KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > opensymphony > module > sitemesh > mapper > AbstractDecoratorMapper


1 /*
2  * Title: AbstractDecoratorMapper
3  * Description:
4  *
5  * This software is published under the terms of the OpenSymphony Software
6  * License version 1.1, of which a copy has been included with this
7  * distribution in the LICENSE.txt file.
8  */

9
10 package com.opensymphony.module.sitemesh.mapper;
11
12 import com.opensymphony.module.sitemesh.Config;
13 import com.opensymphony.module.sitemesh.Decorator;
14 import com.opensymphony.module.sitemesh.DecoratorMapper;
15 import com.opensymphony.module.sitemesh.Page;
16
17 import javax.servlet.http.HttpServletRequest JavaDoc;
18 import java.util.Properties JavaDoc;
19
20 /**
21  * Abstract DecoratorMapper implementation for easy creation of new DecoratorMappers.
22  *
23  * <p>Typically, an implementation would override getNamedDecorator() <b>or</b> getDecorator().
24  * If a Decorator cannot be returned from either of these, then they should delegate to their
25  * superclass.</p>
26  *
27  * @author <a HREF="mailto:joe@truemesh.com">Joe Walnes</a>
28  * @version $Revision: 1.1 $
29  *
30  * @see com.opensymphony.module.sitemesh.DecoratorMapper
31  */

32 public abstract class AbstractDecoratorMapper implements DecoratorMapper {
33     /** Parent DecoratorMapper. */
34     protected DecoratorMapper parent = null;
35     protected Config config = null;
36
37     /** Set parent. */
38     public void init(Config config, Properties JavaDoc properties, DecoratorMapper parent) throws InstantiationException JavaDoc {
39         this.parent = parent;
40         this.config = config;
41     }
42
43     /** Delegate to parent. */
44     public Decorator getDecorator(HttpServletRequest JavaDoc request, Page page) {
45         return parent.getDecorator(request, page);
46     }
47
48     /** Delegate to parent. */
49     public Decorator getNamedDecorator(HttpServletRequest JavaDoc request, String JavaDoc name) {
50         return parent.getNamedDecorator(request, name);
51     }
52 }
53
Popular Tags