Package org.richfaces.component

Examples of org.richfaces.component.SortOrder


                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(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

    public Map<String, String> getFilterValues() {
        return filterValues;
    }

    public SortOrder getSortOrder(String name) {
        SortOrder sortOrder = getSortOrders().get(name);

        if (sortOrder == null) {
            sortOrder = SortOrder.unsorted;
        }
View Full Code Here

        return sortOrder;
    }

    public void switchSortOrder(String name) {
        SortOrder newSortOrder = null;

        switch (getSortOrder(name)) {
            case unsorted:
                newSortOrder = SortOrder.ascending;
                break;
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

        this.sortProperty = sortPropety;
    }

    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;
                } else {
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

    public void sort() {
        String property = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap()
            .get(SORT_PROPERTY_PARAMETER);
        if (property != null) {
            SortOrder currentPropertySortOrder = sortsOrders.get(property);
            if (multipleSorting) {
                if (!sortPriorities.contains(property)) {
                    sortPriorities.add(property);
                }
            } else {
                sortsOrders.clear();
            }
            if (currentPropertySortOrder == null || currentPropertySortOrder.equals(SortOrder.descending)) {
                sortsOrders.put(property, SortOrder.ascending);
            } else {
                sortsOrders.put(property, SortOrder.descending);
            }
        }
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

        updateAttribute(context, dataTableBase, SORT_PRIORITY_STRING, sortPriority);
        context.getPartialViewContext().getRenderIds().add(dataTableBase.getSortingAndFilteringRenderTargetId(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

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.