Package com.inductiveautomation.rm.tool
Class RMTool<T extends RMShape>
java.lang.Object
com.inductiveautomation.snap.ui.UIOwner<SwingEvent,JComponent>
com.inductiveautomation.snap.swing.SwingOwner
com.inductiveautomation.rm.tool.RMTool<T>
- Direct Known Subclasses:
AbstractIgnitionRMTool
,BarcodeTool
,RMCrossTabDividerTool
,RMCrossTabFrameTool
,RMCrossTabTool
,RMDocumentTool
,RMGraphPartBarsTool
,RMGraphPartLabelAxisTool
,RMGraphPartPieTool
,RMGraphPartSeriesTool
,RMGraphPartValueAxisTool
,RMGraphTool
,RMImageTool
,RMLabelsTool
,RMLabelTool
,RMLineShapeTool
,RMMorphShapeTool
,RMNestedDocTool
,RMOvalShapeTool
,RMParentShapeTool
,RMPolygonShapeTool
,RMRectShapeTool
,RMScene3DTool
,RMSelectTool
,RMSoundShapeTool
,RMStarShapeTool
,RMSubreportTool
,RMTextShapeTool
,ShapeGeneral
This is the base class for tools in RM - the objects that provide GUI editing for RM shapes.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
An inner class describing a shape and a handle. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final String
Fields inherited from class com.inductiveautomation.snap.ui.UIOwner
DragDrop, DragEnter, DragEvents, DragExit, DragOver, KeyEvents, KeyFinished, KeyPressed, KeyReleased, KeyTyped, MouseClicked, MouseDragged, MouseEntered, MouseEvents, MouseExited, MouseFinished, MouseMoved, MousePressed, MouseReleased
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
acceptsDrag
(T aShape, DropTargetDragEvent anEvent) Implemented by shapes that can handle drag & drop.void
Called when a tool is selected.void
attachEventBus
(com.google.common.eventbus.EventBus bus) protected JComponent
createUI()
Create UI.void
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.void
dragEnter
(RMShape aShape, DropTargetDragEvent anEvent) Notifies tool that a something was dragged into of one of its shapes with drag and drop.void
dragExit
(RMShape aShape, DropTargetDragEvent anEvent) Notifies tool that a something was dragged out of one of its shapes with drag and drop.void
dragOver
(RMShape aShape, DropTargetDragEvent anEvent) Notifies tool that something was dragged over one of its shapes with drag and drop.void
drop
(T aShape, DropTargetDropEvent anEvent) Notifies tool that something was dropped on one of its shapes with drag and drop.void
dropClass
(T aShape, DropTargetDropEvent anEvent) void
dropColor
(RMShape aShape, DropTargetDropEvent anEvent) Called to handle dropping a color.void
dropDragKey
(T aShape, DropTargetDropEvent anEvent) void
dropFiles
(RMShape aShape, DropTargetDropEvent anEvent) Called to handle dropping a file.void
dropString
(T aShape, DropTargetDropEvent anEvent) Called to handle dropping a string.static DataFlavor
flavorForClass
(Class clazz) void
flushChanges
(RMEditor anEditor, RMShape aShape) Called when a tool is deselected to give an opportunity to finalize changes in progress.boolean
getAcceptsChildren
(RMShape aShape) Returns whether a given shape accepts children.getBoundsSuperSelected
(RMShape aShape) Returns the bounds of the shape in parent coords when super selected (same as getBoundsMarkedDeep by default).getDatasetEntity
(RMShape aShape) Returns the given shape's dataset entity.getDragDisplayBounds
(RMShape aShape, DropTargetDragEvent anEvent) Returns the bounds to be highlighted for a drag over a given shape.Returns the currently active editor.Returns the currently active editor pane.Returns the font for the given shape.getFontDeep
(RMEditor anEditor, RMShape aShape) Returns the font for the given shape.getGalleryClone
(T aShape) Returns a clone of a gallery shape (hook to allow extra configuration for subclasses).int
getHandleAtPoint
(T aShape, Point2D aPoint, boolean isSuperSelected) Returns the handle hit by the given editor coord point.int
getHandleCount
(T aShape) Returns the number of handles for this shape.getHandleCursor
(T aShape, int aHandle) Returns the cursor for given handle.int
getHandleOpposing
(int handle) Returns the handle index that is across from given handle index.getHandlePoint
(T aShape, int aHandle, boolean isSuperSelected) Returns the point for the handle of the given shape at the given handle index in the given shape's coords.getHandleRect
(T aShape, int aHandle, boolean isSuperSelected) Returns the rect for the handle at the given index in editor coords.getIcon()
Returns the icon used to represent shapes that this tool represents.static Icon
Returns the icon for the given shape class.double
getPointsFromUnits
(double aValue) Converts from tool units to shape units.Returns the current selected shape for the current editor.Returns the current selected shapes for the current editor.static RMSelectTool
Returns the SelectTool.Returns the shape class that this tool handles.Returns the fill inspector for this tool's shape class.getShapeHandleAtPoint
(Point2D aPoint) Returns the shape handle for the given editor point.static RMTool
Returns the specific tool for a given shape.static RMTool
Returns the specific tool for a list of shapes (if they have the same tool).getToolTipText
(T aShape, MouseEvent anEvent) Returns a tool tip string for given shape and event.double
getUnitsFromPoints
(double aValue) Converts from shape units to tool units.Returns the string to be used for the inspector window title.boolean
isSelected
(RMShape aShape) Returns whether a given shape is selected in the editor.boolean
isSuperSelectable
(RMShape aShape) Returns whether a given shape is super-selectable.boolean
isSuperSelected
(RMShape aShape) Returns whether a given shape is superselected in the editor.boolean
isUngroupable
(RMShape aShape) Returns whether a given shape can be ungrouped.void
mouseDragged
(MouseEvent anEvent) Event handling for shape creation.void
mouseDragged
(T aShape, MouseEvent anEvent) Event handling from select tool for super selected shapes.void
mouseMoved
(MouseEvent anEvent) Event handling - called on mouse move when this tool is active.void
mouseMoved
(T aShape, MouseEvent anEvent) Event handling from select tool - called on mouse move when tool shape is super selected.void
mousePressed
(MouseEvent anEvent) Event handling for shape creation.void
mousePressed
(T aShape, MouseEvent anEvent) Event handling from select tool for super selected shapes.boolean
mousePressedSelection
(MouseEvent anEvent) Event hook during selection.void
mouseReleased
(MouseEvent anEvent) Event handling for shape creation.void
mouseReleased
(T aShape, MouseEvent anEvent) Event handling from select tool for super selected shapes.void
moveShapeHandle
(T aShape, int aHandle, RMPoint toPoint) Moves the handle at the given index to the given point.protected T
Returns a new instance of the shape class that this tool is responsible for.void
paintShapeHandles
(T aShape, Graphics2D g, boolean isSuperSelected) Handles painting shape handles (or any indication that a shape is selected/super-selected).void
Paints when tool is active for things like SelectTool's handles & selection rect or polygon's in-progress path.void
processKeyEvent
(T aShape, KeyEvent anEvent) Editor method.void
Called when a tool is selected even when it's already the current tool.void
Sets the font for the given shape.void
setFontBold
(RMEditor anEditor, RMShape aShape, boolean aFlag) Sets the font to bold or not bold for given shape.void
setFontBoldDeep
(RMEditor anEditor, RMShape aShape, boolean aFlag) Sets the font to bold or not bold for given shape and its children.void
setFontFamily
(RMEditor anEditor, RMShape aShape, RMFont aFont) Sets the font family for given shape.void
setFontFamilyDeep
(RMEditor anEditor, RMShape aShape, RMFont aFont) Sets the font family for given shape.void
setFontItalic
(RMEditor anEditor, RMShape aShape, boolean aFlag) Sets the font to italic or not italic for given shape.void
setFontItalicDeep
(RMEditor anEditor, RMShape aShape, boolean aFlag) Sets the font to italic or not italic for given shape and its children.void
setFontName
(RMEditor anEditor, RMShape aShape, RMFont aFont) Sets the font name for given shape.void
setFontNameDeep
(RMEditor anEditor, RMShape aShape, RMFont aFont) Sets the font name for given shape.void
setFontSize
(RMEditor anEditor, RMShape aShape, double aSize, boolean isRelative) Sets the font size for given shape.void
setFontSizeDeep
(RMEditor anEditor, RMShape aShape, double aSize, boolean isRelative) Sets the font size for given shape.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.inductiveautomation.snap.swing.SwingOwner
addKeyActionEvent, createTimer, createUI, createWindow, getNode, getNode, getNodeHelper, getTimer, getTimer, getUI, getWindow, isEventThread, isWindowVisible, requestFocus, requestFocusImpl, runLater, sendEvent, setWindowVisible
Methods inherited from class com.inductiveautomation.snap.ui.UIOwner
addNodeBinding, disableEvents, enableEvents, getBindingModelValue, getBindingNodeValue, getConversionMap, getConversionMapKey, getConversionMaps, getConversionMapValue, getFirstFocus, getModelValue, getNode, getNodeAction, getNodeBoolValue, getNodeFloatValue, getNodeIntValue, getNodeItemDisplayKey, getNodeItems, getNodeSelectedIndex, getNodeSelectedItem, getNodeStringValue, getNodeText, getNodeValue, getUI, getUIHpr, initUI, initUI, isNodeEnabled, isNodeValueAdjusting, isSendEventDisabled, isUISet, processResetUI, processRespondUI, resetLater, resetNodeBindings, resetUI, respondUI, runLaterDelayed, runLaterOnce, sendEvent, sendNodeAction, setBindingModelValue, setBindingNodeValue, setFirstFocus, setModelValue, setNodeAction, setNodeEnabled, setNodeItemDisplayKey, setNodeItems, setNodeItems, setNodeSelectedIndex, setNodeSelectedItem, setNodeText, setNodeValue, setSendEventDisabled
-
Field Details
-
SPLIT_RESET
- See Also:
-
HandleWidth
public static final byte HandleWidth- See Also:
-
HandleNW
public static final byte HandleNW- See Also:
-
HandleNE
public static final byte HandleNE- See Also:
-
HandleSW
public static final byte HandleSW- See Also:
-
HandleSE
public static final byte HandleSE- See Also:
-
HandleW
public static final byte HandleW- See Also:
-
HandleE
public static final byte HandleE- See Also:
-
HandleN
public static final byte HandleN- See Also:
-
HandleS
public static final byte HandleS- See Also:
-
-
Constructor Details
-
RMTool
public RMTool() -
RMTool
public RMTool(com.google.common.eventbus.EventBus ebus)
-
-
Method Details
-
getShapeClass
Returns the shape class that this tool handles. -
attachEventBus
public void attachEventBus(com.google.common.eventbus.EventBus bus) -
newInstance
Returns a new instance of the shape class that this tool is responsible for. -
getWindowTitle
Returns the string to be used for the inspector window title. -
createUI
Create UI.- Overrides:
createUI
in classSwingOwner
-
getDatasetEntity
Returns the given shape's dataset entity. Provides a level of indirection show shapes can show a different entity in the designer. -
getEditor
Returns the currently active editor. -
getEditorPane
Returns the currently active editor pane. -
getSelectedShape
Returns the current selected shape for the current editor. -
getSelectedShapes
Returns the current selected shapes for the current editor. -
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
Called when a tool is deselected to give an opportunity to finalize changes in progress. -
isSelected
Returns whether a given shape is selected in the editor. -
isSuperSelected
Returns whether a given shape is superselected in the editor. -
isSuperSelectable
Returns whether a given shape is super-selectable. -
getAcceptsChildren
Returns whether a given shape accepts children. -
isUngroupable
Returns whether a given shape can be ungrouped. -
didBecomeSuperSelectedShapeInEditor
Editor method - called when an instance of this tool's shape is super selected. -
willLoseSuperSelectionInEditor
Editor method - called when an instance of this tool's shape in de-super-selected. -
getBoundsSuperSelected
Returns the bounds of the shape in parent coords when super selected (same as getBoundsMarkedDeep by default). -
getUnitsFromPoints
public double getUnitsFromPoints(double aValue) Converts from shape units to tool units. -
getPointsFromUnits
public double getPointsFromUnits(double aValue) Converts from tool units to shape units. -
getFont
Returns the font for the given shape. If the shape is a table, table row, or CrossTab it returns the font of the first text in the first row or the first text in the row. If the first item has no string it searches through all the children in order to find text and returns that font. -
setFont
Sets the font for the given shape. -
getFontDeep
Returns the font for the given shape. -
setFontFamily
Sets the font family for given shape. -
setFontFamilyDeep
Sets the font family for given shape. -
setFontName
Sets the font name for given shape. -
setFontNameDeep
Sets the font name for given shape. -
setFontSize
Sets the font size for given shape. -
setFontSizeDeep
Sets the font size for given shape. -
setFontBold
Sets the font to bold or not bold for given shape. -
setFontBoldDeep
Sets the font to bold or not bold for given shape and its children. -
setFontItalic
Sets the font to italic or not italic for given shape. -
setFontItalicDeep
Sets the font to italic or not italic for given shape and its children. -
mouseMoved
Event handling - called on mouse move when this tool is active. -
mousePressed
Event handling for shape creation. -
mouseDragged
Event handling for shape creation. -
mouseReleased
Event handling for shape creation. -
mouseMoved
Event handling from select tool - called on mouse move when tool shape is super selected. MouseMoved is useful for setting a custom cursor. -
mousePressed
Event handling from select tool for super selected shapes. -
mouseDragged
Event handling from select tool for super selected shapes. -
mouseReleased
Event handling from select tool for super selected shapes. -
mousePressedSelection
Event hook during selection. -
getToolTipText
Returns a tool tip string for given shape and event. -
processKeyEvent
Editor method. -
paintTool
Paints when tool is active for things like SelectTool's handles & selection rect or polygon's in-progress path. -
paintShapeHandles
Handles painting shape handles (or any indication that a shape is selected/super-selected). -
getHandleCount
Returns the number of handles for this shape. -
getHandlePoint
Returns the point for the handle of the given shape at the given handle index in the given shape's coords. -
getHandleRect
Returns the rect for the handle at the given index in editor coords. -
getHandleAtPoint
Returns the handle hit by the given editor coord point. -
getHandleCursor
Returns the cursor for given handle. -
moveShapeHandle
Moves the handle at the given index to the given point. -
getHandleOpposing
public int getHandleOpposing(int handle) Returns the handle index that is across from given handle index. -
getShapeFillInspector
Returns the fill inspector for this tool's shape class. -
getShapeHandleAtPoint
Returns the shape handle for the given editor point. -
acceptsDrag
Implemented by shapes that can handle drag & drop. -
dragEnter
Notifies tool that a something was dragged into of one of its shapes with drag and drop. -
dragExit
Notifies tool that a something was dragged out of one of its shapes with drag and drop. -
dragOver
Notifies tool that something was dragged over one of its shapes with drag and drop. -
drop
Notifies tool that something was dropped on one of its shapes with drag and drop. -
dropDragKey
-
dropClass
-
flavorForClass
-
getDragDisplayBounds
Returns the bounds to be highlighted for a drag over a given shape. -
dropString
Called to handle dropping a string. -
dropColor
Called to handle dropping a color. -
dropFiles
Called to handle dropping a file. -
getGalleryClone
Returns a clone of a gallery shape (hook to allow extra configuration for subclasses). -
getIcon
Returns the icon used to represent shapes that this tool represents. -
getIcon
Returns the icon for the given shape class. -
getSelectTool
Returns the SelectTool. -
getTool
Returns the specific tool for a list of shapes (if they have the same tool). -
getTool
Returns the specific tool for a given shape.
-