com.touchgraph.graphlayout
Class Node

java.lang.Object
  extended bycom.touchgraph.graphlayout.Node
Direct Known Subclasses:
MMBaseNode

public class Node
extends java.lang.Object

Node.

Version:
1.21 $Id: Node.java,v 1.1.1.1 2004/02/06 08:44:05 keesj Exp $
Author:
Alexander Shapiro, Murray Altheim (2001-11-06; added support for round rects and alternate Node colors)

Field Summary
static java.awt.Color BACK_DEFAULT_COLOR
           
static java.awt.Color BACK_FIXED_COLOR
           
static java.awt.Color BACK_HILIGHT_COLOR
           
static java.awt.Color BACK_SELECT_COLOR
           
protected  java.awt.Color backColor
           
static java.awt.Color BORDER_DRAG_COLOR
           
static java.awt.Color BORDER_INACTIVE_COLOR
           
static 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
           
 boolean justMadeLocal
           
protected  java.lang.String lbl
           
 boolean markedForRemoval
           
protected  int repulsion
           
static java.awt.Font SMALL_TAG_FONT
           
static 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.
 java.util.Iterator getEdges()
          Return an iterator over the Edges in the cumulative Vector, null if it is empty.
 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.
 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 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.
static void setNodeBackDefaultColor(java.awt.Color color)
           
static void setNodeBackFixedColor(java.awt.Color color)
           
static void setNodeBackHilightColor(java.awt.Color color)
           
static void setNodeBackSelectColor(java.awt.Color color)
           
static void setNodeBorderDragColor(java.awt.Color color)
           
static void setNodeBorderInactiveColor(java.awt.Color color)
           
static void setNodeBorderMouseOverColor(java.awt.Color color)
           
static void setNodeTextColor(java.awt.Color color)
           
static void setNodeTextFont(java.awt.Font font)
           
static 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 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 static java.awt.Color BACK_FIXED_COLOR

BACK_SELECT_COLOR

public static java.awt.Color BACK_SELECT_COLOR

BACK_DEFAULT_COLOR

public static java.awt.Color BACK_DEFAULT_COLOR

BACK_HILIGHT_COLOR

public static java.awt.Color BACK_HILIGHT_COLOR

BORDER_DRAG_COLOR

public static java.awt.Color BORDER_DRAG_COLOR

BORDER_MOUSE_OVER_COLOR

public static java.awt.Color BORDER_MOUSE_OVER_COLOR

BORDER_INACTIVE_COLOR

public static java.awt.Color BORDER_INACTIVE_COLOR

TEXT_COLOR

public static 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

dx

protected double dx

dy

protected double dy

fixed

protected boolean fixed

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 static void setNodeBackFixedColor(java.awt.Color color)

setNodeBackSelectColor

public static void setNodeBackSelectColor(java.awt.Color color)

setNodeBackDefaultColor

public static void setNodeBackDefaultColor(java.awt.Color color)

setNodeBackHilightColor

public static void setNodeBackHilightColor(java.awt.Color color)

setNodeBorderDragColor

public static void setNodeBorderDragColor(java.awt.Color color)

setNodeBorderMouseOverColor

public static void setNodeBorderMouseOverColor(java.awt.Color color)

setNodeBorderInactiveColor

public static void setNodeBorderInactiveColor(java.awt.Color color)

setNodeTextColor

public static void setNodeTextColor(java.awt.Color color)

setNodeTextFont

public static void setNodeTextFont(java.awt.Font font)

setNodeType

public static 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.


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.


getEdges

public java.util.Iterator getEdges()
Return an iterator over the Edges in the cumulative Vector, null if it is empty.


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.



Copyright © 2003-2004 SourceForge. All Rights Reserved.