public class DefaultFrontendPerspectiveCache extends Object implements FrontendPerspectiveCache
FrontendPerspectiveCache assumes that the information clients
gave to a DockFrontend is enough and use only the default PerspectiveElements. This cache
handles only the default implementation of the DockStations and of DefaultDockable. Using any
other DockElement will result in exceptions.DefaultDockables are represented by FrontendDockablePerspectives.PerspectiveElement that were ever created are stored in a cache. Clients should make sure to
use a new cache every time the access a Perspective, this way the old cache can be cleaned up by the
garbage collector.Dockables is read from the DockFrontend, this cache has no way
to know the identifiers of unregistered elements. These elements will be ignored and thrown away when reading the layout.| Modifier and Type | Field and Description |
|---|---|
static Path |
CACHE_EXTENSION
Unique identifier to load extensions of type
FrontendPerspectiveCacheExtension |
| Constructor and Description |
|---|
DefaultFrontendPerspectiveCache(DockFrontend frontend)
Creates a new cache
|
| Modifier and Type | Method and Description |
|---|---|
String |
get(PerspectiveElement element)
Gets the unique identifier of
element. |
PerspectiveElement |
get(String id,
boolean rootStation)
Called to convert
id to a PerspectiveElement. |
PerspectiveElement |
get(String id,
DockElement element,
boolean isRootStation)
Given an
element that was earlier created by the client and added to a
DockFrontend, this method converts element to a PerspectiveElement.When called multiple times with the same arguments, then this method is free to either return different objects or to always return the same object. |
boolean |
isRootStation(PerspectiveStation station)
Tells whether
station is supposed to be a root-station. |
protected void |
put(PerspectiveElement element,
String id)
Makes an association that the identifier
id is used for element. |
public static final Path CACHE_EXTENSION
FrontendPerspectiveCacheExtensionpublic DefaultFrontendPerspectiveCache(DockFrontend frontend)
frontend - the frontend to query for information about DockElements.public PerspectiveElement get(String id, DockElement element, boolean isRootStation)
FrontendPerspectiveCacheelement that was earlier created by the client and added to a
DockFrontend, this method converts element to a PerspectiveElement.get in interface FrontendPerspectiveCacheid - the unique identifier under which element is known to the DockFrontendelement - the element whose perspective must be createdisRootStation - whether element is registered as root-station at the DockFrontend
or as Dockablenullprotected void put(PerspectiveElement element, String id)
id is used for element.element - the element whose identifier is stored, not nullid - the identifier to store, not nullpublic PerspectiveElement get(String id, boolean rootStation)
FrontendPerspectiveCacheid to a PerspectiveElement. This method will only be called
with identifiers that were not used for FrontendPerspectiveCache.get(String, DockElement, boolean).get in interface FrontendPerspectiveCacheid - the identifier of some elementrootStation - whether id represents a root-station or notnullpublic String get(PerspectiveElement element)
FrontendPerspectiveCacheelement.get in interface FrontendPerspectiveCacheelement - some element, can be either a dockable or a root-stationnull if this cache is unable to associate element
with an identifier. Should not be null for elements that were created by
FrontendPerspectiveCache.get(String, boolean) or FrontendPerspectiveCache.get(String, DockElement, boolean).public boolean isRootStation(PerspectiveStation station)
FrontendPerspectiveCachestation is supposed to be a root-station.isRootStation in interface FrontendPerspectiveCachestation - the element which may be a root-stationtrue if station should be treated as root-stationCopyright © 2017 Docking Frames. All rights reserved.