Package org.richfaces.model

Examples of org.richfaces.model.SortOrder


    UIComponent column = grid.findComponent(sortColumn);
   
    String name = ColumnUtil.getColumnSorting(column);
   
    SortOrder sortOrder = grid.getSortOrder();
    if (sortOrder == null) {
      sortOrder = new SortOrder();
      grid.setSortOrder(sortOrder);
     
      if (grid.getValueExpression("sortOrder") != null) {
        grid.getValueExpression("sortOrder").setValue(FacesContext.getCurrentInstance().getELContext(), sortOrder);
      }
     
    }
   
    Boolean suggested = e.getSuggestedOrder();
   
    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()]);
    }
   
    sortOrder.setFields(fields);
  }
View Full Code Here


  private List<SortField2> getSortFields() {
    FacesContext context = FacesContext.getCurrentInstance();
    ELContext eLContext= context.getELContext();
    ExpressionFactory expressionFactory = context.getApplication().getExpressionFactory();
    String var = getVar();
    SortOrder sortOrder = getSortOrder();
    List<SortField2> sortFields2 = null;
    if (sortOrder != null) {
      SortField[] sortFields = sortOrder.getFields();
      sortFields2 = new LinkedList<SortField2>();
      for (SortField sortField : sortFields) {
        ValueExpression valueExpression = null;
        String name = sortField.getName();
        if (ELUtils.isValueReference(name)) {
View Full Code Here

    UIComponent column = grid.findComponent(sortColumn);
   
    String name = ColumnUtil.getColumnSorting(column);
   
    SortOrder sortOrder = grid.getSortOrder();
   
    if (sortOrder != null) {
      SortField[] sortFields = sortOrder.getFields();
     
      if (sortFields != null) {
        for (int i = 0; i < sortFields.length && sorting == null; i++) {
          SortField sortField = sortFields[i];
         
View Full Code Here

  if (this._sortOrder != null) {
    return this._sortOrder;
  }
  ValueExpression ve = getValueExpression("sortOrder");
  if (ve != null) {
      SortOrder value = null;
     
      try {
      value = (SortOrder) ve.getValue(getFacesContext().getELContext());
      } catch (ELException e) {
      throw new FacesException(e);
View Full Code Here

    Column column =
      (Column) grid.getChildren().get(columnIndex);
   
    String name = ColumnUtil.getColumnSorting(column);
   
    SortOrder sortOrder = grid.getSortOrder();
   
    if (sortOrder != null) {
      SortField[] sortFields = sortOrder.getFields();
     
      if (sortFields != null) {
        for (int i = 0; i < sortFields.length && sorting == null; i++) {
          SortField sortField = sortFields[i];
         
View Full Code Here

    Column column =
      (Column) grid.getChildren().get(columnIndex);
   
    String name = ColumnUtil.getColumnSorting(column);
   
    SortOrder sortOrder = grid.getSortOrder();
    if (sortOrder == null) {
      sortOrder = new SortOrder();
      grid.setSortOrder(sortOrder);
     
      if (grid.getValueBinding("sortOrder") != null) {
        grid.getValueBinding("sortOrder").setValue(FacesContext.getCurrentInstance(), sortOrder);
      }
     
    }
   
    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;
         
        }
      }
    }
   
    sortOrder.setFields(new SortField[] {newField});
  }
View Full Code Here

    Column column =
      (Column) grid.getChildren().get(columnIndex);
   
    String name = ColumnUtil.getColumnSorting(column);
   
    SortOrder sortOrder = grid.getSortOrder();
    if (sortOrder == null) {
      sortOrder = new SortOrder();
      grid.setSortOrder(sortOrder);
     
      if (grid.getValueBinding("sortOrder") != null) {
        grid.getValueBinding("sortOrder").setValue(FacesContext.getCurrentInstance(), sortOrder);
      }
     
    }
   
    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()]);
    }
   
    sortOrder.setFields(fields);
  }
View Full Code Here

    Column column =
      (Column) grid.getChildren().get(columnIndex);
   
    String name = ColumnUtil.getColumnSorting(column);
   
    SortOrder sortOrder = grid.getSortOrder();
   
    if (sortOrder != null) {
      SortField[] sortFields = sortOrder.getFields();
     
      if (sortFields != null) {
        for (int i = 0; i < sortFields.length && sorting == null; i++) {
          SortField sortField = sortFields[i];
         
View Full Code Here

  if (this._sortOrder != null) {
    return this._sortOrder;
  }
  ValueExpression ve = getValueExpression("sortOrder");
  if (ve != null) {
      SortOrder value = null;
     
      try {
      value = (SortOrder) ve.getValue(getFacesContext().getELContext());
      } catch (ELException e) {
      throw new FacesException(e);
View Full Code Here

TOP

Related Classes of org.richfaces.model.SortOrder

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.