Class AbstractMenuItemDefinition

    • Field Detail

      • m_Owner

        protected adams.terminal.application.AbstractTerminalApplication m_Owner
        the owning application.
    • Constructor Detail

      • AbstractMenuItemDefinition

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

        public AbstractMenuItemDefinition​(adams.terminal.application.AbstractTerminalApplication 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​(adams.terminal.application.AbstractTerminalApplication value)
        Sets the owning application.
        Parameters:
        value - the owner
      • getOwner

        public adams.terminal.application.AbstractTerminalApplication getOwner()
        Returns the owning application.
        Returns:
        the owner
      • logMessage

        public void logMessage​(String msg)
        Logs the message.
        Parameters:
        msg - the message to log
      • logError

        public void logError​(String msg)
        Logs the error.
        Parameters:
        msg - the error message to log
      • logError

        public void logError​(String msg,
                             Throwable t)
        Logs the error.
        Parameters:
        msg - the error message to log
        t - the exception
      • 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
      • getTitle

        public abstract String getTitle()
        Returns the title of the window (and text of menuitem).
        Specified by:
        getTitle in interface MenuItem
        Returns:
        the title
      • preRun

        protected void preRun​(com.googlecode.lanterna.gui2.WindowBasedTextGUI context)
        Prepares before the execution.
        Parameters:
        context - the context to use
      • doRun

        protected abstract void doRun​(com.googlecode.lanterna.gui2.WindowBasedTextGUI context)
        Actual execution.
        Parameters:
        context - the context to use
      • postRun

        protected void postRun​(com.googlecode.lanterna.gui2.WindowBasedTextGUI context)
        Cleans up after the execution.
        Parameters:
        context - the context to use
      • getRunnable

        public Runnable getRunnable​(com.googlecode.lanterna.gui2.WindowBasedTextGUI context)
        Returns the Runnable to use.
        Specified by:
        getRunnable in interface MenuItem
        Parameters:
        context - the context to use
        Returns:
        the runnable
      • 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)