diff options
author | Henri Sara <henri.sara@itmill.com> | 2011-03-04 11:14:32 +0000 |
---|---|---|
committer | Henri Sara <henri.sara@itmill.com> | 2011-03-04 11:14:32 +0000 |
commit | affb4dbd876eba5527d39edda404013fea2e28c2 (patch) | |
tree | e7fcdaf7f6763a6a1b2a435ab7af95a39bd90723 /src/com/vaadin/data/util/AbstractBeanContainer.java | |
parent | b9a512986633326706e95902f3dfbf120a9e54bb (diff) | |
download | vaadin-framework-affb4dbd876eba5527d39edda404013fea2e28c2.tar.gz vaadin-framework-affb4dbd876eba5527d39edda404013fea2e28c2.zip |
#6527 Container refactoring: moved most of Sortable implementation to AbstractInMemoryContainer
svn changeset:17604/svn branch:6.6
Diffstat (limited to 'src/com/vaadin/data/util/AbstractBeanContainer.java')
-rw-r--r-- | src/com/vaadin/data/util/AbstractBeanContainer.java | 60 |
1 files changed, 8 insertions, 52 deletions
diff --git a/src/com/vaadin/data/util/AbstractBeanContainer.java b/src/com/vaadin/data/util/AbstractBeanContainer.java index 56e93733a8..3b8c32455b 100644 --- a/src/com/vaadin/data/util/AbstractBeanContainer.java +++ b/src/com/vaadin/data/util/AbstractBeanContainer.java @@ -9,10 +9,8 @@ import java.io.Serializable; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.Collection; -import java.util.Collections; import java.util.HashMap; import java.util.LinkedHashMap; -import java.util.LinkedList; import java.util.Map; import com.vaadin.data.Container.Filterable; @@ -134,11 +132,6 @@ public abstract class AbstractBeanContainer<IDTYPE, BEANTYPE> extends private BeanIdResolver<IDTYPE, BEANTYPE> beanIdResolver = null; /** - * The item sorter which is used for sorting the container. - */ - private ItemSorter itemSorter = new DefaultItemSorter(); - - /** * Maps all item ids in the container (including filtered) to their * corresponding BeanItem. */ @@ -454,16 +447,8 @@ public abstract class AbstractBeanContainer<IDTYPE, BEANTYPE> extends * * @see com.vaadin.data.Container.Sortable#getSortableContainerPropertyIds() */ - public Collection<Object> getSortableContainerPropertyIds() { - LinkedList<Object> sortables = new LinkedList<Object>(); - for (Object propertyId : getContainerPropertyIds()) { - Class<?> propertyType = getType(propertyId); - if (Comparable.class.isAssignableFrom(propertyType) - || propertyType.isPrimitive()) { - sortables.add(propertyId); - } - } - return sortables; + public Collection<?> getSortableContainerPropertyIds() { + return getSortablePropertyIds(); } /* @@ -472,48 +457,19 @@ 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) { - itemSorter.setSortProperties(this, propertyId, ascending); - - doSort(); - - // notifies if anything changes in the filtered list, including order - filterAll(); + super.sort(propertyId, ascending); } - /** - * Perform the sorting of the data structures in the container. This is - * invoked when the <code>itemSorter</code> has been prepared for the sort - * operation. Typically this method calls - * <code>Collections.sort(aCollection, getItemSorter())</code> on all arrays - * (containing item ids) that need to be sorted. - * - */ - protected void doSort() { - Collections.sort(allItemIds, getItemSorter()); - } - - /** - * Returns the ItemSorter that is used for sorting the container. - * - * @see #setItemSorter(ItemSorter) - * - * @return The ItemSorter that is used for sorting the container - */ + @Override public ItemSorter getItemSorter() { - return itemSorter; + return super.getItemSorter(); } - /** - * Sets the ItemSorter that is used for sorting the container. The - * {@link ItemSorter#compare(Object, Object)} method is called to compare - * two beans (item ids). - * - * @param itemSorter - * The ItemSorter to use when sorting the container - */ + @Override public void setItemSorter(ItemSorter itemSorter) { - this.itemSorter = itemSorter; + super.setItemSorter(itemSorter); } /** |