com.vlsolutions.swing.docking.ws

Class Workspace

public class Workspace extends 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
voidaddDesktop(WSDesktop desktop)
Adds a new desktop to this workspace
voidapply(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.
voidclear()
Removes the contained desktops
WSDesktopgetDesktop(int index)
Returns the index-th desktop contained
WSDesktopgetDesktop(String desktopName)
Returns a desktop identified by its name or null if not found
intgetDesktopCount()
Return the number of desktops contained in this workspace (default is 1 )
voidloadFrom(DockingContext context)
Loads and configures this workspace from a given docking context.
voidreadXML(InputStream in)
voidwriteXML(OutputStream stream)
Saves the workspace layout into an XML stream.

Constructor Detail

Workspace

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

Method Detail

addDesktop

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

apply

public 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.

clear

public void clear()
Removes the contained desktops

getDesktop

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

getDesktop

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

getDesktopCount

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

loadFrom

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

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

Since: 2.1.3

See Also: apply

readXML

public void readXML(InputStream in)

writeXML

public void writeXML(OutputStream stream)
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.

See Also:

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