com.java4less.rtree
Class RTreeApplet

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Panel
                    |
                    +--java.applet.Applet
                          |
                          +--com.java4less.rtree.RTreeApplet
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class RTreeApplet
extends java.applet.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:

The parameters of the applet are:

The following parameters define default values for the nodes:

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:

 

The following parameters will allow you to execute JavaScript functions when something happens:

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:

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:

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 :

See Also:
Serialized Form

Inner Class Summary
 class RTreeApplet.borderCanvas
           
 
Field Summary
static int BORDER_DOUBLE
           
static int BORDER_LINE
           
static int BORDER_LINE2
           
static int BORDER_LOWERED
           
static int BORDER_RAISED
           
static int BORDER_SHADOW
           
 java.awt.Color borderColor
           
 int borderType
          type of the border of the applet
static int NO_BORDER
           
 java.awt.Color pageBackColor
          if you use border type BORDER_SHADOW, this must be the same color as the background of the HTML page
 java.awt.Panel simulator
          internal, for Rtree Visual Designer only
 RTreeList tree
          tree
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
RTreeApplet()
           
 
Method Summary
 void clearTree(java.lang.String nodeName)
           
 java.lang.String getNodeParent(java.lang.String nodeName)
           
 java.lang.String getNodeProperty(java.lang.String nodeName, java.lang.String sParam)
           returns the property of the node.
 java.lang.String getNodeText(java.lang.String nodeName)
          return node's text
 java.lang.String getNodeTip(java.lang.String nodeName)
           
 java.lang.String getSelectedNode(int i)
          get the selected node at the specific index.(index range from 1 to getSelectionCount()-1)
 int getSelectionCount()
          get number of selected nodes
 void init()
           
 void loadNode(java.lang.String nodeName, java.lang.String sFile)
          loads the children of the node nodename from the file sFile.
 void refreshTree()
          repaints the tree.
 void resizeTree()
           
 void setBorderBackground()
           
 void setBounds(int x1, int y1, int w, int h)
           
 void setParam(java.lang.String nodeName, java.lang.String Param, java.lang.String Value)
          Sets a parameter for a node.
 void start()
           
 void stop()
           
 
Methods inherited from class java.applet.Applet
destroy, getAccessibleContext, getAppletContext, getAppletInfo, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, getParameterInfo, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus
 
Methods inherited from class java.awt.Panel
addNotify
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, remove, remove, removeAll, removeContainerListener, removeNotify, setFont, setLayout, update, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, disable, dispatchEvent, enable, enable, enableInputMethods, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getInputContext, getInputMethodRequests, getLocation, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, setBackground, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

tree

public RTreeList tree
tree

NO_BORDER

public static final int NO_BORDER

BORDER_LINE

public static final int BORDER_LINE

BORDER_RAISED

public static final int BORDER_RAISED

BORDER_LOWERED

public static final int BORDER_LOWERED

BORDER_DOUBLE

public static final int BORDER_DOUBLE

BORDER_SHADOW

public static final int BORDER_SHADOW

BORDER_LINE2

public static final int BORDER_LINE2

borderType

public int borderType
type of the border of the applet

pageBackColor

public java.awt.Color pageBackColor
if you use border type BORDER_SHADOW, this must be the same color as the background of the HTML page

borderColor

public java.awt.Color borderColor

simulator

public java.awt.Panel simulator
internal, for Rtree Visual Designer only
Constructor Detail

RTreeApplet

public RTreeApplet()
Method Detail

setParam

public void setParam(java.lang.String nodeName,
                     java.lang.String Param,
                     java.lang.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.


clearTree

public void clearTree(java.lang.String nodeName)

getSelectionCount

public int getSelectionCount()
get number of selected nodes

getSelectedNode

public java.lang.String getSelectedNode(int i)
get the selected node at the specific index.(index range from 1 to getSelectionCount()-1)

getNodeText

public java.lang.String getNodeText(java.lang.String nodeName)
return node's text

getNodeTip

public java.lang.String getNodeTip(java.lang.String nodeName)

getNodeParent

public java.lang.String getNodeParent(java.lang.String nodeName)

getNodeProperty

public java.lang.String getNodeProperty(java.lang.String nodeName,
                                        java.lang.String sParam)
returns the property of the node. Supported properties are:

setBounds

public void setBounds(int x1,
                      int y1,
                      int w,
                      int h)
Overrides:
setBounds in class java.awt.Component

loadNode

public void loadNode(java.lang.String nodeName,
                     java.lang.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.

resizeTree

public void resizeTree()

init

public void init()
Overrides:
init in class java.applet.Applet

stop

public void stop()
Overrides:
stop in class java.applet.Applet

start

public void start()
Overrides:
start in class java.applet.Applet

setBorderBackground

public void setBorderBackground()