01: /*
02: * $Id: AbstractMarkupFilter.java 3916 2006-01-20 13:07:21 +0000 (Fri, 20 Jan
03: * 2006) jdonnerstag $ $Revision: 461655 $ $Date: 2006-01-20 13:07:21 +0000 (Fri,
04: * 20 Jan 2006) $
05: *
06: * ==============================================================================
07: * Licensed under the Apache License, Version 2.0 (the "License"); you may not
08: * use this file except in compliance with the License. You may obtain a copy of
09: * the License at
10: *
11: * http://www.apache.org/licenses/LICENSE-2.0
12: *
13: * Unless required by applicable law or agreed to in writing, software
14: * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15: * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16: * License for the specific language governing permissions and limitations under
17: * the License.
18: */
19: package wicket.markup.parser;
20:
21: import java.text.ParseException;
22:
23: import wicket.markup.ComponentTag;
24:
25: /**
26: * Base class for markup filters
27: *
28: * @see wicket.markup.MarkupParser
29: *
30: * @author Jonathan Locke
31: */
32: public abstract class AbstractMarkupFilter implements IMarkupFilter {
33: /** The next MarkupFilter in the chain */
34: private IMarkupFilter parent;
35:
36: /**
37: * Construct.
38: *
39: * @param parent
40: * The parent of this component The next element in the chain.
41: */
42: public AbstractMarkupFilter() {
43: }
44:
45: /**
46: * Construct.
47: *
48: * @param parent
49: * The parent of this component The next element in the chain.
50: */
51: public AbstractMarkupFilter(final IMarkupFilter parent) {
52: this .parent = parent;
53: }
54:
55: /**
56: * @return The next MarkupFilter in the chain
57: */
58: public final IMarkupFilter getParent() {
59: return parent;
60: }
61:
62: /**
63: * Set new parent.
64: *
65: * @param parent
66: * The parent of this component The next element in the chain
67: */
68: public final void setParent(final IMarkupFilter parent) {
69: this .parent = parent;
70: }
71:
72: /**
73: * A convinience function to retrieve the next tag (same as nextTag()),
74: * however assuming that it is a ComponentTag.
75: *
76: * @return ComponentTag
77: * @throws ParseException
78: */
79: protected final ComponentTag nextComponentTag()
80: throws ParseException {
81: return (ComponentTag) getParent().nextTag();
82: }
83: }
|