global transition respecting bind and validate flags

This commit is contained in:
Keith Donald
2008-07-29 15:47:05 +00:00
parent 4a57f3d1ff
commit 209ccc2fbb
14 changed files with 100 additions and 27 deletions

View File

@@ -73,8 +73,8 @@ public class ProgressiveUICommand extends UICommand {
RequestContext context = RequestContextHolder.getRequestContext();
if (context != null && getActionExpression().isLiteralText()
&& context.getCurrentState() instanceof TransitionableState) {
TransitionDefinition transition = ((TransitionableState) context.getCurrentState())
.getTransition(getActionExpression().getExpressionString());
TransitionDefinition transition = context
.getMatchingTransition(getActionExpression().getExpressionString());
if (transition != null && transition.getAttributes().contains("bind")) {
return Boolean.FALSE.equals(transition.getAttributes().getBoolean("bind"));
}

View File

@@ -36,7 +36,6 @@ import org.springframework.util.ReflectionUtils;
import org.springframework.util.StringUtils;
import org.springframework.validation.Errors;
import org.springframework.webflow.definition.TransitionDefinition;
import org.springframework.webflow.definition.TransitionableStateDefinition;
import org.springframework.webflow.execution.RequestContext;
import org.springframework.webflow.execution.RequestContextHolder;
import org.springframework.webflow.execution.View;
@@ -147,11 +146,10 @@ public class FlowActionListener implements ActionListener {
if (model == null) {
return false;
}
TransitionableStateDefinition currentState = (TransitionableStateDefinition) requestContext.getCurrentState();
TransitionDefinition transition = currentState.getTransition(eventId);
TransitionDefinition transition = requestContext.getMatchingTransition(eventId);
if (transition != null) {
if (transition.getAttributes().contains("bind")) {
return transition.getAttributes().getBoolean("bind").booleanValue();
if (transition.getAttributes().contains("validate")) {
return transition.getAttributes().getBoolean("validate").booleanValue();
}
}
return true;

View File

@@ -20,8 +20,8 @@ import javax.faces.lifecycle.Lifecycle;
import org.springframework.binding.convert.ConversionService;
import org.springframework.binding.expression.Expression;
import org.springframework.binding.expression.ExpressionParser;
import org.springframework.webflow.engine.builder.BinderConfiguration;
import org.springframework.webflow.engine.builder.ViewFactoryCreator;
import org.springframework.webflow.engine.model.BinderModel;
import org.springframework.webflow.execution.ViewFactory;
/**
@@ -36,7 +36,7 @@ public class JsfViewFactoryCreator implements ViewFactoryCreator {
private Lifecycle lifecycle;
public ViewFactory createViewFactory(Expression viewIdExpression, ExpressionParser expressionParser,
ConversionService conversionService, BinderModel binderModel) {
ConversionService conversionService, BinderConfiguration binderConfiguration) {
return new JsfViewFactory(viewIdExpression, getLifecycle());
}

View File

@@ -16,9 +16,9 @@ import org.springframework.faces.model.converter.FacesConversionService;
import org.springframework.faces.webflow.JSFMockHelper;
import org.springframework.faces.webflow.JsfManagedBeanAwareELExpressionParser;
import org.springframework.faces.webflow.JsfViewFactoryCreator;
import org.springframework.webflow.engine.builder.BinderConfiguration;
import org.springframework.webflow.engine.builder.ViewFactoryCreator;
import org.springframework.webflow.engine.builder.support.FlowBuilderServices;
import org.springframework.webflow.engine.model.BinderModel;
import org.springframework.webflow.execution.ViewFactory;
import org.springframework.webflow.expression.el.WebFlowELExpressionParser;
@@ -64,7 +64,7 @@ public class FacesFlowBuilderServicesBeanDefinitionParserTests extends TestCase
public static class TestViewFactoryCreator implements ViewFactoryCreator {
public ViewFactory createViewFactory(Expression viewIdExpression, ExpressionParser expressionParser,
ConversionService conversionService, BinderModel binderModel) {
ConversionService conversionService, BinderConfiguration binderConfiguration) {
throw new UnsupportedOperationException("Auto-generated method stub");
}