Save This Page
Home » mojarra-1.2_09-b02-FCS-source » javax.faces.application » [javadoc | source]
    1   /*
    2    * $Id: ViewHandlerWrapper.java,v 1.6 2007/04/27 22:00:02 ofung Exp $
    3    */
    4   
    5   /*
    6    * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    7    * 
    8    * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
    9    * 
   10    * The contents of this file are subject to the terms of either the GNU
   11    * General Public License Version 2 only ("GPL") or the Common Development
   12    * and Distribution License("CDDL") (collectively, the "License").  You
   13    * may not use this file except in compliance with the License. You can obtain
   14    * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
   15    * or glassfish/bootstrap/legal/LICENSE.txt.  See the License for the specific
   16    * language governing permissions and limitations under the License.
   17    * 
   18    * When distributing the software, include this License Header Notice in each
   19    * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
   20    * Sun designates this particular file as subject to the "Classpath" exception
   21    * as provided by Sun in the GPL Version 2 section of the License file that
   22    * accompanied this code.  If applicable, add the following below the License
   23    * Header, with the fields enclosed by brackets [] replaced by your own
   24    * identifying information: "Portions Copyrighted [year]
   25    * [name of copyright owner]"
   26    * 
   27    * Contributor(s):
   28    * 
   29    * If you wish your version of this file to be governed by only the CDDL or
   30    * only the GPL Version 2, indicate your decision by adding "[Contributor]
   31    * elects to include this software in this distribution under the [CDDL or GPL
   32    * Version 2] license."  If you don't indicate a single choice of license, a
   33    * recipient has the option to distribute your version of this file under
   34    * either the CDDL, the GPL Version 2 or to extend the choice of license to
   35    * its licensees as provided above.  However, if you add GPL Version 2 code
   36    * and therefore, elected the GPL Version 2 license, then the option applies
   37    * only if the new code is made subject to such option by the copyright
   38    * holder.
   39    */
   40   
   41   package javax.faces.application;
   42   
   43   import javax.faces.context.FacesContext;
   44   import javax.faces.component.UIViewRoot;
   45   import javax.faces.FacesException;
   46   
   47   import java.util.Locale;
   48   import java.io.IOException;
   49   
   50   /**
   51    * <p>Provides a simple implementation of {@link ViewHandler} that can
   52    * be subclassed by developers wishing to provide specialized behavior
   53    * to an existing {@link ViewHandler} instance.  The default
   54    * implementation of all methods is to call through to the wrapped
   55    * {@link ViewHandler}.</p>
   56    *
   57    * <p>Usage: extend this class and override {@link #getWrapped} to
   58    * return the instance we are wrapping.</p>
   59    *
   60    * @since 1.2
   61    */
   62   public abstract class ViewHandlerWrapper extends ViewHandler {
   63   
   64   
   65       /**
   66        * @return the instance that we are wrapping.
   67        */ 
   68   
   69       abstract protected ViewHandler getWrapped();
   70   
   71   
   72       // ------------------------ Methods from javax.faces.application.ViewHandler
   73   
   74   
   75       /**
   76        * 
   77        * <p>The default behavior of this method is to
   78        * call {@link ViewHandler#calculateCharacterEncoding(javax.faces.context.FacesContext)}
   79        * on the wrapped {@link ViewHandler} object.</p>
   80        *
   81        * @see ViewHandler#calculateCharacterEncoding(javax.faces.context.FacesContext)
   82        * @since 1.2
   83        */
   84   
   85       public String calculateCharacterEncoding(FacesContext context) {
   86   
   87           return getWrapped().calculateCharacterEncoding(context);
   88   
   89       }
   90           
   91       /**
   92        * 
   93        * <p>The default behavior of this method is to
   94        * call {@link ViewHandler#calculateLocale(javax.faces.context.FacesContext)}
   95        * on the wrapped {@link ViewHandler} object.</p>
   96        *
   97        * @see ViewHandler#calculateLocale(javax.faces.context.FacesContext)
   98        * @since 1.2
   99        */
  100       public Locale calculateLocale(FacesContext context) {
  101   
  102           return getWrapped().calculateLocale(context);
  103   
  104       }
  105   
  106   
  107       /**
  108        * <p>The default behavior of this method is to
  109        * call {@link ViewHandler#calculateRenderKitId(javax.faces.context.FacesContext)}
  110        * on the wrapped {@link ViewHandler} object.</p>
  111        *
  112        * @see ViewHandler#calculateRenderKitId(javax.faces.context.FacesContext)
  113        * @since 1.2
  114        */
  115       public String calculateRenderKitId(FacesContext context) {
  116   
  117           return getWrapped().calculateRenderKitId(context);
  118   
  119       }
  120   
  121   
  122       /**
  123        * <p>The default behavior of this method is to
  124        * call {@link ViewHandler#createView(javax.faces.context.FacesContext, String)}
  125        * on the wrapped {@link ViewHandler} object.</p>
  126        *
  127        * @see ViewHandler#createView(javax.faces.context.FacesContext, String)
  128        * @since 1.2
  129        */
  130       public UIViewRoot createView(FacesContext context, String viewId) {
  131   
  132           return getWrapped().createView(context, viewId);
  133   
  134       }
  135   
  136   
  137       /**
  138        * <p>The default behavior of this method is to
  139        * call {@link ViewHandler#getActionURL(javax.faces.context.FacesContext, String)}
  140        * on the wrapped {@link ViewHandler} object.</p>
  141        *
  142        * @see ViewHandler#getActionURL(javax.faces.context.FacesContext, String)
  143        * @since 1.2
  144        */
  145       public String getActionURL(FacesContext context, String viewId) {
  146   
  147           return getWrapped().getActionURL(context, viewId);
  148   
  149       }
  150   
  151   
  152       /**
  153        * <p>The default behavior of this method is to
  154        * call {@link ViewHandler#getResourceURL(javax.faces.context.FacesContext, String)}
  155        * on the wrapped {@link ViewHandler} object.</p>
  156        *
  157        * @see ViewHandler#getResourceURL(javax.faces.context.FacesContext, String)
  158        * @since 1.2
  159        */
  160       public String getResourceURL(FacesContext context, String path) {
  161   
  162           return getWrapped().getResourceURL(context, path);
  163       }
  164       
  165       /**
  166        * <p>The default behavior of this method is to
  167        * call {@link ViewHandler#initView}
  168        * on the wrapped {@link ViewHandler} object.</p>
  169        *
  170        * @see ViewHandler#initView
  171        * @since 1.2
  172        */
  173       public void initView(FacesContext context) throws FacesException {
  174           
  175           getWrapped().initView(context);
  176       }
  177       
  178       /**
  179        * <p>The default behavior of this method is to
  180        * call {@link ViewHandler#renderView(javax.faces.context.FacesContext, javax.faces.component.UIViewRoot)}
  181        * on the wrapped {@link ViewHandler} object.</p>
  182        *
  183        * @see ViewHandler#renderView(javax.faces.context.FacesContext, javax.faces.component.UIViewRoot)
  184        * @since 1.2
  185        */
  186       public void renderView(FacesContext context, UIViewRoot viewToRender)
  187       throws IOException, FacesException {
  188   
  189           getWrapped().renderView(context, viewToRender);
  190   
  191       }
  192   
  193   
  194       /**
  195        * <p>The default behavior of this method is to
  196        * call {@link ViewHandler#restoreView(javax.faces.context.FacesContext, String)}
  197        * on the wrapped {@link ViewHandler} object.</p>
  198        *
  199        * @see ViewHandler#restoreView(javax.faces.context.FacesContext, String)
  200        * @since 1.2
  201        */
  202       public UIViewRoot restoreView(FacesContext context, String viewId) {
  203   
  204           return getWrapped().restoreView(context, viewId);
  205   
  206       }
  207   
  208       /**
  209        * <p>The default behavior of this method is to
  210        * call {@link ViewHandler#writeState(javax.faces.context.FacesContext)}
  211        * on the wrapped {@link ViewHandler} object.</p>
  212        *
  213        * @see ViewHandler#writeState(javax.faces.context.FacesContext)
  214        * @since 1.2
  215        */
  216       public void writeState(FacesContext context) throws IOException {
  217   	getWrapped().writeState(context);
  218   
  219       }
  220   
  221   }

Save This Page
Home » mojarra-1.2_09-b02-FCS-source » javax.faces.application » [javadoc | source]