|
||||||||||
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 . |
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 Dockable s 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 LocationMode s of this manager and returns all
DockStation s 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 Dockable s. |
void |
setGroupBehavior(CGroupBehavior behavior)
Sets the group behavior. |
void |
setLocationAside(Dockable dockable,
Dockable aside)
Iterates through all the LocationMode s 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 . |
Methods inherited from class bibliothek.gui.dock.support.mode.ModeManager |
---|
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, 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 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 null
public CGroupBehavior getGroupBehavior()
null
setGroupBehavior(CGroupBehavior)
public void setMode(Dockable dockable, ExtendedMode extendedMode)
dockable
.
dockable
- the dockable whose mode is to be setextendedMode
- the mode
IllegalArgumentException
- if extendedMode
is unknownpublic CGroupMovement getCurrentAction()
null
public 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 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 void apply(Dockable dockable, M mode, Location history, AffectedSet set)
ModeManager
dockable
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 dockable
history
- history information for Mode.apply(Dockable, Object, AffectedSet)
,
can be null
set
- 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 null
mode
- some mode, not null
ExtendedModeEnablement.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
mode
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 checkpublic void setLocationAside(Dockable dockable, Dockable aside)
LocationMode
s 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)
ModeManager
station
depending on the
current children of station
. This method is called everytime 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 asked
null
public 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)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |