diff options
Diffstat (limited to 'server/src/com')
6 files changed, 65 insertions, 10 deletions
diff --git a/server/src/com/vaadin/data/Container.java b/server/src/com/vaadin/data/Container.java index 4db346a015..e93db52a35 100644 --- a/server/src/com/vaadin/data/Container.java +++ b/server/src/com/vaadin/data/Container.java @@ -954,11 +954,14 @@ public interface Container extends Serializable { public void removeAllContainerFilters(); /** - * Returns true if any filters have been applied to the container + * Returns the filters which have been applied to the container * + * @return A collection of filters which have been applied to the + * container. An empty collection if no filters have been + * applied. * @since 7.1 */ - public boolean hasContainerFilters(); + public Collection<Filter> getContainerFilters(); } /** diff --git a/server/src/com/vaadin/data/util/AbstractBeanContainer.java b/server/src/com/vaadin/data/util/AbstractBeanContainer.java index c587cf5163..35403d6419 100644 --- a/server/src/com/vaadin/data/util/AbstractBeanContainer.java +++ b/server/src/com/vaadin/data/util/AbstractBeanContainer.java @@ -385,11 +385,26 @@ public abstract class AbstractBeanContainer<IDTYPE, BEANTYPE> extends removeFilter(filter); } + /* + * (non-Javadoc) + * + * @see com.vaadin.data.util.AbstractInMemoryContainer#hasContainerFilters() + */ @Override public boolean hasContainerFilters() { return super.hasContainerFilters(); } + /* + * (non-Javadoc) + * + * @see com.vaadin.data.util.AbstractInMemoryContainer#getContainerFilters() + */ + @Override + public Collection<Filter> getContainerFilters() { + return super.getContainerFilters(); + } + /** * 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 940f2302f5..84304431bc 100644 --- a/server/src/com/vaadin/data/util/AbstractInMemoryContainer.java +++ b/server/src/com/vaadin/data/util/AbstractInMemoryContainer.java @@ -501,12 +501,22 @@ public abstract class AbstractInMemoryContainer<ITEMIDTYPE, PROPERTYIDCLASS, ITE } /** - * Checks if the container has filters + * Returns true if any filters have been applied to the container. * - * @return Returns true if the container has container filters applied + * @return true if the container has filters applied, false otherwise + * @since 7.1 */ protected boolean hasContainerFilters() { - return !getFilters().isEmpty(); + return !getContainerFilters().isEmpty(); + } + + /* + * (non-Javadoc) + * + * @see com.vaadin.data.Container.Filterable#getContainerFilters() + */ + protected Collection<Filter> getContainerFilters() { + return Collections.unmodifiableCollection(filters); } /** diff --git a/server/src/com/vaadin/data/util/IndexedContainer.java b/server/src/com/vaadin/data/util/IndexedContainer.java index 31f37ac277..d7bf70caf6 100644 --- a/server/src/com/vaadin/data/util/IndexedContainer.java +++ b/server/src/com/vaadin/data/util/IndexedContainer.java @@ -1192,9 +1192,23 @@ public class IndexedContainer extends removeFilter(filter); } + /* + * (non-Javadoc) + * + * @see com.vaadin.data.util.AbstractInMemoryContainer#getContainerFilters() + */ @Override public boolean hasContainerFilters() { return super.hasContainerFilters(); } + /* + * (non-Javadoc) + * + * @see com.vaadin.data.util.AbstractInMemoryContainer#getContainerFilters() + */ + @Override + public Collection<Filter> getContainerFilters() { + return super.getContainerFilters(); + } } diff --git a/server/src/com/vaadin/data/util/sqlcontainer/SQLContainer.java b/server/src/com/vaadin/data/util/sqlcontainer/SQLContainer.java index f8efdf0d4f..987466cdb7 100644 --- a/server/src/com/vaadin/data/util/sqlcontainer/SQLContainer.java +++ b/server/src/com/vaadin/data/util/sqlcontainer/SQLContainer.java @@ -597,11 +597,23 @@ public class SQLContainer implements Container, Container.Filterable, } /** - * {@inheritDoc} + * Returns true if any filters have been applied to the container. + * + * @return true if the container has filters applied, false otherwise + * @since 7.1 */ - @Override public boolean hasContainerFilters() { - return !filters.isEmpty(); + return !getContainerFilters().isEmpty(); + } + + /* + * (non-Javadoc) + * + * @see com.vaadin.data.Container.Filterable#getContainerFilters() + */ + @Override + public Collection<Filter> getContainerFilters() { + return Collections.unmodifiableCollection(filters); } /**********************************************/ @@ -1825,4 +1837,5 @@ public class SQLContainer implements Container, Container.Filterable, private static final Logger getLogger() { return Logger.getLogger(SQLContainer.class.getName()); } + } diff --git a/server/src/com/vaadin/ui/Tree.java b/server/src/com/vaadin/ui/Tree.java index a5c3819edd..15175b5a8b 100644 --- a/server/src/com/vaadin/ui/Tree.java +++ b/server/src/com/vaadin/ui/Tree.java @@ -939,8 +939,8 @@ public class Tree extends AbstractSelect implements Container.Hierarchical, com.vaadin.data.Container.ItemSetChangeEvent event) { super.containerItemSetChange(event); if (getContainerDataSource() instanceof Filterable) { - boolean hasFilters = ((Filterable) getContainerDataSource()) - .hasContainerFilters(); + boolean hasFilters = !((Filterable) getContainerDataSource()) + .getContainerFilters().isEmpty(); if (!hasFilters) { /* * If Container is not filtered then the itemsetchange is caused |