|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.touchgraph.graphlayout.Node
org.ceryle.graph.GraphNode
public class GraphNode
An extension of Node acting
as a graph node for display of an extended TouchGraph graph.
| Field Summary | |
|---|---|
static Color |
COLOR_BORDER_DRAG
The border color of a dragged node. |
static Color |
COLOR_BORDER_FIXED
The color of fixed generic nodes. |
static Color |
COLOR_BORDER_INACTIVE
The border color of inactive nodes. |
static Color |
COLOR_BORDER_MOUSE_OVER
The border color of a mouse-over'd node. |
static Color |
COLOR_DEFAULT_NODE
The color of generic nodes. |
static Color |
COLOR_FIXED_NODE
The color of fixed generic nodes. |
static Color |
COLOR_HILIGHTED_NODE
The color of hilighted nodes. |
static Color |
COLOR_NEW_LOCAL_NODE
The color of a node just made local. |
static Color |
COLOR_NODE_DOWNSTREAM
The border color of nodes downstream (following directed edges) from a specific node. |
static Color |
COLOR_NODE_REMOVAL
The color of a node just prior to removal. |
static Color |
COLOR_NODE_TEXT
The color of node text. |
static Color |
COLOR_NODE_UPSTREAM
The border color of nodes upstream (against directed edges) from a specific node. |
static Color |
COLOR_PROVISIONAL
The background color of provisional (i.e., temporary) nodes. |
static Color |
COLOR_SELECT_NODE
The color of the selected node. |
static Color |
COLOR_SELECT_NODE_B
|
static Color |
COLOR_SELECT_NODE_D
|
static Color |
COLOR_SMALL_TAG
The color of the small tag's background (the foreground text will be white). |
static Color |
COLOR_TRANSLUCENT_GRAY
The background color of pinned nodes' small tag. |
static int |
defaultMargin
Default margin, in pixels. |
protected static String |
Ellipsis
|
protected FontMetrics |
fontMetrics
|
protected int |
h
|
protected boolean |
hidden
Hidden status of this GraphNode. |
protected Color |
hilight
|
static int |
hMargin
Horizontal margin, in pixels. |
protected MouseListener |
m_listener
|
static int |
maxHeight
Maximum height, in pixels (default is 80). |
static int |
maxLabelLength
An int acting as the character limit for node labels. |
static int |
maxWidth
Maximum width, in pixels (default is 2000). |
static int |
minHeight
Minimum height, in pixels (default is 10). |
static int |
minWidth
Minimum width, in pixels (default is 10). |
boolean |
outlined
When true, the GraphNode is drawn with an extra outline border. |
protected boolean |
provisional
Provisional status of this GraphNode. |
double |
rel_angle
Relative angle, used in calculating the angle between nodes. |
static boolean |
sortCaseSensitive
A boolean controlling whether the compareTo(Object) implementation
of the Comparable interface when sorting by Node label should be done in case
sensitive (true) or insensitive (false) mode. |
static BasicStroke |
STROKE_OUTLINE
The stroke used to draw the outline hilight. |
protected static BasicStroke |
STROKE_PROVISIONAL
Stroke for drawing provisional (temporary) nodes. |
static boolean |
use3D
A boolean controlling use of 3D versus flat style nodes. |
static int |
vMargin
Vertical margin, in pixels. |
protected int |
w
|
| Fields inherited from class com.touchgraph.graphlayout.Node |
|---|
BACK_DEFAULT_COLOR, BACK_FIXED_COLOR, BACK_HILIGHT_COLOR, BACK_SELECT_COLOR, backColor, BORDER_DRAG_COLOR, BORDER_INACTIVE_COLOR, BORDER_MOUSE_OVER_COLOR, DEFAULT_TYPE, drawx, drawy, dx, dy, edges, fixed, font, justMadeLocal, lbl, markedForRemoval, massfade, repulsion, simpleDraw, SMALL_TAG_FONT, TEXT_COLOR, TEXT_FONT, textColor, typ, TYPE_CIRCLE, TYPE_ELLIPSE, TYPE_RECTANGLE, TYPE_ROUNDRECT, visible, visibleEdgeCnt, x, y |
| Constructor Summary | |
|---|---|
GraphNode()
Minimal constructor which throws an Exception, given that unlike TouchGraph Nodes, all GraphNodes must have an ID. |
|
GraphNode(int type,
String id,
String label,
Color color)
Constructor with Strings for ID id and label, using defaults for type (rectangle) and color (a static variable from TGPanel). |
|
| Method Summary | |
|---|---|
int |
compareTo(Object o)
Implements the Comparable interface to compare this GraphNode with another. |
static Font |
getDefaultNodeFont()
Returns the default font. |
int |
getHeight()
Overrides Node's method by returning the calculated height of this GraphNode. |
Color |
getHilight()
Returns the hilight Color of this GraphNode. |
String |
getID()
Returns the ID of this GraphNode. |
String |
getLabel()
Overrides com.touchgraph.graphlayout.Node's method to return the label of this Node as a String, substituting an ellipsis should the length of the label exceed maxLabelLength. |
MouseListener |
getMouseListener()
Returns the single MouseListener, null if it has not been set. |
Font |
getNodeFont()
Returns the currently-used font for this GraphNode. |
Color |
getPaintBackColor(TGPanel tgPanel)
Returns the background color of the node, dependent on context. |
Color |
getPaintBorderColor(TGPanel tgPanel)
Returns the border color of the node, dependent on context. |
int |
getVerticalTweak()
Returns a vertical text descent tweaking value based on the supplied font. |
static int |
getVerticalTweak(int fontsize)
Returns a vertical text descent tweaking value based on the supplied font size. |
int |
getWidth()
Overrides Node's method by returning the calculated width of this GraphNode. |
boolean |
isHidden()
Returns the hidden status of this GraphNode. |
boolean |
isProvisional()
Returns the provisional status of this GraphNode. |
void |
jubble(int distance)
Randomly moves the GraphNode horizontally and vertically within the limits set by the int distance. |
void |
paint(Graphics g,
TGPanel tgPanel)
Overrides Node's method, paying attention to "hidden" status. |
void |
paintNodeBody(Graphics g,
TGPanel tgPanel)
Overrides Node's method, painting the background of the node, along with its label. |
void |
paintProvisional(Graphics g,
TGPanel tgPanel)
Paints the body of this node as an outline. |
void |
paintSimple(Graphics g,
TGPanel tgPanel)
Paints the body of this node as an simple square. |
void |
paintSmallTag(Graphics g,
TGPanel tgPanel,
int tagX,
int tagY,
Color backCol,
Color textCol,
char character)
Overrides Node's method using a color property from GraphLayoutPanel. |
void |
setAlternateFont(Font font)
Sets the optional alternate font for this Node to the supplied Font. |
void |
setFixed(boolean fixed,
Point p)
Sets the fixed status of this GraphNode to the boolean fixed, fixing it at the provided Point p. |
void |
setHidden(boolean hidden)
Sets the hidden status of this GraphNode to the boolean hidden. |
void |
setHilight(Color hilight)
Sets the hilight of this node to the Color hilight. |
void |
setMargin(int margin)
Sets the horizontal and vertical margins of this GraphNode to the int margin. |
static void |
setMaximumLabelLength(int max)
Sets the maximum length of a Node label to the int max. |
void |
setMouseListener(MouseListener listener)
Sets the single MouseListener to listener. |
static void |
setNodeTagFont(Font font)
Extends Node to allow setting of the small tag font to the Font font. |
static void |
setNodeTextFont(Font font)
Passes the font change on to the superclass, sets the vertical tweaking, and the big font size. |
void |
setProvisional(boolean provisional)
Sets the provisional status of this GraphNode to the boolean provisional. |
protected void |
setSize(Graphics g)
Sets the internal width and height variables based on current properties. |
static void |
setVerticalTweak(int fontsize)
Sets the vertical text descent tweaking based on the supplied font size. |
String |
toString()
Returns the String representation of this GraphNode, ie., its label. |
| Methods inherited from class com.touchgraph.graphlayout.Node |
|---|
addEdge, containsPoint, containsPoint, deleteEdges, edgeAt, edgeCount, edgeNum, getBackColor, getEdges, getFixed, getFont, getLocation, getPaintTextColor, getTextColor, getType, hasEdge, intersects, isFixed, isVisible, removeEdge, setBackColor, setFixed, setFont, setID, setLabel, setLocation, setLocation, setNodeBackDefaultColor, setNodeBackFixedColor, setNodeBackHilightColor, setNodeBackSelectColor, setNodeBorderDragColor, setNodeBorderInactiveColor, setNodeBorderMouseOverColor, setNodeTextColor, setNodeType, setTextColor, setType, setVisible, visibleEdgeCount |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static Color COLOR_DEFAULT_NODE
public static Color COLOR_NODE_TEXT
public static Color COLOR_FIXED_NODE
public static Color COLOR_BORDER_FIXED
public static Color COLOR_HILIGHTED_NODE
public static Color COLOR_NEW_LOCAL_NODE
public static Color COLOR_BORDER_DRAG
public static Color COLOR_BORDER_MOUSE_OVER
public static Color COLOR_NODE_REMOVAL
public static Color COLOR_SELECT_NODE
public static Color COLOR_SELECT_NODE_D
public static Color COLOR_SELECT_NODE_B
public static Color COLOR_BORDER_INACTIVE
public static Color COLOR_NODE_DOWNSTREAM
public static Color COLOR_NODE_UPSTREAM
public static Color COLOR_SMALL_TAG
public static Color COLOR_PROVISIONAL
public static Color COLOR_TRANSLUCENT_GRAY
public static boolean sortCaseSensitive
compareTo(Object) implementation
of the Comparable interface when sorting by Node label should be done in case
sensitive (true) or insensitive (false) mode. The default is false.
public static boolean use3D
public static int maxLabelLength
public double rel_angle
protected boolean hidden
protected boolean provisional
public static int defaultMargin
public static int hMargin
public static int vMargin
public static int minHeight
public static int minWidth
public static int maxWidth
public static int maxHeight
protected static final BasicStroke STROKE_PROVISIONAL
public static final BasicStroke STROKE_OUTLINE
public boolean outlined
protected FontMetrics fontMetrics
protected static String Ellipsis
protected int h
protected int w
protected Color hilight
protected MouseListener m_listener
| Constructor Detail |
|---|
public GraphNode()
throws GraphException
GraphException
public GraphNode(int type,
String id,
String label,
Color color)
throws GraphException
GraphException| Method Detail |
|---|
public void setMouseListener(MouseListener listener)
public MouseListener getMouseListener()
public static void setMaximumLabelLength(int max)
public static void setNodeTextFont(Font font)
public int getVerticalTweak()
public static int getVerticalTweak(int fontsize)
public static void setVerticalTweak(int fontsize)
public String getID()
getID in class Nodepublic boolean isHidden()
public void setHidden(boolean hidden)
public boolean isProvisional()
public void jubble(int distance)
public void setProvisional(boolean provisional)
public String getLabel()
maxLabelLength.
getLabel in class Nodepublic void setMargin(int margin)
protected void setSize(Graphics g)
public int getWidth()
getWidth in class Nodepublic int getHeight()
getHeight in class Nodepublic void setAlternateFont(Font font)
public Font getNodeFont()
public static Font getDefaultNodeFont()
public static void setNodeTagFont(Font font)
public void setFixed(boolean fixed,
Point p)
<?ceryle_node_loc 233,-178 ?>
The PI target is specified by the constant NODE_LOC_INDICATOR.
p is ignored if fixed is false.
public void setHilight(Color hilight)
public Color getHilight()
public void paint(Graphics g,
TGPanel tgPanel)
paint in class Node
public void paintNodeBody(Graphics g,
TGPanel tgPanel)
paintNodeBody in class Node
public void paintSimple(Graphics g,
TGPanel tgPanel)
public void paintProvisional(Graphics g,
TGPanel tgPanel)
public Color getPaintBorderColor(TGPanel tgPanel)
getPaintBorderColor in class Nodepublic Color getPaintBackColor(TGPanel tgPanel)
getPaintBackColor in class Node
public void paintSmallTag(Graphics g,
TGPanel tgPanel,
int tagX,
int tagY,
Color backCol,
Color textCol,
char character)
paintSmallTag in class Nodepublic int compareTo(Object o)
If rel_angle has been set, This is based on relative position (in degrees) from another GraphNode (no other sorting methods have been seen necessary, yet). It's assumed that this comparison is only made when both nodes have a set angle (default is zero). If only one is set, returns 0.
compareTo in interface ComparableClassCastException - if the supplied Object is not a GraphNodepublic String toString()
toString in class Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||