Author: maksimkaszynski
Date: 2007-10-25 11:15:06 -0400 (Thu, 25 Oct 2007)
New Revision: 3540
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/event/AjaxListenerHelper.java
trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/taglib/UIComponentTagBase.java
Log:
http://jira.jboss.com/jira/browse/RF-999
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/event/AjaxListenerHelper.java
===================================================================
---
trunk/framework/impl/src/main/java/org/ajax4jsf/event/AjaxListenerHelper.java 2007-10-25
14:48:37 UTC (rev 3539)
+++
trunk/framework/impl/src/main/java/org/ajax4jsf/event/AjaxListenerHelper.java 2007-10-25
15:15:06 UTC (rev 3540)
@@ -28,9 +28,6 @@
import javax.faces.context.FacesContext;
import javax.faces.el.ValueBinding;
-import org.ajax4jsf.event.AjaxEvent;
-import org.ajax4jsf.event.AjaxListener;
-
/**
* Helper class to keep reference to listener binded as EL-expression.
* @author shura
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/taglib/UIComponentTagBase.java
===================================================================
---
trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/taglib/UIComponentTagBase.java 2007-10-25
14:48:37 UTC (rev 3539)
+++
trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/taglib/UIComponentTagBase.java 2007-10-25
15:15:06 UTC (rev 3540)
@@ -27,22 +27,56 @@
return getFacesContext().getApplication().getExpressionFactory();
}
+ protected void setProperty(UIComponent component, String propName, ValueExpression
valueExpression) {
+ if (valueExpression != null) {
+ if (valueExpression.isLiteralText()) {
+ component.getAttributes().put(propName,valueExpression.getValue(getELContext()));
+ } else {
+ component.setValueExpression(propName, valueExpression);
+ }
+ }
+ }
+
protected void setProperty(UIComponent component, Class<?> type,
String propName, String value) {
if (value != null) {
ValueExpression valueExpression = getExpressionFactory()
.createValueExpression(getELContext(), value, type);
-
- if (valueExpression.isLiteralText()) {
- component.getAttributes().put(propName,
- getExpressionFactory().coerceToType(value, type));
- } else {
- component.setValueExpression(propName, valueExpression);
- }
+ setProperty(component, propName, valueExpression);
}
}
protected void setIntegerProperty(UIComponent component, String propName,
+ ValueExpression value) {
+ setProperty(component, propName, value);
+ }
+
+ protected void setLongProperty(UIComponent component, String propName,
+ ValueExpression value) {
+ setProperty(component, propName, value);
+ }
+
+ protected void setFloatProperty(UIComponent component, String propName,
+ ValueExpression value) {
+ setProperty(component, propName, value);
+ }
+
+ protected void setDoubleProperty(UIComponent component, String propName,
+ ValueExpression value) {
+ setProperty(component, propName, value);
+ }
+
+ protected void setStringProperty(UIComponent component, String propName,
+ ValueExpression value) {
+ setProperty(component, propName, value);
+ }
+
+ protected void setBooleanProperty(UIComponent component, String propName,
+ ValueExpression value) {
+ setProperty(component, propName, value);
+ }
+
+ protected void setIntegerProperty(UIComponent component, String propName,
String value) {
setProperty(component, Integer.class, propName, value);
}
@@ -71,12 +105,17 @@
String value) {
setProperty(component, Boolean.class, propName, value);
}
-
protected void setValueProperty(UIComponent component, String value) {
if (value != null) {
ValueExpression expression = getExpressionFactory()
.createValueExpression(getELContext(), value, Object.class);
+ setValueProperty(component, expression);
+ }
+ }
+ protected void setValueProperty(UIComponent component, ValueExpression expression) {
+ if (expression != null) {
+ String value = expression.getExpressionString();
if (!expression.isLiteralText()) {
component.setValueExpression("value", expression);
} else if (component instanceof UICommand) {