jcreek.cke.tool
Class ZoomTool

java.lang.Object
  extended byjcreek.cke.tool.ZoomTool
All Implemented Interfaces:
ConceptViewListener, ConceptViewPaintListener, CreekTool, java.util.EventListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener

public class ZoomTool
extends java.lang.Object
implements CreekTool, ConceptViewPaintListener

Title: JavaCreek Description: A Case based Reasoning Approach in java Copyright: Copyright (c) 2002 Company: Phil

Version:
1.0
Author:
Victor

Field Summary
protected  CreekDocument document
          Document this mediator is associated with.
protected  java.awt.Point firstMousePos
          First mouse press position when dragging started.
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  DPoint leftTop
          LEFT TOP of the selection region
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  DPoint rightBottom
          RIGHT BOTTOM of the selection region
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
ZoomTool()
           
 
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.
protected  boolean contains(DPoint loc)
           
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.
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 vertices, in the order they were selected by the user.
 void mouseClicked(java.awt.event.MouseEvent me)
           
 void mouseDragged(java.awt.event.MouseEvent me)
           
 void mouseEntered(java.awt.event.MouseEvent e)
           
 void mouseExited(java.awt.event.MouseEvent e)
           
 void mouseMoved(java.awt.event.MouseEvent e)
           
 void mousePressed(java.awt.event.MouseEvent me)
           
 void mouseReleased(java.awt.event.MouseEvent me)
           
 void paintAfter(ConceptViewPaintEvent event)
          Called after the view draws the graph.
 void paintBefore(ConceptViewPaintEvent event)
          Called before the view draws the graph.
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)
           
protected  void zoomIn()
           
protected  void zoomOut()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

model

protected CreekModel model
Model that we're associated with.


view

protected ConceptView view
View that we're associated with.


document

protected CreekDocument document
Document this mediator is associated with.


firstMousePos

protected java.awt.Point firstMousePos
First mouse press position when dragging started.


lastMousePos

protected java.awt.Point lastMousePos
Most recent mouse position while dragging.


pressVertex

protected VisualEntity pressVertex
Vertex the user pressed on in mousePressed(). Could be null if the user didn't press on a entity.


propVertex

protected VisualEntity propVertex
Vertex the rightClicked. Could be null if the user didn't rightClick on a entity.


selectedList

protected VertexList selectedList
List of the selected entities in the order they were selected by the user.


wasPressed

protected boolean wasPressed
True if mouse was pressed on the view before being released. Helps avoid some mis-firings of the mouse buttons.


isSelectRegion

protected boolean isSelectRegion
True if user is selecting entities by defining a region. This is true when user pressed but not on a entity and begins dragging the mouse.


movingVertices

protected VertexList movingVertices
The list of the entities being moved around. These entities are a copy of the originals and can be modified.


leftTop

protected DPoint leftTop
LEFT TOP of the selection region


rightBottom

protected DPoint rightBottom
RIGHT BOTTOM of the selection region


propWin

public PropertyWindow propWin

relationList

protected javax.swing.JPopupMenu relationList
Constructor Detail

ZoomTool

public ZoomTool()
Method Detail

attach

public void attach(CreekModel model,
                   ConceptView view,
                   javax.swing.JInternalFrame win)
Description copied from interface: CreekTool
Attach to the given model and view objects. This begins user interaction and will imply that this tool is the currently active tool. The tool should add itself as a listener to the view object to begin interaction with the user.

Specified by:
attach in interface CreekTool
Parameters:
model - GraphModel to attach to
view - GraphView to attach to

detach

public void detach()
Description copied from interface: CreekTool
Detach from the model and view and prepare to be deactivated. This does not imply that this object is about to be destroyed. The tool should remove itself from the view listener list and cease interaction with the user.

Note that this method may be called more than once between calls to attach()

Specified by:
detach in interface CreekTool

getSelected

public VertexList getSelected()
Description copied from interface: CreekTool
Returns the list of selected vertices, in the order they were selected by the user. Often called by another class that is going to perform some operation on the graph, such as a search.

Specified by:
getSelected in interface CreekTool
Returns:
selected vertex list

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent me)
Specified by:
mouseClicked in interface java.awt.event.MouseListener

mousePressed

public void mousePressed(java.awt.event.MouseEvent me)
Specified by:
mousePressed in interface java.awt.event.MouseListener

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent me)
Specified by:
mouseReleased in interface java.awt.event.MouseListener

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
Specified by:
mouseEntered in interface java.awt.event.MouseListener

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
Specified by:
mouseExited in interface java.awt.event.MouseListener

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent me)
Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent e)
Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener

getMousePosition

public 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

Specified by:
getMousePosition in interface CreekTool
Returns:
Point position of the mouse

paintAfter

public void paintAfter(ConceptViewPaintEvent event)
Called after the view draws the graph. Gives the listener a chance to draw something to the view after everything else has been drawn. The order in which listeners are called is non-deterministic.

Specified by:
paintAfter in interface ConceptViewPaintListener
Parameters:
event - view paint event

paintBefore

public void paintBefore(ConceptViewPaintEvent event)
Called before the view draws the graph. Gives the listener a chance to draw something to the view before anything else appears. The order in which listeners are called is non-deterministic.

Specified by:
paintBefore in interface ConceptViewPaintListener
Parameters:
event - view paint event

findNode

protected VisualEntity findNode(int x,
                                int y)
Find an entity close to the given x,y position.

Parameters:
x - mouse x position
y - mouse y position

selectRegion

protected void selectRegion()
Called when user was defining a rectangular region with which to select entities. Determines which entities are within the rectangle and marks them selected.


resetMovingVertices

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.


finishMoving

protected void finishMoving()
If we were moving entities, clean up now.


formPopup

protected void formPopup(int x,
                         int y)

createMenuItem

protected javax.swing.JMenuItem createMenuItem(java.lang.String cmd)

createRelationsMenu

protected javax.swing.JMenu createRelationsMenu()

toggleRelation

protected void toggleRelation(VisualEntity e,
                              java.lang.String relationName)

deactivateRelation

public void deactivateRelation(java.lang.String relationName)

activateRelation

protected void activateRelation(java.lang.String relationType)

activateRelation

protected void activateRelation(Relation r)

activateEntity

public VisualEntity activateEntity(Entity ed,
                                   VisualEntity activator)

zoomIn

protected void zoomIn()

zoomOut

protected void zoomOut()

contains

protected boolean contains(DPoint loc)


Created at IDI, NTNU by the Artificial Intelligence and Learning group