public Map buildSortQueryParamsMap(String sortExpression) {

        SortModel sortModel = getDataGridState().getSortModel();
        SortStrategy sortStrategy = sortModel.getSortStrategy();

        List currSorts = sortModel.getSorts();
        ArrayList newSorts = new ArrayList();
        if(currSorts == null || currSorts.size() == 0) {
            Sort sort = new Sort();
            sort.setSortExpression(sortExpression);
            sort.setDirection(sortStrategy.getDefaultDirection());
            newSorts.add(sort);
        }
        else {
            boolean foundSort = false;
            for(int i = 0; i < currSorts.size(); i++) {
                Sort sort = (Sort)currSorts.get(i);
                if(!sort.getSortExpression().equals(sortExpression)) {
                    newSorts.add(sort);
                }
                else {
                    Sort newSort = new Sort();
                    newSort.setSortExpression(sortExpression);
                    newSort.setDirection(sortStrategy.nextDirection(sort.getDirection()));
                    newSorts.add(newSort);
                    foundSort = true;
                }
            }
            if(!foundSort) {
                Sort newSort = new Sort();
                newSort.setSortExpression(sortExpression);
                newSort.setDirection(sortStrategy.getDefaultDirection());
                newSorts.add(newSort);
            }
        }

        Map params = _codec.getExistingParams();
        Map newParams = new HashMap();

        Map tmp = _codec.buildSortParamMap(newSorts);
        if(tmp != null)
            newParams.putAll(tmp);

        addFilterParams(newParams);
        addPagerParams(newParams);

        params = mergeMaps(params, newParams);
        params = transformMap(params);

        return params;
    }
public Map buildSortQueryParamsMap ( String sortExpression ) { SortModel sortModel = getDataGridState ( ) . getSortModel ( ) ; SortStrategy sortStrategy = sortModel . getSortStrategy ( ) ; List currSorts = sortModel . getSorts ( ) ; ArrayList newSorts = new ArrayList ( ) ; if ( currSorts == null || currSorts . size ( ) == 0 ) { Sort sort = new Sort ( ) ; sort . setSortExpression ( sortExpression ) ; sort . setDirection ( sortStrategy . getDefaultDirection ( ) ) ; newSorts . add ( sort ) ; } else { boolean foundSort = false ; for ( int i = 0 ; i < currSorts . size ( ) ; i ++ ) { Sort sort = ( Sort ) currSorts . get ( i ) ; if ( ! sort . getSortExpression ( ) . equals ( sortExpression ) ) { newSorts . add ( sort ) ; } else { Sort newSort = new Sort ( ) ; newSort . setSortExpression ( sortExpression ) ; newSort . setDirection ( sortStrategy . nextDirection ( sort . getDirection ( ) ) ) ; newSorts . add ( newSort ) ; foundSort = true ; } } if ( ! foundSort ) { Sort newSort = new Sort ( ) ; newSort . setSortExpression ( sortExpression ) ; newSort . setDirection ( sortStrategy . getDefaultDirection ( ) ) ; newSorts . add ( newSort ) ; } } Map params = _codec . getExistingParams ( ) ; Map newParams = new HashMap ( ) ; Map tmp = _codec . buildSortParamMap ( newSorts ) ; if ( tmp != null ) newParams . putAll ( tmp ) ; addFilterParams ( newParams ) ; addPagerParams ( newParams ) ; params = mergeMaps ( params , newParams ) ; params = transformMap ( params ) ; return params ; }
<p>
Get a URL query parameter map that contains state which will change the direction of a
{@link Sort} whose sort expression matches the given sort expression value.  The {@link SortStrategy}
associated with the data grid's {@link SortModel} will be used to choose the next
{@link org.apache.beehive.netui.databinding.datagrid.api.sort.SortDirection} given the sort's current
sort direction.  This map also contains all of the other existing URL parameters.  The {@link Map}
contains key / value pairs of type String / String[].
</p>
@param sortExpression the sort expression whose direction to change
@return the URL and data grid state needed to change the direction of a {@link Sort} with the given
sort expression