diff options
author | Henri Sara <henri.sara@itmill.com> | 2011-03-08 08:46:05 +0000 |
---|---|---|
committer | Henri Sara <henri.sara@itmill.com> | 2011-03-08 08:46:05 +0000 |
commit | ca2e338e6b1012f2478b5c12d13e7e1725e0daa7 (patch) | |
tree | 16db44998496acdfc3ec3323efb800aa90f45ab9 | |
parent | 6176acd274830fb343bd11739e6036b4f04e2dc0 (diff) | |
download | vaadin-framework-ca2e338e6b1012f2478b5c12d13e7e1725e0daa7.tar.gz vaadin-framework-ca2e338e6b1012f2478b5c12d13e7e1725e0daa7.zip |
#6527 Container refactoring: renamed the protected internal sort() method to sortContainer() for clarity when implementing Sortable in subclasses, javadoc
svn changeset:17657/svn branch:6.6
-rw-r--r-- | src/com/vaadin/data/util/AbstractBeanContainer.java | 3 | ||||
-rw-r--r-- | src/com/vaadin/data/util/AbstractInMemoryContainer.java | 18 | ||||
-rw-r--r-- | src/com/vaadin/data/util/IndexedContainer.java | 13 |
3 files changed, 26 insertions, 8 deletions
diff --git a/src/com/vaadin/data/util/AbstractBeanContainer.java b/src/com/vaadin/data/util/AbstractBeanContainer.java index 31ad37a57f..9853b10150 100644 --- a/src/com/vaadin/data/util/AbstractBeanContainer.java +++ b/src/com/vaadin/data/util/AbstractBeanContainer.java @@ -424,9 +424,8 @@ public abstract class AbstractBeanContainer<IDTYPE, BEANTYPE> extends * @see com.vaadin.data.Container.Sortable#sort(java.lang.Object[], * boolean[]) */ - @Override public void sort(Object[] propertyId, boolean[] ascending) { - super.sort(propertyId, ascending); + sortContainer(propertyId, ascending); } @Override diff --git a/src/com/vaadin/data/util/AbstractInMemoryContainer.java b/src/com/vaadin/data/util/AbstractInMemoryContainer.java index 58e2b5131a..978aac6d0e 100644 --- a/src/com/vaadin/data/util/AbstractInMemoryContainer.java +++ b/src/com/vaadin/data/util/AbstractInMemoryContainer.java @@ -43,6 +43,17 @@ import com.vaadin.data.Item; * interface directly) * </ul> * + * To implement {@link Sortable}, subclasses need to implement + * {@link #getSortablePropertyIds()} and call the superclass method + * {@link #sortContainer(Object[], boolean[])} in the method + * <code>sort(Object[], boolean[])</code>. + * + * To implement Filterable, subclasses need to implement the methods + * <code>addContainerFilter()</code> (calling {@link #addFilter(ItemFilter)}), + * <code>removeAllContainerFilters()</code> (calling {@link #removeAllFilters()} + * ) and <code>removeContainerFilters(Object)</code> (calling + * {@link #removeFilters(Object)}). + * * @param <ITEMIDTYPE> * the class of item identifiers in the container, use Object if can * be any class @@ -499,14 +510,13 @@ public abstract class AbstractInMemoryContainer<ITEMIDTYPE, PROPERTYIDCLASS, ITE /** * Sort base implementation to be used to implement {@link Sortable}. * - * Subclasses should override this with a public - * {@link #sort(Object[], boolean[])} method calling this superclass method - * when implementing Sortable. + * Subclasses should call this from a public + * {@link #sort(Object[], boolean[])} method when implementing Sortable. * * @see com.vaadin.data.Container.Sortable#sort(java.lang.Object[], * boolean[]) */ - protected void sort(Object[] propertyId, boolean[] ascending) { + protected void sortContainer(Object[] propertyId, boolean[] ascending) { if (!(this instanceof Sortable)) { throw new UnsupportedOperationException( "Cannot sort a Container that does not implement Sortable"); diff --git a/src/com/vaadin/data/util/IndexedContainer.java b/src/com/vaadin/data/util/IndexedContainer.java index c440db13f9..c87417a75f 100644 --- a/src/com/vaadin/data/util/IndexedContainer.java +++ b/src/com/vaadin/data/util/IndexedContainer.java @@ -158,6 +158,7 @@ public class IndexedContainer extends * @see com.vaadin.data.Container#addContainerProperty(java.lang.Object, * java.lang.Class, java.lang.Object) */ + @Override public boolean addContainerProperty(Object propertyId, Class<?> type, Object defaultValue) { @@ -200,6 +201,7 @@ public class IndexedContainer extends * * @see com.vaadin.data.Container#removeAllItems() */ + @Override public boolean removeAllItems() { int origSize = size(); @@ -220,6 +222,7 @@ public class IndexedContainer extends * * @see com.vaadin.data.Container#addItem() */ + @Override public Object addItem() { // Creates a new id @@ -236,6 +239,7 @@ public class IndexedContainer extends * * @see com.vaadin.data.Container#addItem(java.lang.Object) */ + @Override public Item addItem(Object itemId) { return internalAddItemAtEnd(itemId, new IndexedContainerItem(itemId), true); @@ -260,6 +264,7 @@ public class IndexedContainer extends * * @see com.vaadin.data.Container#removeItem(java.lang.Object) */ + @Override public boolean removeItem(Object itemId) { if (itemId == null || items.remove(itemId) == null) { return false; @@ -282,6 +287,7 @@ public class IndexedContainer extends * * @see com.vaadin.data.Container#removeContainerProperty(java.lang.Object ) */ + @Override public boolean removeContainerProperty(Object propertyId) { // Fails if the Property is not present @@ -315,6 +321,7 @@ public class IndexedContainer extends * @see com.vaadin.data.Container.Ordered#addItemAfter(java.lang.Object, * java.lang.Object) */ + @Override public Item addItemAfter(Object previousItemId, Object newItemId) { return internalAddItemAfter(previousItemId, newItemId, new IndexedContainerItem(newItemId)); @@ -325,6 +332,7 @@ public class IndexedContainer extends * * @see com.vaadin.data.Container.Ordered#addItemAfter(java.lang.Object) */ + @Override public Object addItemAfter(Object previousItemId) { // Creates a new id @@ -342,6 +350,7 @@ public class IndexedContainer extends * * @see com.vaadin.data.Container.Indexed#addItemAt(int, java.lang.Object) */ + @Override public Item addItemAt(int index, Object newItemId) { return internalAddItemAt(index, newItemId, new IndexedContainerItem( newItemId)); @@ -352,6 +361,7 @@ public class IndexedContainer extends * * @see com.vaadin.data.Container.Indexed#addItemAt(int) */ + @Override public Object addItemAt(int index) { // Creates a new id @@ -945,9 +955,8 @@ public class IndexedContainer extends * @see com.vaadin.data.Container.Sortable#sort(java.lang.Object[], * boolean[]) */ - @Override public void sort(Object[] propertyId, boolean[] ascending) { - super.sort(propertyId, ascending); + sortContainer(propertyId, ascending); } /* |