summaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/src/com/vaadin/data/Container.java6
-rw-r--r--server/src/com/vaadin/data/util/AbstractBeanContainer.java5
-rw-r--r--server/src/com/vaadin/data/util/AbstractInMemoryContainer.java9
-rw-r--r--server/src/com/vaadin/data/util/IndexedContainer.java5
-rw-r--r--server/src/com/vaadin/data/util/sqlcontainer/SQLContainer.java9
-rw-r--r--server/tests/src/com/vaadin/data/util/AbstractContainerTest.java9
6 files changed, 41 insertions, 2 deletions
diff --git a/server/src/com/vaadin/data/Container.java b/server/src/com/vaadin/data/Container.java
index ddeac62d6d..4db346a015 100644
--- a/server/src/com/vaadin/data/Container.java
+++ b/server/src/com/vaadin/data/Container.java
@@ -953,6 +953,12 @@ public interface Container extends Serializable {
*/
public void removeAllContainerFilters();
+ /**
+ * Returns true if any filters have been applied to the container
+ *
+ * @since 7.1
+ */
+ public boolean hasContainerFilters();
}
/**
diff --git a/server/src/com/vaadin/data/util/AbstractBeanContainer.java b/server/src/com/vaadin/data/util/AbstractBeanContainer.java
index db1e1afe0d..c587cf5163 100644
--- a/server/src/com/vaadin/data/util/AbstractBeanContainer.java
+++ b/server/src/com/vaadin/data/util/AbstractBeanContainer.java
@@ -385,6 +385,11 @@ public abstract class AbstractBeanContainer<IDTYPE, BEANTYPE> extends
removeFilter(filter);
}
+ @Override
+ public boolean hasContainerFilters() {
+ return super.hasContainerFilters();
+ }
+
/**
* Make this container listen to the given property provided it notifies
* when its value changes.
diff --git a/server/src/com/vaadin/data/util/AbstractInMemoryContainer.java b/server/src/com/vaadin/data/util/AbstractInMemoryContainer.java
index 504b4081c1..940f2302f5 100644
--- a/server/src/com/vaadin/data/util/AbstractInMemoryContainer.java
+++ b/server/src/com/vaadin/data/util/AbstractInMemoryContainer.java
@@ -501,6 +501,15 @@ public abstract class AbstractInMemoryContainer<ITEMIDTYPE, PROPERTYIDCLASS, ITE
}
/**
+ * Checks if the container has filters
+ *
+ * @return Returns true if the container has container filters applied
+ */
+ protected boolean hasContainerFilters() {
+ return !getFilters().isEmpty();
+ }
+
+ /**
* Remove a specific container filter and re-filter the view (if necessary).
*
* This can be used to implement
diff --git a/server/src/com/vaadin/data/util/IndexedContainer.java b/server/src/com/vaadin/data/util/IndexedContainer.java
index 1df4dd9bfb..a54bf26e52 100644
--- a/server/src/com/vaadin/data/util/IndexedContainer.java
+++ b/server/src/com/vaadin/data/util/IndexedContainer.java
@@ -1190,4 +1190,9 @@ public class IndexedContainer extends
removeFilter(filter);
}
+ @Override
+ public boolean hasContainerFilters() {
+ return super.hasContainerFilters();
+ }
+
}
diff --git a/server/src/com/vaadin/data/util/sqlcontainer/SQLContainer.java b/server/src/com/vaadin/data/util/sqlcontainer/SQLContainer.java
index 64c16b2798..f8efdf0d4f 100644
--- a/server/src/com/vaadin/data/util/sqlcontainer/SQLContainer.java
+++ b/server/src/com/vaadin/data/util/sqlcontainer/SQLContainer.java
@@ -590,13 +590,20 @@ public class SQLContainer implements Container, Container.Filterable,
/**
* {@inheritDoc}
*/
-
@Override
public void removeAllContainerFilters() {
filters.clear();
refresh();
}
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean hasContainerFilters() {
+ return !filters.isEmpty();
+ }
+
/**********************************************/
/** Methods from interface Container.Indexed **/
/**********************************************/
diff --git a/server/tests/src/com/vaadin/data/util/AbstractContainerTest.java b/server/tests/src/com/vaadin/data/util/AbstractContainerTest.java
index f04acf8c46..3d9909c42c 100644
--- a/server/tests/src/com/vaadin/data/util/AbstractContainerTest.java
+++ b/server/tests/src/com/vaadin/data/util/AbstractContainerTest.java
@@ -317,22 +317,29 @@ public abstract class AbstractContainerTest extends TestCase {
container.addContainerFilter(new SimpleStringFilter(
FULLY_QUALIFIED_NAME, "ab", false, false));
+ assertTrue(container.hasContainerFilters());
+
validateContainer(container, "com.vaadin.data.BufferedValidatable",
"com.vaadin.ui.TabSheet",
"com.vaadin.terminal.gwt.client.Focusable",
"com.vaadin.data.Buffered", isFilteredOutItemNull(), 20);
+
// Filter by "contains da" (reversed as ad here)
container.removeAllContainerFilters();
+
+ assertFalse(container.hasContainerFilters());
+
container.addContainerFilter(new SimpleStringFilter(
REVERSE_FULLY_QUALIFIED_NAME, "ad", false, false));
+ assertTrue(container.hasContainerFilters());
+
validateContainer(container, "com.vaadin.data.Buffered",
"com.vaadin.server.ComponentSizeValidator",
"com.vaadin.data.util.IndexedContainer",
"com.vaadin.terminal.gwt.client.ui.VUriFragmentUtility",
isFilteredOutItemNull(), 37);
-
}
/**