public class MenuMenuHandler extends AbstractMenuHandler<JMenu,MenuDockAction>
action, dockable, item
Constructor and Description |
---|
MenuMenuHandler(DockActionSource source,
Dockable dockable,
JPopupMenu menu)
Creates a new handler
|
MenuMenuHandler(MenuDockAction action,
Dockable dockable)
Creates a new handler
|
MenuMenuHandler(MenuDockAction action,
Dockable dockable,
ViewTarget<? extends MenuViewItem<JComponent>> target)
Creates a new handler
|
Modifier and Type | Method and Description |
---|---|
void |
addActionListener(ActionListener listener)
Adds a listener which will be called if this view is triggered.
|
void |
addChildrenActionListener(ActionListener listener)
Adds a listener to this handler, the listener will be invoked if one of the children
of this handler fires an action.
|
void |
bind()
Connects this handler to its action.
|
protected void |
fireActionEvent(ActionEvent event)
Fires
event to all ActionListener s currently known to this handler. |
MenuViewItem<JComponent> |
getViewFor(DockAction action)
Searches for the first view which is used for
action . |
protected MenuViewItem<JComponent> |
handlerFor(DockAction action)
Creates a new view for
action . |
void |
removeActionListener(ActionListener listener)
Removes a listener from this view.
|
void |
removeChildrenActionListener(ActionListener listener)
Removes
listener from this handler. |
void |
unbind()
Disconnects this handler from its action
|
getAction, getDockable, getItem
public MenuMenuHandler(MenuDockAction action, Dockable dockable)
action
- the observed actiondockable
- the dockable for which items are inserted into the menupublic MenuMenuHandler(MenuDockAction action, Dockable dockable, ViewTarget<? extends MenuViewItem<JComponent>> target)
action
- the observed actiondockable
- the dockable for which items are inserted into the menutarget
- what kind of view to use on the menupublic MenuMenuHandler(DockActionSource source, Dockable dockable, JPopupMenu menu)
source
- the observed sourcedockable
- the dockable for which actions are dispatchedmenu
- the menu where items will be insertedpublic void addActionListener(ActionListener listener)
MenuViewItem
listener
- the new listenerpublic void removeActionListener(ActionListener listener)
MenuViewItem
listener
- the listener to removepublic void addChildrenActionListener(ActionListener listener)
ActionEvent
will be the
DockAction
which fired the event.listener
- a new listenerpublic void removeChildrenActionListener(ActionListener listener)
listener
from this handler.listener
- the listener to removeaddChildrenActionListener(ActionListener)
protected void fireActionEvent(ActionEvent event)
event
to all ActionListener
s currently known to this handler.event
- the event to firepublic void bind()
AbstractMenuHandler
bind
in interface ViewItem<JComponent>
bind
in class AbstractMenuHandler<JMenu,MenuDockAction>
protected MenuViewItem<JComponent> handlerFor(DockAction action)
action
. The default implementation
uses the ActionViewConverter
and sets the ViewTarget
to
ViewTarget.MENU
.action
- an actionaction
.public MenuViewItem<JComponent> getViewFor(DockAction action)
action
.action
- some child of this handleraction
, null
if
action
is not found or if this handler is not boundpublic void unbind()
AbstractMenuHandler
unbind
in interface ViewItem<JComponent>
unbind
in class AbstractMenuHandler<JMenu,MenuDockAction>