Class AbstractTool

    • Field Detail

      • m_PanelCanvas

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

        protected ToolKeyAdapter m_KeyListener
        the key listener.
      • m_PaintOperation

        protected PaintOperation m_PaintOperation
        the paint operation.
      • m_PanelOptions

        protected BasePanel m_PanelOptions
        the options panel.
      • m_PanelFullOptions

        protected BasePanel m_PanelFullOptions
        the full option panel.
    • 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 canvas panel to use.
        Specified by:
        setCanvas in interface Tool
        Parameters:
        value - the panel
      • getCanvas

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

        public LayerManager getLayerManager()
        Returns the layer manager.
        Specified by:
        getLayerManager in interface Tool
        Returns:
        the layer manager, null if not available
      • hasActiveOverlay

        public boolean hasActiveOverlay()
        Returns whether an active overlay layer is present.
        Specified by:
        hasActiveOverlay in interface Tool
        Returns:
        true if available
      • getActiveOverlay

        public OverlayLayer getActiveOverlay()
        Returns the active overlay layer.
        Specified by:
        getActiveOverlay in interface Tool
        Returns:
        the layer, null if none available
      • hasActiveCombinedSubLayer

        public boolean hasActiveCombinedSubLayer()
        Returns whether an active combined sub layer is present.
        Specified by:
        hasActiveCombinedSubLayer in interface Tool
        Returns:
        true if available
      • getActiveImage

        public BufferedImage getActiveImage()
        Returns the active image.
        Specified by:
        getActiveImage in interface Tool
        Returns:
        the image or null if none active
      • getActiveColor

        public Color getActiveColor()
        Returns the active color.
        Specified by:
        getActiveColor in interface Tool
        Returns:
        the color or null if none active
      • getZoom

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

        public boolean isAutomaticUndoEnabled()
        Returns whether automatic undo is enabled.
        Specified by:
        isAutomaticUndoEnabled in interface Tool
        Returns:
        true if enabled
      • createCursor

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

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

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

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

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

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

        protected PaintOperation createPaintOperation()
        Creates the paint operation to use.
        Default implementation just returns the NullOperation.
        Returns:
        the operation
      • getPaintOperation

        public PaintOperation getPaintOperation()
        Returns the paint operation for the tool.
        Specified by:
        getPaintOperation in interface Tool
        Returns:
        the paint operation
      • checkBeforeApply

        protected String checkBeforeApply()
        Checks the parameters before applying them.
        Default implementation just returns null.
        Returns:
        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.
        Returns:
        the button
      • setApplyButtonState

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

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

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

        public void activate()
        Gets called to activate the tool.
        Default implementation does nothing.
        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
      • annotationsChanged

        public void annotationsChanged()
        Hook method for when new annotations have been set.
        Specified by:
        annotationsChanged in interface Tool
      • cleanUp

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