bibliothek.gui.dock.common.intern
Class AbstractDockableCStation<S extends CommonDockStation<?,?>>

java.lang.Object
  extended by bibliothek.gui.dock.common.intern.AbstractCDockable
      extended by bibliothek.gui.dock.common.intern.AbstractDockableCStation<S>
Type Parameters:
S - the kind of station represented by this wrapper
All Implemented Interfaces:
CStation<S>, CDockable
Direct Known Subclasses:
CGridArea

public abstract class AbstractDockableCStation<S extends CommonDockStation<?,?>>
extends AbstractCDockable
implements CStation<S>

An abstract implementation of CStation that can be docked like a CDockable.

Author:
Benjamin Sigg

Field Summary
 
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 AbstractDockableCStation()
          Creates a new station but does not yet initialize its fields.
  AbstractDockableCStation(S station, String id, CLocation location, CommonDockable dockable)
          Creates a new station.
 
Method Summary
 CDockable asDockable()
          If this station is a CDockable as well, then this method returns the representation of this station as CDockable.
 CStation<?> asStation()
          Gets this or an object representing this as CStation.
protected  CommonDockable createCommonDockable()
          Creates the CommonDockable that is associated with this dockable, called the first time the CommonDockable is required for an operation.
 CLocation getDropLocation()
          Creates a CLocation that can be used to drop a new CDockable on this station or one of its children stations.
 S getStation()
          Gets the internal representation of this CStation.
 CLocation getStationLocation()
          Gets a location which represents directly CStation.getStation().
 String getUniqueId()
          Gets a unique and constant identifier for this station
protected  void init(S station, String id, CLocation location, CommonDockable dockable)
          Initializes the fields of this station.
protected abstract  void install(CControlAccess access)
          Called when this station is added to a CControl.
 boolean isWorkingArea()
          Tells whether this station is a special working area or not.
 void setControlAccess(CControlAccess access)
          Sets the CControl which is responsible for this CDockable.
 String toString()
           
protected abstract  void uninstall(CControlAccess access)
          Called when this station is removed from a CControl.
 
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, getDockableUniqueId, getExtendedMode, getFocusComponent, getFonts, getGrouping, getMinimizedSize, getParentStation, getWorkingArea, hasParent, init, intern, isDockableVisible, isEnabled, isNormalizeable, isResizeLocked, isResizeLockedHorizontally, isResizeLockedVertically, isShowing, isSingleTabShown, isSticky, isStickySwitchable, isTitleShown, isVisible, propertyListeners, putAction, removeCDockableLocationListener, removeCDockablePropertyListener, removeCDockableStateListener, removeDoubleClickListener, removeFocusListener, removeKeyboardListener, removeVetoClosingListener, setDefaultLocation, setEnabled, setExtendedMode, setFocusComponent, setGrouping, setLocation, setLocationsAside, setLocationsAside, setLocationsAsideFocused, 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.CStation
createPerspective, getTypeId
 
Methods inherited from interface bibliothek.gui.dock.common.intern.CDockable
isCloseable, isExternalizable, isMaximizable, isMinimizable, isStackable
 

Constructor Detail

AbstractDockableCStation

public AbstractDockableCStation(S station,
                                String id,
                                CLocation location,
                                CommonDockable dockable)
Creates a new station.

Parameters:
station - the internal representation of this station
id - the unique id of this station
location - a location that points directly to this station
dockable - how this station appears as dockable

AbstractDockableCStation

protected AbstractDockableCStation()
Creates a new station but does not yet initialize its fields. Subclasses should call init(CommonDockStation, String, CLocation, CommonDockable).

Method Detail

init

protected void init(S station,
                    String id,
                    CLocation location,
                    CommonDockable dockable)
Initializes the fields of this station.

Parameters:
station - the internal representation of this station
id - the unique id of this station
location - a location that points directly to this station
dockable - how this station appears as dockable

toString

public String toString()
Overrides:
toString in class AbstractCDockable

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.

Specified by:
createCommonDockable in class AbstractCDockable
Returns:
the new dockable

getStationLocation

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

Specified by:
getStationLocation in interface CStation<S extends CommonDockStation<?,?>>
Returns:
the location that will always represent the station

getDropLocation

public CLocation getDropLocation()
Description copied from interface: CStation
Creates a CLocation that can be used to drop a new CDockable on this station or one of its children stations. This method returns the "optimal spot", where the definition of "optimal spot" is up to the station itself. The default implementations however call CLocationModeManager.getDropLocation(CStation).

Specified by:
getDropLocation in interface CStation<S extends CommonDockStation<?,?>>
Returns:
the optimal spot for dropping a new CDockable or null if this station is not able to calculate the optimal spot (e.g. because the station is not visible)
See Also:
CDockable.setLocationsAside(CDockable), CDockable.setLocationsAsideFocused()

getUniqueId

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

Specified by:
getUniqueId in interface CStation<S extends CommonDockStation<?,?>>
Returns:
the unique identifier

getStation

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

Specified by:
getStation in interface CStation<S extends CommonDockStation<?,?>>
Returns:
the internal representation

asStation

public CStation<?> asStation()
Description copied from interface: CDockable
Gets this or an object representing this as CStation.

Specified by:
asStation in interface CDockable
Returns:
this as station or null

setControlAccess

public void setControlAccess(CControlAccess access)
Description copied from interface: CDockable
Sets the CControl which is responsible for this CDockable. Subclasses must call CControlAccess.link(CDockable, CDockableAccess) to grant the CControl access to the internal properties of this CDockable. link can also be used to revoke access.

Specified by:
setControlAccess in interface CStation<S extends CommonDockStation<?,?>>
Specified by:
setControlAccess in interface CDockable
Overrides:
setControlAccess in class AbstractCDockable
Parameters:
access - the new control or null

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<S extends CommonDockStation<?,?>>
Returns:
true if this is a working area, false otherwise

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<S extends CommonDockStation<?,?>>
Returns:
this as dockable or null

install

protected abstract void install(CControlAccess access)
Called when this station is added to a CControl.

Parameters:
access - access to the internals of the new owner

uninstall

protected abstract void uninstall(CControlAccess access)
Called when this station is removed from a CControl.

Parameters:
access - access to the internals of the old owner