|
JHotDraw 7.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.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 |
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 chilrend 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)
Returns the figure that contains the given point. |
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.HashMap<Figure,Figure> oldToNew)
|
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. |
void |
setAttribute(AttributeKey key,
java.lang.Object 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, canConnect, createHandles, getBezierPath, getEndConnector, getEndFigure, getLiner, getStartConnector, getStartFigure, handleConnect, handleDisconnect, handleMouseClick, lineout, read, readLiner, readPoints, remap, reverseConnection, 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, getAttribute, 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, 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 |
---|
addFigureListener, canConnect, changed, createHandles, findCompatibleConnector, findConnector, getActions, getAttribute, getAttributes, getAttributesRestoreData, getBounds, getConnectors, getCursor, getDecomposition, getEndPoint, getLayer, getPreferredSize, getStartPoint, getTool, getToolTipText, getTransformRestoreData, handleDrop, handleMouseClick, includes, isRemovable, isSelectable, isTransformable, isVisible, remap, removeFigureListener, requestRemove, restoreAttributesTo, restoreTransformTo, setBounds, willChange |
Methods inherited from interface org.jhotdraw.xml.DOMStorable |
---|
read, write |
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 Figure
draw
in class AbstractAttributedFigure
g
- The Graphics2D to draw to.public void transform(java.awt.geom.AffineTransform tx)
transform
in interface Figure
transform
in class LineConnectionFigure
tx
- The transformation.Figure.getTransformRestoreData()
,
Figure.restoreTransformTo(java.lang.Object)
public java.awt.geom.Rectangle2D.Double getDrawingArea()
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 Figure
getDrawingArea
in class BezierFigure
public boolean contains(java.awt.geom.Point2D.Double p)
Figure
This is used for hit testing by Tool's.
contains
in interface Figure
contains
in class BezierFigure
public void setAttribute(AttributeKey key, java.lang.Object newValue)
setAttribute
in interface Figure
setAttribute
in class BezierFigure
AttributeKey.set(org.jhotdraw.draw.Figure, T)
public Figure findFigureInside(java.awt.geom.Point2D.Double p)
Figure
findFigureInside
in interface Figure
findFigureInside
in class AbstractFigure
public void updateConnection()
ConnectionFigure
updateConnection
in interface ConnectionFigure
updateConnection
in class LineConnectionFigure
public java.util.List<Figure> getChildren()
CompositeFigure
getChildren
in interface CompositeFigure
public int getChildCount()
CompositeFigure
This is a convenience method for calling
getChildren().size();
.
getChildCount
in interface CompositeFigure
public Figure getChild(int index)
CompositeFigure
This is a convenience method for calling
getChildren().get(index);
.
getChild
in interface CompositeFigure
public 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
CompositeFigureListener
s.
add
in interface CompositeFigure
true
if this CompositeFigure changed as a result of the
callpublic void add(int index, Figure figure)
CompositeFigure
This method calls figureAdded
on all registered
CompositeFigureListener
s.
add
in interface CompositeFigure
public 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 CompositeFigure
public 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 CompositeFigure
public Figure removeChild(int index)
CompositeFigure
Calls figureRemoved
on all registered
CompositeFigureListener
's.
removeChild
in interface CompositeFigure
public int basicRemove(Figure figure)
CompositeFigure
This 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 CompositeFigure
public Figure basicRemoveChild(int index)
CompositeFigure
This 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 CompositeFigure
public void removeAllChildren()
CompositeFigure
This is a convenience method for
while(getChildCount() > 0) removeChild(0);
removeAllChildren
in interface CompositeFigure
public void basicRemoveAllChildren()
CompositeFigure
This 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 CompositeFigure
public Layouter getLayouter()
getLayouter
in interface CompositeFigure
public void setLayouter(Layouter newLayouter)
CompositeFigure
setLayouter
in interface CompositeFigure
newLayouter
- encapsulation of a layout algorithm.public void layout()
layout
in interface CompositeFigure
layout
in class BezierFigure
public void invalidate()
AbstractFigure
invalidate
in class BezierFigure
public void validate()
validate
in class LineConnectionFigure
public void addNotify(Drawing drawing)
LineConnectionFigure
addNotify
in interface Figure
addNotify
in class LineConnectionFigure
LineConnectionFigure.handleConnect(org.jhotdraw.draw.Connector, org.jhotdraw.draw.Connector)
public void removeNotify(Drawing drawing)
LineConnectionFigure
removeNotify
in interface Figure
removeNotify
in class LineConnectionFigure
LineConnectionFigure.handleDisconnect(org.jhotdraw.draw.Connector, org.jhotdraw.draw.Connector)
public void removeCompositeFigureListener(CompositeFigureListener listener)
CompositeFigure
removeCompositeFigureListener
in interface CompositeFigure
public 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 Figure
clone
in class LineConnectionFigure
public void remap(java.util.HashMap<Figure,Figure> oldToNew)
remap
in class AbstractFigure
public boolean contains(Figure f)
CompositeFigure
This is a convenience method for calling
getChildren().contains(f);
.
contains
in interface CompositeFigure
public int indexOf(Figure child)
CompositeFigure
This is a convenience method for calling
getChildren().indexOf(index);
.
indexOf
in interface CompositeFigure
|
Copyright 1996-2007 (c) JHotDraw.org. Some rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |