|
JHotDraw 7.0.6 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jhotdraw.draw.AbstractTool
org.jhotdraw.draw.ConnectionTool
public class ConnectionTool
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.
| Field Summary | |
|---|---|
protected boolean |
isPressed
|
protected ConnectionFigure |
prototype
the prototypical figure that is used to create new connections. |
| Fields inherited from class org.jhotdraw.draw.AbstractTool |
|---|
anchor, editor, isWorking, listenerList |
| Constructor Summary | |
|---|---|
ConnectionTool(ConnectionFigure prototype)
Creates a new instance. |
|
ConnectionTool(ConnectionFigure prototype,
java.util.Map attributes)
|
|
ConnectionTool(java.lang.String prototypeClassName)
|
|
ConnectionTool(java.lang.String prototypeClassName,
java.util.Map<AttributeKey,java.lang.Object> attributes)
|
|
| Method Summary | |
|---|---|
void |
activate(DrawingEditor editor)
Activates the tool for the given view. |
protected boolean |
canConnect(Figure start)
|
protected boolean |
canConnect(Figure start,
Figure end)
|
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 |
figureAreaInvalidated(FigureEvent evt)
Sent when an area used by the figure needs to be repainted. |
void |
figureAttributeChanged(FigureEvent e)
Sent when an attribute of the figure has changed. |
void |
figureChanged(FigureEvent e)
Sent when the geometry (e.g. |
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. |
protected 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. |
protected 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()
|
ConnectionFigure |
getPrototype()
|
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. |
protected void |
setConnection(ConnectionFigure newConnection)
|
protected void |
setCreatedFigure(Figure newCreatedFigure)
|
protected void |
setEndConnector(Connector newEndConnector)
|
protected void |
setStartConnector(Connector newStartConnector)
|
protected void |
trackConnectors(java.awt.event.MouseEvent e)
|
| Methods inherited from class org.jhotdraw.draw.AbstractTool |
|---|
addToolListener, addUndoableEditListener, constrainPoint, constrainPoint, editCopy, editCut, editDelete, editDuplicate, editPaste, fireAreaInvalidated, fireAreaInvalidated, fireToolDone, fireToolStarted, getDrawing, getEditor, getView, isActive, keyPressed, keyReleased, keyTyped, mouseClicked, mouseEntered, mouseExited, removeToolListener, removeUndoableEditListener, updateCursor, viewToDrawing |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected ConnectionFigure prototype
protected boolean isPressed
| Constructor Detail |
|---|
public ConnectionTool(ConnectionFigure prototype)
public ConnectionTool(ConnectionFigure prototype,
java.util.Map attributes)
public ConnectionTool(java.lang.String prototypeClassName)
public ConnectionTool(java.lang.String prototypeClassName,
java.util.Map<AttributeKey,java.lang.Object> attributes)
| Method Detail |
|---|
public ConnectionFigure getPrototype()
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.MouseMotionListenerprotected boolean canConnect(Figure start)
protected boolean canConnect(Figure start,
Figure end)
public 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)
protected 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
protected Connector findConnector(java.awt.geom.Point2D.Double p,
Figure target,
ConnectionFigure f)
protected Figure findConnectionStart(java.awt.geom.Point2D.Double p,
Drawing drawing)
protected Figure findConnectableFigure(java.awt.geom.Point2D.Double p,
Drawing drawing)
protected void setStartConnector(Connector newStartConnector)
protected Connector getStartConnector()
protected void setEndConnector(Connector newEndConnector)
protected Connector getEndConnector()
protected Connector getTargetConnector()
protected Figure getTargetFigure()
protected Figure getCreatedFigure()
protected void setCreatedFigure(Figure newCreatedFigure)
public void figureAreaInvalidated(FigureEvent evt)
FigureListener
figureAreaInvalidated 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 figureAttributeChanged(FigureEvent e)
FigureListener
figureAttributeChanged in interface FigureListener
|
Copyright 1996-2006 © JHotDraw.org | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||