bibliothek.gui.dock.common.perspective
Class CControlPerspectiveBlop

java.lang.Object
  extended by bibliothek.gui.dock.common.perspective.CControlPerspectiveBlop

public class CControlPerspectiveBlop
extends Object

A CControlPerspectiveBlop stores all the data a file contains that was writting with CControl.write(java.io.DataOutputStream) or CControl.writeXML(java.io.File). This class allows clients to read and modify the layout files without actually loading any DockElements.

Author:
Benjamin Sigg

Constructor Summary
CControlPerspectiveBlop(CControlPerspective control)
           
 
Method Summary
 CPerspective getPerspective()
          Gets the current layout.
 CPerspective getPerspective(String name)
          Gets the perspective which was stored using name as key.
 String getPerspectiveName()
          Gets the name of the layout that is currently shown.
 String[] getPerspectiveNames()
          Gets the names of all perspectives that are available.
 CSetting getSetting()
          Gets the raw data of the current layout.
 CSetting getSetting(String name)
          Gets the raw data about the layout that is stored using name as key.
 void putPerspective(String name, CPerspective perspective)
          Stores a new layout for name.
 void putSetting(String name, CSetting setting)
          Stores raw data of a layout with name name.
 void read(DataInputStream in)
          Performs the same actions as CControl.read(DataInputStream), this method extracts all layouts of a byte file.
 void readXML(XElement root)
          Performs the same actions as CControl.readXML(XElement), this method extracts all layouts of an xml file.
 void removePerspective(String name)
          Removes a layout from this blop.
 void setPerspective(CPerspective perspective)
          Sets the layout that should be loaded.
 void setPerspectiveName(String name)
          Sets the name of the current layout.
 void setSetting(CSetting setting)
          Sets the raw data of the layout that should be loaded.
 void write(DataOutputStream out)
          Performs the same actions as CControl.write(DataOutputStream)
 void writeXML(XElement root)
          Performs the same actions as CControl.writeXML(java.io.File).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CControlPerspectiveBlop

public CControlPerspectiveBlop(CControlPerspective control)
Method Detail

getPerspectiveNames

public String[] getPerspectiveNames()
Gets the names of all perspectives that are available.

Returns:
the name of the perspectives

getSetting

public CSetting getSetting(String name)
Gets the raw data about the layout that is stored using name as key.

Parameters:
name - the key of the layout
Returns:
the raw data or null if name was not found
See Also:
getPerspective(String)

getPerspective

public CPerspective getPerspective(String name)
Gets the perspective which was stored using name as key.

Parameters:
name - the key of the layout
Returns:
the perspective or null if name was not found

putPerspective

public void putPerspective(String name,
                           CPerspective perspective)
Stores a new layout for name.

Parameters:
name - the name of the layout, not null
perspective - the new layout, not null

putSetting

public void putSetting(String name,
                       CSetting setting)
Stores raw data of a layout with name name.

Parameters:
name - the name of the layout, not null
setting - the new layout, not null
See Also:
putPerspective(String, CPerspective)

removePerspective

public void removePerspective(String name)
Removes a layout from this blop.

Parameters:
name - the name of the layout to remove

getPerspectiveName

public String getPerspectiveName()
Gets the name of the layout that is currently shown.

Returns:
the name of the current layout, can be null

setPerspectiveName

public void setPerspectiveName(String name)
Sets the name of the current layout.

Parameters:
name - the name of the current layout, can be null

getPerspective

public CPerspective getPerspective()
Gets the current layout.

Returns:
the currently applied layout, may be null

getSetting

public CSetting getSetting()
Gets the raw data of the current layout.

Returns:
the raw data

setPerspective

public void setPerspective(CPerspective perspective)
Sets the layout that should be loaded.

Parameters:
perspective - the new layout, not null

setSetting

public void setSetting(CSetting setting)
Sets the raw data of the layout that should be loaded.

Parameters:
setting - the new layout, not null

readXML

public void readXML(XElement root)
             throws XException
Performs the same actions as CControl.readXML(XElement), this method extracts all layouts of an xml file.

Parameters:
root - the root xml element in the file
Throws:
XException - if the structure of root is not as expected

read

public void read(DataInputStream in)
          throws IOException
Performs the same actions as CControl.read(DataInputStream), this method extracts all layouts of a byte file.

Parameters:
in - the stream to read from
Throws:
if - the stream cannot be read
IOException

writeXML

public void writeXML(XElement root)
Performs the same actions as CControl.writeXML(java.io.File).

Parameters:
root - the xml element to write into

write

public void write(DataOutputStream out)
           throws IOException
Performs the same actions as CControl.write(DataOutputStream)

Parameters:
out - the stream to write into
Throws:
IOException - if the stream is not writeable