Package bibliothek.gui.dock.common.mode
Class CLocationModeManager
java.lang.Object
bibliothek.gui.dock.support.mode.ModeManager<Location,M>
bibliothek.gui.dock.facile.mode.LocationModeManager<CLocationMode>
bibliothek.gui.dock.common.mode.CLocationModeManager
LocationModeManager providing additional methods for working with
CLocations, CommonDockables and other items specific to the
common project.- Author:
- Benjamin Sigg
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringthe key used for theIconManagerto read theIconfor the "externalize"-actionstatic final Stringthe key used for theIconManagerto read theIconfor the "maximize"-actionstatic final Stringthe key used for theIconManagerto read theIconfor the "minimize"-actionstatic final Stringthe key used for theIconManagerto read theIconfor the "normalize"-actionstatic final Stringthe key used for theIconManagerto read theIconfor the "unexternalize"-actionstatic final Stringthe key used for theIconManagerto read theIconfor the "unmaximize externalized"-actionFields inherited from class bibliothek.gui.dock.facile.mode.LocationModeManager
DOUBLE_CLICK_STRATEGY, MODE_ENABLEMENT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionchildsExtendedMode(DockStation parent) Guesses the result ofLocationModeManager.getCurrentMode(Dockable)once aDockableis dropped ontoDockStation.protected booleanTells whether an entry for a missingDockableshould be created.<B> ModeSettings<Location,B> createModeSettings(ModeSettingsConverter<Location, B> converter) Creates the empty set of settings for thisModeManager.booleanEnsures that all dockables are in a basic mode.
This method returns immediately if inlayouting modevoidensureValidLocation(CDockable dockable) This method compares the current mode ofdockablewith its availability set.voidensureValidLocation(Dockable dockable) Empty method evaluating the correct location of aDockable.protected CStation<?>Searchesdockableand its parent for the firstCStationthat is a working area.getDropLocation(CStation<?> station) Tries to find the "optimal spot" where to put a new child ontostation.Direct access to the mode handling "externalized"Dockables.getLocation(Dockable dockable) Gets an element describing the location ofdockableas good as possible.getLocation(Dockable dockable, ExtendedMode mode) Assuming thatdockableis currently not in modemode, then this method searches for the previously stored location ofdockable.Direct access to the mode handling "maximized"Dockables.Direct access to the mode handling "minimized"Dockables.Direct access to the mode handling "normal"Dockables.voidreadSettings(ModeSettings<Location, ?> settings) Reads the contents ofsettingsand stores it.readSettings(ModeSettings<Location, ?> settings, UndoableModeSettings pending) Reads the contents ofsettings, creates new entries if eitherModeManager.createEntryDuringRead(String)or ifpendingallows the setting to be undone if not needed.voidRemoves the properties that belong todockable.voidUpdates 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.voidsetLocation(Dockable dockable, CLocation location) Tries to set the location ofdockable.voidsetLocation(Dockable dockable, ExtendedMode mode, CLocation location) Sets the default location ofdockablewhen going intomode.Methods inherited from class bibliothek.gui.dock.facile.mode.LocationModeManager
addListener, apply, apply, applyDuringRead, delayedRefresh, destroy, ensureNotHidden, getCurrentAction, getCurrentMode, getDoubleClickStrategy, getGroupBehavior, getMode, getRepresentations, getSharedActions, isLayouting, isModeAvailable, isModeHidden, removeListener, runLayoutTransaction, setDoubleClickStrategy, setGroupBehavior, setLocationAside, setMode, updateEnablementMethods inherited from class bibliothek.gui.dock.support.mode.ModeManager
add, addAffected, addEmpty, addModeManagerListener, addToModeHistory, apply, apply, apply, apply, apply, 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, rebuild, rebuildAll, reduceToEmpty, refresh, refresh, removeEmpty, removeMode, removeModeManagerListener, runTransaction, runTransaction, runTransaction, runTransaction, setHistoryRewriter, setProperties, store, store, toString, writeSettings
-
Field Details
-
ICON_MANAGER_KEY_MINIMIZE
the key used for theIconManagerto read theIconfor the "minimize"-action- See Also:
-
ICON_MANAGER_KEY_MAXIMIZE
the key used for theIconManagerto read theIconfor the "maximize"-action- See Also:
-
ICON_MANAGER_KEY_NORMALIZE
the key used for theIconManagerto read theIconfor the "normalize"-action- See Also:
-
ICON_MANAGER_KEY_EXTERNALIZE
the key used for theIconManagerto read theIconfor the "externalize"-action- See Also:
-
ICON_MANAGER_KEY_UNEXTERNALIZE
the key used for theIconManagerto read theIconfor the "unexternalize"-action- See Also:
-
ICON_MANAGER_KEY_UNMAXIMIZE_EXTERNALIZED
the key used for theIconManagerto read theIconfor the "unmaximize externalized"-action- See Also:
-
-
Constructor Details
-
CLocationModeManager
Creates a new manager.- Parameters:
control- the control in whose realm this manager works
-
-
Method Details
-
getNormalMode
Direct access to the mode handling "normal"Dockables.- Returns:
- the mode
-
getMaximizedMode
Direct access to the mode handling "maximized"Dockables.- Returns:
- the mode
-
getMinimizedMode
Direct access to the mode handling "minimized"Dockables.- Returns:
- the mode
-
getExternalizedMode
Direct access to the mode handling "externalized"Dockables.- Returns:
- the mode
-
createEntryDuringRead
Description copied from class:ModeManagerTells whether an entry for a missingDockableshould be created. This will result in a call toModeManager.addEmpty(String)duringModeManager.readSettings(ModeSettings). The default implementation returns alwaysfalse.- Overrides:
createEntryDuringReadin classModeManager<Location,CLocationMode> - Parameters:
key- the key for which to create a new entry- Returns:
trueif an entry should be created
-
remove
Description copied from class:ModeManagerRemoves the properties that belong todockable.- Overrides:
removein classModeManager<Location,CLocationMode> - Parameters:
dockable- the element to remove
-
createModeSettings
Description copied from class:ModeManagerCreates the empty set of settings for thisModeManager. Subclasses may override this method to use another set of settings. This method does not need to callModeSettings.addFactory(ModeSettingFactory).- Overrides:
createModeSettingsin classModeManager<Location,CLocationMode> - Type Parameters:
B- the intermediate format- Parameters:
converter- conversion tool from this manager's meta-data format to the intermediate format.- Returns:
- the new empty settings
-
readSettings
Description copied from class:ModeManagerReads the contents ofsettingsand stores it.- Overrides:
readSettingsin classModeManager<Location,CLocationMode> - Parameters:
settings- the settings to read
-
readSettings
Description copied from class:ModeManagerReads the contents ofsettings, creates new entries if eitherModeManager.createEntryDuringRead(String)or ifpendingallows the setting to be undone if not needed.- Overrides:
readSettingsin classModeManager<Location,CLocationMode> - Parameters:
settings- the settings to readpending- undoable settings, can benull- Returns:
- an algorithm that will remove any entry that was created because
pendingdid advise so,nullifpendingwasnull
-
setLocation
Tries to set the location ofdockable. Does nothing iflocationis invalid or requires information that is not available. Ifdockableis aCommonDockableand themoderespectsworking-areas, then the working-area is set or removed depending on the value ofCStation.isWorkingArea().- Parameters:
dockable- the element to movelocation- the new location ofdockable
-
setLocation
Sets the default location ofdockablewhen going intomode. The properties set here will be overridden as soon as the user dragsdockableto another location (within the same mode) ordockableis removed permanently.
This method has no effect ifdockableis already inmode. There is also no effect ifdockablehas not been registered at theCLocationModeManager.
Note: it is the clients responsibility to ensure thatlocationandmodebelong to each other.- Parameters:
dockable- the element whose location will be setmode- the mode for which the location is to be set ornulllocation- the new location- Throws:
IllegalArgumentException- if either argument isnullor ifCLocation.findRoot()orCLocation.findProperty()returnsnull
-
getLocation
Gets an element describing the location ofdockableas good as possible.- Parameters:
dockable- the element whose location should be searched- Returns:
- the location or
nullif no location was found
-
getLocation
Assuming thatdockableis currently not in modemode, then this method searches for the previously stored location ofdockable. Note that this method can't tell wheredockablewould be shown if it never was in that mode and the client never specified the location.- Parameters:
dockable- the dockable whose location is searchedmode- the mode which might be taken bydockable- Returns:
- the location or
null - Throws:
IllegalArgumentException- if any argument isnull
-
getDropLocation
Tries to find the "optimal spot" where to put a new child ontostation. In this case the optimal spot isCLocation.aside()the latest focused child ofstation.- Parameters:
station- the station where aCDockableis about to be dropped onto- Returns:
- the preferred location of the new child
-
ensureValidLocation
Description copied from class:LocationModeManagerEmpty method evaluating the correct location of aDockable. To be overridden by subclasses to handle elements which have additional restrictions.- Overrides:
ensureValidLocationin classLocationModeManager<CLocationMode>- Parameters:
dockable- the element to check
-
ensureValidLocation
This method compares the current mode ofdockablewith its availability set. If the current mode is not available, thendockableis put into another mode (usually thenormal mode).
This method also checks the working area, provided that the current mode respects the working-area settings.
This method returns immediately if inlayouting 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 inlayouting mode- Returns:
trueif at least one element was affected by changes,falseif 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
Guesses the result ofLocationModeManager.getCurrentMode(Dockable)once aDockableis dropped ontoDockStation. If more than onemodeis usingparent, then the guess might not always be correct.- Parameters:
parent- some station- Returns:
- the mode its children are in, or
nullif no guess can be made
-
getAreaOf
Searchesdockableand its parent for the firstCStationthat is a working area.- Parameters:
dockable- the element whose working area is searched- Returns:
- the first working area or
null
-