pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Brown <gkbr...@mac.com>
Subject Re: TreeBranch & TreeNode attributes in the next version?
Date Thu, 11 Feb 2010 16:11:50 GMT
Hi Bob,

> Are TreeBranches and TreeNodes getting userData collections soon? 

TreeBranch and TreeNode are simply default tree data implementations that the default TreeNodeRenderer
is capable of presenting. You are free to extend these classes or replace them entirely as
needed by your application.

> Would it be too heavy to extend TreeBranches and TreeNodes from Component instead of

These classes are data objects, so it wouldn't make sense to extend Component (i.e. making
them extend Component wouldn't allow you to add components to a TreeView).

> Should I just extend TreeNode so in contains one more property with a getter/setter?

That is one option, though extending TreeNode would only allow you to add the property to
the leaf nodes (TreeBranch would still extend the existing TreeNode base class, not your custom
class). If your branch nodes also need the property, you'd also need to extend TreeBranch.
In that case, you might want to define an interface that both subclasses would implement.
Alternatively, you could extend TreeNode to add the property and then create a custom TreeBranch
class that extends your custom TreeNode class.

The most flexible approach would be to create your own tree data classes and renderer. You
can refer to the tree view classes in org.apache.pivot.wtk.content for examples:


Hope this helps,

View raw message