Package bibliothek.gui.dock.support.mode
Interface Mode<H>
- Type Parameters:
H- class storing history information
- All Known Subinterfaces:
CLocationMode,LocationMode
- All Known Implementing Classes:
AbstractLocationMode,CExternalizedMode,CMaximizedMode,CMinimizedMode,CNormalMode,DefaultLocationMode,ExternalizedMode,MaximizedMode,MinimizedMode,NormalMode
public interface Mode<H>
A mode describes a state in which a
Dockable can be. A Dockable
can be in exactly one Mode at a time. Notice that the mode may
change through events that are not registered or influenced by this
mode.- Author:
- Benjamin Sigg
-
Method Summary
Modifier and TypeMethodDescriptionbooleanapply(Dockable dockable, H history, AffectedSet set) Applies this mode todockable.Provides history information about the current state ofdockablein respect to this mode.getActionsFor(Dockable dockable, Mode<H> mode) Gets a factory for creating newModeSettings.Gets a unique identifier, only thisModemust have this identifier.booleanisCurrentMode(Dockable dockable) Tells whetherdockablefulfills the requirements of this mode, meaning whetherdockablehas this mode.booleanisDefaultMode(Dockable dockable) Checks whether this mode is a default mode ofdockable.voidreadSetting(ModeSetting<H> setting) Sets the properties of this mode.voidwriteSetting(ModeSetting<H> setting) Gets the current properties of this mode in an independent way.
-
Method Details
-
getActionsFor
Gets aDockActionSourcewhich should be shown ondockablewhich is currently inmode. This method will be called every time whendockablechanges its mode.- Parameters:
dockable- some element, notnullmode- the mode ofdockable, notnull- Returns:
- the actions for
dockable, can benull
-
getUniqueIdentifier
Path getUniqueIdentifier()Gets 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.
-
apply
Applies this mode todockable. This method may fail for example because aDockAcceptancedoes preventdockablefrom being moved.- Parameters:
dockable- the element whose mode becomesthishistory- history information that was returned by this mode on its last call tocurrent(Dockable). May benullif this mode was never applied or returnsnulloncurrent(Dockable).set- this method has to store allDockables which might have changed their mode in the set.- Returns:
trueifdockablewas successfully moved on its parent or to a new parent, orfalseifdockabledid not change its location
-
current
Provides history information about the current state ofdockablein respect to this mode.- Parameters:
dockable- the element- Returns:
- history information that is needed when calling
apply(Dockable, Object, AffectedSet)
-
isDefaultMode
Checks 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
-
isCurrentMode
Tells whetherdockablefulfills the requirements of this mode, meaning whetherdockablehas this mode. There should be only at most one mode which returnstruefor this question. Please note, the mode selected in theModeManagermay be out of date, and should not be considered when checking the current mode.- Parameters:
dockable- some dockable, notnull- Returns:
- whether
dockableis inthismode
-
writeSetting
Gets 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
Sets 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
-
getSettingFactory
ModeSettingFactory<H> getSettingFactory()Gets a factory for creating newModeSettings.- Returns:
- the factory, can be
null
-