I\'m using Wicket\'s Tree component in a web app. But empty folders are shown in a file-way.
Just like this:
To be more helpful than in my comment, I found this code in the AbstractTreeClass which will control what image it assigns to the node:
/**
* Returns the resource reference for icon of specified tree node.
*
* @param node
* The node
* @return The package resource reference
*/
protected ResourceReference getNodeIcon(TreeNode node)
{
if (node.isLeaf() == true)
{
return getItem();
}
else
{
if (isNodeExpanded(node))
{
return getFolderOpen();
}
else
{
return getFolderClosed();
}
}
}
So, the whole thing comes to the question of what does the isLeaf() method return. I found this in the DefaultMutableTreeNode class:
public boolean isLeaf()
{
return children.size() == 0;
}
So, it seems that your combination would treat all elements without children as leafs and not as folders. Maybe you could overwrite the getNodeIcon method using the getAllowsChildren, making the necessary type adjustments...
Another idea is to overwrite the isLeaf() method of DefaultMutableTreeNode, but then you might get other unexpected issues if it is called somewhere you cannot control...
This is just some insight on how you could do it... Hope it is helpful...