net.sf.jguiraffe.gui.builder.action
Interface ActionManager

All Known Implementing Classes:
SwingActionManager

public interface ActionManager

Definition of an interface for a component that creates GUI library specific action objects and related classes.

This interface plays a similar role for the action builder as the ComponentManager interface for the form builder: It hides the details of creating GUI library specific objects. Instead of form elements this interface deals with objects like actions, menus, and toolbar buttons.

There will be concrete implementations of this interface for all supported GUI libraries. When the action builder is invoked, an implementation must be provided. This object is then accessed by Jelly tag handler classes to create the objects they represent. With the objects created by this implementation the action related components of an application can be constructed.

Version:
$Id: ActionManager.java 156 2009-03-03 21:04:47Z oheger $
Author:
Oliver Heger

Method Summary
 void addMenuSeparator(ActionBuilder actionBuilder, java.lang.Object menu)
          Adds a separator to the specified menu.
 void addToolBarSeparator(ActionBuilder actionBuilder, java.lang.Object toolBar)
          Adds a separator to the specified tool bar.
 FormAction createAction(ActionBuilder actionBuilder, ActionData actionData)
          Creates an action object based on the provided information.
 java.lang.Object createMenu(ActionBuilder actionBuilder, java.lang.Object menu, TextIconData data, java.lang.Object parent)
          Creates a (sub) menu.
 java.lang.Object createMenuBar(ActionBuilder actionBuilder)
          Creates a menu bar.
 ComponentHandler<?> createMenuItem(ActionBuilder actionBuilder, ActionData actionData, boolean checked, java.lang.Object parent)
          Creates a menu item based on the specified action data object and returns a component handler for it.
 java.lang.Object createMenuItem(ActionBuilder actionBuilder, FormAction action, boolean checked, java.lang.Object parent)
          Creates a menu item based on the specified action object.
 java.lang.Object createToolbar(ActionBuilder actionBuilder)
          Creates a toolbar object.
 ComponentHandler<?> createToolbarButton(ActionBuilder actionBuilder, ActionData data, boolean checked, java.lang.Object parent)
          Creates a toolbar button based on the given action data object and returns a component handler for it.
 java.lang.Object createToolbarButton(ActionBuilder actionBuilder, FormAction action, boolean checked, java.lang.Object parent)
          Creates a toolbar button based on the specified action object.
 void registerPopupMenuHandler(java.lang.Object component, PopupMenuHandler handler, ComponentBuilderData compData)
          Registers the specified PopupMenuHandler at the given UI component.
 

Method Detail

createAction

FormAction createAction(ActionBuilder actionBuilder,
                        ActionData actionData)
                        throws FormActionException
Creates an action object based on the provided information.

Parameters:
actionBuilder - the central builder data object
actionData - an object with all information about the action to create
Returns:
the new action object
Throws:
FormActionException - if an error occurs

createMenuItem

java.lang.Object createMenuItem(ActionBuilder actionBuilder,
                                FormAction action,
                                boolean checked,
                                java.lang.Object parent)
                                throws FormActionException
Creates a menu item based on the specified action object. The menu item will be associated with the given action. Its properties (e.g. text and icon) will be obtained from the action, too.

Parameters:
actionBuilder - the action builder
action - the action
checked - a flag if a checked menu item should be created
parent - the parent menu to which the new item should be added
Returns:
the new menu item
Throws:
FormActionException - if an error occurs

createMenuItem

ComponentHandler<?> createMenuItem(ActionBuilder actionBuilder,
                                   ActionData actionData,
                                   boolean checked,
                                   java.lang.Object parent)
                                   throws FormActionException
Creates a menu item based on the specified action data object and returns a component handler for it. The data of this component handler will be a boolean value representing the checked state for checked menu items. For other menu items it is undefined.

Parameters:
actionBuilder - the action builder
actionData - an object with all information about the menu item
checked - a flag if a checked menu item should be created
parent - the parent menu to which the new item should be added
Returns:
a component handler for the new menu item
Throws:
FormActionException - if an error occurs

createMenuBar

java.lang.Object createMenuBar(ActionBuilder actionBuilder)
                               throws FormActionException
Creates a menu bar. Later defined (sub) menus will be added to this bar.

Parameters:
actionBuilder - the action builder
Returns:
the new menu bar
Throws:
FormActionException - if an error occurs

createMenu

java.lang.Object createMenu(ActionBuilder actionBuilder,
                            java.lang.Object menu,
                            TextIconData data,
                            java.lang.Object parent)
                            throws FormActionException
Creates a (sub) menu. The new menu will be added to the specified parent menu, which can be either a menu bar or another menu. This method will be called twice for each menu to be created. In the first call not all initialization properties might be available (e.g. the icon), but the menu must be created nevertheless (to allow for the menu items being added). In the second call missing initialization can be performed. An implementation should only create an uninitialized menu on the first call. On the second call it should initialize the menu's properties.

Parameters:
actionBuilder - the action builder
menu - the menu object; this will be null on the first call; on the second call the object returned by the first call will be passed
data - data defining the new menu
parent - the parent menu
Returns:
the new menu
Throws:
FormActionException - if an error occurs

createToolbar

java.lang.Object createToolbar(ActionBuilder actionBuilder)
                               throws FormActionException
Creates a toolbar object. Later defined toolbar buttons will be added to this bar.

Parameters:
actionBuilder - the action builder
Returns:
the new toolbar object
Throws:
FormActionException - if an error occurs

createToolbarButton

java.lang.Object createToolbarButton(ActionBuilder actionBuilder,
                                     FormAction action,
                                     boolean checked,
                                     java.lang.Object parent)
                                     throws FormActionException
Creates a toolbar button based on the specified action object. The button will be associated with this action and obtain its properties from there.

Parameters:
actionBuilder - the action builder
action - the action
checked - a flag if a checked (toggle) button should be created
parent - the parent component (a toolbar) to which the new button should be added
Returns:
the new button
Throws:
FormActionException - if an error occurs

createToolbarButton

ComponentHandler<?> createToolbarButton(ActionBuilder actionBuilder,
                                        ActionData data,
                                        boolean checked,
                                        java.lang.Object parent)
                                        throws FormActionException
Creates a toolbar button based on the given action data object and returns a component handler for it. The data of this component handler will be a boolean value representing the checked state for checked toolbar buttons. For other toolbar buttons it is undefined.

Parameters:
actionBuilder - the action builder
data - a data object defining all properties of the button
checked - a flag if a checked (toggle) button should be created
parent - the parent component (a toolbar) to which the new button should be added
Returns:
a component handler for the new button
Throws:
FormActionException - if an error occurs

addMenuSeparator

void addMenuSeparator(ActionBuilder actionBuilder,
                      java.lang.Object menu)
                      throws FormActionException
Adds a separator to the specified menu. The passed in menu object must have been created using the createMenu() method.

Parameters:
actionBuilder - the action builder
menu - the menu to which the separator should be added
Throws:
FormActionException - if an error occurs

addToolBarSeparator

void addToolBarSeparator(ActionBuilder actionBuilder,
                         java.lang.Object toolBar)
                         throws FormActionException
Adds a separator to the specified tool bar. The passed in tool bar object must have been created using the createToolBar() method.

Parameters:
actionBuilder - the action builder
toolBar - the tool bar to which the separator should be added
Throws:
FormActionException - if an error occurs

registerPopupMenuHandler

void registerPopupMenuHandler(java.lang.Object component,
                              PopupMenuHandler handler,
                              ComponentBuilderData compData)
                              throws FormActionException
Registers the specified PopupMenuHandler at the given UI component. This will cause the handler to be invoked whenever the user triggers the context menu for this component (e.g. by right clicking it with the mouse). A concrete implementation has to install a proper event listener at the component that takes care of calling the handler when it detects a gesture that should bring up the context menu.

Parameters:
component - the component
handler - the handler for creating the menu
compData - the ComponentBuilderData object
Throws:
FormActionException - if an error occurs


Copyright © 2009 The JGUIraffe Team. All Rights Reserved.