com.vlsolutions.swing.docking.ws
Class Workspace

java.lang.Object
  extended by com.vlsolutions.swing.docking.ws.Workspace

public class Workspace
extends java.lang.Object

A logical organization of dockables. Used to define and save desktop layouts (xml loading in not supported yet).

A Workspace is composed of WSDesktop elements (one per involved desktop).

Each WSDesktop supports an API similar to the DockingDesktop (addDockable, split, createTab), where arguments are simple DockKeys (and not Dockables).

Currently this version doesn't support dockable removal : you can create a workspace, but shouldn't alter its layout by moving already positionned dockables elsewhere (e.g. workspace will fail if you install a dockable on an auto-hide border, then add is as a docked tab later).

Since:
2.1.2

Constructor Summary
Workspace()
          Creates a workspace with a single default WSDesktop
 
Method Summary
 void addDesktop(WSDesktop desktop)
          Adds a new desktop to this workspace
 void apply(DockingContext dockingContext)
          Applies this workspace to the given docking context (this is equivalent as loading a workspace file from DockingContext.readXML() : it removes every dockable from the context and associated desktops, and clears their dockable states, then it reloads the dockables as specified by this workspace layout.
 void clear()
          Removes the contained desktops
 WSDesktop getDesktop(int index)
          Returns the index-th desktop contained
 WSDesktop getDesktop(java.lang.String desktopName)
          Returns a desktop identified by its name or null if not found
 int getDesktopCount()
          Return the number of desktops contained in this workspace (default is 1 )
 void loadFrom(DockingContext context)
          Loads and configures this workspace from a given docking context.
 void readXML(java.io.InputStream in)
           
 void writeXML(java.io.OutputStream stream)
          Saves the workspace layout into an XML stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Workspace

public Workspace()
Creates a workspace with a single default WSDesktop

Method Detail

clear

public void clear()
Removes the contained desktops


addDesktop

public void addDesktop(WSDesktop desktop)
Adds a new desktop to this workspace


getDesktopCount

public int getDesktopCount()
Return the number of desktops contained in this workspace (default is 1 )


getDesktop

public WSDesktop getDesktop(int index)
Returns the index-th desktop contained


getDesktop

public WSDesktop getDesktop(java.lang.String desktopName)
Returns a desktop identified by its name or null if not found


apply

public void apply(DockingContext dockingContext)
           throws WorkspaceException
Applies this workspace to the given docking context (this is equivalent as loading a workspace file from DockingContext.readXML() : it removes every dockable from the context and associated desktops, and clears their dockable states, then it reloads the dockables as specified by this workspace layout.

Throws:
WorkspaceException

loadFrom

public void loadFrom(DockingContext context)
              throws WorkspaceException
Loads and configures this workspace from a given docking context.

The workspace is then ready to be applied or saved as a stream.

Throws:
WorkspaceException
Since:
2.1.3
See Also:
apply(DockingContext)

writeXML

public void writeXML(java.io.OutputStream stream)
              throws java.io.IOException
Saves the workspace layout into an XML stream.

The workspace is composed of every desktop layouts associated with this workspace (desktops are identified by their 'desktopName' property).

The stream is not closed at the end of the operation.

Throws:
java.io.IOException
See Also:
readXML(InputStream)

readXML

public void readXML(java.io.InputStream in)
             throws javax.xml.parsers.ParserConfigurationException,
                    java.io.IOException,
                    org.xml.sax.SAXException
Throws:
javax.xml.parsers.ParserConfigurationException
java.io.IOException
org.xml.sax.SAXException


© Copyright 2004-2007 VLSolutions. All Rights Reserved.
www.vlsolutions.com : Java Components - Smart Client Applications