Class Tool

All Implemented Interfaces:
RMArchiver.Archiving, Cloneable
Direct Known Subclasses:
BarcodeTool, CellDividerTool, CellTableTool, CrossTabTool, DocumentTool, GraphBarLabelTool, GraphTool, GraphTool.GraphContentTool, ImageTool, LabelsTool, LabelTool, LineGraphTool, LineSegmentTool, NestedDocTool, OvalTool, PageTool, PolygonTool, RBTool, RectangleTool, Scene3DTool, SelectTool, SoundTool, SwitchShapeTool, TableGroupTool, TableRowTool, TableTool, TextTool, TextToolAdvanced

public class Tool extends RMObject
This is the base class for tools in RM - the objects that provide GUI editing for RM shapes.
  • Field Details

  • Constructor Details

    • Tool

      public Tool()
      Creates a basic tool.
  • Method Details

    • getTool

      public static Tool getTool(Object anObj)
      Returns the specific tool for a given shape.
    • getTool

      public static Tool getTool(List aList)
      Returns the specific tool for a list of shapes (if they have the same tool).
    • getSelectTool

      public static SelectTool getSelectTool()
      Returns the SelectTool.
    • getCoreTool

      public static Tool getCoreTool(int anIndex)
      Returns the specific core tool at the given index.
    • getCoreToolIndex

      public static int getCoreToolIndex(Tool aTool)
      Returns the core tool index for the given tool.
    • getShapeClass

      public Class getShapeClass()
      Returns the shape class that this tool handles.
    • newInstance

      public RMShape newInstance()
      Returns a new instance of the shape class that this tool is responsible for.
    • isInstance

      public boolean isInstance(Object anObj)
      Returns whether given object is editable by this tool.
    • getWindowTitle

      public String getWindowTitle()
      Returns the string to be used for the inspector window title.
    • editor

      public RMEditor editor()
      Returns the current editor.
    • getSelectedShape

      public RMShape getSelectedShape()
      Returns the current selected shape for the current editor.
    • getSelectedShapes

      public List getSelectedShapes()
      Returns the current selected shapes for the current editor.
    • getUI

      public RJPanel getUI()
      Returns the Swing UI panel for this tool.
    • resetUI

      public void resetUI()
      Resets the UI associated with this tool.
    • respondUI

      public void respondUI(Object anObj)
      Responder callback for the UI associated with this tool.
    • activateTool

      public void activateTool()
      Called when a tool is selected.
    • deactivateTool

      public void deactivateTool()
      Called when a tool is deselected (when another tool is selected).
    • reactivateTool

      public void reactivateTool()
      Called when a tool is selected even when it's already the current tool.
    • flushChanges

      public void flushChanges(RMEditor anEditor, RMShape aShape)
      Called when a tool is deselected to give an opportunity to finalize changes in progress.
    • mouseMoved

      public void mouseMoved(MouseEvent anEvent)
      Event handling - called on mouse move when this tool is active.
    • mousePressed

      public void mousePressed(MouseEvent anEvent)
      Event handling for shape creation.
    • mouseDragged

      public void mouseDragged(MouseEvent anEvent)
      Event handling for shape creation.
    • mouseReleased

      public void mouseReleased(MouseEvent anEvent)
      Event handling for shape creation.
    • mouseMoved

      public void mouseMoved(RMShape aShape, MouseEvent anEvent)
      Event handling from select tool - called on mouse move when tool shape is super selected. MouseMoved is useful for setting a custom cursor.
    • mousePressed

      public void mousePressed(RMShape aShape, MouseEvent anEvent)
      Event handling from select tool for super selected shapes.
    • mouseDragged

      public void mouseDragged(RMShape aShape, MouseEvent anEvent)
      Event handling from select tool for super selected shapes.
    • mouseReleased

      public void mouseReleased(RMShape aShape, MouseEvent anEvent)
      Event handling from select tool for super selected shapes.
    • mousePressedSelection

      public boolean mousePressedSelection(MouseEvent anEvent)
      Event hook during selection.
    • processKeyEvent

      public void processKeyEvent(RMShape aShape, KeyEvent anEvent)
      Editor method.
    • paintTool

      public void paintTool(Graphics2D g)
      Paints when tool is active for things like SelectTool's handles & selection rect or polygon's in-progress path.
    • paintSelectedShape

      public void paintSelectedShape(RMShape aShape, Graphics2D g)
      Handles painting the indication that a shape is selected. Draws handles by default.
    • paintSuperSelectedShape

      public void paintSuperSelectedShape(RMShape aShape, Graphics2D g)
      Handles painting the indication that a shape is super selected. Draws semi-transparent, outset handles by default.
    • getHandleCount

      public int getHandleCount(RMShape aShape)
      Returns the number of handles for this shape.
    • getHandlePoint

      public RMPoint getHandlePoint(RMShape aShape, int handle, boolean isSuperSelected)
      Returns the point for the handle of the given shape at the given handle index in the given shape's coords.
    • getHandleRect

      public RMRect getHandleRect(RMShape aShape, int handle, boolean isSuperSelected)
      Returns the rect for the handle at the given index in editor coords.
    • getHandleAtPoint

      public int getHandleAtPoint(RMShape aShape, Point2D aPoint, boolean isSuperSelected)
      Returns the handle hit by the given editor coord point.
    • didBecomeSuperSelectedShapeInEditor

      public void didBecomeSuperSelectedShapeInEditor(RMShape aShape, RMEditor anEditor)
      Editor method - called when an instance of this tool's shape is super selected.
    • willLoseSuperSelectionInEditor

      public void willLoseSuperSelectionInEditor(RMShape aShape, RMEditor anEditor)
      Editor method - called when an instance of this tool's shape in de-super-selected.
    • isSelected

      public boolean isSelected(RMShape aShape)
      Utility method, returns whether a given shape is selected in the editor.
    • isSuperSelected

      public boolean isSuperSelected(RMShape aShape)
      Utility method, returns whether a given shape is superselected in the editor.
    • moveShapeHandle

      public void moveShapeHandle(RMShape aShape, int handle, RMPoint toPoint)
      Moves the handle at the given index to the given point.
    • getShapeHandleAtPoint

      public Tool.RMShapeHandle getShapeHandleAtPoint(Point2D aPoint)
      Returns the shape handle for the given editor point.
    • getImageIcon

      public ImageIcon getImageIcon()
      Returns the image icon used to represent shapes that this tool represents.
    • getImageIcon

      public static ImageIcon getImageIcon(Class aClass)
      Returns the image icon for the given shape class.