Package org.springframework.webflow.execution

Examples of org.springframework.webflow.execution.View


  public void testProcessUserEventButton() throws IOException {
    TestAction action = new TestAction();
    ActionExecutingViewFactory factory = new ActionExecutingViewFactory(action);
    MockRequestContext context = new MockRequestContext();
    View view = factory.getView(context);
    assertFalse(action.isExecuted());
    view.render();
    assertTrue(action.isExecuted());
    context.putRequestParameter("_eventId_foo", "doesn't matter");
    view.processUserEvent();
    assertTrue(view.hasFlowEvent());
    assertEquals("foo", view.getFlowEvent().getId());
  }
View Full Code Here


  public void testProcessUserEventNoEvent() throws IOException {
    TestAction action = new TestAction();
    ActionExecutingViewFactory factory = new ActionExecutingViewFactory(action);
    MockRequestContext context = new MockRequestContext();
    View view = factory.getView(context);
    assertFalse(action.isExecuted());
    view.render();
    assertTrue(action.isExecuted());
    view.processUserEvent();
    assertFalse(view.hasFlowEvent());
    assertNull(view.getFlowEvent());
  }
View Full Code Here

    this.context.inViewState();
    EasyMock.expectLastCall().andReturn(true);

    EasyMock.replay(new Object[] { this.context });

    View newView = this.factory.getView(this.context);

    assertNotNull("A View was not created", newView);
    assertTrue("A JsfView was expected", newView instanceof JsfView);
    assertEquals("View name did not match", VIEW_ID, ((JsfView) newView).getViewRoot().getViewId());
    assertFalse("An unexpected event was signaled,", newView.hasFlowEvent());
  }
View Full Code Here

    this.context.inViewState();
    EasyMock.expectLastCall().andReturn(true);

    EasyMock.replay(new Object[] { this.context });

    View restoredView = this.factory.getView(this.context);

    assertNotNull("A View was not restored", restoredView);
    assertTrue("A JsfView was expected", restoredView instanceof JsfView);
    assertEquals("View name did not match", VIEW_ID, ((JsfView) restoredView).getViewRoot().getViewId());
    assertFalse("An unexpected event was signaled,", restoredView.hasFlowEvent());
    assertTrue("The input component's valid flag was not reset", input.isValid());
    assertTrue("The PostRestoreViewEvent was not seen", existingRoot.isPostRestoreStateEventSeen());
  }
View Full Code Here

    this.context.inViewState();
    EasyMock.expectLastCall().andReturn(true);

    EasyMock.replay(new Object[] { this.context });

    View restoredView = this.factory.getView(this.context);

    assertNotNull("A View was not restored", restoredView);
    assertTrue("A JsfView was expected", restoredView instanceof JsfView);
    assertEquals("View name did not match", VIEW_ID, ((JsfView) restoredView).getViewRoot().getViewId());
    assertFalse("An unexpected event was signaled,", restoredView.hasFlowEvent());
    assertSame("The UIInput binding was not restored properly", input, testBean.getInput());
    assertSame("The faceted UIOutput binding was not restored properly", output, testBean.getOutput());
    assertTrue("The PostRestoreViewEvent was not seen", existingRoot.isPostRestoreStateEventSeen());
  }
View Full Code Here

    this.context.inViewState();
    EasyMock.expectLastCall().andReturn(true);

    EasyMock.replay(new Object[] { this.context });

    View restoredView = this.factory.getView(this.context);

    assertNotNull("A View was not restored", restoredView);
    assertTrue("A JsfView was expected", restoredView instanceof JsfView);
    assertTrue("An ViewRoot was not set", ((JsfView) restoredView).getViewRoot() instanceof UIViewRoot);
    assertEquals("View name did not match", VIEW_ID, ((JsfView) restoredView).getViewRoot().getViewId());
    assertFalse("An unexpected event was signaled,", restoredView.hasFlowEvent());
    assertTrue("The PostRestoreViewEvent was not seen", existingRoot.isPostRestoreStateEventSeen());
  }
View Full Code Here

    this.jsfMock.facesContext().setViewRoot(newRoot);
    this.jsfMock.facesContext().renderResponse();

    EasyMock.replay(new Object[] { this.context });

    View newView = this.factory.getView(this.context);

    assertNotNull("A View was not created", newView);
    assertTrue("A JsfView was expected", newView instanceof JsfView);
    assertEquals("View name did not match", VIEW_ID, ((JsfView) newView).getViewRoot().getViewId());
    assertSame("View root was not the third party instance", newRoot, ((JsfView) newView).getViewRoot());
    assertFalse("An unexpected event was signaled,", newView.hasFlowEvent());
    assertTrue("The PostRestoreViewEvent was not seen", newRoot.isPostRestoreStateEventSeen());
  }
View Full Code Here

    this.context.inViewState();
    EasyMock.expectLastCall().andReturn(false);

    EasyMock.replay(new Object[] { this.context });

    View view = this.factory.getView(this.context);
    ((JsfView) view).getViewRoot().setTransient(true);
    view.render();

    assertTrue(newRoot.isTransient());
    assertTrue(((NoRenderViewHandler) this.viewHandler).rendered);
  }
View Full Code Here

        context.getExternalContext().requestFlowExecutionRedirect();
        if (popup) {
          context.getExternalContext().requestRedirectInPopup();
        }
      } else {
        View view = viewFactory.getView(context);
        context.setCurrentView(view);
        render(context, view);
      }
    }
  }
View Full Code Here

    }
  }

  public void resume(RequestControlContext context) {
    restoreVariables(context);
    View view = viewFactory.getView(context);
    context.setCurrentView(view);
    if (view.userEventQueued()) {
      boolean stateExited = handleEvent(view, context);
      if (!stateExited) {
        ExternalContext externalContext = context.getExternalContext();
        if (externalContext.isResponseComplete()) {
          if (externalContext.isResponseCompleteFlowExecutionRedirect()) {
            context.getFlashScope().put(View.USER_EVENT_STATE_ATTRIBUTE, view.getUserEventState());
          } else {
            clearFlash(context);
          }
        } else {
          if (externalContext.isAjaxRequest()) {
            render(context, view);
          } else {
            if (shouldRedirectInSameState(context)) {
              context.getFlashScope().put(View.USER_EVENT_STATE_ATTRIBUTE, view.getUserEventState());
              externalContext.requestFlowExecutionRedirect();
            } else {
              if (externalContext.isResponseAllowed()) {
                render(context, view);
              }
View Full Code Here

TOP

Related Classes of org.springframework.webflow.execution.View

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.