org.jhotdraw.framework
Interface Handle

All Known Implementing Classes:
AbstractHandle, UndoableHandle

public interface Handle

Handles are used to change a figure by direct manipulation. Handles know their owning figure and they provide methods to locate the handle on the figure and to track changes.


Design Patterns

 o Adapter
Handles adapt the operations to manipulate a figure to a common interface.

Version:
<$CURRENT_VERSION$>
See Also:
Figure

Field Summary
static int HANDLESIZE
           
 
Method Summary
 boolean containsPoint(int x, int y)
          Tests if a point is contained in the handle.
 java.awt.Rectangle displayBox()
          Gets the display box of the handle.
 void draw(java.awt.Graphics g)
          Draws this handle.
 Cursor getCursor()
          Returns the preferred Cursor for this Handle.
 Undoable getUndoActivity()
          Returns an Undoable to be used by the Undo/Redo infrastructure.
 void invokeEnd(int dx, int dy, Drawing drawing)
          Deprecated. As of version 4.1, use invokeEnd(x, y, anchorX, anchorY, drawingView).
 void invokeEnd(int x, int y, int anchorX, int anchorY, DrawingView view)
          Tracks the end of the interaction.
 void invokeStart(int x, int y, Drawing drawing)
          Deprecated. As of version 4.1, use invokeStart(x, y, drawingView)
 void invokeStart(int x, int y, DrawingView view)
          Tracks the start of the interaction.
 void invokeStep(int dx, int dy, Drawing drawing)
          Deprecated. As of version 4.1, use invokeStep(x, y, anchorX, anchorY, drawingView)
 void invokeStep(int x, int y, int anchorX, int anchorY, DrawingView view)
          Tracks a step of the interaction.
 java.awt.Point locate()
          Locates the handle on the figure.
 Figure owner()
          Gets the handle's owner.
 void setUndoActivity(Undoable newUndoableActivity)
          Sets an Undoable to be used by the Undo/Redo infrastructure.
 

Field Detail

HANDLESIZE

public static final int HANDLESIZE
See Also:
Constant Field Values
Method Detail

locate

public java.awt.Point locate()
Locates the handle on the figure. The handle is drawn centered around the returned point.


invokeStart

public void invokeStart(int x,
                        int y,
                        DrawingView view)
Tracks the start of the interaction. The default implementation does nothing.

Parameters:
x - the x position where the interaction started
y - the y position where the interaction started
view - the handles container

invokeStart

public void invokeStart(int x,
                        int y,
                        Drawing drawing)
Deprecated. As of version 4.1, use invokeStart(x, y, drawingView)

Tracks the start of the interaction. The default implementation does nothing.

Parameters:
x - the x position where the interaction started
y - the y position where the interaction started

invokeStep

public void invokeStep(int x,
                       int y,
                       int anchorX,
                       int anchorY,
                       DrawingView view)
Tracks a step of the interaction.

Parameters:
x - the current x position
y - the current y position
anchorX - the x position where the interaction started
anchorY - the y position where the interaction started

invokeStep

public void invokeStep(int dx,
                       int dy,
                       Drawing drawing)
Deprecated. As of version 4.1, use invokeStep(x, y, anchorX, anchorY, drawingView)

Tracks a step of the interaction.

Parameters:
dx - x delta of this step
dy - y delta of this step

invokeEnd

public void invokeEnd(int x,
                      int y,
                      int anchorX,
                      int anchorY,
                      DrawingView view)
Tracks the end of the interaction.

Parameters:
x - the current x position
y - the current y position
anchorX - the x position where the interaction started
anchorY - the y position where the interaction started

invokeEnd

public void invokeEnd(int dx,
                      int dy,
                      Drawing drawing)
Deprecated. As of version 4.1, use invokeEnd(x, y, anchorX, anchorY, drawingView).

Tracks the end of the interaction.


owner

public Figure owner()
Gets the handle's owner.


displayBox

public java.awt.Rectangle displayBox()
Gets the display box of the handle.


containsPoint

public boolean containsPoint(int x,
                             int y)
Tests if a point is contained in the handle.


draw

public void draw(java.awt.Graphics g)
Draws this handle.


getUndoActivity

public Undoable getUndoActivity()
Returns an Undoable to be used by the Undo/Redo infrastructure.

Returns:
Undoable

setUndoActivity

public void setUndoActivity(Undoable newUndoableActivity)
Sets an Undoable to be used by the Undo/Redo infrastructure.

Parameters:
newUndoableActivity -

getCursor

public Cursor getCursor()
Returns the preferred Cursor for this Handle.

Returns:
Cursor