When using the contrib:TreeView component it works fine, in my app, with the
example John Reynolds gave on the internet using a String.

This however does not work when I rework it to use an Object. It only ever
renders the root element and clicking on it does nothing...

Is there a problem with using objects are apposed to Strings with
SimpleTreeModel?


Sooooo similar:

    <component id="treeView" type="contrib:TreeView">
        <binding name="treeModel" expression='treeModel'/>
        <binding name="treeStateListener" expression='treeStateListener'/>
    </component>

    <component id="treeDataView" type="contrib:TreeDataView">
        <binding name="treeView" expression='components.treeView'/>
        <binding name="value" expression='value'/>
    </component>

    <component id="treeNodeView" type="contrib:TreeNodeView">
        <binding name="treeDataView" expression='components.treeDataView'/>
        <binding name="makeNodeDirect" expression="true"/>
    </component>



    <component id="organisationTreeView" type="contrib:TreeView">
        <binding name="treeModel" expression='organisationSimpleTreeModel'/>
        <binding name="treeStateListener"
expression='organisationTreeStateListener'/>
    </component>

    <component id="organisationTreeDataView" type="contrib:TreeDataView">
        <binding name="treeView"
expression='components.organisationTreeView'/>
        <binding name="value" expression='value'/>
    </component>

    <component id="organisationTreeNodeView" type="contrib:TreeNodeView">
        <binding name="treeDataView"
expression='components.organisationTreeDataView'/>
        <binding name="makeNodeDirect" expression="true"/>
    </component>



    public ITreeModel getTreeModel() {
        if (treeModel == null) {
           System.out.println("creating SimpleTreeModel");

           // Create and "connect" all the nodes
           TreeNode node1 = new StringTreeNode("Root Node");
           TreeNode node2 = new StringTreeNode("Child One");
           TreeNode node2a = new StringTreeNode("Grandchild One");
           node2.insert(node2a);
           node1.insert(node2);
           TreeNode node3 = new StringTreeNode("Child Two");
           TreeNode node3a = new StringTreeNode("GrandChild Two");
           node3.insert(node3a);
           TreeNode node3a1 = new StringTreeNode("Great Grandchild One");
           node3a.insert(node3a1);
           node1.insert(node3);

           // Wrap the root node in a SimpleTreeDataModel
           treeDataModel = new SimpleTreeDataModel(node1);
           // Wrap the SimpleTreeDataModel in a SimpleTreeModel
           treeModel = new SimpleTreeModel(treeDataModel);
        }
        return treeModel;
    }
        
    public ITreeModel getOrganisationSimpleTreeModel() {
        if (organisationSimpleTreeModel == null) {
           System.out.println("creating SimpleOrganisationTreeModel");

           // Create and "connect" all the nodes
           Organisation organisation = new Organisation();
           organisation.setName("Fonterra");
           organisation.setDatasourceUniqueId(1);
           TreeNode node1 = new OrganisationTreeNode(organisation);

           organisation = new Organisation();
           organisation.setName("Hautap");
           organisation.setDatasourceUniqueId(2);
           TreeNode node2 = new OrganisationTreeNode(organisation);
           
           organisation = new Organisation();
           organisation.setName("Cheese");
           organisation.setDatasourceUniqueId(3);
           TreeNode node2a = new OrganisationTreeNode(organisation);
           
           node2.insert(node2a);
           node1.insert(node2);

           organisation = new Organisation();
           organisation.setName("Clandeboye");
           organisation.setDatasourceUniqueId(4);
           TreeNode node3 = new OrganisationTreeNode(organisation);
           
           organisation = new Organisation();
           organisation.setName("Whey");
           organisation.setDatasourceUniqueId(5);
           TreeNode node3a = new OrganisationTreeNode(organisation);
           
           node3.insert(node3a);

           organisation = new Organisation();
           organisation.setName("Processing");
           organisation.setDatasourceUniqueId(5);
           TreeNode node3a1 = new OrganisationTreeNode(organisation);
           
           node3a.insert(node3a1);
           node1.insert(node3);

           // Wrap the root node in a SimpleTreeDataModel
           organisationSimpleTreeDataModel = new SimpleTreeDataModel(node1);
           // Wrap the SimpleTreeDataModel in a SimpleTreeModel
           organisationSimpleTreeModel = new
SimpleTreeModel(organisationSimpleTreeDataModel);
        }
        return organisationSimpleTreeModel;
    }



    public ITreeStateListener getTreeStateListener() {
        return this;
    }
    
    public ITreeStateListener getOrganisationTreeStateListener() {
        return this;
    }


-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.371 / Virus Database: 267.13.13/195 - Release Date: 8/12/2005
 


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

Reply via email to