faceletviewbuilder.java

来自「Please read your package and describe it」· Java 代码 · 共 135 行

JAVA
135
字号
/* * Copyright 2002-2004 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * *      http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */package de.mindmatters.faces.application;import java.io.IOException;import java.util.Locale;import javax.faces.FacesException;import javax.faces.application.ViewHandler;import javax.faces.component.UIViewRoot;import javax.faces.context.FacesContext;/** * <strong>ViewBuilder</strong> implementation based upon jsf-facelets. * Facelets is able to restore the structure of a view without any state * representing the tree structure. *  * <p> * Configure this resolver in your <code>faces-config.xml</code> file as * follows: *  * <pre> * &lt;application&gt; *   ... *   &lt;view-handler&gt;de.mindmatters.faces.application.FaceletViewBuilder&lt;/view-handler&gt; * &lt;/application&gt; * </pre> *  * @author Andreas Kuhrwahl * @see ViewBuilder * @see ViewBuilder#buildView(FacesContext, String) * @see com.sun.facelets.FaceletViewHandler */public class FaceletViewBuilder extends ViewBuilder {    /** The original {@link ViewHandler}. */    private final ExtendedFaceletViewHandler delegate;    /**     * Constructor that takes the original {@link ViewHandler}.     *      * @param delegate     *            the original {@link ViewHandler}     */    public FaceletViewBuilder(final ViewHandler delegate) {        super();        this.delegate = new ExtendedFaceletViewHandler(delegate);    }    /**     * {@inheritDoc}     */    public UIViewRoot buildView(final FacesContext context, final String viewId) {        try {            return this.delegate.buildView(context, viewId);        } catch (Exception ex) {            throw new FacesException(ex.getMessage(), ex);        }    }    /**     * {@inheritDoc}     */    protected void writeStateInClient(final FacesContext context)            throws IOException {        this.delegate.writeState(context);    }    /**     * {@inheritDoc}     */    public Locale calculateLocale(final FacesContext context) {        return this.delegate.calculateLocale(context);    }    /**     * {@inheritDoc}     */    public String calculateRenderKitId(final FacesContext context) {        return this.delegate.calculateRenderKitId(context);    }    /**     * {@inheritDoc}     */    public UIViewRoot createView(final FacesContext context, final String viewId) {        return this.delegate.createView(context, viewId);    }    /**     * {@inheritDoc}     */    public String getActionURL(final FacesContext context, final String viewId) {        return this.delegate.getActionURL(context, viewId);    }    /**     * {@inheritDoc}     */    public String getResourceURL(final FacesContext context, final String path) {        return this.delegate.getResourceURL(context, path);    }    /**     * {@inheritDoc}     */    public void renderView(final FacesContext context,            final UIViewRoot viewToRender) throws IOException {        this.delegate.renderView(context, viewToRender);    }    /**     * {@inheritDoc}     */    public UIViewRoot restoreView(final FacesContext context,            final String viewId) {        return this.delegate.restoreView(context, viewId);    }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?