Package javax.faces.component

Examples of javax.faces.component.UIViewRoot$ComponentResourceContainer


    private Map<String, List<String>> getViewParameterList(FacesContext context,
            String viewId, Map<String, List<String>> parametersFromArg)
    {

        Map<String, List<String>> viewParameters;
        UIViewRoot viewRoot = context.getViewRoot();
        String currentViewId = viewRoot.getViewId();
        Collection<UIViewParameter> toViewParams = null;
        Collection<UIViewParameter> currentViewParams = ViewMetadata.getViewParameters(viewRoot);

        if (currentViewId.equals(viewId))
        {
            toViewParams = currentViewParams;
        }
        else
        {
            String calculatedViewId = getViewHandlerSupport().calculateViewId(context, viewId);           
            ViewDeclarationLanguage vdl = getViewDeclarationLanguage(context,calculatedViewId);
            ViewMetadata viewMetadata = vdl.getViewMetadata(context, viewId);
            // getViewMetadata() returns null on JSP
            if (viewMetadata != null)
            {
                UIViewRoot viewFromMetaData = viewMetadata.createMetadataView(context);
                toViewParams = ViewMetadata.getViewParameters(viewFromMetaData);
            }
        }

        if (toViewParams == null || toViewParams.isEmpty())
View Full Code Here


        Application application = facesContext.getApplication();
        ViewHandler applicationViewHandler = application.getViewHandler();

        Locale currentLocale = null;
        String currentRenderKitId = null;
        UIViewRoot uiViewRoot = facesContext.getViewRoot();
        if (uiViewRoot != null)
        {
            // Remember current locale and renderKitId
            currentLocale = uiViewRoot.getLocale();
            currentRenderKitId = uiViewRoot.getRenderKitId();
        }

        uiViewRoot = (UIViewRoot) application.createComponent(UIViewRoot.COMPONENT_TYPE);

        uiViewRoot.setViewId(calculatedViewId);

        if (currentLocale != null)
        {
            // set old locale
            uiViewRoot.setLocale(currentLocale);
        }
        else
        {
            // calculate locale
            uiViewRoot.setLocale(applicationViewHandler.calculateLocale(facesContext));
        }

        if (currentRenderKitId != null)
        {
            // set old renderKit
            uiViewRoot.setRenderKitId(currentRenderKitId);
        }
        else
        {
            // calculate renderKit
            uiViewRoot.setRenderKitId(applicationViewHandler.calculateRenderKitId(facesContext));
        }

        if (log.isLoggable(Level.FINEST))
            log.finest("Created view " + viewId);
        return uiViewRoot;
View Full Code Here

    {
        Application application = facesContext.getApplication();
        ViewHandler applicationViewHandler = application.getViewHandler();
        String renderKitId = applicationViewHandler.calculateRenderKitId(facesContext);
        String calculatedViewId = getViewHandlerSupport().calculateViewId(facesContext, viewId);
        UIViewRoot viewRoot = application.getStateManager().restoreView(facesContext, calculatedViewId, renderKitId);
        return viewRoot;
    }
View Full Code Here

    @Override
    protected Object getComponentStateToSave(FacesContext facesContext)
    {
        if (log.isLoggable(Level.FINEST)) log.finest("Entering getComponentStateToSave");

        UIViewRoot viewRoot = facesContext.getViewRoot();
        if (viewRoot.isTransient())
        {
            return null;
        }

        Object serializedComponentStates = viewRoot.processSaveState(facesContext);
        //Locale is a state attribute of UIViewRoot and need not be saved explicitly
        if (log.isLoggable(Level.FINEST)) log.finest("Exiting getComponentStateToSave");
        return serializedComponentStates;
    }
View Full Code Here

     */
    @Override
    protected Object getTreeStructureToSave(FacesContext facesContext)
    {
        if (log.isLoggable(Level.FINEST)) log.finest("Entering getTreeStructureToSave");
        UIViewRoot viewRoot = facesContext.getViewRoot();
        if (viewRoot.isTransient())
        {
            return null;
        }
        TreeStructureManager tsm = new TreeStructureManager();
        Object retVal = tsm.buildTreeStructureToSave(viewRoot);
View Full Code Here

        if (log.isLoggable(Level.FINEST)) log.finest("Entering restoreTreeStructure");

        RenderKit rk = getRenderKitFactory().getRenderKit(facesContext, renderKitId);
        ResponseStateManager responseStateManager = rk.getResponseStateManager();

        UIViewRoot uiViewRoot;
        if (isSavingStateInClient(facesContext))
        {
            //reconstruct tree structure from request
            Object treeStructure = responseStateManager.getTreeStructureToRestore(facesContext, viewId);
            if (treeStructure == null)
View Full Code Here

    @Override
    public UIViewRoot restoreView(FacesContext facesContext, String viewId, String renderKitId)
    {
        if (log.isLoggable(Level.FINEST)) log.finest("Entering restoreView - viewId: "+viewId+" ; renderKitId: "+renderKitId);

        UIViewRoot uiViewRoot = null;
       
        ViewDeclarationLanguage vdl = facesContext.getApplication().
            getViewHandler().getViewDeclarationLanguage(facesContext,viewId);
        StateManagementStrategy sms = null;
        if (vdl != null)
        {
            sms = vdl.getStateManagementStrategy(facesContext, viewId);
        }
       
        if (sms != null)
        {
            if (log.isLoggable(Level.FINEST)) log.finest("Redirect to StateManagementStrategy: "+sms.getClass().getName());
           
            uiViewRoot = sms.restoreView(facesContext, viewId, renderKitId);
        }
        else
        {
            RenderKit renderKit = getRenderKitFactory().getRenderKit(facesContext, renderKitId);
            ResponseStateManager responseStateManager = renderKit.getResponseStateManager();

            Object state;
            if (isSavingStateInClient(facesContext))
            {
                if (log.isLoggable(Level.FINEST)) log.finest("Restoring view from client");

                state = responseStateManager.getState(facesContext, viewId);
            }
            else
            {
                if (log.isLoggable(Level.FINEST)) log.finest("Restoring view from session");

                Integer serverStateId = getServerStateId((Object[]) responseStateManager.getState(facesContext, viewId));

                state = getSerializedViewFromServletSession(facesContext, viewId, serverStateId);
            }

            if (state != null) {
                Object[] stateArray = (Object[])state;
                TreeStructureManager tsm = new TreeStructureManager();
                uiViewRoot = tsm.restoreTreeStructure(stateArray[0]);

                if (uiViewRoot != null) {
                    facesContext.setViewRoot (uiViewRoot);
                    uiViewRoot.processRestoreState(facesContext, stateArray[1]);
                }
            }           
        }
        if (log.isLoggable(Level.FINEST)) log.finest("Exiting restoreView - "+viewId);
View Full Code Here

     * necessary
     */
    @Override
    public Object saveView(FacesContext facesContext)
    {
        UIViewRoot uiViewRoot = facesContext.getViewRoot();
       
        String viewId = uiViewRoot.getViewId();
        ViewDeclarationLanguage vdl = facesContext.getApplication().
            getViewHandler().getViewDeclarationLanguage(facesContext,viewId);
        if (vdl != null)
        {
            StateManagementStrategy sms = vdl.getStateManagementStrategy(facesContext, viewId);
           
            if (sms != null)
            {
                if (log.isLoggable(Level.FINEST)) log.finest("Calling saveView of StateManagementStrategy: "+sms.getClass().getName());
               
                return sms.saveView(facesContext);
            }
        }

        // In StateManagementStrategy.saveView there is a check for transient at
        // start, but the same applies for VDL without StateManagementStrategy,
        // so this should be checked before call parent (note that parent method
        // does not do this check).
        if (uiViewRoot.isTransient())
        {
            return null;
        }

        return super.saveView(facesContext);
View Full Code Here

    public void writeState(FacesContext facesContext,
                           SerializedView serializedView) throws IOException
    {
        if (log.isLoggable(Level.FINEST)) log.finest("Entering writeState");

        UIViewRoot uiViewRoot = facesContext.getViewRoot();
        //save state in response (client)
        RenderKit renderKit = getRenderKitFactory().getRenderKit(facesContext, uiViewRoot.getRenderKitId());
        ResponseStateManager responseStateManager = renderKit.getResponseStateManager();

        if (isLegacyResponseStateManager(responseStateManager))
        {
            responseStateManager.writeState(facesContext, serializedView);
View Full Code Here

    }

    @Override
    public String getViewState(FacesContext facesContext)
    {
        UIViewRoot uiViewRoot = facesContext.getViewRoot();
        String viewId = uiViewRoot.getViewId();
        ViewDeclarationLanguage vdl = facesContext.getApplication().getViewHandler().getViewDeclarationLanguage(facesContext,viewId);
        if (vdl != null)
        {
            StateManagementStrategy sms = vdl.getStateManagementStrategy(facesContext, viewId);
           
View Full Code Here

TOP

Related Classes of javax.faces.component.UIViewRoot$ComponentResourceContainer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.