public class DockingContext
extends java.lang.Object
Keeps track of registered dockables and manages import export.
A DockingContext can be seen as the top-most grouping element of docking (as DockingDesktop can be contained is a context), and as such, all methods related to workspace management have been promoted to this class.
Modifier and Type | Field and Description |
---|---|
protected java.util.HashMap<Dockable,DockableState> |
dockableStates
inner state of the dockables
|
protected java.util.ArrayList<Dockable> |
registeredDockables
All dockables must be registered (even if not shown) in order to be processed
by the XML Parser or to be displayed in the DockingSelectorDialog
|
Constructor and Description |
---|
DockingContext()
Constructs a new DockingContext
|
Modifier and Type | Method and Description |
---|---|
void |
addDesktop(DockingDesktop desktop)
Adds a desktop to this context
|
void |
addDockableSelectionListener(DockableSelectionListener listener)
Adds a new DockableSelectionListener to this desktop.
|
void |
addDockableStateChangeListener(DockableStateChangeListener listener)
Adds a new DockableStateChangeListener to this desktop.
|
void |
addDockableStateWillChangeListener(DockableStateWillChangeListener listener)
Adds a new DockableStateWillChangeListener to this desktop.
|
void |
addDockingActionListener(DockingActionListener listener) |
void |
close(Dockable dockable)
Close this dockable
|
java.util.ArrayList<DockingDesktop> |
getDesktopList()
Returns a list of the desktops sharing this context
|
Dockable |
getDockableByKey(java.lang.String dockKey)
Returns the (registered) dockable corresponding to the given key id,
or null if not found
|
DockableResolver |
getDockableResolver()
Returns the dockable resolver used by this context (or null if none defined)
|
DockableState[] |
getDockables()
Creates and returns an array of all registered dockable with their current
state.
|
java.util.ArrayList<Dockable> |
getDockablesByState(DockingDesktop desktop,
DockableState.Location state)
constructs and returns the list of dockables corresponding to a desktop, at a specific state
|
DockableState |
getDockableState(Dockable dockable)
Returns the current state of a dockable (CLOSED, HIDDEN, DOCKED, MAXIMIZED, FLOATING)
|
void |
readXML(java.io.InputStream in)
Reads an XML encoded stream as the new desktop configuration.
|
void |
registerDockable(Dockable dockable)
Every dockable must be registered in order to be managed by a DockingDesktop.
|
void |
removeDesktop(DockingDesktop desktop)
Removes a desktop from this context
|
void |
removeDockableSelectionListener(DockableSelectionListener listener)
Removes a DockableSelectionListener from this desktop.
|
void |
removeDockableStateChangeListener(DockableStateChangeListener listener)
Removes a DockableStateChangeListener from this desktop.
|
void |
removeDockableStateWillChangeListener(DockableStateWillChangeListener listener)
Removes a DockableStateWillChangeListener from this desktop.
|
void |
removeDockingActionListener(DockingActionListener listener) |
void |
setDockableResolver(DockableResolver dockableResolver)
Updates the dockable resolver used by this context (can be set to null)
|
void |
setDockableState(Dockable dockable,
DockableState state)
Updates the current state of a dockable
|
void |
unregisterDockable(Dockable dockable)
Unregisters the dockable, which can be garbage collected (no longer used
by docking desktops.
|
void |
writeXML(java.io.OutputStream stream)
Saves the current desktop configuration into an XML stream.
|
protected java.util.ArrayList<Dockable> registeredDockables
protected java.util.HashMap<Dockable,DockableState> dockableStates
public void addDesktop(DockingDesktop desktop)
public void removeDesktop(DockingDesktop desktop)
public void registerDockable(Dockable dockable)
if this method is invoked and the dockable is already registered, nothing happens. if the dockable is still unknown, it is added to the dockables set and (since 2.1.3) its state is set to CLOSED (prior 2.1.3, the state was null).
public void unregisterDockable(Dockable dockable)
public void close(Dockable dockable)
public DockableState getDockableState(Dockable dockable)
public void setDockableState(Dockable dockable, DockableState state)
public void addDockableStateChangeListener(DockableStateChangeListener listener)
DockableStateChange Events are triggered after the state change.
As of version 2.0 of the framework, this method can also be replaced by adding a propertychangeListener on the DockKey object (and react to its DockableState property).
public void removeDockableStateChangeListener(DockableStateChangeListener listener)
public void addDockableStateWillChangeListener(DockableStateWillChangeListener listener)
DockableStateWillChange Events are triggered before the state change, and are vetoable.
public void removeDockableStateWillChangeListener(DockableStateWillChangeListener listener)
public DockableState[] getDockables()
Visibility states are [DockableState.CLOSED, DOCKED, HIDDEN]
public void writeXML(java.io.OutputStream stream) throws java.io.IOException
The workspace is composed of every desktop layouts associated with this context (desktops are identified by their 'desktopName' property).
The stream is not closed at the end of the operation.
java.io.IOException
readXML(InputStream)
public void readXML(java.io.InputStream in) throws javax.xml.parsers.ParserConfigurationException, java.io.IOException, org.xml.sax.SAXException
When the method returns, the desktops associated to this context are totally reconfigured with posiibly different dockables at different positions.
Note : The DockKey
s of the stream must be registered with
the registerDockable
method,
prior readXML.
This is the case if the desktop is already open and dockables
laid out, but might not be the case if this method is used at application startup
to populate an empty desktop.
Note : altenatively (since 2.1.2) if a DockableResolver has been set, it will
be use to auto-register the new dockables encountered along the stream.
Dismisses all visible dockables (docked and auto-hidden), and clear their DockableState.
The stream is not closed at the end of the operation.
Note : When multiple desktops are loaded from the stream, the context uses their "desktopName" property (desk.getDesktopName()) to identify them.
javax.xml.parsers.ParserConfigurationException
java.io.IOException
org.xml.sax.SAXException
writeXML(OutputStream)
,
registerDockable(Dockable)
,
setDockableResolver(DockableResolver)
public java.util.ArrayList<Dockable> getDockablesByState(DockingDesktop desktop, DockableState.Location state)
public Dockable getDockableByKey(java.lang.String dockKey)
Note : since VLDocking 2.1.2, this method also tries to use its DockableResolver if null would have been returned.
DockableResolver
public void addDockableSelectionListener(DockableSelectionListener listener)
DockableSelection Events are triggered when a dockable takes the focus.
public void removeDockableSelectionListener(DockableSelectionListener listener)
public void addDockingActionListener(DockingActionListener listener)
public void removeDockingActionListener(DockingActionListener listener)
public java.util.ArrayList<DockingDesktop> getDesktopList()
public DockableResolver getDockableResolver()
public void setDockableResolver(DockableResolver dockableResolver)
Copyright © 2010-2014 Pacific Biosciences. All Rights Reserved.