Wt::WTreeNode
2019獨角獸企業重金招聘Python工程師標準>>>
A single node in a tree.
〔 這個 widget 渲染的是一棵樹的一個節點。〕
A tree list is constructed by combining several tree node objects in a tree hierarchy, by passing the parent tree node as the last argument in the child node constructor, or by using addChildNode(), to add a child to its parent.
〔一棵樹或者說一個樹表,由很多樹節點對象按一定的層次關系組合而成,可以先創建子節點然后告訴它誰是父節點,或者創建父節點,然后使用 addChildNode() 增加子節點。 〕
Each tree node has a label, and optionally a label icon pair. The icon pair offers the capability to show a different icon depending on the state of the node (expanded or collapsed). When the node has any children, a child count may be displayed next to the label using setChildCountPolicy().
〔每個樹節點都有一個 標簽,這個標簽也可以用一對小圖標代替。 這一對小圖標具有根據節點打開/關閉狀態切換顯示的功能。當某個節點含有子節點時,可以通過 setChildCountPolicy() 來設置是否在父節點標簽上顯示子節點的數量。 〕
Expanding a tree node it will collapse all its children, so that a user may collapse/expand a node as a short-cut to collapsing all children.
〔擴展開一個樹節點將顯示其所有下級子節點〕
The treenode provides several policies to communicate the current contents of the tree to the client (if possible):
〔樹節點與客戶端通訊的方式有如下幾種:〕
- WTreeNode::PreLoading: the entire tree is transmitted to the client, and all tree navigation requires no further communication.
- 〔一次全部載入,未來不用與服務器通訊。〕
- WTreeNode::LazyLoading: only the minimum is transmitted to the client. When expanding a node for the first time, only then it is transmitted to the client, and this may thus have some latency.
- 〔最小載入原則,當第一次擴展某個節點時才載入到客戶端,這顯然需要有載入時間。〕
- WTreeNode::NextLevelLoading: all leafs of visible children are transmitted, but not their children. This provides a good trade-off between bandwith use and interactivity, since expanding any tree node will happen instantly, and at the same time trigger some communication in the back-ground to load the next level of invisible nodes.
- 〔可見載入原則。這是一種平衡原則,當前看不到的子節點不用載入,需要時才載入。〕
The default policy is WTreeNode::LazyLoading. Another load policy may be specified using setLoadPolicy() on the root node and before adding any children. The load policy is inherited by all children in the tree.
〔Wt 默認的是最小載入原則,其他的可以通過 setLoadPolicy()? 對根節點定義,特別要注意必須是在添加子節點前定義。載入原則可以被所有子節點繼承。〕
There are a few scenarios where it makes sense to specialize the WTreeNode class. One scenario is create a tree that is populated dynamically while browsing. For this purpose you should reimplement the populate() method, whose default implementation does nothing. This method is called when 'loading' the node. The exact moment for loading a treenode depends on the LoadPolicy.
A second scenario that is if you want to customize the look of the tree label (see labelArea()) or if you want to modify or augment the event collapse/expand event handling (see doExpand() and doCollapse()).
〔節點的樣式可以自定義,通過labelArea() 擴展當前標簽區域的內容或動作等,當然擴展或收起的事件處理也可以自定義,具體參考doExpand() 和 doCollapse()〕
See WTree for a usage example.
CSS
The tree is styled by the current CSS theme. The look can be overridden using the Wt-tree CSS class and the following selectors:
〔默認樹節點的樣式采用 CSS theme 定義,我們可以重寫 Wt-tree 樣式類,如下:〕
.Wt-tree .Wt-trunk : vertical line, trunk
.Wt-tree .Wt-end : vertical line, last item
.Wt-tree .Wt-collapse : collapse icon (img *)
.Wt-tree .Wt-expand : expand icon (img *)
.Wt-tree .Wt-noexpand : leaf icon
.Wt-tree .Wt-label : the node label
.Wt-tree .Wt-childcount : the node child count * The collapse and expand icons are fetched themselves as images, nav-plus.gif and nav-minus.gif.
See also:
類別: c++witty? 查看評論
轉載于:https://my.oschina.net/zhmsong/blog/5226
總結
以上是生活随笔為你收集整理的Wt::WTreeNode的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 搜索引擎指令站长常用搜索引擎命令汇总
- 下一篇: XenServer上启动虚拟机失败’Th