Todd is more knowledgeable about TreeView than I am, but I believe we left the 
definition of the "mixed" state up to the application. There are multiple ways 
to define a mixed state, so, as I recall, we felt that it was best to make it 
an application-level concern.
G

On Dec 12, 2010, at 9:02 AM, Eugene Kondrashev wrote:

> I have one more question regarding TreeView and third point.
> 
> After reading docs you provided link to, I understood, that i've expressed my 
> thought not clear enough. I mean not enable/disable functionality, but 
> checked/unchecked instead. How can i map my data object 'enable' flag to the 
> checkbox state in suitable way?
> The confusing thing is that i can't do that at TreeNode creation moment.
> 
> Thankks, Eugene
> 
> 2010/12/10 Chris Bartlett <[email protected]>
> 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 <[email protected]> 
> 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
> 
> 

Reply via email to