Interface ActionManager

  • All Known Implementing Classes:
    ActionManagerWrapper

    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.

    Note: This interface is not intended to be directly implemented by client code. It is subject to change even in minor releases as new features are made available. Therefore if an application needs to provide a custom implementation of this interface, it should extend an existing implementation. For instance, the ActionManagerWrapper class is a good candidate if only a subset of methods is to be modified.

    Version:
    $Id: ActionManager.java 205 2012-01-29 18:29:57Z oheger $
    Author:
    Oliver Heger
    • 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

        Object createMenuItem​(ActionBuilder actionBuilder,
                              FormAction action,
                              boolean checked,
                              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,
                                           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

        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

        Object createMenu​(ActionBuilder actionBuilder,
                          Object menu,
                          TextIconData data,
                          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

        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

        Object createToolbarButton​(ActionBuilder actionBuilder,
                                   FormAction action,
                                   boolean checked,
                                   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,
                                                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,
                              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,
                                 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​(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