pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Bartlett <cbartlet...@gmail.com>
Subject Re: Checkmark enabled TreeView
Date Fri, 10 Dec 2010 19:50:43 GMT
Eugene,

Firstly, the Pivot source code for the 1.5.2 release is available on the
download page here
http://pivot.apache.org/download.cgi#1.5.2

Or from SVN here
http://svn.apache.org/repos/asf/pivot/tags/v1.5.2/

The latest 2.0 source is here
http://svn.apache.org/repos/asf/pivot/trunk/

The KitchenSink demo is located in the 'tutorials' project here
http://svn.apache.org/repos/asf/pivot/tags/v1.5.2/tutorials/src/org/apache/pivot/tutorials/
http://svn.apache.org/repos/asf/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/



1) If you are using a org.apache.pivot.wtk.content.TreeViewNodeRenderer to
render the TreeView, then be aware that it has a 'showIcon' property.
http://svn.apache.org/repos/asf/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/explorer/tools/event_logger_skin.bxml


2)
It sounds like you are trying to replicate the behaviour that can be seen in
the EventLogger window at the bottom right hand side of the
ComponentExplorer window.
http://pivot.apache.org/demos/component-explorer.html

Have a look here, and search for the following string
'// Propagate check state upwards or downwards as necessary'
http://svn.apache.org/repos/asf/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/explorer/tools/EventLoggerSkin.java


3)
Are you aware of the disabledCheckmarkFilter and disabledNodeFilter
properties of TableView?
http://pivot.apache.org/1.5.2/docs/api/org/apache/pivot/wtk/TreeView.html#setDisabledNodeFilter(org.apache.pivot.util.Filter)

If you provide a Filter which knows how to determine your internal 'enabled'
flag, the TreeView should take care of the rest.
Search for 'checkTreeView.setDisabledNodeFilter(new Filter<TreeNode>() {'
here
http://svn.apache.org/repos/asf/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/KitchenSink.java


Chris

On 11 December 2010 02:12, Eugene Kondrashev <eugene.kondrashev@gmail.com>wrote:

> Hi guys!
>
> Ive created a checkmark enabled tree view with mixed mode feature. Here I
> faced with two problems:
> 1. tree node text lable is shiffed relative to checkbox icon. It seems like
> there should be a treeNode icon, but i did not set any icons for the node,
> why it shows that free space bettween check box and a text label?
> 2. I wonder if mixed mode "correct" behaviour is implemented by default. By
> correct behaviour i meen example at
> http://pivot.apache.org/demos/kitchen-sink.html Trees section.
> One of the problem here is that parent node is not getting checked
> automatically when all child nodes are checked by user. And vise versa -
> child nodes are not getting checked while checking parent node.
> I can't find sources of example at kitched-sink page regarding Trees. Can
> you help me with that, please?
>
>
>
> My code wtkx:
> <gsq:GSQCustomerProfileController
>         xmlns:wtkx="http://pivot.apache.org/wtkx"
>         xmlns="org.apache.pivot.wtk"
>         xmlns:gsq="com.mbt.client.gui.pivot.modules">
>     <Border>
>         <content>
>             <TablePane>
>                 <columns>
>                     <TablePane.Column width="-1"/>
>                     <TablePane.Column width="1*"/>
>                 </columns>
>                 <rows>
>                     <TablePane.Row height="-1">
>                         <BoxPane styles="{padding:4, spacing:4,
> fill:true}">
>                             <Border styles="{color:10}">
>                                 <content>
>                                     <ScrollPane
> horizontalScrollBarPolicy="fill" minimumPreferredWidth="70"
>
>  verticalScrollBarPolicy="fill_to_capacity">
>                                         <view>
>                                             <TreeView
> wtkx:id="clustersTree" showMixedCheckmarkState="true"
> checkmarksEnabled="true">
>                                             </TreeView>
>                                         </view>
>                                     </ScrollPane>
>                                 </content>
>                             </Border>
>                         </BoxPane>
>                         <CardPane wtkx:id="criteriaCardPane">
>                         </CardPane>
>                     </TablePane.Row>
>                 </rows>
>             </TablePane>
>         </content>
>     </Border>
> </gsq:GSQCustomerProfileController>
>
> Oh, and one more thing. Let say i have aList of some data object with
> enabled flag as internal field. As I understood from the api, I need to
> create org.apache.pivot.collections.List<TreeBranch> from java.util.List and
> then iterate over tree nodes once again setting enabled flag.. If so that is
> really paintfull.
>
> Perhaps I'm doing something wrong, please tell me if so.
>
>         public void handleResponse(List<Cluster> retrievedClusters) {
>             org.apache.pivot.collections.List<TreeBranch> clusters = new
> LinkedList<TreeBranch>();
>             for (Cluster cluster : retrievedClusters) {
>                 TreeBranch treeBranch = new TreeBranch(cluster.getName());
>                 for (Criteria criteria : cluster.getCriteria())
>                     treeBranch.insert(new TreeNode(criteria.getName()), 0);
>                 clusters.add(treeBranch);
>             }
>             clustersTree.setTreeData(clusters);
>         }
>
> Thanks,
> Eugene
>

Mime
View raw message