Class AbstractToolPlugin<T extends JPanel>

    • Field Detail

      • m_LastSetup

        protected static Hashtable<Class,​Object> m_LastSetup
        for storing the last setup for a plugin.
      • m_CurrentPanel

        protected T extends JPanel m_CurrentPanel
        the current panel.
      • m_CanceledByUser

        protected boolean m_CanceledByUser
        whether the user canceled the operation.
    • Constructor Detail

      • AbstractToolPlugin

        public AbstractToolPlugin()
    • Method Detail

      • getMenu

        public String getMenu()
        Returns the text for the menu to place the plugin beneath.
        Returns:
        the menu
      • getCaption

        public abstract String getCaption()
        Returns the text for the menu item to create.
        Returns:
        the text
      • getIconName

        public String getIconName()
        Returns the icon name.
        Returns:
        the name, null if none available
      • getIcon

        public ImageIcon getIcon()
        Returns the icon.
        Returns:
        the icon or the empty icon if no icon name available
      • hasLastSetup

        protected boolean hasLastSetup()
        Checks whether there is a setup available for the class of this object.
        Returns:
        true if a setup is available
      • getLastSetup

        protected Object getLastSetup()
        Returns the last setup for this object's class.
        Returns:
        the setup, null if none available
      • setLastSetup

        protected void setLastSetup​(Object setup)
        Stores the setup for this object's class.
        Parameters:
        setup - the setup to store
      • getCanceledByUser

        public boolean getCanceledByUser()
        Returns whether the operation was canceled by the user.
        Returns:
        true if the user canceled the operation
      • canExecute

        public abstract boolean canExecute​(T panel)
        Checks whether the plugin can be executed given the specified panel.
        Parameters:
        panel - the panel to use as basis for decision
        Returns:
        true if plugin can be executed
      • doExecute

        protected abstract String doExecute()
        Executes the plugin.
        Returns:
        null if OK, otherwise error message. Using an empty string will suppress the error message display and the creation of a log entry.
      • createLogEntry

        protected abstract String createLogEntry()
        Creates the log message.
        Returns:
        the message, null if none available
      • doLog

        protected abstract void doLog​(String msg)
        Performs the actual logging.
        Parameters:
        msg - the message to log
      • log

        protected void log()
        Logs the successful action to the log.
      • execute

        public String execute​(T panel)
        Executes the plugin.
        Parameters:
        panel - the panel to use the plugin on
        Returns:
        null if OK, otherwise error message