bibliothek.gui.dock.common
Class CGridArea

java.lang.Object
  extended by bibliothek.gui.dock.common.intern.AbstractCDockable
      extended by bibliothek.gui.dock.common.intern.AbstractDockableCStation<CSplitDockStation>
          extended by bibliothek.gui.dock.common.CGridArea
All Implemented Interfaces:
CStation<CSplitDockStation>, CDockable, SingleCDockable
Direct Known Subclasses:
CWorkingArea

public class CGridArea
extends AbstractDockableCStation<CSplitDockStation>
implements SingleCDockable

In a CGridArea normalized CDockable can be shown. Clients should use getComponent() to gain access to a JComponent that represents this area.

Author:
Benjamin Sigg

Field Summary
static Path TYPE_ID
          The result of getTypeId()
 
Fields inherited from class bibliothek.gui.dock.common.intern.AbstractCDockable
listenerCollection
 
Fields inherited from interface bibliothek.gui.dock.common.intern.CDockable
ACTION_KEY_CLOSE, ACTION_KEY_EXTERNALIZE, ACTION_KEY_MAXIMIZE, ACTION_KEY_MINIMIZE, ACTION_KEY_MINIMIZE_HOLD, ACTION_KEY_NORMALIZE, ACTION_KEY_UNEXTERNALIZE, ACTION_KEY_UNMAXIMIZE_EXTERNALIZED
 
Constructor Summary
protected CGridArea()
          Creates a new grid area but does not yet initialize its fields.
  CGridArea(CControl control, String uniqueId)
          Creates a new area.
 
Method Summary
 CDockable asDockable()
          If this station is a CDockable as well, then this method returns the representation of this station as CDockable.
protected  CommonDockable createCommonDockable()
          Creates the CommonDockable that is associated with this dockable, called the first time the CommonDockable is required for an operation.
 CStationPerspective createPerspective()
          Returns a new CStationPerspective that represents this station.
 void deploy(CGrid grid)
          Exchanges all the CDockables on this area with the elements of grid.
 JComponent getComponent()
          Gets the JComponent which represents this station.
 CSplitDockStation 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.
 Path getTypeId()
          Gets a unique path denoting the type of this station.
 String getUniqueId()
          Gets a unique and constant identifier for this station
protected  void init(CControl control, String uniqueId)
          Initializes the fields of this area.
protected  void install(CControlAccess access)
          Called when this station is added to a CControl.
 boolean isCloseable()
          Tells whether this CDockable can be closed by the user.
 boolean isExternalizable()
          Tells whether this CDockable can be externalized by the user.
 boolean isMaximizable()
          Tells whether this CDockable can be maximized by the user.
 boolean isMaximizingArea()
          Tells whether children of this area remain children when maximized or not.
 boolean isMinimizable()
          Tells whether this CDockable can be minimized by the user.
 boolean isStackable()
          Tells whether this CDockable can be combined with another Dockable to create a stack.
 boolean isWorkingArea()
          Tells whether this station is a special working area or not.
 void setMaximizingArea(boolean maximize)
          Sets whether this area is also used as maximizing area.
 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.
protected  void uninstall(CControlAccess access)
          Called when this station is removed from a CControl.
 
Methods inherited from class bibliothek.gui.dock.common.intern.AbstractDockableCStation
asStation, getDropLocation, init, setControlAccess, toString
 
Methods inherited from class bibliothek.gui.dock.common.intern.AbstractCDockable
addCDockableLocationListener, addCDockablePropertyListener, addCDockableStateListener, addDoubleClickListener, addFocusListener, addKeyboardListener, addVetoClosingListener, control, getAction, getAndClearResizeRequest, getAutoBaseLocation, getBaseLocation, getClose, getColors, getControl, getControlAccess, getDefaultLocation, getExtendedMode, getFocusComponent, getFonts, getMinimizedSize, getWorkingArea, hasParent, init, intern, isDockableVisible, isEnabled, isMinimizedHold, isMinimizedHoldSwitchable, isResizeLocked, isResizeLockedHorizontally, isResizeLockedVertically, isShowing, isSingleTabShown, isSticky, isStickySwitchable, isTitleShown, isVisible, propertyListeners, putAction, removeCDockableLocationListener, removeCDockablePropertyListener, removeCDockableStateListener, removeDoubleClickListener, removeFocusListener, removeKeyboardListener, removeVetoClosingListener, setDefaultLocation, setEnabled, setExtendedMode, setFocusComponent, setLocation, setMinimizedHold, setMinimizedHoldSwitchable, setMinimizedSize, setResizeLocked, setResizeLockedHorizontally, setResizeLockedVertically, setResizeRequest, setResizeRequest, setSingleTabShown, setSticky, setStickySwitchable, setTitleShown, setVisible, setWorkingArea, stateListeners, toFront
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface bibliothek.gui.dock.common.intern.CDockable
addCDockableLocationListener, addCDockablePropertyListener, addCDockableStateListener, addDoubleClickListener, addFocusListener, addKeyboardListener, addVetoClosingListener, asStation, getAction, getAndClearResizeRequest, getAutoBaseLocation, getBaseLocation, getColors, getControl, getControlAccess, getExtendedMode, getFocusComponent, getFonts, getMinimizedSize, getWorkingArea, hasParent, intern, isDockableVisible, isEnabled, isMinimizedHold, isMinimizedHoldSwitchable, isResizeLockedHorizontally, isResizeLockedVertically, isShowing, isSingleTabShown, isSticky, isStickySwitchable, isTitleShown, isVisible, removeCDockableLocationListener, removeCDockablePropertyListener, removeCDockableStateListener, removeDoubleClickListener, removeFocusListener, removeKeyboardListener, removeVetoClosingListener, setControlAccess, setExtendedMode, setLocation, setMinimizedHold, setMinimizedHoldSwitchable, setMinimizedSize, setSticky, setStickySwitchable, setVisible, setWorkingArea
 

Field Detail

TYPE_ID

public static final Path TYPE_ID
The result of getTypeId()

Constructor Detail

CGridArea

public CGridArea(CControl control,
                 String uniqueId)
Creates a new area.

Parameters:
control - the owner of this station
uniqueId - a unique identifier

CGridArea

protected CGridArea()
Creates a new grid area but does not yet initialize its fields. Subclasses must call init(CControl, String) to complete initialization

Method Detail

init

protected void init(CControl control,
                    String uniqueId)
Initializes the fields of this area.

Parameters:
control - the owner of this station
uniqueId - a unique identifier

createCommonDockable

protected CommonDockable createCommonDockable()
Description copied from class: AbstractCDockable
Creates the CommonDockable that is associated with this dockable, called the first time the CommonDockable is required for an operation.

Overrides:
createCommonDockable in class AbstractDockableCStation<CSplitDockStation>
Returns:
the new dockable

deploy

public void deploy(CGrid grid)
Exchanges all the CDockables on this area with the elements of grid.

Parameters:
grid - a grid containing some new Dockables

getStation

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

Specified by:
getStation in interface CStation<CSplitDockStation>
Overrides:
getStation in class AbstractDockableCStation<CSplitDockStation>
Returns:
the internal 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<CSplitDockStation>
Overrides:
asDockable in class AbstractDockableCStation<CSplitDockStation>
Returns:
this as dockable or null

createPerspective

public CStationPerspective createPerspective()
Description copied from interface: CStation
Returns a new CStationPerspective that represents this station. This method does not need to set any content of the new perspective. Basically this method just needs to tell the framework what type of CStationPerspective is needed, not what its content is.

Specified by:
createPerspective in interface CStation<CSplitDockStation>
Returns:
the new, empty perspective
See Also:
CStation.getTypeId()

getComponent

public JComponent getComponent()
Gets the JComponent which represents this station.

Returns:
the component

getStationLocation

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

Specified by:
getStationLocation in interface CStation<CSplitDockStation>
Overrides:
getStationLocation in class AbstractDockableCStation<CSplitDockStation>
Returns:
the location that will always represent the station

getTypeId

public Path getTypeId()
Description copied from interface: CStation
Gets a unique path denoting the type of this station. This path will be given to MissingPerspectiveStrategy.createStation(String, Path) when loading a layout as a CPerspective.

Specified by:
getTypeId in interface CStation<CSplitDockStation>
Returns:
the type of this station. Paths starting with "dock." are reserved for the framework. A value of null will just be ignored.

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

setMaximizingArea

public void setMaximizingArea(boolean maximize)
Sets whether this area is also used as maximizing area. If so then pressing the "maximize"-button of a child of this area will have the effect that the child is maximized only within this area. Otherwise it takes more space.

Parameters:
maximize - true if children should be maximized to this area, false if not.

isMaximizingArea

public boolean isMaximizingArea()
Tells whether children of this area remain children when maximized or not.

Returns:
true if children remain children
See Also:
setMaximizingArea(boolean)

install

protected void install(CControlAccess access)
Description copied from class: AbstractDockableCStation
Called when this station is added to a CControl.

Specified by:
install in class AbstractDockableCStation<CSplitDockStation>
Parameters:
access - access to the internals of the new owner

uninstall

protected void uninstall(CControlAccess access)
Description copied from class: AbstractDockableCStation
Called when this station is removed from a CControl.

Specified by:
uninstall in class AbstractDockableCStation<CSplitDockStation>
Parameters:
access - access to the internals of the old owner

isCloseable

public boolean isCloseable()
Description copied from interface: CDockable
Tells whether this CDockable can be closed by the user. A close-button has to be provided by the CDockable itself. The best way to do that is to instantiate a CloseActionSource and include this source in the array that is returned by CommonDockable.getSources().

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<CSplitDockStation>
Specified by:
getUniqueId in interface SingleCDockable
Overrides:
getUniqueId in class AbstractDockableCStation<CSplitDockStation>
Returns:
the unique identifier

isExternalizable

public boolean isExternalizable()
Description copied from interface: CDockable
Tells whether this CDockable 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 CDockable 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 CDockable 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 CDockable 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.
Working areas must either be registered as root-station (see CControl.addStation(CStation, boolean)) or must be a SingleCDockable.

Specified by:
isWorkingArea in interface CStation<CSplitDockStation>
Overrides:
isWorkingArea in class AbstractDockableCStation<CSplitDockStation>
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