Board: Trees for Melati

Subject

no subject

Author

Myles Chippendale

Status

Date

20/07/2000 14:17

Message

All,
I have been looking at how to do melatitrees. Currently my plan is
that you will need something like the following in your application
template:
($tree is a org.melati.util.Tree object built in your handler - is
that the right package for it to live in?)
============= Application Template ==============================
#set $dtree = $melati.JSDynamicTree($tree)
#set $dtree.NodeHeight = 19
#set $dtree.NodeWidth = 400
#set $dtree.NodeColour = "#ffffff"
#set $dtree.NodeLabelTemplet = "melatitrees/test/multipleselect.wm"
$ml.render($dtree)
===================== end =======================================
=============== example melatitrees/test/multipleselect.wm ======
<font face=arial>
<a href="Stuff?depth=$tree.NodeWidth&leaf=$node.isLeaf()&id=$node.Data.id">
$ml.rendered($node.Data.DisplayString)
</a>
</font>
===================== end ========================================
The idea is that you can define how each node is displayed, including
any actions associated with a node (e.g the hyperlink in the example
above, but this could obviously be javascript handlers which would be
defined in the application template).
The question is, are people happy that the code for the template lives
in a separate template? We could include it in the main application
template which would make it easier to keep things in line, especially
if clicking on the node name does some javascript stuff, _but_ we would
have to remember to escape the relevant variables (those that should only
be expanded for each node, not when setting up the string orginally).
An example would be:
============= Application Template ==============================
#set $dtree = $melati.JSDynamicTree($tree)
#set $dtree.NodeHeight = 19
#set $dtree.NodeWidth = 400
#set $dtree.NodeColour = "#ffffff"
#set $dtree.NodeLabelTemplet = "<font face=arial>
<a href="Stuff?depth=\$tree.NodeWidth&leaf=\$node.isLeaf()&id=\$node.Data.id">
\$ml.rendered(\$node.Data.DisplayString)
</a>
</font>"
$ml.render($dtree)
===================== end =======================================
Do people have strong feelings either way?
Regards,
Myles

Trees for Melati Board

 

Post Follow-up

Search This Board

 



Home -  News -  Reference Sites -  Members -  Partners -  Guidelines -  Philosophy -  Your Details -  Logout