All Packages Class Hierarchy This Package Previous Next Index
Class MSBTree.RTreeApplet
- public class RTreeApplet
- extends Applet
The RTreeApplet is a thin layer on the RTreeList class that allows you to use
the RTreeList as an applet in a web page. The parameters for the applet are:
Parameters of the applet
Allmost all parameters are Strings or Integers, however the are some special
cases:
- Colors: valid values are:
RED,BLUE,GREEN,BLACK,GRAY,LIGHTGRAY,WHITE,DARKGRAY,YELLOW,ORANGE,CYAN and
MAGENTA. You can also use the numerical value of a color as parameter.
- Fonts have the format <font name>|<style>|<size>.
Style can be PLAIN, ITALIC or BOLD. Example: "Arial|BOLD|12"
The parameters of the applet are:
- MINUS_ICON: Image used instead of the signed - when the node is
expanded.
- PLUS_ICON: Image used instead of the signed + when the node is not
expanded.
- SHOW_ROOT: If "Y" then the root of the tree will be
displayed, it not, it will be hidden.
- TREE_ANIMATION: This parameter defines how the initial animation is
going to be. Valid values are:
NO: there will be no animation
TOP: the tree will come from the top a will scroll down.
BOTTOM: the tree will come from the bottom a will scroll up.
LEFT: the tree will come from the left a will scroll right.
RIGHT: the tree will come from the right a will scroll left.
- TREE_ANIMATION_DELAY: time in milliseconds between scenes of the
initial animation.
- TREE_BACK_COLOR: background color of the tree.
- TREE_BACK_IMAGE: background image for the tree.
- TREE_BORDER: type of border. Valir values are:
NO,RAISED,LOWERED,LINE,LINE2,SHADOW and DOUBLE.
- TREE_BORDER_COLOR: color of the border.
- TREE_BOX_COLOR: color of the box used to display the tips. The
default value is BLACK.
- TREE_EXPAND_MODE. Valid values are:
ON_CLICK: a node will be expanded only when the user clicks on it
ON_ENTER: a node will be automatically expanded when the cursor is on it.
- TREE_DRAW_LINE: Valid values are "Y" or "N". If
"N" then no lines will be displayed between a node an its children.
- TREE_DRAW_PLUS_MINUS: Valid values are "Y" or
"N". It "Y" then the tree will display a + sign next to
collapsed nodes and a - signe next to expanded nodes.
- TREE_ICON_WIDTH: width in pixels of the space reserved for the icon.
- TREE_ITEM_HEIGHT. Height of the nodes of the tree. The default
value is 20 (in pixels).
- TREE_LOADING_FONT: Font to be used for the text displayed when the tree is
loading a definition file or images.
- TREE_LOADING_IMAGE: Image to be displayed when the tree is
loading a definition file or images.
- TREE_LOADING_TEXT: This is the text to be displayed when the tree is
loading a definition file or images. The default value is "Loading...";
- TREE_LEFT_MARGIN. In pixels.
- TREE_LINE_COLOR: color of the lines in the tree. The default value
is BLACK.
- TREE_LINE_TYPE: This is the type of line used to link a node and
its children. Valid values as NORMAL, DASHED or DOTS.
- TREE_OPEN_TEXT: This is the text to be displayed when the tree is
opening a link after the user double-clicks a node. The default value is
"Opening URL...";
- TREE_PAGE_BACK_COLOR: background color of the page where the applet
is.
- TREE_SCROLL_COLOR: background color of the scroll bar.
- TREE_TAB: This is the left margin of the children of a node. The
default value is 20. This means that children will be displayes 10 pixes to
the right of the parent.
- TREE_TARGET: target frame of the HTML page. Valid values are:
"_self", "_parent","_top", "_blank"
or <frame name>. This is the default used if it is not otherwise
specified at the node level.
- TREE_TIP_BACK_COLOR: background color of the tips. The default
value is YELLOW.
- TREE_TIP_COLOR: text color of the tips.
- TREE_TIP_DELAY: This is the number of milliseconds the tree is
going to wait before showing the tip of the current node.
- TREE_TIP_FONT: text font of the tips.
- TREE_TOP_MARGIN. In pixels.
The following parameters define default values for the nodes:
- NODE_BACK_COLOR: background color of the node.
- NODE_BACK_IMAGE: background image of the nodes.
- NODE_BACK_SELECTED_COLOR: background color when the node is
selected.
- NODE_CENTER_TEXT: center text of the nodes.
- NODE_COLOR: color of the texts.
- NODE_EXPANDED_ICON: icon when the node is expanded.
- NODE_ICON: icon of the node.
- NODE_FONT: font of the text..
- NODE_RAISED: if "Y" the node will displayed a "raised"
effect when it is selected.
- NODE_SELECTED_COLOR: color of the text when the node is selected.
The following parameters define the value for a given node. The * must be
substituted by the node's name. If the parameters are used in Javascript or in a
definition file the *_ should not be included:
- *_BACK_IMAGE: background image of the node.
- *_CENTER_TEXT: center text of the node.
- *_BACK_COLOR: background color of the node.
- *_BACK_SELECTED_COLOR: background color when the node is selected.
- *_COLOR: color of the texts.
- *_DATA_FILE: file where the definition of the children of this node
can be found.
- *_EXPANDED: Valid values are "Y" or "N".
- *_EXPANDED_ICON: icon when the node is expanded.
- *_ICON: icon of the node.
- *_FONT: font of the text..
- *_LINK: URL to open when the user double-clicks the node.
- *_RAISED: if "Y" the node will displayed a "raised"
effect when it is selected.
- *_SELECTED_COLOR: color of the text when the node is selected.
- *_TARGET: target frame of the HTML page. Valid values are: "_self",
"_parent","_top", "_blank" or <frame name>.
- *_TEXT: text for this node.
- *_TIP: tip for this node.
The following parameters will allow you to execute JavaScript functions when
something happens:
- TREE_ON_ENTER: This function will be executed when the mouse enters the
menu. It has no parameters.
- TREE_ON_EXIT: This function will be executed when the mouse exits the menu.
It has no parameters.
- TREE_ON_LOAD: This function will be executed applet is loading nodes and
images.
- TREE_ON_LOAD_END: This function will be executed the applet has finished
loading nodes and images..
- TREE_ON_SELECT: This function will be executed when the mouse is over a
node. The function will receive as parameter, the node's name.
- TREE_ON_EXPAND: This function will be executed when the user expands a
node. The function will receive as parameter, the node's name.
- TREE_ON_DBL_CLICK: This function will be executed when the user
double-clicks a node. The function will receive as parameter, the node's
name.
See the file Example3.html to see an example of these parameters.
Loading from files
The data for a node or tree can also be loaded from a text file instead of
using the parameters of the applet. The advantadge of this approach is:
- You can change the menu in you HTML page without modifing the HTML file.
- The tree's nodes will be loaded dynamically. Only when the node is
expanded its children will be created.
- In the case of a big menu using parameters would result in a big HTML file.
The structure of the file is very simple; each file contains the
definition of the children of one node only. Each line in the file contains
one command. The command can be:
- CHILD=<new node's name> to create a new child
- <parameter's name>=<parameter's value> to assign a vaue to the
child.
For example:
CHILD=Index
ICON=car1.gif
SELECTED_ICON=car2.gif
DATA_FILE=file://www.myserver/IndexNodes.txt
TEXT=Index
CHILD=Features
.
.
.
This file creates a new node called "Index". The following 4 lines contain some parameters for this node. This parameters have the same
name as those used in the applet parameters (without the *_). Note that the children of the node
"index" will be defined in the file "IndexNodes.txt".
Javascript
It is also possible to change teh appearance of the tree from Javascript (See
the file Example1.html to see an example of this). The following methods can be accessed from javascript :
clearTree
public void clearTree(String nodeName)
deletes the children of the node.
loadNode
public void loadNode(String nodeName,
String sFile)
loads the children of the node nodename from the file sFile.
refreshTree
public void refreshTree()
repaints the tree. The Javascript should call this after using other functions in other methods.
setParam
public void setParam(String nodeName,
String Param,
String Value)
Sets a parameter for a node. This methods allows the configuration of the applet from
javascript. For example, in order to change the icon of a node called
"node1":
javascript:document.tree.setParam('node1','ICON','newicon.gif');
In the example "tree" is the name of the applet.
All Packages Class Hierarchy This Package Previous Next Index