01: /**
02: * Copyright 2006 Webmedia Group Ltd.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: **/package org.araneaframework.uilib.widgets.lists.tests.mock;
16:
17: import java.util.Comparator;
18: import java.util.Locale;
19: import org.araneaframework.tests.mock.MockConfiguration;
20: import org.araneaframework.uilib.ConfigurationContext;
21: import org.araneaframework.uilib.form.FormElement;
22: import org.araneaframework.uilib.form.FormWidget;
23: import org.araneaframework.uilib.list.structure.filter.FilterContext;
24: import org.araneaframework.uilib.list.util.ComparatorFactory;
25: import org.araneaframework.uilib.util.Event;
26:
27: public class MockFilterContext implements FilterContext {
28:
29: private FormWidget form = new FormWidget();
30: private ConfigurationContext configuration = new MockConfiguration();
31:
32: public FormWidget getForm() {
33: return form;
34: }
35:
36: public boolean isStrict() {
37: return false;
38: }
39:
40: public ConfigurationContext getConfiguration() {
41: return configuration;
42: }
43:
44: public Comparator getFieldComparator(String fieldId) {
45: return ComparatorFactory.getDefault();
46: }
47:
48: public String getFieldLabel(String fieldId) {
49: return null;
50: }
51:
52: public Class getFieldType(String fieldId) {
53: return null;
54: }
55:
56: public Locale getLocale() {
57: return Locale.getDefault();
58: }
59:
60: public boolean isIgnoreCase() {
61: return true;
62: }
63:
64: public void setLabelForElement(FormElement formElement,
65: String fieldId) {
66: formElement.setLabel(fieldId);
67: }
68:
69: public void addInitEvent(Event event) {
70: event.run();
71: }
72:
73: }
|