bibliothek.gui.dock.themes.basic.action.menu
Class SelectableMenuHandler

java.lang.Object
  extended by bibliothek.gui.dock.themes.basic.action.menu.AbstractMenuHandler<javax.swing.JMenuItem,SelectableDockAction>
      extended by bibliothek.gui.dock.themes.basic.action.menu.SelectableMenuHandler
All Implemented Interfaces:
ViewItem<javax.swing.JComponent>, MenuViewItem<javax.swing.JComponent>

public class SelectableMenuHandler
extends AbstractMenuHandler<javax.swing.JMenuItem,SelectableDockAction>

A handler which ensures that the selected-state of a JMenuItem and a SelectableDockAction are always the same.

Author:
Benjamin Sigg

Field Summary
 
Fields inherited from class bibliothek.gui.dock.themes.basic.action.menu.AbstractMenuHandler
action, dockable, item
 
Constructor Summary
SelectableMenuHandler(SelectableDockAction action, Dockable dockable, javax.swing.JMenuItem item)
          Creates a new handler
 
Method Summary
 void addActionListener(java.awt.event.ActionListener listener)
          Adds a listener which will be called if this view is triggered.
 void bind()
          Connects this handler to its action.
 void removeActionListener(java.awt.event.ActionListener listener)
          Removes a listener from this 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
 

Constructor Detail

SelectableMenuHandler

public SelectableMenuHandler(SelectableDockAction action,
                             Dockable dockable,
                             javax.swing.JMenuItem item)
Creates a new handler

Parameters:
action - the action to observe
dockable - the Dockable for which actions are dispatched
item - the item to manage
Method Detail

addActionListener

public void addActionListener(java.awt.event.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.

Parameters:
listener - the new listener

removeActionListener

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

Parameters:
listener - the listener to remove

bind

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

Specified by:
bind in interface ViewItem<javax.swing.JComponent>
Overrides:
bind in class AbstractMenuHandler<javax.swing.JMenuItem,SelectableDockAction>

unbind

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

Specified by:
unbind in interface ViewItem<javax.swing.JComponent>
Overrides:
unbind in class AbstractMenuHandler<javax.swing.JMenuItem,SelectableDockAction>