[jdom-interest] Design of a tree and UI on the web client via JDOM
Michael Kastner
kastner at galt.de
Fri Aug 17 01:44:07 PDT 2001
Hi Tapan,
If I have got you right, it seems I have faced a similar problem recently.
I also needed to create an xml image of a Swing TreeModel (Actually
DefaultTreeModel). I my case, it was for a site/content management client,
where every page can have sub pages.
First thing I did to solve this, was to create a recursive (nested) xml copy
of the tree which sort looked like this (in principle):
<page>
<content>
some content on level 0 (root node in treemodel)
</content>
<page>
<content>
Some Content
</content>
<page>
<content>
Some Content
</content>
</page>
</page>
<page>
<content>
Some Content
</content>
<page>
<content>
Some Content
</content>
</page>
</page>
</page>
I dropped that. It creates a perfect image of the tree, but its hard to fix
or maintain manually. So, what I did was to create a flat structure of the
content with an simple indexed treepath defining the location of each node
(page). So what I had to do, was to translate treepath, which is an array of
TreeNodes, to a much simpler form. So I made use of the index of each node
stored in the parent node object. I ended up with a simple path, consisting
of numbers e.g. 0.3.1.2.
now the structure looks like this:
<tree>
<page>
<indexpath>
0.
</indexpath>
<content>
some content on level 0 (root node in treemodel)
</content>
</page>
<page>
<indexpath>
0.1.
</indexpath>
<content>
Some Content
</content>
</page>
<page>
<indexpath>
0.2.
</indexpath>
<content>
Some Content
</content>
</page>
<page>
<indexpath>
0.1.2.
</indexpath>
<content>
Some Content
</content>
</page>
</tree>
The order of the vectorized nodes depends actually on how you traverse the
TreeModel. However with the indexed information of the treepath you have a
simple easy to maintain flat structure which allows you to rebuild the tree
everywhere you need to or even store the tree in a relational database. I
hope this is of any help.
Greetings
Michael Kastner
----- Original Message -----
From: "Tapan" <Tapan at optechsolutions.com>
To: <jdom-interest at jdom.org>
Sent: Thursday, August 16, 2001 4:07 PM
Subject: [jdom-interest] Design of a tree and UI on the web client via JDOM
> Hi all
> I have a design Issue to discuss here. I have a project and there are
tasks
> of a project. A project can have many tasks. Further a project task can be
> made a subproject and can have tasks again. Doesnt it look like a Tree
> structure ?? All the data for the projects and tasks is presently in a
> relational Dabase.
> Now I want the tree structure to be sent to a web client for making
changes.
> The web client can drag and drop tasks any where for eg move the tasks to
a
> different sequence, reschedule them. He can also expand the time span of
the
> projects and tasks. All this via a GUI on the client.The web client has
to
> be as light as possible...
> I was thinking that JDOM fits into picture very well. Can the gurus
suggest
> me how do we design this. Any help will be appreciated.
> Cheers
> Tapan
>
>
> _______________________________________________
> To control your jdom-interest membership:
>
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos
t.com
More information about the jdom-interest
mailing list