diff options
Diffstat (limited to 'server')
-rw-r--r-- | server/src/com/vaadin/data/util/GeneratedPropertyContainer.java | 33 | ||||
-rw-r--r-- | server/tests/src/com/vaadin/data/util/GeneratedPropertyContainerBasicTest.java | 3 |
2 files changed, 34 insertions, 2 deletions
diff --git a/server/src/com/vaadin/data/util/GeneratedPropertyContainer.java b/server/src/com/vaadin/data/util/GeneratedPropertyContainer.java index f50ff01fc6..cea1e27ee9 100644 --- a/server/src/com/vaadin/data/util/GeneratedPropertyContainer.java +++ b/server/src/com/vaadin/data/util/GeneratedPropertyContainer.java @@ -165,6 +165,39 @@ public class GeneratedPropertyContainer extends AbstractContainer implements throw new UnsupportedOperationException( "GeneratedPropertyItem does not support removing properties"); } + + /** + * Tests if the given object is the same as the this object. Two Items + * from the same container with the same ID are equal. + * + * @param obj + * an object to compare with this object + * @return <code>true</code> if the given object is the same as this + * object, <code>false</code> if not + */ + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + + if (obj == null + || !obj.getClass().equals(GeneratedPropertyItem.class)) { + return false; + } + final GeneratedPropertyItem li = (GeneratedPropertyItem) obj; + return getContainer() == li.getContainer() + && itemId.equals(li.itemId); + } + + @Override + public int hashCode() { + return itemId.hashCode(); + } + + private GeneratedPropertyContainer getContainer() { + return GeneratedPropertyContainer.this; + } }; /** diff --git a/server/tests/src/com/vaadin/data/util/GeneratedPropertyContainerBasicTest.java b/server/tests/src/com/vaadin/data/util/GeneratedPropertyContainerBasicTest.java index b9c2a0ab22..90ec893f4d 100644 --- a/server/tests/src/com/vaadin/data/util/GeneratedPropertyContainerBasicTest.java +++ b/server/tests/src/com/vaadin/data/util/GeneratedPropertyContainerBasicTest.java @@ -38,8 +38,7 @@ public class GeneratedPropertyContainerBasicTest extends } public void testContainerOrdered() { - // Fails because of #19246 - // testContainerOrdered(createContainer()); + testContainerOrdered(createContainer()); } public void testContainerIndexed() { |