|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbibliothek.gui.dock.DockSituation
public class DockSituation
A DockSituation is a converter: the relationship of
DockStations
and Dockables
,
the position of Dockables and other information are converted into a
stream of bytes. The other direction, read a stream
and create Dockables and DockStations, is also possible.
Constructor Summary | |
---|---|
DockSituation()
Constructs a new DockSituation. |
|
DockSituation(DockFactory<?>... factories)
Constructs a new DockSituation and sets some factories which are used to create new DockElements |
Method Summary | |
---|---|
void |
add(DockFactory<?> factory)
Adds a factory |
protected DockFactory<? extends DockElement> |
getFactory(String id)
Gets the factory which has the given id . |
protected String |
getID(DockElement dockable)
Gets the id of the factory which is needed to write (and later read) the element dockable . |
protected String |
getID(DockFactory<?> factory)
Gets the id of factory . |
DockSituationIgnore |
getIgnore()
Gets the filter which decides, which elements are stored. |
protected boolean |
ignoreChildren(DockStation station)
Tells whether to ignore the children of the station when saving or not. |
protected boolean |
ignoreElement(DockElement element)
Tells whether to ignore this element when saving. |
Map<String,DockStation> |
read(byte[] data)
Reads data as stream and returns the roots of the
DockElements which were found. |
Map<String,DockStation> |
read(DataInputStream in)
Reads in and returns the roots of the
DockElements which were found. |
void |
setIgnore(DockSituationIgnore ignore)
Sets a filter which decides, which elements (stations and dockables) are stored. |
byte[] |
write(Map<String,DockStation> stations)
Writes all locations and relationships of the DockStations
stations and their children into an array of bytes. |
void |
write(Map<String,DockStation> stations,
DataOutputStream out)
Writes all locations and relationships of the DockStations
stations and their children into the stream out . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DockSituation(DockFactory<?>... factories)
DockElements
factories
- the factoriespublic DockSituation()
DefaultDockable
,
SplitDockStation
, StackDockStation
and
FlapDockStation
will be preinstalled.
Method Detail |
---|
public void setIgnore(DockSituationIgnore ignore)
ignore
- the filter or null
public DockSituationIgnore getIgnore()
null
public void add(DockFactory<?> factory)
factory
- the additional factorypublic byte[] write(Map<String,DockStation> stations) throws IOException
DockStations
stations
and their children into an array of bytes.
stations
- The stations to store, a call to read(byte[])
would return the same map. Only the roots are needed.
IOException
- if the information can't be writtenpublic void write(Map<String,DockStation> stations, DataOutputStream out) throws IOException
DockStations
stations
and their children into the stream out
.
stations
- The stations to store, only the roots are needed.out
- the stream to write in
IOException
- if the stream throws an exceptionpublic Map<String,DockStation> read(byte[] data) throws IOException
data
as stream and returns the roots of the
DockElements
which were found.
data
- the array to read
IOException
- if data
can't be readpublic Map<String,DockStation> read(DataInputStream in) throws IOException
in
and returns the roots of the
DockElements
which were found.
in
- the stream to read
IOException
- if the stream can't be readprotected boolean ignoreElement(DockElement element)
DockSituationIgnore
of this situation.
element
- the element which might not be saved
true
if the element should not be savedprotected boolean ignoreChildren(DockStation station)
DockSituationIgnore
of this situation.
station
- the station whose children might be ignored
true
if the station is saved as having no childrenprotected String getID(DockElement dockable)
dockable
.
dockable
- the dockable to write
getID(DockFactory)
,
getFactory(String)
protected String getID(DockFactory<?> factory)
factory
. The default behavior is just to
return DockFactory.getID()
. Note that this method should be
a bijection to getFactory(String)
.
factory
- the factory whose id is needed
protected DockFactory<? extends DockElement> getFactory(String id)
id
. Note that this
method should be a bijection to getID(DockFactory)
. The
default behavior compares id
with the
getID(DockFactory)
.
id
- the name of the factory
null
if no factory has this id
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |