> Could you give me more detailed information on what methods in Tree
> I should override?
>
There may be other/better ways, but what I did was this:
class MyTree extends Tree
{
private TreeModelProvider m_provider;
...
@Override
protected void junctionLinkClicked( DefaultMutableTreeNode node )
{
// Keep the functionality of the super class, it is what we want
super.junctionLinkClicked( node );
if( isExpanding( node ) )
{
TreeModel newModel = m_provider.expandNode( node );
if( null != newModel )
setTreeModel( newModel );
expandNode( node );
}
else
{
TreeModel newModel = m_provider.collapseNode( node );
if( null != newModel )
setTreeModel( newModel );
expandNodes((DefaultMutableTreeNode)node.getParent());
}
}
...
}
The TreeModelProvider class provides the model for my tree. In this
class, I decide what data I need to load to properly display the tree,
without loading any unnecessary data.
And of course, when adding this tree to my Wicket page, I use:
Tree tree = new MyTree( "tree", provider )
{
private static final long serialVersionUID = 1L;
protected String getNodeLabel( DefaultMutableTreeNode node )
{
final MyTreeNode treeNode = (MyTreeNode)node.getUserObject();
return treeNode.getLabel();
}
};
add( tree );
Good luck!
On Fri, 2006-07-21 at 16:20 +0800, Rice Yeh wrote:
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user