Class ShadowMenu

    • Constructor Detail

      • ShadowMenu

        public ShadowMenu​(Context context,
                          Collection<? extends ModuleInfo> modules)
        Constructs a root menu node populated with the given modules.
    • Method Detail

      • getModuleInfo

        public ModuleInfo getModuleInfo()
        Gets the module linked to this node, or null if node is not a leaf.
      • getMenu

        public ShadowMenu getMenu​(MenuPath menuPath)
        Gets the node with the given menu path (relative to this node), or null if no such menu node.

        For example, asking for "File > New > Image..." from the root application menu node would retrieve the node for "Image...", as would asking for "New > Image..." from the "File" node.

      • getMenuEntry

        public MenuEntry getMenuEntry()
        Gets the menu entry corresponding to this node. May be a non-leaf menu (e.g., "File") or a leaf item (e.g., "Exit").
      • getMenuDepth

        public int getMenuDepth()
        Gets how deep into the menu structure this node is. For example, "File" would be at depth 1, whereas "Exit" (of "File>Exit") would be at depth 2.
      • getParent

        public ShadowMenu getParent()
        Gets this node's parent, or null if it is a root node.
      • getChildren

        public List<ShadowMenu> getChildren()
        Gets this node's children, sorted by weight.
      • isLeaf

        public boolean isLeaf()
        Returns true if this node has no children.
      • isToggle

        public boolean isToggle()
        Returns true if this node is selectable (checkbox or radio button).
      • isCheckBox

        public boolean isCheckBox()
        Returns true if this node is a checkbox.
      • isRadioButton

        public boolean isRadioButton()
        Returns true if this node is a radio button.
      • update

        public boolean update​(ModuleInfo module)
        Updates the menu structure to reflect changes in the given module. Does nothing unless the module is already in the menu structure.
        Returns:
        true if the module was successfully updated
      • updateAll

        public boolean updateAll​(Collection<? extends ModuleInfo> c)
        Updates the menu structure to reflect changes in the given modules. Does nothing unless at least one of the modules is already in the menu structure.
        Returns:
        true if at least one module was successfully updated
      • getName

        public String getName()
        Description copied from interface: Named
        Gets the name of the object.
        Specified by:
        getName in interface Named
      • setName

        public void setName​(String name)
        Description copied from interface: Named
        Sets the name of the object.
        Specified by:
        setName in interface Named
      • run

        public void run()
        Executes the module linked to this node. Does nothing for non-leaf nodes.
        Specified by:
        run in interface Runnable