com.java4less.rtree
Class RTreeList
java.lang.Object
|
+--java.awt.Component
|
+--java.awt.Container
|
+--java.awt.Panel
|
+--com.java4less.rtree.RTreeList
- All Implemented Interfaces:
- javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.lang.Runnable, java.io.Serializable
- public class RTreeList
- extends java.awt.Panel
- implements java.lang.Runnable
Warning: This documentation is only for java programmers. If you are just using the Applet in a HTML page, please read Class RTreeApplet.
The RTreeList is a subclass of Panel. Therefore you can add it to any container in your java application. In order to create a tree you must follow these steps:
1. Create tree and add it to a container.
2. Create nodes and add them to the tree. You can:
2.1 add a node to the first level with the method addFirstLevelNode().
2.2 or add the node to another node.
3 You can also read the definition of the tree from a file like this: tree.createTreeFromFile(tree.Root,). See documention of the applet for details Class RTreeApplet about the parameters in the file.
4 Start the tree. The tree implements the Runnable interface in other to be able to run the initial animation, for this reason you must start it like this: new Thread(tree).start();
- See Also:
- Serialized Form
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 |
Method Summary |
void |
addFirstLevelNode(RNode n)
adds the node to the root. |
void |
clear(RNode n)
deletes the children of the node. |
void |
collapseNodes(RNode n)
|
java.awt.Color |
convertColor(java.lang.String c)
converts a color parameter (as string) to a color class. |
java.awt.Font |
convertFont(java.lang.String f)
converts a font parameter (as string) to a Font class. |
int |
countNodesToDraw(RNode n,
java.awt.Graphics g,
int[] maxX)
number of visible nodes |
void |
createTreeFromFile(RNode startNode,
java.lang.String sFile)
processes the file sfile. |
void |
createTreeFromParameters(java.applet.Applet pApplet)
create the tree using the parameters of the applet. |
void |
drawLineWithStyle(java.awt.Graphics g,
int x1,
int y1,
int x2,
int y2,
int lineType)
|
void |
drawNode(java.awt.Graphics g,
RNode n,
int level,
boolean redrawChildren)
|
void |
expandASC(RNode n,
boolean b)
|
void |
expandNode(java.lang.String Name,
boolean expand)
Expands or collapses a node. |
RNode |
findNode(RNode n,
java.lang.String Name)
find a node by name. |
java.lang.String |
getImageFile(java.awt.Image img)
|
RNode |
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 |
java.awt.Image |
loadImageUrl(java.lang.String urlAdd)
|
void |
paint(java.awt.Graphics g)
|
void |
processParameter(RNode currentNode,
java.lang.String ParamName,
java.lang.String ParamValue)
process a parameter. |
void |
refresh()
force redrawing |
void |
resizeAndPaint()
|
void |
run()
starts the tree. |
void |
setNodeDefaults(RNode n)
|
Methods inherited from class java.awt.Panel |
addNotify, getAccessibleContext |
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, 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, getLocale, 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, resize, resize, setBackground, setBounds, 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 |
appletWidth
public int appletWidth
- size of the applet for the designer
appletHeight
public int appletHeight
changeCursor
public boolean changeCursor
- change cursor's icon
selCursor
public java.awt.Cursor selCursor
- drag and drpp cursor
dropCursor
public java.awt.Cursor dropCursor
backImage
public java.awt.Image backImage
- background image of the tree.
EXPAND_ON_CLICK
public static final int EXPAND_ON_CLICK
- expand nodes when the user clicks on them.
EXPAND_ON_ENTER
public static final int EXPAND_ON_ENTER
- expand nodes when the mouse enters them.
expandOn
public int expandOn
- specifies how the nodes are going to be expanded. Valid values are EXPAND_ON_CLICK or EXPAND_ON_ENTER.
NO_ANIMATION
public static final int NO_ANIMATION
- no initial animation is performed
ANIMATION_FROM_TOP
public static final int ANIMATION_FROM_TOP
- the tree will come from the top of the panel and will scroll down.
ANIMATION_FROM_BOTTOM
public static final int ANIMATION_FROM_BOTTOM
- the tree will come from the bottom of the panel and will scroll up.
ANIMATION_FROM_LEFT
public static final int ANIMATION_FROM_LEFT
- the tree will come from left side of the panel and will scroll right.
ANIMATION_FROM_RIGHT
public static final int ANIMATION_FROM_RIGHT
- the tree will come from right side of the panel and will scroll left.
LINE_NORMAL
public static final int LINE_NORMAL
- Lines from a nodes and its children will be solid.
LINE_DOTS
public static final int LINE_DOTS
- Lines from a nodes and its children will be made of dots.
LINE_DASHED
public static final int LINE_DASHED
- Lines from a nodes and its children will be made of short lines.
lineType
public int lineType
- specifies what kind of line will be used to link a node and its descendants. Valid values are LINE_* contants.
tipDelay
public int tipDelay
- specifies the number of milliseconds the tree will wait before showing a tip for the current node.
animation
public int animation
animationDelay
public int animationDelay
- Specifies time (in milliseconds) between scenes in the initial animation.
loadingText
public java.lang.String loadingText
- this text will be shown to the user while definition files or applet parameters are read.
openingURLText
public java.lang.String openingURLText
- this text will be shown to the user while openning a URL.
backColor
public java.awt.Color backColor
- background color of the tree.
backColor2
public java.awt.Color backColor2
iconsWidth
public int iconsWidth
- Width of the icons. The default value is 16.
scrollColor
public java.awt.Color scrollColor
- background color of the scroll bar.
nodeIcon
public java.awt.Image nodeIcon
nodeSelectedIcon
public java.awt.Image nodeSelectedIcon
nodeColor
public java.awt.Color nodeColor
nodeSelectedColor
public java.awt.Color nodeSelectedColor
nodeBackColor
public java.awt.Color nodeBackColor
nodeSelectedBackColor
public java.awt.Color nodeSelectedBackColor
nodeBackImage
public java.awt.Image nodeBackImage
nodeCenterText
public boolean nodeCenterText
nodeRaised
public boolean nodeRaised
nodeFont
public java.awt.Font nodeFont
lastClickedColor
public java.awt.Color lastClickedColor
lastClickedBack
public java.awt.Color lastClickedBack
lastClickedFont
public java.awt.Font lastClickedFont
lastClickedImage
public java.awt.Image lastClickedImage
loadingImage
public java.awt.Image loadingImage
- Image to be displayed while definition files or applet parameters are read.
loadingFont
public java.awt.Font loadingFont
- font of the text displayed to the user while definition files or applet parameters are read.
loadingColor
public java.awt.Color loadingColor
rootAlwaysExpanded
public boolean rootAlwaysExpanded
showTip
public boolean showTip
- If false, no tips will be displayed.
tipFont
public java.awt.Font tipFont
- Font used to display tips.
tipColor
public java.awt.Color tipColor
- color of the border of the box used to displayed tips.
tipBorder
public java.awt.Color tipBorder
- color of the border of the box used to displayed tips.
tipBack
public java.awt.Color tipBack
- background of the box used to displayed tips.
autoReorganize
public boolean autoReorganize
autoReorganizeAlways
public boolean autoReorganizeAlways
Root
public RNode Root
- root of the tree. Trees always have a root but it can be hidden.
clickedNode
public RNode clickedNode
clickedNodes
public java.util.Vector clickedNodes
showRoot
public boolean showRoot
- if false, the root of the tree will not be shown.
levelTab
public int levelTab
- left margin used for each new level of the tree.
leftMargin
public int leftMargin
- left margin of the tree.
topMargin
public int topMargin
- top margin of the tree.
lineColor
public java.awt.Color lineColor
- color of the lines used to link a node with its children
plusminusboxColor
public java.awt.Color plusminusboxColor
- color of the +/- signes.
drawLine
public boolean drawLine
- specifies whether the lines that link nodes should be displayed.
drawPlusMinus
public boolean drawPlusMinus
- if true :
"-" will be displayed left to an expanded node.
"+" will be displayed next to a not expanded node.
currentNode
public RNode currentNode
lastCurrentNode
public RNode lastCurrentNode
plusImage
public java.awt.Image plusImage
- Image to used instead of the + sign.
minusImage
public java.awt.Image minusImage
- Image to use instead of the - sign.
parentApplet
public java.applet.Applet parentApplet
- Applet (if any) in which the tree is placed. This is used to read the applet's parameters.
defaultTarget
public java.lang.String defaultTarget
- Target frame where URL should be openned after double-clicking a node. Valid values are:
"_self" show in the current frame
"_parent" show in the parent frame
"_top" show in the topmost frame
"_blank" show in a new unnamed top-level window
name: show in a new top-level window named name
itemHeight
public int itemHeight
- Height of the items in the tree. The default is 20.
itemWidth
public int itemWidth
- Width of the items in the tree. The default is the width of the applet itself.
JSOnEnter
public java.lang.String JSOnEnter
- name of javascript function to call on events "enter"
JSOnExit
public java.lang.String JSOnExit
- name of javascript function to call on events "exit"
JSOnLoad
public java.lang.String JSOnLoad
- name of javascript function to call on events "load"
JSOnLoadEnd
public java.lang.String JSOnLoadEnd
- name of javascript function to call on events "load end"
JSOnExpand
public java.lang.String JSOnExpand
- name of javascript function to call on events "expand"
JSOnSelect
public java.lang.String JSOnSelect
- name of javascript function to call on events "select"
JSOnDblClick
public java.lang.String JSOnDblClick
- name of javascript function to call on events "double click"
popup
public java.awt.PopupMenu popup
- for use of RTRee Visual Designer
popupShowing
public boolean popupShowing
- for use of RTRee Visual Designer
listener
public RNodeListener listener
allowDragging
public boolean allowDragging
- for use of RTRee Visual Designer
RTreeList
public RTreeList()
getSelectionCount
public int getSelectionCount()
- get number of selected nodes
getSelectedNode
public RNode getSelectedNode(int i)
- get the selected node at the specific index.(index range from 1 to getSelectionCount()-1)
addFirstLevelNode
public void addFirstLevelNode(RNode n)
- adds the node to the root.
run
public void run()
- starts the tree.
- Specified by:
run
in interface java.lang.Runnable
resizeAndPaint
public void resizeAndPaint()
paint
public void paint(java.awt.Graphics g)
- Overrides:
paint
in class java.awt.Container
collapseNodes
public void collapseNodes(RNode n)
expandASC
public void expandASC(RNode n,
boolean b)
countNodesToDraw
public int countNodesToDraw(RNode n,
java.awt.Graphics g,
int[] maxX)
- number of visible nodes
expandNode
public void expandNode(java.lang.String Name,
boolean expand)
- Expands or collapses a node.
refresh
public void refresh()
- force redrawing
clear
public void clear(RNode n)
- deletes the children of the node.
findNode
public RNode findNode(RNode n,
java.lang.String Name)
- find a node by name.
getImageFile
public java.lang.String getImageFile(java.awt.Image img)
loadImageUrl
public java.awt.Image loadImageUrl(java.lang.String urlAdd)
convertColor
public java.awt.Color convertColor(java.lang.String c)
- converts a color parameter (as string) to a color class.
convertFont
public java.awt.Font convertFont(java.lang.String f)
- converts a font parameter (as string) to a Font class.
drawLineWithStyle
public void drawLineWithStyle(java.awt.Graphics g,
int x1,
int y1,
int x2,
int y2,
int lineType)
setNodeDefaults
public void setNodeDefaults(RNode n)
createTreeFromFile
public void createTreeFromFile(RNode startNode,
java.lang.String sFile)
- processes the file sfile. The nodes will be added as children of startNode.
createTreeFromParameters
public void createTreeFromParameters(java.applet.Applet pApplet)
- create the tree using the parameters of the applet.
processParameter
public void processParameter(RNode currentNode,
java.lang.String ParamName,
java.lang.String ParamValue)
- process a parameter. This method ís used to provide access to paramters from javascript.
drawNode
public void drawNode(java.awt.Graphics g,
RNode n,
int level,
boolean redrawChildren)