Package com.inductiveautomation.rm.tool
Class RMTextShapeTool<T extends RMTextShape>
- java.lang.Object
-
- com.inductiveautomation.snap.ui.UIOwner<SwingEvent,javax.swing.JComponent>
-
- com.inductiveautomation.snap.swing.SwingOwner
-
- com.inductiveautomation.rm.tool.RMTool<T>
-
- com.inductiveautomation.rm.tool.RMTextShapeTool<T>
-
- Direct Known Subclasses:
RMCrossTabCellTool
public class RMTextShapeTool<T extends RMTextShape> extends RMTool<T>
This class provides Swing UI editing for text shapes.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.inductiveautomation.rm.tool.RMTool
RMTool.RMShapeHandle
-
-
Field Summary
-
Fields inherited from class com.inductiveautomation.rm.tool.RMTool
HandleE, HandleN, HandleNE, HandleNW, HandleS, HandleSE, HandleSW, HandleW, HandleWidth, SPLIT_RESET
-
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 Constructor Description RMTextShapeTool()RMTextShapeTool(com.google.common.eventbus.EventBus ebus)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanacceptsDrag(T aShape, java.awt.dnd.DropTargetDragEvent anEvent)Overrides Tool implementation to accept KeysPanel drags.voidactivateTool()Overrides standard tool method to deselect any currently editing text.static voidconvertToText(RMShape aShape, java.lang.String aString)Converts a shape to a text shape.voiddidBecomeSuperSelectedShapeInEditor(RMShape aShape, RMEditor anEditor)Editor method - installs this text in RMEditor's text editor.voiddrop(T aShape, java.awt.dnd.DropTargetDropEvent anEvent)Override normal implementation to handle KeysPanel drop.intgetHandleCount(T aText)Editor method - returns handle count.RMRectgetHandleRect(T aTextShape, int handle, boolean isSuperSelected)Editor method - returns handle rect in editor coords.java.lang.ClassgetShapeClass()Returns the shape class that this tool edits.java.lang.StringgetToolTipText(T aTextShape, java.awt.event.MouseEvent anEvent)Overrides tool tooltip method to return text string if some chars aren't visible.java.lang.StringgetWindowTitle()Returns the name of this tool to be displayed by inspector.protected voidinitUI()Initialize UI panel.booleanisPaintingTextLinkIndicator(RMTextShape aText)Returns whether to paint text link indicator.voidmouseDragged(java.awt.event.MouseEvent anEvent)Handles mouse dragged for tool.voidmouseDragged(T aTextShape, java.awt.event.MouseEvent anEvent)Event handling for shape editing (just forwards to text editor).voidmouseMoved(java.awt.event.MouseEvent anEvent)Event handling - overridden to install text cursor.voidmousePressed(java.awt.event.MouseEvent anEvent)Handles mouse pressed for text tool.voidmousePressed(T aTextShape, java.awt.event.MouseEvent anEvent)Event handling for shape editing (just forwards to text editor).booleanmousePressedSelection(java.awt.event.MouseEvent anEvent)Event hook during selection.voidmouseReleased(java.awt.event.MouseEvent e)Event handling for text tool mouse loop.voidmouseReleased(T aTextShape, java.awt.event.MouseEvent anEvent)Event handling for shape editing (just forwards to text editor).voidmoveShapeHandle(T aShape, int aHandle, RMPoint toPoint)Moves the handle at the given index to the given point.voidpaintShapeHandles(T aTextShape, java.awt.Graphics2D g, boolean isSuperSelected)Paints selected shape indicator, like handles (and maybe a text linking indicator).voidpaintTextLinkIndicator(RMTextShape aText, java.awt.Graphics2D g)Paints the text link indicator.voidprocessKeyEvent(T aTextShape, java.awt.event.KeyEvent anEvent)Key event handling for super selected text.voidresetUI()Refreshes UI controls from currently selected text shape.voidrespondUI(SwingEvent anEvent)Handles changes from UI panel controls.voidwillLoseSuperSelectionInEditor(RMShape aShape, RMEditor anEditor)Editor method - uninstalls this text from RMEditor's text editor and removes new text if empty.-
Methods inherited from class com.inductiveautomation.rm.tool.RMTool
attachEventBus, createUI, deactivateTool, dragEnter, dragExit, dragOver, dropClass, dropColor, dropDragKey, dropFiles, dropString, flavorForClass, flushChanges, getAcceptsChildren, getBoundsSuperSelected, getDatasetEntity, getDragDisplayBounds, getEditor, getEditorPane, getFont, getFontDeep, getGalleryClone, getHandleAtPoint, getHandleCursor, getHandleOpposing, getHandlePoint, getIcon, getIcon, getPointsFromUnits, getSelectedShape, getSelectedShapes, getSelectTool, getShapeFillInspector, getShapeHandleAtPoint, getTool, getTool, getUnitsFromPoints, isSelected, isSuperSelectable, isSuperSelected, isUngroupable, mouseMoved, newInstance, paintTool, reactivateTool, setFont, setFontBold, setFontBoldDeep, setFontFamily, setFontFamilyDeep, setFontItalic, setFontItalicDeep, setFontName, setFontNameDeep, setFontSize, setFontSizeDeep
-
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, isNodeEnabled, isNodeValueAdjusting, isSendEventDisabled, isUISet, processResetUI, processRespondUI, resetLater, resetNodeBindings, runLaterDelayed, runLaterOnce, sendEvent, sendNodeAction, setBindingModelValue, setBindingNodeValue, setFirstFocus, setModelValue, setNodeAction, setNodeEnabled, setNodeItemDisplayKey, setNodeItems, setNodeItems, setNodeSelectedIndex, setNodeSelectedItem, setNodeText, setNodeValue, setSendEventDisabled
-
-
-
-
Method Detail
-
initUI
protected void initUI()
Initialize UI panel.- Overrides:
initUIin classUIOwner<SwingEvent,javax.swing.JComponent>
-
resetUI
public void resetUI()
Refreshes UI controls from currently selected text shape.- Overrides:
resetUIin classUIOwner<SwingEvent,javax.swing.JComponent>
-
respondUI
public void respondUI(SwingEvent anEvent)
Handles changes from UI panel controls.- Overrides:
respondUIin classUIOwner<SwingEvent,javax.swing.JComponent>
-
activateTool
public void activateTool()
Overrides standard tool method to deselect any currently editing text.- Overrides:
activateToolin classRMTool<T extends RMTextShape>
-
mouseMoved
public void mouseMoved(java.awt.event.MouseEvent anEvent)
Event handling - overridden to install text cursor.- Overrides:
mouseMovedin classRMTool<T extends RMTextShape>
-
mousePressed
public void mousePressed(java.awt.event.MouseEvent anEvent)
Handles mouse pressed for text tool. Special support to super select any text hit by tool mouse pressed.- Overrides:
mousePressedin classRMTool<T extends RMTextShape>
-
mouseDragged
public void mouseDragged(java.awt.event.MouseEvent anEvent)
Handles mouse dragged for tool. If user doesn't really drag, then default text box should align the base line of the text about the pressed point. If they do really drag, then text box should be the rect they drag out.- Overrides:
mouseDraggedin classRMTool<T extends RMTextShape>
-
mouseReleased
public void mouseReleased(java.awt.event.MouseEvent e)
Event handling for text tool mouse loop.- Overrides:
mouseReleasedin classRMTool<T extends RMTextShape>
-
mousePressed
public void mousePressed(T aTextShape, java.awt.event.MouseEvent anEvent)
Event handling for shape editing (just forwards to text editor).- Overrides:
mousePressedin classRMTool<T extends RMTextShape>
-
mouseDragged
public void mouseDragged(T aTextShape, java.awt.event.MouseEvent anEvent)
Event handling for shape editing (just forwards to text editor).- Overrides:
mouseDraggedin classRMTool<T extends RMTextShape>
-
mouseReleased
public void mouseReleased(T aTextShape, java.awt.event.MouseEvent anEvent)
Event handling for shape editing (just forwards to text editor).- Overrides:
mouseReleasedin classRMTool<T extends RMTextShape>
-
processKeyEvent
public void processKeyEvent(T aTextShape, java.awt.event.KeyEvent anEvent)
Key event handling for super selected text.- Overrides:
processKeyEventin classRMTool<T extends RMTextShape>
-
didBecomeSuperSelectedShapeInEditor
public void didBecomeSuperSelectedShapeInEditor(RMShape aShape, RMEditor anEditor)
Editor method - installs this text in RMEditor's text editor.- Overrides:
didBecomeSuperSelectedShapeInEditorin classRMTool<T extends RMTextShape>
-
mousePressedSelection
public boolean mousePressedSelection(java.awt.event.MouseEvent anEvent)
Event hook during selection.- Overrides:
mousePressedSelectionin classRMTool<T extends RMTextShape>
-
moveShapeHandle
public void moveShapeHandle(T aShape, int aHandle, RMPoint toPoint)
Moves the handle at the given index to the given point.- Overrides:
moveShapeHandlein classRMTool<T extends RMTextShape>
-
getToolTipText
public java.lang.String getToolTipText(T aTextShape, java.awt.event.MouseEvent anEvent)
Overrides tool tooltip method to return text string if some chars aren't visible.- Overrides:
getToolTipTextin classRMTool<T extends RMTextShape>
-
paintShapeHandles
public void paintShapeHandles(T aTextShape, java.awt.Graphics2D g, boolean isSuperSelected)
Paints selected shape indicator, like handles (and maybe a text linking indicator).- Overrides:
paintShapeHandlesin classRMTool<T extends RMTextShape>
-
isPaintingTextLinkIndicator
public boolean isPaintingTextLinkIndicator(RMTextShape aText)
Returns whether to paint text link indicator.
-
paintTextLinkIndicator
public void paintTextLinkIndicator(RMTextShape aText, java.awt.Graphics2D g)
Paints the text link indicator.
-
getHandleCount
public int getHandleCount(T aText)
Editor method - returns handle count.- Overrides:
getHandleCountin classRMTool<T extends RMTextShape>
-
getHandleRect
public RMRect getHandleRect(T aTextShape, int handle, boolean isSuperSelected)
Editor method - returns handle rect in editor coords.- Overrides:
getHandleRectin classRMTool<T extends RMTextShape>
-
willLoseSuperSelectionInEditor
public void willLoseSuperSelectionInEditor(RMShape aShape, RMEditor anEditor)
Editor method - uninstalls this text from RMEditor's text editor and removes new text if empty.- Overrides:
willLoseSuperSelectionInEditorin classRMTool<T extends RMTextShape>
-
acceptsDrag
public boolean acceptsDrag(T aShape, java.awt.dnd.DropTargetDragEvent anEvent)
Overrides Tool implementation to accept KeysPanel drags.- Overrides:
acceptsDragin classRMTool<T extends RMTextShape>
-
drop
public void drop(T aShape, java.awt.dnd.DropTargetDropEvent anEvent)
Override normal implementation to handle KeysPanel drop.- Overrides:
dropin classRMTool<T extends RMTextShape>
-
getShapeClass
public java.lang.Class getShapeClass()
Returns the shape class that this tool edits.- Overrides:
getShapeClassin classRMTool<T extends RMTextShape>
-
getWindowTitle
public java.lang.String getWindowTitle()
Returns the name of this tool to be displayed by inspector.- Overrides:
getWindowTitlein classRMTool<T extends RMTextShape>
-
convertToText
public static void convertToText(RMShape aShape, java.lang.String aString)
Converts a shape to a text shape.
-
-