Class ApplicationMenu

    • Field Detail

      • LAYOUT_AUTOMATICDISCOVERY

        public static final String LAYOUT_AUTOMATICDISCOVERY
        the props file key for the automatic menu item discovery.
        See Also:
        Constant Field Values
      • LAYOUT_MENU_PREFIX

        public static final String LAYOUT_MENU_PREFIX
        the props file key prefix for the menus.
        See Also:
        Constant Field Values
      • LAYOUT_SHORTCUT_PREFIX

        public static final String LAYOUT_SHORTCUT_PREFIX
        the props file key prefix for the shortcuts.
        See Also:
        Constant Field Values
      • LAYOUT_BLACKLISTED_PREFIX

        public static final String LAYOUT_BLACKLISTED_PREFIX
        the props file key prefix for the blacklisted menu items.
        See Also:
        Constant Field Values
      • LAYOUT_CATEGORY_PREFIX

        public static final String LAYOUT_CATEGORY_PREFIX
        the props file key prefix for the menu items with a new category.
        See Also:
        Constant Field Values
      • LAYOUT_MENU_WINDOWS

        public static final String LAYOUT_MENU_WINDOWS
        the props file key for the windows menu.
        See Also:
        Constant Field Values
      • LAYOUT_MENU_TOOLS

        public static final String LAYOUT_MENU_TOOLS
        the props file key for the tools menu.
        See Also:
        Constant Field Values
      • SEPARATOR

        public static final String SEPARATOR
        the separator between classname and alternative title.
        See Also:
        Constant Field Values
      • m_UnavailableMenuItems

        protected static HashSet<String> m_UnavailableMenuItems
        stores classnames that aren't available.
      • m_Setup

        protected String m_Setup
        the file with the layout, shortcuts and blacklisted menu items.
      • m_Properties

        protected Properties m_Properties
        the properties read from the setup file.
      • m_UserMode

        protected UserMode m_UserMode
        the user mode.
      • m_MenuWindows

        protected JMenu m_MenuWindows
        the "windows" menu.
    • Constructor Detail

      • ApplicationMenu

        public ApplicationMenu​(AbstractApplicationFrame owner)
        Initializes menu generator.
        Parameters:
        owner - the owning application frame
    • Method Detail

      • setSetup

        public void setSetup​(String value)
        Sets the setup file with the layout, etc.
        Parameters:
        value - the setup file
      • getSetup

        public String getSetup()
        Returns the setup file with the layout, etc.
        Returns:
        the setup file
      • setUserMode

        public void setUserMode​(UserMode value)
        Sets the user mode to use, i.e., the visibility level of menu items.
        Parameters:
        value - the user mode
      • getUserMode

        public UserMode getUserMode()
        Returns the current user mode, i.e., the visibility level of menu items.
        Returns:
        the user mode
      • getProperties

        protected Properties getProperties()
        Returns the properties.
        Returns:
        the properties
      • determineItemIndex

        protected int determineItemIndex​(String[] items,
                                         JMenu menu)
        Determines the lowest index of the menu items in the given menu.
        Parameters:
        items - the items to look for in the menu (case-insensitive)
        menu - the menu to look through
        Returns:
        the lowest index, -1 if none was found
      • getMenuBar

        public JMenuBar getMenuBar()
        Generates the menu and returns it.
        Returns:
        the menu bar
      • setBlacklisted

        public void setBlacklisted​(Class cls,
                                   boolean value)
        Sets whether the class is blacklisted or not.
        Parameters:
        cls - the class to blacklist/whitelist
        value - true if to blacklist
      • setBlacklisted

        public void setBlacklisted​(String classname,
                                   boolean value)
        Sets whether the class is blacklisted or not.
        Parameters:
        classname - the class to blacklist/whitelist
        value - true if to blacklist
      • isBlacklisted

        public boolean isBlacklisted​(Class cls)
        Checks whether the class is blacklisted.
        Parameters:
        cls - the class to check
        Returns:
        true if blacklisted
      • isBlacklisted

        public boolean isBlacklisted​(String classname)
        Checks whether the class is blacklisted.
        Parameters:
        classname - the class to check
        Returns:
        true if blacklisted
      • hasCategory

        public boolean hasCategory​(Class cls)
        Checks whether the class has a different category assigned.
        Parameters:
        cls - the class to check
        Returns:
        true if a different category assigned
      • hasCategory

        public boolean hasCategory​(String classname)
        Checks whether the class has a different category assigned.
        Parameters:
        classname - the class to check
        Returns:
        true if a different category assigned
      • getCategory

        public String getCategory​(Class cls)
        Returns the different category assigned for the class (if any).
        Parameters:
        cls - the class to get the category for
        Returns:
        the category, null if no alternative assigned
      • getCategory

        public String getCategory​(String classname)
        Returns the different category assigned for the class (if any).
        Parameters:
        classname - the class to get the category for
        Returns:
        the category, null if no alternative assigned
      • isUnavailable

        public boolean isUnavailable​(Class cls)
        Checks whether the class is unavailable (ie not found in classpath), based on previous menu generation.
        Parameters:
        cls - the class to check
        Returns:
        true if unavailable
      • isUnavailable

        public boolean isUnavailable​(String classname)
        Checks whether the class is unavailable (ie not found in classpath), based on previous menu generation.
        Parameters:
        classname - the name to check
        Returns:
        true if unavailable
      • setUnavailable

        public void setUnavailable​(Class cls)
        Marks this class as unavailable.
        Parameters:
        cls - the class to mark as unavailable
      • setUnavailable

        public void setUnavailable​(String classname)
        Marks this class as unavailable.
        Parameters:
        classname - the name to mark as unavailable
      • getWindowsMenu

        public JMenu getWindowsMenu()
        Returns the "Windows" menu from the last "getMenuBar" call.
        Returns:
        the "Windows" menu
        See Also:
        getMenuBar()