pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eugene Kondrashev <eugene.kondras...@gmail.com>
Subject Checkmark enabled TreeView
Date Fri, 10 Dec 2010 19:12:30 GMT
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