Class RMTextShapeTool<T extends RMTextShape>

Direct Known Subclasses:
RMCrossTabCellTool

public class RMTextShapeTool<T extends RMTextShape> extends RMTool<T>
This class provides Swing UI editing for text shapes.
  • Constructor Details

    • RMTextShapeTool

      public RMTextShapeTool()
    • RMTextShapeTool

      public RMTextShapeTool(com.google.common.eventbus.EventBus ebus)
  • Method Details

    • initUI

      protected void initUI()
      Initialize UI panel.
      Overrides:
      initUI in class UIOwner<SwingEvent, JComponent>
    • resetUI

      public void resetUI()
      Refreshes UI controls from currently selected text shape.
      Overrides:
      resetUI in class UIOwner<SwingEvent, JComponent>
    • respondUI

      public void respondUI(SwingEvent anEvent)
      Handles changes from UI panel controls.
      Overrides:
      respondUI in class UIOwner<SwingEvent, JComponent>
    • activateTool

      public void activateTool()
      Overrides standard tool method to deselect any currently editing text.
      Overrides:
      activateTool in class RMTool<T extends RMTextShape>
    • mouseMoved

      public void mouseMoved(MouseEvent anEvent)
      Event handling - overridden to install text cursor.
      Overrides:
      mouseMoved in class RMTool<T extends RMTextShape>
    • mousePressed

      public void mousePressed(MouseEvent anEvent)
      Handles mouse pressed for text tool. Special support to super select any text hit by tool mouse pressed.
      Overrides:
      mousePressed in class RMTool<T extends RMTextShape>
    • mouseDragged

      public void mouseDragged(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 RMTool<T extends RMTextShape>
    • mouseReleased

      public void mouseReleased(MouseEvent e)
      Event handling for text tool mouse loop.
      Overrides:
      mouseReleased in class RMTool<T extends RMTextShape>
    • mousePressed

      public void mousePressed(T aTextShape, MouseEvent anEvent)
      Event handling for shape editing (just forwards to text editor).
      Overrides:
      mousePressed in class RMTool<T extends RMTextShape>
    • mouseDragged

      public void mouseDragged(T aTextShape, MouseEvent anEvent)
      Event handling for shape editing (just forwards to text editor).
      Overrides:
      mouseDragged in class RMTool<T extends RMTextShape>
    • mouseReleased

      public void mouseReleased(T aTextShape, MouseEvent anEvent)
      Event handling for shape editing (just forwards to text editor).
      Overrides:
      mouseReleased in class RMTool<T extends RMTextShape>
    • processKeyEvent

      public void processKeyEvent(T aTextShape, KeyEvent anEvent)
      Key event handling for super selected text.
      Overrides:
      processKeyEvent in class RMTool<T extends RMTextShape>
    • didBecomeSuperSelectedShapeInEditor

      public void didBecomeSuperSelectedShapeInEditor(RMShape aShape, RMEditor anEditor)
      Editor method - installs this text in RMEditor's text editor.
      Overrides:
      didBecomeSuperSelectedShapeInEditor in class RMTool<T extends RMTextShape>
    • mousePressedSelection

      public boolean mousePressedSelection(MouseEvent anEvent)
      Event hook during selection.
      Overrides:
      mousePressedSelection in class RMTool<T extends RMTextShape>
    • moveShapeHandle

      public void moveShapeHandle(T aShape, int aHandle, RMPoint toPoint)
      Moves the handle at the given index to the given point.
      Overrides:
      moveShapeHandle in class RMTool<T extends RMTextShape>
    • getToolTipText

      public String getToolTipText(T aTextShape, MouseEvent anEvent)
      Overrides tool tooltip method to return text string if some chars aren't visible.
      Overrides:
      getToolTipText in class RMTool<T extends RMTextShape>
    • paintShapeHandles

      public void paintShapeHandles(T aTextShape, Graphics2D g, boolean isSuperSelected)
      Paints selected shape indicator, like handles (and maybe a text linking indicator).
      Overrides:
      paintShapeHandles in class RMTool<T extends RMTextShape>
    • isPaintingTextLinkIndicator

      public boolean isPaintingTextLinkIndicator(RMTextShape aText)
      Returns whether to paint text link indicator.
    • paintTextLinkIndicator

      public void paintTextLinkIndicator(RMTextShape aText, Graphics2D g)
      Paints the text link indicator.
    • getHandleCount

      public int getHandleCount(T aText)
      Editor method - returns handle count.
      Overrides:
      getHandleCount in class RMTool<T extends RMTextShape>
    • getHandleRect

      public RMRect getHandleRect(T aTextShape, int handle, boolean isSuperSelected)
      Editor method - returns handle rect in editor coords.
      Overrides:
      getHandleRect in class RMTool<T extends RMTextShape>
    • willLoseSuperSelectionInEditor

      public void willLoseSuperSelectionInEditor(RMShape aShape, RMEditor anEditor)
      Editor method - uninstalls this text from RMEditor's text editor and removes new text if empty.
      Overrides:
      willLoseSuperSelectionInEditor in class RMTool<T extends RMTextShape>
    • acceptsDrag

      public boolean acceptsDrag(T aShape, DropTargetDragEvent anEvent)
      Overrides Tool implementation to accept KeysPanel drags.
      Overrides:
      acceptsDrag in class RMTool<T extends RMTextShape>
      Parameters:
      aShape - the shape being dragged over
      anEvent - the drag event carrying data flavor information
      Returns:
      true to accept the drag; false to reject it
    • drop

      public void drop(T aShape, DropTargetDropEvent anEvent)
      Override normal implementation to handle KeysPanel drop.
      Overrides:
      drop in class RMTool<T extends RMTextShape>
    • getShapeClass

      public Class getShapeClass()
      Returns the shape class that this tool edits.
      Overrides:
      getShapeClass in class RMTool<T extends RMTextShape>
    • getWindowTitle

      public String getWindowTitle()
      Returns the name of this tool to be displayed by inspector.
      Overrides:
      getWindowTitle in class RMTool<T extends RMTextShape>
    • convertToText

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