Class AbstractTool

    • Field Detail

      • m_CanvasPanel

        protected CanvasPanel m_CanvasPanel
        the canvas panel to operate on.
      • m_KeyListener

        protected ToolKeyAdapter m_KeyListener
        the key listener.
      • m_PanelOptions

        protected BasePanel m_PanelOptions
        the options panel.
      • m_PanelFullOptions

        protected BasePanel m_PanelFullOptions
        the full option panel.
      • m_Modified

        protected boolean m_Modified
        whether the settings are currently modified.
    • Constructor Detail

      • AbstractTool

        protected AbstractTool()
        Initializes the tool.
    • Method Detail

      • initialize

        protected void initialize()
        Initializes the members.
      • setCanvas

        public void setCanvas​(CanvasPanel value)
        Sets the panel to use.
        Specified by:
        setCanvas in interface Tool
        value - the panel
      • getCanvas

        public CanvasPanel getCanvas()
        Returns the currently set canvas panel.
        Specified by:
        getCanvas in interface Tool
        the panel, null if none set
      • hasImage

        public boolean hasImage()
        Checks whether an image is currently available.
        Specified by:
        hasImage in interface Tool
        true if available
      • getImage

        public BufferedImage getImage()
        Returns the current image.
        Specified by:
        getImage in interface Tool
        the image or null if none available
      • getZoom

        public double getZoom()
        Returns the current zoom.
        Specified by:
        getZoom in interface Tool
        the zoom (1.0 = 100%)
      • createCursor

        protected abstract Cursor createCursor()
        Creates the mouse cursor to use.
        the cursor
      • getCursor

        public Cursor getCursor()
        Returns the mouse cursor to use.
        Specified by:
        getCursor in interface Tool
        the cursor
      • createMouseListener

        protected abstract ToolMouseAdapter createMouseListener()
        Creates the mouse listener to use.
        the listener, null if not applicable
      • createMouseMotionListener

        protected abstract ToolMouseMotionAdapter createMouseMotionListener()
        Creates the mouse motion listener to use.
        the listener, null if not applicable
      • createKeyListener

        protected ToolKeyAdapter createKeyListener()
        Creates the key listener to use.
        Default implementation just returns null.
        the listener, null if not applicable
      • getKeyListener

        public ToolKeyAdapter getKeyListener()
        Returns the mouse listener to use.
        Specified by:
        getKeyListener in interface Tool
        the listener
      • checkBeforeApply

        protected String checkBeforeApply()
        Checks the parameters before applying them.
        Default implementation just returns null.
        null if checks passed, otherwise error message (gets displayed in GUI)
      • doApply

        protected abstract void doApply()
        Applies the settings.
      • createApplyButton

        protected BaseFlatButton createApplyButton()
        Generates the apply button.
        the button
      • setApplyButtonState

        protected void setApplyButtonState​(BaseFlatButton button,
                                           boolean modified)
        Sets the state of the "Apply" button according to the modified flag.
        button - the button to update
        modified - whether applying needs doing or not
      • isModified

        public boolean isModified()
        Returns whether the settings are currently modified.
        Specified by:
        isModified in interface Tool
        true if modified
      • createOptionPanel

        protected abstract BasePanel createOptionPanel()
        Creates the panel for setting the options.
        the options panel
      • getOptionPanel

        public BasePanel getOptionPanel()
        Returns the panel for setting the options.
        Specified by:
        getOptionPanel in interface Tool
        the options panel
      • activate

        public void activate()
        Gets called to activate the tool.
        Default implementation repaints the canvas.
        Specified by:
        activate in interface Tool
      • deactivate

        public void deactivate()
        Gets called to deactivate the tool.
        Default implementation does nothing.
        Specified by:
        deactivate in interface Tool
      • update

        public void update()
        Called when image or annotations change.
        Specified by:
        update in interface Tool
      • cleanUp

        public void cleanUp()
        Cleans up data structures, frees up memory.
        Specified by:
        cleanUp in interface CleanUpHandler