TreeviewServlet




Configuration of Treeview Servlet File

There are two files you need to configure:

Configuring the treeview.properties

Configuration of the file connection

The file connection property defines the url to your nodes.txt file which stores the tree information.
The nodes.txt can be stored everywhere on the net. It just has to be accessible via http.

# ------------------------------------------------------------
# Your file connection to the tree data
#

file.InputFileURL=http://www.yourdomain.com/tree/nodes.txt

# ------------------------------------------------------------

Configuration of the linking

The servlet needs to know the how it can make requests to itself. You define the URL to
the Treeview Servlet by defining the
link.node.UrlLeftStart property.

You can also use a jsp file as the standard linkling file. The file can then include the TreeView
Servlet. Just have a look at our online examples.

# ------------------------------------------------------------
# Linking option
#

link.node.UrlLeftStart = <a href='STreeViewServlet20?NodeId=
link.node.UrlLeftEnd = '>
link.node.UrlEnd = </a>

# ------------------------------------------------------------

Configuration of the GUI

The response HTML code of the treeview servlet can be configured within the
gui properties section of the treeview.properties file.

There's on important property in this section called "gui.node.PicPathStart". With this
property you can define the location of your tree icons:

gui.node.PicPathStart = <img src='http://www.yourdomain.com/images/icons/

# ------------------------------------------------------------
# GUI of the TreeView
#
gui.html.Head = <html><head><title>TreeView Servlet</title>
	</head><body bgcolor=white link=black vlink=black alink=black>
	<br><font face='Verdana, Arial, arial' size=2>
	<b>TreeView Servlet Demo</b></font><br><br>
gui.html.Style = <STYLE TYPE='text/css'> a:hover {color: rgb(255,33,33);
	text-decoration: underline;} td {font-size: 10px;
	font-family: Verdana, Arial,Arial; } </style>
gui.html.Bottom = </body></html>
gui.html.Font = <font face='Verdana, Arial, Arial' size=-2>

gui.node.Table = <table cellspacing=0 cellpadding=0 border=0>
gui.node.Table_ = </table>
gui.node.TR = <tr>
gui.node.TR_ = </tr>
gui.node.TD = <td>
gui.node.TD_ = </td>

gui.node.linked.TD = <td bgcolor=darkblue>
gui.node.linked.Font = <font color=white><b>

gui.node.PicPathStart = <img src='http://www.www.yourdomain.com/images/nav_icons/
gui.node.PicPathEnd = ' border=0 width=16 height=16>

# ------------------------------------------------------------

Back to top



Configuring the nodes.txt

Please first have a look at our demonstration file:

/***********************************************************
1,0,1,1,1,Open Folder,-

12,1,2,0,1,Closed child Folder,-
121,12,3,0,0,child,-
122,12,3,0,0,child,-
123,12,3,0,0,child,-

13,1,2,0,0,child,-
14,1,2,0,0,child,-
15,1,2,0,0,special icon,net.gif

16,0,1,0,1,Search Engines,-
161,16,2,0,0,Yahoo,-,http://www.yahoo.com,main
162,16,2,0,0,Metacrawler,-,http://www.metacrawler.com,main
163,16,2,0,0,Bluewindow,-,http://www.sear.ch,main

17,0,1,0,0,Contact,mail.gif,mailto:treeview@swissource.ch,main

/*******************************************************

Each line defines a one node. A node is structured like this:

Id, ParentId, LevelNr, IsOpen, IsFolder, Text, additionalPicture, linkURL, targetFrame

Id: Integer The identification number of the node. This number has to be a unique number.
ParentId: Integer If the node is a childnode you have to define the parents id. Type here 0 if its a root node.
LevelNr: Integer The number of the level. The tree root starts at level 1. The deeper a node is nested the higher is the levelNr.
IsOpen: Boolean (1/0) 1 = Folder is open, 0 = Folder is closed
IsFolder: Boolean (1/0) 1 = Node is a folder and can have childs, 0 = Node isn't a folder
Text: String The nodes name which will be displayed.
additionalPicture: String You can define a separate picture for each node. The pictures have to be stored in the gui.node.PicPathStart path.

the following parameters only need to be defined when you set the link.linkingOption to 1

linkURL: String The URL which the servlet will link to when an user clicks the node.
targetFrame: String The target frame in which the content of the URL will appear. It has to be a valid frame name.

Important:

You have to define the whole parameter string for each node. If you don't know a parameter or you want to leave it out then put a "-" on it's place (Not working for Id, Parentid, LevelNr, IsOpen, IsFolder).

Linking of a node:

When you define a link for a node the link only gets active when the node gets clicked. The servlet returns a javascript piece of code which proceeds the linking. If the defined target is not valid then the javascript will fire an error message.

 

Back to top




Back to the TreeviewServlet page

How to Add Java Applets to Your Site

New on the Java Boutique:

New Review:

Time Management Made Easy with the Quartz Enterprise Job Scheduler
Why not just use the Java timer API? This open source scheduling API boasts simplicity, ease-of-integration, a well-rounded feature set, and it's free!

New Applet:

Reverse Complement
Reverse Complement is a simple applet that converts DNA or RNA sequences into three useful formats.

Elsewhere on internet.com:

WebDeveloper Java
Lots of Java information on webdeveloper.com

WDVL Java
Thorough Java resource at the Web Developer's Virtual Library.

ScriptSearch Java
Hundreds of free Java code files to download.

jGuru: Your View of the Java Universe
Customizable portal with online training, FAQs, regular news updates, and tutorials.