📄 firsttree.html
字号:
<html jwcid="@Shell" title="Using The Tapestry Tree Control" stylesheet="ognl:assets.stylesheet"><head jwcid="@Block"> <link rel="stylesheet" type="text/css" href="../css/style.css"/></head><body jwcid="@Body"> <h1>First Tree</h1> <div class="note"> This page demonstrates how to use the Tree components to implement a simple tree. </div> The simple tree that follows uses the <code>contrib:TreeView</code>, <code>contrib:TreeDataView</code> and <code>contrib:TreeView</code> components. Click on the nodes to expand and contract the tree. <table border="1"> <tr> <td valign="top"> <span class="tree" jwcid="treeView"> <span jwcid="treeDataView"> <span jwcid="treeNodeView"/> </span> </span> </td> </tr> </table> <p> The files <code>FirstTree.html</code>, <code>FirstTree.page</code>, <code>FirstTreePage.java</code> and <code>StringTreeNode.java</code> are used to implement this page. <p> Here is a snippet from <code>FirstTree.html</code> that shows how the tree is set up on the HTML template:<div class="code"><pre> <span class="tree" jwcid="treeView"> <span jwcid="treeDataView"> <span jwcid="treeNodeView"/> </span> </span></pre></div> <p> Here is a snippet from <code>FirstTree.page</code> that shows how the tree is set up:<div class="code"><pre> <component id="treeView" type="contrib:TreeView"> <binding name="treeModel" <code class="highlight">expression='treeModel'</code>/> <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></pre></div> <p> The expression <code>'treeModel'</code> resolves to the method <code>getTreeModel()</code> in <code>FirstTreePage.java</code>. Before examining that code, we need to discuss the objects that provide data to the tree components. <p> To use <code>contrib:TreeView</code> on a page, you must first create a populated TreeModel by performing the following steps: <ul> <li>Create a class that implements the ITreeNode interface</li> <li>Create a "tree" of ITreeNode objects</li> <li>Create an ITreeDataModel object to wrap the "tree"</li> <li>Create an ITreeModel that wraps the ITreeDataModel</li> </ul> <p> <a href="#" jwcid="@PageLink" page="FirstTree1">Creating a class that implements ITreeNode...</a> <p> <a href="#" jwcid="@PageLink" page="Home">Return to Home Page...</a></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -