Class AbstractMenuItemDefinition

    • Constructor Detail

      • AbstractMenuItemDefinition

        public AbstractMenuItemDefinition()
        Initializes the menu item with no owner.
      • AbstractMenuItemDefinition

        public AbstractMenuItemDefinition​(AbstractApplicationFrame owner)
        Initializes the menu item.
        Parameters:
        owner - the owning application
    • Method Detail

      • initialize

        protected void initialize()
        Initializes members.

        Default implementation does nothing.
      • setOwner

        public void setOwner​(AbstractApplicationFrame value)
        Sets the owning application.
        Parameters:
        value - the owner
      • isAvailable

        public boolean isAvailable()
        Returns whether the menu item is available.
        Returns:
        true if available
      • getIconName

        public String getIconName()
        Returns the file name of the icon.
        Returns:
        the filename or null if no icon available
      • getIcon

        public ImageIcon getIcon()
        Returns the icon.
        Returns:
        the icon or null if no icon available
      • getMenuItem

        public abstract JMenuItem getMenuItem()
        Returns the JMenuItem to use.
        Returns:
        the menu item
      • getTitle

        public abstract String getTitle()
        Returns the title of the window (and text of menuitem).
        Returns:
        the title
      • equals

        public boolean equals​(Object obj)
        Checks whether the obj is the same definition (using category/title).
        Overrides:
        equals in class Object
        Parameters:
        obj - the object to compare with
        Returns:
        true if the same definition
        See Also:
        compareTo(AbstractMenuItemDefinition)
      • isSingleton

        public abstract boolean isSingleton()
        Whether the panel can only be displayed once.
        Returns:
        true if the panel can only be displayed once
      • getUserMode

        public abstract UserMode getUserMode()
        Returns the user mode, which determines visibility as well.
        Returns:
        the user mode
      • getCategory

        public abstract String getCategory()
        Returns the category of the menu item in which it should appear, i.e., the name of the menu.
        Returns:
        the category/menu name
      • getActualCategory

        public String getActualCategory()
        Returns the actual category of the menu item in which it should appear, i.e., the name of the menu.
        Returns:
        the category/menu name
      • requiresRestartableApplication

        public boolean requiresRestartableApplication()
        Returns whether the menu item requires a restartable application.
        Returns:
        true if a restartable application is required
      • createChildFrame

        protected ChildFrame createChildFrame​(Component c)
        Creates a frame and returns it. Doesn't change width or height.
        Parameters:
        c - the component to place, can be null
        Returns:
        the generated frame
      • createChildFrame

        protected ChildFrame createChildFrame​(Component c,
                                              Dimension size)
        creates a frame and returns it.
        Parameters:
        c - the component to place, can be null
        size - the size of the frame, ignored if -1 and -1
        Returns:
        the generated frame
      • getLogger

        protected Logger getLogger()
        Returns the logger.
        Returns:
        the logger
      • forCommandLine

        public static AbstractMenuItemDefinition forCommandLine​(AbstractApplicationFrame owner,
                                                                String cmdline)
        Instantiates the menu item definition from the given commandline (i.e., classname and optional parameters).
        Parameters:
        owner - the owning application frame
        cmdline - the classname (and optional parameters) of the menu item definition to instantiate
        Returns:
        the instantiated menu item definition or null if an error occurred
      • forName

        public static AbstractMenuItemDefinition forName​(AbstractApplicationFrame owner,
                                                         String classname,
                                                         String[] params)
        Returns a menu item definition based on the classname and optional parameters.
        Parameters:
        owner - the owning application frame
        classname - the class name of the menu item
        params - the optional parameters, can be null
        Returns:
        the generated menu item definition, null in case of an error