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