bibliothek.gui.dock.common.perspective
Class CControlPerspective

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

@ClientOnly
public class CControlPerspective
extends java.lang.Object

A CControlPerspective is a wrapper around a CControl allowing access to various CPerspectives.

Author:
Benjamin Sigg

Constructor Summary
CControlPerspective(CControlAccess control)
          Creates a new wrapper
 
Method Summary
 CPerspective createEmptyPerspective()
          Creates a new CPerspective that is set up with the root-stations of the CControl.
 java.lang.String[] getNames()
          Gets the names of all the perspectives that are available.
 CPerspective getPerspective(boolean includeWorkingAreas)
          Gets a perspective that matches the current layout of the application.
 CPerspective getPerspective(java.lang.String name)
          Gets the perspective which represents a layout that was stored using CControl.save(String).
 void removePerspective(java.lang.String name)
          Deletes the perspective with name name.
 void renamePerspective(java.lang.String source, java.lang.String destination)
          Renames the perspective source to destination.
 void setPerspective(CPerspective perspective, boolean includeWorkingAreas)
          Changes the layout of the associated CControl such that it matches perspective.
 void setPerspective(java.lang.String name, CPerspective perspective)
          Stores perspective as a layout that can be selected by the user by calling CControl.load(String).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CControlPerspective

public CControlPerspective(CControlAccess control)
Creates a new wrapper

Parameters:
control - the control whose perspectives are modified
Method Detail

createEmptyPerspective

public CPerspective createEmptyPerspective()
Creates a new CPerspective that is set up with the root-stations of the CControl. There are no Dockables stored in the new perspective.

Returns:
the new perspective

getPerspective

public CPerspective getPerspective(boolean includeWorkingAreas)
Gets a perspective that matches the current layout of the application.

Parameters:
includeWorkingAreas - whether Dockables that are managed by a working-area should be included in the layout or not
Returns:
the current perspective

getNames

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

Returns:
all the names

getPerspective

public CPerspective getPerspective(java.lang.String name)
Gets the perspective which represents a layout that was stored using CControl.save(String).

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

setPerspective

public void setPerspective(CPerspective perspective,
                           boolean includeWorkingAreas)
Changes the layout of the associated CControl such that it matches perspective.

Parameters:
perspective - the perspective to apply, not null
includeWorkingAreas - whether Dockables that are managed by a working-area should be included in the layout or not

setPerspective

public void setPerspective(java.lang.String name,
                           CPerspective perspective)
Stores perspective as a layout that can be selected by the user by calling CControl.load(String).

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

removePerspective

public void removePerspective(java.lang.String name)
Deletes the perspective with name name.

Parameters:
name - the name of the perspective

renamePerspective

public void renamePerspective(java.lang.String source,
                              java.lang.String destination)
Renames the perspective source to destination. If there is already a layout with name destination it will be overriden. This operation works directly on the CControl, already existing CPerspectives will not be affected by invoking this method.

Parameters:
source - the name of the source
destination - the name of the destination
Throws:
java.lang.IllegalArgumentException - if source does not point to an existing layout
java.lang.IllegalArgumentException - if either source or destination are null