bibliothek.gui.dock.toolbar.item
Class DockActionItem

java.lang.Object
  extended by bibliothek.gui.dock.toolbar.item.DockActionItem
All Implemented Interfaces:
ToolbarItem

public class DockActionItem
extends Object
implements ToolbarItem

A wrapper around a DockAction allowing the action to show up on a toolbar.

Author:
Benjamin Sigg

Field Summary
static bibliothek.gui.dock.action.view.ViewTarget<bibliothek.gui.dock.themes.basic.action.BasicTitleViewItem<JComponent>> TOOLBAR
          A target for converting a DockAction into a Component that can be shown on a toolbar.
 
Constructor Summary
DockActionItem(bibliothek.gui.dock.action.DockAction action)
          Creates a new dockable showing action
 
Method Summary
 void addMouseInputListener(MouseInputListener listener)
          Urges this item to add listener to its component.
 void bind()
          Informs this item that it is now in use, the result of ToolbarItem.getComponent() must not be null and must not change after this method has been called.
 Component getComponent()
          Gets the Component which is wrapped by this item.
 void removeMouseInputListener(MouseInputListener listener)
          Urges this item to remove listener from its component.
 void setController(bibliothek.gui.DockController controller)
          Informs this item about the DockController in whose realm it is used.
 void setDockable(ToolbarItemDockable dockable)
          Informs this item about the Dockable that is using it.
 void setOrientation(Orientation orientation)
          Tells this item the orientation of the toolbar
 void setSelected(boolean selected)
          Informs this item whether it is actually shown or not.
 void unbind()
          Informs this item that it is no longer in use, the result of ToolbarItem.getComponent() can be null or change after this method has been called.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TOOLBAR

public static final bibliothek.gui.dock.action.view.ViewTarget<bibliothek.gui.dock.themes.basic.action.BasicTitleViewItem<JComponent>> TOOLBAR
A target for converting a DockAction into a Component that can be shown on a toolbar. If nothing else is defined, this target will automatically fall back to ViewTarget#TARGET

Constructor Detail

DockActionItem

public DockActionItem(bibliothek.gui.dock.action.DockAction action)
Creates a new dockable showing action

Parameters:
action - the action to show on this dockable
Method Detail

setDockable

public void setDockable(ToolbarItemDockable dockable)
Description copied from interface: ToolbarItem
Informs this item about the Dockable that is using it.

Specified by:
setDockable in interface ToolbarItem
Parameters:
dockable - the owner of this item

setController

public void setController(bibliothek.gui.DockController controller)
Description copied from interface: ToolbarItem
Informs this item about the DockController in whose realm it is used. This method will always be called before ToolbarItem.bind(), or after ToolbarItem.unbind(), is executed.

Specified by:
setController in interface ToolbarItem
Parameters:
controller - the controller in whose realm this item works, can be null

bind

public void bind()
Description copied from interface: ToolbarItem
Informs this item that it is now in use, the result of ToolbarItem.getComponent() must not be null and must not change after this method has been called.

Specified by:
bind in interface ToolbarItem

unbind

public void unbind()
Description copied from interface: ToolbarItem
Informs this item that it is no longer in use, the result of ToolbarItem.getComponent() can be null or change after this method has been called.

Specified by:
unbind in interface ToolbarItem

addMouseInputListener

public void addMouseInputListener(MouseInputListener listener)
Description copied from interface: ToolbarItem
Urges this item to add listener to its component. This method must only be called if ToolbarItem.bind() was executed.

Specified by:
addMouseInputListener in interface ToolbarItem
Parameters:
listener - the MouseListener and MouseMotionListener that should be added

removeMouseInputListener

public void removeMouseInputListener(MouseInputListener listener)
Description copied from interface: ToolbarItem
Urges this item to remove listener from its component. This method must only be called if ToolbarItem.bind() was executed.

Specified by:
removeMouseInputListener in interface ToolbarItem
Parameters:
listener - the MouseListener and MouseMotionListener that should be removed

getComponent

public Component getComponent()
Description copied from interface: ToolbarItem
Gets the Component which is wrapped by this item. The result of this method must not be null after ToolbarItem.bind() has been called, it may not change until ToolbarItem.unbind() was called.

Specified by:
getComponent in interface ToolbarItem
Returns:
the wrapped Component, can be null unless ToolbarItem.bind() was called

setSelected

public void setSelected(boolean selected)
Description copied from interface: ToolbarItem
Informs this item whether it is actually shown or not.

Specified by:
setSelected in interface ToolbarItem
Parameters:
selected - true if the item is shown

setOrientation

public void setOrientation(Orientation orientation)
Description copied from interface: ToolbarItem
Tells this item the orientation of the toolbar

Specified by:
setOrientation in interface ToolbarItem
Parameters:
orientation - the orientation of the toolbar