Class WMenu

    • Constructor Detail

      • WMenu

        public WMenu()
        Creates a WMenu which is displayed as a menu bar.
      • WMenu

        public WMenu​(WMenu.MenuType type)
        Creates a WMenu of the given type.
        Parameters:
        type - the type of WMenu to create.
    • Method Detail

      • getRows

        public int getRows()
        Deprecated.
        No longer supported, no Java alternative. If this is required use application level CSS.
        Returns:
        the number of rows to display for a column menu.
      • setRows

        public void setRows​(int rows)
        Deprecated.
        No longer supported, no Java alternative. If this is required use application level CSS.
        Sets the number of rows to display for a column menu.
        Parameters:
        rows - The rows to set.
      • getMargin

        public Margin getMargin()
        Get the margin for the component, or null if not set.
        Specified by:
        getMargin in interface Marginable
        Returns:
        the margin for the component, or null if not set
      • setMargin

        public void setMargin​(Margin margin)
        Set the margin for the component, or null for no margin.
        Specified by:
        setMargin in interface Marginable
        Parameters:
        margin - the margin for the component
      • isDisabled

        public boolean isDisabled()
        Indicates whether this menu is disabled.
        Specified by:
        isDisabled in interface Disableable
        Returns:
        true if this menu is disabled.
      • setDisabled

        public void setDisabled​(boolean disabled)
        Sets whether this menu is disabled.
        Specified by:
        setDisabled in interface Disableable
        Parameters:
        disabled - if true, the menu will be disabled.
      • addSeparator

        public void addSeparator()
        Adds a separator to the end of the menu.
      • getMenuItems

        public List<MenuItem> getMenuItems​(boolean recurse)
        Parameters:
        recurse - true if recurse into child items that are menu containers (ie group items and submenus).
        Returns:
        the list of menu items
      • getSelectedItem

        @Deprecated
        public WComponent getSelectedItem()
        Deprecated.
        Returns the selected item (WMenUItem/WSubMenu, depending on the menu type) in the given context.
        Returns:
        the selected item, or null if no item has been selected.
      • getSelectedItems

        @Deprecated
        public List<WComponent> getSelectedItems()
        Deprecated.
        Returns the selected items (WMenUItems/WSubMenus, depending on the menu type) in the given context.
        Returns:
        the selected items, or an empty list if nothing is selected.
      • getSelectedMenuItem

        public MenuItemSelectable getSelectedMenuItem()
        Returns the selected item (WMenUItem/WSubMenu, depending on the menu type) in the given context.
        Returns:
        the selected item, or null if no item has been selected.
      • setSelectedMenuItem

        public void setSelectedMenuItem​(MenuItemSelectable selectedItem)
        Sets the selected item (WMenuItem and/or WSubMenu, depending on the menu type).
        Parameters:
        selectedItem - the selected item.
      • getSelectedMenuItems

        public List<MenuItemSelectable> getSelectedMenuItems()
        Returns the selected items (WMenUItems/WSubMenus, depending on the menu type) in the given context.
        Returns:
        the selected items, or an empty list if nothing is selected.
      • setSelectedMenuItems

        public void setSelectedMenuItems​(List<? extends MenuItemSelectable> selectedItems)
        Sets the selected items (WMenuItems or WSubMenus, depending on the menu type).
        Parameters:
        selectedItems - the selected items.
      • clearSelectedMenuItems

        public void clearSelectedMenuItems()
        Clears an existing list of selected items.
      • afterPaint

        protected void afterPaint​(RenderContext renderContext)
        Subclasses may override this method to output content after the component has been painted. When overriding this method, it is good practice to call the superclass implementation before emitting any additional content.
        Overrides:
        afterPaint in class AbstractWComponent
        Parameters:
        renderContext - the context to render to.
      • isPresent

        protected boolean isPresent​(Request request)
        Determine if this WMenu is on the Request.
        Parameters:
        request - the request being responded to.
        Returns:
        true if this WMenu is on the Request, otherwise return false.
      • getComponentModel

        protected WMenu.MenuModel getComponentModel()
        Returns the effective component model for this component. Subclass may override this method to narrow the return type to their specific model type.
        Overrides:
        getComponentModel in class AbstractWComponent
        Returns:
        the effective component model
      • getOrCreateComponentModel

        protected WMenu.MenuModel getOrCreateComponentModel()
        Retrieves the model for this component so that it can be modified. If this method is called during request processing, and a session specific model does not yet exist, then a new model is created. Subclasses may override this method to narrow the return type to their specific model type.
        Overrides:
        getOrCreateComponentModel in class AbstractWComponent
        Returns:
        the model for this component