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

java.lang.Object
  extended by bibliothek.gui.dock.themes.basic.action.menu.AbstractMenuHandler<JMenu,MenuDockAction>
      extended by bibliothek.gui.dock.themes.basic.action.menu.MenuMenuHandler
All Implemented Interfaces:
ViewItem<JComponent>, MenuViewItem<JComponent>

public class MenuMenuHandler
extends AbstractMenuHandler<JMenu,MenuDockAction>

A handler that manages a menu. The menu can either be toplevel (like a popup-menu) or a submenu of another menu.

Author:
Benjamin Sigg

Field Summary
 
Fields inherited from class bibliothek.gui.dock.themes.basic.action.menu.AbstractMenuHandler
action, dockable, item
 
Constructor Summary
MenuMenuHandler(DockActionSource source, Dockable dockable, JPopupMenu menu)
          Creates a new handler
MenuMenuHandler(MenuDockAction action, Dockable dockable)
          Creates a 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.
protected  ViewItem<JComponent> handlerFor(DockAction action)
          Creates a new view for action.
 void removeActionListener(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

MenuMenuHandler

public MenuMenuHandler(MenuDockAction action,
                       Dockable dockable)
Creates a new handler

Parameters:
action - the observed action
dockable - the dockable for which items are inserted into the menu

MenuMenuHandler

public MenuMenuHandler(DockActionSource source,
                       Dockable dockable,
                       JPopupMenu menu)
Creates a new handler

Parameters:
source - the observed source
dockable - the dockable for which actions are dispatched
menu - the menu where items will be inserted
Method Detail

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.

Parameters:
listener - the new listener

removeActionListener

public void removeActionListener(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<JComponent>
Overrides:
bind in class AbstractMenuHandler<JMenu,MenuDockAction>

handlerFor

protected ViewItem<JComponent> handlerFor(DockAction action)
Creates a new view for action. The default implementation uses the ActionViewConverter and sets the ViewTarget to ViewTarget.MENU.

Parameters:
action - an action
Returns:
a handler ready to work with action.

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<JMenu,MenuDockAction>