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) {
      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


  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

    super.setUp();
    sortFields = new SortField[3];
    sortFields[0] = new SortField("_id1", Boolean.TRUE);
    sortFields[1] = new SortField("name", Boolean.FALSE);
    sortFields[2] = new SortField("#{" +var + ".name}", Boolean.TRUE);
    sortOrder = new SortOrder(sortFields);
   
    factory = new ObjectWrapperFactory(facesContext, var, sortOrder);
  }
View Full Code Here

  public final void testProcessSort() {
    SortEvent event = new SortEvent(table, "col1", 0, 0);
   
    listener.processSort(event);
   
    SortOrder sortOrder = table.getSortOrder();
   
    assertNotNull(sortOrder);
   
    SortField[] fields = sortOrder.getFields();
   
    assertNotNull(fields);
    assertEquals(1, fields.length);
   
    SortField field = fields[0];
   
    assertEquals("col1", field.getName());
    assertEquals(Boolean.TRUE, field.getAscending());
   
    listener.processSort(event);
   
    sortOrder = table.getSortOrder();
   
    assertNotNull(sortOrder);
   
    fields = sortOrder.getFields();
   
    assertNotNull(fields);
    assertEquals(1, fields.length);
   
    field = fields[0];
   
    assertEquals("col1", field.getName());
    assertEquals(Boolean.FALSE, field.getAscending());
   
    event = new SortEvent(table, "col2", 0, 0);
   
    listener.processSort(event);
   
    sortOrder = table.getSortOrder();
   
    assertNotNull(sortOrder);
   
    fields = sortOrder.getFields();
   
    assertNotNull(fields);
    assertEquals(1, fields.length);
   
    field = fields[0];
View Full Code Here

  public final void testProcessSort() {
    SortEvent event = new SortEvent(table, "col1", 0, 0);
   
    listener.processSort(event);
   
    SortOrder sortOrder = table.getSortOrder();
   
    assertNotNull(sortOrder);
   
    SortField[] fields = sortOrder.getFields();
   
    assertNotNull(fields);
    assertEquals(1, fields.length);
   
    SortField field = fields[0];
   
    assertEquals("col1", field.getName());
    assertEquals(Boolean.TRUE, field.getAscending());
   
    listener.processSort(event);
   
    sortOrder = table.getSortOrder();
   
    assertNotNull(sortOrder);
   
    fields = sortOrder.getFields();
   
    assertNotNull(fields);
    assertEquals(1, fields.length);
   
    field = fields[0];
   
    assertEquals("col1", field.getName());
    assertEquals(Boolean.FALSE, field.getAscending());
   
    event = new SortEvent(table, "col2", 0, 0);
   
    listener.processSort(event);
   
    sortOrder = table.getSortOrder();
   
    assertNotNull(sortOrder);
   
    fields = sortOrder.getFields();
   
    assertNotNull(fields);
    assertEquals(2, fields.length);
   
    field = fields[0];
View Full Code Here

    l = createList();
    a = createArray();
    o = o(20);
   
   
    sortOrder = new SortOrder(new SortField[] {new SortField("name", Boolean.TRUE)});
   
    //model = new ComponentSortableDataModel()
  }
View Full Code Here

  protected SortOrder createTestData_0_sortOrder() {
    SortField[] fields = new SortField[] {
      new SortField("aaa", Boolean.TRUE),
      new SortField("bb", Boolean.FALSE)
    };
    return new SortOrder(fields);
  }
View Full Code Here

    SortField[] fields = new SortField[] {
      new SortField("column3", null),
      new SortField("column1", Boolean.TRUE),
      new SortField("column2", Boolean.FALSE)
    };
    return new SortOrder(fields);
  }
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

    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);
      }
     
    }
   
    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;
         
        }
      }
    }
   
    sortOrder.setFields(new SortField[] {newField});
  }
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.