|
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.AbstractTool
org.jhotdraw.draw.ConnectionTool
public class ConnectionTool
A tool to create a connection between two figures.
The ConnectionFigure
to be created is specified by a prototype.
The location of the start and end points are controlled by Connector
s.
To create a connection using the ConnectionTool, the user does the following mouse gestures on a DrawingView:
Field Summary | |
---|---|
protected java.util.Collection<Connector> |
connectors
|
protected ConnectionFigure |
createdFigure
The created figure. |
protected ConnectionFigure |
prototype
the prototypical figure that is used to create new connections. |
protected Figure |
targetFigure
The figure for which we enabled drawing of connectors. |
Fields inherited from class org.jhotdraw.draw.AbstractTool |
---|
anchor, editor, isWorking, listenerList |
Fields inherited from class org.jhotdraw.beans.AbstractBean |
---|
propertySupport |
Constructor Summary | |
---|---|
ConnectionTool(ConnectionFigure prototype)
Creates a new instance. |
|
ConnectionTool(ConnectionFigure prototype,
java.util.Map<AttributeKey,java.lang.Object> attributes)
|
|
ConnectionTool(ConnectionFigure prototype,
java.util.Map<AttributeKey,java.lang.Object> attributes,
java.lang.String presentationName)
|
|
ConnectionTool(java.lang.String prototypeClassName)
|
|
ConnectionTool(java.lang.String prototypeClassName,
java.util.Map<AttributeKey,java.lang.Object> attributes,
java.lang.String presentationName)
|
Method Summary | |
---|---|
void |
activate(DrawingEditor editor)
Activates the tool for the given editor. |
protected ConnectionFigure |
createFigure()
Creates the ConnectionFigure. |
protected void |
creationFinished(Figure createdFigure)
This method allows subclasses to do perform additonal user interactions after the new figure has been created. |
void |
deactivate(DrawingEditor editor)
Deactivates the tool. |
void |
draw(java.awt.Graphics2D g)
Draws the tool. |
ConnectionFigure |
getPrototype()
|
boolean |
isToolDoneAfterCreation()
Returns true, if this tool fires toolDone immediately after a new figure has been created. |
void |
mouseDragged(java.awt.event.MouseEvent e)
Adjust the created connection. |
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. |
void |
repaintConnectors(java.awt.event.MouseEvent evt)
Updates the list of connectors that we draw when the user moves or drags the mouse over a figure to which can connect. |
void |
setToolDoneAfterCreation(boolean newValue)
If this is set to false, the CreationTool does not fire toolDone after a new Figure has been created. |
Methods inherited from class org.jhotdraw.draw.AbstractTool |
---|
addToolListener, addUndoableEditListener, constrainPoint, constrainPoint, createActionMap, createInputMap, editCopy, editCut, editDelete, editDuplicate, editPaste, fireAreaInvalidated, fireAreaInvalidated, fireToolDone, fireToolStarted, getActionMap, getDrawing, getEditor, getInputMap, getView, isActive, keyPressed, keyReleased, keyTyped, mouseClicked, mouseEntered, mouseExited, removeToolListener, removeUndoableEditListener, setActionMap, setInputMap, updateCursor, viewToDrawing |
Methods inherited from class org.jhotdraw.beans.AbstractBean |
---|
addPropertyChangeListener, addPropertyChangeListener, clone, firePropertyChange, firePropertyChange, firePropertyChange, removePropertyChangeListener, removePropertyChangeListener |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected ConnectionFigure createdFigure
protected ConnectionFigure prototype
protected Figure targetFigure
protected java.util.Collection<Connector> connectors
Constructor Detail |
---|
public ConnectionTool(ConnectionFigure prototype)
public ConnectionTool(ConnectionFigure prototype, java.util.Map<AttributeKey,java.lang.Object> attributes)
public ConnectionTool(ConnectionFigure prototype, java.util.Map<AttributeKey,java.lang.Object> attributes, java.lang.String presentationName)
public ConnectionTool(java.lang.String prototypeClassName)
public ConnectionTool(java.lang.String prototypeClassName, java.util.Map<AttributeKey,java.lang.Object> attributes, java.lang.String presentationName)
Method Detail |
---|
public ConnectionFigure getPrototype()
public void mouseMoved(java.awt.event.MouseEvent evt)
mouseMoved
in interface java.awt.event.MouseMotionListener
mouseMoved
in class AbstractTool
public void repaintConnectors(java.awt.event.MouseEvent evt)
public void mousePressed(java.awt.event.MouseEvent evt)
mousePressed
in interface java.awt.event.MouseListener
mousePressed
in class AbstractTool
public void mouseDragged(java.awt.event.MouseEvent e)
public void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased
in interface java.awt.event.MouseListener
mouseReleased
in class AbstractTool
public void activate(DrawingEditor editor)
Tool
activate
in interface Tool
activate
in class AbstractTool
public void deactivate(DrawingEditor editor)
Tool
deactivate
in interface Tool
deactivate
in class AbstractTool
protected ConnectionFigure createFigure()
public void draw(java.awt.Graphics2D g)
Tool
draw
in interface Tool
draw
in class AbstractTool
protected void creationFinished(Figure createdFigure)
public void setToolDoneAfterCreation(boolean newValue)
public boolean isToolDoneAfterCreation()
|
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 |