You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by gb...@apache.org on 2009/06/25 00:11:59 UTC

svn commit: r788195 - in /incubator/pivot/trunk: core/src/org/apache/pivot/collections/Sequence.java wtk/src/org/apache/pivot/wtk/TreeView.java wtk/src/org/apache/pivot/wtk/content/TreeViewNodeEditor.java

Author: gbrown
Date: Wed Jun 24 22:11:59 2009
New Revision: 788195

URL: http://svn.apache.org/viewvc?rev=788195&view=rev
Log:
Clean up Sequence.Tree.Path constructors.

Modified:
    incubator/pivot/trunk/core/src/org/apache/pivot/collections/Sequence.java
    incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/TreeView.java
    incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/content/TreeViewNodeEditor.java

Modified: incubator/pivot/trunk/core/src/org/apache/pivot/collections/Sequence.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/core/src/org/apache/pivot/collections/Sequence.java?rev=788195&r1=788194&r2=788195&view=diff
==============================================================================
--- incubator/pivot/trunk/core/src/org/apache/pivot/collections/Sequence.java (original)
+++ incubator/pivot/trunk/core/src/org/apache/pivot/collections/Sequence.java Wed Jun 24 22:11:59 2009
@@ -52,15 +52,15 @@
                 this.elements = new ArrayList<Integer>(elements);
             }
 
-            public Path(Sequence<Integer> elements) {
-                this(elements, 0, elements.getLength());
+            public Path(Path path) {
+                this(path, path.getLength());
             }
 
-            public Path(Sequence<Integer> elements, int index, int count) {
-                this.elements = new ArrayList<Integer>(count);
+            public Path(Path path, int depth) {
+                elements = new ArrayList<Integer>(depth);
 
-                for (int i = index, n = index + count; i < n; i++) {
-                    this.elements.add(elements.get(i));
+                for (int i = 0; i < depth; i++) {
+                    elements.add(path.get(i));
                 }
             }
 

Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/TreeView.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/TreeView.java?rev=788195&r1=788194&r2=788195&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/TreeView.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/TreeView.java Wed Jun 24 22:11:59 2009
@@ -1031,7 +1031,7 @@
                 Path path = selectedPaths.get(i);
 
                 // Monitor the path's parent
-                monitorBranch(new Path(path, 0, path.getLength() - 1));
+                monitorBranch(new Path(path, path.getLength() - 1));
 
                 // Update the selection
                 this.selectedPaths.add(new Path(path));
@@ -1150,7 +1150,7 @@
 
         if (selectedPaths.indexOf(path) < 0) {
             // Monitor the path's parent
-            monitorBranch(new Path(path, 0, path.getLength() - 1));
+            monitorBranch(new Path(path, path.getLength() - 1));
 
             // Update the selection
             selectedPaths.add(new Path(path));
@@ -1253,7 +1253,7 @@
             || (index >= 0 && !disabled)) {
             if (disabled) {
                 // Monitor the path's parent
-                monitorBranch(new Path(path, 0, path.getLength() - 1));
+                monitorBranch(new Path(path, path.getLength() - 1));
 
                 // Update the disabled paths
                 disabledPaths.add(new Path(path));
@@ -1478,7 +1478,7 @@
                 // anything so we know which events to fire after we're done
                 ancestorCheckStates = new ArrayList<NodeCheckState>(path.getLength() - 1);
 
-                Path ancestorPath = new Path(path, 0, path.getLength() - 1);
+                Path ancestorPath = new Path(path, path.getLength() - 1);
 
                 for (int i = ancestorPath.getLength() - 1; i >= 0; i--) {
                     ancestorCheckStates.insert(getNodeCheckState(ancestorPath), 0);
@@ -1489,7 +1489,7 @@
 
             if (checked) {
                 // Monitor the path's parent
-                monitorBranch(new Path(path, 0, path.getLength() - 1));
+                monitorBranch(new Path(path, path.getLength() - 1));
 
                 // Update the checked paths
                 checkedPaths.add(new Path(path));
@@ -1503,7 +1503,7 @@
 
             if (showMixedCheckmarkState) {
                 // Notify listeners of any changes to our ancestors' check states
-                Path ancestorPath = new Path(path, 0, path.getLength() - 1);
+                Path ancestorPath = new Path(path, path.getLength() - 1);
 
                 for (int i = ancestorPath.getLength() - 1; i >= 0; i--) {
                     NodeCheckState ancestorPreviousCheckState = ancestorCheckStates.get(i);

Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/content/TreeViewNodeEditor.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/content/TreeViewNodeEditor.java?rev=788195&r1=788194&r2=788195&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/content/TreeViewNodeEditor.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/content/TreeViewNodeEditor.java Wed Jun 24 22:11:59 2009
@@ -259,7 +259,7 @@
         if (n == 1) {
             parentData = (List<TreeNode>)treeData;
         } else {
-            Path parentPath = new Path(path, 0, n - 1);
+            Path parentPath = new Path(path, n - 1);
             parentData = (List<TreeNode>)Sequence.Tree.get(treeData, parentPath);
         }
 
@@ -275,7 +275,7 @@
             parentData.add(treeNode);
 
             // Re-select the node, and make sure it's visible
-            Path newPath = new Path(path, 0, n - 1);
+            Path newPath = new Path(path, n - 1);
             newPath.add(parentData.indexOf(treeNode));
             treeView.setSelectedPath(newPath);
             treeView.scrollAreaToVisible(treeView.getNodeBounds(newPath));