Package org.richfaces.component

Examples of org.richfaces.component.SortOrder


    protected void renderSortButton(FacesContext context, UIComponent column, String cssPrefix) throws IOException {
        ResponseWriter writer = context.getResponseWriter();
        writer.startElement(HtmlConstants.SPAN_ELEM, column);
        String classAttr = String.format("%1$s-srt %1$s-srt-btn ", cssPrefix);
        SortOrder sortOrder = (SortOrder) column.getAttributes().get("sortOrder");
        if (sortOrder == null || sortOrder == SortOrder.unsorted) {
            classAttr = classAttr + String.format("%s-srt-uns", cssPrefix);
        } else if (sortOrder == SortOrder.ascending) {
            classAttr = classAttr + String.format("%s-srt-asc", cssPrefix);
        } else if (sortOrder == SortOrder.descending) {
View Full Code Here


    private Map<String, SortOrder> sortingOrder =
            new HashMap<String, SortOrder>();

    public SortOrder getSorting(String colName) {
        SortOrder sort = sortingOrder.get(colName);
        if (sort == null) {
            sort = SortOrder.unsorted;
        }

        return sort;
View Full Code Here

        return sort;
    }

    public void cycleSorting(ColumnSortCompositeComponent columnSort) {
        UIColumn column = columnSort.getParentColumn();
        SortOrder currentSort = getSorting(column.getId());
        SortOrder newSort = SortOrder.unsorted;

        if (currentSort == null || currentSort == SortOrder.unsorted
                || currentSort == SortOrder.descending) {
            newSort = SortOrder.ascending;
        } else if (currentSort == SortOrder.ascending) {
View Full Code Here

 
   
  public void toggleSort() {  
   
    for (Entry<String, SortOrder> entry : sortOrders.entrySet()) {            
      SortOrder newOrder;                          
      if (entry.getKey().equals(sortProperty)) {                
        if (entry.getValue() == SortOrder.ascending)
        {                    
          newOrder = SortOrder.descending;                
          }
View Full Code Here

                ///////////////String propertyName = (String) sortField.getSortBy().getValue(facesContext.getELContext());
               
                Path<Object> expression = root.get(propertyName);
               
                Order jpaOrder;
                SortOrder sortOrder = sortField.getSortOrder();
                if (sortOrder == SortOrder.ascending) {
                    jpaOrder = criteriaBuilder.asc(expression);
                } else if (sortOrder == SortOrder.descending) {
                    jpaOrder = criteriaBuilder.desc(expression);
                } else {
                    throw new IllegalArgumentException(sortOrder.toString());
                }
           
                orders.add(jpaOrder);
            }
        }
View Full Code Here

        updateAttribute(context, dataTableBase, SORT_PRIORITY_STRING, sortPriority);
        context.getPartialViewContext().getRenderIds().add(dataTableBase.getClientId(context));
    }

    private void updateSortOrder(FacesContext context, UIComponent component, String value) {
        SortOrder sortOrder = SortOrder.ascending;
        try {
            sortOrder = SortOrder.valueOf(value);
        } catch (IllegalArgumentException e) {
            // If value isn't name of enum constant of SortOrder, toggle sortOrder of column.
            if (SortOrder.ascending.equals(component.getAttributes().get(SORT_ORDER_STRING))) {
View Full Code Here

        originalModel.setRowKey(rowKey2);
        Object object2 = originalModel.getRowData();
        int result = 0;
        for (Iterator<SortField> iterator = state.getSortFields().iterator(); iterator.hasNext() && result == 0;) {
            SortField sortField = iterator.next();
            SortOrder sortOrder = sortField.getSortOrder();
            if (sortOrder != null && !SortOrder.unsorted.equals(sortOrder)) {
                Comparator comparator = sortField.getComparator();
                if (comparator != null) {
                    result = comparator.compare(object1, object2);
                } else {
View Full Code Here

            }

            if ("header".equals(facetName) && column instanceof AbstractColumn && ((AbstractColumn) column).useBuiltInSort()) {
                writer.startElement(HtmlConstants.SPAN_ELEM, column);
                String classAttr = "rf-edt-srt rf-edt-srt-btn ";
                SortOrder sortOrder = (SortOrder) column.getAttributes().get("sortOrder");
                if (sortOrder == null || sortOrder == SortOrder.unsorted) {
                    classAttr = classAttr + "rf-edt-srt-uns";
                } else if (sortOrder == SortOrder.ascending) {
                    classAttr = classAttr + "rf-edt-srt-asc";
                } else if (sortOrder == SortOrder.descending) {
View Full Code Here

                        updateAttribute(facesContext, column, "filterValue", stateFilterValue);
                }

                String sort = tableState.getColumnSort(column);
                if (sort != null) {
                    SortOrder sortOrder = SortOrder.valueOf(sort);
                    if (! sortOrder.equals(column.getSortOrder())) {
                        updateAttribute(facesContext, column, "sortOrder", sortOrder);
                    }
                }
            }
        }
View Full Code Here

     *            Column index starting from 0.
     */
    public void sortSummaryTableByColumn(long lcolumn) {
        int column = (int) lcolumn;
        log.debug("Sorting Criterion Impact Factors by IF" + column);
        SortOrder currentColumn = summaryTableSortOrder[column];
        clearSummaryTableSortOrders();
        if (currentColumn.equals(SortOrder.descending)) {
            summaryTableSortOrder[column] = SortOrder.ascending;
        } else {
            summaryTableSortOrder[column] = SortOrder.descending;
        }
    }
View Full Code Here

TOP

Related Classes of org.richfaces.component.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.