bibliothek.gui.dock.common.intern
Class AbstractCDockable

java.lang.Object
  extended by bibliothek.gui.dock.common.intern.AbstractCDockable
All Implemented Interfaces:
CDockable
Direct Known Subclasses:
CWorkingArea, DefaultCDockable

public abstract class AbstractCDockable
extends Object
implements CDockable

An abstract implementation of CDockable. Contains methods to work with listeners and with CActions.

Author:
Benjamin Sigg

Nested Class Summary
 
Nested classes/interfaces inherited from interface bibliothek.gui.dock.common.intern.CDockable
CDockable.ExtendedMode
 
Constructor Summary
protected AbstractCDockable(CommonDockable dockable)
          Creates a new dockable
 
Method Summary
 void addCDockableListener(CDockableListener listener)
          Adds a listener to this dockable, the listener will be informed of changes of this dockable.
protected  CControlAccess control()
          Gets access to the controller.
 DockActionSource getClose()
          Gets the source that contains the close-action.
 CControlAccess getControl()
          Gets the control which is responsible for this dockable.
 CDockable.ExtendedMode getExtendedMode()
          Gets the size and location of this dockable.
 CLocation getLocation()
          Gets the location of this dockable.
 CWorkingArea getWorkingArea()
          Gets the parent of this dockable, this should be the same as set by the last call of CDockable.setWorkingArea(CWorkingArea).
protected  void init(CommonDockable dockable)
          Initializes this CDockable.
 CommonDockable intern()
          Gets the intern representation of this dockable.
abstract  boolean isCloseable()
          Tells whether this dockable can be closed by the user.
 boolean isVisible()
          Tells whether this dockable is currently visible or not.
protected  CDockableListener[] listeners()
          Gets the list of listeners.
 void removeCDockableListener(CDockableListener listener)
          Removes a listener from this dockable.
 void setControl(CControlAccess control)
          Sets the CControl which is responsible for this dockable.
 void setExtendedMode(CDockable.ExtendedMode extendedMode)
          Sets how and where this dockable should be shown.
 void setLocation(CLocation location)
          Sets the location of this dockable.
 void setVisible(boolean visible)
          Shows or hides this dockable.
 void setWorkingArea(CWorkingArea area)
          Sets the parent of this dockable.
 void toFront()
          Tries to focus this dockable.
protected  void updateClose()
          Ensures that close contains an action when necessary.
 
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
isExternalizable, isMaximizable, isMinimizable, isStackable
 

Constructor Detail

AbstractCDockable

protected AbstractCDockable(CommonDockable dockable)
Creates a new dockable

Parameters:
dockable - the internal representation of this CDockable, can be null but then init(CommonDockable) should be called.
Method Detail

init

protected void init(CommonDockable dockable)
Initializes this CDockable.

Parameters:
dockable - the representation of this CDockable, not null

control

protected CControlAccess control()
Gets access to the controller.

Returns:
access or null

addCDockableListener

public void addCDockableListener(CDockableListener listener)
Adds a listener to this dockable, the listener will be informed of changes of this dockable.

Specified by:
addCDockableListener in interface CDockable
Parameters:
listener - the new listener

removeCDockableListener

public void removeCDockableListener(CDockableListener listener)
Removes a listener from this dockable.

Specified by:
removeCDockableListener in interface CDockable
Parameters:
listener - the listener to remove

listeners

protected CDockableListener[] listeners()
Gets the list of listeners.

Returns:
the listeners

isCloseable

public abstract boolean isCloseable()
Tells whether this dockable can be closed by the user. Clients which have a method like "setCloseable" can use updateClose() to ensure that an action is shown/hidden that allows the user to close this CDockable.

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

updateClose

protected void updateClose()
Ensures that close contains an action when necessary.


setVisible

public void setVisible(boolean visible)
Shows or hides this dockable. If this dockable is not visible and is made visible, then the framework tries to set its location at the last known position.

Specified by:
setVisible in interface CDockable
Parameters:
visible - the new visibility state
See Also:
CDockable.isVisible()

isVisible

public boolean isVisible()
Tells whether this dockable is currently visible or not.

Specified by:
isVisible in interface CDockable
Returns:
true if this dockable can be accessed by the user through a graphical user interface.

toFront

public void toFront()
Tries to focus this dockable. There are no guarantees that this dockabe really gets focused.


setLocation

public void setLocation(CLocation location)
Sets the location of this dockable. If this dockable is visible, than this method will take immediately effect. Otherwise the location will be stored in a cache and read as soon as this dockable is made visible.
Note that the location can only be seen as a hint, the framework tries to fit the location as good as possible, but there are no guarantees.

Specified by:
setLocation in interface CDockable
Parameters:
location - the new location, null is possible, but will not move the dockable immediately

getLocation

public CLocation getLocation()
Gets the location of this dockable. If this dockable is visible, then a location will always be returned. Otherwise a location will only be returned if it just was set using setLocation(CLocation).

Specified by:
getLocation in interface CDockable
Returns:
the location or null

setExtendedMode

public void setExtendedMode(CDockable.ExtendedMode extendedMode)
Sets how and where this dockable should be shown. Conflicts with CDockable.isExternalizable(), CDockable.isMaximizable() and CDockable.isMinimizable() will just be ignored.

Specified by:
setExtendedMode in interface CDockable
Parameters:
extendedMode - the size and location

getExtendedMode

public CDockable.ExtendedMode getExtendedMode()
Gets the size and location of this dockable.

Specified by:
getExtendedMode in interface CDockable
Returns:
the size and location or null if this dockable is not part of an CControl.

setWorkingArea

public void setWorkingArea(CWorkingArea area)
Description copied from interface: CDockable
Sets the parent of this dockable. This method can be called by the client or indirectly through CDockable.setLocation(CLocation).

Specified by:
setWorkingArea in interface CDockable
Parameters:
area - the new parent or null

getWorkingArea

public CWorkingArea getWorkingArea()
Description copied from interface: CDockable
Gets the parent of this dockable, this should be the same as set by the last call of CDockable.setWorkingArea(CWorkingArea).

Specified by:
getWorkingArea in interface CDockable
Returns:
the parent or null

intern

public CommonDockable intern()
Gets the intern representation of this dockable.

Specified by:
intern in interface CDockable
Returns:
the intern representation.

setControl

public void setControl(CControlAccess control)
Sets the CControl which is responsible for this dockable.

Specified by:
setControl in interface CDockable
Parameters:
control - the new control

getClose

public DockActionSource getClose()
Gets the source that contains the close-action.

Specified by:
getClose in interface CDockable
Returns:
the source

getControl

public CControlAccess getControl()
Gets the control which is responsible for this dockable.

Specified by:
getControl in interface CDockable
Returns:
the control