bibliothek.gui.dock.action.actions
Class SimpleMenuAction

java.lang.Object
  extended by bibliothek.gui.dock.action.actions.AbstractStandardDockAction
      extended by bibliothek.gui.dock.action.actions.SimpleDockAction
          extended by bibliothek.gui.dock.action.actions.SimpleMenuAction
All Implemented Interfaces:
DockAction, MenuDockAction, StandardDockAction
Direct Known Subclasses:
FlapDockDirection

public class SimpleMenuAction
extends SimpleDockAction
implements MenuDockAction

An action that provides a menu which contains other actions.

Author:
Benjamin Sigg

Field Summary
 
Fields inherited from class bibliothek.gui.dock.action.actions.AbstractStandardDockAction
listeners
 
Constructor Summary
SimpleMenuAction()
          Creates a new action.
SimpleMenuAction(DockActionSource menu)
          Creates a new action.
 
Method Summary
<V> V
createView(ViewTarget<V> target, ActionViewConverter converter, Dockable dockable)
          Creates a view for this action, for the platform target and with help of converter.
 DockActionSource getMenu()
          Gets the menu of this action
 DockActionSource getMenu(Dockable dockable)
          Returns the menu that is represented by this action.
 void setMenu(DockActionSource menu)
          Sets a menu that will be displayed instead of this action.
 boolean trigger(Dockable dockable)
          Does the appropriate action that can be done respecting the current state of this action.
 
Methods inherited from class bibliothek.gui.dock.action.actions.SimpleDockAction
bound, getAccelerator, getDisabledIcon, getDisabledIcon, getIcon, getIcon, getText, getText, getTooltip, getTooltipText, getTooltipText, isEnabled, isEnabled, setAccelerator, setDisabledIcon, setEnabled, setIcon, setText, setTooltip, trigger, unbound
 
Methods inherited from class bibliothek.gui.dock.action.actions.AbstractStandardDockAction
addDockActionListener, bind, fireActionDisabledIconChanged, fireActionEnabledChanged, fireActionIconChanged, fireActionTextChanged, fireActionTooltipTextChanged, getBoundDockables, isBound, removeDockActionListener, unbind
 
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.action.StandardDockAction
addDockActionListener, getDisabledIcon, getIcon, getText, getTooltipText, isEnabled, removeDockActionListener
 
Methods inherited from interface bibliothek.gui.dock.action.DockAction
bind, unbind
 

Constructor Detail

SimpleMenuAction

public SimpleMenuAction()
Creates a new action. The menu has to be set later.

See Also:
setMenu(DockActionSource)

SimpleMenuAction

public SimpleMenuAction(DockActionSource menu)
Creates a new action.

Parameters:
menu - the menu that is shown for this action
Method Detail

setMenu

public void setMenu(DockActionSource menu)
Sets a menu that will be displayed instead of this action. Note that this call might not have an immediate effect.

Parameters:
menu - the menu, may be null

getMenu

public DockActionSource getMenu(Dockable dockable)
Description copied from interface: MenuDockAction
Returns the menu that is represented by this action.

Specified by:
getMenu in interface MenuDockAction
Parameters:
dockable - the Dockable for which the menu is shown
Returns:
the items of the menu or null

getMenu

public DockActionSource getMenu()
Gets the menu of this action

Returns:
the menu

createView

public <V> V createView(ViewTarget<V> target,
                        ActionViewConverter converter,
                        Dockable dockable)
Description copied from interface: DockAction
Creates a view for this action, for the platform target and with help of converter. Clients might use their own code to create a new view, but the preferred way is to call ActionViewConverter.createView(ActionType, DockAction, ViewTarget, Dockable) with an ActionType that fits to this DockAction.

Specified by:
createView in interface DockAction
Type Parameters:
V - the type of view requested
Parameters:
target - The platform on which the view will be used
converter - A set of methods that can be used to create a view
dockable - The Dockable for which the view will be shown. Note that this action may not yet be bound to this action.
Returns:
a new view

trigger

public boolean trigger(Dockable dockable)
Description copied from interface: DockAction
Does the appropriate action that can be done respecting the current state of this action.

Specified by:
trigger in interface DockAction
Parameters:
dockable - the element for which this action is called
Returns:
true if this action could do anything, false if this action was not able to react in any way to the event.