View Javadoc
1   /*
2    * Copyright (c) 2002-2014, Mairie de Paris
3    * All rights reserved.
4    *
5    * Redistribution and use in source and binary forms, with or without
6    * modification, are permitted provided that the following conditions
7    * are met:
8    *
9    *  1. Redistributions of source code must retain the above copyright notice
10   *     and the following disclaimer.
11   *
12   *  2. Redistributions in binary form must reproduce the above copyright notice
13   *     and the following disclaimer in the documentation and/or other materials
14   *     provided with the distribution.
15   *
16   *  3. Neither the name of 'Mairie de Paris' nor 'Lutece' nor the names of its
17   *     contributors may be used to endorse or promote products derived from
18   *     this software without specific prior written permission.
19   *
20   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21   * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23   * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
24   * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25   * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26   * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27   * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28   * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29   * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30   * POSSIBILITY OF SUCH DAMAGE.
31   *
32   * License 1.0
33   */
34  package fr.paris.lutece.util.datatable;
35  
36  import fr.paris.lutece.util.ReferenceList;
37  
38  
39  /**
40   * Class to filter data with a DataTableManager
41   */
42  public class DataTableFilter
43  {
44      private DataTableFilterType _filterType;
45      private String _strParameterName;
46      private String _strFilterLabel;
47      private String _strValue;
48      private ReferenceList _refList;
49  
50      /**
51       * Creates a new filter
52       * @param filterType The type of the filter
53       * @param strParameterName The name of the parameter to filter
54       * @param strFilterLabel The label of the filter
55       */
56      protected DataTableFilter( DataTableFilterType filterType, String strParameterName, String strFilterLabel )
57      {
58          _filterType = filterType;
59          _strParameterName = strParameterName;
60          _strFilterLabel = strFilterLabel;
61      }
62  
63      /**
64       * Get the type of the filter
65       * @return The type of the filter
66       */
67      public DataTableFilterType getFilterType(  )
68      {
69          return _filterType;
70      }
71  
72      /**
73       * Set the type of the filter
74       * @param filterType The type of the filter
75       */
76      protected void setFilterType( DataTableFilterType filterType )
77      {
78          _filterType = filterType;
79      }
80  
81      /**
82       * Get the name of the parameter to filter
83       * @return The name of the parameter to filter
84       */
85      public String getParameterName(  )
86      {
87          return _strParameterName;
88      }
89  
90      /**
91       * Set the name of the parameter to filter
92       * @param strParameterName The name of the parameter to filter
93       */
94      protected void setParameterName( String strParameterName )
95      {
96          _strParameterName = strParameterName;
97      }
98  
99      /**
100      * Get the label of the filter
101      * @return The label of the filter
102      */
103     public String getFilterLabel(  )
104     {
105         return _strFilterLabel;
106     }
107 
108     /**
109      * Set the label of the filter
110      * @param strFilterLabel The label of the filter
111      */
112     protected void setFilterLabel( String strFilterLabel )
113     {
114         _strFilterLabel = strFilterLabel;
115     }
116 
117     /**
118      * Get the reference list of this filter
119      * @return The reference list of this filter
120      */
121     public ReferenceList getRefList(  )
122     {
123         return _refList;
124     }
125 
126     /**
127      * Set the reference list of this filter
128      * @param refList The reference list of this filter
129      */
130     protected void setRefList( ReferenceList refList )
131     {
132         _refList = refList;
133     }
134 
135     /**
136      * Get the current value of the filter
137      * @return The current value of the filter
138      */
139     public String getValue(  )
140     {
141         return _strValue;
142     }
143 
144     /**
145      * Set the current value of the filter
146      * @param strValue The current value of the filter
147      */
148     protected void setValue( String strValue )
149     {
150         _strValue = strValue;
151     }
152 }