p:treeTable不在GUI中显示父节点

时间:2016-10-04 05:05:00

标签: jsf primefaces treetable

primeface treenode无法在Xhtml中正确打印,父节点中显示的子值。但在控制台打印值中显示正确。

以下是我的代码:

支持Bean:

public TreeNode getTreeData()
{

    lstTestProcessByRelease = testProcessBo.findAllTestProcessByReleaseGroupBy(getTestSuite(), getReleaseName());
    List<TestProcess> lstTestScenario = new ArrayList<TestProcess>();
    root1 = new DefaultTreeNode("Root",null);
    for(TestProcess tp : lstTestProcessByRelease)
    {

        TreeNode parent = new DefaultTreeNode(new TestProcess(tp.getTestScenarioName(), tp.getTestCaseName(), tp.getTestCaseExecNo(), tp.getTestScenarioExecNo()),root1);
        System.out.println("============"+ tp.getTestScenarioName() +"=================");
        System.out.println("Scenario Name (ROWKEY) :"+ parent.getRowKey());
            lstTestScenario = testProcessBo.findAllTestCasesByTestScenarioName(tp.getTestSuite(), tp.getReleaseName(), tp.getTestScenarioName());
            TreeNode child =null;
            for(TestProcess tc : lstTestScenario)
            {

                child = new DefaultTreeNode(new TestProcess(tc.getTestScenarioName(), tc.getTestCaseName(), tc.getTestCaseExecNo(), tc.getTestScenarioExecNo()),parent);
                System.out.println("TestCase (ROWKEY) :"+ child.getRowKey());
                System.out.println("Scenario Name :" + tc.getTestScenarioName());
                System.out.println("TestCases Name : " + tc.getTestCaseName());
                System.out.println("   TestScenario ExecNo :" + tc.getTestScenarioExecNo());
                System.out.println("      TestCase ExecNo :" + tc.getTestCaseExecNo());
            }
            System.out.println("");
            System.out.println("");
    }


    return root1;
}

Xhtml文件:

[Output image]

<p:treeTable value="#{testProcessBean.root1}" id="TestProcessID"
                        var="tree1" editable="true" editMode="cell">


                        <p:column headerText="Test Scenario and Test Cases">
                            <h:outputText value="#{tree1.testCaseName}" />
                        </p:column>
                        <p:column headerText="Execution Order">
                            <h:outputText value="#{tree1.testCaseExecNo}" />
                        </p:column>

                    </p:treeTable>

输出显示在附加图像中。 在输出中,Login-1是LOGIN的子项。当我在控制台中打印时,我得到了正确但是当我在xthml中打印时,它显示来自孩子本身的父值。

这是控制台输出:

============LOGIN=================
Scenario Name (ROWKEY) :0
TestCase (ROWKEY) :0_0
Scenario Name :LOGIN
TestCases Name : Login-1
   TestScenario ExecNo :1
      TestCase ExecNo :1
TestCase (ROWKEY) :0_1
Scenario Name :LOGIN
TestCases Name : Login-2
   TestScenario ExecNo :1
      TestCase ExecNo :2
TestCase (ROWKEY) :0_2
Scenario Name :LOGIN
TestCases Name : Login-3
   TestScenario ExecNo :1
      TestCase ExecNo :3
TestCase (ROWKEY) :0_3
Scenario Name :LOGIN
TestCases Name : DocumentUpload
   TestScenario ExecNo :1
      TestCase ExecNo :4

0 个答案:

没有答案