bibliothek.gui.dock.themes.basic.action.dropdown
Class AbstractDropDownHandler<S extends StandardDropDownItemAction>

java.lang.Object
  extended by bibliothek.gui.dock.themes.basic.action.menu.AbstractMenuHandler<JMenuItem,S>
      extended by bibliothek.gui.dock.themes.basic.action.dropdown.AbstractDropDownHandler<S>
Type Parameters:
S - the type of action handled by this handler
All Implemented Interfaces:
ViewItem<JComponent>, DropDownViewItem, MenuViewItem<JComponent>
Direct Known Subclasses:
ButtonDropDownHandler, SelectableDropDownHandler

public abstract class AbstractDropDownHandler<S extends StandardDropDownItemAction>
extends AbstractMenuHandler<JMenuItem,S>
implements DropDownViewItem

A handler that connects a StandardDropDownItemAction with a drop-down-button.

Author:
Benjamin Sigg

Field Summary
 
Fields inherited from class bibliothek.gui.dock.themes.basic.action.menu.AbstractMenuHandler
action, dockable, item
 
Constructor Summary
AbstractDropDownHandler(S action, Dockable dockable, JMenuItem item)
          Creates an new handler.
 
Method Summary
 void addActionListener(ActionListener listener)
          Adds a listener which will be called if this view is triggered.
 void bind()
          Connects this handler to its action.
 DropDownView getView()
          Gets the view that can be used to send properties directly to the drop-down-button.
 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 unbind()
          Disconnects this handler from its action
 
Methods inherited from class bibliothek.gui.dock.themes.basic.action.menu.AbstractMenuHandler
getAction, getDockable, getItem
 
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.themes.basic.action.dropdown.DropDownViewItem
triggered
 
Methods inherited from interface bibliothek.gui.dock.action.view.ViewItem
getAction, getItem
 

Constructor Detail

AbstractDropDownHandler

public AbstractDropDownHandler(S action,
                               Dockable dockable,
                               JMenuItem item)
Creates an new handler.

Parameters:
action - the action to observe
dockable - the Dockable for which the action is shown.
item - the item that represents the action
Method Detail

getView

public DropDownView getView()
Gets the view that can be used to send properties directly to the drop-down-button.

Returns:
the view, can be null

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

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

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

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

bind

public void bind()
Description copied from class: AbstractMenuHandler
Connects this handler to its action.

Specified by:
bind in interface ViewItem<JComponent>
Overrides:
bind in class AbstractMenuHandler<JMenuItem,S extends StandardDropDownItemAction>

unbind

public void unbind()
Description copied from class: AbstractMenuHandler
Disconnects this handler from its action

Specified by:
unbind in interface ViewItem<JComponent>
Overrides:
unbind in class AbstractMenuHandler<JMenuItem,S extends StandardDropDownItemAction>