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, wait
trackEnd, trackStart, trackStep
protected DrawingView view
protected javax.swing.event.EventListenerList listenerList
public AbstractHandle(Figure owner)
protected int getHandlesize()
public void addHandleListener(HandleListener l)
addHandleListener
in interface Handle
public void removeHandleListener(HandleListener l)
removeHandleListener
in interface Handle
public Figure getOwner()
Handle
public void setView(DrawingView view)
Handle
public 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)
Handle
public void invalidate()
Handle
invalidate
in interface Handle
public void dispose()
Handle
public void areaInvalidated(FigureEvent evt)
areaInvalidated
in interface FigureListener
public void figureAdded(FigureEvent e)
figureAdded
in interface FigureListener
public void figureRemoved(FigureEvent e)
figureRemoved
in interface FigureListener
public void figureRequestRemove(FigureEvent e)
figureRequestRemove
in interface FigureListener
public void figureChanged(FigureEvent evt)
figureChanged
in interface FigureListener
public java.awt.Cursor getCursor()
public boolean isCombinableWith(Handle handle)
isCombinableWith
in interface Handle
public void keyTyped(java.awt.event.KeyEvent evt)
keyTyped
in interface java.awt.event.KeyListener
public void keyReleased(java.awt.event.KeyEvent evt)
keyReleased
in interface java.awt.event.KeyListener
public void keyPressed(java.awt.event.KeyEvent evt)
keyPressed
in interface java.awt.event.KeyListener
public final java.awt.Rectangle getBounds()
Handle
public java.awt.Rectangle getDrawingArea()
Handle
getDrawingArea
in interface Handle
protected abstract java.awt.Rectangle basicGetBounds()
protected void updateBounds()
public void trackDoubleClick(java.awt.Point p, int modifiersEx)
trackDoubleClick
in interface Handle
public void attributeChanged(FigureEvent e)
FigureListener
attributeChanged
in interface FigureListener
public void viewTransformChanged()
Handle
viewTransformChanged
in interface Handle
public java.util.Collection<Handle> createSecondaryHandles()
Handle
createSecondaryHandles
in interface Handle
public java.lang.String getToolTipText(java.awt.Point p)
getToolTipText
in interface Handle
public void setToolTipText(java.lang.String newValue)
public void figureHandlesChanged(FigureEvent e)
FigureListener
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.
figureHandlesChanged
in interface FigureListener