/** * Gets state binder configuration. * * @param state the state * @return the state binder configuration */ public BinderConfiguration getViewStateBinderConfiguration(final ViewState state) { val field = ReflectionUtils.findField(state.getViewFactory().getClass(), "binderConfiguration"); ReflectionUtils.makeAccessible(field); return (BinderConfiguration) ReflectionUtils.getField(field, state.getViewFactory()); }
val field = ReflectionUtils.findField(((ViewState) state).getViewFactory().getClass(), "viewId"); if (field != null) { ReflectionUtils.makeAccessible(field); val exp = (Expression) ReflectionUtils.getField(field, ((ViewState) state).getViewFactory()); stateMap.put("viewId", StringUtils.defaultIfBlank(exp.getExpressionString(), exp.getValue(null).toString())); } else {
viewStateClass= ((WicketView) viewState.getViewFactory().getView(null)).getViewId();
public void handle(FlowExecutionException exception, RequestControlContext requestControlContext) { requestControlContext.getMessageContext().addMessage( new MessageBuilder() .error() .source(null) .defaultText( findBusinessException(exception).getMessage()) .build()); Object testState = requestControlContext.getCurrentState(); if (testState instanceof ViewState) { ViewState viewState = (ViewState) testState; try { viewState.getViewFactory().getView(requestControlContext) .render(); } catch (IOException e) { e.printStackTrace(); // Properly handle rendering errors here } } }
public void testViewStateExternalRedirect() { ViewStateModel state = new ViewStateModel("view"); state.setView("externalRedirect:http://www.paypal.com?_callbackUrl=#{flowExecutionUri}"); model.setStates(asList(state)); Flow flow = getFlow(model); ViewFactory vf = ((ViewState) flow.getStateInstance("view")).getViewFactory(); assertTrue(vf instanceof ActionExecutingViewFactory); ActionExecutingViewFactory avf = (ActionExecutingViewFactory) vf; assertTrue(avf.getAction() instanceof ExternalRedirectAction); }
public void testViewStateFlowRedirect() { ViewStateModel state = new ViewStateModel("view"); state.setView("flowRedirect:myFlow?input=#{flowScope.foo}"); model.setStates(asList(state)); Flow flow = getFlow(model); ViewFactory vf = ((ViewState) flow.getStateInstance("view")).getViewFactory(); assertTrue(vf instanceof ActionExecutingViewFactory); ActionExecutingViewFactory avf = (ActionExecutingViewFactory) vf; assertTrue(avf.getAction() instanceof FlowDefinitionRedirectAction); }