Class TextTool

    • Constructor Detail

      • TextTool

        public TextTool()
        Creates a new text tool.
    • Method Detail

      • getUI

        public RJPanel getUI()
        Returns the Swing UI panel for this tool.
        Overrides:
        getUI in class Tool
      • resetUI

        public void resetUI()
        Refreshes Swing UI controls from currently selected text shape.
        Overrides:
        resetUI in class Tool
      • respondUI

        public void respondUI​(java.lang.Object anObj)
        Handles changes from Swing UI panel controls.
        Overrides:
        respondUI in class Tool
      • activateTool

        public void activateTool()
        Overrides standard tool method to deselect any currently editing text.
        Overrides:
        activateTool in class Tool
      • mouseMoved

        public void mouseMoved​(java.awt.event.MouseEvent anEvent)
        Event handling - overridden to install text cursor.
        Overrides:
        mouseMoved in class Tool
      • mousePressed

        public void mousePressed​(java.awt.event.MouseEvent anEvent)
        Handles mouse pressed for text tool. Special support to super select any text hit by tool mouse pressed.
        Overrides:
        mousePressed in class Tool
      • mouseDragged

        public void mouseDragged​(java.awt.event.MouseEvent anEvent)
        Handles mouse dragged for tool. If user doesn't really drag, then default text box should align the base line of the text about the pressed point. If they do really drag, then text box should be the rect they drag out.
        Overrides:
        mouseDragged in class Tool
      • mouseReleased

        public void mouseReleased​(java.awt.event.MouseEvent e)
        Event handling for text tool mouse loop.
        Overrides:
        mouseReleased in class Tool
      • mousePressed

        public void mousePressed​(RMShape aShape,
                                 java.awt.event.MouseEvent anEvent)
        Event handling for shape editing (just forwards to text editor).
        Overrides:
        mousePressed in class Tool
      • mouseDragged

        public void mouseDragged​(RMShape aShape,
                                 java.awt.event.MouseEvent anEvent)
        Event handling for shape editing (just forwards to text editor).
        Overrides:
        mouseDragged in class Tool
      • mouseReleased

        public void mouseReleased​(RMShape aShape,
                                  java.awt.event.MouseEvent anEvent)
        Event handling for shape editing (just forwards to text editor).
        Overrides:
        mouseReleased in class Tool
      • mousePressedSelection

        public boolean mousePressedSelection​(java.awt.event.MouseEvent anEvent)
        Event hook during selection.
        Overrides:
        mousePressedSelection in class Tool
      • paintSelectedShape

        public void paintSelectedShape​(RMShape aShape,
                                       java.awt.Graphics2D g)
        Paints selected shape indicator, like handles (and maybe a text linking indicator).
        Overrides:
        paintSelectedShape in class Tool
      • paintSuperSelectedShape

        public void paintSuperSelectedShape​(RMShape aShape,
                                            java.awt.Graphics2D g)
        Paints super selected shape indicators, like handles.
        Overrides:
        paintSuperSelectedShape in class Tool
      • paintTextLinkIndicator

        public void paintTextLinkIndicator​(RMText text,
                                           java.awt.Graphics2D g)
        Paints the text link indicator.
      • getHandleCount

        public int getHandleCount​(RMShape aShape)
        Editor method - returns handle count.
        Overrides:
        getHandleCount in class Tool
      • getHandleRect

        public RMRect getHandleRect​(RMShape aShape,
                                    int handle,
                                    boolean isSuperSelected)
        Editor method - returns handle rect in editor coords.
        Overrides:
        getHandleRect in class Tool
      • willLoseSuperSelectionInEditor

        public void willLoseSuperSelectionInEditor​(RMShape aShape,
                                                   RMEditor anEditor)
        Editor method - unistalls this text from RMEditor's text editor and removes new text if empty.
        Overrides:
        willLoseSuperSelectionInEditor in class Tool
      • flushChanges

        public void flushChanges​(RMEditor anEditor,
                                 RMShape aShape)
        Editor method - resets text's cached height-to-fit value.
        Overrides:
        flushChanges in class Tool
      • getShapeClass

        public java.lang.Class getShapeClass()
        Returns the shape class that this tool edits.
        Overrides:
        getShapeClass in class Tool
      • isInstance

        public boolean isInstance​(java.lang.Object anObj)
        Returns whether the given object can be edited by this tool.
        Overrides:
        isInstance in class Tool
      • getWindowTitle

        public java.lang.String getWindowTitle()
        Returns the name of this tool to be displayed by inspector.
        Overrides:
        getWindowTitle in class Tool
      • convertToText

        public static void convertToText​(RMShape aShape,
                                         java.lang.String aString)
        Converts a shape to a text shape.