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 2010/07/08 16:36:42 UTC
svn commit: r961786 -
/pivot/trunk/wtk/src/org/apache/pivot/wtk/content/TreeBranch.java
Author: gbrown
Date: Thu Jul 8 14:36:42 2010
New Revision: 961786
URL: http://svn.apache.org/viewvc?rev=961786&view=rev
Log:
Don't fire comparator changes in TreeBranch unless the comparator actually changes.
Modified:
pivot/trunk/wtk/src/org/apache/pivot/wtk/content/TreeBranch.java
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/content/TreeBranch.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/content/TreeBranch.java?rev=961786&r1=961785&r2=961786&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/content/TreeBranch.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/content/TreeBranch.java Thu Jul 8 14:36:42 2010
@@ -144,19 +144,22 @@ public class TreeBranch extends TreeNode
@Override
public void setComparator(Comparator<TreeNode> comparator) {
Comparator<TreeNode> previousComparator = treeNodes.getComparator();
- treeNodes.setComparator(comparator);
- // Recursively apply comparator change
- for (int i = 0, n = treeNodes.getLength(); i < n; i++) {
- TreeNode treeNode = treeNodes.get(i);
-
- if (treeNode instanceof TreeBranch) {
- TreeBranch treeBranch = (TreeBranch)treeNode;
- treeBranch.setComparator(comparator);
+ if (previousComparator != comparator) {
+ treeNodes.setComparator(comparator);
+
+ // Recursively apply comparator change
+ for (int i = 0, n = treeNodes.getLength(); i < n; i++) {
+ TreeNode treeNode = treeNodes.get(i);
+
+ if (treeNode instanceof TreeBranch) {
+ TreeBranch treeBranch = (TreeBranch)treeNode;
+ treeBranch.setComparator(comparator);
+ }
}
- }
- listListeners.comparatorChanged(this, previousComparator);
+ listListeners.comparatorChanged(this, previousComparator);
+ }
}
@Override