summaryrefslogtreecommitdiffstats
path: root/src/com/vaadin/data/util/AbstractInMemoryContainer.java
diff options
context:
space:
mode:
authorHenri Sara <henri.sara@itmill.com>2011-03-01 12:47:25 +0000
committerHenri Sara <henri.sara@itmill.com>2011-03-01 12:47:25 +0000
commit735edca132b57be99af2a8e3575624b67c5ae32f (patch)
treeef7fcb9dbfc179344f62f755fd67cbd1ffc4799a /src/com/vaadin/data/util/AbstractInMemoryContainer.java
parentfca375e6b185a6758337c40276c8b7a5cdbbc7fc (diff)
downloadvaadin-framework-735edca132b57be99af2a8e3575624b67c5ae32f.tar.gz
vaadin-framework-735edca132b57be99af2a8e3575624b67c5ae32f.zip
#6527 Container refactoring: move common parts of item removal to AbstractInMemoryContainer
svn changeset:17530/svn branch:6.6
Diffstat (limited to 'src/com/vaadin/data/util/AbstractInMemoryContainer.java')
-rw-r--r--src/com/vaadin/data/util/AbstractInMemoryContainer.java40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/com/vaadin/data/util/AbstractInMemoryContainer.java b/src/com/vaadin/data/util/AbstractInMemoryContainer.java
index f83e50be04..63f90399d9 100644
--- a/src/com/vaadin/data/util/AbstractInMemoryContainer.java
+++ b/src/com/vaadin/data/util/AbstractInMemoryContainer.java
@@ -181,6 +181,46 @@ public abstract class AbstractInMemoryContainer<ITEMIDTYPE, PROPERTYIDCLASS, ITE
// internal methods
/**
+ * Removes all items from the internal data structures of this class. This
+ * can be used to implement {@link #removeAllItems()} in subclasses.
+ *
+ * No notification is sent, the caller has to fire a suitable item set
+ * change notification.
+ */
+ protected void internalRemoveAllItems() {
+ // Removes all Items
+ allItemIds.clear();
+ if (getFilteredItemIds() != null) {
+ getFilteredItemIds().clear();
+ }
+ }
+
+ /**
+ * Removes a single item from the internal data structures of this class.
+ * This can be used to implement {@link #removeItem(Object)} in subclasses.
+ *
+ * No notification is sent, the caller has to fire a suitable item set
+ * change notification.
+ *
+ * @param itemId
+ * the identifier of the item to remove
+ * @return true if an item was successfully removed, false if failed to
+ * remove or no such item
+ */
+ protected boolean internalRemoveItem(Object itemId) {
+ if (itemId == null) {
+ return false;
+ }
+
+ boolean result = allItemIds.remove(itemId);
+ if (result && getFilteredItemIds() != null) {
+ getFilteredItemIds().remove(itemId);
+ }
+
+ return result;
+ }
+
+ /**
* Returns the internal list of visible item identifiers after filtering.
*
* For internal use only.