Class CPerspective
java.lang.Object
bibliothek.gui.dock.common.perspective.CPerspective
@Todo(compatibility=COMPATIBLE,
priority=MAJOR,
description="remove the warning about modes without perspective")
public class CPerspective
extends Object
A
When using a
CPerspective is a lightweight, modifiable representation of all Dockables and DockStations
handled by a CControl.When using a
CPerspective clients have to be aware of:
- Neither single- nor multiple-dockables need to be registered.
- Any root-
CStationused by aCControlneeds to be registered usingaddStation(CStationPerspective)
- Author:
- Benjamin Sigg
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddStation(CStationPerspective station) Adds a new station to this perspective.elements()Gets an iterator that will visit all thePerspectiveElements of thisCPerspective.Gets a representation of the defaultCContentArea.getContentArea(String id) Gets a representation of theCContentAreawith identifierid.getDockable(String id) Searches for theSingleCDockablePerspectiveorMultipleCDockablePerspectivewhose unique identifier isid.String[]Gets all the unique keys forSingleCDockablePerspectives andMultipleCDockablePerspectives.Gets the representation of theCLocationModeManager, the representation is responsible for finding out whatExtendedModeand location aCDockablePerspectivehas.Gets theCStationPerspectivefor the station that represents free floating dockables.getStation(String id) Gets the station which was registered with the unique identifierid.String[]Gets the names of all the stations that were registeredvoidputDockable(CDockablePerspective dockable) Storesdockablein the list of known dockables.removeDockable(String key) Removes the dockable with unique keykeyfrom the list of known dockables.voidshrink()Searches all occurrences of aShrinkablePerspectiveStationand callsshrinkon them.storeLocation(CDockablePerspective dockable) Determines the current location ofdockableand stores that location in a map using theExtendedModeof theLocationas key.voidStores the current location of allCDockablePerspectives currently known to thisCPerspective.
-
Constructor Details
-
CPerspective
Creates a new perspective- Parameters:
control- the owner of this perspective
-
-
Method Details
-
getLocationManager
Gets the representation of theCLocationModeManager, the representation is responsible for finding out whatExtendedModeand location aCDockablePerspectivehas.- Returns:
- the location manager, not
null
-
storeLocations
public void storeLocations()Stores the current location of allCDockablePerspectives currently known to thisCPerspective. The location is stored in theLocationHistoryof each dockable. -
storeLocation
Determines the current location ofdockableand stores that location in a map using theExtendedModeof theLocationas key. If the user later clicks on one of the buttons like "minimize" or "externalize" this location information is read and applied.
Also stores the dockables itself, if they are removed from their parents the perspective still knows of their existence- Parameters:
dockable- the element whose location should be stored- Returns:
- the location that was stored or
nullif the location ofdockablecould not be determined
-
addStation
Adds a new station to this perspective. If a station with nameidis already registered, then this station gets replaced.
WARNING: the framework will not automatically create aCStation. The client needs to register aSingleCDockableFactoryin order to create the station when it is missing.- Parameters:
station- the new station
-
getStation
Gets the station which was registered with the unique identifierid.- Parameters:
id- some unique identifier- Returns:
- the station associated with
id, can benull
-
getDockable
Searches for theSingleCDockablePerspectiveorMultipleCDockablePerspectivewhose unique identifier isid. This method requires a call tostoreLocations()before it will return any results.- Parameters:
id- the unique identifier of a dockable, afterCControlRegister.toSingleId(String)orCControlRegister.toMultiId(String)has been applied.- Returns:
- the stored dockable,
nullifidis unknown or ifstoreLocations()was not executed
-
getDockableKeys
Gets all the unique keys forSingleCDockablePerspectives andMultipleCDockablePerspectives. For this method to return the correct keys,storeLocations()must have been executed.- Returns:
- the keys of all the dockables that are currently known
-
removeDockable
Removes the dockable with unique keykeyfrom the list of known dockables. If the dockable is still part of the tree, andstoreLocations()is called, then the dockable is reinserted into the list.- Parameters:
key- the unique identifier of the element to remove- Returns:
- the element that was removed
-
putDockable
Storesdockablein the list of known dockables. This allows clients to add "invisible" dockables:CDockables which are not yet visible but which already have some location information stored.- Parameters:
dockable- the new element, notnull
-
getStationKeys
Gets the names of all the stations that were registered- Returns:
- the names, not
null
-
getContentArea
Gets a representation of the defaultCContentArea. If there are no stations for the perspective, then the missing stations are automatically added to this perspective.- Returns:
- the area
-
getContentArea
Gets a representation of theCContentAreawith identifierid. If there are no stations for the perspective, then the missing stations are automatically added to this perspective.- Parameters:
id- the unique identifier of the area- Returns:
- the area
-
getScreenStation
Gets theCStationPerspectivefor the station that represents free floating dockables. This is equivalent of callinggetRoot( CControl.EXTERNALIZED_STATION_ID ).- Returns:
- the station or
nullif there is no station registered with keyCControl.EXTERNALIZED_STATION_ID - Throws:
ClassCastException- if the station namedCControl.EXTERNALIZED_STATION_IDis not of typeCExternalizePerspective
-
shrink
public void shrink()Searches all occurrences of aShrinkablePerspectiveStationand callsshrinkon them. -
elements
Gets an iterator that will visit all thePerspectiveElements of thisCPerspective. The iterator does not check whether this perspective is modified while it is in use.- Returns:
- the iterator over all elements
-