Package edu.cnu.mdi.graphics.toolbar
Class DefaultToolHandler
java.lang.Object
edu.cnu.mdi.graphics.toolbar.DefaultToolHandler
- All Implemented Interfaces:
IToolHandler
- Direct Known Subclasses:
PlotToolHandler
Default tool handler that performs no actions except for panning,
printing, and capturing images. It is intended as a base class for
custom tool handlers. It can be used like an Adapter.
- Author:
- heddle
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanApprove or reject a connection point.voidBegin dragging an object/selection.voidboxZoomRubberbanding(GestureContext gc, Rectangle bounds) Box-zoom rubberband completion (or continuous feedback depending on tool).voidvoidcreateConnection(GestureContext gc, Point start, Point end) Create a connection between two points.voidcreateEllipse(GestureContext gc, Rectangle bounds) Create an ellipse.voidcreateLine(GestureContext gc, Point start, Point end) Create a line between two points.voidcreatePolygon(GestureContext gc, Point[] vertices) Create a polygon.voidcreatePolyline(GestureContext gc, Point[] vertices) Create a polyline.voidcreateRadArc(GestureContext gc, Point[] vertices) Create a radial arc.voidcreateRectangle(GestureContext gc, Rectangle bounds) Create a rectangle.voidcreateTextItem(GestureContext gc, Point location) Create a text item at the given location.voiddelete(GestureContext gc) booleanOptional veto before starting a drag.voiddragObjectBy(GestureContext gc, int dx, int dy) Drag the object/selection by a pixel delta.voidEnd dragging an object/selection.hitTest(GestureContext gc, Point p) Hit test at a point on the canvas.voidinfo(GestureContext gc) voidvoidvoidvoidvoidvoidvoidPointer click (single click).voidPointer double-click.voidpointerRubberbanding(GestureContext gc, Rectangle bounds) Pointer rubberband feedback (typically multi-select or region selection).voidprint(GestureContext gc) voidvoidvoidvoidvoidzoomIn(GestureContext gc) void
-
Constructor Details
-
DefaultToolHandler
public DefaultToolHandler()
-
-
Method Details
-
createRectangle
Description copied from interface:IToolHandlerCreate a rectangle.- Specified by:
createRectanglein interfaceIToolHandler- Parameters:
gc- gesture context (non-null)bounds- rectangle bounds (non-null)
-
createEllipse
Description copied from interface:IToolHandlerCreate an ellipse.- Specified by:
createEllipsein interfaceIToolHandler- Parameters:
gc- gesture context (non-null)bounds- ellipse bounds (non-null)
-
createRadArc
Description copied from interface:IToolHandlerCreate a radial arc.The expected interpretation of vertices is tool-defined; for a typical radial arc gesture:
- vertices[0] = center
- vertices[1] = radius leg endpoint
- vertices[2] = angle-defining point
- Specified by:
createRadArcin interfaceIToolHandler- Parameters:
gc- gesture context (non-null)vertices- gesture vertices (non-null)
-
createTextItem
Description copied from interface:IToolHandlerCreate a text item at the given location.- Specified by:
createTextItemin interfaceIToolHandler- Parameters:
gc- gesture context (non-null)location- text location (non-null)
-
hitTest
Description copied from interface:IToolHandlerHit test at a point on the canvas.- Specified by:
hitTestin interfaceIToolHandler- Parameters:
gc- gesture context providing toolbar/canvas (non-null)p- point to test in canvas coordinates (non-null)- Returns:
- hit object or null
-
pointerRubberbanding
Description copied from interface:IToolHandlerPointer rubberband feedback (typically multi-select or region selection).- Specified by:
pointerRubberbandingin interfaceIToolHandler- Parameters:
gc- gesture context (non-null)bounds- rubberband bounds (non-null)
-
pointerClick
Description copied from interface:IToolHandlerPointer click (single click).- Specified by:
pointerClickin interfaceIToolHandler- Parameters:
gc- gesture context (non-null).gc.getTarget()may be null.
-
pointerDoubleClick
Description copied from interface:IToolHandlerPointer double-click.- Specified by:
pointerDoubleClickin interfaceIToolHandler- Parameters:
gc- gesture context (non-null).gc.getTarget()may be null.
-
beginDragObject
Description copied from interface:IToolHandlerBegin dragging an object/selection.- Specified by:
beginDragObjectin interfaceIToolHandler- Parameters:
gc- gesture context (non-null).gc.getTarget()is the drag target.
-
dragObjectBy
Description copied from interface:IToolHandlerDrag the object/selection by a pixel delta.- Specified by:
dragObjectByin interfaceIToolHandler- Parameters:
gc- gesture context (non-null)dx- delta x since last updatedy- delta y since last update
-
endDragObject
Description copied from interface:IToolHandlerEnd dragging an object/selection.- Specified by:
endDragObjectin interfaceIToolHandler- Parameters:
gc- gesture context (non-null)
-
doNotDrag
Description copied from interface:IToolHandlerOptional veto before starting a drag.- Specified by:
doNotDragin interfaceIToolHandler- Parameters:
gc- gesture context (non-null)- Returns:
- true to veto drag start, false to allow
-
panStartDrag
- Specified by:
panStartDragin interfaceIToolHandler- Parameters:
gc- gesture context (non-null)
-
panUpdateDrag
- Specified by:
panUpdateDragin interfaceIToolHandler- Parameters:
gc- gesture context (non-null)
-
panDoneDrag
- Specified by:
panDoneDragin interfaceIToolHandler- Parameters:
gc- gesture context (non-null)
-
magnifyStartMove
- Specified by:
magnifyStartMovein interfaceIToolHandler- Parameters:
gc- gesture context (non-null)
-
magnifyUpdateMove
- Specified by:
magnifyUpdateMovein interfaceIToolHandler- Parameters:
gc- gesture context (non-null)
-
magnifyDoneMove
- Specified by:
magnifyDoneMovein interfaceIToolHandler- Parameters:
gc- gesture context (non-null)
-
recenter
- Specified by:
recenterin interfaceIToolHandler- Parameters:
gc- gesture context (non-null)
-
zoomIn
- Specified by:
zoomInin interfaceIToolHandler- Parameters:
gc- context (non-null)
-
zoomOut
- Specified by:
zoomOutin interfaceIToolHandler- Parameters:
gc- context (non-null)
-
undoZoom
- Specified by:
undoZoomin interfaceIToolHandler- Parameters:
gc- context (non-null)
-
resetZoom
- Specified by:
resetZoomin interfaceIToolHandler- Parameters:
gc- context (non-null)
-
styleEdit
- Specified by:
styleEditin interfaceIToolHandler- Parameters:
gc- context (non-null)
-
delete
- Specified by:
deletein interfaceIToolHandler- Parameters:
gc- context (non-null)
-
captureImage
- Specified by:
captureImagein interfaceIToolHandler- Parameters:
gc- context (non-null)
-
print
- Specified by:
printin interfaceIToolHandler- Parameters:
gc- context (non-null)
-
createConnection
Description copied from interface:IToolHandlerCreate a connection between two points.- Specified by:
createConnectionin interfaceIToolHandler- Parameters:
gc- gesture context (non-null)start- start point (non-null)end- end point (non-null)
-
approveConnectionPoint
Description copied from interface:IToolHandlerApprove or reject a connection point.- Specified by:
approveConnectionPointin interfaceIToolHandler- Parameters:
gc- gesture context (non-null)p- point to approve/reject (non-null)- Returns:
- true to approve
-
boxZoomRubberbanding
Description copied from interface:IToolHandlerBox-zoom rubberband completion (or continuous feedback depending on tool).- Specified by:
boxZoomRubberbandingin interfaceIToolHandler- Parameters:
gc- gesture context (non-null)bounds- rubberband bounds (non-null)
-
createPolygon
Description copied from interface:IToolHandlerCreate a polygon.- Specified by:
createPolygonin interfaceIToolHandler- Parameters:
gc- gesture context (non-null)vertices- polygon vertices (non-null)
-
createPolyline
Description copied from interface:IToolHandlerCreate a polyline.- Specified by:
createPolylinein interfaceIToolHandler- Parameters:
gc- gesture context (non-null)vertices- polyline vertices (non-null)
-
createLine
Description copied from interface:IToolHandlerCreate a line between two points.- Specified by:
createLinein interfaceIToolHandler- Parameters:
gc- gesture context (non-null)start- start pointend- end point
-
info
- Specified by:
infoin interfaceIToolHandler- Parameters:
gc- context (non-null)
-