[jboss-cvs] jboss-seam/src/main/org/jboss/seam/actionparam ...
Gavin King
gavin.king at jboss.com
Fri Sep 29 21:36:14 EDT 2006
User: gavin
Date: 06/09/29 21:36:14
Modified: src/main/org/jboss/seam/actionparam
ActionParamMethodBinding.java
ActionParamValueBinding.java
Log:
get rid of funny tags when using method bindings with params
Revision Changes Path
1.2 +10 -4 jboss-seam/src/main/org/jboss/seam/actionparam/ActionParamMethodBinding.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: ActionParamMethodBinding.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/actionparam/ActionParamMethodBinding.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- ActionParamMethodBinding.java 9 Aug 2006 20:30:08 -0000 1.1
+++ ActionParamMethodBinding.java 30 Sep 2006 01:36:14 -0000 1.2
@@ -22,12 +22,15 @@
package org.jboss.seam.actionparam;
+import javax.faces.application.Application;
import javax.faces.component.StateHolder;
import javax.faces.context.FacesContext;
import javax.faces.el.EvaluationException;
import javax.faces.el.MethodBinding;
import javax.faces.el.MethodNotFoundException;
+import org.jboss.seam.jsf.SeamApplication;
+
/**
* This class assumes that the entire expression is not a string literal. If
* it is, use SimpleActionMethodBinding instead.
@@ -38,21 +41,24 @@
private String expWithParams;
private ActionParamBindingHelper helper;
+ private Application application;
private boolean isTransient = false;
public ActionParamMethodBinding()
{
// constructor needed for StateHolder
+ application = ( (SeamApplication) FacesContext.getCurrentInstance().getApplication() ).getDelegate();
}
- public ActionParamMethodBinding(FacesContext facesContext, String expWithParams) {
+ public ActionParamMethodBinding(Application application, String expWithParams) {
if (MethodExpressionParser.isStringLiteral(expWithParams)) {
throw new EvaluationException(expWithParams + " is not an EL expression");
}
this.expWithParams = expWithParams;
- this.helper = new ActionParamBindingHelper(facesContext.getApplication(), expWithParams);
+ this.application = application;
+ this.helper = new ActionParamBindingHelper(application, expWithParams);
}
@Override
@@ -71,8 +77,8 @@
}
public void restoreState(FacesContext facesContext, Object object) {
- this.expWithParams = (String)object;
- this.helper = new ActionParamBindingHelper(facesContext.getApplication(), expWithParams);
+ this.expWithParams = (String) object;
+ this.helper = new ActionParamBindingHelper(application, expWithParams);
}
public Object saveState(FacesContext facesContext) {
1.2 +12 -6 jboss-seam/src/main/org/jboss/seam/actionparam/ActionParamValueBinding.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: ActionParamValueBinding.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/actionparam/ActionParamValueBinding.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- ActionParamValueBinding.java 9 Aug 2006 20:30:08 -0000 1.1
+++ ActionParamValueBinding.java 30 Sep 2006 01:36:14 -0000 1.2
@@ -22,12 +22,15 @@
package org.jboss.seam.actionparam;
+import javax.faces.application.Application;
import javax.faces.component.StateHolder;
import javax.faces.context.FacesContext;
import javax.faces.el.EvaluationException;
import javax.faces.el.PropertyNotFoundException;
import javax.faces.el.ValueBinding;
+import org.jboss.seam.jsf.SeamApplication;
+
/**
* This is a sort of bastardized ValueBinding that takes an action expression.
* It is used for s:link which wraps the action expression as a ValueBinding.
@@ -42,24 +45,27 @@
private String expression;
private ValueBinding binding;
+ private Application application;
private boolean isTransient = false;
public ActionParamValueBinding()
{
// needed for StateHolder
+ application = ( (SeamApplication) FacesContext.getCurrentInstance().getApplication() ).getDelegate();
}
- public ActionParamValueBinding(FacesContext facesContext, String expression)
+ public ActionParamValueBinding(Application application, String expression)
{
this.expression = expression;
- setBinding(facesContext, expression);
+ this.application = application;
+ setBinding(expression);
}
- private void setBinding(FacesContext facesContext, String expression)
+ private void setBinding(String expression)
{
MethodExpressionParser parser = new MethodExpressionParser(expression);
- this.binding = facesContext.getApplication().createValueBinding(parser.getCombinedExpression());
+ this.binding = application.createValueBinding( parser.getCombinedExpression() );
}
public void setValue(FacesContext facesContext, Object object) throws EvaluationException, PropertyNotFoundException
@@ -88,8 +94,8 @@
}
public void restoreState(FacesContext facesContext, Object object) {
- this.expression = (String)object;
- setBinding(facesContext, this.expression);
+ this.expression = (String) object;
+ setBinding(this.expression);
}
public Object saveState(FacesContext facesContext) {
More information about the jboss-cvs-commits
mailing list