⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 optimizedstatemanager.java

📁 Please read your package and describe it at least 40 bytes in English. System will automatically de
💻 JAVA
字号:
/* * 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 javax.faces.FactoryFinder;import javax.faces.application.StateManager;import javax.faces.component.UIViewRoot;import javax.faces.context.FacesContext;import javax.faces.render.RenderKit;import javax.faces.render.RenderKitFactory;import javax.faces.render.ResponseStateManager;import org.springframework.util.Assert;/** * <strong>OptimizedStateManager</strong> saves and restores the state of the * component tree. *  * @author Andreas Kuhrwahl *  */public final class OptimizedStateManager extends        AbstractViewBuildingStateManager {    /**     * Creates an OptimizedStateManager with the given state manager     * <code>delegate</code> of the underlying JSF implementation.     *      * @param delegate     *            the original state manager of the underlying JSF     *            implementation     */    public OptimizedStateManager(final StateManager delegate) {        super(delegate);    }    /**     * {@inheritDoc}     */    protected Object getComponentStateToSave(final FacesContext context) {        UIViewRoot viewRoot = context.getViewRoot();        return viewRoot.processSaveState(context);    }    /**     * {@inheritDoc}     */    protected void restoreComponentState(final FacesContext context,            final UIViewRoot viewRoot, final String renderKitId) {        Object state = getResponseStateManager(context, renderKitId)                .getComponentStateToRestore(context);        Assert.notNull(state);        viewRoot.processRestoreState(context, state);    }    /**     * Resolves the appropriate ResponseStateManager for the given     * <code>renderKitId</code>.     *      * @param context     *            {@link FacesContext} for the current request     * @param renderKitId     *            the renderKitId used to render this response. Must not be     *            <code>null</code>.     * @return the ResponseStateManager to use     * @throws javax.faces.FacesException     *             in cases of errors     */    private ResponseStateManager getResponseStateManager(            final FacesContext context, final String renderKitId) {        RenderKit renderKit = ((RenderKitFactory) FactoryFinder                .getFactory(FactoryFinder.RENDER_KIT_FACTORY)).getRenderKit(                context, renderKitId);        Assert.notNull(renderKit);        return renderKit.getResponseStateManager();    }}

⌨️ 快捷键说明

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