Save This Page
Home » sitemesh-2.3 » com.opensymphony.module » sitemesh » mapper » [javadoc | source]
    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;
   18   import java.util.Properties;
   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 properties, DecoratorMapper parent) throws InstantiationException {
   39           this.parent = parent;
   40           this.config = config;
   41       }
   42   
   43       /** Delegate to parent. */
   44       public Decorator getDecorator(HttpServletRequest request, Page page) {
   45           return parent.getDecorator(request, page);
   46       }
   47   
   48       /** Delegate to parent. */
   49       public Decorator getNamedDecorator(HttpServletRequest request, String name) {
   50           return parent.getNamedDecorator(request, name);
   51       }
   52   }

Save This Page
Home » sitemesh-2.3 » com.opensymphony.module » sitemesh » mapper » [javadoc | source]