public class Tool extends RMObject
Modifier and Type | Class and Description |
---|---|
static class |
Tool.RMShapeHandle
An inner class describing a shape and a handle.
|
Modifier and Type | Field and Description |
---|---|
static byte |
HandleMaxXMaxY |
static byte |
HandleMaxXMidY |
static byte |
HandleMaxXMinY |
static byte |
HandleMidXMaxY |
static byte |
HandleMidXMinY |
static byte |
HandleMinXMaxY |
static byte |
HandleMinXMidY |
static byte |
HandleMinXMinY |
static byte |
HandleWidth |
Constructor and Description |
---|
Tool()
Creates a basic tool.
|
Modifier and Type | Method and Description |
---|---|
void |
activateTool()
Called when a tool is selected.
|
void |
deactivateTool()
Called when a tool is deselected (when another tool is selected).
|
void |
didBecomeSuperSelectedShapeInEditor(RMShape aShape,
RMEditor anEditor)
Editor method - called when an instance of this tool's shape is super selected.
|
RMEditor |
editor()
Returns the current editor.
|
void |
flushChanges(RMEditor anEditor,
RMShape aShape)
Called when a tool is deselected to give an opportunity to finalize changes in progress.
|
static Tool |
getCoreTool(int anIndex)
Returns the specific core tool at the given index.
|
static int |
getCoreToolIndex(Tool aTool)
Returns the core tool index for the given tool.
|
int |
getHandleAtPoint(RMShape aShape,
java.awt.geom.Point2D aPoint,
boolean isSuperSelected)
Returns the handle hit by the given editor coord point.
|
int |
getHandleCount(RMShape aShape)
Returns the number of handles for this shape.
|
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.
|
RMRect |
getHandleRect(RMShape aShape,
int handle,
boolean isSuperSelected)
Returns the rect for the handle at the given index in editor coords.
|
javax.swing.ImageIcon |
getImageIcon()
Returns the image icon used to represent shapes that this tool represents.
|
static javax.swing.ImageIcon |
getImageIcon(java.lang.Class aClass)
Returns the image icon for the given shape class.
|
RMShape |
getSelectedShape()
Returns the current selected shape for the current editor.
|
java.util.List |
getSelectedShapes()
Returns the current selected shapes for the current editor.
|
static SelectTool |
getSelectTool()
Returns the SelectTool.
|
java.lang.Class |
getShapeClass()
Returns the shape class that this tool handles.
|
Tool.RMShapeHandle |
getShapeHandleAtPoint(java.awt.geom.Point2D aPoint)
Returns the shape handle for the given editor point.
|
static Tool |
getTool(java.util.List aList)
Returns the specific tool for a list of shapes (if they have the same tool).
|
static Tool |
getTool(java.lang.Object anObj)
Returns the specific tool for a given shape.
|
RJPanel |
getUI()
Returns the Swing UI panel for this tool.
|
java.lang.String |
getWindowTitle()
Returns the string to be used for the inspector window title.
|
boolean |
isInstance(java.lang.Object anObj)
Returns whether given object is editable by this tool.
|
boolean |
isSelected(RMShape aShape)
Utility method, returns whether a given shape is selected in the editor.
|
boolean |
isSuperSelected(RMShape aShape)
Utility method, returns whether a given shape is superselected in the editor.
|
void |
mouseDragged(java.awt.event.MouseEvent anEvent)
Event handling for shape creation.
|
void |
mouseDragged(RMShape aShape,
java.awt.event.MouseEvent anEvent)
Event handling from select tool for super selected shapes.
|
void |
mouseMoved(java.awt.event.MouseEvent anEvent)
Event handling - called on mouse move when this tool is active.
|
void |
mouseMoved(RMShape aShape,
java.awt.event.MouseEvent anEvent)
Event handling from select tool - called on mouse move when tool shape is super selected.
|
void |
mousePressed(java.awt.event.MouseEvent anEvent)
Event handling for shape creation.
|
void |
mousePressed(RMShape aShape,
java.awt.event.MouseEvent anEvent)
Event handling from select tool for super selected shapes.
|
boolean |
mousePressedSelection(java.awt.event.MouseEvent anEvent)
Event hook during selection.
|
void |
mouseReleased(java.awt.event.MouseEvent anEvent)
Event handling for shape creation.
|
void |
mouseReleased(RMShape aShape,
java.awt.event.MouseEvent anEvent)
Event handling from select tool for super selected shapes.
|
void |
moveShapeHandle(RMShape aShape,
int handle,
RMPoint toPoint)
Moves the handle at the given index to the given point.
|
RMShape |
newInstance()
Returns a new instance of the shape class that this tool is responsible for.
|
void |
paintSelectedShape(RMShape aShape,
java.awt.Graphics2D g)
Handles painting the indication that a shape is selected.
|
void |
paintSuperSelectedShape(RMShape aShape,
java.awt.Graphics2D g)
Handles painting the indication that a shape is super selected.
|
void |
paintTool(java.awt.Graphics2D g)
Paints when tool is active for things like SelectTool's handles & selection rect or polygon's in-progress path.
|
void |
processKeyEvent(RMShape aShape,
java.awt.event.KeyEvent anEvent)
Editor method.
|
void |
reactivateTool()
Called when a tool is selected even when it's already the current tool.
|
void |
resetUI()
Resets the UI associated with this tool.
|
void |
respondUI(java.lang.Object anObj)
Responder callback for the UI associated with this tool.
|
void |
willLoseSuperSelectionInEditor(RMShape aShape,
RMEditor anEditor)
Editor method - called when an instance of this tool's shape in de-super-selected.
|
clone, copy, didChange, didUndo, getAnimAttribute, getClassNameShort, initWithArchiver, undoClone, undoCopy, undoEquals
public static final byte HandleWidth
public static final byte HandleMinXMinY
public static final byte HandleMaxXMinY
public static final byte HandleMinXMaxY
public static final byte HandleMaxXMaxY
public static final byte HandleMinXMidY
public static final byte HandleMaxXMidY
public static final byte HandleMidXMinY
public static final byte HandleMidXMaxY
public static Tool getTool(java.lang.Object anObj)
public static Tool getTool(java.util.List aList)
public static SelectTool getSelectTool()
public static Tool getCoreTool(int anIndex)
public static int getCoreToolIndex(Tool aTool)
public java.lang.Class getShapeClass()
public RMShape newInstance()
public boolean isInstance(java.lang.Object anObj)
public java.lang.String getWindowTitle()
public RMEditor editor()
public RMShape getSelectedShape()
public java.util.List getSelectedShapes()
public RJPanel getUI()
public void resetUI()
public void respondUI(java.lang.Object anObj)
public void activateTool()
public void deactivateTool()
public void reactivateTool()
public void flushChanges(RMEditor anEditor, RMShape aShape)
public void mouseMoved(java.awt.event.MouseEvent anEvent)
public void mousePressed(java.awt.event.MouseEvent anEvent)
public void mouseDragged(java.awt.event.MouseEvent anEvent)
public void mouseReleased(java.awt.event.MouseEvent anEvent)
public void mouseMoved(RMShape aShape, java.awt.event.MouseEvent anEvent)
public void mousePressed(RMShape aShape, java.awt.event.MouseEvent anEvent)
public void mouseDragged(RMShape aShape, java.awt.event.MouseEvent anEvent)
public void mouseReleased(RMShape aShape, java.awt.event.MouseEvent anEvent)
public boolean mousePressedSelection(java.awt.event.MouseEvent anEvent)
public void processKeyEvent(RMShape aShape, java.awt.event.KeyEvent anEvent)
public void paintTool(java.awt.Graphics2D g)
public void paintSelectedShape(RMShape aShape, java.awt.Graphics2D g)
public void paintSuperSelectedShape(RMShape aShape, java.awt.Graphics2D g)
public int getHandleCount(RMShape aShape)
public RMPoint getHandlePoint(RMShape aShape, int handle, boolean isSuperSelected)
public RMRect getHandleRect(RMShape aShape, int handle, boolean isSuperSelected)
public int getHandleAtPoint(RMShape aShape, java.awt.geom.Point2D aPoint, boolean isSuperSelected)
public void didBecomeSuperSelectedShapeInEditor(RMShape aShape, RMEditor anEditor)
public void willLoseSuperSelectionInEditor(RMShape aShape, RMEditor anEditor)
public boolean isSelected(RMShape aShape)
public boolean isSuperSelected(RMShape aShape)
public void moveShapeHandle(RMShape aShape, int handle, RMPoint toPoint)
public Tool.RMShapeHandle getShapeHandleAtPoint(java.awt.geom.Point2D aPoint)
public javax.swing.ImageIcon getImageIcon()
public static javax.swing.ImageIcon getImageIcon(java.lang.Class aClass)