public abstract class AbstractPopupMenuBuilder extends Object implements PopupMenuBuilder
An abstract base class for implementations of the PopupMenuBuilder
interface.
The idea behind this class is that the basic functionality required for a
popup builder is already provided by an ActionManager
. For instance,
methods for adding actions, separators, or sub menus can be directly
delegated to the corresponding methods of the action manager. Therefore, an
instance is initialized with an ActionManager
reference and meta data
to be passed to the methods of the action manager. Based on this most of the
creation methods can be implemented. Concrete subclasses just have to provide
the actual creation methods - i.e. they have to create the correct objects
required by the UI toolkit in use.
Modifier | Constructor and Description |
---|---|
protected |
AbstractPopupMenuBuilder(ActionManager manager,
ActionBuilder builder)
Creates a new instance of
AbstractPopupMenuBuilder . |
Modifier and Type | Method and Description |
---|---|
PopupMenuBuilder |
addAction(FormAction action)
Adds an action to the current menu.
|
PopupMenuBuilder |
addSeparator()
Adds a separator to the current menu.
|
PopupMenuBuilder |
addSubMenu(Object subMenu)
Adds a sub menu to the current menu.
|
ActionBuilder |
getActionBuilder()
Returns the
ActionBuilder data object to be passed to the action
manager. |
ActionManager |
getActionManager()
Returns the
ActionManager this builder delegates to. |
protected abstract Object |
getMenuUnderConstruction()
Returns the menu which is currently under construction.
|
PopupMenuBuilder |
subMenuBuilder(ActionData menuDesc)
Returns a builder for creating a sub menu.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
create
protected AbstractPopupMenuBuilder(ActionManager manager, ActionBuilder builder)
AbstractPopupMenuBuilder
.manager
- the ActionManager
builder
- the ActionBuilder
public ActionManager getActionManager()
ActionManager
this builder delegates to.ActionManager
public ActionBuilder getActionBuilder()
ActionBuilder
data object to be passed to the action
manager.ActionBuilder
public PopupMenuBuilder addAction(FormAction action)
ActionManager.createMenuItem(ActionBuilder, FormAction, boolean, Object)
method.addAction
in interface PopupMenuBuilder
action
- the action to be added (must not be null)public PopupMenuBuilder addSeparator()
ActionManager.addMenuSeparator(ActionBuilder, Object)
method of
the wrapped action builder.addSeparator
in interface PopupMenuBuilder
public PopupMenuBuilder addSubMenu(Object subMenu)
addSubMenu
in interface PopupMenuBuilder
subMenu
- the sub menu to add (must not be null)PopupMenuBuilder.subMenuBuilder(ActionData)
public PopupMenuBuilder subMenuBuilder(ActionData menuDesc)
create()
method
returns the menu created. The passed in ActionData
object
contains the definition of the menu as it will be displayed in the parent
menu (i.e. its text, icon, etc.). This implementation creates a special builder
implementation for defining a sub menu.subMenuBuilder
in interface PopupMenuBuilder
menuDesc
- an ActionData
object with the properties of
the sub menu (must not be null)protected abstract Object getMenuUnderConstruction()
ActionManager
in order to add new elements to it.Copyright © 2016 The JGUIraffe Team. All rights reserved.