Last Updated: 3/4/97
Class NFDiagram

Class NFDiagram

public class NFDiagram extends NFGraph

The NFDiagram class supports the display of diagrams consisting of labeled regions connected by arrows. It allows the end-user to move the labelled regions around the screen, while maintaining the connectivity defined by the arrows.

Final Variables

Type Name Description
int BOTH Arrows Both Ways
int FROMTO Arrow From Src To Dest
int NONE No Arrow
int TOFROM Arrow From Dest To Src

Constructors

Methods


NFDiagram (Applet app)
Create a new diagram instance.

void addEdge (String from,
              String to,
              Color color) throws Exception
Add an edge between the given nodes. An exception is thrown if either node is not already defined. The default arrow style is used (FROMTO).

void addEdge (String from,
              String to,
              Color color,
              int arrowStyle) throws Exception
Add an edge between the given nodes. An exception is thrown if either node is not already defined.

void addNode (String name,
              String lbl,
              int x,
              int y,
              Color fgcolor,
              Color bgcolor,
              Font font,
              NFActiveLabel activeLabel)
Add a node to the NFDiagram. If the node already exists, it's attributes will be modified.

protected void defineParams ()
This method extends the NFGraph.defineParams() method to define the following diagram parameters:
 	Nodes
 	Edges

void deleteAllEdges () throws Exception
Delete all edges.

void deleteAllNodes () throws Exception
Delete all nodes and all edges

void deleteEdge (String from,
                 String to) throws Exception
Delete all edges from node FROM to node TO

void deleteNode (String name) throws Exception
Delete the given node and any edge going to/from it.

protected void drawGraph (Graphics offg,
                          Rectangle rect)
Draw the diagram in the given graphics context and rectangle.

protected void loadParams () throws Exception
This method extends the NFGraph.loadParams() method to load the parameters defined in the defineParams method.

synchronized boolean mouseDown (Event evt,
                                int x,
                                int y)
This method should be used to service a mouseDown event.

synchronized boolean mouseDrag (Event evt,
                                int x,
                                int y)
This method should be used to service a mouseDrag event.

synchronized boolean mouseUp (Event evt,
                              int x,
                              int y)
This method should be used to service a mouseUp event.

void setColor (String name,
               Color fgcolor,
               Color bgcolor) throws Exception
Set the colors for the node with the given name.

void setFont (String name,
              Font font) throws Exception
Set the font for the node with the given name.

void setLabel (String name,
               String lbl) throws Exception
Set the label for the node with the given name.

void setPos (String name,
             int x,
             int y) throws Exception
Set the center position for the node with the given name.