M - the kind of mode this manager handlespublic class LocationModeManager<M extends LocationMode> extends ModeManager<Location,M>
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).| Modifier and Type | Field and Description |
|---|---|
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 and Description |
|---|
LocationModeManager(DockController controller)
Creates a new manager.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addListener(Path identifier,
LocationModeListener listener)
Adds a listener to the mode with unique identifier
identifier. |
void |
apply(Dockable dockable,
ExtendedMode extendedMode,
CGroupMovement action)
Executes
action in a transaction assuming that the result of this action will lead to
dockable having the new mode extendedMode. |
void |
apply(Dockable dockable,
M mode,
Location history,
AffectedSet set)
Alters the mode of
dockable to be mode. |
protected void |
applyDuringRead(String key,
Path old,
Path current,
Dockable dockable)
Ignores the call, the position of
Dockables is set elsewhere. |
void |
delayedRefresh(Dockable dockable)
If the
DockRegister is currently stalled, then a call to ModeManager.refresh(Dockable, boolean)
is scheduled, otherwise the call is performed directly. |
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. |
CGroupMovement |
getCurrentAction()
Gets the action that is currently carried out.
|
M |
getCurrentMode(Dockable dockable)
Tries to find the mode
dockable is currently in. |
DoubleClickLocationStrategy |
getDoubleClickStrategy()
Gets the current strategy for handing double-clicks.
|
CGroupBehavior |
getGroupBehavior()
Gets the current group behavior.
|
ExtendedMode |
getMode(Dockable dockable)
Gets the current mode of
dockable. |
Map<ExtendedMode,DockStation> |
getRepresentations(String id)
Checks all
LocationModes of this manager and returns all
DockStations that were registered with the given id. |
DockActionSource |
getSharedActions(DockStation station)
Gets a list of actions that should be shown on
station depending on the
current children of station. |
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. |
boolean |
isModeHidden(Dockable dockable,
ExtendedMode mode)
Using the current
ExtendedModeEnablement this method tells whether
mode mode is hidden from the user when looking at 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
Dockables. |
void |
setGroupBehavior(CGroupBehavior behavior)
Sets the group behavior.
|
void |
setLocationAside(Dockable dockable,
Dockable aside)
Iterates through all the
LocationModes for which aside has stored locations,
and sets dockable as neighbor. |
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. |
add, addAffected, addEmpty, addModeManagerListener, addToModeHistory, apply, apply, apply, apply, apply, createEntryDuringRead, createModeSettings, createSettings, fireAdded, fireAdded, fireModeChanged, fireRemoved, fireRemoved, getController, getDefaultMode, getDoubleClickTarget, getFactories, getHistory, getHistoryRewriter, getKey, getMode, getModeHistory, getPreviousMode, getProperties, getPropertyHistory, isEmpty, isOnContinuous, isOnTransaction, isRegistered, listDockables, listeners, modes, put, putFactory, putMode, readSettings, readSettings, rebuild, rebuildAll, reduceToEmpty, refresh, refresh, remove, removeEmpty, removeMode, removeModeManagerListener, runTransaction, runTransaction, runTransaction, runTransaction, setHistoryRewriter, setProperties, store, store, toString, writeSettingspublic 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.public LocationModeManager(DockController controller)
controller - the controller in whose realm this manager will workpublic void destroy()
ModeManagerDockController and
other components.destroy in class ModeManager<Location,M extends LocationMode>protected void updateEnablement()
ExtendedModeEnablement using the factory
provided by MODE_ENABLEMENT.public void setGroupBehavior(CGroupBehavior behavior)
setMode(Dockable, ExtendedMode) is called and
modifies the call such that another Dockable receives the event. Any call directly to any of
the apply methods will not be modified by the group behavior.behavior - the new behavior, not nullpublic CGroupBehavior getGroupBehavior()
nullsetGroupBehavior(CGroupBehavior)public void setMode(Dockable dockable, ExtendedMode extendedMode)
dockable.dockable - the dockable whose mode is to be setextendedMode - the modeIllegalArgumentException - if extendedMode is unknownpublic CGroupMovement getCurrentAction()
nullpublic void apply(Dockable dockable, ExtendedMode extendedMode, CGroupMovement action)
action in a transaction assuming that the result of this action will lead to
dockable having the new mode extendedMode.dockable - the primary Dockable, this item may very well be the new focus ownerextendedMode - the expected mode dockable will have after action completedaction - the action to executepublic ExtendedMode getMode(Dockable dockable)
dockable.dockable - the element whose mode is searchednull if not foundpublic Map<ExtendedMode,DockStation> getRepresentations(String id)
LocationModes of this manager and returns all
DockStations 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 stationnull, can be emptyprotected void applyDuringRead(String key, Path old, Path current, Dockable dockable)
Dockables is set elsewhere.applyDuringRead in class ModeManager<Location,M extends LocationMode>key - the identifier of dockableold - the mode dockable is currently incurrent - the mode dockable is going to bedockable - the element that changes its mode, might be nullpublic void apply(Dockable dockable, M mode, Location history, AffectedSet set)
ModeManagerdockable to be mode.
This method does not alter the modes of other dockables, notice however
that the methods Mode.apply(Dockable, Object, AffectedSet) may
trigger additional mode-changes.apply in class ModeManager<Location,M extends LocationMode>dockable - the element whose mode is changedmode - the new mode of dockablehistory - history information for Mode.apply(Dockable, Object, AffectedSet),
can be nullset - to store elements that have changedpublic boolean isModeAvailable(Dockable dockable, ExtendedMode mode)
ExtendedModeEnablement this method tells whether
mode mode can be applied to dockable.dockable - some element, not nullmode - some mode, not nullExtendedModeEnablement.isAvailable(Dockable, ExtendedMode)public boolean isModeHidden(Dockable dockable, ExtendedMode mode)
ExtendedModeEnablement this method tells whether
mode mode is hidden from the user when looking at dockable. A hidden
modedockable - some element, not nullmode - some mode, not nullExtendedModeEnablement.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 nullpublic void removeListener(Path identifier, LocationModeListener listener)
identifier.identifier - the name of a modelistener - the listener to removepublic M getCurrentMode(Dockable dockable)
ModeManagerdockable 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 nullnull if not foundpublic DoubleClickLocationStrategy getDoubleClickStrategy()
nullsetDoubleClickStrategy(DoubleClickLocationStrategy)public void setDoubleClickStrategy(DoubleClickLocationStrategy strategy)
Dockables. 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 Dockables.layouting modedockable - 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 checkpublic void setLocationAside(Dockable dockable, Dockable aside)
LocationModes for which aside has stored locations,
and sets dockable as neighbor. This method does not change the actual location of dockable,
rather a call to apply would be necessary to update the location.dockable can actually be placed at any
location where aside ever was.dockable - the item whose location should changeaside - the item whose neighbor is setpublic DockActionSource getSharedActions(DockStation station)
ModeManagerstation depending on the
current children of station. This method is called every time when either
a child is added, removed or selected on station.getSharedActions in class ModeManager<Location,M extends LocationMode>station - the station whose actions are askednullpublic void delayedRefresh(Dockable dockable)
DockRegister is currently stalled, then a call to ModeManager.refresh(Dockable, boolean)
is scheduled, otherwise the call is performed directly.dockable - the dockable which should be forwarded to ModeManager.refresh(Dockable, boolean)Copyright © 2018. All rights reserved.