Package org.springframework.webflow.engine

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


    assertEquals("baz", exp.getValue(context));
  }

  public void testResolveViewScope() {
    MockRequestControlContext context = new MockRequestControlContext();
    ViewState state = new ViewState(context.getRootFlow(), "view", new StubViewFactory());
    context.setCurrentState(state);
    context.getViewScope().put("foo", "bar");
    Expression exp = parser.parseExpression("foo", new FluentParserContext().evaluate(RequestContext.class));
    assertEquals("bar", exp.getValue(context));
  }
View Full Code Here

    assertEquals("bar", exp.getValue(context));
  }

  public void testSetViewScope() {
    MockRequestControlContext context = new MockRequestControlContext();
    ViewState state = new ViewState(context.getRootFlow(), "view", new StubViewFactory());
    context.setCurrentState(state);
    context.getViewScope().put("foo", "bar");
    Expression exp = parser.parseExpression("foo", new FluentParserContext().evaluate(RequestContext.class));
    exp.setValue(context, "baz");
    assertEquals("baz", exp.getValue(context));
View Full Code Here

  public void testGetFlowExecutorBasicConfig() throws Exception {
    factoryBean.setFlowDefinitionLocator(new FlowDefinitionLocator() {
      public FlowDefinition getFlowDefinition(String id) throws NoSuchFlowDefinitionException,
          FlowDefinitionConstructionException {
        Flow flow = new Flow(id);
        ViewState view = new ViewState(flow, "view", new StubViewFactory());
        view.getTransitionSet().add(new Transition(new DefaultTargetStateResolver("end")));
        new EndState(flow, "end");
        return flow;
      }
    });
    factoryBean.afterPropertiesSet();
View Full Code Here

  public void testGetFlowExecutorOptionsSpecified() throws Exception {
    factoryBean.setFlowDefinitionLocator(new FlowDefinitionLocator() {
      public FlowDefinition getFlowDefinition(String id) throws NoSuchFlowDefinitionException,
          FlowDefinitionConstructionException {
        Flow flow = new Flow(id);
        ViewState view = new ViewState(flow, "view", new StubViewFactory());
        view.getTransitionSet().add(new Transition(new DefaultTargetStateResolver("end")));
        new EndState(flow, "end");
        return flow;
      }
    });
    Set attributes = new HashSet();
View Full Code Here

    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

   
    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

        // 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

   * @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

    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

TOP

Related Classes of org.springframework.webflow.engine.ViewState

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.