From: Marc Englund Date: Thu, 31 Jan 2008 14:12:52 +0000 (+0000) Subject: Fixed PiggybackListener.equals() X-Git-Tag: 6.7.0.beta1~5131 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=66412e6ea935739479ba7fcd31d9464b338c402e;p=vaadin-framework.git Fixed PiggybackListener.equals() svn changeset:3685/svn branch:trunk --- diff --git a/src/com/itmill/toolkit/data/util/ContainerHierarchicalWrapper.java b/src/com/itmill/toolkit/data/util/ContainerHierarchicalWrapper.java index 8acd75583a..bc3e3e0a5f 100644 --- a/src/com/itmill/toolkit/data/util/ContainerHierarchicalWrapper.java +++ b/src/com/itmill/toolkit/data/util/ContainerHierarchicalWrapper.java @@ -23,8 +23,9 @@ import com.itmill.toolkit.data.Property; * *

* 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. *

* * @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() { diff --git a/src/com/itmill/toolkit/data/util/ContainerOrderedWrapper.java b/src/com/itmill/toolkit/data/util/ContainerOrderedWrapper.java index 7e57a138ce..94a5974f29 100644 --- a/src/com/itmill/toolkit/data/util/ContainerOrderedWrapper.java +++ b/src/com/itmill/toolkit/data/util/ContainerOrderedWrapper.java @@ -21,8 +21,9 @@ import com.itmill.toolkit.data.Property; * *

* 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. *

* * @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() {