001// Copyright 2008 The Apache Software Foundation 002// 003// Licensed under the Apache License, Version 2.0 (the "License"); 004// you may not use this file except in compliance with the License. 005// You may obtain a copy of the License at 006// 007// http://www.apache.org/licenses/LICENSE-2.0 008// 009// Unless required by applicable law or agreed to in writing, software 010// distributed under the License is distributed on an "AS IS" BASIS, 011// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 012// See the License for the specific language governing permissions and 013// limitations under the License. 014 015package org.apache.tapestry5.grid; 016 017import java.util.List; 018 019/** 020 * Models the sorting applied to the a {@link org.apache.tapestry5.grid.GridDataSource}. 021 */ 022public interface GridSortModel 023{ 024 /** 025 * Identifies how (or if) a column is sorted. 026 * 027 * @param columnId 028 * @return the sort for the indicated column or {@link org.apache.tapestry5.grid.ColumnSort#UNSORTED} if the column 029 * is not used for sorting 030 */ 031 ColumnSort getColumnSort(String columnId); 032 033 /** 034 * Updates the column sort. The receiver determines how to handle the sort request. 035 * 036 * @param columnId property id of column to sort on 037 */ 038 void updateSort(String columnId); 039 040 /** 041 * Returns a list of sort constraints, identifying which columns are sorted, and how. May return an empty list (but 042 * won't return null). 043 * 044 * @see org.apache.tapestry5.grid.GridDataSource#prepare(int, int, java.util.List) 045 */ 046 List<SortConstraint> getSortConstraints(); 047 048 void clear(); 049}