bibliothek.gui.dock.frontend
Class Setting

java.lang.Object
  extended by bibliothek.gui.dock.frontend.Setting
Direct Known Subclasses:
CSetting

public class Setting
extends Object

The set of properties that describe one setting of a DockFrontend.

Author:
Benjamin Sigg

Constructor Summary
Setting()
           
 
Method Summary
 void addInvisible(String key, String root, DockLayoutComposition layout, DockableProperty location)
          Stores the location of an invisible element.
 void fillMissing(DockSituation situation)
          Using the factories given by situation, this method tries to fill any gaps in the layout.
 int getInvisibleCount()
          Gets the number of stored invisible elements.
 String getInvisibleKey(int index)
          Gets the key of the index'th invisible element.
 DockLayoutComposition getInvisibleLayout(int index)
          Gets the layout of the index'th invisible element.
 DockableProperty getInvisibleLocation(int index)
          Gets the location of the index'th invisible element.
 String getInvisibleRoot(int index)
          Gets the preferred root of the index'th invisible element.
 DockLayoutComposition getRoot(String root)
          Gets the layout of a root.
 String[] getRootKeys()
          Gets the keys of all known roots.
 void putRoot(String root, DockLayoutComposition layout)
          Stores the layout of a root.
 void read(DockSituation situation, PropertyTransformer transformer, boolean entry, DataInputStream in)
          Reads the properties of this setting.
 void readXML(DockSituation situation, PropertyTransformer transformer, boolean entry, XElement element)
          Reads the properties of this setting.
 void write(DockSituation situation, PropertyTransformer transformer, boolean entry, DataOutputStream out)
          Writes the properties of this setting into out.
 void writeXML(DockSituation situation, PropertyTransformer transformer, boolean entry, XElement element)
          Writes the properties of this setting in xml format.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Setting

public Setting()
Method Detail

putRoot

public void putRoot(String root,
                    DockLayoutComposition layout)
Stores the layout of a root.

Parameters:
root - the name of the root
layout - the layout

getRoot

public DockLayoutComposition getRoot(String root)
Gets the layout of a root.

Parameters:
root - the root
Returns:
the layout or null

getRootKeys

public String[] getRootKeys()
Gets the keys of all known roots.

Returns:
the keys of the roots

addInvisible

public void addInvisible(String key,
                         String root,
                         DockLayoutComposition layout,
                         DockableProperty location)
Stores the location of an invisible element.

Parameters:
key - the key of the element
root - the preferred root of the element
layout - the layout of the element, may be null
location - the location of the element on root

getInvisibleCount

public int getInvisibleCount()
Gets the number of stored invisible elements.

Returns:
the number of elements

getInvisibleKey

public String getInvisibleKey(int index)
Gets the key of the index'th invisible element.

Parameters:
index - the index of the element
Returns:
the key

getInvisibleRoot

public String getInvisibleRoot(int index)
Gets the preferred root of the index'th invisible element.

Parameters:
index - the index of the element
Returns:
the root

getInvisibleLocation

public DockableProperty getInvisibleLocation(int index)
Gets the location of the index'th invisible element.

Parameters:
index - the index of the element
Returns:
the location

getInvisibleLayout

public DockLayoutComposition getInvisibleLayout(int index)
Gets the layout of the index'th invisible element.

Parameters:
index - the index of the layout
Returns:
associated information, may be null

fillMissing

public void fillMissing(DockSituation situation)
Using the factories given by situation, this method tries to fill any gaps in the layout.

Parameters:
situation - a set of factories to use
Throws:
IllegalArgumentException - if situation cannot handle the content of this setting

write

public void write(DockSituation situation,
                  PropertyTransformer transformer,
                  boolean entry,
                  DataOutputStream out)
           throws IOException
Writes the properties of this setting into out.

Parameters:
situation - can be used to write DockLayouts
transformer - can be used to write DockablePropertys
entry - if true, then this setting is used as one of the settings a user can choose. If false then this setting is used as the final setting that is written when the application shuts down.
out - a stream to write into
Throws:
IOException - if an I/O-error occurs

writeXML

public void writeXML(DockSituation situation,
                     PropertyTransformer transformer,
                     boolean entry,
                     XElement element)
Writes the properties of this setting in xml format.

Parameters:
situation - can be used to write DockLayouts
transformer - can be used to write DockablePropertys
entry - if true, then this setting is used as one of the settings a user can choose. If false then this setting is used as the final setting that is written when the application shuts down.
element - the element into which this setting writes, the attributes of element are not changed.

read

public void read(DockSituation situation,
                 PropertyTransformer transformer,
                 boolean entry,
                 DataInputStream in)
          throws IOException
Reads the properties of this setting. Old properties are deleted without further notice.

Parameters:
situation - can be used to read DockLayouts
transformer - can be used to read DockablePropertys
entry - if true, then this setting is used as one of the settings a user can choose. If false then this setting is used as the first setting that is read when the application starts up.
in - the stream to read from
Throws:
IOException - if an I/O-error occurs

readXML

public void readXML(DockSituation situation,
                    PropertyTransformer transformer,
                    boolean entry,
                    XElement element)
Reads the properties of this setting. Old properties are deleted without further notice.

Parameters:
situation - can be used to read DockLayouts
transformer - can be used to read DockablePropertys
entry - if true, then this setting is used as one of the settings a user can choose. If false then this setting is used as the first setting that is read when the application starts up.
element - the element which should be read