Hi Doug,
You need to set up the TreeState when the tree first renders. You can
do this by overriding newTreeState.

Below is a snippet that shows one way of accomplishing this:

    @Override
    protected ITreeState newTreeState()
    {

        ITreeState state = new DefaultTreeState();
        state.collapseAll();
        TreeModel treeModel = (TreeModel) getModelObject();
        RealTimeTreeNode root = (RealTimeTreeNode) treeModel.getRoot();
        checkNodeForExpansion(root, state);
        return state;
    }

    protected void checkNodeForExpansion(RealTimeTreeNode root,
ITreeState state)
    {
        state.expandNode(root);
        Enumeration e = root.children();
        while (e.hasMoreElements()) {
            Object node = e.nextElement();
            if (node instanceof RealTimeTreeNode) {
                RealTimeTreeNode rtnode = (RealTimeTreeNode) node;
                SWTree tree = rtnode.getNode();
                switch (tree.getSWTreeType()) {
                    case Provider:
                    case Account:
                    case Site:
                    case Gateway:
                    case System:
                        checkNodeForExpansion(rtnode, state);
                        break;
                    case Device:
                    case Card:
                    case Meter:
                        break;
                }

            }
        }
    }


best,
jim


On 10/18/07, Doug Leeper <[EMAIL PROTECTED]> wrote:
>
> How does one get a Tree node that allows children but has no children display
> as a folder rather than a leaf node?
>
> I thought if allowsChildren was true it would always default to a folder
> icon.
> --
> View this message in context: 
> http://www.nabble.com/Simple-Tree-question-tf4648222.html#a13278582
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to