org.jhotdraw.draw.handle
Class AbstractHandle
- java.lang.Object
-
- org.jhotdraw.draw.handle.AbstractHandle
-
- All Implemented Interfaces:
- java.awt.event.KeyListener, java.util.EventListener, FigureListener, Handle
- Direct Known Subclasses:
- AbstractConnectionHandle, AbstractRotateHandle, BezierControlPointHandle, BezierNodeHandle, BezierOutlineHandle, BezierScaleHandle, BoundsOutlineHandle, ConnectorHandle, ConvexHullOutlineHandle, DragHandle, LinkHandle, LocatorHandle, ODGPathOutlineHandle, ODGRectRadiusHandle, OrientationHandle, RoundRectangleRadiusHandle, SVGPathOutlineHandle, SVGRectRadiusHandle, TextOverflowHandle
public abstract class AbstractHandle extends java.lang.Object implements Handle, FigureListener
This abstract class can be extended to implement aHandle.
-
-
Constructor Summary
Constructors Constructor and Description AbstractHandle(Figure owner)Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidaddHandleListener(HandleListener l)Adds a listener for this handle.voidareaInvalidated(FigureEvent evt)Sent when a region used by the figure needs to be repainted.voidattributeChanged(FigureEvent e)Sent when an attribute of the figure has changed.booleancontains(java.awt.Point p)Tests if a point is contained in the handle.java.util.Collection<Handle>createSecondaryHandles()Creates secondary handles.voiddispose()Disposes the resources aquired by the handler.voiddraw(java.awt.Graphics2D g)Draws this handle.voidfigureAdded(FigureEvent e)Sent when a figure was added.voidfigureChanged(FigureEvent evt)Sent when the bounds or shape of a figure has changed.voidfigureHandlesChanged(FigureEvent e)Sent when handles of a Figure have been added, removed or replaced.voidfigureRemoved(FigureEvent e)Sent when a figure was removed.voidfigureRequestRemove(FigureEvent e)Sent when a figure requests to be removed.java.awt.RectanglegetBounds()Returns the bounding box of the handle.java.awt.CursorgetCursor()Returns a cursor for the handle.java.awt.RectanglegetDrawingArea()Returns the drawing area of the handle.DrawingEditorgetEditor()FiguregetOwner()Returns the owner of this handle.java.lang.StringgetToolTipText(java.awt.Point p)Returns a tooltip for the specified location.DrawingViewgetView()voidinvalidate()Invalidates the handle.booleanisCombinableWith(Handle handle)Returns true, if the given handle is an instance of the same class or of a subclass of this handle,.voidkeyPressed(java.awt.event.KeyEvent evt)voidkeyReleased(java.awt.event.KeyEvent evt)voidkeyTyped(java.awt.event.KeyEvent evt)voidremoveHandleListener(HandleListener l)Removes a listener for this handle.voidsetToolTipText(java.lang.String newValue)Changes the default tool tip text returned by AbstractHandle.voidsetView(DrawingView view)Sets the view of the handle.voidtrackDoubleClick(java.awt.Point p, int modifiersEx)Tracks a double click.voidviewTransformChanged()This method is invoked by the drawing view, when its transform has changed.-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.jhotdraw.draw.handle.Handle
trackEnd, trackStart, trackStep
-
-
-
-
Constructor Detail
-
AbstractHandle
public AbstractHandle(Figure owner)
Creates a new instance.
-
-
Method Detail
-
addHandleListener
public void addHandleListener(HandleListener l)
Adds a listener for this handle.- Specified by:
addHandleListenerin interfaceHandle
-
removeHandleListener
public void removeHandleListener(HandleListener l)
Removes a listener for this handle.- Specified by:
removeHandleListenerin interfaceHandle
-
getOwner
public Figure getOwner()
Description copied from interface:HandleReturns the owner of this handle.
-
setView
public void setView(@Nullable DrawingView view)
Description copied from interface:HandleSets the view of the handle.
-
getView
@Nullable public DrawingView getView()
-
getEditor
public DrawingEditor getEditor()
-
draw
public void draw(java.awt.Graphics2D g)
Draws this handle.
-
contains
public boolean contains(java.awt.Point p)
Description copied from interface:HandleTests if a point is contained in the handle.
-
invalidate
public void invalidate()
Description copied from interface:HandleInvalidates the handle. This method informs its listeners that its current display box is invalid and should be refreshed.- Specified by:
invalidatein interfaceHandle
-
dispose
public void dispose()
Description copied from interface:HandleDisposes the resources aquired by the handler.
-
areaInvalidated
public void areaInvalidated(FigureEvent evt)
Sent when a region used by the figure needs to be repainted. The implementation of this method assumes that the handle is located on the bounds of the figure or inside the figure. If the handle is located elsewhere this method must be reimpleted by the subclass.- Specified by:
areaInvalidatedin interfaceFigureListener
-
figureAdded
public void figureAdded(FigureEvent e)
Sent when a figure was added.- Specified by:
figureAddedin interfaceFigureListener
-
figureRemoved
public void figureRemoved(FigureEvent e)
Sent when a figure was removed.- Specified by:
figureRemovedin interfaceFigureListener
-
figureRequestRemove
public void figureRequestRemove(FigureEvent e)
Sent when a figure requests to be removed.- Specified by:
figureRequestRemovein interfaceFigureListener
-
figureChanged
public void figureChanged(FigureEvent evt)
Sent when the bounds or shape of a figure has changed.- Specified by:
figureChangedin interfaceFigureListener
-
getCursor
public java.awt.Cursor getCursor()
Returns a cursor for the handle.
-
isCombinableWith
public boolean isCombinableWith(Handle handle)
Returns true, if the given handle is an instance of the same class or of a subclass of this handle,.- Specified by:
isCombinableWithin interfaceHandle
-
keyTyped
public void keyTyped(java.awt.event.KeyEvent evt)
- Specified by:
keyTypedin interfacejava.awt.event.KeyListener
-
keyReleased
public void keyReleased(java.awt.event.KeyEvent evt)
- Specified by:
keyReleasedin interfacejava.awt.event.KeyListener
-
keyPressed
public void keyPressed(java.awt.event.KeyEvent evt)
- Specified by:
keyPressedin interfacejava.awt.event.KeyListener
-
getBounds
public final java.awt.Rectangle getBounds()
Description copied from interface:HandleReturns the bounding box of the handle. Note: The bounding box must be returned in the coordinate system of the DrawingView.
-
getDrawingArea
public java.awt.Rectangle getDrawingArea()
Description copied from interface:HandleReturns the drawing area of the handle. Note: The drawing area must be returned in the coordinate system of the DrawingView.- Specified by:
getDrawingAreain interfaceHandle
-
trackDoubleClick
public void trackDoubleClick(java.awt.Point p, int modifiersEx)Tracks a double click.- Specified by:
trackDoubleClickin interfaceHandle
-
attributeChanged
public void attributeChanged(FigureEvent e)
Description copied from interface:FigureListenerSent when an attribute of the figure has changed.- Specified by:
attributeChangedin interfaceFigureListener
-
viewTransformChanged
public void viewTransformChanged()
Description copied from interface:HandleThis method is invoked by the drawing view, when its transform has changed. This means, that DrawingView.viewToDrawing and DrawingView.drawingToView will return different values than they did before.- Specified by:
viewTransformChangedin interfaceHandle
-
createSecondaryHandles
public java.util.Collection<Handle> createSecondaryHandles()
Description copied from interface:HandleCreates secondary handles.- Specified by:
createSecondaryHandlesin interfaceHandle
-
getToolTipText
public java.lang.String getToolTipText(java.awt.Point p)
Returns a tooltip for the specified location. By default, AbstractHandle returns null.- Specified by:
getToolTipTextin interfaceHandle
-
setToolTipText
public void setToolTipText(java.lang.String newValue)
Changes the default tool tip text returned by AbstractHandle.
-
figureHandlesChanged
public void figureHandlesChanged(FigureEvent e)
Description copied from interface:FigureListenerSent when handles of a Figure have been added, removed or replaced.DrawingViews listen to this event to repopulate the Handles.
A Figure should not fire this event, if just the state or the location of Handle has changed.
- Specified by:
figureHandlesChangedin interfaceFigureListener
-
-
DataMelt 3.0 © DataMelt by jWork.ORG