bibliothek.gui.dock.common.mode
Class CLocationModeManager

java.lang.Object
  extended by bibliothek.gui.dock.support.mode.ModeManager<Location,M>
      extended by bibliothek.gui.dock.facile.mode.LocationModeManager<CLocationMode>
          extended by bibliothek.gui.dock.common.mode.CLocationModeManager

public class CLocationModeManager
extends LocationModeManager<CLocationMode>

LocationModeManager providing additional methods for working with CLocations, CommonDockables and other items specific to the common project.

Author:
Benjamin Sigg

Field Summary
static String ICON_MANAGER_KEY_EXTERNALIZE
          the key used for the IconManager to read the Icon for the "externalize"-action
static String ICON_MANAGER_KEY_MAXIMIZE
          the key used for the IconManager to read the Icon for the "maximize"-action
static String ICON_MANAGER_KEY_MINIMIZE
          the key used for the IconManager to read the Icon for the "minimize"-action
static String ICON_MANAGER_KEY_NORMALIZE
          the key used for the IconManager to read the Icon for the "normalize"-action
static String ICON_MANAGER_KEY_UNEXTERNALIZE
          the key used for the IconManager to read the Icon for the "unexternalize"-action
static String ICON_MANAGER_KEY_UNMAXIMIZE_EXTERNALIZED
          the key used for the IconManager to read the Icon for the "unmaximize externalized"-action
 
Fields inherited from class bibliothek.gui.dock.facile.mode.LocationModeManager
DOUBLE_CLICK_STRATEGY, MODE_ENABLEMENT
 
Constructor Summary
CLocationModeManager(CControlAccess control)
          Creates a new manager.
 
Method Summary
 ExtendedMode childsExtendedMode(DockStation parent)
          Guesses the result of LocationModeManager.getCurrentMode(Dockable) once a Dockable is dropped onto DockStation.
protected  boolean createEntryDuringRead(String key)
          Tells whether an entry for a missing Dockable should be created.
protected
<B> ModeSettings<Location,B>
createModeSettings(ModeSettingsConverter<Location,B> converter)
          Creates the empty set of settings for this ModeManager.
 boolean ensureBasicModes()
          Ensures that all dockables are in a basic mode.
 void ensureValidLocation(CDockable dockable)
          This method compares the current mode of dockable with its availability set.
 void ensureValidLocation(Dockable dockable)
          Empty method evaluating the correct location of a Dockable.
protected  CStation<?> getAreaOf(Dockable dockable)
          Searches dockable and its parent for the first CStation that is a working area.
 CExternalizedMode getExternalizedMode()
          Direct access to the mode handling "externalized" Dockables.
 CLocation getLocation(Dockable dockable)
          Gets an element describing the location of dockable as good as possible.
 CLocation getLocation(Dockable dockable, ExtendedMode mode)
          Assuming that dockable is currently not in mode mode, then this method searches for the previously stored location of dockable.
 CMaximizedMode getMaximizedMode()
          Direct access to the mode handling "maximized" Dockables.
 CMinimizedMode getMinimizedMode()
          Direct access to the mode handling "minimized" Dockables.
 CNormalMode getNormalMode()
          Direct access to the mode handling "normal" Dockables.
 void readSettings(ModeSettings<Location,?> settings)
           
 void remove(Dockable dockable)
          Removes the properties that belong to dockable.
 void resetWorkingAreaChildren()
          Updates the location of all dockables that should be on a working-area and that are currently in a mode that does not support working-areas.
 void setLocation(Dockable dockable, CLocation location)
          Tries to set the location of dockable.
 void setLocation(Dockable dockable, ExtendedMode mode, CLocation location)
          Sets the default location of dockable when going into mode.
 
Methods inherited from class bibliothek.gui.dock.facile.mode.LocationModeManager
addListener, applyDuringRead, destroy, ensureNotHidden, getCurrentMode, getDoubleClickStrategy, getMode, getRepresentations, isLayouting, isModeAvailable, removeListener, runLayoutTransaction, setDoubleClickStrategy, setMode, updateEnablement
 
Methods inherited from class bibliothek.gui.dock.support.mode.ModeManager
add, addAffected, addEmpty, addModeManagerListener, apply, apply, apply, apply, apply, apply, 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, rebuild, rebuildAll, reduceToEmpty, refresh, refresh, 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

ICON_MANAGER_KEY_MINIMIZE

public static final String ICON_MANAGER_KEY_MINIMIZE
the key used for the IconManager to read the Icon for the "minimize"-action

See Also:
Constant Field Values

ICON_MANAGER_KEY_MAXIMIZE

public static final String ICON_MANAGER_KEY_MAXIMIZE
the key used for the IconManager to read the Icon for the "maximize"-action

See Also:
Constant Field Values

ICON_MANAGER_KEY_NORMALIZE

public static final String ICON_MANAGER_KEY_NORMALIZE
the key used for the IconManager to read the Icon for the "normalize"-action

See Also:
Constant Field Values

ICON_MANAGER_KEY_EXTERNALIZE

public static final String ICON_MANAGER_KEY_EXTERNALIZE
the key used for the IconManager to read the Icon for the "externalize"-action

See Also:
Constant Field Values

ICON_MANAGER_KEY_UNEXTERNALIZE

public static final String ICON_MANAGER_KEY_UNEXTERNALIZE
the key used for the IconManager to read the Icon for the "unexternalize"-action

See Also:
Constant Field Values

ICON_MANAGER_KEY_UNMAXIMIZE_EXTERNALIZED

public static final String ICON_MANAGER_KEY_UNMAXIMIZE_EXTERNALIZED
the key used for the IconManager to read the Icon for the "unmaximize externalized"-action

See Also:
Constant Field Values
Constructor Detail

CLocationModeManager

public CLocationModeManager(CControlAccess control)
Creates a new manager.

Parameters:
control - the control in whose realm this manager works
Method Detail

getNormalMode

public CNormalMode getNormalMode()
Direct access to the mode handling "normal" Dockables.

Returns:
the mode

getMaximizedMode

public CMaximizedMode getMaximizedMode()
Direct access to the mode handling "maximized" Dockables.

Returns:
the mode

getMinimizedMode

public CMinimizedMode getMinimizedMode()
Direct access to the mode handling "minimized" Dockables.

Returns:
the mode

getExternalizedMode

public CExternalizedMode getExternalizedMode()
Direct access to the mode handling "externalized" Dockables.

Returns:
the mode

createEntryDuringRead

protected boolean createEntryDuringRead(String key)
Description copied from class: ModeManager
Tells whether an entry for a missing Dockable should be created. This will result in a call to ModeManager.addEmpty(String) during ModeManager.readSettings(ModeSettings). The default implementation returns always false.

Overrides:
createEntryDuringRead in class ModeManager<Location,CLocationMode>
Parameters:
key - the key for which to create a new entry
Returns:
true if an entry should be created

remove

public void remove(Dockable dockable)
Description copied from class: ModeManager
Removes the properties that belong to dockable.

Overrides:
remove in class ModeManager<Location,CLocationMode>
Parameters:
dockable - the element to remove

createModeSettings

protected <B> ModeSettings<Location,B> createModeSettings(ModeSettingsConverter<Location,B> converter)
Description copied from class: ModeManager
Creates the empty set of settings for this ModeManager. Subclasses may override this method to use another set of settings. This method does not need to call ModeSettings.addFactory(ModeSettingFactory).

Overrides:
createModeSettings in class ModeManager<Location,CLocationMode>
Type Parameters:
B - the intermediate format
Parameters:
converter - converstion tool from this managers meta-data format to the intermediate format.
Returns:
the new empty settings

readSettings

public void readSettings(ModeSettings<Location,?> settings)
Overrides:
readSettings in class ModeManager<Location,CLocationMode>

setLocation

public void setLocation(Dockable dockable,
                        CLocation location)
Tries to set the location of dockable. Does nothing if location is invalid or requires information that is not available. If dockable is a CommonDockable and the mode respects working-areas, then the working-area is set or removed depending on the value of CStation.isWorkingArea().

Parameters:
dockable - the element to move
location - the new location of dockable

setLocation

public void setLocation(Dockable dockable,
                        ExtendedMode mode,
                        CLocation location)
Sets the default location of dockable when going into mode. The properties set here will be overridden as soon as the user drags dockable to another location (within the same mode) or dockable is removed permanently.
This method has no effect if dockable is already in mode. There is also no effect if dockable has not been registered at the CLocationModeManager.
Note: it is the clients responsibility to ensure that location and mode belong to each other.

Parameters:
dockable - the element whose location will be set
mode - the mode for which the location is to be set or null
location - the new location
Throws:
IllegalArgumentException - if either argument is null or if CLocation.findRoot() or CLocation.findProperty() returns null

getLocation

public CLocation getLocation(Dockable dockable)
Gets an element describing the location of dockable as good as possible.

Parameters:
dockable - the element whose location should be searched
Returns:
the location or null if no location was found

getLocation

public CLocation getLocation(Dockable dockable,
                             ExtendedMode mode)
Assuming that dockable is currently not in mode mode, then this method searches for the previously stored location of dockable. Note that this method can't tell where dockable would be shown if it never was in that mode and the client never specified the location.

Parameters:
dockable - the dockable whose location is searched
mode - the mode which might be taken by dockable
Returns:
the location or null
Throws:
IllegalArgumentException - if any argument is null

ensureValidLocation

public void ensureValidLocation(Dockable dockable)
Description copied from class: LocationModeManager
Empty method evaluating the correct location of a Dockable. To be overridden by subclasses to handle elements which have additional restrictions.

Overrides:
ensureValidLocation in class LocationModeManager<CLocationMode>
Parameters:
dockable - the element to check

ensureValidLocation

public void ensureValidLocation(CDockable dockable)
This method compares the current mode of dockable with its availability set. If the current mode is not available, then dockable is put into another mode (usually the normal mode).
This method also checks the working area, provided that the current mode respects the working-area settings.
This method returns immediatelly if in layouting mode

Parameters:
dockable - the element whose mode is to be checked

ensureBasicModes

public boolean ensureBasicModes()
Ensures that all dockables are in a basic mode.
This method returns immediately if in layouting mode

Returns:
true if at least one element was affected by changes, false if nothing happened.

resetWorkingAreaChildren

public void resetWorkingAreaChildren()
Updates the location of all dockables that should be on a working-area and that are currently in a mode that does not support working-areas. The history of the elements is searched for the first mode which supports working-areas. If no such mode is found, then the normal-mode is applied.


childsExtendedMode

public ExtendedMode childsExtendedMode(DockStation parent)
Guesses the result of LocationModeManager.getCurrentMode(Dockable) once a Dockable is dropped onto DockStation. If more than one mode is using parent, then the guess might not always be correct.

Parameters:
parent - some station
Returns:
the mode its children are in, or null if no guess can be made

getAreaOf

protected CStation<?> getAreaOf(Dockable dockable)
Searches dockable and its parent for the first CStation that is a working area.

Parameters:
dockable - the element whose working area is searched
Returns:
the first working area or null