Inserting Nodes Into The Tree


In 1 Awesome Java Tree, every node is defined by its own parameter in the APPLET tag. The formal syntax is:

<PARAM NAME="node location in the tree hierarchy" VALUE="caption^URL^target frame^status bar text^inactive bullet image^active bullet image^expanded bullet image">

The NAME attribute

Every node in the tree hierarchy has its own name. The node's name will indicate its location in the hierarchy. All node names begin with "node" followed by an underscore and the index of the node on that level level.

For example, the first node in the tree must be named "node_0", the second node is named "node_1" the third node "node_2" and so on. The first child of "node_0" must be "node_0_0", the second child is "node_0_1", and so on. Hence the level on which a node resides is determined by the number of underscores in the node's name. The number following the last underscore represents the index of the node on that level.

Here is a diagram to give you a better idea:

The VALUE attribute

In the above diagram, Node 5 is defined as follows:

<PARAM NAME="node_5" VALUE="Node 5^index.htm^main^This is Node 5^arrow.gif^arrow.gif^arrow2.gif">

Lets examine the VALUE attribute in detail. Note that the string elements are separated by the "^" symbol. This symbol is used as a delimiter. The format of the VALUE attribute is as follows:

1) The first element "Node 5" is the caption of the node and will be displayed inside the node. The coloring of the caption is controlled by the defNodeColor, activeNodeColor, and clickedNodeColor parameters. For details on these parameters, see the Parameters Overview section.

2) The second element is the URL of the document to load when the node is clicked. Relative URLs can be used as seen in the above example. For instance, "product/index.htm" or "../home.htm". This element can also be used to open up the mail client to send e-mails. For example, if you want the user to send an e-mail to you when he/she clicks on the node, set URL to "mailto:yourcompany@mailhost.com" where "yourcompany@mailhost.com" is your e-mail address.

3) The third element is the name of the target frame in which to load the document specified by the URL. When usng 1 Awesome Java Tree as a site navigation tool, you can place the applet in the left frame and the actual viewing area in the right frame. When the user clicks on a node, the document will be displayed in the right frame.

The name of a frame is given by its NAME attribute. For example, the HTML code for a frame named "main" could be:

<FRAME NAME="main" SRC="home.htm">

The font style for the caption is controlled by the fontstyle parameter, while the size is controlled by the fontsize parameter.

4) The fourth element is the status bar text. The string will be displayed in the web browser's status bar.

5) The fifth element is the URL of the bullet image for inactive nodes. Nodes are said to be inactive when the mouse pointer is not over it and it is not clicked.

6) The sixth element is the URL of the bullet image for expanded nodes.

7) The seventh element is the URL of the bullet image for active nodes. A node is active when the mouse pointer is over it.

Special Node Behaviours

1) When a node is expanded, only its expanded bullet image will be displayed, even if the mouse pointer moves over it.

2) Leave nodes (nodes without children) do not have an expanded state. Hence their expanded bullet image will not be used.