bibliothek.gui.dock.themes.basic.action.menu
Class AbstractMenuHandler<I extends javax.swing.JMenuItem,D extends StandardDockAction>

java.lang.Object
  extended by bibliothek.gui.dock.themes.basic.action.menu.AbstractMenuHandler<I,D>
Type Parameters:
I - DropDownItemHandle used by this handler
D - Action used by this handler
All Implemented Interfaces:
ViewItem<javax.swing.JComponent>, MenuViewItem<javax.swing.JComponent>
Direct Known Subclasses:
AbstractDropDownHandler, BasicPanelPopupMenuHandler, BasicPanelPopupMenuItemHandler, ButtonMenuHandler, MenuMenuHandler, SelectableMenuHandler

public abstract class AbstractMenuHandler<I extends javax.swing.JMenuItem,D extends StandardDockAction>
extends java.lang.Object
implements MenuViewItem<javax.swing.JComponent>

A handler that connects a JMenuItem with a DockAction.

Author:
Benjamin Sigg

Field Summary
protected  D action
          the action shown by the item of this handler, may be null
protected  Dockable dockable
          the Dockable for which actions are dispatched
protected  I item
          the visual representation of the action, may be null
 
Constructor Summary
AbstractMenuHandler(D action, Dockable dockable, I item)
          Creates a new handler with predefined item.
 
Method Summary
 void bind()
          Connects this handler to its action.
 D getAction()
          Gets the action that is observed by this handler.
 Dockable getDockable()
          Gets the element for which actions are dispatched.
 javax.swing.JMenuItem getItem()
          Gets the item whose values are updated by this handler.
 void unbind()
          Disconnects this handler from its action
 
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.menu.MenuViewItem
addActionListener, removeActionListener
 

Field Detail

item

protected I extends javax.swing.JMenuItem item
the visual representation of the action, may be null


dockable

protected Dockable dockable
the Dockable for which actions are dispatched


action

protected D extends StandardDockAction action
the action shown by the item of this handler, may be null

Constructor Detail

AbstractMenuHandler

public AbstractMenuHandler(D action,
                           Dockable dockable,
                           I item)
Creates a new handler with predefined item.

Parameters:
action - the action to observe
dockable - the dockable for which actions are dispatched
item - the item whose values have to be updated, null is only valid if action is null too.
Method Detail

getDockable

public Dockable getDockable()
Gets the element for which actions are dispatched.

Returns:
the element

getAction

public D getAction()
Gets the action that is observed by this handler.

Specified by:
getAction in interface ViewItem<javax.swing.JComponent>
Returns:
the action, may be null

getItem

public javax.swing.JMenuItem getItem()
Gets the item whose values are updated by this handler.

Specified by:
getItem in interface ViewItem<javax.swing.JComponent>
Returns:
the item, may be null

bind

public void bind()
Connects this handler to its action.

Specified by:
bind in interface ViewItem<javax.swing.JComponent>

unbind

public void unbind()
Disconnects this handler from its action

Specified by:
unbind in interface ViewItem<javax.swing.JComponent>