snap.ui.diagram
Class Visualization

java.lang.Object
  |
  +--snap.ui.diagram.Visualization

public class Visualization
extends java.lang.Object

Visualization is the UI abstraction of a Visualization object. The Visualization object encapsulates all the information needed to build the UI representation of a visualization within a layout.

Author:
Nathan Conklin - nathan@conklinfamily.net, Matt Clement - macleme2@vt.edu, Chris North - north@cs.vt.edu

Constructor Summary
Visualization(snap.graph.UINode node, snap.ui.diagram.DiagramPanel container)
          Class constructor
 
Method Summary
 void addLink(snap.ui.diagram.Link link)
          Adds a Link to the list of associated links for this Visualization object
 boolean containsPoint(java.awt.Point testPoint)
          Determines whether a given point passed in as a parameter is within the graphical drawing space of the Visualization.
 void erase(java.awt.Graphics g)
          Erases the iconic representation of the Visualization object.
 java.awt.Point getCenterPoint()
          Calculates the center point of the iconic representation of the Visualization and returns that as a Point object for rendering the associated coordinations in the UI.
 java.util.Vector getLinks()
          Retrieves the list of Links associated with this Visualization.
 java.awt.Point getLocation()
          Retrieves the location where the Visualization object is painting
 snap.graph.UINode getUINode()
          Retrieves the UINode of the Visualization object.
 boolean isLinked()
          Determines if the Visualization is connected by examining the list of associated coordinations.
 void paintComponent(java.awt.Graphics g)
          Draws the iconic represntation of the SnapVisualizaiton object at its location.
 void removeLink(snap.ui.diagram.Link link)
          Removes a coordination from the list of associated coordinations for this Visualization object
 void setLocation(java.awt.Point newPoint)
          Sets the location where the Visualization should paint to the point specified by parameter.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Visualization

public Visualization(snap.graph.UINode node,
                     snap.ui.diagram.DiagramPanel container)
Class constructor

Parameters:
node - the node of the new Visualization
Method Detail

setLocation

public void setLocation(java.awt.Point newPoint)
Sets the location where the Visualization should paint to the point specified by parameter.

Parameters:
newPoint - the new location where the object should paint

getUINode

public snap.graph.UINode getUINode()
Retrieves the UINode of the Visualization object.

Returns:
the UINode of the Visualization object

getLocation

public java.awt.Point getLocation()
Retrieves the location where the Visualization object is painting

Returns:
returns the location as type Point where the object is painting

getCenterPoint

public java.awt.Point getCenterPoint()
Calculates the center point of the iconic representation of the Visualization and returns that as a Point object for rendering the associated coordinations in the UI.

Returns:
returns a new Point object located at the center of the visualization icon

getLinks

public java.util.Vector getLinks()
Retrieves the list of Links associated with this Visualization.

Returns:
the list of Links associated with this Visualization

isLinked

public boolean isLinked()
Determines if the Visualization is connected by examining the list of associated coordinations. Returns false if the list is empty and true otherwise.

Returns:
returns true if the object is connected and false if it is not

containsPoint

public boolean containsPoint(java.awt.Point testPoint)
Determines whether a given point passed in as a parameter is within the graphical drawing space of the Visualization. Returns true if the point is located within the bounds of the iconic representation and false otherwise. This test does NOT account for points on the edge of the icon.

Parameters:
testPoint - the point to test for containment
Returns:
returns true if the point is within the bounds of the iconic representation and false otherwise

paintComponent

public void paintComponent(java.awt.Graphics g)
Draws the iconic represntation of the SnapVisualizaiton object at its location.

Parameters:
g - the graphics context to use for painting

erase

public void erase(java.awt.Graphics g)
Erases the iconic representation of the Visualization object. This is accomplished by a simple overlay of appropriate background colors.

Parameters:
g - the graphics context to use for painting

addLink

public void addLink(snap.ui.diagram.Link link)
Adds a Link to the list of associated links for this Visualization object

Parameters:
link - the Link object to be added or associated with the visualization object

removeLink

public void removeLink(snap.ui.diagram.Link link)
Removes a coordination from the list of associated coordinations for this Visualization object

Parameters:
link - the Link object to be removed from the Visualization object