Package javax.faces.application.StateManager

Examples of javax.faces.application.StateManager.SerializedView


{
    public static final String RENDER_KIT_ID_PARAM = "javax.faces.RenderKitId";
    public static final String VIEW_STATE_PARAM = "javax.faces.ViewState";
   
    public void writeState(FacesContext context, Object state) throws IOException{
        SerializedView view;
        if (state instanceof SerializedView)
        {
            view = (SerializedView) state;
        }
        else
            if (state instanceof Object[])
            {
                Object[] structureAndState = (Object[]) state;

                if (structureAndState.length == 2)
                {
                    Object structureObj = structureAndState[0];
                    Object stateObj = structureAndState[1];

                    StateManager stateManager = context.getApplication().getStateManager();
                    view = stateManager.new SerializedView(structureObj, stateObj);
                }
                else
                {
                    throw new IOException("The state should be an array of Object[] of lenght 2");
                }
View Full Code Here


        Object treeStruct = null;
        Object compStates = null;

        if (state instanceof SerializedView)
        {
            SerializedView view = (SerializedView) state;
            treeStruct = view.getStructure();
            compStates = view.getState();
        }
        else if (state instanceof Object[])
        {
            Object[] structureAndState = (Object[]) state;
View Full Code Here

    } catch (NoSuchMethodException e) {
      // JSF 1.1 !
    }
    ResponseWriter writer = context.getResponseWriter();
    StateManager stateManager = context.getApplication().getStateManager();
    SerializedView serializedView = stateManager
        .saveSerializedView(context);
    if (null != serializedView) {
      StringWriter bufWriter = new StringWriter();
      ResponseWriter cloneWithWriter = writer.cloneWithWriter(bufWriter);
      context.setResponseWriter(cloneWithWriter);
View Full Code Here

    public static final String RENDER_KIT_ID_PARAM = "javax.faces.RenderKitId";
    public static final String VIEW_STATE_PARAM = "javax.faces.ViewState";

    public void writeState(FacesContext context, Object state) throws IOException
    {
        SerializedView view;
        if (state instanceof SerializedView)
        {
            view = (SerializedView)state;
        }
        else if (state instanceof Object[])
        {
            Object[] structureAndState = (Object[])state;

            if (structureAndState.length == 2)
            {
                Object structureObj = structureAndState[0];
                Object stateObj = structureAndState[1];

                StateManager stateManager = context.getApplication().getStateManager();
                view = stateManager.new SerializedView(structureObj, stateObj);
            }
            else
            {
                throw new IOException("The state should be an array of Object[] of lenght 2");
            }
View Full Code Here

    public static final String RENDER_KIT_ID_PARAM = "javax.faces.RenderKitId";
    public static final String VIEW_STATE_PARAM = "javax.faces.ViewState";

    public void writeState(FacesContext context, Object state) throws IOException
    {
        SerializedView view;
        if (state instanceof SerializedView)
        {
            view = (SerializedView)state;
        }
        else if (state instanceof Object[])
        {
            Object[] structureAndState = (Object[])state;

            if (structureAndState.length == 2)
            {
                Object structureObj = structureAndState[0];
                Object stateObj = structureAndState[1];

                StateManager stateManager = context.getApplication().getStateManager();
                view = stateManager.new SerializedView(structureObj, stateObj);
            }
            else
            {
                throw new IOException("The state should be an array of Object[] of lenght 2");
            }
View Full Code Here

    @SuppressWarnings("deprecation")
    public SerializedView saveSerializedView(FacesContext context) {
      // delegate to enclosed class method.
      Object[] viewState = buildViewState(context);
      return new SerializedView(viewState[0],viewState[1]);
    }
View Full Code Here

      stateViewArray = buildViewState(context);
    } else {
      // Delegate save method to seam State Manager.
      stateViewArray=(Object[]) seamStateManager.saveView(context);
    }
    return new SerializedView(stateViewArray[0],stateViewArray[1]);
  }
View Full Code Here

  return structure;
    }

    public void writeState(FacesContext context,
                           Object state) throws IOException {
        SerializedView view = null;
        if (state instanceof SerializedView) {
            view = (SerializedView) state;
        }
        else {
            Object[] stateArray = (Object[])state;
            StateManager stateManager =
                context.getApplication().getStateManager();
            view = stateManager.new SerializedView(stateArray[0], null);
        }
        writeSerializedState(context, view);
    }
View Full Code Here

        root.getChildren().add(comp3);
       
        getFacesContext().setViewRoot(root);
        root.getAttributes().put("checkThisValue", "checkThisValue");
       
        SerializedView viewState = wrapper.saveSerializedView(getFacesContext());
       
        // See that the Logical View and Actual View maps are correctly created
        Map sessionMap = getFacesContext().getExternalContext().getSessionMap();
        assertTrue(sessionMap.containsKey(RequestStateManager.LOGICAL_VIEW_MAP));
        assertTrue(((Map)sessionMap.get(RequestStateManager.LOGICAL_VIEW_MAP)).containsKey("j_id1"));
View Full Code Here

        getFacesContext().setViewRoot(root);

        StateManager stateManager =
            getFacesContext().getApplication().getStateManager();
  SerializedView viewState =
      stateManager.saveSerializedView(getFacesContext());
  assertTrue(null != viewState);
  try {
      RenderKit curKit = RenderKitUtils.getCurrentRenderKit(getFacesContext());
      StringWriter writer = new StringWriter();
View Full Code Here

TOP

Related Classes of javax.faces.application.StateManager.SerializedView

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.