Revision history [back]

click to hide/show revision 1
initial version

asked 2013-07-09 18:20:37 +0800

robertkaren gravatar image robertkaren

multi column treerender isn't working

I am trying to get a 2-column tree example working using code from documentation and another question (from brand). I see from println sttmts that the render() is getting called and tree values are there but there are no tree nodes appearing. below are the render() and zul portions. can someone tell me what is missing? thanks for any help!

public class BinaryTreeRenderer3 implements TreeitemRenderer {

@Override
    public void render(Treeitem treeItem, Object data, int i) throws Exception {
        System.out.println("render called with:" );
        System.out.println("     treeItem = " + treeItem.toString() + ",  data = " + data.toString() + " , int = " + i + "." );

        ArrayList orderData = (ArrayList) data;
        Treecell item = new Treecell(orderData.get(0).toString());
        Treecell descriptor = new Treecell((String) orderData.get(1));
        Treerow treeRow = null;
            //
        if (treeItem.getTreerow() == null) {
                treeRow = new Treerow();
                treeRow.setParent(treeItem);
        } else {
                treeRow = treeItem.getTreerow();
                treeRow.getChildren().clear();
        }
        System.out.println("render(): parent = " + treeRow.toString() + " getTreerow() = " + treeItem.getTreerow().toString() + " item = " + item.getLabel() + ", desc = " + descriptor.getLabel());
        item.setParent(treeRow);
        descriptor.setParent(treeRow);
        treeItem.setOpen(false);
    }
}

and here is zul section. look down for id 'navTree':

<borderlayout>
    <west size="45%" border="0" collapsible="true" splittable="true" title="Expand/Collapse" flex="1">
        <tabbox id="homeTabLeftTabBox" height="80%">
            <tabs id="homeTabLeftTabBoxTabs">
               <tab id="surveyTab" label="Survey" />
            </tabs>
            <tabpanels>
                   <tabpanel>
                    <borderlayout>
                        <center>
                        <!--
                            <zscript><![CDATA[
                                TreeModel btm = new com.namsi.eztab.services.BinaryTreeModel(
                                new ArrayList(
                                    new com.namsi.eztab.services.BigList(1000)));
                            ]]></zscript>
                            <tree id="surveysTree" model="${btm}"/>
                          -->
                        </center>
                    </borderlayout>
                   </tabpanel>
            </tabpanels>
        </tabbox>
    </west>
    <center border="0" flex="1">
    </center>
    <east size="45%" collapsible="true" splittable="true" title="Expand/Collapse" flex="1">
      <div vflex="1">
        <tabbox id="homeTabRightTabBox" height="80%">
            <tabs id="homeTabRightTabBoxTabs">
               <tab id="projectTab" label="Project" />
              <tab id="searchTab" label="Search" />
            </tabs>
             <tabpanels>
                <tabpanel>
                   <window height="100%" apply="com.namsi.eztab.services.BinaryTreeController3">
                      <borderlayout>
                        <north flex="true">
                          <window id="northWin">
                          <tree id="navTree"
                            width="100%" height="75%"
                            vflex="true"
                            autopaging="true">
                            <treecols sizable="true">
                              <treecol label="Item" width="10%"/>
                              <treecol label="Description" width="90%"/>
                             </treecols>
                            </tree>
                            </window>
                          </north>
                          <south>
                            <window id="southWin">
                            <button id="startButton" label="START"/>
                            </window>
                          </south>
                        </borderlayout>
                     </window>
                  </tabpanel>
                  <tabpanel>This is panel Search</tabpanel>
               </tabpanels>
           </tabbox>
         </div>
      </east>
</borderlayout>

multi column treerender isn't working

I am trying to get a 2-column tree example working using code from documentation and another question (from brand). I see from println sttmts that the render() is getting called and tree values are there but there are no tree nodes appearing. below are the render() and zul portions. can someone tell me what is missing? thanks for any help!

public class BinaryTreeRenderer3 implements TreeitemRenderer {

@Override
    public void render(Treeitem treeItem, Object data, int i) throws Exception {
        System.out.println("render called with:" );
        System.out.println("     treeItem = " + treeItem.toString() + ",  data = " + data.toString() + " , int = " + i + "." );

        ArrayList orderData = (ArrayList) data;
        Treecell item = new Treecell(orderData.get(0).toString());
        Treecell descriptor = new Treecell((String) orderData.get(1));
        Treerow treeRow = null;
            //
        if (treeItem.getTreerow() == null) {
                treeRow = new Treerow();
                treeRow.setParent(treeItem);
        } else {
                treeRow = treeItem.getTreerow();
                treeRow.getChildren().clear();
        }
        System.out.println("render(): parent = " + treeRow.toString() + " getTreerow() = " + treeItem.getTreerow().toString() + " item = " + item.getLabel() + ", desc = " + descriptor.getLabel());
        item.setParent(treeRow);
        descriptor.setParent(treeRow);
        treeItem.setOpen(false);
    }
}

and here is zul section. look down for id 'navTree':

<borderlayout>
    <west size="45%" border="0" collapsible="true" splittable="true" title="Expand/Collapse" flex="1">
        <tabbox id="homeTabLeftTabBox" height="80%">
            <tabs id="homeTabLeftTabBoxTabs">
               <tab id="surveyTab" label="Survey" />
            </tabs>
            <tabpanels>
                   <tabpanel>
                    <borderlayout>
                        <center>
                        <!--
                            <zscript><![CDATA[
                                TreeModel btm = new com.namsi.eztab.services.BinaryTreeModel(
                                new ArrayList(
                                    new com.namsi.eztab.services.BigList(1000)));
                            ]]></zscript>
                            <tree id="surveysTree" model="${btm}"/>
                          -->
                        </center>
                    </borderlayout>
                   </tabpanel>
            </tabpanels>
        </tabbox>
    </west>
    <center border="0" flex="1">
    </center>
    <east size="45%" collapsible="true" splittable="true" title="Expand/Collapse" flex="1">
      <div vflex="1">
        <tabbox id="homeTabRightTabBox" height="80%">
            <tabs id="homeTabRightTabBoxTabs">
               <tab id="projectTab" label="Project" />
              <tab id="searchTab" label="Search" />
            </tabs>
             <tabpanels>
                <tabpanel>
                   <window height="100%" apply="com.namsi.eztab.services.BinaryTreeController3">
                      <borderlayout>
                        <north flex="true">
                          <window id="northWin">
                          <tree id="navTree"
                            width="100%" height="75%"
                            vflex="true"
                            autopaging="true">
                            <treecols sizable="true">
                              <treecol label="Item" width="10%"/>
                              <treecol label="Description" width="90%"/>
                             </treecols>
                            </tree>
                            </window>
                          </north>
                          <south>
                            <window id="southWin">
                            <button id="startButton" label="START"/>
                            </window>
                          </south>
                        </borderlayout>
                     </window>
                  </tabpanel>
                  <tabpanel>This is panel Search</tabpanel>
               </tabpanels>
           </tabbox>
         </div>
      </east>
</borderlayout>

multi column treerender isn't workingnewbie question tree peculiarity

I am trying to get have a 2-column tree example working using code load-on-demand in a borderlayout below (see lower portion of layout below w/ tree having id "navTree" and buttons labeled START and CHECK) with the tree in a <north> <window> and some buttons in the <center> <window>. it works as I expect. However, if I move the window with the buttons from <north> to <center> and the window with the tree from documentation and another question (from brand). I <center> to <north>, the render() is called to put data into the tree (I see from println sttmts that the render() is getting called and tree values are there sttmts) but there are is no tree nodes appearing. below are visible change to the render() and zul portions. tree. It remains empty. can someone tell me what is missing? thanks for any help!

public class BinaryTreeRenderer3 implements TreeitemRenderer {

@Override
    public void render(Treeitem treeItem, Object data, int i) throws Exception {
        System.out.println("render called with:" );
        System.out.println("     treeItem = " + treeItem.toString() + ",  data = " + data.toString() + " , int = " + i + "." );

        ArrayList orderData = (ArrayList) data;
        Treecell item = new Treecell(orderData.get(0).toString());
        Treecell descriptor = new Treecell((String) orderData.get(1));
        Treerow treeRow = null;
            //
        if (treeItem.getTreerow() == null) {
                treeRow = new Treerow();
                treeRow.setParent(treeItem);
        } else {
                treeRow = treeItem.getTreerow();
                treeRow.getChildren().clear();
        }
        System.out.println("render(): parent = " + treeRow.toString() + " getTreerow() = " + treeItem.getTreerow().toString() + " item = " + item.getLabel() + ", desc = " + descriptor.getLabel());
        item.setParent(treeRow);
        descriptor.setParent(treeRow);
        treeItem.setOpen(false);
    }
}

and here is zul section. look down for id 'navTree':explain? Thanks.

<borderlayout>
    <west size="45%" border="0" collapsible="true" splittable="true" title="Expand/Collapse" flex="1">
>
        <tabbox id="homeTabLeftTabBox" height="80%">
vflex="1">
            <tabs id="homeTabLeftTabBoxTabs">
               <tab id="surveyTab" label="Survey" />
            </tabs>
            <tabpanels>
                   <tabpanel>
                    <borderlayout>
                        <center>
                        <!--
                            <zscript><![CDATA[
                                TreeModel btm = new com.namsi.eztab.services.BinaryTreeModel(
                                new ArrayList(
                                    new com.namsi.eztab.services.BigList(1000)));
                            ]]></zscript>
                            <tree id="surveysTree" model="${btm}"/>
                          -->
                        </center>
                    </borderlayout>
                   </tabpanel>
            </tabpanels>
        </tabbox>
    </west>
    <center border="0" flex="1">
border="0">
      <div hflex="1"/>
    </center>
    <east size="45%" collapsible="true" splittable="true" title="Expand/Collapse" flex="1">
>
      <div vflex="1">
vflex="1" >
        <tabbox id="homeTabRightTabBox" height="80%">
vflex="true">
            <tabs id="homeTabRightTabBoxTabs">
               <tab id="projectTab" label="Project" />
              <tab id="searchTab" label="Search" />
            </tabs>
             <tabpanels>
                <tabpanel>
                   <window  style="background:#ababab" height="100%" apply="com.namsi.eztab.services.BinaryTreeController3">
                      <borderlayout>
                        <north flex="true">
<center>
                          <window id="northWin">
id="southWin" vflex="true" hflex="true" style="background:#aba33b">
                          <tree id="navTree"
                            width="100%" height="75%"
                            vflex="true"
                            autopaging="true">
                            <treecols sizable="true">
                              <treecol label="Item" width="10%"/>
                              <treecol label="Description" width="90%"/>
                             </treecols>
                            </tree>
                            </window>
                          </north>
                          <south>
</center>
                          <north>
                            <window id="southWin">
vflex="min" style="background:#22abab" id="northWin" >
                            <button id="startButton" label="START"/>
                            <button id="afterButton" label="Check"/>
                            </window>
                          </south>
</north>
                        </borderlayout>
                     </window>
                  </tabpanel>
                  <tabpanel>This is panel Search</tabpanel>
               </tabpanels>
           </tabbox>
         </div>
      </east>
</borderlayout>
Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More