|
|||||||||
| 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.AbstractTool
org.jhotdraw.draw.BidirectionalConnectionTool
public class BidirectionalConnectionTool
A tool that can be used to connect figures, to split connections, and to join two segments of a connection. ConnectionTools turns the visibility of the Connectors on when it enters a figure. The connection object to be created is specified by a prototype.
FIXME: Use a Tracker instance for each state of this tool.
XXX - This tool is not needed anywhere. We should get rid of it.
| Field Summary | |
|---|---|
private java.util.Map<AttributeKey,java.lang.Object> |
attributes
|
private ConnectionFigure |
connection
the currently created figure |
private Figure |
createdFigure
the figure that was actually added Note, this can be a different figure from the one which has been created. |
private ConnectionFigure |
editedConnection
the currently edited connection |
private Connector |
endConnector
|
private ConnectionFigure |
prototype
the prototypical figure that is used to create new connections. |
private int |
splitPoint
the currently manipulated connection point |
private Connector |
startConnector
the anchor point of the interaction |
private Figure |
target
|
private Connector |
targetConnector
|
| Fields inherited from class org.jhotdraw.draw.AbstractTool |
|---|
anchor, editor, isWorking, listenerList |
| Fields inherited from class org.jhotdraw.beans.AbstractBean |
|---|
propertySupport |
| Constructor Summary | |
|---|---|
BidirectionalConnectionTool(ConnectionFigure prototype)
Creates a new instance. |
|
BidirectionalConnectionTool(ConnectionFigure prototype,
java.util.Map<AttributeKey,java.lang.Object> attributes)
|
|
| Method Summary | |
|---|---|
void |
activate(DrawingEditor editor)
Activates the tool for the given editor. |
void |
areaInvalidated(FigureEvent evt)
Sent when the drawing area used by the figure needs to be repainted. |
void |
attributeChanged(FigureEvent e)
Sent when an attribute of the figure has changed. |
protected ConnectionFigure |
createFigure()
Creates the ConnectionFigure. |
void |
deactivate(DrawingEditor editor)
Deactivates the tool. |
void |
draw(java.awt.Graphics2D g)
Draws the tool. |
void |
figureAdded(FigureEvent e)
Sent when a figure was added to a drawing. |
void |
figureChanged(FigureEvent e)
Sent when the geometry (for example the bounds) of the 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 from a drawing. |
void |
figureRequestRemove(FigureEvent e)
Sent when the figure requests to be removed from a drawing. |
private Figure |
findConnectableFigure(java.awt.geom.Point2D.Double p,
Drawing drawing)
|
protected ConnectionFigure |
findConnection(java.awt.geom.Point2D.Double p,
Drawing drawing)
Finds an existing connection figure. |
protected Figure |
findConnectionStart(java.awt.geom.Point2D.Double p,
Drawing drawing)
Finds a connection start figure. |
private Connector |
findConnector(java.awt.geom.Point2D.Double p,
Figure target,
ConnectionFigure f)
|
protected Figure |
findSource(java.awt.geom.Point2D.Double p,
Drawing drawing)
Finds a connectable figure target. |
protected Figure |
findTarget(java.awt.geom.Point2D.Double p,
Drawing drawing)
Finds a connectable figure target. |
protected ConnectionFigure |
getConnection()
Gets the connection which is created by this tool |
protected Figure |
getCreatedFigure()
Gets the figure that was actually added Note, this can be a different figure from the one which has been created. |
protected Connector |
getEndConnector()
|
protected Connector |
getStartConnector()
|
protected Connector |
getTargetConnector()
|
protected Figure |
getTargetFigure()
|
void |
mouseDragged(java.awt.event.MouseEvent e)
Adjust the created connection or split segment. |
void |
mouseMoved(java.awt.event.MouseEvent evt)
|
void |
mousePressed(java.awt.event.MouseEvent evt)
Manipulates connections in a context dependent way. |
void |
mouseReleased(java.awt.event.MouseEvent e)
Connects the figures if the mouse is released over another figure. |
private void |
setConnection(ConnectionFigure newConnection)
|
private void |
setCreatedFigure(Figure newCreatedFigure)
|
private void |
setEndConnector(Connector newEndConnector)
|
private void |
setStartConnector(Connector newStartConnector)
|
private void |
setTargetConnector(Connector newTargetConnector)
|
private void |
setTargetFigure(Figure newTarget)
|
protected void |
trackConnectors(java.awt.event.MouseEvent e)
|
| Methods inherited from class org.jhotdraw.beans.AbstractBean |
|---|
addPropertyChangeListener, addPropertyChangeListener, clone, firePropertyChange, firePropertyChange, firePropertyChange, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private java.util.Map<AttributeKey,java.lang.Object> attributes
private Connector startConnector
private Connector endConnector
private Connector targetConnector
private Figure target
private ConnectionFigure connection
private int splitPoint
private ConnectionFigure editedConnection
private Figure createdFigure
private ConnectionFigure prototype
| Constructor Detail |
|---|
public BidirectionalConnectionTool(ConnectionFigure prototype)
public BidirectionalConnectionTool(ConnectionFigure prototype,
java.util.Map<AttributeKey,java.lang.Object> attributes)
| Method Detail |
|---|
public void mouseMoved(java.awt.event.MouseEvent evt)
mouseMoved in interface java.awt.event.MouseMotionListenermouseMoved in class AbstractToolpublic void mousePressed(java.awt.event.MouseEvent evt)
mousePressed in interface java.awt.event.MouseListenermousePressed in class AbstractToolpublic void mouseDragged(java.awt.event.MouseEvent e)
mouseDragged in interface java.awt.event.MouseMotionListenerpublic void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased in interface java.awt.event.MouseListenermouseReleased in class AbstractToolpublic void activate(DrawingEditor editor)
Tool
activate in interface Toolactivate in class AbstractToolpublic void deactivate(DrawingEditor editor)
Tool
deactivate in interface Tooldeactivate in class AbstractToolprotected ConnectionFigure createFigure()
protected Figure findSource(java.awt.geom.Point2D.Double p,
Drawing drawing)
protected Figure findTarget(java.awt.geom.Point2D.Double p,
Drawing drawing)
protected ConnectionFigure findConnection(java.awt.geom.Point2D.Double p,
Drawing drawing)
private void setConnection(ConnectionFigure newConnection)
protected ConnectionFigure getConnection()
protected void trackConnectors(java.awt.event.MouseEvent e)
public void draw(java.awt.Graphics2D g)
Tool
draw in interface Tooldraw in class AbstractTool
private Connector findConnector(java.awt.geom.Point2D.Double p,
Figure target,
ConnectionFigure f)
protected Figure findConnectionStart(java.awt.geom.Point2D.Double p,
Drawing drawing)
private Figure findConnectableFigure(java.awt.geom.Point2D.Double p,
Drawing drawing)
private void setStartConnector(Connector newStartConnector)
protected Connector getStartConnector()
private void setEndConnector(Connector newEndConnector)
protected Connector getEndConnector()
private void setTargetConnector(Connector newTargetConnector)
protected Connector getTargetConnector()
private void setTargetFigure(Figure newTarget)
protected Figure getTargetFigure()
protected Figure getCreatedFigure()
private void setCreatedFigure(Figure newCreatedFigure)
public void areaInvalidated(FigureEvent evt)
FigureListener
areaInvalidated in interface FigureListenerpublic void figureAdded(FigureEvent e)
FigureListener
figureAdded in interface FigureListenerpublic void figureChanged(FigureEvent e)
FigureListener
figureChanged in interface FigureListenerpublic void figureRemoved(FigureEvent e)
FigureListener
figureRemoved in interface FigureListenerpublic void figureRequestRemove(FigureEvent e)
FigureListener
figureRequestRemove in interface FigureListenerpublic void attributeChanged(FigureEvent e)
FigureListener
attributeChanged in interface FigureListenerpublic 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
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||