Interface PopupMenuHandler

  • All Known Implementing Classes:
    SimplePopupMenuHandler

    public interface PopupMenuHandler

    Definition of an interface for controlling popup menus that can be associated with GUI components.

    With this interface a platform-independent way of associating popup menus with specific UI elements can be realized. The basic idea is that the ActionManager interface provides the registerPopupMenuHandler() method for associating an object implementing this interface with a UI element. This will cause a platform-specific event handler being registered at said element, which listens for gestures bringing up a context menu. When such a gesture is detected the PopupMenuHandler is invoked passing in a PopupMenuBuilder implementation. Using this builder object the handler can create an arbitrary complex menu. It is especially free to adapt this menu to the current status of the application (it is completely up to the handler, which actions it adds to the menu; it can even add different actions on each invocation). When it calls the builder's PopupMenuBuilder.create() method the menu will be displayed. (The handler can also decide not to invoke create(); in this case no menu will be displayed.)

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

      • constructPopup

        void constructPopup​(PopupMenuBuilder builder,
                            ComponentBuilderData compData)
                     throws FormActionException
        Asks this handler to create a popup menu using the specified PopupMenuBuilder. An implementation can use the methods offered by the builder to create a menu with arbitrary actions and sub menus. On calling the builder's create() method the menu will be displayed. The ComponentBuilderData object is a source of all available information: through the BeanContext accessible through this object many important objects can be obtained including the current form or the ActionStore. So all actions required by the PopupMenuHandler should be reachable through this object.
        Parameters:
        builder - the builder for creating the menu
        compData - the current ComponentBuilderData object providing access to lots of context information
        Throws:
        FormActionException - if an error occurs when creating the menu