|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjcreek.cke.tool.MoveTool
Tool for moving entities and relations around a graph; acts as a go-between for the user and the graph. This class takes user input and coordinates the interaction by talking to the model and view to provide appropriate feedback to the user. In this way, the view and model appear to be operating as one entity.
User can select a entity or relation by clicking on it. If user clicks in empty space and drags the mouse they can select any number of entities that fall within the bounding rectangle. To select multiple objects, user must hold down Control key.
Field Summary | |
static java.awt.datatransfer.DataFlavor |
dataFlavor
|
protected CreekDocument |
document
Document this mediator is associated with. |
protected java.awt.dnd.DragSource |
dragSource
|
protected java.awt.Point |
firstMousePos
First mouse press position when dragging started. |
protected boolean |
isCTRLDown
True if user has pressed CTRL key. |
protected boolean |
isSelectRegion
True if user is selecting entities by defining a region. |
protected java.awt.Point |
lastMousePos
Most recent mouse position while dragging. |
protected CreekModel |
model
Model that we're associated with. |
protected VertexList |
movingVertices
The list of the entities being moved around. |
protected VisualEntity |
pressVertex
Vertex the user pressed on in mousePressed(). |
protected VisualEntity |
propVertex
Vertex the rightClicked. |
PropertyWindow |
propWin
|
protected javax.swing.JPopupMenu |
relationList
|
protected VertexList |
selectedList
List of the selected entities in the order they were selected by the user. |
protected boolean |
wasPressed
True if mouse was pressed on the view before being released. |
protected ConceptView |
view
View that we're associated with. |
Constructor Summary | |
MoveTool()
Creates a new MoveTool object. |
Method Summary | |
VisualEntity |
activateEntity(Entity ed,
VisualEntity activator)
|
protected void |
activateRelation(Relation r)
|
protected void |
activateRelation(java.lang.String relationType)
|
void |
attach(CreekModel model,
ConceptView view,
javax.swing.JInternalFrame win)
Attach to the given model and view objects. |
boolean |
canPerformAction(int action,
java.awt.Point location)
|
protected javax.swing.JMenuItem |
createMenuItem(java.lang.String cmd)
|
protected javax.swing.JMenu |
createRelationsMenu()
|
void |
deactivateRelation(java.lang.String relationName)
|
void |
detach()
Detach from the model and view and prepare to be deactivated. |
void |
dragDropEnd(java.awt.dnd.DragSourceDropEvent e)
DragSourceListener Methods |
void |
dragEnter(java.awt.dnd.DragSourceDragEvent e)
|
void |
dragEnter(java.awt.dnd.DropTargetDragEvent e)
|
void |
dragExit(java.awt.dnd.DragSourceEvent e)
|
void |
dragExit(java.awt.dnd.DropTargetEvent e)
|
void |
dragGestureRecognized(java.awt.dnd.DragGestureEvent e)
DragGestureRecognized for DragGestureListener |
void |
dragOver(java.awt.dnd.DragSourceDragEvent e)
|
void |
dragOver(java.awt.dnd.DropTargetDragEvent e)
|
void |
drop(java.awt.dnd.DropTargetDropEvent e)
DropTargetListener methods |
void |
dropActionChanged(java.awt.dnd.DragSourceDragEvent e)
|
void |
dropActionChanged(java.awt.dnd.DropTargetDragEvent e)
|
protected VisualEntity |
findNode(int x,
int y)
Find an entity close to the given x,y position. |
protected void |
finishMoving()
If we were moving entities, clean up now. |
protected void |
formPopup(int x,
int y)
|
java.awt.Point |
getMousePosition()
Returns the position of the mouse,this will return the first Mouse Position or last Mouse Position depending on the current Tool and the state of the tool |
VertexList |
getSelected()
Returns the list of selected entities, in the order they were selected by the user. |
VisualEntity |
getVisualEntity(VisualEntity ve,
VertexList vl)
|
protected void |
initialiseEntities(VertexList vl)
|
protected void |
initialiseRelations(RelationList rl)
|
boolean |
isSelected(VisualRelation vr,
VisualEntity[] ves)
|
void |
mouseClicked(java.awt.event.MouseEvent e)
We ignore this event. |
void |
mouseDragged(java.awt.event.MouseEvent me)
The user is dragging the mouse so lets see about moving the selected entities. |
void |
mouseEntered(java.awt.event.MouseEvent e)
We ignore this event. |
void |
mouseExited(java.awt.event.MouseEvent me)
We ignore this event. |
void |
mouseMoved(java.awt.event.MouseEvent me)
We ignore this event. |
void |
mousePressed(java.awt.event.MouseEvent me)
User has pressed a mouse button on us. |
void |
mouseReleased(java.awt.event.MouseEvent me)
User has released the mouse button. |
void |
paintAfter(ConceptViewPaintEvent event)
Called after the view draws the graph. |
void |
paintBefore(ConceptViewPaintEvent event)
Called before the view draws the graph. |
void |
propertyChange(java.beans.PropertyChangeEvent e)
The state of the object we're listening to has changed. |
protected void |
resetMovingVertices()
Moves all the moving entities back to their original positions by using the original positions stored in the copy of the entities. |
protected void |
selectRegion()
Called when user was defining a rectangular region with which to select entities. |
protected void |
toggleRelation(VisualEntity e,
java.lang.String relationName)
|
java.lang.String |
toString()
Returns a string representation of this object. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected CreekModel model
protected ConceptView view
protected CreekDocument document
protected VisualEntity pressVertex
protected VisualEntity propVertex
protected VertexList selectedList
protected boolean wasPressed
protected boolean isSelectRegion
protected boolean isCTRLDown
protected VertexList movingVertices
protected java.awt.Point firstMousePos
protected java.awt.Point lastMousePos
public PropertyWindow propWin
protected javax.swing.JPopupMenu relationList
protected java.awt.dnd.DragSource dragSource
public static final java.awt.datatransfer.DataFlavor dataFlavor
Constructor Detail |
public MoveTool()
Method Detail |
public void attach(CreekModel model, ConceptView view, javax.swing.JInternalFrame win)
attach
in interface CreekTool
model
- CreekModel to attach toview
- ConceptView to attach topublic void detach()
Note that this method may be called more than once
between calls to attach()
detach
in interface CreekTool
protected VisualEntity findNode(int x, int y)
x
- mouse x positiony
- mouse y positionprotected void finishMoving()
public VertexList getSelected()
getSelected
in interface CreekTool
public void mouseClicked(java.awt.event.MouseEvent e)
mouseClicked
in interface java.awt.event.MouseListener
e
- mouse eventpublic void mouseDragged(java.awt.event.MouseEvent me)
mouseDragged
in interface java.awt.event.MouseMotionListener
me
- mouse eventpublic void mouseEntered(java.awt.event.MouseEvent e)
mouseEntered
in interface java.awt.event.MouseListener
e
- mouse eventpublic void mouseExited(java.awt.event.MouseEvent me)
mouseExited
in interface java.awt.event.MouseListener
me
- mouse eventpublic void mouseMoved(java.awt.event.MouseEvent me)
mouseMoved
in interface java.awt.event.MouseMotionListener
public void mousePressed(java.awt.event.MouseEvent me)
mousePressed
in interface java.awt.event.MouseListener
me
- mouse event for this canvaspublic void mouseReleased(java.awt.event.MouseEvent me)
mouseReleased
in interface java.awt.event.MouseListener
me
- mouse event for this canvaspublic void paintAfter(ConceptViewPaintEvent event)
paintAfter
in interface ConceptViewPaintListener
event
- view paint eventpublic void paintBefore(ConceptViewPaintEvent event)
paintBefore
in interface ConceptViewPaintListener
event
- view paint eventpublic void propertyChange(java.beans.PropertyChangeEvent e)
propertyChange
in interface java.beans.PropertyChangeListener
e
- change eventprotected void resetMovingVertices()
protected void selectRegion()
public java.lang.String toString()
public java.awt.Point getMousePosition()
getMousePosition
in interface CreekTool
protected void formPopup(int x, int y)
protected javax.swing.JMenuItem createMenuItem(java.lang.String cmd)
protected javax.swing.JMenu createRelationsMenu()
protected void toggleRelation(VisualEntity e, java.lang.String relationName)
public void deactivateRelation(java.lang.String relationName)
protected void activateRelation(java.lang.String relationType)
protected void activateRelation(Relation r)
public VisualEntity activateEntity(Entity ed, VisualEntity activator)
public void drop(java.awt.dnd.DropTargetDropEvent e)
drop
in interface java.awt.dnd.DropTargetListener
public void dragEnter(java.awt.dnd.DropTargetDragEvent e)
dragEnter
in interface java.awt.dnd.DropTargetListener
public void dragExit(java.awt.dnd.DropTargetEvent e)
dragExit
in interface java.awt.dnd.DropTargetListener
public void dragOver(java.awt.dnd.DropTargetDragEvent e)
dragOver
in interface java.awt.dnd.DropTargetListener
public void dropActionChanged(java.awt.dnd.DropTargetDragEvent e)
dropActionChanged
in interface java.awt.dnd.DropTargetListener
public void dragGestureRecognized(java.awt.dnd.DragGestureEvent e)
dragGestureRecognized
in interface java.awt.dnd.DragGestureListener
public void dragDropEnd(java.awt.dnd.DragSourceDropEvent e)
dragDropEnd
in interface java.awt.dnd.DragSourceListener
public void dragEnter(java.awt.dnd.DragSourceDragEvent e)
dragEnter
in interface java.awt.dnd.DragSourceListener
public void dragExit(java.awt.dnd.DragSourceEvent e)
dragExit
in interface java.awt.dnd.DragSourceListener
public void dragOver(java.awt.dnd.DragSourceDragEvent e)
dragOver
in interface java.awt.dnd.DragSourceListener
public void dropActionChanged(java.awt.dnd.DragSourceDragEvent e)
dropActionChanged
in interface java.awt.dnd.DragSourceListener
public boolean canPerformAction(int action, java.awt.Point location)
public boolean isSelected(VisualRelation vr, VisualEntity[] ves)
public VisualEntity getVisualEntity(VisualEntity ve, VertexList vl)
protected void initialiseEntities(VertexList vl)
protected void initialiseRelations(RelationList rl)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |