Package com.reportmill.panels
Class Tool
- java.lang.Object
-
- com.reportmill.base.RMObject
-
- com.reportmill.panels.Tool
-
- All Implemented Interfaces:
RMArchiver.Archiving
,java.lang.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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Tool.RMShapeHandle
An inner class describing a shape and a handle.
-
Field Summary
Fields Modifier and Type Field 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 Summary
Constructors Constructor Description Tool()
Creates a basic tool.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method 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.lang.Object anObj)
Returns the specific tool for a given shape.static Tool
getTool(java.util.List aList)
Returns the specific tool for a list of shapes (if they have the same tool).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(RMShape aShape, java.awt.event.MouseEvent anEvent)
Event handling from select tool for super selected shapes.void
mouseDragged(java.awt.event.MouseEvent anEvent)
Event handling for shape creation.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
mouseMoved(java.awt.event.MouseEvent anEvent)
Event handling - called on mouse move when this tool is active.void
mousePressed(RMShape aShape, java.awt.event.MouseEvent anEvent)
Event handling from select tool for super selected shapes.void
mousePressed(java.awt.event.MouseEvent anEvent)
Event handling for shape creation.boolean
mousePressedSelection(java.awt.event.MouseEvent anEvent)
Event hook during selection.void
mouseReleased(RMShape aShape, java.awt.event.MouseEvent anEvent)
Event handling from select tool for super selected shapes.void
mouseReleased(java.awt.event.MouseEvent anEvent)
Event handling for shape creation.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.-
Methods inherited from class com.reportmill.base.RMObject
clone, copy, didChange, didUndo, getAnimAttribute, getClassNameShort, initWithArchiver, undoClone, undoCopy, undoEquals
-
-
-
-
Field Detail
-
HandleWidth
public static final byte HandleWidth
- See Also:
- Constant Field Values
-
HandleMinXMinY
public static final byte HandleMinXMinY
- See Also:
- Constant Field Values
-
HandleMaxXMinY
public static final byte HandleMaxXMinY
- See Also:
- Constant Field Values
-
HandleMinXMaxY
public static final byte HandleMinXMaxY
- See Also:
- Constant Field Values
-
HandleMaxXMaxY
public static final byte HandleMaxXMaxY
- See Also:
- Constant Field Values
-
HandleMinXMidY
public static final byte HandleMinXMidY
- See Also:
- Constant Field Values
-
HandleMaxXMidY
public static final byte HandleMaxXMidY
- See Also:
- Constant Field Values
-
HandleMidXMinY
public static final byte HandleMidXMinY
- See Also:
- Constant Field Values
-
HandleMidXMaxY
public static final byte HandleMidXMaxY
- See Also:
- Constant Field Values
-
-
Method Detail
-
getTool
public static Tool getTool(java.lang.Object anObj)
Returns the specific tool for a given shape.
-
getTool
public static Tool getTool(java.util.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 java.lang.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(java.lang.Object anObj)
Returns whether given object is editable by this tool.
-
getWindowTitle
public java.lang.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 java.util.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(java.lang.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(java.awt.event.MouseEvent anEvent)
Event handling - called on mouse move when this tool is active.
-
mousePressed
public void mousePressed(java.awt.event.MouseEvent anEvent)
Event handling for shape creation.
-
mouseDragged
public void mouseDragged(java.awt.event.MouseEvent anEvent)
Event handling for shape creation.
-
mouseReleased
public void mouseReleased(java.awt.event.MouseEvent anEvent)
Event handling for shape creation.
-
mouseMoved
public void mouseMoved(RMShape aShape, java.awt.event.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, java.awt.event.MouseEvent anEvent)
Event handling from select tool for super selected shapes.
-
mouseDragged
public void mouseDragged(RMShape aShape, java.awt.event.MouseEvent anEvent)
Event handling from select tool for super selected shapes.
-
mouseReleased
public void mouseReleased(RMShape aShape, java.awt.event.MouseEvent anEvent)
Event handling from select tool for super selected shapes.
-
mousePressedSelection
public boolean mousePressedSelection(java.awt.event.MouseEvent anEvent)
Event hook during selection.
-
processKeyEvent
public void processKeyEvent(RMShape aShape, java.awt.event.KeyEvent anEvent)
Editor method.
-
paintTool
public 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.
-
paintSelectedShape
public void paintSelectedShape(RMShape aShape, java.awt.Graphics2D g)
Handles painting the indication that a shape is selected. Draws handles by default.
-
paintSuperSelectedShape
public void paintSuperSelectedShape(RMShape aShape, java.awt.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, java.awt.geom.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(java.awt.geom.Point2D aPoint)
Returns the shape handle for the given editor point.
-
getImageIcon
public javax.swing.ImageIcon getImageIcon()
Returns the image icon used to represent shapes that this tool represents.
-
getImageIcon
public static javax.swing.ImageIcon getImageIcon(java.lang.Class aClass)
Returns the image icon for the given shape class.
-
-