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.list.structure.filter;
16:
17: import java.util.ArrayList;
18: import java.util.Iterator;
19: import java.util.List;
20: import org.araneaframework.Environment;
21: import org.araneaframework.uilib.list.structure.ListFilter;
22:
23: public abstract class MultiFilter implements ListFilter {
24:
25: protected List children = new ArrayList();
26:
27: public void init(Environment env) {
28: for (Iterator i = children.iterator(); i.hasNext();) {
29: ListFilter filter = (ListFilter) i.next();
30: filter.init(env);
31: }
32: }
33:
34: public void destroy() {
35: clearFilters();
36: }
37:
38: public MultiFilter addFilter(ListFilter filter) {
39: this .children.add(filter);
40: return this ;
41: }
42:
43: public List getFilters() {
44: return this .children;
45: }
46:
47: public void clearFilters() {
48: for (Iterator i = children.iterator(); i.hasNext();) {
49: ListFilter filter = (ListFilter) i.next();
50: filter.destroy();
51: i.remove();
52: }
53: }
54: }
|