Package bibliothek.gui.dock.facile.mode
Class MaximizedMode<M extends MaximizedModeArea>
java.lang.Object
bibliothek.gui.dock.facile.mode.AbstractLocationMode<M>
bibliothek.gui.dock.facile.mode.MaximizedMode<M>
- Type Parameters:
M- the kind of areas this mode handles
- All Implemented Interfaces:
LocationMode,Mode<Location>,Iterable<M>
- Direct Known Subclasses:
CMaximizedMode
Dockables are maximized if they take up the whole space a frame
or a screen offers.- Author:
- Benjamin Sigg
-
Nested Class Summary
Nested classes/interfaces inherited from class bibliothek.gui.dock.facile.mode.AbstractLocationMode
AbstractLocationMode.DockableHandle -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringthe key used for theIconManagerto read theIconfor the "maximize"-actionstatic final Pathunique identifier for this mode -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedEmpty default constructor.MaximizedMode(CControl control) Creates a new modeMaximizedMode(DockController controller) Creates a new mode. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidapplyDone(LocationModeEvent event) protected voidapplyStarting(LocationModeEvent event) Provides history information about the current state ofdockablein respect to this mode.voidensureNotHidden(Dockable dockable) Ensures that noDockablethat has this mode hidesdockable.Gets the unique identifier of this mode.getMaximizeArea(Dockable dockable) Searches the firstMaximizedModeAreawhich is a parent ofdockable.getMaximizeArea(Dockable dockable, Location history) Gets the area to whichdockableshould be maximized.getMaximizeArea(DockStation station) Searches the oneMaximizedModeAreawhose station isstation.getMaximizingElement(Dockable dockable) Gets the element which must be maximized when the user requests thatdockableis maximized.getMaximizingElement(Dockable old, Dockable dockable) Gets the element which would be maximized ifoldis currently maximized, anddockableis or will not be maximized.getNextMaximizeArea(DockStation station) Searches theMaximizedModeAreawhich either representsstationor its nearest parent.Gets a factory for creating newModeSettings.Gets a unique identifier, only thisModemust have this identifier.getUnmaximizedMode(Dockable dockable) Assumingdockableis a maximized element, tells which mode would be the preferred mode for unmaximization.booleanisCurrentMode(Dockable dockable) If this method is not able to clearly find out whetherdockablehas this mode, it returnsfalse.booleanisDefaultMode(Dockable dockable) Checks whether this mode is a default mode ofdockable.booleanisRepresenting(DockStation station) Tells whether this mode knowsstationand represents the mode children ofstationare in.booleanmaximize(MaximizedModeArea area, Dockable dockable, Location history, AffectedSet set) Ensures thatdockableis maximized.voidmaximize(MaximizedModeArea area, Dockable dockable, AffectedSet set) Ensures thatdockableis maximized.protected booleanInvoked whenever a key is pressed, released or typed.voidreadSetting(ModeSetting<Location> setting) Sets the properties of this mode.booleanrunApply(Dockable dockable, Location history, AffectedSet set) Called byAbstractLocationMode.apply(Dockable, Location, AffectedSet)after theLocationModeListeners are informed.voidsetManager(LocationModeManager<?> manager) Sets the manager which is using this mode.booleanswitchMode(Dockable dockable) Tries to switch the current mode ofdockableto or from the maximized mode.voidunmaximize(MaximizedModeArea area, AffectedSet affected) Ensures thatareahas no maximized child.voidunmaximize(Dockable dockable, AffectedSet set) Ensures thatdockableis not maximized.voidunmaximize(DockStation station, AffectedSet affected) Ensures that either theMaximizedModeAreastationor its nearest parent does not show a maximized element.voidwriteSetting(ModeSetting<Location> setting) Gets the current properties of this mode in an independent way.Methods inherited from class bibliothek.gui.dock.facile.mode.AbstractLocationMode
add, addLocationModeListener, apply, aside, createHandle, get, get, get, get, getActionsFor, getController, getDefaultArea, getManager, getRepresentation, getRepresentationIds, isModeAvailable, isModeHidden, iterator, listeners, remove, removeLocationModeListener, setActionProvider, setController, setDefaultArea, setShouldAutoFocus, shouldAutoFocusMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
IDENTIFIER
unique identifier for this mode -
ICON_IDENTIFIER
the key used for theIconManagerto read theIconfor the "maximize"-action- See Also:
-
-
Constructor Details
-
MaximizedMode
protected MaximizedMode()Empty default constructor. Subclasses should callAbstractLocationMode.setActionProvider(LocationModeActionProvider)to complete initialization of this mode. -
MaximizedMode
Creates a new mode- Parameters:
control- the control in whose realm this mode will work
-
MaximizedMode
Creates a new mode.- Parameters:
controller- the owner of this mode
-
-
Method Details
-
setManager
Description copied from interface:LocationModeSets the manager which is using this mode.- Specified by:
setManagerin interfaceLocationMode- Overrides:
setManagerin classAbstractLocationMode<M extends MaximizedModeArea>- Parameters:
manager- the manager ornull
-
getUniqueIdentifier
Description copied from interface:ModeGets a unique identifier, only thisModemust have this identifier. Identifiers with the first segment being "dock" are reserved for this framework, clients may choose any other identifiers.- Returns:
- the identifier, not
null, should contain at least one segment.
-
getExtendedMode
Description copied from interface:LocationModeGets the unique identifier of this mode.- Returns:
- the unique identifier
-
runApply
Description copied from class:AbstractLocationModeCalled byAbstractLocationMode.apply(Dockable, Location, AffectedSet)after theLocationModeListeners are informed. Applies this mode todockable.- Specified by:
runApplyin classAbstractLocationMode<M extends MaximizedModeArea>- Parameters:
dockable- the element whose mode becomesthishistory- history information that was returned by this mode when callingMode.current(Dockable)the last time.set- this method has to store allDockables which might have changed their mode in the set.- Returns:
trueifdockablewas moved,falseif the method failed to set the location ofdockablefor any reason
-
current
Description copied from interface:ModeProvides history information about the current state ofdockablein respect to this mode.- Parameters:
dockable- the element- Returns:
- history information that is needed when calling
Mode.apply(Dockable, Object, AffectedSet)
-
isCurrentMode
Description copied from interface:LocationModeIf this method is not able to clearly find out whetherdockablehas this mode, it returnsfalse. TheLocationModeManagerwill ask again with the parent station ofdockable.- Parameters:
dockable- some dockable, notnull- Returns:
- whether
dockableis inthismode
-
isDefaultMode
Description copied from interface:ModeChecks whether this mode is a default mode ofdockable. A default mode is a mode that is chosen per default, if no other mode is selected. There should be only one default-mode perDockable.- Parameters:
dockable- some dockable, notnull- Returns:
- whether this is a default mode
-
isRepresenting
Description copied from interface:LocationModeTells whether this mode knowsstationand represents the mode children ofstationare in.- Specified by:
isRepresentingin interfaceLocationMode- Overrides:
isRepresentingin classAbstractLocationMode<M extends MaximizedModeArea>- Parameters:
station- the station which is to be tested- Returns:
- whether this mode is represented by
station
-
getUnmaximizedMode
Assumingdockableis a maximized element, tells which mode would be the preferred mode for unmaximization.- Parameters:
dockable- some child- Returns:
- the preferred unmaximized mode, can be
null
-
maximize
Ensures thatdockableis maximized.- Parameters:
area- the future parent ofdockable, can benulldockable- the element that should be made maximizedset- a set ofDockables which will be filled by the elements that change their mode because of this method
-
maximize
public boolean maximize(MaximizedModeArea area, Dockable dockable, Location history, AffectedSet set) Ensures thatdockableis maximized.- Parameters:
area- the future parent ofdockable, can benulldockable- the element that should be made maximizedhistory- the expected location ofdockableafter this method has finished, can benull. No guarantees are given that the final location matcheshistory.set- a set ofDockables which will be filled by the elements that change their mode because of this method- Returns:
- whether the operation was a success
-
unmaximize
Ensures thatdockableis not maximized. Does nothing if the parentMaximizedModeAreaofdockablehas not maximizeddockableor if theLocationModeManagerdoes not knowdockable.- Parameters:
dockable- the element that might be maximized currentlyset- a set ofDockables which will be filled by the elements that change their mode because of this method
-
getNextMaximizeArea
Searches theMaximizedModeAreawhich either representsstationor its nearest parent.- Parameters:
station- some station- Returns:
- the nearest area or
null
-
unmaximize
Ensures that either theMaximizedModeAreastationor its nearest parent does not show a maximized element.- Parameters:
station- an area or a child of an areaaffected- elements whose mode changes will be added to this set
-
unmaximize
Ensures thatareahas no maximized child.- Parameters:
area- some areaaffected- the element whose mode might change
-
ensureNotHidden
Description copied from interface:LocationModeEnsures that noDockablethat has this mode hidesdockable. Note thatdockablemay or may not be in this mode.- Parameters:
dockable- the element which must not be hidden
-
getMaximizeArea
Gets the area to whichdockableshould be maximized. This can begetMaximizeArea(Dockable), or some other station.- Parameters:
dockable- the element that is maximizedhistory- the history of the last place wheredockablewas maximized, might benull- Returns:
- the preferred area to maximize
dockable
-
getMaximizeArea
Searches the firstMaximizedModeAreawhich is a parent ofdockable. This method will never returndockableitself.- Parameters:
dockable- the element whose maximize area is searched- Returns:
- the area or
null
-
getMaximizeArea
Searches the oneMaximizedModeAreawhose station isstation.- Parameters:
station- the station whose area is searched- Returns:
- the area or
nullif not found
-
getMaximizingElement
Gets the element which must be maximized when the user requests thatdockableis maximized.- Parameters:
dockable- some element, notnull- Returns:
- the element that must be maximized, might be
dockableitself, notnull
-
getMaximizingElement
Gets the element which would be maximized ifoldis currently maximized, anddockableis or will not be maximized.- Parameters:
old- some elementdockable- some element, might beold- Returns:
- the element which would be maximized if
dockableis no longer maximized, can benull
-
applyStarting
-
applyDone
-
getSettingFactory
Description copied from interface:ModeGets a factory for creating newModeSettings.- Returns:
- the factory, can be
null
-
writeSetting
Description copied from interface:ModeGets the current properties of this mode in an independent way.- Parameters:
setting- aModeSettingwith the same id as thisMode. This setting was created by aModeSettingFactorywith the same id as thisMode.
-
readSetting
Description copied from interface:ModeSets the properties of this mode. This method will only be called with aModeSettingthat has been created by the currentModeSettingFactory- Parameters:
setting- the new set of properties, notnull
-
process
Invoked whenever a key is pressed, released or typed.- Parameters:
dockable- the element to which the event belongsevent- the event- Returns:
trueif the event has been processed,falseif the event was not used up.
-
switchMode
Tries to switch the current mode ofdockableto or from the maximized mode.- Parameters:
dockable- the element whose mode is to be changed- Returns:
- whether the operation was successful
-