graphlab.gui.core.graph.vertex
Class GResizer

java.lang.Object
  extended by graphlab.gui.core.graph.vertex.GResizer
All Implemented Interfaces:
PaintHandler, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.util.EventListener

public class GResizer
extends java.lang.Object
implements PaintHandler, java.awt.event.MouseListener, java.awt.event.MouseMotionListener

Tool for resizing vertices on the graph. The user can select only one vertex at a time. The currently selected vertex will have resize handles attached to it. These are used to resize the width, height, or both width and height of the vertex.

Author:
Nathan Fiedler, Azin Azadi

Field Summary
static java.lang.String IS_RESIZING_VERTEX
           
 
Constructor Summary
GResizer(BlackBoard b)
           
 
Method Summary
 void activate(Vertex vertex)
          Invoked when this tool is about to begin user interaction.
 void deactivate()
          Invoked when the tool is no longer being used.
 ResizerListener getResizeListener()
           
 boolean isMouseIsOnABox()
           
 void mouseClicked(java.awt.event.MouseEvent e)
           
 void mouseDragged(java.awt.event.MouseEvent me)
          If user is pressing on a resize handle, handle the resizing of the selected vertex.
 void mouseEntered(java.awt.event.MouseEvent e)
           
 void mouseExited(java.awt.event.MouseEvent e)
           
 void mouseMoved(java.awt.event.MouseEvent me)
           
 void mousePressed(java.awt.event.MouseEvent me)
          See if the user is pressing on a resize handle (if there's a selected vertex).
 void mouseReleased(java.awt.event.MouseEvent me)
           
 void paint(java.awt.Graphics g, java.awt.Component destinationComponent)
          Called after the view draws the graph.
static void resizeVertex(Vertex vertex, int _dx, int _dy)
          resizes the size o the vertex by dx , dy according to some conditions,...
 void setMouseIsOnABox(boolean mouseIsOnABox)
           
 void setResizeListener(ResizerListener rl)
          a resize listener can listen to this resizer to know wheter the vertex resized
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

IS_RESIZING_VERTEX

public static final java.lang.String IS_RESIZING_VERTEX
See Also:
Constant Field Values
Constructor Detail

GResizer

public GResizer(BlackBoard b)
Method Detail

activate

public void activate(Vertex vertex)
Invoked when this tool is about to begin user interaction. The tool should add itself as a listener to the view object and save the model reference for making changes to the graph.


deactivate

public void deactivate()
Invoked when the tool is no longer being used. 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 activate().


mouseDragged

public void mouseDragged(java.awt.event.MouseEvent me)
If user is pressing on a resize handle, handle the resizing of the selected vertex.

Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener
Parameters:
me - mouse event

resizeVertex

public static void resizeVertex(Vertex vertex,
                                int _dx,
                                int _dy)
resizes the size o the vertex by dx , dy according to some conditions,...


mouseMoved

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

mouseClicked

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

mousePressed

public void mousePressed(java.awt.event.MouseEvent me)
See if the user is pressing on a resize handle (if there's a selected vertex). If not pressing on a handle (either because they didn't click on one or because there's no selected vertex) then check if the user is pressing on a vertex.

Specified by:
mousePressed in interface java.awt.event.MouseListener
Parameters:
me - mouse event for this canvas

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

paint

public void paint(java.awt.Graphics g,
                  java.awt.Component destinationComponent)
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:
paint in interface PaintHandler

isMouseIsOnABox

public boolean isMouseIsOnABox()

setMouseIsOnABox

public void setMouseIsOnABox(boolean mouseIsOnABox)

getResizeListener

public ResizerListener getResizeListener()

setResizeListener

public void setResizeListener(ResizerListener rl)
a resize listener can listen to this resizer to know wheter the vertex resized

Parameters:
rl -