bibliothek.gui.dock.common
Class CWorkingArea

java.lang.Object
  extended by bibliothek.gui.dock.common.intern.AbstractCDockable
      extended by bibliothek.gui.dock.common.CWorkingArea
All Implemented Interfaces:
CStation, CDockable, SingleCDockable

public class CWorkingArea
extends AbstractCDockable
implements SingleCDockable, CStation

A working area is an element which is always visible and contains some CDockables which can't be dragged out of it. Also no CDockable can be dropped in a CWorkingArea.
There can be more than one CWorkingArea, and the working areas can be nested.

Author:
Benjamin Sigg

Nested Class Summary
 
Nested classes/interfaces inherited from interface bibliothek.gui.dock.common.intern.CDockable
CDockable.ExtendedMode
 
Field Summary
 
Fields inherited from interface bibliothek.gui.dock.common.intern.CDockable
ACTION_KEY_CLOSE, ACTION_KEY_EXTERNALIZE, ACTION_KEY_MAXIMIZE, ACTION_KEY_MINIMIZE, ACTION_KEY_NORMALIZE
 
Constructor Summary
CWorkingArea(String uniqueId, boolean restrictedEnvironment)
          Creates a new area.
 
Method Summary
<F extends MultipleCDockable>
F
add(F dockable)
          Ensures that this is the parent of dockable and adds dockable to the CControl which is associated with this CWorkingArea.
<F extends SingleCDockable>
F
add(F dockable)
          Ensures that this is the parent of dockable and adds dockable to the CControl which is associated with this CWorkingArea.
 CDockable asDockable()
          If this station is a CDockable as well, then this method returns the representation of this station as CDockable.
 void deploy(CGrid grid)
          Exchanges all the CDockables on this area with the elements of grid.
 DockStation getStation()
          Gets the internal representation of this CStation.
 CLocation getStationLocation()
          Gets a location which represents directly CStation.getStation().
 Icon getTitleIcon()
          Gets the icon that is shown in the title.
 String getTitleText()
          Gets the text that is shown as title.
 String getUniqueId()
          Gets a unique and constant identifier for this station
 boolean isCloseable()
          Tells whether this dockable can be closed by the user.
 boolean isExternalizable()
          Tells whether this dockable can be externalized by the user.
 boolean isMaximizable()
          Tells whether this dockable can be maximized by the user.
 boolean isMinimizable()
          Tells whether this dockable can be minimized by the user.
 boolean isStackable()
          Tells whether this dockable can be combined with another dockable to create a stack.
 boolean isSuppressTitle()
          Deprecated. use AbstractCDockable.isTitleShown() instead
 boolean isWorkingArea()
          Tells whether this station is a special working area or not.
 void setControl(CControlAccess control)
          Sets the CControl which is responsible for this dockable.
 void setSuppressTitle(boolean suppressTitle)
          Deprecated. use AbstractCDockable.setTitleShown(boolean) instead
 void setTitleIcon(Icon icon)
          Sets the icon that is shown in the title of this CDockable.
 void setTitleText(String text)
          Sets the text that is shown as title.
protected  boolean suppressTitle(DockTitleVersion version)
          Checks whether the title created by version should be suppressed.
 
Methods inherited from class bibliothek.gui.dock.common.intern.AbstractCDockable
addCDockablePropertyListener, addCDockableStateListener, control, getAction, getAndClearResizeRequest, getBaseLocation, getClose, getColors, getControl, getExtendedMode, getMinimizedSize, getWorkingArea, init, intern, isMinimizedHold, isResizeLocked, isTitleShown, isVisible, propertyListeners, putAction, removeCDockablePropertyListener, removeCDockableStateListener, setExtendedMode, setLocation, setMinimizedHold, setMinimizedSize, setResizeLocked, setResizeRequest, setTitleShown, setVisible, setWorkingArea, stateListeners, toFront
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface bibliothek.gui.dock.common.intern.CDockable
addCDockablePropertyListener, addCDockableStateListener, getAction, getAndClearResizeRequest, getBaseLocation, getColors, getControl, getExtendedMode, getMinimizedSize, getWorkingArea, intern, isMinimizedHold, isResizeLocked, isTitleShown, isVisible, removeCDockablePropertyListener, removeCDockableStateListener, setExtendedMode, setLocation, setMinimizedHold, setMinimizedSize, setVisible, setWorkingArea
 

Constructor Detail

CWorkingArea

public CWorkingArea(String uniqueId,
                    boolean restrictedEnvironment)
Creates a new area.

Parameters:
uniqueId - a unique identifier
restrictedEnvironment - true if the SecurityManager is active, for example in an applet or when using webstart.
Method Detail

deploy

public void deploy(CGrid grid)
Exchanges all the CDockables on this area with the elements of grid. This method also calls CDockable.setWorkingArea(CStation) for each dockable in grid.

Parameters:
grid - a grid containing some new Dockables

getStation

public DockStation getStation()
Description copied from interface: CStation
Gets the internal representation of this CStation.

Specified by:
getStation in interface CStation
Returns:
the interal representation

asDockable

public CDockable asDockable()
Description copied from interface: CStation
If this station is a CDockable as well, then this method returns the representation of this station as CDockable.

Specified by:
asDockable in interface CStation
Returns:
this as dockable or null

getStationLocation

public CLocation getStationLocation()
Description copied from interface: CStation
Gets a location which represents directly CStation.getStation().

Specified by:
getStationLocation in interface CStation
Returns:
the location that will always represent the station

setSuppressTitle

@Deprecated
public void setSuppressTitle(boolean suppressTitle)
Deprecated. use AbstractCDockable.setTitleShown(boolean) instead

Sets whether this working-area should suppress its title or not.

Parameters:
suppressTitle - true if this area should try not to have a title.

isSuppressTitle

@Deprecated
public boolean isSuppressTitle()
Deprecated. use AbstractCDockable.isTitleShown() instead

Tells whether this working-area suppresses its title.

Returns:
true if this area normally has no title

setTitleText

public void setTitleText(String text)
Sets the text that is shown as title.

Parameters:
text - the title

getTitleText

public String getTitleText()
Gets the text that is shown as title.

Returns:
the title

setTitleIcon

public void setTitleIcon(Icon icon)
Sets the icon that is shown in the title of this CDockable.

Parameters:
icon - the title-icon

getTitleIcon

public Icon getTitleIcon()
Gets the icon that is shown in the title.

Returns:
the title-icon, might be null

add

public <F extends SingleCDockable> F add(F dockable)
Ensures that this is the parent of dockable and adds dockable to the CControl which is associated with this CWorkingArea. If there is no CControl, then the dockable is added nowhere.

Type Parameters:
F - the type of element to add
Parameters:
dockable - the new element
Returns:
dockable

add

public <F extends MultipleCDockable> F add(F dockable)
Ensures that this is the parent of dockable and adds dockable to the CControl which is associated with this CWorkingArea. If there is no CControl, then the dockable is added nowhere.

Type Parameters:
F - the type of element to add
Parameters:
dockable - the new element
Returns:
dockable

setControl

public void setControl(CControlAccess control)
Description copied from class: AbstractCDockable
Sets the CControl which is responsible for this dockable.

Specified by:
setControl in interface CStation
Specified by:
setControl in interface CDockable
Overrides:
setControl in class AbstractCDockable
Parameters:
control - the new control

isCloseable

public boolean isCloseable()
Description copied from interface: CDockable
Tells whether this dockable can be closed by the user.

Specified by:
isCloseable in interface CDockable
Returns:
true if this element can be closed

getUniqueId

public String getUniqueId()
Description copied from interface: CStation
Gets a unique and constant identifier for this station

Specified by:
getUniqueId in interface CStation
Specified by:
getUniqueId in interface SingleCDockable
Returns:
the unique identifier

isExternalizable

public boolean isExternalizable()
Description copied from interface: CDockable
Tells whether this dockable can be externalized by the user.

Specified by:
isExternalizable in interface CDockable
Returns:
true if this element can be externalized

isMaximizable

public boolean isMaximizable()
Description copied from interface: CDockable
Tells whether this dockable can be maximized by the user.

Specified by:
isMaximizable in interface CDockable
Returns:
true if this element can be maximized

isMinimizable

public boolean isMinimizable()
Description copied from interface: CDockable
Tells whether this dockable can be minimized by the user.

Specified by:
isMinimizable in interface CDockable
Returns:
true if this element can be minimized

isStackable

public boolean isStackable()
Description copied from interface: CDockable
Tells whether this dockable can be combined with another dockable to create a stack.

Specified by:
isStackable in interface CDockable
Returns:
true if this element can be combined with another dockable, normally true should be the answer.

isWorkingArea

public boolean isWorkingArea()
Description copied from interface: CStation
Tells whether this station is a special working area or not. It is not possible drag a child from a working area if it is registered there, or to drop a child onto a working area if it is not registered there.

Specified by:
isWorkingArea in interface CStation
Returns:
true if this is a working area, false otherwise

suppressTitle

protected boolean suppressTitle(DockTitleVersion version)
Checks whether the title created by version should be suppressed.

Parameters:
version - the version of the title
Returns:
true if no DockTitle should be created