public abstract class Perspective
extends java.lang.Object
Perspective
is a helper class that allows clients to create a layout without the need to
create DockStation
s or Dockable
s.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 DockFactory s that are registered at
this perspective. |
DockLayoutComposition |
convert(PerspectiveElement element)
Converts
element using the DockFactory s that are registered at this
perspective. |
protected abstract DockFactory<?,?,?> |
getFactory(java.lang.String id)
Gets the factory which is responsible to store an element whose id is
id . |
protected abstract java.lang.String |
getID(PerspectiveElement element)
Gets the identifier of the factory that is responsible for
element . |
DockSituation |
getSituation()
|
java.util.Map<java.lang.String,PerspectiveStation> |
read(java.io.DataInputStream in)
Reads the contents of
in and returns them in a map. |
java.util.Map<java.lang.String,PerspectiveStation> |
readXML(XElement root)
Reads the contents of
root and returns them in a map. |
void |
write(java.util.Map<java.lang.String,PerspectiveStation> stations,
java.io.DataOutputStream out)
Writes the layout created by
stations to out . |
void |
writeXML(java.util.Map<java.lang.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 java.util.Map<java.lang.String,PerspectiveStation> readXML(XElement root)
root
and returns them in a map.root
- the data to readroot
public void writeXML(java.util.Map<java.lang.String,PerspectiveStation> stations, XElement element)
stations
to XML.stations
- the items to writeelement
- the element to write intopublic java.util.Map<java.lang.String,PerspectiveStation> read(java.io.DataInputStream in) throws java.io.IOException
in
and returns them in a map.in
- the stream to read fromin
java.io.IOException
- if an I/O-error occurspublic void write(java.util.Map<java.lang.String,PerspectiveStation> stations, java.io.DataOutputStream out) throws java.io.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 intojava.io.IOException
- if an I/O-error occurredpublic DockLayoutComposition convert(PerspectiveElement element)
element
using the DockFactory
s that are registered at this
perspective.element
- the element to convert, not null
java.lang.IllegalArgumentException
- if a factory is missingpublic PerspectiveElement convert(DockLayoutComposition composition)
composition
using the DockFactory
s that are registered at
this perspective.composition
- the element to convert, not null
public DockSituation getSituation()
null
protected abstract java.lang.String getID(PerspectiveElement element)
element
.element
- the element to storeelement
protected abstract DockFactory<?,?,?> getFactory(java.lang.String id)
id
.id
- the identifier of the element to store or readnull