bibliothek.gui.dock.themes.basic.action.dropdown
Class SubDropDownHandler

java.lang.Object
  extended by bibliothek.gui.dock.themes.basic.action.dropdown.SubDropDownHandler
All Implemented Interfaces:
ViewItem<JComponent>, DropDownViewItem, MenuViewItem<JComponent>

public class SubDropDownHandler
extends Object
implements DropDownViewItem

A handler that connects non-selectable, non-triggerable items with a drop-down-button.

Author:
Benjamin Sigg

Constructor Summary
SubDropDownHandler(MenuViewItem<JComponent> view)
          Creates a new handler.
 
Method Summary
 void addActionListener(ActionListener listener)
          Adds a listener which will be called if this view is triggered.
 void bind()
          Binds this item to its action
 DockAction getAction()
          Gets the action that is represented by this target.
 JComponent getItem()
          Gets this item as component.
 boolean isSelectable()
          Tells whether this item can be selected by the button.
 boolean isTriggerable(boolean selected)
          Tells whether the item can be triggered if it is on the button or in the menu.
 void removeActionListener(ActionListener listener)
          Removes a listener from this view.
 void setView(DropDownView view)
          Sends the current settings of this item to the view.
 void triggered()
          Invoked if the item is triggered from outside.
 void unbind()
          Unbinds this item from its action
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SubDropDownHandler

public SubDropDownHandler(MenuViewItem<JComponent> view)
Creates a new handler.

Parameters:
view - the item as it will appear in the menu
Method Detail

triggered

public void triggered()
Description copied from interface: DropDownViewItem
Invoked if the item is triggered from outside. The item should call the method of its action that causes the action to execute its natural code (for example: a checkbox may change its selected-state).

Specified by:
triggered in interface DropDownViewItem

setView

public void setView(DropDownView view)
Description copied from interface: DropDownViewItem
Sends the current settings of this item to the view. The values can be changed as long as the view is registered.

Specified by:
setView in interface DropDownViewItem
Parameters:
view - the view, might be null

isSelectable

public boolean isSelectable()
Description copied from interface: DropDownViewItem
Tells whether this item can be selected by the button. Only selectable items can be shown directly on the button. Some items, like a separator, should return false.

Specified by:
isSelectable in interface DropDownViewItem
Returns:
whether the item can be selected

isTriggerable

public boolean isTriggerable(boolean selected)
Description copied from interface: DropDownViewItem
Tells whether the item can be triggered if it is on the button or in the menu.

Specified by:
isTriggerable in interface DropDownViewItem
Parameters:
selected - if true, then this item is currently shown directly on the main button, otherwise it is in the drop-down menu.
Returns:
true if the item can be triggered

addActionListener

public void addActionListener(ActionListener listener)
Description copied from interface: MenuViewItem
Adds a listener which will be called if this view is triggered. The listener should only be called, if the user clicked directly onto this view.

Specified by:
addActionListener in interface MenuViewItem<JComponent>
Parameters:
listener - the new listener

removeActionListener

public void removeActionListener(ActionListener listener)
Description copied from interface: MenuViewItem
Removes a listener from this view.

Specified by:
removeActionListener in interface MenuViewItem<JComponent>
Parameters:
listener - the listener to remove

bind

public void bind()
Description copied from interface: ViewItem
Binds this item to its action

Specified by:
bind in interface ViewItem<JComponent>

getAction

public DockAction getAction()
Description copied from interface: ViewItem
Gets the action that is represented by this target.

Specified by:
getAction in interface ViewItem<JComponent>
Returns:
the action, might be null

getItem

public JComponent getItem()
Description copied from interface: ViewItem
Gets this item as component.

Specified by:
getItem in interface ViewItem<JComponent>
Returns:
this item

unbind

public void unbind()
Description copied from interface: ViewItem
Unbinds this item from its action

Specified by:
unbind in interface ViewItem<JComponent>