aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenri Sara <henri.sara@itmill.com>2011-03-15 13:47:18 +0000
committerHenri Sara <henri.sara@itmill.com>2011-03-15 13:47:18 +0000
commit850805c7a42be05f219b6245a271cac7a3aeda9d (patch)
treecff0e5bd81352dcd9a7e365a467db757d21bc2cb
parent42787665b1d4d0fc59a8c3c0b875dbbe021e73ab (diff)
downloadvaadin-framework-850805c7a42be05f219b6245a271cac7a3aeda9d.tar.gz
vaadin-framework-850805c7a42be05f219b6245a271cac7a3aeda9d.zip
#6286 Container filtering improvements: also pass item id to passesFilter()
svn changeset:17788/svn branch:6.6
-rw-r--r--src/com/vaadin/data/Container.java6
-rw-r--r--src/com/vaadin/data/util/AbstractInMemoryContainer.java2
-rw-r--r--src/com/vaadin/data/util/filter/And.java5
-rw-r--r--src/com/vaadin/data/util/filter/Not.java5
-rw-r--r--src/com/vaadin/data/util/filter/Or.java5
-rw-r--r--src/com/vaadin/data/util/filter/SimpleStringFilter.java2
6 files changed, 16 insertions, 9 deletions
diff --git a/src/com/vaadin/data/Container.java b/src/com/vaadin/data/Container.java
index 68219f2454..23cb0248c2 100644
--- a/src/com/vaadin/data/Container.java
+++ b/src/com/vaadin/data/Container.java
@@ -660,12 +660,16 @@ public interface Container extends Serializable {
/**
* Check if an item passes the filter (in-memory filtering).
*
+ * @param itemId
+ * identifier of the item being filtered; may be null when
+ * the item is being added to the container
* @param item
+ * the item being filtered
* @return true if the item is accepted by this filter
* @throws UnsupportedOperationException
* if the filter cannot be used for in-memory filtering
*/
- public boolean passesFilter(Item item)
+ public boolean passesFilter(Object itemId, Item item)
throws UnsupportedOperationException;
/**
diff --git a/src/com/vaadin/data/util/AbstractInMemoryContainer.java b/src/com/vaadin/data/util/AbstractInMemoryContainer.java
index df0e860b24..548f30f984 100644
--- a/src/com/vaadin/data/util/AbstractInMemoryContainer.java
+++ b/src/com/vaadin/data/util/AbstractInMemoryContainer.java
@@ -366,7 +366,7 @@ public abstract class AbstractInMemoryContainer<ITEMIDTYPE, PROPERTYIDCLASS, ITE
final Iterator<Filter> i = getFilters().iterator();
while (i.hasNext()) {
final Filter f = i.next();
- if (!f.passesFilter(item)) {
+ if (!f.passesFilter(itemId, item)) {
return false;
}
}
diff --git a/src/com/vaadin/data/util/filter/And.java b/src/com/vaadin/data/util/filter/And.java
index ec1a2bf8c6..253a420548 100644
--- a/src/com/vaadin/data/util/filter/And.java
+++ b/src/com/vaadin/data/util/filter/And.java
@@ -27,9 +27,10 @@ public class And extends AbstractJunctionFilter implements Filter {
super(filters);
}
- public boolean passesFilter(Item item) throws UnsupportedFilterException {
+ public boolean passesFilter(Object itemId, Item item)
+ throws UnsupportedFilterException {
for (Filter filter : getFilters()) {
- if (!filter.passesFilter(item)) {
+ if (!filter.passesFilter(itemId, item)) {
return false;
}
}
diff --git a/src/com/vaadin/data/util/filter/Not.java b/src/com/vaadin/data/util/filter/Not.java
index 0e2ec4c55e..fd4717c865 100644
--- a/src/com/vaadin/data/util/filter/Not.java
+++ b/src/com/vaadin/data/util/filter/Not.java
@@ -33,8 +33,9 @@ public class Not implements Filter {
return filter;
}
- public boolean passesFilter(Item item) throws UnsupportedOperationException {
- return !filter.passesFilter(item);
+ public boolean passesFilter(Object itemId, Item item)
+ throws UnsupportedOperationException {
+ return !filter.passesFilter(itemId, item);
}
/**
diff --git a/src/com/vaadin/data/util/filter/Or.java b/src/com/vaadin/data/util/filter/Or.java
index c4a3684e48..3da0de2c86 100644
--- a/src/com/vaadin/data/util/filter/Or.java
+++ b/src/com/vaadin/data/util/filter/Or.java
@@ -27,9 +27,10 @@ public class Or extends AbstractJunctionFilter implements Filter {
super(filters);
}
- public boolean passesFilter(Item item) throws UnsupportedFilterException {
+ public boolean passesFilter(Object itemId, Item item)
+ throws UnsupportedFilterException {
for (Filter filter : getFilters()) {
- if (filter.passesFilter(item)) {
+ if (filter.passesFilter(itemId, item)) {
return true;
}
}
diff --git a/src/com/vaadin/data/util/filter/SimpleStringFilter.java b/src/com/vaadin/data/util/filter/SimpleStringFilter.java
index 3fb81c5641..b3801415d3 100644
--- a/src/com/vaadin/data/util/filter/SimpleStringFilter.java
+++ b/src/com/vaadin/data/util/filter/SimpleStringFilter.java
@@ -36,7 +36,7 @@ public class SimpleStringFilter implements Filter {
this.onlyMatchPrefix = onlyMatchPrefix;
}
- public boolean passesFilter(Item item) {
+ public boolean passesFilter(Object itemId, Item item) {
final Property p = item.getItemProperty(propertyId);
if (p == null || p.toString() == null) {
return false;