public class WSDesktop
extends java.lang.Object
Use this object to define the layout of a DockingDesktop. This layout can be applied later to that desktop through the Workspace.apply(DockingContext ctx) method.
The API is a subset of the one of DockingDesktop : limited to layout building. you can addDockable(), split(), createTab(), addHiddenDockable(), addFloatingDockable(), see these method description for further information.
Node : WSDesktop doens't support layout updates : you should use it to build a layout, but not to move dockables around. (if you add a dockable somewhere, don't add it elsewhere later as removal isn't fully implemented).
In a WSDesktop, dockables are identified by a WSDockKey (a limited version of DockKey) : this is to allow you to create workspaces with dockables that haven't been constructed yet (lazy loading).
Example :
Workspace w = new Workspace(); WSDesktop desk = w.getDesktop(0); // gets the default (single) desktop // define some dockable keys WSDockKey editorKey = new WSDockKey("editor"); WSDockKey treeKey, tableKey, imgToolKey // other dockable keys // now define a workspace layout desk.addDockable(editorKey); // initial dockable desk.split(editorKey, treeKey, DockingConstants.SPLIT_LEFT, 0.5); // splitted desk.split(treeKey, tableKey, DockingConstants.SPLIT_TOP, 0.7); // tree is also splitted desk.createTab(tableKey, imgToolsKey, 0); // tableKey is transformed into a tabbed container // and that's it // ... // later // DockingContext ctx = ... // your real desktop w.apply(ctx); // applies the workspace to this desktop // now the dektops are loaded as specified in the 'w' workspace
Modifier and Type | Field and Description |
---|---|
protected java.util.HashMap<WSDockKey,java.util.LinkedList<WSDockKey>> |
tabbedGroups
groups of tabs (used to re-tab autohidden dockable)
|
Constructor and Description |
---|
WSDesktop()
Constructs a WSDesktop with "default" as name
|
WSDesktop(java.lang.String desktopName)
Constructs a WSDesktop with a given name
|
Modifier and Type | Method and Description |
---|---|
void |
addDockable(WSDockKey key)
Adds the first dockable to this desktop.
|
void |
addDockable(WSDockKey compoundDockable,
WSDockKey childDockable)
Adds a dockable into a compound dockable
|
void |
addHiddenDockable(WSDockKey dockable,
RelativeDockablePosition dockedPosition)
Adds a new dockable (and stores its return-to-docked position)
|
void |
addToTabbedGroup(WSDockKey base,
WSDockKey newTab)
Registers a dockable as belonging to a tab group.
|
void |
clear()
removes all information stored into this desktop, which becomes ready to be reused.
|
void |
createTab(WSDockKey baseTab,
WSDockKey newTab,
int order)
Creates a tab containing baseTab and newTab (if baseTab is already into a Tab, then newTab will just be added at the "order" position.
|
java.lang.String |
getDesktopName()
Returns the name of this desktop (which must match the name of a real desktop if more than one desktops are used )
|
void |
setDesktopName(java.lang.String name)
Updates the name of this workspace desktop
|
void |
setFloating(WSDockKey dockable,
java.awt.Rectangle windowRect,
RelativeDockablePosition returnPosition)
Adds a new floating dockable
|
void |
setMaximizedDockable(WSDockKey max)
Sets the maximized dockable of this desktop, (or null if no dockable maximized).
|
void |
split(WSDockKey base,
WSDockKey newDockable,
DockingConstants.Split split,
double splitLocation)
Splits a dockable (with a given split location)
|
public WSDesktop()
public WSDesktop(java.lang.String desktopName)
public void clear()
public void addDockable(WSDockKey key)
public void setMaximizedDockable(WSDockKey max)
Don't forget that this dockable MUST ALSO BE in the DOCKED state (added to the desktop in a split, tab or compound node) otherwise the missing restore information will cause unwanted behaviour, or exceptions.
public void split(WSDockKey base, WSDockKey newDockable, DockingConstants.Split split, double splitLocation)
base
- the dockable to be splittednewDockable
- the new dockablesplit
- the orientation of splitsplitLocation
- where the split divisor is (always relative from the top/left dockable, so split(a, b, SPLIT_TOP, 0.1f) and split(a, b, SPLIT_BOTTOM, 0.1f) have the same dividor location (somewhere near the top of the split).public void createTab(WSDockKey baseTab, WSDockKey newTab, int order)
public void addDockable(WSDockKey compoundDockable, WSDockKey childDockable)
public void addHiddenDockable(WSDockKey dockable, RelativeDockablePosition dockedPosition)
public void setFloating(WSDockKey dockable, java.awt.Rectangle windowRect, RelativeDockablePosition returnPosition)
dockable
- the dockable to add as floatingwindowRect
- rectangle defining the window (relative to screen) of the floating dockablereturnPosition
- where to put the dockable when returning to the desktoppublic java.lang.String getDesktopName()
public void setDesktopName(java.lang.String name)
public void addToTabbedGroup(WSDockKey base, WSDockKey newTab)
It is used to have a memory of grouped (tabbed) dockables in order to keep the group together when dockable are restored from auto-hide mode.
This method is generally called by the tabbed container management, and not directly by the developper.
However, there is a case where calling this method can be usefull : when, at startup, a desktop is built with multiple hidden dockables, and the developper wants them to be grouped in a tab container when they are restored to the desktop.
base
- an already tabbed dockablenewTab
- a dockable to add to the tab groupCopyright © 2010-2014 Pacific Biosciences. All Rights Reserved.