Home » tapestry-src-5.0.19 » org.apache.tapestry5.grid » [javadoc | source]

    1   // Copyright 2008 The Apache Software Foundation
    2   //
    3   // Licensed under the Apache License, Version 2.0 (the "License");
    4   // you may not use this file except in compliance with the License.
    5   // You may obtain a copy of the License at
    6   //
    7   //     http://www.apache.org/licenses/LICENSE-2.0
    8   //
    9   // Unless required by applicable law or agreed to in writing, software
   10   // distributed under the License is distributed on an "AS IS" BASIS,
   11   // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   12   // See the License for the specific language governing permissions and
   13   // limitations under the License.
   14   
   15   package org.apache.tapestry5.grid;
   16   
   17   import org.apache.tapestry5.beaneditor.PropertyModel;
   18   import org.apache.tapestry5.ioc.internal.util.Defense;
   19   
   20   /**
   21    * Identifies how a single column (identified as a {@link org.apache.tapestry5.beaneditor.PropertyModel}) is sorted.
   22    */
   23   public class SortConstraint
   24   {
   25       private final PropertyModel propertyModel;
   26   
   27       private final ColumnSort columnSort;
   28   
   29       public SortConstraint(PropertyModel propertyModel, ColumnSort columnSort)
   30       {
   31           Defense.notNull(propertyModel, "propertyModel");
   32           Defense.notNull(columnSort, "columnSort");
   33   
   34           this.propertyModel = propertyModel;
   35           this.columnSort = columnSort;
   36       }
   37   
   38       public PropertyModel getPropertyModel()
   39       {
   40           return propertyModel;
   41       }
   42   
   43       public ColumnSort getColumnSort()
   44       {
   45           return columnSort;
   46       }
   47   
   48       // equals() is useful for testing
   49   
   50       @Override
   51       public boolean equals(Object o)
   52       {
   53           if (this == o) return true;
   54   
   55           if (o == null || getClass() != o.getClass()) return false;
   56   
   57           SortConstraint that = (SortConstraint) o;
   58   
   59           if (columnSort != that.columnSort) return false;
   60   
   61           return propertyModel.equals(that.propertyModel);
   62       }
   63   }

Home » tapestry-src-5.0.19 » org.apache.tapestry5.grid » [javadoc | source]