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 classTool.RMShapeHandleAn inner class describing a shape and a handle.
-
Field Summary
Fields Modifier and Type Field Description static byteHandleMaxXMaxYstatic byteHandleMaxXMidYstatic byteHandleMaxXMinYstatic byteHandleMidXMaxYstatic byteHandleMidXMinYstatic byteHandleMinXMaxYstatic byteHandleMinXMidYstatic byteHandleMinXMinYstatic byteHandleWidth
-
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 voidactivateTool()Called when a tool is selected.voiddeactivateTool()Called when a tool is deselected (when another tool is selected).voiddidBecomeSuperSelectedShapeInEditor(RMShape aShape, RMEditor anEditor)Editor method - called when an instance of this tool's shape is super selected.RMEditoreditor()Returns the current editor.voidflushChanges(RMEditor anEditor, RMShape aShape)Called when a tool is deselected to give an opportunity to finalize changes in progress.static ToolgetCoreTool(int anIndex)Returns the specific core tool at the given index.static intgetCoreToolIndex(Tool aTool)Returns the core tool index for the given tool.intgetHandleAtPoint(RMShape aShape, java.awt.geom.Point2D aPoint, boolean isSuperSelected)Returns the handle hit by the given editor coord point.intgetHandleCount(RMShape aShape)Returns the number of handles for this shape.RMPointgetHandlePoint(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.RMRectgetHandleRect(RMShape aShape, int handle, boolean isSuperSelected)Returns the rect for the handle at the given index in editor coords.javax.swing.ImageIcongetImageIcon()Returns the image icon used to represent shapes that this tool represents.static javax.swing.ImageIcongetImageIcon(java.lang.Class aClass)Returns the image icon for the given shape class.RMShapegetSelectedShape()Returns the current selected shape for the current editor.java.util.ListgetSelectedShapes()Returns the current selected shapes for the current editor.static SelectToolgetSelectTool()Returns the SelectTool.java.lang.ClassgetShapeClass()Returns the shape class that this tool handles.Tool.RMShapeHandlegetShapeHandleAtPoint(java.awt.geom.Point2D aPoint)Returns the shape handle for the given editor point.static ToolgetTool(java.lang.Object anObj)Returns the specific tool for a given shape.static ToolgetTool(java.util.List aList)Returns the specific tool for a list of shapes (if they have the same tool).RJPanelgetUI()Returns the Swing UI panel for this tool.java.lang.StringgetWindowTitle()Returns the string to be used for the inspector window title.booleanisInstance(java.lang.Object anObj)Returns whether given object is editable by this tool.booleanisSelected(RMShape aShape)Utility method, returns whether a given shape is selected in the editor.booleanisSuperSelected(RMShape aShape)Utility method, returns whether a given shape is superselected in the editor.voidmouseDragged(RMShape aShape, java.awt.event.MouseEvent anEvent)Event handling from select tool for super selected shapes.voidmouseDragged(java.awt.event.MouseEvent anEvent)Event handling for shape creation.voidmouseMoved(RMShape aShape, java.awt.event.MouseEvent anEvent)Event handling from select tool - called on mouse move when tool shape is super selected.voidmouseMoved(java.awt.event.MouseEvent anEvent)Event handling - called on mouse move when this tool is active.voidmousePressed(RMShape aShape, java.awt.event.MouseEvent anEvent)Event handling from select tool for super selected shapes.voidmousePressed(java.awt.event.MouseEvent anEvent)Event handling for shape creation.booleanmousePressedSelection(java.awt.event.MouseEvent anEvent)Event hook during selection.voidmouseReleased(RMShape aShape, java.awt.event.MouseEvent anEvent)Event handling from select tool for super selected shapes.voidmouseReleased(java.awt.event.MouseEvent anEvent)Event handling for shape creation.voidmoveShapeHandle(RMShape aShape, int handle, RMPoint toPoint)Moves the handle at the given index to the given point.RMShapenewInstance()Returns a new instance of the shape class that this tool is responsible for.voidpaintSelectedShape(RMShape aShape, java.awt.Graphics2D g)Handles painting the indication that a shape is selected.voidpaintSuperSelectedShape(RMShape aShape, java.awt.Graphics2D g)Handles painting the indication that a shape is super selected.voidpaintTool(java.awt.Graphics2D g)Paints when tool is active for things like SelectTool's handles & selection rect or polygon's in-progress path.voidprocessKeyEvent(RMShape aShape, java.awt.event.KeyEvent anEvent)Editor method.voidreactivateTool()Called when a tool is selected even when it's already the current tool.voidresetUI()Resets the UI associated with this tool.voidrespondUI(java.lang.Object anObj)Responder callback for the UI associated with this tool.voidwillLoseSuperSelectionInEditor(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.
-
-