001// Licensed under the Apache License, Version 2.0 (the "License"); 002// you may not use this file except in compliance with the License. 003// You may obtain a copy of the License at 004// 005// http://www.apache.org/licenses/LICENSE-2.0 006// 007// Unless required by applicable law or agreed to in writing, software 008// distributed under the License is distributed on an "AS IS" BASIS, 009// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 010// See the License for the specific language governing permissions and 011// limitations under the License. 012 013package org.apache.tapestry5.grid; 014 015import org.apache.tapestry5.BaseOptimizedSessionPersistedObject; 016 017/** 018 * Standard implementation of {@link org.apache.tapestry5.grid.GridPaginationModel}. 019 * 020 * @since 5.4 021 */ 022public class GridPaginationModelImpl extends BaseOptimizedSessionPersistedObject implements GridPaginationModel 023{ 024 private static final long serialVersionUID = -5532310466213300537L; 025 026 private String sortColumnId; 027 028 private Boolean sortAscending; 029 030 private Integer currentPage; 031 032 @Override 033 public String getSortColumnId() 034 { 035 return sortColumnId; 036 } 037 038 @Override 039 public void setSortColumnId(String sortColumnId) 040 { 041 this.sortColumnId = sortColumnId; 042 043 markDirty(); 044 } 045 046 @Override 047 public Boolean getSortAscending() 048 { 049 return sortAscending; 050 } 051 052 @Override 053 public void setSortAscending(Boolean sortAscending) 054 { 055 this.sortAscending = sortAscending; 056 057 markDirty(); 058 } 059 060 @Override 061 public Integer getCurrentPage() 062 { 063 return currentPage; 064 } 065 066 @Override 067 public void setCurrentPage(Integer currentPage) 068 { 069 this.currentPage = currentPage; 070 071 markDirty(); 072 } 073 074 @Override 075 public String toString() 076 { 077 return String.format("GridPaginationModelImpl[currentPage=%s, sortColumnId=%s, sortAscending=%s]", 078 currentPage, sortColumnId, sortAscending); 079 } 080}