A - the values managed by this modepublic abstract class AbstractLocationMode<A extends ModeArea> extends Object implements Iterable<A>, LocationMode
LocationMode. It also allows to store a set of ModeAreas. Basic methods
to verify and change the Mode of a Dockable are implemented too.| Modifier and Type | Class and Description |
|---|---|
protected class |
AbstractLocationMode.DockableHandle
Meta information about a currently registered Dockable.
|
| Constructor and Description |
|---|
AbstractLocationMode() |
| Modifier and Type | Method and Description |
|---|---|
void |
add(A area)
Adds an area to this mode.
|
void |
addLocationModeListener(LocationModeListener listener)
Adds a listener to this mode.
|
boolean |
apply(Dockable dockable,
Location history,
AffectedSet set)
Applies this mode to
dockable. |
Location |
aside(AsideRequest request,
Location location)
Calls
DockStation.aside(AsideRequest) on a station that matches location. |
protected AbstractLocationMode.DockableHandle |
createHandle(Dockable dockable)
Creates a new handle for
dockable. |
A |
get(Dockable dockable)
Recursively searches through all stations of
dockable
until a station is found that is registered at this mode. |
A |
get(Dockable dockable,
boolean locationRoot)
Recursively searches through all stations of
dockable
until a station is found that is registered at this mode. |
A |
get(DockStation station)
Recursively searches through all areas known to this mode until the
mode is found that represents
station. |
A |
get(String key)
Gets the area with the specified id.
|
DockActionSource |
getActionsFor(Dockable dockable,
Mode<Location> mode)
|
DockController |
getController()
Gets the controller in whose realm this mode works.
|
A |
getDefaultArea()
Gets the default area of this mode, can be
null. |
LocationModeManager<?> |
getManager()
Gets the owner of this mode.
|
DockStation |
getRepresentation(String uniqueId)
Gets the one
DockStation that is known with the root-id uniqueId. |
Set<String> |
getRepresentationIds()
Gets all the unique identifiers that will yield a non-
null result when calling LocationMode.getRepresentation(String). |
protected boolean |
isModeAvailable(Dockable dockable)
Tells whether this mode is available for
dockable. |
protected boolean |
isModeHidden(Dockable dockable)
Tells whether this mode is hidden for
dockable. |
boolean |
isRepresenting(DockStation station)
Tells whether this mode knows
station and represents the mode
children of station are in. |
Iterator<A> |
iterator() |
protected LocationModeListener[] |
listeners()
Gets all the listeners that are currently registered at this mode.
|
A |
remove(String key)
Removes the area with identifier
key from this
mode. |
void |
removeLocationModeListener(LocationModeListener listener)
Removes
listener from this mode. |
protected abstract boolean |
runApply(Dockable dockable,
Location history,
AffectedSet set)
Called by
apply(Dockable, Location, AffectedSet) after the LocationModeListeners
are informed. |
void |
setActionProvider(LocationModeActionProvider actionProvider)
Sets the
LocationModeActionProvider for this mode. |
void |
setController(DockController controller)
Connects this mode with a controller.
|
void |
setDefaultArea(A defaultArea)
Sets the default area of this mode.
|
void |
setManager(LocationModeManager<?> manager)
Sets the manager which is using this mode.
|
void |
setShouldAutoFocus(boolean autoFocus)
Sets the result of
shouldAutoFocus(). |
boolean |
shouldAutoFocus()
Tells the
LocationModeManager whether the focus should be transferred to
a Dockable that has this mode. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEach, spliteratorensureNotHidden, getExtendedMode, isCurrentModecurrent, getSettingFactory, getUniqueIdentifier, isDefaultMode, readSetting, writeSettingpublic void setActionProvider(LocationModeActionProvider actionProvider)
LocationModeActionProvider for this mode.actionProvider - the provider, not nullIllegalArgumentException - if actionProvider is nullIllegalStateException - if there are already Dockables which show actions
that are provided by the current LocationModeActionProviderpublic void setManager(LocationModeManager<?> manager)
LocationModesetManager in interface LocationModemanager - the manager or nullpublic LocationModeManager<?> getManager()
getManager in interface LocationModenullpublic void setController(DockController controller)
LocationModeModeAreas.setController in interface LocationModecontroller - the new controller or nullpublic DockController getController()
nullpublic void addLocationModeListener(LocationModeListener listener)
LocationModeapply starts or finishes.addLocationModeListener in interface LocationModelistener - the new listenerpublic void removeLocationModeListener(LocationModeListener listener)
LocationModelistener from this mode.removeLocationModeListener in interface LocationModelistener - the listener to removeprotected LocationModeListener[] listeners()
public boolean shouldAutoFocus()
LocationModeLocationModeManager whether the focus should be transferred to
a Dockable that has this mode.shouldAutoFocus in interface LocationModepublic void setShouldAutoFocus(boolean autoFocus)
shouldAutoFocus().autoFocus - whether automatic focus transfer to Dockable in this mode
should be allowedpublic void add(A area)
area - the new area, not nullpublic A remove(String key)
key from this
mode.key - the identifier of the areanullpublic void setDefaultArea(A defaultArea)
get(Dockable) returns null for some key.defaultArea - the default area, can be null. Must be
registered using add(ModeArea) first.public A getDefaultArea()
null. The default area
is the oldest area that was added to this mode and whose property
ModeArea.autoDefaultArea() is true, or the one area set
through setDefaultArea(ModeArea).public A get(String key)
key - the name of the areanullpublic DockStation getRepresentation(String uniqueId)
LocationModeDockStation that is known with the root-id uniqueId.
The uniqueId is the same id as used returned by Location.getRoot()
of Locations issued by this mode.getRepresentation in interface LocationModeuniqueId - the id of some stationnullpublic Set<String> getRepresentationIds()
LocationModenull result when calling LocationMode.getRepresentation(String).getRepresentationIds in interface LocationModeDockStations, the result may not be modifiablepublic A get(Dockable dockable)
dockable
until a station is found that is registered at this mode.dockable - the element whose root is searchednull, never dockable itselfpublic A get(Dockable dockable, boolean locationRoot)
dockable
until a station is found that is registered at this mode.dockable - the element whose root is searchedlocationRoot - if true, then only those ModeAreas are returned
which are ModeArea.isLocationRoot()null, never dockable itselfpublic A get(DockStation station)
station. If station
is a Dockable that its parent station is searched too.station - the station whose area is to be foundModeArea.getStation() equals station,
may be nullpublic Location aside(AsideRequest request, Location location)
LocationModeDockStation.aside(AsideRequest) on a station that matches location.aside in interface LocationModerequest - the request to forward to a DockStation or to processlocation - the source of the location whose neighbor is searchednull if the request could not be processedpublic DockActionSource getActionsFor(Dockable dockable, Mode<Location> mode)
ModeDockActionSource which should be shown on dockable
which is currently in mode. This method will be called
every time when dockable changes its mode.getActionsFor in interface Mode<Location>dockable - some element, not nullmode - the mode of dockable, not nulldockable, can be nullprotected boolean isModeAvailable(Dockable dockable)
dockable.dockable - some element to checktrue if this mode is availableprotected boolean isModeHidden(Dockable dockable)
dockable. If the mode is hidden
then the actions of the action provider
do not show up.dockable - some element to checktrue if this mode is availablepublic boolean isRepresenting(DockStation station)
LocationModestation and represents the mode
children of station are in.isRepresenting in interface LocationModestation - the station which is to be testedstationpublic boolean apply(Dockable dockable, Location history, AffectedSet set)
Modedockable. This method may fail for example because a DockAcceptance
does prevent dockable from being moved.apply in interface Mode<Location>dockable - the element whose mode becomes thishistory - history information that was returned by this mode
on its last call to Mode.current(Dockable). May be null
if this mode was never applied or returns null on Mode.current(Dockable).set - this method has to store all Dockables which might have changed their
mode in the set.true if dockable was successfully moved on its parent or to a new parent,
or false if dockable did not change its locationprotected abstract boolean runApply(Dockable dockable, Location history, AffectedSet set)
apply(Dockable, Location, AffectedSet) after the LocationModeListeners
are informed. Applies this mode to dockable.dockable - the element whose mode becomes thishistory - history information that was returned by this mode when calling
Mode.current(Dockable) the last time.set - this method has to store all Dockables which might have changed their
mode in the set.true if dockable was moved, false if the method failed
to set the location of dockable for any reasonprotected AbstractLocationMode.DockableHandle createHandle(Dockable dockable)
dockable.dockable - the newly registered elementCopyright © 2018. All rights reserved.