public abstract class Perspective extends Object
Perspective is a helper class that allows clients to create a layout without the need to
create DockStations or Dockables.DockSituation that
would load the layout and then call the method DockSituation.createPerspective() to create
a Perspective which in return is able to write a file that matches the need of its
owner DockSituation.| Constructor and Description |
|---|
Perspective(DockSituation situation)
Creates a new
Perspective using situation to read and write
items. |
| Modifier and Type | Method and Description |
|---|---|
PerspectiveElement |
convert(DockLayoutComposition composition)
Converts
composition using the DockFactorys that are registered at
this perspective. |
DockLayoutComposition |
convert(PerspectiveElement element)
Converts
element using the DockFactorys that are registered at this
perspective. |
protected abstract DockFactory<?,?,?> |
getFactory(String id)
Gets the factory which is responsible to store an element whose id is
id. |
protected abstract String |
getID(PerspectiveElement element)
Gets the identifier of the factory that is responsible for
element. |
DockSituation |
getSituation()
|
Map<String,PerspectiveStation> |
read(DataInputStream in)
Reads the contents of
in and returns them in a map. |
Map<String,PerspectiveStation> |
readXML(XElement root)
Reads the contents of
root and returns them in a map. |
void |
write(Map<String,PerspectiveStation> stations,
DataOutputStream out)
Writes the layout created by
stations to out. |
void |
writeXML(Map<String,PerspectiveStation> stations,
XElement element)
Converts the content of
stations to XML. |
public Perspective(DockSituation situation)
Perspective using situation to read and write
items.situation - the set of factories to usepublic Map<String,PerspectiveStation> readXML(XElement root)
root and returns them in a map.root - the data to readrootpublic void writeXML(Map<String,PerspectiveStation> stations, XElement element)
stations to XML.stations - the items to writeelement - the element to write intopublic Map<String,PerspectiveStation> read(DataInputStream in) throws IOException
in and returns them in a map.in - the stream to read frominIOException - if an I/O-error occurspublic void write(Map<String,PerspectiveStation> stations, DataOutputStream out) throws IOException
stations to out. The data written
by this method can be read by DockSituation.read(DataInputStream)stations - the root-stations to storeout - the stream to write intoIOException - if an I/O-error occurredpublic DockLayoutComposition convert(PerspectiveElement element)
element using the DockFactorys that are registered at this
perspective.element - the element to convert, not nullIllegalArgumentException - if a factory is missingpublic PerspectiveElement convert(DockLayoutComposition composition)
composition using the DockFactorys that are registered at
this perspective.composition - the element to convert, not nullpublic DockSituation getSituation()
nullprotected abstract String getID(PerspectiveElement element)
element.element - the element to storeelementprotected abstract DockFactory<?,?,?> getFactory(String id)
id.id - the identifier of the element to store or readnullCopyright © 2017 Docking Frames. All rights reserved.