Class MenuNode

  • All Implemented Interfaces:
    ClientBehaviorHolder, DialogListener, java.io.Serializable
    Direct Known Subclasses:
    TypedMenuNode

    public class MenuNode
    extends Component
    implements java.io.Serializable, DialogListener, ClientBehaviorHolder
    MenuNode represents an action source in UI. When clicked, a partial behavior request will be sent to server and the action will be handled.

    A menuNode can have children, so menu node is hierarchical like tree menu. A menu node can open a dialog for user to input data before executing its action.

    Since:
    2.2
    See Also:
    Serialized Form
    • Constructor Detail

      • MenuNode

        public MenuNode​(MenuBean menuBean,
                        java.lang.String id)
        Constructor
        Parameters:
        menuBean - the MenuBean of this MenuNode
        id - menu node id that is unique within the menuBean
      • MenuNode

        public MenuNode​(MenuBean menuBean,
                        java.lang.String id,
                        java.lang.String name,
                        boolean nameLocalized)
        Label menuNode constructor
        Parameters:
        menuBean - the MenuBean of this menu node
        id - menu node id that is unique within the menuBean
        name - menu node name
        nameLocalized - if false, translate name for display using resource bundle
      • MenuNode

        public MenuNode​(MenuBean menuBean,
                        java.lang.String id,
                        java.lang.String name,
                        boolean nameLocalized,
                        java.lang.String outputLink,
                        boolean addContextPath)
        Output link menu node constructor
        Parameters:
        menuBean - the MenuBean of the menu node to create
        id - menu node id that is unique within the menuBean
        name - menu node name
        nameLocalized - if false, translate name for display using resource bundle
        outputLink - absolute URL (http://...) or relative URL starting with /
        addContextPath - whether to add contextPath. ignored for absolute URLs.
      • MenuNode

        public MenuNode​(MenuBean menuBean,
                        java.lang.String id,
                        I18NName name,
                        java.lang.String outputLink,
                        boolean addContextPath)
        Output link menu node constructor
        Parameters:
        menuBean - the MenuBean of the menu node to create
        id - menu node id that is unique within the menuBean
        name - menu node name
        outputLink - absolute URL (http://...) or relative URL starting with /
        addContextPath - whether to add contextPath. ignored for absolute URLs.
        Since:
        5.16
      • MenuNode

        public MenuNode​(MenuBean menuBean,
                        java.lang.String id,
                        java.lang.String name,
                        boolean nameLocalized,
                        RenderStyle renderStyle)
        Command menu node constructor.
        Parameters:
        menuBean - the MenuBean of the menu node to create
        id - menu node id that is unique within the menuBean
        name - menu node name
        nameLocalized - if false, translate name for display using resource bundle
        renderStyle - menu node RenderStyle
      • MenuNode

        public MenuNode​(MenuBean menuBean,
                        java.lang.String command,
                        RenderStyle renderStyle)
        Command menu node constructor. By default a command menu node is partial behavior enabled, and its execute target is the menu node commandLink or commanButton. Menu node id and name are the same as the command, and name is not localized.
        Parameters:
        menuBean - the MenuBean of the menu node to create
        command - the command name
        renderStyle - menu node RenderStyle
      • MenuNode

        public MenuNode​(MenuBean menuBean,
                        java.lang.String name,
                        boolean nameLocalized,
                        java.lang.String command,
                        RenderStyle renderStyle)
        Command menu node constructor. By default a command menu node is partial behavior enabled, and its execute target is the menu node commandLink or commanButton. Menu node id is the same as the command.
        Parameters:
        menuBean - the MenuBean of this menu node
        name - menu node name
        nameLocalized - if false, translate name for display using resource bundle
        command - the command name
        renderStyle - menu node RenderStyle
      • MenuNode

        public MenuNode​(MenuBean menuBean,
                        I18NName name,
                        java.lang.String command,
                        RenderStyle renderStyle)
        Command menu node constructor. By default a command menu node is partial behavior enabled, and its execute target is the menu node commandLink or commandButton. Menu node id is the same as the command.
        Parameters:
        menuBean - the MenuBean of this menu node
        name - menu node name
        command - the command name
        renderStyle - menu node RenderStyle
      • MenuNode

        public MenuNode​(MenuBean menuBean,
                        java.lang.String name,
                        boolean nameLocalized,
                        java.lang.String command,
                        int defaultStyleNumber)
        Command menu node constructor. By default a command menu node is partial behavior enabled, and its execute target is the menu node commandLink or commanButton. Menu node id is the same as the command.
        Parameters:
        menuBean - the MenuBean of this menu node
        name - menu node name
        nameLocalized - if false, translate name for display using resource bundle
        command - the command name
        defaultStyleNumber - the style number for menu node if command style number is not specified in the ViewConfig of its menuBean.
      • MenuNode

        public MenuNode​(MenuBean menuBean,
                        I18NName name,
                        java.lang.String command,
                        int defaultStyleNumber)
        Command menu node constructor. By default a command menu node is partial behavior enabled, and its execute target is the menu node commandLink or commanButton. Menu node id is the same as the command.
        Parameters:
        menuBean - the MenuBean of this menu node
        name - menu node name
        command - the command name
        defaultStyleNumber - the style number for menu node if command style number is not specified in the ViewConfig of its menuBean.
        Since:
        5.16
      • MenuNode

        public MenuNode​(MenuBean menuBean,
                        java.lang.String command,
                        int defaultStyleNumber)
        Command menu node constructor. By default a command menu node is partial behavior enabled, and its execute target is the menu node commandLink or commanButton. Menu node id and name are the same as the command, and name is not localized.
        Parameters:
        menuBean - the MenuBean of this menu node
        command - the command name
        defaultStyleNumber - the style number for menu node if command style number is not specified in the ViewConfig of its menuBean.
      • MenuNode

        public MenuNode​(MenuBean menuBean,
                        java.lang.String id,
                        java.lang.String name,
                        boolean nameLocalized,
                        java.lang.String command,
                        RenderStyle renderStyle,
                        java.lang.Integer pageId)
        Command menu node constructor. By default a command menu node is partial behavior enabled, and its execute target is the menu node commandLink or commanButton.
        Parameters:
        menuBean - the MenuBean of this menu node
        id - menu node id that is unique within the menuBean
        name - menu node name
        nameLocalized - if false, translate name for display using resource bundle
        command - the command name
        renderStyle - menu node RenderStyle
        pageId - the page to navigate to after handling action of this MenuNode
      • MenuNode

        public MenuNode​(MenuBean menuBean,
                        java.lang.String name,
                        java.lang.String command,
                        RenderStyle renderStyle)
        Command menu node constructor. By default a command menu node is partial behavior enabled, and its execute target is the menu node commandLink or commanButton. Menu node id is the same as the command, and name is not localized.
        Parameters:
        menuBean - the MenuBean of this menu node
        name - menu node name
        command - the command name
        renderStyle - menu node RenderStyle
      • MenuNode

        public MenuNode​(MenuBean menuBean,
                        java.lang.String id,
                        java.lang.String name,
                        boolean nameLocalized,
                        java.lang.Integer count,
                        java.lang.String command,
                        java.lang.Object userData,
                        int defaultStyleNumber,
                        java.lang.Integer pageId)
        Command menu node constructor. By default a command menu node is partial behavior enabled, and its execute target is the menu node commandLink or commanButton.
        Parameters:
        menuBean - the MenuBean of this menu node
        id - menu node id that is unique within the menuBean
        name - menu node name
        nameLocalized - if false, translate name for display using resource bundle
        count - menu node count value
        command - the command name
        userData - any data that can be an argument for the command
        defaultStyleNumber - the style number for menu node if command style number is not specified in the ViewConfig of its menuBean.
        pageId - the page to navigate to after handling action of this MenuNode
      • MenuNode

        public MenuNode​(MenuBean menuBean,
                        java.lang.String id,
                        java.lang.String name,
                        boolean nameLocalized,
                        java.lang.Integer count,
                        java.lang.String command,
                        java.lang.Object userData,
                        RenderStyle renderStyle,
                        java.lang.Integer pageId)
        Command menu node constructor. By default a command menu node is partial behavior enabled, and its execute target is the menu node commandLink or commanButton.
        Parameters:
        menuBean - the MenuBean of this menu node
        id - menu node id that is unique within the menuBean
        name - menu node name
        nameLocalized - if false, translate name for display using resource bundle
        count - menu node count value
        command - the command name
        userData - any data that can be an argument for the command
        renderStyle - menu node RenderStyle
        pageId - the page to navigate to after handling action of this MenuNode
      • MenuNode

        public MenuNode​(MenuBean menuBean,
                        java.lang.String id,
                        I18NName name,
                        java.lang.Integer count,
                        java.lang.String command,
                        java.lang.Object userData,
                        RenderStyle renderStyle,
                        java.lang.Integer pageId)
        Command menu node constructor. By default a command menu node is partial behavior enabled, and its execute target is the menu node commandLink or commanButton.
        Parameters:
        menuBean - the MenuBean of this menu node
        id - menu node id that is unique within the menuBean
        name - menu node name
        count - menu node count value
        command - the command name
        userData - any data that can be an argument for the command
        renderStyle - menu node RenderStyle
        pageId - the page to navigate to after handling action of this MenuNode
        Since:
        5.16
    • Method Detail

      • getLicenseFeatureRequired

        public ModuleScopedName getLicenseFeatureRequired()
        Get required license feature to execute menuNode command. If licenseFeatureRequired is not set, delegate to parent.
        Returns:
        licenseFeature(module.name). return null if not required.
      • isLicenseFeatureInheritted

        public boolean isLicenseFeatureInheritted()
        Whether required license feature is inherited from its parent menuNode.
        Returns:
        true if inherited
      • setLicenseFeatureRequired

        public void setLicenseFeatureRequired​(ModuleScopedName licenseFeatureRequired)
        Set the licenseFeature required to execute the menuNode command. If not required and prevent inheritance from its parent, set to a ModuleScopedName(null, null).
        Parameters:
        licenseFeatureRequired - license feature (module.name)
      • getName

        public I18NName getName()
        Get menuNode name.
        Returns:
        name.
      • setName

        public void setName​(I18NName name)
        Set menu node name
        Parameters:
        name - the name
      • setName

        public void setName​(java.lang.String name,
                            boolean nameLocalized)
        Set menu node name and whether it is localized.
        Parameters:
        name - node name
        nameLocalized - whether name is localized
        Since:
        5.13
      • isLocalized

        public boolean isLocalized()
        Whether name is localized? If name is not localized, resource bundle will be used to get display name.
        Returns:
        true if name is localized.
      • setNameLocalized

        public void setNameLocalized​(boolean nameLocalized)
        Set whether name is localized. If name is not localized, resource bundle will be used to get display name.
        Parameters:
        nameLocalized - true for localized name
      • getDisplayName

        public java.lang.String getDisplayName()
        Get the display name. If iconOnly is true and icon is not null, return null.
        Returns:
        display name
      • getLocalizedName

        public java.lang.String getLocalizedName()
        Get localized name. If nameLocalized is false, menu node name is translated using resource bundle.
        Returns:
        localized name.
      • setIcon

        public void setIcon​(java.lang.Integer icon)
        Set icon for commandLink or commandButton.
        Parameters:
        icon - icon number that will be mapped to an icon of current view binding. If null, no icon will be defined for this menu node.
      • setIcon

        public void setIcon​(java.lang.Integer icon,
                            boolean iconOnly)
        Set icon and whether to display icon only
        Parameters:
        icon - icon number
        iconOnly - true if displaying icon only
      • getIcon

        public java.lang.Integer getIcon()
        Get icon number.
        Returns:
        icon number. return null if no icon is specified.
        Since:
        6.0
      • isIconOnly

        public boolean isIconOnly()
        Whether to display an icon only without name?
        Returns:
        true if displaying icon only
      • setIconOnly

        public void setIconOnly​(boolean iconOnly)
        Set whether to display an icon only without name
        Parameters:
        iconOnly - true for displaying icon only
      • isDisabled

        public boolean isDisabled()
        For command menu node, is it disabled?
        Returns:
        true if disabled
      • setDisabled

        public void setDisabled​(boolean disabled)
        For command menu node, set it to be disabled or enabled
        Parameters:
        disabled - true for disabled
      • getTitle

        public java.lang.String getTitle()
        Get title that is used as tooltip when mouse over.
        Returns:
        title. return null if title is not set and menu node is not iconOnly
      • setTitle

        public void setTitle​(I18NName title)
        Set title that is used as tooltip when mouse over.
        Parameters:
        title - title
        Since:
        5.13
      • getStyleClass

        public java.lang.String getStyleClass()
        Get menu node style class
        Returns:
        style class
      • setStyleClass

        public void setStyleClass​(java.lang.String styleClass)
        Set menu node style class
        Parameters:
        styleClass - style class
      • getId

        public java.lang.String getId()
        Get menu node id that is unique within its MenuBean.
        Returns:
        menu node id
      • setId

        public void setId​(java.lang.String id)
        Set menu node id that is unique within its MenuBean.
        Parameters:
        id - menu node id
      • getRenderStyle

        public RenderStyle getRenderStyle()
        Get renderStyle. Default is commandLink
        Returns:
        render style
      • setRenderStyle

        public void setRenderStyle​(RenderStyle renderStyle)
        Set renderStyle.
        Parameters:
        renderStyle - render style
      • isLeaf

        public boolean isLeaf()
        Is menu node a leaf without children?
        Returns:
        true if it is a leaf.
      • getChildren

        public java.util.List<MenuNode> getChildren()
        Get child menu nodes. If menuBean.isContextMenuAsChildren() returns true, children will include its contextMenu top menu nodes.
        Returns:
        child menu nodes
      • getActionHandler

        public MenuNodeActionHandler getActionHandler()
        Get action handler. If the action handler of this menu node is null, delegate to the action handler of its parent menu node.
        Returns:
        actionHandler the handler to handle action of this menu node
      • isActionHandlerDelegateToParent

        public boolean isActionHandlerDelegateToParent()
        Whether the actionHandler of this menu node is null and delegate to its parent.
        Returns:
        true if delegating to its parent.
      • setActionHandler

        public void setActionHandler​(MenuNodeActionHandler actionHandler)
        Set action handler. If the action handler of this menu node is null, default to the action handler of its parent menu node.
        Parameters:
        actionHandler - the action handler to set
      • getActionListener

        public MenuNodeActionListener getActionListener()
        Get the action listener that will be notified before and after the action of this menu node is handled.
        Returns:
        a MenuNodeActionListener, can be null
      • setActionListener

        public void setActionListener​(MenuNodeActionListener actionListener)
        Set the action listener that will be notified before and after the action of this menu node is handled.
        Parameters:
        actionListener - a MenuNodeActionListener
      • getLazyInitializer

        public MenuNodeLazyInitializer getLazyInitializer()
        Get the MenuNodeLazyInitializer that will initialize this menu node and create its child menu nodes(if any) if this menu node is not initialized.
        Returns:
        the MenuNodeLazyInitializer, can be null.
      • setLazyInitializer

        public void setLazyInitializer​(MenuNodeLazyInitializer lazyInitializer)
        Set the MenuNodeLazyInitializer that will initialize this menu node and create its child menu nodes(if any) if this menu node is not initialized.
        Parameters:
        lazyInitializer - the MenuNodeLazyInitializer
      • getFactory

        public MenuNodeFactory getFactory()
        Get menu node factory. If null, same as the the MenuNodeFactory of its parent menu node.
        Returns:
        menu node factory, can be null.
      • setFactory

        public void setFactory​(MenuNodeFactory factory)
        Set menu node factory. If null, same as the the MenuNodeFactory of its parent menu node.
        Parameters:
        factory - the MenuNodeFactory to set
      • setFALFromParent

        public void setFALFromParent()
        Set factory, action handler and initializer from its parent menu node if they are not initialized. Their getter methods are delegated to its parent menu node. But when a menu node is extracted and inserted into another subtree, its factory, action handler and initializer need to be set.
        Since:
        5.13
      • getContextMenuBean

        public MenuNodeContextMenuBean getContextMenuBean()
        Get the context menu of this menu node. If context menu is inheritable, it can inherit context menu from its parent menu node.
        Returns:
        context menu. can be null.
      • setContextMenuBean

        public void setContextMenuBean​(MenuNodeContextMenuBean contextMenuBean)
        Set the context menu of this menu node. If context menu is inheritable, its descendant children will inherit the context menu
        Parameters:
        contextMenuBean - context menu
      • getParent

        public MenuNode getParent()
        Get parent menu node
        Returns:
        parent menu node. return null if there is no parent.
      • setParent

        public void setParent​(MenuNode parent)
        Set parent menu node
        Parameters:
        parent - parent menu node
      • getCommand

        public java.lang.String getCommand()
        Get the command of this MenuNode.
        Returns:
        command name. return null for label or outputLink.
      • setCommand

        public void setCommand​(java.lang.String command)
        Set the command of this MenuNode.
        Parameters:
        command - the command to set
      • isDefaultCommand

        public boolean isDefaultCommand()
        Is this menu node the default command in the scope of its closest ancestor component of type EntityBackingBean or EntityListBackingBean. Default command will be invoked if ENTER key is pressed on any input field within the scope.
        Returns:
        true if it is the default, false otherwise
      • setDefaultCommand

        public void setDefaultCommand​(boolean defaultCommand)
        Set whether this menu node is the default command in the scope of its closest ancestor component of type EntityBackingBean or EntityListBackingBean. Default command will be invoked if ENTER key is pressed on any input field within the scope.
        Parameters:
        defaultCommand - true for default command, false otherwise.
      • getCount

        public java.lang.Integer getCount()
        Get the count that is meaningful and will be shown with the menu node.
        Returns:
        a number, return null if not set
      • setCount

        public void setCount​(java.lang.Integer count)
        Set the count that is meaningful and will be shown with the menu node.
        Parameters:
        count - a number
      • setOnclickJS

        public void setOnclickJS​(java.lang.String onclickJS)
        Set DOM event handler for DomEventSupport.EVENT_CLICK. The handler(javascript code) will be executed when this MenuNode is clicked.
        Parameters:
        onclickJS - javascript code
      • setConfirmMessage

        public void setConfirmMessage​(ParameterizedMessage message)
        Set confirm dialog message before executing the command of this menu node. If user clicks No or Cancel, the command will not be executed.
        Parameters:
        message - the message to show. remove existing confirm message if null.
        Since:
        5.5
      • isImmediate

        public boolean isImmediate()
        Whether the action of this menu node will be handled in JSF apply request value phase, skipping model update.
        Returns:
        true if handled in JSF apply request value phase
      • setImmediate

        public void setImmediate​(boolean immediate)
        Set whether the action of this menu node will be handled in JSF apply request value phase, skipping model update.
        Parameters:
        immediate - true if handled in JSF apply request value phase
      • getUserData

        public java.lang.Object getUserData()
        Get user data that can be any object used by action handler.
        Returns:
        user data
      • setUserData

        public void setUserData​(java.lang.Object userData)
        Set user data that can be any object used by action handler.
        Parameters:
        userData - any object
      • getOutputLink

        public java.lang.String getOutputLink()
        Get the output link (hyperlink) for render style: RenderStyle.OUTPUT_LINK.
        Returns:
        link URL
      • setOutputLink

        public void setOutputLink​(java.lang.String outputLink,
                                  boolean addContextPath)
        Set the output link (hyperlink) for render style: RenderStyle.OUTPUT_LINK.
        Parameters:
        outputLink - absolute URL (http://...) or relative URL starting with /
        addContextPath - whether to add contextPath. ignored for absolute URLs.
      • getPageId

        public java.lang.Integer getPageId()
        Get the page Id for navigation after the action is handled
        Returns:
        page id such as /myPage.xhtml. null for staying in the same page.
      • setPageId

        public void setPageId​(java.lang.Integer pageId)
        Set the page Id for navigation after the action is handled
        Parameters:
        pageId - page id
      • click

        public java.lang.String click()
        Handle menu node action.
        Returns:
        navigation outcome. return null for staying in the same page.
      • clickNode

        public PageNavigation clickNode​(boolean ignoreDialog,
                                        boolean ignoreProgress)
                                 throws SystemException
        Handle menu node action. Check license feature if required.
        Parameters:
        ignoreDialog - whether to ignore input dialog
        ignoreProgress - whether to ignore progress
        Returns:
        a PageNavigation
        Throws:
        SystemException - throw if an error occurs when handling the action
      • getDepth

        public int getDepth()
        Get depth. The root depth is 1.
        Returns:
        depth.
      • getDepth

        public static int getDepth​(MenuNode from,
                                   MenuNode to)
        Get depth: number of menu nodes in the path
        Parameters:
        from - start node
        to - end ancestor node
        Returns:
        depth
      • getMenuBean

        public MenuBean getMenuBean()
        Get the MenuBean of this MenuNode
        Returns:
        MenuBean instance
      • setMenuBean

        public void setMenuBean​(MenuBean menuBean)
        Set the MenuBean of this MenuNode
        Parameters:
        menuBean - MenuBean instance
      • addChild

        public void addChild​(MenuNode menuNode)
        Append the child menu node, replacing existing menu node with the same id if any.
        Parameters:
        menuNode - the child menu node to add
      • addChildren

        public void addChildren​(java.util.List<MenuNode> menuNodes)
        Add the list of the menu nodes as children. Replace existing child menu nodes with the same id(s) if any.
        Parameters:
        menuNodes - a list of child menu nodes to add
      • addChildren

        public void addChildren​(java.lang.Integer position,
                                java.util.List<MenuNode> menuNodes)
        Add the list of the menu nodes as children. Replace existing child menu nodes with the same id(s) if any.
        Parameters:
        position - zero-based position to add the menu nodes, null to append
        menuNodes - a list of child menu nodes to add
      • addChildren

        public void addChildren​(java.util.List<MenuNode> menuNodes,
                                MenuNodeFactory factory)
        Add the list of the menu nodes as children. Replace existing child menu nodes with the same id(s) if any. Set the default lazyInitializer and actionHandler of the menu nodes to be the factory if the factory is also a MenuNodeLazyInitializer and/or MenuNodeActionHandler.
        Parameters:
        menuNodes - a list of child menu nodes to add
        factory - menu node factory
      • setChild

        public void setChild​(int position,
                             MenuNode menuNode)
        Replace the child menu node at the position with the new menu node
        Parameters:
        position - the index of menu node to be replaced
        menuNode - the new menu node
      • removeChild

        public MenuNode removeChild​(int position)
        Remove the child menu node at the position
        Parameters:
        position - the index of child menu node to be removed
        Returns:
        the menu node removed. null if not found.
      • removeChild

        public boolean removeChild​(MenuNode child)
        Remove the child menu node
        Parameters:
        child - the child menu node to be removed
        Returns:
        true if removed
      • isInitialized

        public boolean isInitialized()
        Whether this menu node is initialized? If its children has been created, then it is initialized. If false, its LazyInitializer will be called to create its subtree on demand.
        Returns:
        true if initialized. default is true.
      • setInitialized

        public void setInitialized​(boolean initialized)
        Set whether this menu node is initialized. If its children has been created, then it is set to be initialized. For lazy initialization, set to false and its LazyInitializer will be called to create its subtree on demand.
        Parameters:
        initialized - true if initialized
      • init

        public void init()
                  throws SystemException
        Initialize this menu node by adding its children.
        Throws:
        SystemException - throw if an error occurs in creating descendant menu nodes
      • isRoot

        public boolean isRoot()
        Is this menu node the root of its MenuBean.
        Returns:
        true if it is the root
      • getChild

        public MenuNode getChild​(int index)
        Get the child menu node at the index
        Parameters:
        index - the index of child menu node to get
        Returns:
        child menu node. null if not found or the index is out of range
      • getLastChild

        public MenuNode getLastChild()
        Get the last child menu node
        Returns:
        menu node, null if there is no children.
      • equals

        public boolean equals​(java.lang.Object menuNode)
        Overrides:
        equals in class java.lang.Object
      • getChildCount

        public int getChildCount()
        Get number of children.
        Returns:
        child count
        See Also:
        getChildren()
      • increaseCount

        public void increaseCount​(int number)
        Increase the count of menu node by the number. The meaning of the count is application specific. For example, the count is the number of entities.
        Parameters:
        number - the number to increase
      • getNamePathAsString

        public java.lang.String getNamePathAsString​(int rootNodeDepth,
                                                    java.lang.String separator)
        Get the name path from this node to its ancestor of the specified depth for example, A > B > C(this node).
        Parameters:
        rootNodeDepth - the root node depth
        separator - name component separator
        Returns:
        name path
      • isLoginRequired

        public boolean isLoginRequired()
        Whether user is required to login before executing the command of this MenuNode?
        Returns:
        true if login is required
      • setLoginRequired

        public void setLoginRequired​(boolean loginRequired)
        Set whether user is required to login before executing the command of this MenuNode.
        Parameters:
        loginRequired - true if login is required
      • isEntitySelectionRequired

        public boolean isEntitySelectionRequired()
        Whether this command is executed on one or more selected entities?
        Returns:
        true if one or more selected entities are required
      • setEntitySelectionRequired

        public void setEntitySelectionRequired​(EntityListBackingBean entityListBackingBean,
                                               boolean entitySelectionRequired)
        Set whether this command is executed on one or more selected entities. if true, the command default execute target will be set to the entityListBackingBean.
        Parameters:
        entityListBackingBean - entity list backing bean
        entitySelectionRequired - true if required, or false if not required.
      • isCountPartOfParent

        public boolean isCountPartOfParent()
        Is the count of this MenuNode a part of the count of its parent menu node? If true, changing the count of this MenuNode will update the count of its parent menu node.
        Returns:
        true if the count of this MenuNode is a part of the count of its parent menu node
      • setCountPartOfParent

        public void setCountPartOfParent​(boolean countPartOfParent)
        Set whether the count of this MenuNode is a part of the count of its parent menu node. If true, changing the count of this MenuNode will update the count of its parent menu node.
        Parameters:
        countPartOfParent - true if the count of this MenuNode is a part of the count of its parent menu node
      • replaceWith

        public void replaceWith​(MenuNode newMenuNode)
        Replace this menu node in its tree with a new menu node.
        Parameters:
        newMenuNode - a new menu node
      • getInputData

        public PersistenceEntity getInputData()
        Get the input data of this MenuNode.
        Returns:
        the entity of inputDataBean. return null if inputDataBean is null.
      • getInputDataBean

        public EntityBackingBean getInputDataBean()
        Get the inputDataBean of this MenuNode that is an EntityBackingBean for user to input data for the action.
        Returns:
        EntityBackingBean instance.
      • setInputDataBean

        public void setInputDataBean​(EntityBackingBean inputDataBean)
        Set the inputDataBean of this MenuNode that is an EntityBackingBean for user to input data for the action.
        Parameters:
        inputDataBean - EntityBackingBean instance.
      • isShowInputDataOnly

        public boolean isShowInputDataOnly()
        Whether to show input data only without showing this menu node.
        Returns:
        true if showing input data only
      • setShowInputDataOnly

        public void setShowInputDataOnly​(boolean showInputDataOnly)
        Set whether to show input data only without showing this menu node.
        Parameters:
        showInputDataOnly - true for showing input data only
      • getInputDataValue

        public java.lang.Object getInputDataValue​(java.lang.String propertyName)
        Get the value for the property in the input data that is an entity with a list of properties. if input data is a MapEntity, the propretyName is a key for the mapEntity. otherwise, return null.
        Parameters:
        propertyName - property name
        Returns:
        property value
      • getInputDataSingleValue

        public java.lang.Object getInputDataSingleValue()
        Get inputData single value. There is only one property for the input data(MapEntity). The input data MapEntity can have many properties to hold many input values.
        Returns:
        the single value that can be of any type.
      • setInputDataSingleValue

        public void setInputDataSingleValue​(java.lang.Object value)
        Set inputData single value. There is only one property for the input data that is a MapEntity.
        Parameters:
        value - the value for input data
      • getInputDataBoolean

        public java.lang.Boolean getInputDataBoolean()
        Get the input data single value as Boolean
        Returns:
        input data single value
      • getInputDataInteger

        public java.lang.Integer getInputDataInteger()
        Get the input data single value as Integer
        Returns:
        input data single value
      • getInputDataString

        public java.lang.String getInputDataString()
        Get the input data single value as String
        Returns:
        input data single value
      • setInputDataString

        public void setInputDataString​(java.lang.String inputData)
        Set the input data single value as String
        Parameters:
        inputData - input data single value
      • getInputDataDate

        public java.util.Date getInputDataDate()
        Get the input data single value as Date
        Returns:
        input data single value
      • setInputDataDate

        public void setInputDataDate​(java.util.Date inputData)
        Set the input data single value as Date
        Parameters:
        inputData - input data single value
      • enableContinueCommandForInputDataBean

        public void enableContinueCommandForInputDataBean()
                                                   throws SystemException
        Enable Continue command for inputDataBean. Call this method before adding input data properties to inputDataBean if the Continue command is needed. The Continue command will invoke the action of this menu node.
        Throws:
        SystemException - throw if an error occurs
        Since:
        5.20
      • createInputDataMapEntityBean

        public <T extends MapEntityMapEntityBean<T> createInputDataMapEntityBean​(ContainerBean containerBean)
                                                                            throws SystemException
        Create an inputDataBean that uses MapEntity to store data. A MapEntity can store as many as name/value pairs as needed.

        The nested viewConfig getNestedViewConfig(boolean, Class) for inputData will be used. If not defined, default viewConfig will be created.

        Parameters:
        containerBean - the containerBean of the inputDataBean
        Returns:
        MapEntityBean instance
        Throws:
        SystemException - throw if an error occurs in creating MapEntityBean
      • createInputDataMapEntityBean

        public <T extends MapEntityMapEntityBean<T> createInputDataMapEntityBean​(ContainerBean containerBean,
                                                                                   EntityViewConfig viewConfig)
                                                                            throws SystemException
        Create an inputDataBean that uses MapEntity to store data. A MapEntity can store as many as name/value pairs as needed.

        If the viewConfig is null, the nested viewConfig getNestedViewConfig(boolean, Class) for inputData will be used. If not defined, default viewConfig will be created.

        Parameters:
        containerBean - the containerBean of the inputDataBean
        viewConfig - entity viewConfig that can be null.
        Returns:
        MapEntityBean instance
        Throws:
        SystemException - throw if an error occurs in creating MapEntityBean
      • addInputDataProperty

        public <T extends MapEntityEntityProperty<T> addInputDataProperty​(java.lang.Class propertyType,
                                                                            java.lang.Object propertyValue,
                                                                            PartialBehaviorSupport partialBehaviorSupport,
                                                                            RenderStyle renderStyle,
                                                                            boolean required)
                                                                     throws SystemException
        Add the single property to the inputData that is a MapEntity. propertyName is the default inputData single value property name. Its value can be obtained using getInputDataSingleValue(). property name is not visible.
        Parameters:
        propertyType - property type
        propertyValue - property value
        partialBehaviorSupport - property partial behavior support
        renderStyle - property render style
        required - whether property value is required
        Returns:
        EntityProperty instance
        Throws:
        SystemException - throw if an error occurs
      • addInputDataProperty

        public <T extends MapEntityEntityProperty<T> addInputDataProperty​(java.lang.Class propertyType,
                                                                            java.lang.String visibleName,
                                                                            java.lang.Object propertyValue,
                                                                            PartialBehaviorSupport partialBehaviorSupport,
                                                                            RenderStyle renderStyle,
                                                                            boolean required)
                                                                     throws SystemException
        Add the single property to the inputData that is a MapEntity. propertyName is the default inputData single value property name. Its value can be obtained using getInputDataSingleValue().
        Parameters:
        propertyType - property type
        visibleName - property visible name, not localized
        propertyValue - property value
        partialBehaviorSupport - property partial behavior support
        renderStyle - property render style
        required - whether property value is required
        Returns:
        EntityProperty instance
        Throws:
        SystemException - throw if an error occurs
      • addInputDataCollectionProperty

        public <T extends MapEntityEntityCollectionProperty<T> addInputDataCollectionProperty​(java.lang.Class propertyType,
                                                                                                java.lang.Class memberType,
                                                                                                RenderStyle renderStyle,
                                                                                                boolean required)
                                                                                         throws SystemException
        Add the single property(collection type) to the inputData that is a MapEntity. propertyName is the default inputData single value property name. Its value can be obtained using getInputDataSingleValue().
        Parameters:
        propertyType - collection type such as List or Set.
        memberType - collection member type
        renderStyle - property render style
        required - where the property is required.
        Returns:
        added EntityCollectionProperty instance
        Throws:
        SystemException - throw if an error occurs
      • addInputDataProperty

        public <T extends MapEntityEntityProperty<T> addInputDataProperty​(java.lang.String propertyName,
                                                                            java.lang.Class propertyType,
                                                                            java.lang.Object propertyValue,
                                                                            PartialBehaviorSupport partialBehaviorSupport,
                                                                            RenderStyle renderStyle,
                                                                            boolean required)
                                                                     throws SystemException
        Add the property to the inputData that is a MapEntity. create a MapEntityBean as the inputDataBean if inputDataBean is null.
        Parameters:
        propertyName - property name
        propertyType - property type
        propertyValue - property value
        partialBehaviorSupport - property partialBehavior support
        renderStyle - property render style
        required - whether property value is required
        Returns:
        EntityProperty instance
        Throws:
        SystemException - throw if an error occurs
      • getParameter

        public java.lang.Object getParameter​(java.lang.String key)
        Get the value of the parameter. A menu node has a map of name/value pairs.
        Parameters:
        key - parameter name
        Returns:
        parameter value
      • setParameter

        public void setParameter​(java.lang.String key,
                                 java.lang.Object value)
        Set the value of the parameter. A menu node has a map of name/value pairs.
        Parameters:
        key - parameter name
        value - parameter value
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • asVisitTarget

        public VisitTarget asVisitTarget​(boolean subTree)
        Create a VisitTarget for this MenuNode. The visit target includes this MenuNode itself and its input data bean.
        Parameters:
        subTree - whether to include subtree of this menu node.
        Returns:
        VisitTarget instance
      • getParentComponent

        public Component getParentComponent()
        Description copied from class: Component
        Get parent component
        Overrides:
        getParentComponent in class Component
        Returns:
        parent component. return null if there is no parent.
      • getContainerBean

        public ContainerBean getContainerBean()
        Description copied from class: Component
        Get containerBean of this component, that is, the closest ancestor component of ContainerBean type.
        Overrides:
        getContainerBean in class Component
        Returns:
        containerBean. return null if not exists.
      • isCaptchaRequired

        public boolean isCaptchaRequired()
        Is captcha required to perform the action of this menu node? A captcha provides a challenge that requires correct response from user, which is used to prevent Bots from performing the action.
        Returns:
        true if required
      • setCaptchaRequired

        public void setCaptchaRequired​(boolean captchaRequired)
        Set whether captcha is required to perform the action of this menu node. A captcha provides a challenge that requires correct response from user, which is used to prevent Bots from performing the action.
        Parameters:
        captchaRequired - true if required
      • isShowProgress

        public boolean isShowProgress()
        Whether to show progress while the command is being executed.
        Returns:
        true for showing progress
      • setShowProgress

        public void setShowProgress​(boolean showProgress)
        Set whether to show progress while the command is being executed.
        Parameters:
        showProgress - true to show progress
      • getPartialBehaviorSupport

        public PartialBehaviorSupport getPartialBehaviorSupport​(boolean create)
        Get the partial behavior support of this menu node.
        Parameters:
        create - whether to create one if null
        Returns:
        PartialBehaviorSupport instance
      • setPartialBehaviorSupport

        public void setPartialBehaviorSupport​(PartialBehaviorSupport partialBehaviorSupport)
        Set the partialBehavior support of this menu node.
        Parameters:
        partialBehaviorSupport - PartialBehaviorSupport instance
      • getPartialBehavior

        public PartialBehavior getPartialBehavior​(java.lang.String event,
                                                  boolean create)
        Get the partial behavior for the event.
        Parameters:
        event - event name that is defined in PartialBehaviorEvent
        create - whether to create default partial behavior behavior if not defined. the execute target of default partial behavior is commandLink or commandButton.
        Returns:
        the PartialBehavior for the event
      • getActionPartialBehavior

        public PartialBehavior getActionPartialBehavior​(boolean create)
        Get the partial behavior for the action event.
        Parameters:
        create - whether to create default partial behavior if not defined. the execute target of default partial behavior is commandLink or commandButton.
        Returns:
        the PartialBehavior for the action event
      • getDomEventSupport

        public DomEventSupport getDomEventSupport​(boolean create)
        Get the DOM vent support of this menu node.
        Parameters:
        create - whether to create one if null
        Returns:
        DomEventSupport instance
      • getDomEventDynamicHandler

        public java.lang.String getDomEventDynamicHandler​(java.lang.String event)
                                                   throws SystemException
        Description copied from interface: ClientBehaviorHolder
        Get DOM event dynamic handler that is script, not ajax. The event handler is dynamic and can not be put in DomEventSupport statically.
        Specified by:
        getDomEventDynamicHandler in interface ClientBehaviorHolder
        Parameters:
        event - dom event name
        Returns:
        event handler
        Throws:
        SystemException - throw if an error occurs
      • isExpanded

        public boolean isExpanded()
        Whether this menu node is expanded for tree menu. Default: rootMenuNode is expanded.
        Returns:
        true if expanded.
      • setExpanded

        public void setExpanded​(boolean expanded)
        Set whether this menu node is expanded for tree menu.
        Parameters:
        expanded - true for expanded
      • getClientId

        public java.lang.String getClientId​(VisitTarget visitTarget)
        Description copied from class: Component
        Get the clientId of this component. A component has a clientId while being visited by lifecycle. A component may have more than one visitTarget.
        Overrides:
        getClientId in class Component
        Parameters:
        visitTarget - a visitTarget of this component
        Returns:
        clientId
      • setClientId

        public void setClientId​(VisitTarget visitTarget,
                                java.lang.String clientId)
        Description copied from class: Component
        Set the clientId of this component for the visitTarget. A component may have more than one visitTarget.
        Overrides:
        setClientId in class Component
        Parameters:
        visitTarget - a visitTarget of this component
        clientId - clientId to set
      • getModuleNode

        public ModuleNode getModuleNode()
        Get the module node for this menu node if this menu node belongs to a module menu. The module node is mapped to a root menu node created by a ModuleMenuNodeFactory, and the root menu node is the closest ancestor of this menu node if any.
        Returns:
        ModuleNode instance. return null if not found.
      • getNestedViewConfig

        public <T extends ViewConfig> T getNestedViewConfig​(boolean command,
                                                            java.lang.Class<T> viewConfigType)
        Get the nested viewConfig for its command or input data bean from the ViewConfig of its MenuBean.

        The nested viewConfig name: [menuNodeIdentifier]:[command or inputData]. For example, cmd.Create:command for command, id.Create:inputData for inputData bean.

        How a nested viewConfig for command is used depends on its action handler.

        Parameters:
        command - true for command, false for inputData.
        viewConfigType - viewConfig type
        Returns:
        nested viewConfig. return null if not defined or viewConfig type does not match.
        Since:
        5.4
      • isAddSeparatorBefore

        public boolean isAddSeparatorBefore()
        Whether to add a separator before this menu node? Ignored if this menu node is the first menu node among its siblings.
        Returns:
        true to add a separator, false otherwise.
        Since:
        5.5
      • setAddSeparatorBefore

        public void setAddSeparatorBefore​(boolean addSeparatorBefore)
        Set whether to add a separator before this menu node. Ignored if this menu node is the first menu node among its siblings.
        Parameters:
        addSeparatorBefore - true to add a separator, false otherwise.
        Since:
        5.5
      • getMenuNodeWithPath

        public MenuNode getMenuNodeWithPath​(java.lang.String menuNodePath)
        Get the menu node with the path. The path format is MenuNode1/MenuNode2/... where each component is menu node name (unlocalized). If the path is null, return this menuNode.
        Parameters:
        menuNodePath - menu node path, e.g MenuNode1/menuNode2
        Returns:
        MenuNode instance.
        Throws:
        java.lang.IllegalArgumentException - throw if not found
        Since:
        5.13
      • getChildIndex

        public int getChildIndex​(java.lang.String name)
        Get the index of child menu node with the name (unlocalized).
        Parameters:
        name - child menu node name
        Returns:
        zero-based index. return -1 if not found
        Since:
        5.14
      • getDataAccessUnit

        public DataAccessUnit getDataAccessUnit​(boolean returnNullForBoundDataAccessUnit)
        Description copied from class: Component
        Get associated DataAccessUnit. If this component has a parent, return parent's DataAccessUnit.
        Overrides:
        getDataAccessUnit in class Component
        Parameters:
        returnNullForBoundDataAccessUnit - whether to return null for current bound dataAccessUnit.
        Returns:
        DataAccessUnit instance. return null if it is current bound dataAccessUnit and returnNullForBoundDataAccessUnit is true.