public abstract class AbstractHandle extends java.lang.Object implements Handle, FigureListener
Handle.| Modifier and Type | Field and Description |
|---|---|
protected javax.swing.event.EventListenerList |
listenerList |
protected DrawingView |
view |
| Constructor and Description |
|---|
AbstractHandle(Figure owner)
Creates a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addHandleListener(HandleListener l)
Adds a listener for this handle.
|
void |
areaInvalidated(FigureEvent evt)
Sent when a region used by the figure needs to be repainted.
|
void |
attributeChanged(FigureEvent e)
Sent when an attribute of the figure has changed.
|
protected abstract java.awt.Rectangle |
basicGetBounds() |
boolean |
contains(java.awt.Point p)
Tests if a point is contained in the handle.
|
java.util.Collection<Handle> |
createSecondaryHandles()
Creates secondary handles.
|
void |
dispose()
Disposes the resources aquired by the handler.
|
void |
draw(java.awt.Graphics2D g)
Draws this handle.
|
protected void |
drawCircle(java.awt.Graphics2D g,
java.awt.Color fill,
java.awt.Color stroke) |
protected void |
drawDiamond(java.awt.Graphics2D g,
java.awt.Color fill,
java.awt.Color stroke) |
protected void |
drawRectangle(java.awt.Graphics2D g,
java.awt.Color fill,
java.awt.Color stroke) |
void |
figureAdded(FigureEvent e)
Sent when a figure was added.
|
void |
figureChanged(FigureEvent evt)
Sent when the bounds or shape of a figure has changed.
|
void |
figureHandlesChanged(FigureEvent e)
Sent when handles of a Figure have been added, removed or replaced.
|
void |
figureRemoved(FigureEvent e)
Sent when a figure was removed.
|
void |
figureRequestRemove(FigureEvent e)
Sent when a figure requests to be removed.
|
protected void |
fireAreaInvalidated(java.awt.Rectangle invalidatedArea)
Notify all listenerList that have registered interest for
notification on this event type.
|
protected void |
fireHandleRequestRemove(java.awt.Rectangle invalidatedArea)
Notify all listenerList that have registered interest for
notification on this event type.
|
protected void |
fireHandleRequestSecondaryHandles()
Notify all listenerList that have registered interest for
notification on this event type.
|
protected void |
fireUndoableEditHappened(javax.swing.undo.UndoableEdit edit)
Notify all listenerList that have registered interest for
notification on this event type.
|
java.awt.Rectangle |
getBounds()
Returns the bounding box of the handle.
|
java.awt.Cursor |
getCursor()
Returns a cursor for the handle.
|
java.awt.Rectangle |
getDrawingArea()
Returns the drawing area of the handle.
|
DrawingEditor |
getEditor() |
protected int |
getHandlesize() |
Figure |
getOwner()
Returns the owner of this handle.
|
java.lang.String |
getToolTipText(java.awt.Point p)
Returns a tooltip for the specified location.
|
DrawingView |
getView() |
void |
invalidate()
Invalidates the handle.
|
boolean |
isCombinableWith(Handle handle)
Returns true, if the given handle is an instance of the same
class or of a subclass of this handle,.
|
void |
keyPressed(java.awt.event.KeyEvent evt) |
void |
keyReleased(java.awt.event.KeyEvent evt) |
void |
keyTyped(java.awt.event.KeyEvent evt) |
void |
removeHandleListener(HandleListener l)
Removes a listener for this handle.
|
void |
setToolTipText(java.lang.String newValue)
Changes the default tool tip text returned by AbstractHandle.
|
void |
setView(DrawingView view)
Sets the view of the handle.
|
void |
trackDoubleClick(java.awt.Point p,
int modifiersEx)
Tracks a double click.
|
protected void |
updateBounds() |
void |
viewTransformChanged()
This method is invoked by the drawing view, when its transform
has changed.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waittrackEnd, trackStart, trackStepprotected DrawingView view
protected javax.swing.event.EventListenerList listenerList
public AbstractHandle(Figure owner)
protected int getHandlesize()
public void addHandleListener(HandleListener l)
addHandleListener in interface Handlepublic void removeHandleListener(HandleListener l)
removeHandleListener in interface Handlepublic Figure getOwner()
Handlepublic void setView(DrawingView view)
Handlepublic DrawingView getView()
public DrawingEditor getEditor()
protected void fireAreaInvalidated(java.awt.Rectangle invalidatedArea)
protected void fireUndoableEditHappened(javax.swing.undo.UndoableEdit edit)
protected void fireHandleRequestRemove(java.awt.Rectangle invalidatedArea)
protected void fireHandleRequestSecondaryHandles()
public void draw(java.awt.Graphics2D g)
protected void drawCircle(java.awt.Graphics2D g,
java.awt.Color fill,
java.awt.Color stroke)
protected void drawRectangle(java.awt.Graphics2D g,
java.awt.Color fill,
java.awt.Color stroke)
protected void drawDiamond(java.awt.Graphics2D g,
java.awt.Color fill,
java.awt.Color stroke)
public boolean contains(java.awt.Point p)
Handlepublic void invalidate()
Handleinvalidate in interface Handlepublic void dispose()
Handlepublic void areaInvalidated(FigureEvent evt)
areaInvalidated in interface FigureListenerpublic void figureAdded(FigureEvent e)
figureAdded in interface FigureListenerpublic void figureRemoved(FigureEvent e)
figureRemoved in interface FigureListenerpublic void figureRequestRemove(FigureEvent e)
figureRequestRemove in interface FigureListenerpublic void figureChanged(FigureEvent evt)
figureChanged in interface FigureListenerpublic java.awt.Cursor getCursor()
public boolean isCombinableWith(Handle handle)
isCombinableWith in interface Handlepublic void keyTyped(java.awt.event.KeyEvent evt)
keyTyped in interface java.awt.event.KeyListenerpublic void keyReleased(java.awt.event.KeyEvent evt)
keyReleased in interface java.awt.event.KeyListenerpublic void keyPressed(java.awt.event.KeyEvent evt)
keyPressed in interface java.awt.event.KeyListenerpublic final java.awt.Rectangle getBounds()
Handlepublic java.awt.Rectangle getDrawingArea()
HandlegetDrawingArea in interface Handleprotected abstract java.awt.Rectangle basicGetBounds()
protected void updateBounds()
public void trackDoubleClick(java.awt.Point p,
int modifiersEx)
trackDoubleClick in interface Handlepublic void attributeChanged(FigureEvent e)
FigureListenerattributeChanged in interface FigureListenerpublic void viewTransformChanged()
HandleviewTransformChanged in interface Handlepublic java.util.Collection<Handle> createSecondaryHandles()
HandlecreateSecondaryHandles in interface Handlepublic java.lang.String getToolTipText(java.awt.Point p)
getToolTipText in interface Handlepublic void setToolTipText(java.lang.String newValue)
public void figureHandlesChanged(FigureEvent e)
FigureListenerDrawingViews 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.
figureHandlesChanged in interface FigureListener