Class ActionManagerWrapper

  • All Implemented Interfaces:
    ActionManager

    public abstract class ActionManagerWrapper
    extends Object
    implements ActionManager

    A base class for wrapper implementations of the ActionManager interface.

    An instance of this class is initialized with a reference to an ActionManager object. All methods simply delegate to this object.

    This class is especially useful if a custom implementation of ActionManager is to be created based on an existing implementation. Then only the methods to be customized have to be implemented. All other methods can still delegate to the existing implementation.

    Version:
    $Id: ActionManagerWrapper.java 205 2012-01-29 18:29:57Z oheger $
    Author:
    Oliver Heger
    • Constructor Detail

      • ActionManagerWrapper

        protected ActionManagerWrapper​(ActionManager wrapped)
        Creates a new instance of ActionManagerWrapper and initializes it with the wrapped ActionManager. Note: This method does not check whether the passed in ActionManager object is null because we do not want to enforce this restriction on all subclasses. The passed in wrapped action manager is stored in an internal field and can be accessed using the getWrappedActionManager() method. If a subclass needs another mechanism to access the wrapped manager, it has to override the getWrappedActionManager() method.
        Parameters:
        wrapped - the wrapped ActionManager
    • Method Detail

      • getWrappedActionManager

        public ActionManager getWrappedActionManager()
        Returns a reference to the wrapped ActionManager object.
        Returns:
        the wrapped ActionManager
      • createAction

        public FormAction createAction​(ActionBuilder actionBuilder,
                                       ActionData actionData)
                                throws FormActionException
        Creates an action object based on the provided information. Just delegates to the wrapped ActionManager object.
        Specified by:
        createAction in interface ActionManager
        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

        public 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. Just delegates to the wrapped ActionManager object.
        Specified by:
        createMenuItem in interface ActionManager
        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

        public 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. Just delegates to the wrapped ActionManager object.
        Specified by:
        createMenuItem in interface ActionManager
        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
      • createMenu

        public 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. Just delegates to the wrapped ActionManager object.
        Specified by:
        createMenu in interface ActionManager
        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

        public Object createToolbar​(ActionBuilder actionBuilder)
                             throws FormActionException
        Creates a toolbar object. Later defined toolbar buttons will be added to this bar. Just delegates to the wrapped ActionManager object.
        Specified by:
        createToolbar in interface ActionManager
        Parameters:
        actionBuilder - the action builder
        Returns:
        the new toolbar object
        Throws:
        FormActionException - if an error occurs
      • createToolbarButton

        public 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. Just delegates to the wrapped ActionManager object.
        Specified by:
        createToolbarButton in interface ActionManager
        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

        public 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. Just delegates to the wrapped ActionManager object.
        Specified by:
        createToolbarButton in interface ActionManager
        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

        public 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. Just delegates to the wrapped ActionManager object.
        Specified by:
        addMenuSeparator in interface ActionManager
        Parameters:
        actionBuilder - the action builder
        menu - the menu to which the separator should be added
        Throws:
        FormActionException - if an error occurs
      • addToolBarSeparator

        public 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. Just delegates to the wrapped ActionManager object.
        Specified by:
        addToolBarSeparator in interface ActionManager
        Parameters:
        actionBuilder - the action builder
        toolBar - the tool bar to which the separator should be added
        Throws:
        FormActionException - if an error occurs
      • registerPopupMenuHandler

        public 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. Just delegates to the wrapped ActionManager object.
        Specified by:
        registerPopupMenuHandler in interface ActionManager
        Parameters:
        component - the component
        handler - the handler for creating the menu
        compData - the ComponentBuilderData object
        Throws:
        FormActionException - if an error occurs