is there a way to provide multiple strategies for rendering different model types in a heterogenous tree? for example, i might have folder nodes and three different kinds of file nodes, all of which have different models and render differently.
can we think of some way that the indentation markup can be more generalized?
Eelco Hillenius wrote:
There was one some time ago (about two months), but here is a short, updated one:
1. abstract base class that knows how to work with a tree model, tree state and links;
a. links are handled as a special case: instead of adding links to contained elements, there are coupled to the tree iself in order avoid back button problems. For this to work, user objects of the tree nodes need to be unique. Either the user provides unique user objects himself, or uses the 'makeUnique' method or constructor parameter to have the nodes in his model made unique for him.
2. There are two ready-to-use implementations of the tree.
a. Tree: renders nested <ul> and <li> lists using panels for the rows (probably ul) and row (probably li) level. This tree can be used out of the box: just provide a tree model and use it as a panel. It can be customized by overriding and providing own panels. Hence, this tree can be anything the user wants, it just provides a nested rendering strategy. An example of both using the tree as-is as well as overriding it are in the filebrowser example.
b. FlatTree: renders like one list that for each row has a contained list of 'spacers' (elements you only use to indent) and the actual tree nodes. FlatTree is abstract, as you need to provide you custom images for both junctions and nodes. The rendering of the FlatTree is fixed because in this case, I favored easy use on flexibility. If people want their own 'flat tree' like trees with custom population, they can extend the base tree class and look at FlatTree as an example. It works similar like a ListView (with container population) in that case. However, for people wanting this kind of tree, it is probably good for 90% of the cases.
3. Javascript/ DHTML. No effort was made on this field so far simply because:
a. Users have enough options allready to create a javascript/ DHTML tree with Wicket. All they need to do is to use such a component (you can find enough of them on the internet), provide them somehow with data (could e.g. use a label for this) and links (autolinks would work).
b. If you look at the DHTML trees out there, there's a wide range of implementations. I'd rather have users decide on which one to use instead of providing one (so, if we do this would definitively be a contrib component).
c. As we do not have Javascript support in Wicket, such support for the tree cannot be build in yet either.
d. By having an abstract tree and having an implementation that works with overridable panels, I hope to give users allready the flexibility they need to build Javascript etc. in (when Wicket supports it).
4. By using Swing, the model and view (tree state) are nicely seperated. This way, you can re-use your whole tree model for all clients, and use a tree state per client. Also by using Swing, we have a full blown mature API at our disposal for doing tree manipulation etc.
Eelco
Jonathan Locke wrote:
was there a feature list for this somewhere? i missed that info...
------------------------------------------------------- The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt _______________________________________________ Wicket-develop mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/wicket-develop
------------------------------------------------------- The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt _______________________________________________ Wicket-develop mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/wicket-develop
