|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object bibliothek.gui.dock.support.mode.ModeManager<Location,M> bibliothek.gui.dock.facile.mode.LocationModeManager<M>
M
- the kind of mode this manager handlespublic class LocationModeManager<M extends LocationMode>
ModeManager
for the location of a Dockable
. This manager is able to
work together with CControl
or together with DockController
. Clients
using it together with a DockController
need to set icons for the
modes manually, they can use the IconManager
and the keys provided in
each mode (e.g. NormalMode.ICON_IDENTIFIER
).
Field Summary | |
---|---|
static PropertyKey<DoubleClickLocationStrategy> |
DOUBLE_CLICK_STRATEGY
PropertyKey for the DoubleClickLocationStrategy that should be used
to change the ExtendedMode of an element which has been double-clicked. |
static PropertyKey<ExtendedModeEnablementFactory> |
MODE_ENABLEMENT
PropertyKey for the ExtendedModeEnablement that should be used
by a LocationModeManager to activate and deactivate the modes. |
Constructor Summary | |
---|---|
LocationModeManager(DockController controller)
Creates a new manager. |
Method Summary | |
---|---|
void |
addListener(Path identifier,
LocationModeListener listener)
Adds a listener to the mode with unique identifier identifier . |
protected void |
applyDuringRead(String key,
Path old,
Path current,
Dockable dockable)
Ignores the call, the position of Dockable s is set elsewhere. |
void |
destroy()
Unregisters listeners which this manager added to the DockController and
other components. |
void |
ensureNotHidden(Dockable dockable)
Ensures that dockable is not hidden behind another
Dockable . |
void |
ensureValidLocation(Dockable dockable)
Empty method evaluating the correct location of a Dockable . |
M |
getCurrentMode(Dockable dockable)
Tries to find the mode dockable is currently in. |
DoubleClickLocationStrategy |
getDoubleClickStrategy()
Gets the current strategy for handing double-clicks. |
ExtendedMode |
getMode(Dockable dockable)
Gets the current mode of dockable . |
Map<ExtendedMode,DockStation> |
getRepresentations(String id)
Checks all LocationMode s of this manager and returns all
DockStation s that were registered with the given id. |
boolean |
isLayouting()
Tells whether this mode is currently in layouting mode. |
boolean |
isModeAvailable(Dockable dockable,
ExtendedMode mode)
Using the current ExtendedModeEnablement this method tells whether
mode mode can be applied to dockable . |
void |
removeListener(Path identifier,
LocationModeListener listener)
Removes a listener from the mode identifier . |
void |
runLayoutTransaction(Runnable run)
Activates the layout mode while run
is running. |
void |
setDoubleClickStrategy(DoubleClickLocationStrategy strategy)
Sets the current strategy for handling double-clicks on Dockable s. |
void |
setMode(Dockable dockable,
ExtendedMode extendedMode)
Sets the current mode of dockable . |
protected void |
updateEnablement()
Updates the current ExtendedModeEnablement using the factory
provided by MODE_ENABLEMENT . |
Methods inherited from class bibliothek.gui.dock.support.mode.ModeManager |
---|
add, addAffected, addEmpty, addModeManagerListener, apply, apply, apply, apply, apply, apply, createEntryDuringRead, createModeSettings, createSettings, fireAdded, fireAdded, fireModeChanged, fireRemoved, fireRemoved, getController, getDefaultMode, getDoubleClickTarget, getKey, getMode, getModeHistory, getPreviousMode, getProperties, getPropertyHistory, isEmpty, isOnContinuous, isOnTransaction, isRegistered, listDockables, listeners, modes, put, putFactory, putMode, readSettings, rebuild, rebuildAll, reduceToEmpty, refresh, refresh, remove, removeEmpty, removeMode, removeModeManagerListener, runTransaction, runTransaction, runTransaction, runTransaction, setProperties, store, store, toString, writeSettings |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final PropertyKey<ExtendedModeEnablementFactory> MODE_ENABLEMENT
PropertyKey
for the ExtendedModeEnablement
that should be used
by a LocationModeManager
to activate and deactivate the modes.
public static final PropertyKey<DoubleClickLocationStrategy> DOUBLE_CLICK_STRATEGY
PropertyKey
for the DoubleClickLocationStrategy
that should be used
to change the ExtendedMode
of an element which has been double-clicked.
Constructor Detail |
---|
public LocationModeManager(DockController controller)
controller
- the controller in whose realm this manager will workMethod Detail |
---|
public void destroy()
ModeManager
DockController
and
other components.
destroy
in class ModeManager<Location,M extends LocationMode>
protected void updateEnablement()
ExtendedModeEnablement
using the factory
provided by MODE_ENABLEMENT
.
public void setMode(Dockable dockable, ExtendedMode extendedMode)
dockable
.
dockable
- the dockable whose mode is to be setextendedMode
- the mode
IllegalArgumentException
- if extendedMode
is unknownpublic ExtendedMode getMode(Dockable dockable)
dockable
.
dockable
- the element whose mode is searched
null
if not foundpublic Map<ExtendedMode,DockStation> getRepresentations(String id)
LocationMode
s of this manager and returns all
DockStation
s that were registered with the given id. The same
station or the same id might be used for different modes.
id
- the id of some station
null
, can be emptyprotected void applyDuringRead(String key, Path old, Path current, Dockable dockable)
Dockable
s is set elsewhere.
applyDuringRead
in class ModeManager<Location,M extends LocationMode>
key
- the identifier of dockable
old
- the mode dockable
is currently incurrent
- the mode dockable
is going to bedockable
- the element that changes its mode, might be null
public boolean isModeAvailable(Dockable dockable, ExtendedMode mode)
ExtendedModeEnablement
this method tells whether
mode mode
can be applied to dockable
.
dockable
- some element, not null
mode
- some mode, not null
ExtendedModeEnablement.isAvailable(Dockable, ExtendedMode)
public void addListener(Path identifier, LocationModeListener listener)
identifier
. If the
mode is exchanged then this listener is automatically removed and may be re-added
to the new mode.
identifier
- the identifier of some mode (not necessarily registered yet).listener
- the new listener, not null
public void removeListener(Path identifier, LocationModeListener listener)
identifier
.
identifier
- the name of a modelistener
- the listener to removepublic M getCurrentMode(Dockable dockable)
ModeManager
dockable
is currently in. This method
calls Mode.isCurrentMode(Dockable)
and returns the first
Mode
where the answer was true
.
getCurrentMode
in class ModeManager<Location,M extends LocationMode>
dockable
- some dockable, not null
null
if not foundpublic DoubleClickLocationStrategy getDoubleClickStrategy()
null
setDoubleClickStrategy(DoubleClickLocationStrategy)
public void setDoubleClickStrategy(DoubleClickLocationStrategy strategy)
Dockable
s. This
strategy will be asked what mode to assign to an element that has been double-clicked.
Results that are not allowed by the current ExtendedModeEnablement
are ignored.
strategy
- the new strategy, can be null
to set the default strategypublic boolean isLayouting()
true
if layouting mode is activepublic void runLayoutTransaction(Runnable run)
layout mode
while run
is running.
run
- some code to executepublic void ensureNotHidden(Dockable dockable)
dockable
is not hidden behind another
Dockable
. That does not mean that dockable
becomes
visible, just that it is easier reachable without the need to change
modes of any Dockable
s.layouting mode
dockable
- the element which should not be hiddenpublic void ensureValidLocation(Dockable dockable)
Dockable
. To be
overridden by subclasses to handle elements which have additional restrictions.
dockable
- the element to check
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |