Examples of ViewState


Examples of org.springframework.webflow.engine.ViewState

   
    private Flow createSimpleFlow(final String id) {
        // Create a flat flow with an action and single view state
        final Flow flow = new Flow(id);
        final ActionState state1 = new ActionState(flow, "state1-action");
        final ViewState state2 = new ViewState(flow, "state2-view", new MockViewFactory("view"));
        new EndState(flow, "state3-end");
        state1.getActionList().add(new MockAction("state1-result"));
        state1.getTransitionSet().add(new Transition(new DefaultTargetStateResolver("state2-view")));
        state2.getTransitionSet().add(new Transition(new DefaultTargetStateResolver("state3-end")));
        return flow;
    }
View Full Code Here

Examples of org.springframework.webflow.engine.ViewState

        // Create a flow containing a subflow followed by a view state
        final Flow parent = new Flow(parentId);
        final Flow child = createSimpleFlow(childId);
        final ActionState state1 = new ActionState(parent, "state1-action");
        final SubflowState state2 = new SubflowState(parent, "state2-subflow", new StaticExpression(child));
        final ViewState state3 = new ViewState(parent, "state3-view", new MockViewFactory("parentview"));
        new EndState(parent, "state4-end");
        state1.getActionList().add(new MockAction("state1-result"));
        state1.getTransitionSet().add(new Transition(new DefaultTargetStateResolver("state2-subflow")));
        state2.getTransitionSet().add(new Transition(new DefaultTargetStateResolver("state3-view")));
        state3.getTransitionSet().add(new Transition(new DefaultTargetStateResolver("state4-end")));
        return parent;
    }
View Full Code Here

Examples of org.springframework.webflow.engine.ViewState

   * @return the fully initialized view state instance
   */
  public State createViewState(String id, Flow flow, ViewVariable[] variables, Action[] entryActions,
      ViewFactory viewFactory, Boolean redirect, boolean popup, Action[] renderActions, Transition[] transitions,
      FlowExecutionExceptionHandler[] exceptionHandlers, Action[] exitActions, AttributeMap attributes) {
    ViewState viewState = new ViewState(flow, id, viewFactory);
    viewState.addVariables(variables);
    viewState.setRedirect(redirect);
    viewState.setPopup(popup);
    viewState.getRenderActionList().addAll(renderActions);
    configureCommonProperties(viewState, entryActions, transitions, exceptionHandlers, exitActions, attributes);
    return viewState;
  }
View Full Code Here

Examples of org.springframework.webflow.engine.ViewState

    context.getELResolver().setValue(context, null, getBaseVariable(), null);
    assertFalse("setValue should be a no-op when no flow is active", context.isPropertyResolved());
  }

  protected void initView(MockRequestContext requestContext) {
    ((MockFlowSession) requestContext.getFlowExecutionContext().getActiveSession()).setState(new ViewState(
        requestContext.getRootFlow(), "view", new ViewFactory() {
          public View getView(RequestContext context) {
            throw new UnsupportedOperationException("Auto-generated method stub");
          }
        }));
View Full Code Here

Examples of org.springframework.webflow.engine.ViewState

    }
  }

  public void testDispatchWithCurrentStateId() throws Exception {
    MockFlowSession session = context.getMockFlowExecutionContext().getMockActiveSession();
    session.setState(new ViewState(session.getDefinitionInternal(), "increment", new StubViewFactory()));
    action.execute(context);
    assertEquals(1, action.counter);
  }
View Full Code Here

Examples of org.springframework.webflow.engine.ViewState

  private Map<String, ?> model;

  public void testRender() throws Exception {
    MockRequestControlContext context = new MockRequestControlContext();
    context.setCurrentState(new ViewState(context.getRootFlow(), "test", new StubViewFactory()));
    context.getRequestScope().put("foo", "bar");
    context.getFlowScope().put("bar", "baz");
    context.getFlowScope().put("bindBean", new BindBean());
    context.getConversationScope().put("baz", "boop");
    context.getFlashScope().put("boop", "bing");
View Full Code Here

Examples of org.springframework.webflow.engine.ViewState

    assertNull(model.get(BindingResult.MODEL_KEY_PREFIX + "bindBean"));
  }

  public void testRenderWithBindingModel() throws Exception {
    MockRequestControlContext context = new MockRequestControlContext();
    context.setCurrentState(new ViewState(context.getRootFlow(), "test", new StubViewFactory()));
    Object bindBean = new BindBean();
    StaticExpression modelObject = new StaticExpression(bindBean);
    modelObject.setExpressionString("bindBean");
    context.getCurrentState().getAttributes().put("model", modelObject);
    context.getFlowScope().put("bindBean", bindBean);
View Full Code Here

Examples of org.springframework.webflow.engine.ViewState

  public void testStateEnteringNoSecurity() {
    SecurityFlowExecutionListener listener = new SecurityFlowExecutionListener();
    RequestContext context = new MockRequestContext();
    Flow flow = new Flow("flow");
    ViewState state = new ViewState(flow, "view", new StubViewFactory());
    listener.stateEntering(context, state);
  }
View Full Code Here

Examples of org.springframework.webflow.engine.ViewState

  public void testStateEnteringWithSecurity() {
    SecurityFlowExecutionListener listener = new SecurityFlowExecutionListener();
    RequestContext context = new MockRequestContext();
    Flow flow = new Flow("flow");
    ViewState state = new ViewState(flow, "view", new StubViewFactory());
    SecurityRule rule = getSecurityRuleAllAuthorized();
    state.getAttributes().put(SecurityRule.SECURITY_ATTRIBUTE_NAME, rule);
    configureSecurityContext();
    listener.stateEntering(context, state);
  }
View Full Code Here

Examples of org.springframework.webflow.engine.ViewState

    }
  }

  public void testResume() {
    Flow flow = new Flow("flow");
    new ViewState(flow, "view", new StubViewFactory());
    MockFlowExecutionListener mockListener = new MockFlowExecutionListener();
    FlowExecutionListener[] listeners = new FlowExecutionListener[] { mockListener };
    FlowExecutionImpl execution = new FlowExecutionImpl(flow);
    execution.setListeners(listeners);
    execution.setKeyFactory(new MockFlowExecutionKeyFactory());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.