KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > commons > jelly > tags > define > SuperTag


1 /*
2  * Copyright 1999-2002,2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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  */

16 package org.apache.commons.jelly.tags.define;
17
18 import org.apache.commons.jelly.JellyTagException;
19 import org.apache.commons.jelly.TagSupport;
20 import org.apache.commons.jelly.XMLOutput;
21
22 /**
23  * <super> tag is used to invoke a parent tag implementation, when
24  * a tag extends an existing tag
25  *
26  * @author <a HREF="mailto:tima@intalio.com">Tim Anderson</a>
27  * @version $Revision: 155420 $
28  * @see ExtendTag
29  */

30 public class SuperTag extends TagSupport {
31
32     public SuperTag() {
33     }
34
35     // Tag interface
36
//-------------------------------------------------------------------------
37
public void doTag(XMLOutput output) throws JellyTagException {
38         ExtendTag tag = (ExtendTag) findAncestorWithClass(ExtendTag.class);
39         if (tag == null) {
40             throw new JellyTagException(
41                 "<define:super> must be inside a <define:extend>");
42         }
43
44         tag.getSuperScript().run(getContext(), output);
45     }
46 }
47
48
Popular Tags