Package org.richfaces.model

Examples of org.richfaces.model.SortField


  private List<DemoInventoryItem> allCars = null;

  public DataTableScrollerBean() {
    initColumnsHeaders();
    SortField[] fields = { new SortField("make", true) };
    order.setFields(fields);
  }
View Full Code Here


     
    }
   
    SortField[] fields = sortOrder.getFields();
   
    SortField newField = new SortField(name, nextSortOrder(null, e.getSuggestedOrder()));
   
    if (fields != null) {
      for (int i = 0; i < fields.length; i++) {
        SortField sortField = fields[i];
        if (name != null && name.equals(sortField.getName())) {
         
          Boolean asc = nextSortOrder(sortField.getAscending(), e.getSuggestedOrder()) ;
         
          newField = new SortField(name, asc);
          break;
         
        }
      }
    }
View Full Code Here

   
    SortField[] fields = sortOrder.getFields();
   
    if (fields == null) {
      //If no sorting was applied at all, set sorting to current
      fields = new SortField[] {new SortField(name, nextSortOrder(null, suggested))};
    } else {
     
      List<SortField> newFields = new LinkedList<SortField>(Arrays.asList(fields));
      SortField newField = null;
     
      for (Iterator<SortField> iterator = newFields.iterator(); iterator.hasNext() && newField == null; ) {
        SortField sortField = (SortField) iterator.next();
        if (name != null && name.equals(sortField.getName())) {
         
          Boolean asc = sortField.getAscending();
         
          newField = new SortField(name, nextSortOrder(asc, suggested));
          iterator.remove();
         
        }       
      }
     
      if (newField == null) {
       
        newField = new SortField(name, nextSortOrder(null, suggested));
      }
     
      newFields.add(newField);
      fields = (SortField[]) newFields.toArray(new SortField[newFields.size()]);
    }
View Full Code Here

    if (sortOrder != null) {
      SortField[] sortFields = sortOrder.getFields();
     
      if (sortFields != null) {
        for (int i = 0; i < sortFields.length && sorting == null; i++) {
          SortField sortField = sortFields[i];
         
          if (name != null && name.equals(sortField.getName())) {
            sorting = sortField.getAscending();
          }
        }
      }
    }
   
View Full Code Here

    if (sortOrder != null) {
      SortField[] sortFields = sortOrder.getFields();
     
      if (sortFields != null) {
        for (int i = 0; i < sortFields.length && sorting == null; i++) {
          SortField sortField = sortFields[i];
         
          if ((name != null && name.equals(sortField.getName()))
              || columnIndex == sortField.getIndex()) {
            sorting = sortField.getAscending();
          }
        }
      }
    }
   
View Full Code Here

     
    }
   
    SortField[] fields = sortOrder.getFields();
   
    SortField newField = new SortField(name, columnIndex, Boolean.TRUE);
   
    if (fields != null) {
      for (int i = 0; i < fields.length; i++) {
        SortField sortField = fields[i];
        if (sortField.getIndex() == columnIndex ||
            (sortField.getName() != null &&
                name != null &&
                name.equals(sortField.getName()))) {
         
          Boolean asc = sortField.getAscending();
          asc = Boolean.TRUE.equals(asc) ? Boolean.FALSE : Boolean.TRUE;
         
          newField = new SortField(name, columnIndex, asc);
          break;
         
        }
      }
    }
View Full Code Here

   
    SortField[] fields = sortOrder.getFields();
   
    if (fields == null) {
      //If no sorting was applied at all, set sorting to current
      fields = new SortField[] {new SortField(name, columnIndex, Boolean.TRUE)};
    } else {
     
      List newFields = new LinkedList(Arrays.asList(fields));
      SortField newField = null;
     
      for (Iterator iterator = newFields.iterator(); iterator.hasNext() && newField == null; ) {
        SortField sortField = (SortField) iterator.next();
        if (sortField.getIndex() == columnIndex ||
            (sortField.getName() != null &&
                name != null &&
                name.equals(sortField.getName()))) {
         
          Boolean asc = sortField.getAscending();
          asc = Boolean.TRUE.equals(asc) ? Boolean.FALSE : Boolean.TRUE;
         
          newField = new SortField(name, columnIndex, asc);
          iterator.remove();
         
        }       
      }
     
      if (newField == null) {
        newField = new SortField(name, columnIndex, Boolean.TRUE);
      }
     
      newFields.add(newField);
      fields = (SortField[]) newFields.toArray(new SortField[newFields.size()]);
    }
View Full Code Here

    SortField[] sortFields = sortOrder.getFields();
   
    expressions = new Expression[sortFields.length];
                                
    for (int i = 0; i < sortFields.length; i++) {
      final SortField field = sortFields[i];
      final String name = field.getName();
     
      if (ELUtils.isValueReference(name)) {
       
        expressions[i] = new ValueBindingExpression(context, name, var);
       
View Full Code Here

            }
        };
        column.setSortOrder(SortOrder.ascending);
        column.setValueExpression("sortBy", expression);
        column.setComparator(comparator);
        SortField sortField = column.getSortField();
        Assert.assertEquals(SortOrder.ascending, sortField.getSortOrder());
        Assert.assertEquals(expression, sortField.getSortBy());
        Assert.assertSame(comparator, sortField.getComparator());
    }
View Full Code Here

        }
        return field;
    }

    public SortField getSortField() {
        SortField field = null;
        SortOrder sortOrder = getSortOrder();
        if (sortOrder != null && !SortOrder.unsorted.equals(sortOrder)) {
            Comparator<?> comparator = getComparator();
            ValueExpression sortBy = getValueExpression("sortBy");
            if (comparator != null || sortBy != null) {
                field = new SortField(sortBy, comparator, sortOrder);
            }
        }
        return field;
    }
View Full Code Here

TOP

Related Classes of org.richfaces.model.SortField

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.