edu.ucla.stat.SOCR.touchgraph.graphlayout
Class Node

java.lang.Object
  extended by edu.ucla.stat.SOCR.touchgraph.graphlayout.Node

public class Node
extends java.lang.Object

Node.

Version:
1.22-jre1.1 $Id: Node.java,v 1.1 2010/01/20 20:38:32 jiecui Exp $
Author:
Alexander Shapiro, Murray Altheim (2001-11-06; added support for round rects and alternate Node colors)

Field Summary
 java.awt.Color BACK_DEFAULT_COLOR
           
 java.awt.Color BACK_FIXED_COLOR
           
 java.awt.Color BACK_HILIGHT_COLOR
           
 java.awt.Color BACK_HILIGHT1_COLOR
           
 java.awt.Color BACK_HILIGHT2_COLOR
           
 java.awt.Color BACK_HILIGHT3_COLOR
           
 java.awt.Color BACK_JML_COLOR
           
 java.awt.Color BACK_MRF_COLOR
           
 java.awt.Color BACK_SELECT_COLOR
           
protected  java.awt.Color backColor
           
 java.awt.Color BORDER_DRAG_COLOR
           
 java.awt.Color BORDER_INACTIVE_COLOR
           
 java.awt.Color BORDER_MOUSE_OVER_COLOR
           
static int DEFAULT_TYPE
           
 double drawx
           
 double drawy
           
protected  double dx
           
protected  double dy
           
protected  boolean fixed
           
protected  java.awt.Font font
           
protected  java.awt.FontMetrics fontMetrics
           
protected  int highlight_flag
           
protected  boolean highlighted
           
 boolean justMadeLocal
           
protected  java.lang.String lbl
           
 boolean markedForRemoval
           
 double massfade
           
protected  int repulsion
           
static java.awt.Font SMALL_TAG_FONT
           
 java.awt.Color TEXT_COLOR
           
static java.awt.Font TEXT_FONT
           
protected  java.awt.Color textColor
           
protected  int typ
          an int indicating the Node type.
static int TYPE_CIRCLE
          This Node's type is a Circle.
static int TYPE_ELLIPSE
          This Node's type is an Ellipse.
static int TYPE_RECTANGLE
          This Node's type is a Rectangle.
static int TYPE_ROUNDRECT
          This Node's type is a Round Rectangle.
protected  boolean visible
           
 int visibleEdgeCnt
           
 double x
           
 double y
           
 
Constructor Summary
Node()
          Minimal constructor which will generate an ID value from Java's Date class.
Node(java.lang.String id)
          Constructor with the required ID id, using defaults for type (rectangle), color (a static variable from TGPanel).
Node(java.lang.String id, int type, java.awt.Color color, java.lang.String label)
          Constructor with a String ID id, an int type, Background Color bgColor, and a String label.
Node(java.lang.String id, java.lang.String label)
          Constructor with Strings for ID id and label, using defaults for type (rectangle) and color (a static variable from TGPanel).
 
Method Summary
 void addEdge(Edge edge)
          Add the Edge edge to the graph.
 boolean containsPoint(double px, double py)
          Returns true if this Node contains the Point px,py.
 boolean containsPoint(java.awt.Point p)
          Returns true if this Node contains the Point p.
 Edge edgeAt(int index)
          Return the Edge at int index.
 int edgeCount()
          Return the number of Edges in the cumulative Vector.
 int edgeNum()
          Deprecated. this method has been replaced by the edgeCount() method.
 java.awt.Color getBackColor()
          Return the background color of this Node as a Color.
 boolean getFixed()
          Returns true if this Node is fixed (in place).
 java.awt.Font getFont()
          Returns the font of this Node as a Font
 int getHeight()
          Return the height of this Node.
 java.lang.String getID()
          Return the ID of this Node as a String.
 java.lang.String getLabel()
          Return the label of this Node as a String.
 java.awt.Point getLocation()
          Return the location of this Node as a Point.
 java.awt.Color getPaintBackColor(TGPanel tgPanel)
           
 java.awt.Color getPaintBorderColor(TGPanel tgPanel)
           
 java.awt.Color getPaintTextColor(TGPanel tgPanel)
           
 java.awt.Color getTextColor()
          Return the text color of this Node as a Color.
 int getType()
          Return the type of this Node as an int.
 java.lang.String getURL()
           
 int getWidth()
          Return the width of this Node.
 boolean intersects(java.awt.Dimension d)
          Returns true if this Node intersects Dimension d.
 boolean isVisible()
          Return the visibility of this Node as a boolean.
 void paint(java.awt.Graphics g, TGPanel tgPanel)
          Paints the Node.
 void paintNodeBody(java.awt.Graphics g, TGPanel tgPanel)
          Paints the background of the node, along with its label
 void paintSmallTag(java.awt.Graphics g, TGPanel tgPanel, int tagX, int tagY, java.awt.Color backCol, java.awt.Color textCol, char character)
          Paints a tag with containing a character in a small font.
 void removeEdge(Edge edge)
          Remove the Edge edge from the graph.
 void setBackColor(java.awt.Color bgColor)
          Set the background color of this Node to the Color bgColor.
 void setFixed(boolean fixed)
          Set the fixed status of this Node to the boolean fixed.
 void setFont(java.awt.Font font)
          Set the font of this Node to the Font font.
 void setHighlighted(boolean flag)
           
 void setHighlightedAsBoth(boolean flag)
           
 void setHighlightedAsChild(boolean flag)
           
 void setHighlightedAsParent(boolean flag)
           
 void setID(java.lang.String id)
          Set the ID of this Node to the String id.
 void setLabel(java.lang.String label)
          Set the label of this Node to the String label.
 void setLocation(java.awt.Point p)
          Set the location of this Node provided the Point p.
 void setNodeBackDefaultColor(java.awt.Color color)
           
 void setNodeBackFixedColor(java.awt.Color color)
           
 void setNodeBackHilightColor(java.awt.Color color)
           
 void setNodeBackSelectColor(java.awt.Color color)
           
 void setNodeBorderDragColor(java.awt.Color color)
           
 void setNodeBorderInactiveColor(java.awt.Color color)
           
 void setNodeBorderMouseOverColor(java.awt.Color color)
           
 void setNodeTextColor(java.awt.Color color)
           
 void setNodeTextFont(java.awt.Font font)
           
 void setNodeType(int type)
           
 void setTextColor(java.awt.Color txtColor)
          Set the text color of this Node to the Color txtColor.
 void setType(int type)
          Set the type of this Node to the int type.
 void setURL(java.lang.String strUrl)
           
 void setVisible(boolean v)
          Set the visibility of this Node to the boolean v.
 int visibleEdgeCount()
          Returns the local Edge count.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TYPE_RECTANGLE

public static final int TYPE_RECTANGLE
This Node's type is a Rectangle.

See Also:
Constant Field Values

TYPE_ROUNDRECT

public static final int TYPE_ROUNDRECT
This Node's type is a Round Rectangle.

See Also:
Constant Field Values

TYPE_ELLIPSE

public static final int TYPE_ELLIPSE
This Node's type is an Ellipse.

See Also:
Constant Field Values

TYPE_CIRCLE

public static final int TYPE_CIRCLE
This Node's type is a Circle.

See Also:
Constant Field Values

SMALL_TAG_FONT

public static final java.awt.Font SMALL_TAG_FONT

BACK_FIXED_COLOR

public java.awt.Color BACK_FIXED_COLOR

BACK_SELECT_COLOR

public java.awt.Color BACK_SELECT_COLOR

BACK_DEFAULT_COLOR

public java.awt.Color BACK_DEFAULT_COLOR

BACK_HILIGHT_COLOR

public java.awt.Color BACK_HILIGHT_COLOR

BACK_HILIGHT1_COLOR

public java.awt.Color BACK_HILIGHT1_COLOR

BACK_HILIGHT2_COLOR

public java.awt.Color BACK_HILIGHT2_COLOR

BACK_HILIGHT3_COLOR

public java.awt.Color BACK_HILIGHT3_COLOR

BACK_MRF_COLOR

public java.awt.Color BACK_MRF_COLOR

BACK_JML_COLOR

public java.awt.Color BACK_JML_COLOR

BORDER_DRAG_COLOR

public java.awt.Color BORDER_DRAG_COLOR

BORDER_MOUSE_OVER_COLOR

public java.awt.Color BORDER_MOUSE_OVER_COLOR

BORDER_INACTIVE_COLOR

public java.awt.Color BORDER_INACTIVE_COLOR

TEXT_COLOR

public java.awt.Color TEXT_COLOR

TEXT_FONT

public static java.awt.Font TEXT_FONT

DEFAULT_TYPE

public static int DEFAULT_TYPE

typ

protected int typ
an int indicating the Node type.

See Also:
TYPE_RECTANGLE, TYPE_ROUNDRECT, TYPE_ELLIPSE

drawx

public double drawx

drawy

public double drawy

fontMetrics

protected java.awt.FontMetrics fontMetrics

font

protected java.awt.Font font

lbl

protected java.lang.String lbl

backColor

protected java.awt.Color backColor

textColor

protected java.awt.Color textColor

x

public double x

y

public double y

massfade

public double massfade

dx

protected double dx

dy

protected double dy

fixed

protected boolean fixed

highlighted

protected boolean highlighted

highlight_flag

protected int highlight_flag

repulsion

protected int repulsion

justMadeLocal

public boolean justMadeLocal

markedForRemoval

public boolean markedForRemoval

visibleEdgeCnt

public int visibleEdgeCnt

visible

protected boolean visible
Constructor Detail

Node

public Node()
Minimal constructor which will generate an ID value from Java's Date class. Defaults will be used for type and color. The label will be taken from the ID value.


Node

public Node(java.lang.String id)
Constructor with the required ID id, using defaults for type (rectangle), color (a static variable from TGPanel). The Node's label will be taken from the ID value.


Node

public Node(java.lang.String id,
            java.lang.String label)
Constructor with Strings for ID id and label, using defaults for type (rectangle) and color (a static variable from TGPanel). If the label is null, it will be taken from the ID value.


Node

public Node(java.lang.String id,
            int type,
            java.awt.Color color,
            java.lang.String label)
Constructor with a String ID id, an int type, Background Color bgColor, and a String label. If the label is null, it will be taken from the ID value.

See Also:
TYPE_RECTANGLE, TYPE_ROUNDRECT
Method Detail

setNodeBackFixedColor

public void setNodeBackFixedColor(java.awt.Color color)

setNodeBackSelectColor

public void setNodeBackSelectColor(java.awt.Color color)

setNodeBackDefaultColor

public void setNodeBackDefaultColor(java.awt.Color color)

setNodeBackHilightColor

public void setNodeBackHilightColor(java.awt.Color color)

setNodeBorderDragColor

public void setNodeBorderDragColor(java.awt.Color color)

setNodeBorderMouseOverColor

public void setNodeBorderMouseOverColor(java.awt.Color color)

setNodeBorderInactiveColor

public void setNodeBorderInactiveColor(java.awt.Color color)

setNodeTextColor

public void setNodeTextColor(java.awt.Color color)

setNodeTextFont

public void setNodeTextFont(java.awt.Font font)

setNodeType

public void setNodeType(int type)

setID

public void setID(java.lang.String id)
Set the ID of this Node to the String id.


getID

public java.lang.String getID()
Return the ID of this Node as a String.


setLocation

public void setLocation(java.awt.Point p)
Set the location of this Node provided the Point p.


getLocation

public java.awt.Point getLocation()
Return the location of this Node as a Point.


setVisible

public void setVisible(boolean v)
Set the visibility of this Node to the boolean v.


isVisible

public boolean isVisible()
Return the visibility of this Node as a boolean.


setType

public void setType(int type)
Set the type of this Node to the int type.

See Also:
TYPE_RECTANGLE, TYPE_ROUNDRECT, TYPE_ELLIPSE, TYPE_CIRCLE

getType

public int getType()
Return the type of this Node as an int.

See Also:
TYPE_RECTANGLE, TYPE_ROUNDRECT, TYPE_ELLIPSE, TYPE_CIRCLE

setFont

public void setFont(java.awt.Font font)
Set the font of this Node to the Font font.


getFont

public java.awt.Font getFont()
Returns the font of this Node as a Font


setBackColor

public void setBackColor(java.awt.Color bgColor)
Set the background color of this Node to the Color bgColor.


getBackColor

public java.awt.Color getBackColor()
Return the background color of this Node as a Color.


setTextColor

public void setTextColor(java.awt.Color txtColor)
Set the text color of this Node to the Color txtColor.


getTextColor

public java.awt.Color getTextColor()
Return the text color of this Node as a Color.


setLabel

public void setLabel(java.lang.String label)
Set the label of this Node to the String label.


getLabel

public java.lang.String getLabel()
Return the label of this Node as a String.


setFixed

public void setFixed(boolean fixed)
Set the fixed status of this Node to the boolean fixed.


setHighlighted

public void setHighlighted(boolean flag)

setHighlightedAsParent

public void setHighlightedAsParent(boolean flag)

setHighlightedAsChild

public void setHighlightedAsChild(boolean flag)

setHighlightedAsBoth

public void setHighlightedAsBoth(boolean flag)

getFixed

public boolean getFixed()
Returns true if this Node is fixed (in place).


edgeNum

public int edgeNum()
Deprecated. this method has been replaced by the edgeCount() method.

Return the number of Edges in the cumulative Vector.


edgeCount

public int edgeCount()
Return the number of Edges in the cumulative Vector.


visibleEdgeCount

public int visibleEdgeCount()
Returns the local Edge count.


edgeAt

public Edge edgeAt(int index)
Return the Edge at int index.


addEdge

public void addEdge(Edge edge)
Add the Edge edge to the graph.


removeEdge

public void removeEdge(Edge edge)
Remove the Edge edge from the graph.


getWidth

public int getWidth()
Return the width of this Node.


getHeight

public int getHeight()
Return the height of this Node.


intersects

public boolean intersects(java.awt.Dimension d)
Returns true if this Node intersects Dimension d.


containsPoint

public boolean containsPoint(double px,
                             double py)
Returns true if this Node contains the Point px,py.


containsPoint

public boolean containsPoint(java.awt.Point p)
Returns true if this Node contains the Point p.


paint

public void paint(java.awt.Graphics g,
                  TGPanel tgPanel)
Paints the Node.


getPaintBorderColor

public java.awt.Color getPaintBorderColor(TGPanel tgPanel)

getPaintBackColor

public java.awt.Color getPaintBackColor(TGPanel tgPanel)

getPaintTextColor

public java.awt.Color getPaintTextColor(TGPanel tgPanel)

paintNodeBody

public void paintNodeBody(java.awt.Graphics g,
                          TGPanel tgPanel)
Paints the background of the node, along with its label


paintSmallTag

public void paintSmallTag(java.awt.Graphics g,
                          TGPanel tgPanel,
                          int tagX,
                          int tagY,
                          java.awt.Color backCol,
                          java.awt.Color textCol,
                          char character)
Paints a tag with containing a character in a small font.


getURL

public java.lang.String getURL()

setURL

public void setURL(java.lang.String strUrl)