Esempio n. 1
0
  @Override
  public void sort(Object[] propertyId, boolean[] ascending) {
    // Grid in 7.4 may call this method with empty sorting instructions...
    if (propertyId.length > 0) {
      Comparator<T> comparator = new PropertyComparator(propertyId, ascending);

      Collections.sort(backingList, comparator);
      fireItemSetChange();
    }
  }
Esempio n. 2
0
 @Override
 public Collection<?> getSortableContainerPropertyIds() {
   if (backingList instanceof SortableLazyList) {
     // Assume SortableLazyList can sort by any Comparable property
   } else if (backingList instanceof LazyList) {
     // When using LazyList, don't support sorting by default
     // as the sorting should most probably be done at backend call level
     return Collections.emptySet();
   }
   final ArrayList<String> props = new ArrayList<String>();
   for (Object a : getContainerPropertyIds()) {
     DynaProperty db = getDynaClass().getDynaProperty(a.toString());
     if (db != null
         && db.getType() != null
         && (db.getType().isPrimitive() || Comparable.class.isAssignableFrom(db.getType()))) {
       props.add(db.getName());
     }
   }
   return props;
 }