bibliothek.gui.dock.common.intern
Interface CDockable

All Known Subinterfaces:
MultipleCDockable, SingleCDockable
All Known Implementing Classes:
AbstractCDockable, CWorkingArea, DefaultCDockable, DefaultMultipleCDockable, DefaultSingleCDockable

public interface CDockable

A basic element representing some Component.

Author:
Benjamin Sigg

Nested Class Summary
static class CDockable.ExtendedMode
          The mode tells how big a CDockable is.
 
Field Summary
static String ACTION_KEY_CLOSE
          Key for an action of getAction(String).
static String ACTION_KEY_EXTERNALIZE
          Key for an action of getAction(String).
static String ACTION_KEY_MAXIMIZE
          Key for an action of getAction(String).
static String ACTION_KEY_MINIMIZE
          Key for an action of getAction(String).
static String ACTION_KEY_NORMALIZE
          Key for an action of getAction(String).
 
Method Summary
 void addCDockablePropertyListener(CDockablePropertyListener listener)
          Adds a property listener to this dockable, the listener will be informed of changes of this dockable.
 void addCDockableStateListener(CDockableStateListener listener)
          Adds a state listener to this dockable, the listener will be informed of changes of this dockable.
 void addDoubleClickListener(CDoubleClickListener listener)
          Adds a new listener to this dockable.
 void addFocusListener(CFocusListener listener)
          Adds a focus listener to this dockable.
 void addKeyboardListener(CKeyboardListener listener)
          Adds a keyboard listener to this dockable.
 CAction getAction(String key)
          Gets an action which is not added to the title by this CDockable put by another module.
 RequestDimension getAndClearResizeRequest()
          Gets the preferred size of this CDockable.
 CLocation getBaseLocation()
          Gets the location of this dockable.
 ColorMap getColors()
          Gets a mutable map of colors.
 CControlAccess getControl()
          Gets the control which is responsible for this dockable.
 CDockable.ExtendedMode getExtendedMode()
          Gets the size and location of this dockable.
 Dimension getMinimizedSize()
          Gets the size which is used when this dockable is minimzed and on a popup window.
 CStation getWorkingArea()
          Gets the parent of this dockable, this should be the same as set by the last call of setWorkingArea(CStation).
 CommonDockable intern()
          Gets the intern representation of this dockable.
 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 isMinimizedHold()
          Tells whether this dockable remains visible when minimized and without focus.
 boolean isResizeLockedHorizontally()
          Tells whether the width of this dockable should remain the same when its parent changes the size.
 boolean isResizeLockedVertically()
          Tells whether the height of this dockable should remain the same when its parent changes the size.
 boolean isStackable()
          Tells whether this dockable can be combined with another dockable to create a stack.
 boolean isTitleShown()
          Tells whether this dockable shows its title or not.
 boolean isVisible()
          Tells whether this dockable is currently visible or not.
 void removeCDockablePropertyListener(CDockablePropertyListener listener)
          Removes a property listener from this dockable.
 void removeCDockableStateListener(CDockableStateListener listener)
          Removes a state listener from this dockable.
 void removeDoubleClickListener(CDoubleClickListener listener)
          Removes a listener from this dockable.
 void removeFocusListener(CFocusListener listener)
          Removes a focus listener from this dockable.
 void removeKeyboardListener(CKeyboardListener 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 setMinimizedHold(boolean hold)
          Sets whether this dockable should remain visible when minimized and without focus.
 void setMinimizedSize(Dimension size)
          Sets the size of this dockable when this dockable is minimized and on a popup window.
 void setVisible(boolean visible)
          Shows or hides this dockable.
 void setWorkingArea(CStation area)
          Sets the parent of this dockable.
 

Field Detail

ACTION_KEY_MINIMIZE

static final String ACTION_KEY_MINIMIZE
Key for an action of getAction(String). The action behind this key should call setExtendedMode(bibliothek.gui.dock.common.intern.CDockable.ExtendedMode) with an argument of CDockable.ExtendedMode.MINIMIZED.

See Also:
Constant Field Values

ACTION_KEY_MAXIMIZE

static final String ACTION_KEY_MAXIMIZE
Key for an action of getAction(String). The action behind this key should call setExtendedMode(bibliothek.gui.dock.common.intern.CDockable.ExtendedMode) with an argument of CDockable.ExtendedMode.MAXIMIZED.

See Also:
Constant Field Values

ACTION_KEY_NORMALIZE

static final String ACTION_KEY_NORMALIZE
Key for an action of getAction(String). The action behind this key should call setExtendedMode(bibliothek.gui.dock.common.intern.CDockable.ExtendedMode) with an argument of CDockable.ExtendedMode.NORMALIZED.

See Also:
Constant Field Values

ACTION_KEY_EXTERNALIZE

static final String ACTION_KEY_EXTERNALIZE
Key for an action of getAction(String). The action behind this key should call setExtendedMode(bibliothek.gui.dock.common.intern.CDockable.ExtendedMode) with an argument of CDockable.ExtendedMode.EXTERNALIZED.

See Also:
Constant Field Values

ACTION_KEY_CLOSE

static final String ACTION_KEY_CLOSE
Key for an action of getAction(String). The action behind this key should call setVisible(boolean) with the argument false.

See Also:
Constant Field Values
Method Detail

addCDockableStateListener

void addCDockableStateListener(CDockableStateListener listener)
Adds a state listener to this dockable, the listener will be informed of changes of this dockable.

Parameters:
listener - the new listener

addCDockablePropertyListener

void addCDockablePropertyListener(CDockablePropertyListener listener)
Adds a property listener to this dockable, the listener will be informed of changes of this dockable.

Parameters:
listener - the new listener

removeCDockableStateListener

void removeCDockableStateListener(CDockableStateListener listener)
Removes a state listener from this dockable.

Parameters:
listener - the listener to remove

removeCDockablePropertyListener

void removeCDockablePropertyListener(CDockablePropertyListener listener)
Removes a property listener from this dockable.

Parameters:
listener - the listener to remove

addFocusListener

void addFocusListener(CFocusListener listener)
Adds a focus listener to this dockable. The focus listener gets informed when this dockable gains or loses the focus.

Parameters:
listener - the new listener

removeFocusListener

void removeFocusListener(CFocusListener listener)
Removes a focus listener from this dockable.

Parameters:
listener - the listener to remove

addKeyboardListener

void addKeyboardListener(CKeyboardListener listener)
Adds a keyboard listener to this dockable. The listener gets informed when a key is pressed or released on this dockable.

Parameters:
listener - the new listener

removeKeyboardListener

void removeKeyboardListener(CKeyboardListener listener)
Removes a listener from this dockable.

Parameters:
listener - the listener to remove

addDoubleClickListener

void addDoubleClickListener(CDoubleClickListener listener)
Adds a new listener to this dockable. The listener gets informed when the mouse is clicked twice on this dockable.

Parameters:
listener - the new listener

removeDoubleClickListener

void removeDoubleClickListener(CDoubleClickListener listener)
Removes a listener from this dockable.

Parameters:
listener - the listener to remove

isMinimizable

boolean isMinimizable()
Tells whether this dockable can be minimized by the user.

Returns:
true if this element can be minimized

isMaximizable

boolean isMaximizable()
Tells whether this dockable can be maximized by the user.

Returns:
true if this element can be maximized

isExternalizable

boolean isExternalizable()
Tells whether this dockable can be externalized by the user.

Returns:
true if this element can be externalized

isStackable

boolean isStackable()
Tells whether this dockable can be combined with another dockable to create a stack.

Returns:
true if this element can be combined with another dockable, normally true should be the answer.

isCloseable

boolean isCloseable()
Tells whether this dockable can be closed by the user.

Returns:
true if this element can be closed

isResizeLockedVertically

boolean isResizeLockedVertically()
Tells whether the height of this dockable should remain the same when its parent changes the size. This has only effect if the parent can choose the size of its children. A lock is no guarantee for staying with the same size, the user still can resize this dockable.

Returns:
true if the height of this dockable should remain the same during resize events of the parent.

isResizeLockedHorizontally

boolean isResizeLockedHorizontally()
Tells whether the width of this dockable should remain the same when its parent changes the size. This has only effect if the parent can choose the size of its children. A lock is no guarantee for staying with the same size, the user still can resize this dockable.

Returns:
true if the width of this dockable should remain the same during resize events of the parent.

getAndClearResizeRequest

RequestDimension getAndClearResizeRequest()
Gets the preferred size of this CDockable. The preferred size will be used to resize this CDockable when CControl.handleResizeRequests() is called. There are no guarantees that the request can be granted, or will be handled at all.
Calling this method should delete the request, so calling this method twice should have the effect, that the second time null is returned.

Returns:
the next requested size or null

setVisible

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.
Subclasses should call CControlAccess.show(CDockable) or CControlAccess.hide(CDockable).

Parameters:
visible - the new visibility state
Throws:
IllegalStateException - if this dockable can't be made visible
See Also:
isVisible()

isVisible

boolean isVisible()
Tells whether this dockable is currently visible or not. Visibility means that this dockable is in the tree structure of DockingFrames. Being in the structure does not imply being visible on the screen. If some JFrame is not shown, or some DockStation not properly added to a parent component, then a visible dockable can be invisible for the user.
Subclasses should return the result of CControlAccess.isVisible(CDockable).

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

setLocation

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.

Parameters:
location - the new location, null is possible, but will not move the dockable immediately

getBaseLocation

CLocation getBaseLocation()
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).

Returns:
the location or null

setExtendedMode

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

Parameters:
extendedMode - the size and location

getExtendedMode

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

Returns:
the size and location or null if this dockable is not part of an CControl.

setWorkingArea

void setWorkingArea(CStation area)
Sets the parent of this dockable. This method can be called by the client or indirectly through setLocation(CLocation).

Parameters:
area - the new parent or null

getWorkingArea

CStation getWorkingArea()
Gets the parent of this dockable, this should be the same as set by the last call of setWorkingArea(CStation).

Returns:
the parent or null

setMinimizedSize

void setMinimizedSize(Dimension size)
Sets the size of this dockable when this dockable is minimized and on a popup window.

Parameters:
size - the size

getMinimizedSize

Dimension getMinimizedSize()
Gets the size which is used when this dockable is minimzed and on a popup window. If a value below 0 is set, then the default size is used.

Returns:
the size

setMinimizedHold

void setMinimizedHold(boolean hold)
Sets whether this dockable should remain visible when minimized and without focus.

Parameters:
hold - whether to remain visible

isMinimizedHold

boolean isMinimizedHold()
Tells whether this dockable remains visible when minimized and without focus.

Returns:
true if this remains visible, false otherwise

isTitleShown

boolean isTitleShown()
Tells whether this dockable shows its title or not. Note that some DockThemes might override this setting.

Returns:
true if the title is shown, false otherwise.

intern

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

Returns:
the intern representation.

setControl

void setControl(CControlAccess control)
Sets the CControl which is responsible for this dockable. Subclasses must call CControlAccess.link(CDockable, CDockableAccess) to grant the CControl access to the internal systems of this CDockable. link can also be used to revoke access.

Parameters:
control - the new control or null

getAction

CAction getAction(String key)
Gets an action which is not added to the title by this CDockable put by another module.

Parameters:
key - the name of the action
Returns:
an action or null

getColors

ColorMap getColors()
Gets a mutable map of colors. Clients can put colors into this map, and the colors will be presented on the screen by various effects.

Returns:
the map, this has always to be the same object

getControl

CControlAccess getControl()
Gets the control which is responsible for this dockable. Clients should not use this method unless they know exactly what they are doing.

Returns:
the control