|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbibliothek.gui.dock.support.action.ModeTransitionManager<StateManager.Location>
bibliothek.gui.dock.facile.state.StateManager
public class StateManager
A manager that can minimize/normalize/maximize and externalize a
Dockable
.
FlapDockStation
SplitDockStation
, and
in fullscreen-modeScreenDockStation
Nested Class Summary | |
---|---|
static class |
StateManager.Location
Describes the location of a Dockable . |
static class |
StateManager.LocationConverter
A transformer to read or write StateManager.Location s. |
static class |
StateManager.StateManagerSetting<B>
A set of properties used to store the contents of a StateManager |
Field Summary | |
---|---|
static String |
EXTERNALIZED
key for the externalized mode |
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 |
MAXIMIZED
key for the maximized mode |
static String |
MINIMIZED
key for the minimized mode |
static String |
NORMALIZED
key for the normalized mode |
Constructor Summary | |
---|---|
|
StateManager(DockController controller)
Creates a new manager. |
protected |
StateManager(DockController controller,
boolean init)
Creates a new manager. |
Method Summary | ||
---|---|---|
void |
add(String name,
FlapDockStation station)
Adds a station to which a Dockable can be minimized. |
|
void |
add(String name,
ScreenDockStation station)
Adds a station to which a Dockable can be externalized. |
|
void |
add(String name,
SplitDockStation station)
Adds a station to which a Dockable can be normalized
or maximized. |
|
void |
add(String name,
SplitDockStation station,
boolean allowAutoDefault)
Adds a station to which a Dockable can be normalized
or maximized. |
|
void |
addMaximizingArea(MaximizeArea area)
Adds a new maximizing-area to this manager. |
|
protected String[] |
availableModes(String current,
Dockable dockable)
Makes a list of all modes dockable can be going into. |
|
protected String |
childsMode(DockStation station)
Guesses the mode a child of station would have if it is
dropped on station . |
|
protected
|
createSetting(ModeTransitionConverter<StateManager.Location,B> converter)
Creates a new, empty setting. |
|
protected StateManager.Location |
currentLocation(String mode,
Dockable dockable)
Creates the StateManager.Location describing the location of dockable . |
|
protected String |
currentMode(Dockable dockable)
Gets the mode dockable is currently into. |
|
protected String |
currentModeSharp(Dockable dockable)
Searches the current mode of dockable and returns
the mode. |
|
void |
ensureNotHidden(Dockable dockable)
Ensures that dockable is not hidden behind another
Dockable . |
|
boolean |
ensureNothingMaximized()
Ensures that there is no maximized element. |
|
protected String |
getDefaultMode(Dockable dockable)
Gets the mode dockable should be go to if no other
mode is preferred. |
|
protected DockStation |
getDefaultNormal(Dockable dockable)
Gets the DockStation which should be used as default normal
parent for dockable . |
|
protected MaximizeArea |
getMaximizeArea(Dockable dockable)
Searches the first MaximizeArea which is a parent
of dockable . |
|
protected MaximizeArea |
getMaximizeArea(DockStation station)
Searches the one MaximizeArea whose station is
station . |
|
Dockable |
getMaximized()
Gets the one Dockable which is considered to be the root of
all maximized Dockable s. |
|
MaximizeArea |
getMaximizingArea()
Gets the current default maximizing-area. |
|
MaximizeArea[] |
getMaximizingAreas()
Gets a list of all the MaximizeArea s that are currently
registered, the list is in not ordered. |
|
protected Dockable |
getMaximizingElement(Dockable dockable)
Gets the element which must be maximized when the user requests that dockable is maximized. |
|
protected Dockable |
getMaximizingElement(Dockable old,
Dockable dockable)
Gets the element which would be maximized if old is currently
maximized, and dockable is or will not be maximized. |
|
protected String |
getRootName(Dockable dockable)
Gets the name of the root of dockable . |
|
|
getSetting(ModeTransitionConverter<StateManager.Location,B> converter)
Gets the current set or properties. |
|
protected DockStation |
getStation(String name)
Gets the station that is registered under name . |
|
protected void |
init()
Initializes all the elements of this manager. |
|
boolean |
isOnTransition()
Tells whether this StateManager currently is executing a
transition. |
|
protected boolean |
isValidNormalized(Dockable dockable)
Tells whether the element dockable is on a valid normalized
area or not. |
|
protected void |
putMode(Dockable dockable)
Stores for each Dockable of the tree with the root
dockable the current mode. |
|
void |
remove(String name)
Removes the DockStation name from this manager. |
|
void |
removeMaximizingArea(MaximizeArea area)
Removes area from the list of potential parents of
maximized Dockable s. |
|
void |
setMaximizingArea(MaximizeArea area)
Sets the default maximizing-area for this manager. |
|
void |
setMaximizingStation(String name)
Deprecated. better use setMaximizingArea(MaximizeArea) |
|
void |
setSetting(ModeTransitionSetting<StateManager.Location,?> setting)
Sets all properties of this manager. |
|
protected void |
store(Dockable dockable)
Stores for each Dockable in the tree with the root dockable
the location associated to their current mode. |
|
protected void |
store(String mode,
Dockable dockable)
Stores the location of dockable under the key mode . |
|
protected void |
transition(String oldMode,
String newMode,
Dockable dockable)
Called when a Dockable has to change from one mode to another mode. |
|
protected void |
transitionDuringRead(String id,
String oldMode,
String newMode,
Dockable dockable)
Called while reading modes in ModeTransitionManager.setSetting(ModeTransitionSetting) . |
Methods inherited from class bibliothek.gui.dock.support.action.ModeTransitionManager |
---|
add, added, addEmpty, createEntryDuringRead, getDockables, getIngoingAction, getIngoingAction, getName, getOutgoingAction, getOutgoingAction, getProperties, getSource, goIn, goOut, history, modeChanged, previousMode, put, putIngoingAction, putMode, putOutgoingAction, react, read, rebuild, rebuildAll, reduceToEmpty, remove, removed, removeEmpty, setMode, setProperties, write |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String ICON_MANAGER_KEY_MINIMIZE
IconManager
to read the Icon
for the "minimize"-action
public static final String ICON_MANAGER_KEY_MAXIMIZE
IconManager
to read the Icon
for the "maximize"-action
public static final String ICON_MANAGER_KEY_NORMALIZE
IconManager
to read the Icon
for the "normalize"-action
public static final String ICON_MANAGER_KEY_EXTERNALIZE
IconManager
to read the Icon
for the "externalize"-action
public static final String MINIMIZED
public static final String MAXIMIZED
public static final String NORMALIZED
public static final String EXTERNALIZED
Constructor Detail |
---|
public StateManager(DockController controller)
controller
and adds this
as ActionGuard
to the controller
.
controller
- the controller which is observed by this manager.protected StateManager(DockController controller, boolean init)
controller
and adds this
as ActionGuard
to the controller
.
controller
- the controller which is observed by this manager.init
- whether to initialize all the element of this manager or not.
If false
, then init()
has to be called.Method Detail |
---|
protected void init()
DockController
, and setting text and icons of
the DockAction
s used by this ModeTransitionManager
.
public <B> ModeTransitionSetting<StateManager.Location,B> getSetting(ModeTransitionConverter<StateManager.Location,B> converter)
ModeTransitionManager
getSetting
in class ModeTransitionManager<StateManager.Location>
B
- the type of the internal representation of the propertiesconverter
- converts the properties into the internal representation
public void setSetting(ModeTransitionSetting<StateManager.Location,?> setting)
ModeTransitionManager
setting
will not be affected by this method.
setSetting
in class ModeTransitionManager<StateManager.Location>
setting
- the set of propertiesprotected <B> StateManager.StateManagerSetting<B> createSetting(ModeTransitionConverter<StateManager.Location,B> converter)
ModeTransitionManager
createSetting
in class ModeTransitionManager<StateManager.Location>
B
- the type of properties stored in the settingconverter
- used to convert properties of this manager to the properties of the setting
public void add(String name, SplitDockStation station)
Dockable
can be normalized
or maximized. If this is the first call to this method, then
station
becomes the default station for this kind or
operation.
name
- the name of the stationstation
- the new stationpublic void add(String name, SplitDockStation station, boolean allowAutoDefault)
Dockable
can be normalized
or maximized. If this is the first call to this method, then
station
becomes the default station for this kind or
operation.
name
- the name of the stationstation
- the new stationallowAutoDefault
- tells whether station
can automatically
become the default station for some actions like maximizingpublic void addMaximizingArea(MaximizeArea area)
Dockable
then such an area becomes the new parent of the
element.
area
- a new area, must not be null
and not use
an already existing identifierpublic MaximizeArea[] getMaximizingAreas()
MaximizeArea
s that are currently
registered, the list is in not ordered.
null
public void removeMaximizingArea(MaximizeArea area)
area
from the list of potential parents of
maximized Dockable
s.
area
- the are to removepublic void setMaximizingArea(MaximizeArea area)
addMaximizingArea(MaximizeArea)
if necessary.
area
- the new default area, not null
public MaximizeArea getMaximizingArea()
null
setMaximizingArea(MaximizeArea)
@Deprecated public void setMaximizingStation(String name)
setMaximizingArea(MaximizeArea)
Dockable
s.
Any currently maximized elements will be normalized.
name
- the unique identifier of the station that should become
the maximize areapublic void add(String name, FlapDockStation station)
Dockable
can be minimized.
If this is the first call to this method, then
station
becomes the default station for this kind or
operation.
name
- the name of the stationstation
- the new station.public void add(String name, ScreenDockStation station)
Dockable
can be externalized.
If this is the first call to this method, then
station
becomes the default station for this kind or
operation.
name
- the name of the stationstation
- the new station.public void remove(String name)
DockStation
name
from this manager. If
the station is a default-station, then this property is set to null
.
name
- the name of the station to removepublic 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.
dockable
- the element which should not be hiddenpublic boolean ensureNothingMaximized()
true
if at least one element was affected by changes,
false
if nothing happened.public Dockable getMaximized()
Dockable
which is considered to be the root of
all maximized Dockable
s.
Dockable
s or null
protected MaximizeArea getMaximizeArea(Dockable dockable)
MaximizeArea
which is a parent
of dockable
. This method will never return
dockable
itself.
dockable
- the element whose maximize area is searched
null
protected MaximizeArea getMaximizeArea(DockStation station)
MaximizeArea
whose station is
station
.
station
- the station whose area is searched
null
if not foundprotected String[] availableModes(String current, Dockable dockable)
ModeTransitionManager
dockable
can be going into.
availableModes
in class ModeTransitionManager<StateManager.Location>
current
- the mode dockable
is currently indockable
- the element whose available modes are searched
protected String currentMode(Dockable dockable)
ModeTransitionManager
dockable
is currently into. This method
must also work if dockable
is not registered at this
ModeTransitionManager
.
currentMode
in class ModeTransitionManager<StateManager.Location>
dockable
- the element whose mode is searched
dockable
is, null
is not valid.protected String currentModeSharp(Dockable dockable)
dockable
and returns
the mode.
dockable
- the element whose mode is searched
null
if the mode could not be foundprotected String childsMode(DockStation station)
station
would have if it is
dropped on station
.
station
- some station
null
. The mode is one of
NORMALIZED
, MINIMIZED
or EXTERNALIZED
.
The mode MAXIMIZED
will not be considered.protected String getDefaultMode(Dockable dockable)
ModeTransitionManager
dockable
should be go to if no other
mode is preferred.
getDefaultMode
in class ModeTransitionManager<StateManager.Location>
dockable
- the element whose default mode is asked
public boolean isOnTransition()
StateManager
currently is executing a
transition.
true
if currently in a transition.transition(String, String, Dockable)
protected void transition(String oldMode, String newMode, Dockable dockable)
ModeTransitionManager
Dockable
has to change from one mode to another mode.ModeTransitionManager.getProperties(String, Dockable)
and
ModeTransitionManager.setProperties(String, Dockable, Object)
to get or store
properties associated with the mode.
transition
in class ModeTransitionManager<StateManager.Location>
oldMode
- the mode dockable
is currently innewMode
- the mode dockable
is going to bedockable
- the element that changes its modeprotected void transitionDuringRead(String id, String oldMode, String newMode, Dockable dockable)
ModeTransitionManager
ModeTransitionManager.setSetting(ModeTransitionSetting)
.
Subclasses might change the mode according to newMode
.
transitionDuringRead
in class ModeTransitionManager<StateManager.Location>
id
- the identifier of dockable
oldMode
- the mode dockable
is currently innewMode
- the mode dockable
is going to bedockable
- the element that changes its mode, might be null
protected Dockable getMaximizingElement(Dockable dockable)
dockable
is maximized.
dockable
- some element, not null
dockable
itself, not null
protected Dockable getMaximizingElement(Dockable old, Dockable dockable)
old
is currently
maximized, and dockable
is or will not be maximized.
old
- some elementdockable
- some element, might be old
dockable
is
no longer maximized, can be null
protected boolean isValidNormalized(Dockable dockable)
dockable
is on a valid normalized
area or not.
dockable
- the element to check
true
if dockable
can remain at the
location that it currently hasprotected DockStation getDefaultNormal(Dockable dockable)
DockStation
which should be used as default normal
parent for dockable
.
dockable
- some Dockable
dockable
or null
protected void store(Dockable dockable)
Dockable
in the tree with the root dockable
the location associated to their current mode.
dockable
- a root of a treeprotected void store(String mode, Dockable dockable)
dockable
under the key mode
.
mode
- the mode dockable
is currently indockable
- the element whose location will be storedprotected void putMode(Dockable dockable)
Dockable
of the tree with the root
dockable
the current mode.
dockable
- the element whose mode should be storedprotected StateManager.Location currentLocation(String mode, Dockable dockable)
StateManager.Location
describing the location of dockable
.
mode
- the current modedockable
- the element whose StateManager.Location
is created
StateManager.Location
or null
protected String getRootName(Dockable dockable)
dockable
.
dockable
- the element whose station is searched
protected DockStation getStation(String name)
name
.
name
- the name of the station
null
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |