Interface MenuItem

    • Method Detail

      • getResourceKey

        java.lang.String getResourceKey()
        Retrieve the resource key ("name") of this menu item
        Returns:
        resource key for this menu
      • getStyle

        int getStyle()
        Get the type of the menu item
      • setStyle

        void setStyle​(int style)
        Set the style of the menu item (see STYLE_ constants)
        Parameters:
        style -
      • getData

        java.lang.Object getData()
        Get the current data value associated with the menu: Boolean for CHECK style
        Returns:
      • setData

        void setData​(java.lang.Object data)
        Set the current data value associated with the menu: Boolean for CHECK style
        Parameters:
        data -
      • isEnabled

        boolean isEnabled()
        Whether or not this item is enabled or not
        Returns:
      • setEnabled

        void setEnabled​(boolean enabled)
        Set the enabled status of the menu item
        Parameters:
        enabled -
      • setGraphic

        void setGraphic​(Graphic graphic)
        set the menu item's icon
        Parameters:
        graphic -
      • getGraphic

        Graphic getGraphic()
        get the menu's graphic
        Returns:
      • addFillListener

        void addFillListener​(MenuItemFillListener listener)
        Adds a listener to be notified when the menu item is about to be displayed. The "context" object provided is always going to be either be null (if there is no context) or an array of objects (such as an array of TableRows or an array of Download objects).
        Parameters:
        listener -
      • setSubmenuBuilder

        void setSubmenuBuilder​(MenuBuilder builder)
        For STYLE_MENU, builder is called when user wants to see the submenu items. Setting a builder will force clear all submenu items.
        Since:
        5.5.0.1
      • addMultiListener

        void addMultiListener​(MenuItemListener l)
        Adds a selection listener for this menu item. This differs from addListener(MenuItemListener), in that the target object which will be passed to the listener will be an array of objects, rather than just a single object.
        Parameters:
        l - listener to be notified when user has selected the menu item.
        Since:
        3.0.2
      • removeMultiListener

        void removeMultiListener​(MenuItemListener l)
        Removes a selection listener from this menu item. You only use this method to remove a listener added via addMultiListener(MenuItemListener).
        Parameters:
        l - listener to remove
        Since:
        3.0.2
      • addListener

        void addListener​(MenuItemListener l)
        Adds a selection listener for this menu item.
        Parameters:
        l - listener to be notified when user has selected the menu item.
      • removeListener

        void removeListener​(MenuItemListener l)
        Removes a selection listener from this menu item.
        Parameters:
        l - listener to remove
      • getParent

        MenuItem getParent()
        Retrieve the parent MenuItem.
        Returns:
        parent menu object, or null if no parent
      • getItems

        MenuItem[] getItems()
        Get all child items currently associated with this MenuItem.
        Returns:
        An array of items (if this object has the menu style associated) or null otherwise.
      • getItem

        MenuItem getItem​(java.lang.String key_id)
        Get the child item with the given resource key.
        Returns:
        The child MenuItem object which has the resource key specified, or null otherwise.
      • getText

        java.lang.String getText()
        Gets the text to display for this menu item.
      • setText

        void setText​(java.lang.String text)
        Sets the text to display for this menu item. You can also pass null to revert back to the default behaviour.
      • getMenuID

        java.lang.String getMenuID()
        Retrieve the menu ID that the menu item belongs to
        Returns:
        MenuManager.MENU_ constant.
        Since:
        3.0.0.7
      • remove

        void remove()
        Removes the menu item. Calling this will remove the item from the menus, as well as removing all listeners and removing all child menu items (if any exist). The behaviour of this object is undefined after this method has been called. If you need to interact with this object when you are about to destroy it, you should do it before you call the remove method.
        Since:
        3.0.0.7
      • removeAllChildItems

        void removeAllChildItems()
        Removes all child menu items from this menu (if any exist).
        Since:
        3.0.0.7
      • setVisible

        void setVisible​(boolean visible)
        Sets whether the menu item is visible or not.
        Since:
        3.0.2.0
      • isVisible

        boolean isVisible()
        Returns whether the menu item is visible or not.
        Since:
        3.0.2.0
      • isSelected

        boolean isSelected()
        Returns whether the menu item is selected or not. This method should only be called if the menu is of type STYLE_RADIO or type STYLE_CHECK and if the menu item has already had a selected or deselected state assigned to it.
        Since:
        3.0.2.4
      • setHeaderCategory

        void setHeaderCategory​(java.lang.String header)
        Sets which header to place the menu item under for top level fancy menu
      • getHeaderCategory

        java.lang.String getHeaderCategory()
        The header that a top menu item will be placed under for the fancy menu
      • getMinUserMode

        int getMinUserMode()
      • setMinUserMode

        void setMinUserMode​(int minUserMode)
      • setDisposeWithUIDetach

        void setDisposeWithUIDetach​(java.lang.String uiType)
        Auto-dispose of MenuItem when a specific UI is detached (See {@link com.biglybt.pif.ui.UIInstance#UIT_*} for types
        Parameters:
        uiType -
      • getDisposeWithUIDetach

        java.lang.String getDisposeWithUIDetach()