|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object bibliothek.gui.dock.facile.mode.AbstractLocationMode<A>
A
- the values managed by this modepublic abstract class AbstractLocationMode<A extends ModeArea>
This abstract class offers various properties that may be useful for any implementation
of LocationMode
. It also allows to store a set of ModeArea
s. Basic methods
to verify and change the Mode
of a Dockable
are implemented too.
Nested Class Summary | |
---|---|
protected class |
AbstractLocationMode.DockableHandle
Meta information about a currently registered Dockable. |
Constructor Summary | |
---|---|
AbstractLocationMode()
|
Method Summary | |
---|---|
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)
Gets a DockActionSource which should be shown on dockable
which is currently in 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 LocationModeListener s
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 transfered to
a Dockable that has this mode. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface bibliothek.gui.dock.facile.mode.LocationMode |
---|
ensureNotHidden, getExtendedMode, isCurrentMode |
Methods inherited from interface bibliothek.gui.dock.support.mode.Mode |
---|
current, getSettingFactory, getUniqueIdentifier, isDefaultMode, readSetting, writeSetting |
Constructor Detail |
---|
public AbstractLocationMode()
Method Detail |
---|
public void setActionProvider(LocationModeActionProvider actionProvider)
LocationModeActionProvider
for this mode.
actionProvider
- the provider, not null
IllegalArgumentException
- if actionProvider
is null
IllegalStateException
- if there are already Dockable
s which show actions
that are provided by the current LocationModeActionProvider
public void setManager(LocationModeManager<?> manager)
LocationMode
setManager
in interface LocationMode
manager
- the manager or null
public LocationModeManager<?> getManager()
getManager
in interface LocationMode
null
public void setController(DockController controller)
LocationMode
ModeArea
s.
setController
in interface LocationMode
controller
- the new controller or null
public DockController getController()
null
public void addLocationModeListener(LocationModeListener listener)
LocationMode
apply
starts or finishes.
addLocationModeListener
in interface LocationMode
listener
- the new listenerpublic void removeLocationModeListener(LocationModeListener listener)
LocationMode
listener
from this mode.
removeLocationModeListener
in interface LocationMode
listener
- the listener to removeprotected LocationModeListener[] listeners()
public boolean shouldAutoFocus()
LocationMode
LocationModeManager
whether the focus should be transfered to
a Dockable
that has this mode.
shouldAutoFocus
in interface LocationMode
public 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 null
public A remove(String key)
key
from this
mode.
key
- the identifier of the area
null
public Iterator<A> iterator()
iterator
in interface Iterable<A extends ModeArea>
public 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 area
null
public DockStation getRepresentation(String uniqueId)
LocationMode
DockStation
that is known with the root-id uniqueId
.
The uniqueId
is the same id as used returned by Location.getRoot()
of Location
s issued by this mode.
getRepresentation
in interface LocationMode
uniqueId
- the id of some station
null
public Set<String> getRepresentationIds()
LocationMode
null
result when calling LocationMode.getRepresentation(String)
.
getRepresentationIds
in interface LocationMode
DockStation
s, 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 searched
null
, 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 ModeArea
s 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 found
ModeArea.getStation()
equals station
,
may be null
public Location aside(AsideRequest request, Location location)
LocationMode
DockStation.aside(AsideRequest)
on a station that matches location
.
aside
in interface LocationMode
request
- the request to forward to a DockStation
or to processlocation
- the source of the location whose neighbor is searched
null
if the request could not be processedpublic DockActionSource getActionsFor(Dockable dockable, Mode<Location> mode)
Mode
DockActionSource
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 null
mode
- the mode of dockable
, not null
dockable
, can be null
protected boolean isModeAvailable(Dockable dockable)
dockable
.
dockable
- some element to check
true
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 check
true
if this mode is availablepublic boolean isRepresenting(DockStation station)
LocationMode
station
and represents the mode
children of station
are in.
isRepresenting
in interface LocationMode
station
- the station which is to be tested
station
public boolean apply(Dockable dockable, Location history, AffectedSet set)
Mode
dockable
. 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 this
history
- 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 Dockable
s which might have changed their
mode in the set.
true
if dockable
was succesfully 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 LocationModeListener
s
are informed. Applies this mode to dockable
.
dockable
- the element whose mode becomes this
history
- history information that was returned by this mode when calling
Mode.current(Dockable)
the last time.set
- this method has to store all Dockable
s 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 element
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |