SWF-543 - Add support for calculating immediate attribute value on Spring Faces command buttons from current view-state transition

This commit is contained in:
Jeremy Grelle
2008-04-03 20:02:01 +00:00
parent 2f490b4488
commit b109773655

View File

@@ -4,6 +4,11 @@ import javax.faces.component.UICommand;
import javax.faces.context.FacesContext;
import javax.faces.el.ValueBinding;
import org.springframework.webflow.definition.TransitionDefinition;
import org.springframework.webflow.engine.TransitionableState;
import org.springframework.webflow.execution.RequestContext;
import org.springframework.webflow.execution.RequestContextHolder;
public class ProgressiveCommandButton extends UICommand {
private String type = "submit";
@@ -44,6 +49,19 @@ public class ProgressiveCommandButton extends UICommand {
this.ajaxEnabled = ajaxEnabled;
}
public boolean isImmediate() {
RequestContext context = RequestContextHolder.getRequestContext();
if (context != null && getActionExpression().isLiteralText()
&& context.getCurrentState() instanceof TransitionableState) {
TransitionDefinition transition = ((TransitionableState) context.getCurrentState())
.getTransition(getActionExpression().getExpressionString());
if (transition.getAttributes().contains("bind")) {
return Boolean.FALSE.equals(transition.getAttributes().getBoolean("bind"));
}
}
return super.isImmediate();
}
public Object saveState(FacesContext context) {
Object[] values = new Object[4];
values[0] = super.saveState(context);