|
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
org.jhotdraw.draw.AbstractAttributedFigure
org.jhotdraw.draw.BezierFigure
org.jhotdraw.draw.LineFigure
org.jhotdraw.draw.LineConnectionFigure
org.jhotdraw.draw.LabeledLineConnectionFigure
public class LabeledLineConnectionFigure
A LineConnection with labels.
Usage:
LineConnectionFigure lcf = new LineConnectionFigure();
lcf.setLayouter(new LocatorLayouter());
TextFigure label = new TextFigure();
label.setText("Hello");
LocatorLayouter.LAYOUT_LOCATOR.set(label, new BezierLabelLocator(0, -Math.PI / 4, 8));
lcf.add(label);
| Field Summary |
|---|
| Fields inherited from class org.jhotdraw.draw.LineConnectionFigure |
|---|
LINER_PROPERTY |
| Fields inherited from class org.jhotdraw.draw.BezierFigure |
|---|
path |
| Fields inherited from class org.jhotdraw.draw.AbstractFigure |
|---|
changingDepth, listenerList |
| Fields inherited from class org.jhotdraw.beans.AbstractBean |
|---|
propertySupport |
| Fields inherited from interface org.jhotdraw.draw.CompositeFigure |
|---|
LAYOUT_INSETS |
| Fields inherited from interface org.jhotdraw.draw.Figure |
|---|
CONNECTABLE_PROPERTY, REMOVABLE_PROPERTY, SELECTABLE_PROPERTY, TRANSFORMABLE_PROPERTY |
| Constructor Summary | |
|---|---|
LabeledLineConnectionFigure()
Creates a new instance. |
|
| Method Summary | ||
|---|---|---|
boolean |
add(Figure figure)
Adds a child to the figure. |
|
void |
add(int index,
Figure figure)
Adds a child to the figure at the specified index. |
|
void |
addCompositeFigureListener(CompositeFigureListener listener)
Adds a listener for this composite figure. |
|
void |
addNotify(Drawing drawing)
This method is invoked, when the Figure is being removed from a Drawing. |
|
void |
basicAdd(Figure figure)
Adds a child to the figure without firing events. |
|
void |
basicAdd(int index,
Figure figure)
Adds a child to the figure at the specified index without firing events. |
|
int |
basicRemove(Figure figure)
Removes the specified child without firing events. |
|
void |
basicRemoveAllChildren()
Removes all children from the composite figure without firing events. |
|
Figure |
basicRemoveChild(int index)
Removes the child at the specified index without firing events. |
|
LabeledLineConnectionFigure |
clone()
Returns a clone of the figure, with clones of all aggregated figures, such as children and decorators. |
|
boolean |
contains(Figure f)
Returns true if this composite figure contains the specified figure. |
|
boolean |
contains(java.awt.geom.Point2D.Double p)
Checks if a point is contained by the figure. |
|
void |
draw(java.awt.Graphics2D g)
Draw the figure. |
|
Figure |
findFigureInside(java.awt.geom.Point2D.Double p)
Finds the innermost figure at the specified location. |
|
protected void |
fireFigureAdded(Figure f,
int zIndex)
Notify all listenerList that have registered interest for notification on this event type. |
|
protected void |
fireFigureRemoved(Figure f,
int zIndex)
Notify all listenerList that have registered interest for notification on this event type. |
|
Figure |
getChild(int index)
Returns the child figure at the specified index. |
|
int |
getChildCount()
Returns the number of children. |
|
java.util.List<Figure> |
getChildren()
Returns an unchangeable list view on the children. |
|
java.util.List<Figure> |
getChildrenFrontToBack()
Returns an iterator to iterate in Z-order front to back over the children. |
|
java.awt.geom.Rectangle2D.Double |
getDrawingArea()
Returns the drawing area of the figure as a Rectangle. |
|
Layouter |
getLayouter()
Get a Layouter object which encapsulated a layout algorithm for this figure. |
|
int |
indexOf(Figure child)
Returns the index of the specified child. |
|
void |
invalidate()
Invalidates cached data of the Figure. |
|
void |
layout()
A layout algorithm is used to define how the child components should be laid out in relation to each other. |
|
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. |
|
boolean |
remove(Figure figure)
Removes the specified child. |
|
void |
removeAllChildren()
Removes all children from the composite figure. |
|
Figure |
removeChild(int index)
Removes the child at the specified index. |
|
void |
removeCompositeFigureListener(CompositeFigureListener listener)
Removes a listener from this composite figure. |
|
void |
removeNotify(Drawing drawing)
This method is invoked, when the Figure is being removed from a Drawing. |
|
|
set(AttributeKey<T> key,
T newValue)
Sets an attribute of the figure. |
|
void |
setLayouter(Layouter newLayouter)
Set a Layouter object which encapsulated a layout algorithm for this figure. |
|
void |
transform(java.awt.geom.AffineTransform tx)
Transforms the figure. |
|
void |
updateConnection()
Updates the start and end point of the figure and fires figureChanged events. |
|
void |
validate()
|
|
| Methods inherited from class org.jhotdraw.draw.LineConnectionFigure |
|---|
canConnect, canConnect, createHandles, getBezierPath, getEndConnector, getEndFigure, getLiner, getStartConnector, getStartFigure, handleConnect, handleDisconnect, handleMouseClick, lineout, read, readLiner, readPoints, reverseConnection, setConnectable, setEndConnector, setEndPoint, setLiner, setNode, setPoint, setStartConnector, setStartPoint, write, writeLiner, writePoints |
| Methods inherited from class org.jhotdraw.draw.BezierFigure |
|---|
addNode, addNode, chop, drawCaps, drawFill, drawStroke, findCompatibleConnector, findConnector, findNode, findSegment, getBounds, getCappedPath, getCenter, getEndPoint, getNode, getNodeCount, getOutermostPoint, getPoint, getPoint, getPointOnPath, getStartPoint, getTransformRestoreData, isClosed, joinSegments, joinSegments, removeAllNodes, removeNode, restoreTransformTo, setBezierPath, setBounds, setClosed, setPoint, splitSegment, splitSegment |
| Methods inherited from class org.jhotdraw.draw.AbstractAttributedFigure |
|---|
applyAttributesTo, drawText, get, getAttributeKey, getAttributes, getAttributesRestoreData, getStroke, getStrokeMiterLimitFactor, hasAttribute, isAttributeEnabled, readAttributes, removeAttribute, restoreAttributesTo, setAttributeEnabled, setAttributes, writeAttributes |
| 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.ConnectionFigure |
|---|
getEndPoint, getNode, getNodeCount, getPoint, getStartPoint |
| Constructor Detail |
|---|
public LabeledLineConnectionFigure()
| Method Detail |
|---|
public void draw(java.awt.Graphics2D g)
draw in interface Figuredraw in class AbstractAttributedFigureg - The Graphics2D to draw to.public void transform(java.awt.geom.AffineTransform tx)
transform in interface Figuretransform in class LineConnectionFiguretx - The transformation.Figure.getTransformRestoreData(),
Figure.restoreTransformTo(java.lang.Object)public java.awt.geom.Rectangle2D.Double getDrawingArea()
Figure
The drawing area is used to inform DrawingView about the
area that is needed to draw this figure.
The drawing area needs to be large enough, to take line width, line caps and other decorations into account that exceed the bounds of the Figure.
getDrawingArea in interface FiguregetDrawingArea in class BezierFigurepublic boolean contains(java.awt.geom.Point2D.Double p)
FigureThis is used for hit testing by Tool's.
contains in interface Figurecontains in class BezierFigure
public <T> void set(AttributeKey<T> key,
T newValue)
set in interface Figureset in class BezierFigureAttributeKey.set(org.jhotdraw.draw.Figure, T)public 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 FigurefindFigureInside in class AbstractFigurep - A location on the drawing.
public void updateConnection()
ConnectionFigure
updateConnection in interface ConnectionFigureupdateConnection in class LineConnectionFigurepublic java.util.List<Figure> getChildren()
CompositeFigure
getChildren in interface CompositeFigurepublic int getChildCount()
CompositeFigure
This is a convenience method for calling
getChildren().size();.
getChildCount in interface CompositeFigurepublic Figure getChild(int index)
CompositeFigure
This is a convenience method for calling
getChildren().get(index);.
getChild in interface CompositeFigurepublic java.util.List<Figure> getChildrenFrontToBack()
public boolean add(Figure figure)
CompositeFigure
This is a convenience method for add(getChildCount(), child);
This method calls figureAdded on all registered
CompositeFigureListeners.
add in interface CompositeFiguretrue if this CompositeFigure changed as a result of the
call
public void add(int index,
Figure figure)
CompositeFigure
This method calls figureAdded on all registered
CompositeFigureListeners.
add in interface CompositeFigurepublic void basicAdd(Figure figure)
CompositeFigure
This method can be used to reinsert a child figure which has been
temporarily removed from this CompositeFigure (for example to reorder
the sequence of the children) and to efficiently build a drawing from
an InputFormat.
This is a convenience method for calling
basicAdd(getChildCount(), child);.
basicAdd in interface CompositeFigure
public void basicAdd(int index,
Figure figure)
CompositeFigure
This method can be used to reinsert a child figure which has been
temporarily removed from this CompositeFigure (for example to reorder
the sequence of the children) and to efficiently build a drawing from
an InputFormat.
basicAdd in interface CompositeFigurepublic boolean remove(Figure figure)
CompositeFigure
This is a convenience method for calling
removeChild(getChildren().indexOf(child));
This method calls figureRemoved on all registered
CompositeFigureListener's.
remove in interface CompositeFigurepublic Figure removeChild(int index)
CompositeFigure
Calls figureRemoved on all registered
CompositeFigureListener's.
removeChild in interface CompositeFigurepublic int basicRemove(Figure figure)
CompositeFigureThis method can be used to temporarily remove a child from this CompositeFigure (for example to reorder the sequence of the children).
This is a convenience method for calling
basicRemove(indexOf(child));.
Returns the index of the removed figure. Returns -1 if the figure was not a child of this CompositeFigure.
basicRemove in interface CompositeFigurepublic Figure basicRemoveChild(int index)
CompositeFigureThis method can be used to temporarily remove a child from this CompositeFigure (for example to reorder the sequence of the children).
Returns the removed child figure.
basicRemoveChild in interface CompositeFigurepublic void removeAllChildren()
CompositeFigure
This is a convenience method for
while(getChildCount() > 0) removeChild(0);
removeAllChildren in interface CompositeFigurepublic void basicRemoveAllChildren()
CompositeFigureThis method can be used to temporarily remove a child from this CompositeFigure (for example to reorder the sequence of the children).
This is a convenience method for
while(getChildCount() > 0) basicRemoveChild(0);
basicRemoveAllChildren in interface CompositeFigurepublic Layouter getLayouter()
getLayouter in interface CompositeFigurepublic void setLayouter(Layouter newLayouter)
CompositeFigure
setLayouter in interface CompositeFigurenewLayouter - encapsulation of a layout algorithm.public void layout()
layout in interface CompositeFigurelayout in class BezierFigurepublic void invalidate()
AbstractFigure
invalidate in class BezierFigurepublic void validate()
validate in class LineConnectionFigurepublic void addNotify(Drawing drawing)
LineConnectionFigure
addNotify in interface FigureaddNotify in class LineConnectionFigureLineConnectionFigure.handleConnect(org.jhotdraw.draw.connector.Connector, org.jhotdraw.draw.connector.Connector)public void removeNotify(Drawing drawing)
LineConnectionFigure
removeNotify in interface FigureremoveNotify in class LineConnectionFigureLineConnectionFigure.handleDisconnect(org.jhotdraw.draw.connector.Connector, org.jhotdraw.draw.connector.Connector)public void removeCompositeFigureListener(CompositeFigureListener listener)
CompositeFigure
removeCompositeFigureListener in interface CompositeFigurepublic void addCompositeFigureListener(CompositeFigureListener listener)
CompositeFigure
addCompositeFigureListener in interface CompositeFigure
protected void fireFigureAdded(Figure f,
int zIndex)
protected void fireFigureRemoved(Figure f,
int zIndex)
public LabeledLineConnectionFigure clone()
Figure
clone in interface Figureclone in class LineConnectionFigure
public void remap(java.util.Map<Figure,Figure> oldToNew,
boolean disconnectIfNotInMap)
Figure
remap in interface Figureremap in class LineConnectionFigurepublic boolean contains(Figure f)
CompositeFigure
This is a convenience method for calling
getChildren().contains(f);.
contains in interface CompositeFigurepublic int indexOf(Figure child)
CompositeFigure
This is a convenience method for calling
getChildren().indexOf(index);.
indexOf in interface CompositeFigure
|
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 | ||||||||