bibliothek.gui.dock.themes.basic
Class TabDecorator

java.lang.Object
  extended by bibliothek.gui.dock.themes.basic.TabDecorator
All Implemented Interfaces:
StackDockComponentParent, BasicDockableDisplayerDecorator

public class TabDecorator
extends Object
implements BasicDockableDisplayerDecorator, StackDockComponentParent

Shows a StackDockComponent as decoration.

Author:
Benjamin Sigg

Constructor Summary
TabDecorator(DockStation station, PropertyKey<DockActionDistributor> distributor)
          Creates a new decorator
 
Method Summary
 void addDecoratorListener(BasicDockableDisplayerDecoratorListener listener)
          Adds the listener listener to this decorator, listener will be informed if a property of this decorator changes.
protected  void fireMoveableElementChanged()
          Calls BasicDockableDisplayerDecoratorListener.moveableElementChanged(BasicDockableDisplayerDecorator) on all listeners that are currently registered.
 DockActionSource getActionSuggestion()
          Gets a DockActionSource which is forwarded to the DockTitle through a ActionsDockTitleEvent.
 Component getComponent()
          Gets the Component which represents this decorator, the result of this method may change whenever BasicDockableDisplayerDecorator.setController(DockController) or BasicDockableDisplayerDecorator.setDockable(Component, Dockable) is called.
 Insets getDockableInsets()
          Gets an estimate of how much space of the component is used by the border around the Dockable.
 DockElementRepresentative getMoveableElement()
          Gets a DockElementRepresentative that can be used to move the entire displayer.
 StackDockComponent getStackComponent()
          Gets the component which is used by this TabDecorator.
 DockStation getStackDockParent()
          Gets the station this parent represents.
 int indexOf(Dockable dockable)
          Gets the index of dockable in the list of dockables that are present on this parent.
 void removeDecoratorListener(BasicDockableDisplayerDecoratorListener listener)
          Removes the listener listener from this decorator.
 void setController(DockController controller)
          Sets the controller in whose realm this decorator works
 void setDockable(Component panel, Dockable dockable)
          Sets the element to show on this decorator, can be null
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TabDecorator

public TabDecorator(DockStation station,
                    PropertyKey<DockActionDistributor> distributor)
Creates a new decorator

Parameters:
station - the station for which this decorator is used
distributor - key to a DockActionDistributor that suggests the actions for the title
Method Detail

addDecoratorListener

public void addDecoratorListener(BasicDockableDisplayerDecoratorListener listener)
Description copied from interface: BasicDockableDisplayerDecorator
Adds the listener listener to this decorator, listener will be informed if a property of this decorator changes.

Specified by:
addDecoratorListener in interface BasicDockableDisplayerDecorator
Parameters:
listener - the new listener, not null

removeDecoratorListener

public void removeDecoratorListener(BasicDockableDisplayerDecoratorListener listener)
Description copied from interface: BasicDockableDisplayerDecorator
Removes the listener listener from this decorator.

Specified by:
removeDecoratorListener in interface BasicDockableDisplayerDecorator
Parameters:
listener - the listener to remove

fireMoveableElementChanged

protected void fireMoveableElementChanged()
Calls BasicDockableDisplayerDecoratorListener.moveableElementChanged(BasicDockableDisplayerDecorator) on all listeners that are currently registered.


getStackDockParent

public DockStation getStackDockParent()
Description copied from interface: StackDockComponentParent
Gets the station this parent represents.

Specified by:
getStackDockParent in interface StackDockComponentParent
Returns:
the station

indexOf

public int indexOf(Dockable dockable)
Description copied from interface: StackDockComponentParent
Gets the index of dockable in the list of dockables that are present on this parent.

Specified by:
indexOf in interface StackDockComponentParent
Parameters:
dockable - some dockable
Returns:
its index or -1

getStackComponent

public StackDockComponent getStackComponent()
Gets the component which is used by this TabDecorator.

Returns:
the StackDockComponent, may be null

setDockable

public void setDockable(Component panel,
                        Dockable dockable)
Description copied from interface: BasicDockableDisplayerDecorator
Sets the element to show on this decorator, can be null

Specified by:
setDockable in interface BasicDockableDisplayerDecorator
Parameters:
panel - the component which represents dockable
dockable - the element to show

getMoveableElement

public DockElementRepresentative getMoveableElement()
Description copied from interface: BasicDockableDisplayerDecorator
Gets a DockElementRepresentative that can be used to move the entire displayer. This method should not return the Dockable itself.

Specified by:
getMoveableElement in interface BasicDockableDisplayerDecorator
Returns:
an element to move the displayer, can be null

setController

public void setController(DockController controller)
Description copied from interface: BasicDockableDisplayerDecorator
Sets the controller in whose realm this decorator works

Specified by:
setController in interface BasicDockableDisplayerDecorator
Parameters:
controller - the controller

getComponent

public Component getComponent()
Description copied from interface: BasicDockableDisplayerDecorator
Gets the Component which represents this decorator, the result of this method may change whenever BasicDockableDisplayerDecorator.setController(DockController) or BasicDockableDisplayerDecorator.setDockable(Component, Dockable) is called.

Specified by:
getComponent in interface BasicDockableDisplayerDecorator
Returns:
the component or null to show nothing

getActionSuggestion

public DockActionSource getActionSuggestion()
Description copied from interface: BasicDockableDisplayerDecorator
Gets a DockActionSource which is forwarded to the DockTitle through a ActionsDockTitleEvent. This method may be called at any time, the action source must update itself if the settings of this decorator (like BasicDockableDisplayerDecorator.setController(DockController)) change.

Specified by:
getActionSuggestion in interface BasicDockableDisplayerDecorator
Returns:
the suggestion for actions, can be null

getDockableInsets

public Insets getDockableInsets()
Description copied from interface: BasicDockableDisplayerDecorator
Gets an estimate of how much space of the component is used by the border around the Dockable.

Specified by:
getDockableInsets in interface BasicDockableDisplayerDecorator
Returns:
an estimate of how much space is used by the border