@Todo(compatibility=COMPATIBLE, priority=MAJOR, description="remove the warning about modes without perspective") public class CPerspective extends Object
CPerspective
is a lightweight, modifiable representation of all Dockable
s and DockStation
s
handled by a CControl
.CPerspective
clients have to be aware of:
Constructor and Description |
---|
CPerspective(CControlAccess control)
Creates a new perspective
|
Modifier and Type | Method and Description |
---|---|
void |
addStation(CStationPerspective station)
Adds a new station to this perspective.
|
Iterator<PerspectiveElement> |
elements()
Gets an iterator that will visit all the
PerspectiveElement s of this CPerspective . |
CContentPerspective |
getContentArea()
Gets a representation of the default
CContentArea . |
CContentPerspective |
getContentArea(String id)
Gets a representation of the
CContentArea with identifier id . |
CDockablePerspective |
getDockable(String id)
Searches for the
SingleCDockablePerspective or MultipleCDockablePerspective whose
unique identifier is id . |
String[] |
getDockableKeys()
Gets all the unique keys for
SingleCDockablePerspective s and MultipleCDockablePerspective s. |
LocationModeManagerPerspective |
getLocationManager()
Gets the representation of the
CLocationModeManager , the representation
is responsible for finding out what ExtendedMode and location a
CDockablePerspective has. |
CExternalizePerspective |
getScreenStation()
Gets the
CStationPerspective for the station that represents free floating dockables. |
CStationPerspective |
getStation(String id)
Gets the station which was registered with the unique identifier
id . |
String[] |
getStationKeys()
Gets the names of all the stations that were registered
|
void |
putDockable(CDockablePerspective dockable)
Stores
dockable in the list of known dockables. |
CDockablePerspective |
removeDockable(String key)
Removes the dockable with unique key
key from the list of known dockables. |
void |
shrink()
Searches all occurrences of a
ShrinkablePerspectiveStation and calls
shrink on them. |
Location |
storeLocation(CDockablePerspective dockable)
Determines the current location of
dockable and stores that location
in a map using the ExtendedMode of the Location as key. |
void |
storeLocations()
Stores the current location of all
CDockablePerspective s currently known to this
CPerspective . |
public CPerspective(CControlAccess control)
control
- the owner of this perspectivepublic LocationModeManagerPerspective getLocationManager()
CLocationModeManager
, the representation
is responsible for finding out what ExtendedMode
and location a
CDockablePerspective
has.null
public void storeLocations()
CDockablePerspective
s currently known to this
CPerspective
. The location is stored in the LocationHistory
of each
dockable.public Location storeLocation(CDockablePerspective dockable)
dockable
and stores that location
in a map using the ExtendedMode
of the Location
as key. If the
user later clicks on one of the buttons like "minimize" or "externalize" this
location information is read and applied.dockable
- the element whose location should be storednull
if the location of
dockable
could not be determinedpublic void addStation(CStationPerspective station)
id
is
already registered, then this station gets replaced.CStation
. The client needs
to register a SingleCDockableFactory
in order to create the station when it is missing.station
- the new stationpublic CStationPerspective getStation(String id)
id
.id
- some unique identifierid
, can be null
public CDockablePerspective getDockable(String id)
SingleCDockablePerspective
or MultipleCDockablePerspective
whose
unique identifier is id
. This method requires a call to storeLocations()
before it will return any results.id
- the unique identifier of a dockable, after CControlRegister.toSingleId(String)
or CControlRegister.toMultiId(String)
has been applied.null
if id
is unknown or if
storeLocations()
was not executedpublic String[] getDockableKeys()
SingleCDockablePerspective
s and MultipleCDockablePerspective
s.
For this method to return the correct keys, storeLocations()
must have been executed.public CDockablePerspective removeDockable(String key)
key
from the list of known dockables. If the
dockable is still part of the tree, and storeLocations()
is called, then the dockable
is reinserted into the list.key
- the unique identifier of the element to removepublic void putDockable(CDockablePerspective dockable)
dockable
in the list of known dockables. This allows
clients to add "invisible" dockables: CDockable
s which are not yet visible
but which already have some location information stored.dockable
- the new element, not null
public String[] getStationKeys()
null
public CContentPerspective getContentArea()
CContentArea
. If there are no
stations for the perspective, then the missing stations are automatically
added to this perspective.public CContentPerspective getContentArea(String id)
CContentArea
with identifier id
. If there are no
stations for the perspective, then the missing stations are automatically
added to this perspective.id
- the unique identifier of the areapublic CExternalizePerspective getScreenStation()
CStationPerspective
for the station that represents free floating dockables. This
is equivalent of calling getRoot( CControl.EXTERNALIZED_STATION_ID )
.null
if there is no station registered with key
CControl.EXTERNALIZED_STATION_ID
ClassCastException
- if the station named CControl.EXTERNALIZED_STATION_ID
is not
of type CExternalizePerspective
public void shrink()
ShrinkablePerspectiveStation
and calls
shrink
on them.public Iterator<PerspectiveElement> elements()
PerspectiveElement
s of this CPerspective
. The
iterator does not check whether this perspective is modified while it is in use.