Class PopupHandlerTag

  • All Implemented Interfaces:
    ConditionalTag, PropertySupport, org.apache.commons.jelly.DynaTag, org.apache.commons.jelly.impl.BeanSource, org.apache.commons.jelly.Tag

    public class PopupHandlerTag
    extends UseBeanBaseTag

    A tag handler class that allows registering a handler for a popup menu at a component.

    Tags of this type can be placed in the body of arbitrary component tags (i.e. tags derived from ComponentBaseTag). They fetch the PopupMenuHandler specified by the attributes and call the ActionManager's ActionManager#registerPopupMenuHandler(Object, PopupMenuHandler) method. (Implementation note: This is done at the end of the builder operation because it cannot be guaranteed that the component is fully initialized at an earlier point of time.)

    By inheriting from UseBeanBaseTag the typical ways of defining beans are available; especially the dependency injection framework can be used. Refer to the documentation of the base class for a full list of supported configuration options.

    The following example fragment shows how this tag can be used for assigning a context menu to a tree component. We expect that the bean for the context menu handler is defined somewhere else:

     <f:tree name="myTree" model="treeModel">
       <a:popup beanName="myPopupHandler"/>
     </f:tree>
     

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

      • PopupHandlerTag

        public PopupHandlerTag()
        Creates a new instance of PopupHandlerTag.
    • Method Detail

      • passResults

        protected boolean passResults​(Object bean)
                               throws org.apache.commons.jelly.JellyTagException
        Processes the bean managed by this tag. This implementation checks whether the parent tag is derived from ComponentBaseTag. If this is the case, a call back object will be created, which registers the handler bean at the component managed by the parent tag.
        Overrides:
        passResults in class UseBeanBaseTag
        Parameters:
        bean - the menu handler bean
        Returns:
        a flag whether the bean could be processed
        Throws:
        org.apache.commons.jelly.JellyTagException - if the tag is incorrectly used
      • createCallBack

        protected ComponentBuilderCallBack createCallBack​(ComponentBaseTag componentTag,
                                                          PopupMenuHandler handler)
        Creates the call back object for actually registering the popup menu handler. This object will be added at the ComponentBuilderData object to be invoked at the end of the builder operation.
        Parameters:
        componentTag - the parent component tag managing the component where to register the handler
        handler - the handler
        Returns:
        the call back, which performs the registration