001: /**
002: * Copyright 2006 Webmedia Group Ltd.
003: *
004: * Licensed under the Apache License, Version 2.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: **/package org.araneaframework.uilib.list.structure.filter;
016:
017: import org.araneaframework.core.Assert;
018: import org.araneaframework.uilib.form.Control;
019: import org.araneaframework.uilib.form.FormElement;
020: import org.araneaframework.uilib.list.ListWidget;
021: import org.araneaframework.uilib.list.TypeHelper;
022:
023: /**
024: * One list field specific proxy for {@link FilterHelper}.
025: *
026: * @author <a href="mailto:rein@araneaframework.org">Rein Raudjärv</a>
027: *
028: * @see FilterHelper
029: * @see ListWidget
030: */
031: public class FieldFilterHelper extends BaseFilterHelper {
032:
033: private final FilterHelper helper;
034: private final String fieldId;
035:
036: /**
037: * Constructs a {@link FieldFilterHelper} for specified {@link FilterHelper}
038: * and field.
039: *
040: * @param helper filter helper.
041: * @param fieldId list field id.
042: */
043: public FieldFilterHelper(FilterHelper helper, String fieldId) {
044: super (helper.list);
045:
046: Assert.notNullParam(helper, "helper");
047: Assert.notEmptyParam(fieldId, "fieldId");
048:
049: this .helper = helper;
050: this .fieldId = fieldId;
051: }
052:
053: /**
054: * Returns the {@link FilterHelper} that this {@link FieldFilterHelper} is
055: * based on.
056: *
057: * @return the filter helper.
058: */
059: public FilterHelper getFilterHelper() {
060: return this .helper;
061: }
062:
063: /**
064: * Sets the current case sensitivity behaivor.
065: *
066: * @param ignoreCase whether to ignore case.
067: */
068: public FieldFilterHelper setIgnoreCase(boolean ignoreCase) {
069: super ._setIgnoreCase(ignoreCase);
070: return this ;
071: }
072:
073: // /**
074: // * Sets the current locale.
075: // *
076: // * @param locale new locale.
077: // */
078: // public FieldFilterHelper setLocale(Locale locale) {
079: // super._setLocale(locale);
080: // return this;
081: // }
082:
083: /**
084: * Sets the current strickness behaivor.
085: *
086: * @param strict whether new filters should be strict.
087: */
088: public FieldFilterHelper setStrict(boolean strict) {
089: super ._setStrict(strict);
090: return this ;
091: }
092:
093: /**
094: * Adds custom label for current field. This can override already defined
095: * label of list field. Those labels are used by new filter form elements
096: * that are automatically created for list filters.
097: *
098: * @param labelId label id (not yet resolved).
099: */
100: public FieldFilterHelper useCustomLabel(String labelId) {
101: super ._addCustomLabel(fieldId, labelId);
102: return this ;
103: }
104:
105: /**
106: * Defines type for current field.
107: *
108: * @param type field type.
109: *
110: * @see TypeHelper#addFieldType(String, Class)
111: */
112: public FieldFilterHelper useFieldType(Class type) {
113: super ._addFieldType(fieldId, type);
114: return this ;
115: }
116:
117: // ========== EQUALS ==========
118:
119: // filter with form element
120:
121: public FilterHelper eq() {
122: return this .helper.eq(fieldId);
123: }
124:
125: public FilterHelper eq(String valueId) {
126: return this .helper.eq(fieldId, valueId);
127: }
128:
129: public FilterHelper eq(Control control) {
130: return this .helper.eq(fieldId, control);
131: }
132:
133: public FilterHelper eq(String valueId, Control control) {
134: return this .helper.eq(fieldId, valueId, control);
135: }
136:
137: public FilterHelper eq(FormElement element) {
138: return this .helper.eq(fieldId, element);
139: }
140:
141: public FilterHelper eq(String valueId, FormElement element) {
142: return this .helper.eq(fieldId, valueId, element);
143: }
144:
145: // filter
146:
147: public FilterHelper _eq() {
148: return this .helper._eq(fieldId);
149: }
150:
151: public FilterHelper _eq(String valueId) {
152: return this .helper._eq(fieldId, valueId);
153: }
154:
155: // constant filter
156:
157: public FilterHelper eqConst(Object value) {
158: return this .helper.eqConst(fieldId, value);
159: }
160:
161: public FilterHelper eqConst(String valueId, Object value) {
162: return this .helper.eqConst(fieldId, valueId, value);
163: }
164:
165: // ========== GREATER THAN ==========
166:
167: // filter with form element
168:
169: public FilterHelper gt() {
170: return this .helper.gt(fieldId);
171: }
172:
173: public FilterHelper gt(String valueId) {
174: return this .helper.gt(fieldId, valueId);
175: }
176:
177: public FilterHelper gt(Control control) {
178: return this .helper.gt(fieldId, control);
179: }
180:
181: public FilterHelper gt(String valueId, Control control) {
182: return this .helper.gt(fieldId, valueId, control);
183: }
184:
185: public FilterHelper gt(FormElement element) {
186: return this .helper.gt(fieldId, element);
187: }
188:
189: public FilterHelper gt(String valueId, FormElement element) {
190: return this .helper.gt(fieldId, valueId, element);
191: }
192:
193: // filter
194:
195: public FilterHelper _gt() {
196: return this .helper._gt(fieldId);
197: }
198:
199: public FilterHelper _gt(String valueId) {
200: return this .helper._gt(fieldId, valueId);
201: }
202:
203: // constant filter
204:
205: public FilterHelper gtConst(Object value) {
206: return this .helper.gtConst(fieldId, value);
207: }
208:
209: public FilterHelper gtConst(String valueId, Object value) {
210: return this .helper.gtConst(fieldId, valueId, value);
211: }
212:
213: // ========== LOWER THAN ==========
214:
215: // filter with form element
216:
217: public FilterHelper lt() {
218: return this .helper.lt(fieldId);
219: }
220:
221: public FilterHelper lt(String valueId) {
222: return this .helper.lt(fieldId, valueId);
223: }
224:
225: public FilterHelper lt(Control control) {
226: return this .helper.lt(fieldId, control);
227: }
228:
229: public FilterHelper lt(String valueId, Control control) {
230: return this .helper.lt(fieldId, valueId, control);
231: }
232:
233: public FilterHelper lt(FormElement element) {
234: return this .helper.lt(fieldId, element);
235: }
236:
237: public FilterHelper lt(String valueId, FormElement element) {
238: return this .helper.lt(fieldId, valueId, element);
239: }
240:
241: // filter
242:
243: public FilterHelper _lt() {
244: return this .helper._lt(fieldId);
245: }
246:
247: public FilterHelper _lt(String valueId) {
248: return this .helper._lt(fieldId, valueId);
249: }
250:
251: // constant filter
252:
253: public FilterHelper ltConst(Object value) {
254: return this .helper.ltConst(fieldId, value);
255: }
256:
257: public FilterHelper ltConst(String valueId, Object value) {
258: return this .helper.ltConst(fieldId, valueId, value);
259: }
260:
261: // ========== LIKE ==========
262:
263: // filter with form element
264:
265: public FilterHelper like() {
266: return this .helper.like(fieldId);
267: }
268:
269: public FilterHelper like(String valueId) {
270: return this .helper.like(fieldId, valueId);
271: }
272:
273: public FilterHelper like(Control control) {
274: return this .helper.like(fieldId, control);
275: }
276:
277: public FilterHelper like(String valueId, Control control) {
278: return this .helper.like(fieldId, valueId, control);
279: }
280:
281: public FilterHelper like(FormElement element) {
282: return this .helper.like(fieldId, element);
283: }
284:
285: public FilterHelper like(String valueId, FormElement element) {
286: return this .helper.like(fieldId, valueId, element);
287: }
288:
289: // filter
290:
291: public FilterHelper _like() {
292: return this .helper._like(fieldId);
293: }
294:
295: public FilterHelper _like(String valueId) {
296: return this .helper._like(fieldId, valueId);
297: }
298:
299: // constant filter
300:
301: public FilterHelper likeConst(Object value) {
302: return this .helper.likeConst(fieldId, value);
303: }
304:
305: public FilterHelper likeConst(String valueId, Object value) {
306: return this .helper.likeConst(fieldId, valueId, value);
307: }
308:
309: // ========== IS NULL ==========
310:
311: // fiisNuller with form element
312:
313: public FilterHelper isNull(Object conditionValue) {
314: return this .helper.isNull(fieldId, conditionValue);
315: }
316:
317: public FilterHelper isNull(String valueId, Object conditionValue) {
318: return this .helper.isNull(fieldId, valueId, conditionValue);
319: }
320:
321: public FilterHelper isNull(Object conditionValue, Control control) {
322: return this .helper.isNull(fieldId, conditionValue, control);
323: }
324:
325: public FilterHelper isNull(String valueId, Object conditionValue,
326: Control control) {
327: return this .helper.isNull(fieldId, valueId, conditionValue,
328: control);
329: }
330:
331: public FilterHelper isNull(Object conditionValue,
332: FormElement element) {
333: return this .helper.isNull(fieldId, conditionValue, element);
334: }
335:
336: public FilterHelper isNull(String valueId, Object conditionValue,
337: FormElement element) {
338: return this .helper.isNull(fieldId, valueId, conditionValue,
339: element);
340: }
341:
342: // fiisNuller
343:
344: public FilterHelper _isNull(Object conditionValue) {
345: return this .helper._isNull(fieldId, conditionValue);
346: }
347:
348: public FilterHelper _isNull(String valueId, Object conditionValue) {
349: return this .helper._isNull(fieldId, valueId, conditionValue);
350: }
351:
352: // constant fiisNuller
353:
354: public FilterHelper isNullConst() {
355: return this .helper.isNullConst(fieldId);
356: }
357:
358: // ========== NOT NULL ==========
359:
360: // fiisNuller with form element
361:
362: public FilterHelper notNull(Object conditionValue) {
363: return this .helper.notNull(fieldId, conditionValue);
364: }
365:
366: public FilterHelper notNull(String valueId, Object conditionValue) {
367: return this .helper.notNull(fieldId, valueId, conditionValue);
368: }
369:
370: public FilterHelper notNull(Object conditionValue, Control control) {
371: return this .helper.notNull(fieldId, conditionValue, control);
372: }
373:
374: public FilterHelper notNull(String valueId, Object conditionValue,
375: Control control) {
376: return this .helper.notNull(fieldId, valueId, conditionValue,
377: control);
378: }
379:
380: public FilterHelper notNull(Object conditionValue,
381: FormElement element) {
382: return this .helper.notNull(fieldId, conditionValue, element);
383: }
384:
385: public FilterHelper notNull(String valueId, Object conditionValue,
386: FormElement element) {
387: return this .helper.notNull(fieldId, valueId, conditionValue,
388: element);
389: }
390:
391: // finotNuller
392:
393: public FilterHelper _notNull(Object conditionValue) {
394: return this .helper._notNull(fieldId, conditionValue);
395: }
396:
397: public FilterHelper _notNull(String valueId, Object conditionValue) {
398: return this .helper._notNull(fieldId, valueId, conditionValue);
399: }
400:
401: // constant finotNuller
402:
403: public FilterHelper notNullConst() {
404: return this .helper.notNullConst(fieldId);
405: }
406:
407: // ========== RANGE ==========
408:
409: // filter with form element
410:
411: public FilterHelper range() {
412: return this .helper.range(fieldId);
413: }
414:
415: public FilterHelper range(String lowValueId, String highValueId) {
416: return this .helper.range(fieldId, lowValueId, highValueId);
417: }
418:
419: public FilterHelper range(Control lowControl, Control highControl) {
420: return this .helper.range(fieldId, lowControl, highControl);
421: }
422:
423: public FilterHelper range(String lowValueId, String highValueId,
424: Control lowControl, Control highControl) {
425: return this .helper.range(fieldId, lowValueId, highValueId,
426: lowControl, highControl);
427: }
428:
429: public FilterHelper range(FormElement lowElement,
430: FormElement highElement) {
431: return this .helper.range(fieldId, lowElement, highElement);
432: }
433:
434: public FilterHelper range(String lowValueId, String highValueId,
435: FormElement lowElement, FormElement highElement) {
436: return this .helper.range(fieldId, lowValueId, highValueId,
437: lowElement, highElement);
438: }
439:
440: // filter
441:
442: public FilterHelper _range() {
443: return this .helper._range(fieldId);
444: }
445:
446: public FilterHelper _range(String lowValueId, String highValueId) {
447: return this.helper._range(fieldId, lowValueId, highValueId);
448: }
449:
450: }
|