|
JHotDraw 7.5.1 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.jhotdraw.beans.AbstractBean
org.jhotdraw.draw.AbstractFigure
public abstract class AbstractFigure
This abstract class can be extended to implement a Figure.
| Field Summary | |
|---|---|
protected int |
changingDepth
This variable is used to prevent endless change loops. |
protected javax.swing.event.EventListenerList |
listenerList
|
| Fields inherited from class org.jhotdraw.beans.AbstractBean |
|---|
propertySupport |
| Fields inherited from interface org.jhotdraw.draw.Figure |
|---|
CONNECTABLE_PROPERTY, REMOVABLE_PROPERTY, SELECTABLE_PROPERTY, TRANSFORMABLE_PROPERTY |
| Constructor Summary | |
|---|---|
AbstractFigure()
Creates a new instance. |
|
| Method Summary | |
|---|---|
void |
addFigureListener(FigureListener l)
Adds a listener for FigureEvent's. |
void |
addNotify(Drawing d)
Informs a figure, that it has been added to a drawing. |
AbstractFigure |
basicClone(java.util.HashMap<Figure,Figure> oldToNew)
|
void |
changed()
Informs that a figure changed the area of its display box. |
AbstractFigure |
clone()
Returns a clone of the figure, with clones of all aggregated figures, such as children and decorators. |
java.util.Collection<Handle> |
createHandles(int detailLevel)
Creates handles used to manipulate the figure. |
Connector |
findCompatibleConnector(Connector c,
boolean isStart)
Gets a compatible connector. |
Connector |
findConnector(java.awt.geom.Point2D.Double p,
ConnectionFigure prototype)
Returns the Figures connector for the specified location. |
Figure |
findFigureInside(java.awt.geom.Point2D.Double p)
Finds the innermost figure at the specified location. |
void |
fireAreaInvalidated()
Notify all listenerList that have registered interest for notification on this event type. |
protected void |
fireAreaInvalidated(FigureEvent event)
Notify all listenerList that have registered interest for notification on this event type. |
protected void |
fireAreaInvalidated(java.awt.geom.Rectangle2D.Double invalidatedArea)
Notify all listenerList that have registered interest for notification on this event type. |
protected void |
fireAttributeChanged(AttributeKey attribute,
java.lang.Object oldValue,
java.lang.Object newValue)
Notify all listenerList that have registered interest for notification on this event type. |
protected void |
fireFigureAdded()
Notify all listenerList that have registered interest for notification on this event type. |
void |
fireFigureChanged()
|
protected void |
fireFigureChanged(FigureEvent event)
|
protected void |
fireFigureChanged(java.awt.geom.Rectangle2D.Double changedArea)
Notify all listenerList that have registered interest for notification on this event type. |
protected void |
fireFigureHandlesChanged()
Notify all listenerList that have registered interest for notification on this event type. |
protected void |
fireFigureRemoved()
Notify all listenerList that have registered interest for notification on this event type. |
protected void |
fireFigureRequestRemove()
Notify all listenerList that have registered interest for notification on this event type. |
protected void |
fireUndoableEditHappened(javax.swing.undo.UndoableEdit edit)
Notify all UndoableEditListener of the Drawing, to which this Figure has been added to. |
java.util.Collection<javax.swing.Action> |
getActions(java.awt.geom.Point2D.Double p)
Returns a collection of actions which are presented to the user in a popup menu. |
protected int |
getChangingDepth()
|
java.util.Collection<Connector> |
getConnectors(ConnectionFigure prototype)
Returns all connectors of this Figure for the specified prototype of a ConnectionFigure. |
java.awt.Cursor |
getCursor(java.awt.geom.Point2D.Double p)
Returns a cursor for the specified location. |
java.util.Collection<Figure> |
getDecomposition()
Returns a decompositon of a figure into its parts. |
protected Drawing |
getDrawing()
|
java.awt.geom.Point2D.Double |
getEndPoint()
Returns the untransformed logical end point of the bounds. |
protected java.awt.font.FontRenderContext |
getFontRenderContext()
|
int |
getLayer()
AbstractFigure always returns 0. |
protected java.lang.Object |
getLock()
|
Dimension2DDouble |
getPreferredSize()
The preferred size is used by Layouter to determine the preferred size of a Figure. |
java.awt.geom.Point2D.Double |
getStartPoint()
Returns the untransformed logical start point of the bounds. |
Tool |
getTool(java.awt.geom.Point2D.Double p)
Returns a specialized tool for the given coordinate. |
java.lang.String |
getToolTipText(java.awt.geom.Point2D.Double p)
Returns a tooltip for the specified location on the figure. |
boolean |
handleDrop(java.awt.geom.Point2D.Double p,
java.util.Collection<Figure> droppedFigures,
DrawingView view)
Handles a drop. |
boolean |
handleMouseClick(java.awt.geom.Point2D.Double p,
java.awt.event.MouseEvent evt,
DrawingView view)
Handles a mouse click. |
boolean |
includes(Figure figure)
Checks whether the given figure is contained in this figure. |
protected void |
invalidate()
Invalidates cached data of the Figure. |
protected boolean |
isChanging()
|
boolean |
isConnectable()
Checks whether this figure is connectable. |
boolean |
isRemovable()
Checks whether this figure is removable. |
boolean |
isSelectable()
Checks whether this figure is selectable. |
boolean |
isTransformable()
Checks whether this figure is transformable. |
boolean |
isVisible()
Checks whether this figure is visible. |
void |
remap(java.util.Map<Figure,Figure> oldToNew,
boolean disconnectIfNotInMap)
After cloning a collection of figures, the ConnectionFigures contained in this collection still connect to the original figures instead of to the clones. |
void |
removeFigureListener(FigureListener l)
Removes a listener for FigureEvent's. |
void |
removeNotify(Drawing d)
Informs a figure, that it has been removed from a drawing. |
void |
requestRemove()
Fires a FigureListener.figureRequestRemove event. |
void |
setBounds(java.awt.geom.Point2D.Double anchor,
java.awt.geom.Point2D.Double lead)
Sets the logical and untransformed bounds of the figure. |
void |
setBounds(java.awt.geom.Rectangle2D.Double bounds)
|
void |
setConnectable(boolean newValue)
|
void |
setRemovable(boolean newValue)
|
void |
setSelectable(boolean newValue)
|
void |
setTransformable(boolean newValue)
|
void |
setVisible(boolean newValue)
|
java.lang.String |
toString()
|
protected void |
validate()
|
void |
willChange()
Informs that a figure is about to change something that affects the contents of its display box. |
| Methods inherited from class org.jhotdraw.beans.AbstractBean |
|---|
addPropertyChangeListener, addPropertyChangeListener, firePropertyChange, firePropertyChange, firePropertyChange, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.jhotdraw.draw.Figure |
|---|
addPropertyChangeListener, contains, draw, get, getAttributes, getAttributesRestoreData, getBounds, getDrawingArea, getTransformRestoreData, removePropertyChangeListener, restoreAttributesTo, restoreTransformTo, set, transform |
| Field Detail |
|---|
protected javax.swing.event.EventListenerList listenerList
protected int changingDepth
| Constructor Detail |
|---|
public AbstractFigure()
| Method Detail |
|---|
public void addFigureListener(FigureListener l)
Figure
addFigureListener in interface Figurepublic void removeFigureListener(FigureListener l)
Figure
removeFigureListener in interface Figurepublic void addNotify(Drawing d)
Figure
addNotify in interface Figurepublic void removeNotify(Drawing d)
Figure
removeNotify in interface Figureprotected Drawing getDrawing()
protected java.lang.Object getLock()
public void fireAreaInvalidated()
protected void fireAreaInvalidated(java.awt.geom.Rectangle2D.Double invalidatedArea)
protected void fireAreaInvalidated(FigureEvent event)
protected void fireFigureRequestRemove()
protected void fireFigureAdded()
protected void fireFigureRemoved()
public void fireFigureChanged()
protected void fireFigureChanged(java.awt.geom.Rectangle2D.Double changedArea)
protected void fireFigureChanged(FigureEvent event)
protected void fireAttributeChanged(AttributeKey attribute,
java.lang.Object oldValue,
java.lang.Object newValue)
protected void fireFigureHandlesChanged()
protected void fireUndoableEditHappened(javax.swing.undo.UndoableEdit edit)
public AbstractFigure clone()
Figure
clone in interface Figureclone in class AbstractBeanpublic final AbstractFigure basicClone(java.util.HashMap<Figure,Figure> oldToNew)
public void remap(java.util.Map<Figure,Figure> oldToNew,
boolean disconnectIfNotInMap)
Figure
remap in interface Figurepublic java.util.Collection<Handle> createHandles(int detailLevel)
Figure
createHandles in interface FiguredetailLevel - The detail level of the handles. Usually this is 0 for
bounding box handles and 1 for point handles. The value -1 is used
by the SelectAreaTracker and the HandleTracker to highlight figures, over which the mouse
pointer is hovering.
Handlepublic java.awt.Cursor getCursor(java.awt.geom.Point2D.Double p)
Figure
getCursor in interface Figurepublic final void setBounds(java.awt.geom.Rectangle2D.Double bounds)
public void setBounds(java.awt.geom.Point2D.Double anchor,
java.awt.geom.Point2D.Double lead)
FigureThis is used by Tool's which create a new Figure and by Tool's which connect a Figure to another Figure.
This is a basic operation which does not fire events. Use the following code sequence, if you need event firing:
figure.willChange(); figure.setBounds(...); figure.changed();
setBounds in interface Figureanchor - the start point of the boundslead - the end point of the boundsFigure.getBounds()protected void invalidate()
protected boolean isChanging()
protected int getChangingDepth()
public void willChange()
willChange in interface FigureFigure.changed()protected void validate()
public void changed()
changed in interface FigureFigure.willChange()
public Connector findConnector(java.awt.geom.Point2D.Double p,
ConnectionFigure prototype)
findConnector in interface Figurep - the location of the connector.prototype - The prototype used to create a connection or null if
unknown. This allows for specific connectors for different
connection figures.ChopRectangleConnectorpublic boolean includes(Figure figure)
Figure
includes in interface Figurepublic Figure findFigureInside(java.awt.geom.Point2D.Double p)
Figure
In case of a CompositeFigure, this method descends into its
children and into its children's children until the innermost figure is
found.
This functionality is implemented using the Chain of Responsibility design pattern. A figure which is not composed of other figures returns itself if the point is contained by the figure. Composed figures pass the method call down to their children.
findFigureInside in interface Figurep - A location on the drawing.
public Connector findCompatibleConnector(Connector c,
boolean isStart)
Figure
findCompatibleConnector in interface Figurepublic java.util.Collection<javax.swing.Action> getActions(java.awt.geom.Point2D.Double p)
The collection may contain null entries. These entries are used interpreted as separators in the popup menu.
getActions in interface Figurepublic Tool getTool(java.awt.geom.Point2D.Double p)
Returns null, if no specialized tool is available.
getTool in interface Figure
public boolean handleMouseClick(java.awt.geom.Point2D.Double p,
java.awt.event.MouseEvent evt,
DrawingView view)
handleMouseClick in interface Figurep - The location of the mouse event.evt - The mouse event.view - The drawing view which is the source of the mouse event.
public boolean handleDrop(java.awt.geom.Point2D.Double p,
java.util.Collection<Figure> droppedFigures,
DrawingView view)
Figure
handleDrop in interface Figurep - The location of the mouse event.droppedFigures - The dropped figures.view - The drawing view which is the source of the mouse event.
public java.awt.geom.Point2D.Double getEndPoint()
Figure
getEndPoint in interface FigureFigure.setBounds(java.awt.geom.Point2D.Double, java.awt.geom.Point2D.Double)public java.awt.geom.Point2D.Double getStartPoint()
Figure
getStartPoint in interface FigureFigure.setBounds(java.awt.geom.Point2D.Double, java.awt.geom.Point2D.Double)public Dimension2DDouble getPreferredSize()
Figure
getPreferredSize in interface Figurepublic boolean isConnectable()
AbstractFigure can be connected.
isConnectable in interface Figurepublic void setConnectable(boolean newValue)
public boolean isSelectable()
AbstractFigure can be selected.
isSelectable in interface Figurepublic void setSelectable(boolean newValue)
public boolean isRemovable()
AbstractFigure can be removed.
isRemovable in interface Figurepublic void setRemovable(boolean newValue)
public boolean isTransformable()
AbstractFigure can be transformed.
isTransformable in interface FigureFigure.transform(java.awt.geom.AffineTransform)public void setTransformable(boolean newValue)
public boolean isVisible()
AbstractFigure is visible.
isVisible in interface Figurepublic void setVisible(boolean newValue)
public java.util.Collection<Figure> getDecomposition()
Figure
getDecomposition in interface Figureprotected java.awt.font.FontRenderContext getFontRenderContext()
public void requestRemove()
FigureFigureListener.figureRequestRemove event.
requestRemove in interface Figurepublic int getLayer()
getLayer in interface Figurepublic java.lang.String getToolTipText(java.awt.geom.Point2D.Double p)
Figure
getToolTipText in interface Figurepublic java.lang.String toString()
toString in class java.lang.Objectpublic java.util.Collection<Connector> getConnectors(ConnectionFigure prototype)
FigureThis is used by connection tools and connection handles to visualize the connectors when the user is about to create a ConnectionFigure to this Figure.
getConnectors in interface Figureprototype - The prototype used to create a connection or null if
unknown. This allows for specific connectors for different
connection figures.
|
Copyright 1996-2010 (c) by the authors and contributors of the JHotDraw project. Some rights reserved. |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||