]> source.dussan.org Git - vaadin-framework.git/commitdiff
Fixed PiggybackListener.equals()
authorMarc Englund <marc.englund@itmill.com>
Thu, 31 Jan 2008 14:12:52 +0000 (14:12 +0000)
committerMarc Englund <marc.englund@itmill.com>
Thu, 31 Jan 2008 14:12:52 +0000 (14:12 +0000)
svn changeset:3685/svn branch:trunk

src/com/itmill/toolkit/data/util/ContainerHierarchicalWrapper.java
src/com/itmill/toolkit/data/util/ContainerOrderedWrapper.java

index 8acd75583a19c166b46f95e8d7c38e546875333a..bc3e3e0a5f2763da9622735b91fa0d9bc85af8bd 100644 (file)
@@ -23,8 +23,9 @@ import com.itmill.toolkit.data.Property;
  * 
  * <p>
  * If the wrapped container is changed directly (that is, not through the
- * wrapper), the hierarchy information must be updated with the
- * {@link #updateHierarchicalWrapper()} method.
+ * wrapper), and does not implement Container.ItemSetChangeNotifier and/or
+ * Container.PropertySetChangeNotifier the hierarchy information must be updated
+ * with the {@link #updateHierarchicalWrapper()} method.
  * </p>
  * 
  * @author IT Mill Ltd.
@@ -419,7 +420,7 @@ public class ContainerHierarchicalWrapper implements Container.Hierarchical,
     public Object addItem() throws UnsupportedOperationException {
 
         final Object id = container.addItem();
-        if (id != null) {
+        if (!hierarchical && id != null) {
             addToHierarchyWrapper(id);
         }
         return id;
@@ -438,7 +439,7 @@ public class ContainerHierarchicalWrapper implements Container.Hierarchical,
     public Item addItem(Object itemId) throws UnsupportedOperationException {
 
         final Item item = container.addItem(itemId);
-        if (item != null) {
+        if (!hierarchical && item != null) {
             addToHierarchyWrapper(itemId);
         }
         return item;
@@ -456,7 +457,7 @@ public class ContainerHierarchicalWrapper implements Container.Hierarchical,
 
         final boolean success = container.removeAllItems();
 
-        if (success) {
+        if (!hierarchical && success) {
             roots.clear();
             parent.clear();
             children.clear();
@@ -481,7 +482,7 @@ public class ContainerHierarchicalWrapper implements Container.Hierarchical,
 
         final boolean success = container.removeItem(itemId);
 
-        if (success) {
+        if (!hierarchical && success) {
             removeFromHierarchyWrapper(itemId);
         }
 
@@ -667,7 +668,7 @@ public class ContainerHierarchicalWrapper implements Container.Hierarchical,
         }
 
         public boolean equals(Object obj) {
-            return listener.equals(obj);
+            return obj == listener || (obj != null && obj.equals(listener));
         }
 
         public int hashCode() {
index 7e57a138ce7f501526662eab405aea7234eec8ce..94a5974f29f4d6c8815038950573e5c391ff2b82 100644 (file)
@@ -21,8 +21,9 @@ import com.itmill.toolkit.data.Property;
  * 
  * <p>
  * If the wrapped container is changed directly (that is, not through the
- * wrapper), the ordering must be updated with the {@link #updateOrderWrapper()}
- * method.
+ * wrapper), and does not implement Container.ItemSetChangeNotifier and/or
+ * Container.PropertySetChangeNotifier the hierarchy information must be updated
+ * with the {@link #updateOrderWrapper()} method.
  * </p>
  * 
  * @author IT Mill Ltd.
@@ -586,7 +587,7 @@ public class ContainerOrderedWrapper implements Container.Ordered,
         }
 
         public boolean equals(Object obj) {
-            return listener.equals(obj);
+            return obj == listener || (obj != null && obj.equals(listener));
         }
 
         public int hashCode() {