All Packages Class Hierarchy This Package Previous Next Index
Class MSBTree.RMenuApplet
- public class RMenuApplet
- extends Applet
The RMenuApplet is a thin layer on the RMenu class that allows you to
use the RMenuas 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:
- TREE_ANIMATION_DELAY: time in milliseconds between scenes of
the initial animation.
- TREE_BACK_COLOR: background color of the menu.
- TREE_BACK_IMAGE: background image for the menu.
- 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_INTERNAL_MARGIN: space between the border of the menu and
the items.
- TREE_ITEM_HEIGHT. Height of the nodes of the menu. The default
value is 20 (in pixels).
- TREE_ITEM_WIDTH. Width of the nodes of the menu.The default
value is 100 (in pixels).
- TREE_ITEMS_ALIGN: how items are going to be aligned on a horizontal
menu. (LEFT, RIGHT or CENTER).
- TREE_ITEMSX: x coordinates of the items for a menu of type "DEFINED".
The coordinates will be separed by | (e.g. "10|30|10").
- TREE_ITEMSY: y coordinates of the items for a menu of type "DEFINED".
The coordinates will be separed by | (e.g. "10|30|10").
- 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 menu is loading
a definition file or images.
- TREE_LOADING_TEXT: This is the text to be displayed when the
menu is loading a definition file or images. The default value is "Loading...";
- TREE_LEFT_MARGIN. In pixels.
- 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_MENU_TYPE: Type of menu: VERTICAL, HORIZONTAL (see
TREE_ITEMS_ALIGN ) and DEFINED (see TREE_ITEMSX and TREE_ITEMSY).
- 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_SEPARATOR: separator of items in a horizontal menu.
- TREE_SUBMENU_ICON: maged used to signal that there is a submenu.
- 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_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.
- NODE_SUBMENUCOLOR: Color of the background of this node's submenu.
- NODE_SUBMENU_INVERTED: is this node'submenu to be inverted.
An inverted menu is display from bottom to top. Valid values are "N"
and "Y".
- NODE_SUBMENU_BORDER_COLOR: Color of the border of this node's
submenu.
- NODE_SUBMENU_BORDER: type of border of this node's submenu. Valid
values are "NO", "LINE" and "RAISED".
- NODE_SUBMENU_IMAGE: background image of the submenu.
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.
- *_SUBMENUCOLOR: see NODE_SUBMENUCOLOR;
- *_SUBMENU_INVERTED: see NODE_SUBMENU_INVERTES;
- *_SUBMENU_BORDER_COLOR: see NODE_SUBMENU_BORDER_COLOR;
- *_SUBMENU_BORDER: see NODE_SUBMENU_BORDER;
- *_SUBMENU_IMAGE: see NODE_SUBMENU_IMAGE;
- *_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 menu 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 menu'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 menu 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