snap.ui.diagram
Class Link

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

public class Link
extends java.lang.Object

Link is the UI abstraction of a Link between two visualizations. The Link object encapsulates all the information needed to build the UI representation of a connection within a layout.

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

Constructor Summary
Link(java.awt.Point start, snap.ui.diagram.Visualization startViz, java.awt.Point end, snap.ui.diagram.Visualization endViz, snap.ui.diagram.DiagramPanel container)
          Class constructor
 
Method Summary
 boolean containsPoint(java.awt.Point testPoint)
          Determines whether a point given as a parameter is within the clickable region of the Link object and returns boolean values as appropriate.
 void erase(java.awt.Graphics g)
          Erases the iconic representation of the Link object.
 java.util.Vector getCoordinations()
          Returns a Vector of Coordination objects.
 java.awt.Point getEndLocation()
          Retrieves the location where the Link object ends.
 snap.ui.diagram.Visualization getEndVisualization()
          Retrieves the Visualization object at the end of the connection.
 java.lang.String getName()
          Retrieves the name of the Link object.
 java.awt.Point getStartLocation()
          Retrieves the location where the Link object starts
 snap.ui.diagram.Visualization getStartVisualization()
          Retrieves the Visualization object at the beginning of the connection
 void paintComponent(java.awt.Graphics g)
          Draws the iconic represntation of the Link object at its location.
 void setEndLocation(java.awt.Point newPoint)
          Sets the location where the Link should stop painting to a point passed in as a parameter.
 void setEndVisualization(snap.ui.diagram.Visualization newEnd)
          Sets the visualization where the connection should end to that specified by the parameter.
 void setStartLocation(java.awt.Point newPoint)
          Sets the location where the Link should begin painting to a point passed in as a parameter.
 void setStartVisualization(snap.ui.diagram.Visualization newStart)
          Sets the visualization where the connection should begin to that specified by the parameter.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Link

public Link(java.awt.Point start,
            snap.ui.diagram.Visualization startViz,
            java.awt.Point end,
            snap.ui.diagram.Visualization endViz,
            snap.ui.diagram.DiagramPanel container)
Class constructor

Parameters:
start - the starting point of the UI representation
end - the ending point of the UI representation
Method Detail

getName

public java.lang.String getName()
Retrieves the name of the Link object.

Returns:
returns the name of the Link object as type String

getCoordinations

public java.util.Vector getCoordinations()
Returns a Vector of Coordination objects. Each coordination is the link between one action and other.


getStartLocation

public java.awt.Point getStartLocation()
Retrieves the location where the Link object starts

Returns:
returns the location as type Point where the object starts

getEndLocation

public java.awt.Point getEndLocation()
Retrieves the location where the Link object ends.

Returns:
returns the location as type Point where the object ends

getStartVisualization

public snap.ui.diagram.Visualization getStartVisualization()
Retrieves the Visualization object at the beginning of the connection

Returns:
retuns the Visualization object at the beginning of the connection

getEndVisualization

public snap.ui.diagram.Visualization getEndVisualization()
Retrieves the Visualization object at the end of the connection.

Returns:
retuns the Visualization object at the end of the connection

setStartVisualization

public void setStartVisualization(snap.ui.diagram.Visualization newStart)
Sets the visualization where the connection should begin to that specified by the parameter.

Parameters:
newStart - the new starting visualization

setEndVisualization

public void setEndVisualization(snap.ui.diagram.Visualization newEnd)
Sets the visualization where the connection should end to that specified by the parameter.


setStartLocation

public void setStartLocation(java.awt.Point newPoint)
Sets the location where the Link should begin painting to a point passed in as a parameter.

Parameters:
newPoint - the new beginning location for the Link

setEndLocation

public void setEndLocation(java.awt.Point newPoint)
Sets the location where the Link should stop painting to a point passed in as a parameter.

Parameters:
newPoint - the new ending location for the Link

containsPoint

public boolean containsPoint(java.awt.Point testPoint)
Determines whether a point given as a parameter is within the clickable region of the Link object and returns boolean values as appropriate.

Parameters:
testPoint - the point to test for containment
Returns:
returns true if the point in question is within the clickable area of the Link and false otherwise.

paintComponent

public void paintComponent(java.awt.Graphics g)
Draws the iconic represntation of the Link 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 Link object. This is accomplished by a simple overlay of appropriate background colors.

Parameters:
g - the graphics context to use for painting