001/*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 *
009 *      http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.apache.wicket.extensions.markup.html.repeater.data.table.filter;
018
019import org.apache.wicket.util.io.IClusterable;
020
021/**
022 * Locator that locates the object that represents the state of the filter. Usually it is convenient
023 * to let the data provider object implement this interface so that the data provider can be itself
024 * used to locate the filter state object. This also makes it easy for the data provider to locate
025 * the filter state which it will most likely need to filter the data.
026 * <p>
027 * Example
028 * 
029 * <pre>
030 *    class UserDataProvider extends SortableDataProvider implements IFilterStateLocator<User> {
031 *      private User filterBean=new User;
032 *      
033 *      public User getFilterState() { return filterBean; }
034 *      public void setFilterState(User user) { filterBean=user; }
035 *      
036 *      public Iterator iterate(int start, int count) {
037 *        getUserDao().find(start, count, filterBean);
038 *      }
039 *    }
040 * </pre>
041 * 
042 * @param <T>
043 *            type of filter state object
044 * @author igor
045 * 
046 */
047public interface IFilterStateLocator<T> extends IClusterable
048{
049        /**
050         * @return object that represents the state of the filter toolbar
051         */
052        T getFilterState();
053
054        /**
055         * Setter for the filter state object
056         * 
057         * @param state
058         *            filter state object
059         */
060        void setFilterState(T state);
061}