You are viewing a plain text version of this content. The canonical link for it is here.
Posted to adffaces-commits@incubator.apache.org by aw...@apache.org on 2006/11/01 02:03:04 UTC
svn commit: r469750 [5/43] - in
/incubator/adffaces/branches/faces-1_2-061031: plugins/maven-faces-plugin/
plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/
plugins/maven-faces-plugin/src/main/java/org/apache/myfac...
Modified: incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/convert/DateTimeConverter.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/convert/DateTimeConverter.java?view=diff&rev=469750&r1=469749&r2=469750
==============================================================================
--- incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/convert/DateTimeConverter.java (original)
+++ incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/convert/DateTimeConverter.java Tue Oct 31 18:02:55 2006
@@ -29,7 +29,7 @@
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.ConverterException;
-import javax.faces.el.ValueBinding;
+import javax.el.ValueExpression;
import org.apache.myfaces.trinidad.logging.TrinidadLogger;
@@ -108,10 +108,10 @@
Object value)
{
assert value != null;
- ValueBinding binding = component.getValueBinding("value");
- if (binding != null)
+ ValueExpression expression = component.getValueExpression("value");
+ if (expression != null)
{
- Class<?> expectedType = binding.getType(context);
+ Class<?> expectedType = expression.getType(context.getELContext());
// Sometimes the type might be null, if it cannot be determined:
if ((expectedType != null) && (!expectedType.isAssignableFrom(value.getClass())))
{
@@ -157,8 +157,7 @@
{
// =-=AEW Only if Javascript...
// -= Simon Lessard =-
- // FIXME: JSF 1.2 specifies <String, Object>
- Map<Object, Object> requestMap = context.getExternalContext().getRequestMap();
+ Map<String, Object> requestMap = context.getExternalContext().getRequestMap();
// this fetch could be at the place where we append, but has been
// moved ahead to optimize use of StringBuffer
@@ -516,7 +515,7 @@
// RenderingContext key indicating the _dateFormat object
// has been created
- private static final Object _PATTERN_WRITTEN_KEY = "org.apache.myfaces.trinidadinternal.convert.DateTimeConverter._PATTERN_WRITTEN";
+ private static final String _PATTERN_WRITTEN_KEY = "org.apache.myfaces.trinidadinternal.convert.DateTimeConverter._PATTERN_WRITTEN";
// String indicating that NO_JS_PATTERN is available
private static final String _NO_JS_PATTERN = new String();
Modified: incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/ReturnActionListenerTag.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/ReturnActionListenerTag.java?view=diff&rev=469750&r1=469749&r2=469750
==============================================================================
--- incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/ReturnActionListenerTag.java (original)
+++ incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/ReturnActionListenerTag.java Tue Oct 31 18:02:55 2006
@@ -55,10 +55,10 @@
ValueExpression valueExp = _value.getValueExpression(faceletContext, Object.class);
ActionSource actionSource = (ActionSource)parent;
ReturnActionListener listener = new ReturnActionListener();
- listener.setValueBinding(ReturnActionListener.VALUE_KEY, new LegacyValueBinding(valueExp));
+ listener.setValueExpression(ReturnActionListener.VALUE_KEY, valueExp);
actionSource.addActionListener(listener);
}
}
private final TagAttribute _value;
-}
\ No newline at end of file
+}
Modified: incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/SetActionListenerTag.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/SetActionListenerTag.java?view=diff&rev=469750&r1=469749&r2=469750
==============================================================================
--- incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/SetActionListenerTag.java (original)
+++ incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/SetActionListenerTag.java Tue Oct 31 18:02:55 2006
@@ -24,14 +24,12 @@
import com.sun.facelets.FaceletContext;
import com.sun.facelets.FaceletException;
-import com.sun.facelets.el.LegacyValueBinding;
import com.sun.facelets.tag.TagAttribute;
import com.sun.facelets.tag.TagConfig;
import com.sun.facelets.tag.TagHandler;
import com.sun.facelets.tag.jsf.ComponentSupport;
/**
- * @todo it should be removed after we consume JSF1.2.
* @author Emmanuel Pirsch
*/
public class SetActionListenerTag extends TagHandler
@@ -57,10 +55,10 @@
Object.class);
ActionSource actionSource= (ActionSource) parent;
SetActionListener listener = new SetActionListener();
- listener.setValueBinding(SetActionListener.FROM_KEY,
- new LegacyValueBinding(fromExpression));
- listener.setValueBinding(SetActionListener.TO_KEY,
- new LegacyValueBinding(toExpression));
+ listener.setValueExpression(SetActionListener.FROM_KEY,
+ fromExpression);
+ listener.setValueExpression(SetActionListener.TO_KEY,
+ toExpression);
actionSource.addActionListener(listener);
}
}
Modified: incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/TrinidadListenersTagRule.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/TrinidadListenersTagRule.java?view=diff&rev=469750&r1=469749&r2=469750
==============================================================================
--- incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/TrinidadListenersTagRule.java (original)
+++ incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/TrinidadListenersTagRule.java Tue Oct 31 18:02:55 2006
@@ -39,9 +39,9 @@
{
public static final MetaRule Instance = new TrinidadListenersTagRule();
- private static class ListenerPropertyMetadata extends Metadata
+ private static class ListenerMBPropertyMetadata extends Metadata
{
- public ListenerPropertyMetadata(Method method, TagAttribute attribute, Class[] paramList)
+ public ListenerMBPropertyMetadata(Method method, TagAttribute attribute, Class[] paramList)
{
_method = method;
_attribute = attribute;
@@ -74,6 +74,42 @@
private final TagAttribute _attribute;
private Class[] _paramList;
}
+
+ private static class ListenerMEPropertyMetadata extends Metadata
+ {
+ public ListenerMEPropertyMetadata(Method method, TagAttribute attribute, Class[] paramList)
+ {
+ _method = method;
+ _attribute = attribute;
+ _paramList = paramList;
+ }
+
+ @Override
+ @SuppressWarnings("deprecation")
+ public void applyMetadata(FaceletContext ctx, Object instance)
+ {
+ MethodExpression expr =
+ _attribute.getMethodExpression(ctx, null, _paramList);
+
+ try
+ {
+ _method.invoke(instance,
+ new Object[]{expr});
+ }
+ catch (InvocationTargetException e)
+ {
+ throw new TagAttributeException(_attribute, e.getCause());
+ }
+ catch (Exception e)
+ {
+ throw new TagAttributeException(_attribute, e);
+ }
+ }
+
+ private final Method _method;
+ private final TagAttribute _attribute;
+ private Class[] _paramList;
+ }
@Override
@@ -82,7 +118,11 @@
TagAttribute attribute,
MetadataTarget meta)
{
- if ((meta.getPropertyType(name) == MethodBinding.class) &&
+ Class metaType = meta.getPropertyType(name);
+ boolean isMethodBinding = (metaType == MethodBinding.class);
+ boolean isMethodExpression = (metaType == MethodExpression.class);
+
+ if ((isMethodBinding || isMethodExpression) &&
name.endsWith("Listener"))
{
// OK, we're trying to call setFooListener()
@@ -110,8 +150,12 @@
return null;
// And go
- return new ListenerPropertyMetadata(m, attribute,
- new Class[]{eventClass});
+ if (isMethodBinding)
+ return new ListenerMBPropertyMetadata(m, attribute,
+ new Class[]{eventClass});
+ else
+ return new ListenerMEPropertyMetadata(m, attribute,
+ new Class[]{eventClass});
}
}
return null;
Modified: incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/io/ResponseWriterDecorator.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/io/ResponseWriterDecorator.java?view=diff&rev=469750&r1=469749&r2=469750
==============================================================================
--- incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/io/ResponseWriterDecorator.java (original)
+++ incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/io/ResponseWriterDecorator.java Tue Oct 31 18:02:55 2006
@@ -124,6 +124,15 @@
getResponseWriter().writeComment(comment);
}
+
+
+ @Override
+ public void writeText(Object text, UIComponent component,
+ String propertyName)
+ throws IOException
+ {
+ getResponseWriter().writeText(text, component, propertyName);
+ }
@Override
public void writeText(Object text, String componentPropertyName) throws IOException
Modified: incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/menu/MenuUtils.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/menu/MenuUtils.java?view=diff&rev=469750&r1=469749&r2=469750
==============================================================================
--- incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/menu/MenuUtils.java (original)
+++ incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/menu/MenuUtils.java Tue Oct 31 18:02:55 2006
@@ -31,8 +31,6 @@
import java.util.Set;
import javax.faces.context.FacesContext;
-import javax.faces.el.ValueBinding;
-
import javax.faces.webapp.UIComponentTag;
import org.apache.myfaces.trinidad.logging.TrinidadLogger;
@@ -48,7 +46,7 @@
MenuUtils() {}
//=======================================================================
- // Bound Value/EL Binding utilities
+ // Bound Value/EL Expression utilities
//=======================================================================
/**
@@ -62,12 +60,10 @@
try
{
- // Value of rendered is EL method binding, so we
- // need to evaluate it
- FacesContext ctx = FacesContext.getCurrentInstance();
- ValueBinding binding =
- ctx.getApplication().createValueBinding(elExpression);
- retVal = binding.getValue(ctx);
+ FacesContext ctx = FacesContext.getCurrentInstance();
+ return ctx.getApplication().evaluateExpressionGet(ctx,
+ elExpression,
+ null);
}
catch (Exception ex)
{
@@ -75,7 +71,6 @@
" is invalid or returned a bad value.\n", ex);
return null;
}
- return retVal;
}
/**
Modified: incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreResponseStateManager.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreResponseStateManager.java?view=diff&rev=469750&r1=469749&r2=469750
==============================================================================
--- incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreResponseStateManager.java (original)
+++ incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreResponseStateManager.java Tue Oct 31 18:02:55 2006
@@ -67,7 +67,8 @@
ResponseWriter rw = context.getResponseWriter();
rw.startElement("input", null);
rw.writeAttribute("type", "hidden", null);
- rw.writeAttribute("name", _STATE_FIELD_NAME, null);
+ rw.writeAttribute("name", VIEW_STATE_PARAM, null);
+ rw.writeAttribute("id", VIEW_STATE_PARAM, null);
String s = encodeSerializedViewAsString(serializedView);
rw.writeAttribute("value", s, null);
@@ -75,6 +76,16 @@
rw.endElement("input");
}
+ @Override
+ /**
+ * A request is a postback if it contains the state parameter.
+ */
+ public boolean isPostback(FacesContext context)
+ {
+ Map requestParams = context.getExternalContext().getRequestParameterMap();
+ return requestParams.containsKey(VIEW_STATE_PARAM);
+ }
+
protected String encodeSerializedViewAsString(
StateManager.SerializedView serializedView) throws IOException
@@ -143,7 +154,7 @@
Map<String, String> requestParamMap =
context.getExternalContext().getRequestParameterMap();
- String stateString = requestParamMap.get(_STATE_FIELD_NAME);
+ String stateString = requestParamMap.get(VIEW_STATE_PARAM);
if (stateString == null)
return null;
@@ -193,8 +204,6 @@
return view;
}
-
- static private final String _STATE_FIELD_NAME = "org.apache.myfaces.trinidad.faces.STATE";
/* Test code for dumping out the page's state
Modified: incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/EditableValueRenderer.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/EditableValueRenderer.java?view=diff&rev=469750&r1=469749&r2=469750
==============================================================================
--- incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/EditableValueRenderer.java (original)
+++ incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/EditableValueRenderer.java Tue Oct 31 18:02:55 2006
@@ -19,12 +19,13 @@
import java.util.Iterator;
+import javax.el.ValueExpression;
+
import javax.faces.component.EditableValueHolder;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.faces.convert.ConverterException;
-import javax.faces.el.ValueBinding;
import javax.faces.validator.Validator;
import org.apache.myfaces.trinidad.logging.TrinidadLogger;
@@ -227,15 +228,15 @@
if (Boolean.TRUE.equals(o))
return true;
- // Now, if the ValueBinding underlying the value says it's
+ // Now, if the ValueExpression underlying the value says it's
// read-only, then again, it is.
- ValueBinding vb = getValueBinding(bean);
- if ((vb != null) && vb.isReadOnly(context))
+ ValueExpression ve = getValueExpression(bean);
+ if ((ve != null) && ve.isReadOnly(context.getELContext()))
{
if (_LOG.isFiner())
{
_LOG.finer("Value expression {0} is read-only",
- vb.getExpressionString());
+ ve.getExpressionString());
}
return true;
Modified: incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleInputColorRenderer.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleInputColorRenderer.java?view=diff&rev=469750&r1=469749&r2=469750
==============================================================================
--- incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleInputColorRenderer.java (original)
+++ incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleInputColorRenderer.java Tue Oct 31 18:02:55 2006
@@ -74,7 +74,7 @@
{
FacesBean bean = getFacesBean(component);
// If there's a non-default action, then just launch away
- if (getAction(bean) != null)
+ if (getActionExpression(bean) != null)
{
super.queueActionEvent(context, component);
}
@@ -295,7 +295,7 @@
// If the field has an action, use the default behavior. Or,
// if the field doesn't support launching a window at all,
// use the default behavior.
- if ((getAction(bean) != null) ||
+ if ((getActionExpression(bean) != null) ||
!Boolean.TRUE.equals(
arc.getAgent().getCapabilities().get(TrinidadAgent.CAP_MULTIPLE_WINDOWS)))
return super.getLaunchOnclick(context, arc, component, bean);
Modified: incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleInputDateRenderer.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleInputDateRenderer.java?view=diff&rev=469750&r1=469749&r2=469750
==============================================================================
--- incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleInputDateRenderer.java (original)
+++ incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleInputDateRenderer.java Tue Oct 31 18:02:55 2006
@@ -74,7 +74,7 @@
{
FacesBean bean = getFacesBean(component);
// If there's a non-default action, then just launch away
- if (getAction(bean) != null)
+ if (getActionExpression(bean) != null)
{
super.queueActionEvent(context, component);
}
@@ -336,7 +336,7 @@
// If the field has an action, use the default behavior. Or,
// if the field doesn't support launching a window at all,
// use the default behavior.
- if ((getAction(bean) != null) ||
+ if ((getActionExpression(bean) != null) ||
!Boolean.TRUE.equals(
arc.getAgent().getCapabilities().get(TrinidadAgent.CAP_MULTIPLE_WINDOWS)))
return super.getLaunchOnclick(context, arc, component, bean);
Modified: incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleInputListOfValuesRenderer.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleInputListOfValuesRenderer.java?view=diff&rev=469750&r1=469749&r2=469750
==============================================================================
--- incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleInputListOfValuesRenderer.java (original)
+++ incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleInputListOfValuesRenderer.java Tue Oct 31 18:02:55 2006
@@ -60,7 +60,7 @@
super.findTypeConstants(type);
_searchDescKey = type.findKey("searchDesc");
_iconKey = type.findKey("icon");
- _actionKey = type.findKey("action");
+ _actionExpressionKey = type.findKey("actionExpression");
}
//
@@ -357,9 +357,9 @@
return true;
}
- protected Object getAction(FacesBean bean)
+ protected Object getActionExpression(FacesBean bean)
{
- return bean.getProperty(_actionKey);
+ return bean.getProperty(_actionExpressionKey);
}
protected String getSearchDesc(
@@ -392,7 +392,7 @@
return "af|inputListOfValues::content";
}
- private PropertyKey _actionKey;
+ private PropertyKey _actionExpressionKey;
private PropertyKey _iconKey;
private PropertyKey _searchDescKey;
Modified: incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleSelectManyRenderer.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleSelectManyRenderer.java?view=diff&rev=469750&r1=469749&r2=469750
==============================================================================
--- incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleSelectManyRenderer.java (original)
+++ incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleSelectManyRenderer.java Tue Oct 31 18:02:55 2006
@@ -23,14 +23,14 @@
import java.util.Arrays;
import java.util.List;
+import javax.el.ValueExpression;
+
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
import javax.faces.convert.Converter;
import javax.faces.convert.ConverterException;
-import javax.faces.el.ValueBinding;
-
import javax.faces.model.SelectItem;
import org.apache.myfaces.trinidad.logging.TrinidadLogger;
@@ -92,10 +92,10 @@
converter = getDefaultConverter(context, bean);
Class<?> modelClass = null;
- ValueBinding binding = getValueBinding(bean);
- if (binding != null)
+ ValueExpression expression = getValueExpression(bean);
+ if (expression != null)
{
- modelClass = binding.getType(context);
+ modelClass = expression.getType(context.getELContext());
}
boolean valuePassThru = getValuePassThru(getFacesBean(component));
@@ -144,11 +144,11 @@
FacesContext context,
FacesBean bean)
{
- ValueBinding binding = getValueBinding(bean);
- if (binding == null)
+ ValueExpression expression = getValueExpression(bean);
+ if (expression == null)
return null;
- Class<?> type = binding.getType(context);
+ Class<?> type = expression.getType(context.getELContext());
if ((type == null) || type.isAssignableFrom(List.class))
return null;
Modified: incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/ValueRenderer.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/ValueRenderer.java?view=diff&rev=469750&r1=469749&r2=469750
==============================================================================
--- incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/ValueRenderer.java (original)
+++ incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/ValueRenderer.java Tue Oct 31 18:02:55 2006
@@ -15,10 +15,11 @@
*/
package org.apache.myfaces.trinidadinternal.renderkit.core.xhtml;
+import javax.el.ValueExpression;
+
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
-import javax.faces.el.ValueBinding;
import org.apache.myfaces.trinidad.bean.FacesBean;
import org.apache.myfaces.trinidad.bean.PropertyKey;
@@ -66,11 +67,11 @@
FacesContext context,
FacesBean bean)
{
- ValueBinding binding = getValueBinding(bean);
- if (binding == null)
+ ValueExpression expression = getValueExpression(bean);
+ if (expression == null)
return null;
- Class<?> type = binding.getType(context);
+ Class<?> type = expression.getType(context.getELContext());
return ConverterUtils.createConverter(context, type);
}
@@ -80,11 +81,11 @@
}
/**
- * Returns the ValueBinding for the "value" property.
+ * Returns the ValueExpression for the "value" property.
*/
- protected ValueBinding getValueBinding(FacesBean bean)
+ protected ValueExpression getValueExpression(FacesBean bean)
{
- return bean.getValueBinding(_valueKey);
+ return bean.getValueExpression(_valueKey);
}
protected Converter getConverter(FacesBean bean)
Modified: incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/table/TableSelectOneRenderer.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/table/TableSelectOneRenderer.java?view=diff&rev=469750&r1=469749&r2=469750
==============================================================================
--- incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/table/TableSelectOneRenderer.java (original)
+++ incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/table/TableSelectOneRenderer.java Tue Oct 31 18:02:55 2006
@@ -237,6 +237,13 @@
}
@Override
+ protected String getClientId(FacesContext context, UIComponent component)
+ {
+ // We use the table's container client ID
+ return component.getContainerClientId(context);
+ }
+
+ @Override
protected Object getSubmittedValue(FacesBean bean)
{
TableRenderingContext tContext =
Modified: incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/table/TreeNodeColumnRenderer.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/table/TreeNodeColumnRenderer.java?view=diff&rev=469750&r1=469749&r2=469750
==============================================================================
--- incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/table/TreeNodeColumnRenderer.java (original)
+++ incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/table/TreeNodeColumnRenderer.java Tue Oct 31 18:02:55 2006
@@ -135,7 +135,7 @@
{
// we need to render a unique ID for the expand/collapse link, so that
// PPR can restore the focus correctly after a PPR request:
- String tableName = tContext.getTable().getClientId(fc);
+ String tableName = tContext.getTable().getContainerClientId(fc);
String id = tableName + NamingContainer.SEPARATOR_CHAR + _ICON_ID;
fc.getResponseWriter().writeAttribute("id", id, null);
}
Modified: incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/htmlBasic/ComponentFacesBean.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/htmlBasic/ComponentFacesBean.java?view=diff&rev=469750&r1=469749&r2=469750
==============================================================================
--- incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/htmlBasic/ComponentFacesBean.java (original)
+++ incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/htmlBasic/ComponentFacesBean.java Tue Oct 31 18:02:55 2006
@@ -18,6 +18,8 @@
import java.util.Iterator;
import java.util.Set;
+import javax.el.ValueExpression;
+
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.el.ValueBinding;
@@ -66,9 +68,20 @@
throw new UnsupportedOperationException();
}
+
final public ValueBinding getValueBinding(PropertyKey key)
{
return _component.getValueBinding(key.getName());
+ }
+
+ final public ValueExpression getValueExpression(PropertyKey key)
+ {
+ return _component.getValueExpression(key.getName());
+ }
+
+ final public void setValueExpression(PropertyKey key, ValueExpression expression)
+ {
+ throw new UnsupportedOperationException();
}
final public Object getRawProperty(PropertyKey key)
Modified: incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/uix/SelectItemSupport.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/uix/SelectItemSupport.java?view=diff&rev=469750&r1=469749&r2=469750
==============================================================================
--- incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/uix/SelectItemSupport.java (original)
+++ incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/uix/SelectItemSupport.java Tue Oct 31 18:02:55 2006
@@ -22,13 +22,14 @@
import java.util.List;
import java.util.Map;
+import javax.el.ValueExpression;
+
import javax.faces.component.UIComponent;
import javax.faces.component.UISelectItem;
import javax.faces.component.UISelectItems;
import javax.faces.component.ValueHolder;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
-import javax.faces.el.ValueBinding;
import javax.faces.model.SelectItem;
import org.apache.myfaces.trinidad.component.UIXSelectItem;
import org.apache.myfaces.trinidadinternal.convert.ConverterUtils;
@@ -370,13 +371,13 @@
Converter converter = null;
Class<?> modelClass = null;
- ValueBinding binding = component.getValueBinding("value");
- if (binding != null)
+ ValueExpression expression = component.getValueExpression("value");
+ if (expression != null)
{
- modelClass = binding.getType(fContext);
+ modelClass = expression.getType(fContext.getELContext());
if (modelClass == null)
{
- Object o = binding.getValue(fContext);
+ Object o = expression.getValue(fContext.getELContext());
if (o != null)
{
modelClass = o.getClass();
Modified: incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/ComponentDefTag.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/ComponentDefTag.java?view=diff&rev=469750&r1=469749&r2=469750
==============================================================================
--- incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/ComponentDefTag.java (original)
+++ incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/ComponentDefTag.java Tue Oct 31 18:02:55 2006
@@ -23,7 +23,7 @@
import javax.servlet.jsp.JspException;
import org.apache.myfaces.trinidadinternal.taglib.util.TagUtils;
-import javax.faces.webapp.UIComponentTag;
+import javax.faces.webapp.UIComponentClassicTagBase;
public class ComponentDefTag extends TagSupport
{
@@ -41,7 +41,7 @@
@Override
public int doStartTag() throws JspException
{
- UIComponentTag tag = UIComponentTag.getParentUIComponentTag(pageContext);
+ UIComponentClassicTagBase tag = UIComponentClassicTagBase.getParentUIComponentClassicTagBase(pageContext);
if (tag == null)
{
throw new JspException(
@@ -60,9 +60,6 @@
if (_var != null)
{
- if (TagUtils.isValueReference(_var))
- throw new JspException("tr:componentDef does not support EL on 'var'");
-
((UIXComponentRef) component).setVar(_var);
}
}
Modified: incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/ComponentRefTag.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/ComponentRefTag.java?view=diff&rev=469750&r1=469749&r2=469750
==============================================================================
--- incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/ComponentRefTag.java (original)
+++ incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/ComponentRefTag.java Tue Oct 31 18:02:55 2006
@@ -209,7 +209,7 @@
AttributeMetaData attr = attrs.get(i);
String name = attr.getAttrName();
Class<?> klass = attr.getAttrClass();
- if (region.getValueBinding(name) != null)
+ if (region.getValueExpression(name) != null)
continue;
Object compValue = compAttrs.get(name);
Modified: incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/FacetRefTag.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/FacetRefTag.java?view=diff&rev=469750&r1=469749&r2=469750
==============================================================================
--- incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/FacetRefTag.java (original)
+++ incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/FacetRefTag.java Tue Oct 31 18:02:55 2006
@@ -17,7 +17,7 @@
import javax.faces.component.UIComponent;
import javax.faces.webapp.FacetTag;
-import javax.faces.webapp.UIComponentTag;
+import javax.faces.webapp.UIComponentClassicTagBase;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.Tag;
@@ -46,7 +46,7 @@
@Override
public int doStartTag() throws JspException
{
- UIComponentTag tag = UIComponentTag.getParentUIComponentTag(pageContext);
+ UIComponentClassicTagBase tag = UIComponentClassicTagBase.getParentUIComponentClassicTagBase(pageContext);
if (tag == null)
{
_LOG.warning("facetRef must be inside of a UIComponent tag.");
Modified: incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/ForEachTag.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/ForEachTag.java?view=diff&rev=469750&r1=469749&r2=469750
==============================================================================
--- incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/ForEachTag.java (original)
+++ incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/ForEachTag.java Tue Oct 31 18:02:55 2006
@@ -15,19 +15,26 @@
*/
package org.apache.myfaces.trinidadinternal.taglib;
+import java.io.Serializable;
+
import java.lang.reflect.Array;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import javax.el.ELContext;
+import javax.el.PropertyNotWritableException;
+import javax.el.ValueExpression;
+import javax.el.VariableMapper;
+
import javax.faces.context.FacesContext;
-import javax.faces.el.ValueBinding;
import javax.faces.webapp.UIComponentTag;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspTagException;
import javax.servlet.jsp.tagext.TagSupport;
+import javax.servlet.jsp.jstl.core.IndexedValueExpression;
import org.apache.myfaces.trinidad.logging.TrinidadLogger;
import org.apache.myfaces.trinidad.webapp.ELContextTag;
@@ -56,45 +63,38 @@
*
* @author The Oracle ADF Faces Team
*/
-public class ForEachTag extends TagSupport implements ELContextTag
+public class ForEachTag extends TagSupport
{
- public void setItems(String items)
+ public void setItems(ValueExpression items)
{
- if (!items.startsWith("#{") ||
- !items.endsWith("}"))
+ if (items.isLiteralText())
throw new IllegalArgumentException(
- "\"items\" must be a simple JSF EL expression");
+ "\"items\" must be an EL expression");
_items = items;
}
- public void setBegin(String begin)
+ public void setBegin(Integer begin)
{
_begin = begin;
}
- public void setEnd(String end)
+ public void setEnd(Integer end)
{
_end = end;
}
- public void setStep(String step)
+ public void setStep(Integer step)
{
_step = step;
}
public void setVar(String var)
{
- if (UIComponentTag.isValueReference(var))
- throw new IllegalArgumentException("\"var\" cannot be an expression");
-
_var = var;
}
public void setVarStatus(String varStatus)
{
- if (UIComponentTag.isValueReference(varStatus))
- throw new IllegalArgumentException("\"varStatus\" cannot be an expression");
-
_varStatus = varStatus;
}
@@ -104,13 +104,13 @@
_validateAttributes();
FacesContext context = FacesContext.getCurrentInstance();
- _parentELContext = (ELContextTag)
- findAncestorWithClass(this, ELContextTag.class);
- _currentBegin = _resolveInteger(context, _begin, 0);
+ _currentBegin = (_begin == null) ? 0 : _begin.intValue();
int length;
+
if (null != _items)
{
- Object items = _resolveObject(context, _items);
+ Object items = _items.getValue(pageContext.getELContext());
+
//pu: If items is specified and resolves to null, it is treated as an
// empty collection, i.e., no iteration is performed.
if (items == null)
@@ -119,6 +119,8 @@
_LOG.fine("Items expression " + _items + " resolved to null.");
return SKIP_BODY;
}
+
+ _itemsValue = items;
// =-=AEW <c:forEach> supports arbitrary collections; but
// JSF only supports List in its EL.
if (items instanceof List)
@@ -141,7 +143,8 @@
_LOG.fine("Size of 'items' is less than 'begin'");
return SKIP_BODY;
}
- _currentEnd = _resolveInteger(context, _end, length - 1);
+
+ _currentEnd = (_end == null) ? length - 1 : _end.intValue();
//pu: If 'end' were specified, but is beyond the size of collection, limit
// the iteration to where the collection ends. A mimic of c:forEach and
// fix for bug 4029853.
@@ -150,41 +153,35 @@
}
else
{
- _currentEnd = _resolveInteger(context, _end, 0);
+ _currentEnd = (_end == null) ? 0 : _end.intValue();
}
_currentIndex = _currentBegin;
- _currentStep = _resolveInteger(context, _step, 1);
+ _currentStep = (_step == null) ? 1 : _step.intValue();
//pu: Now check the valid relation between 'begin','end' and validity of 'step'
_validateRangeAndStep();
+ // If we can bail, do it now
if (_currentEnd < _currentIndex)
return SKIP_BODY;
- if (null != _var || null != _varStatus)
- {
- //pu: If items not defined (syntax 2), the return type of 'var' is an
- // int according to JSTL specs, and apache impl returns index. Mimic.
- _varReplacement = (null == _items)?
- String.valueOf(_currentIndex):
- _items.substring(2, _items.length() - 1) + "[" + _currentIndex + "]";
- }
- //pu: If there is no varStatus set, no point in keeping loop status
- // variables updated.
+ // Save off the previous deferred variables
+ VariableMapper vm =
+ pageContext.getELContext().getVariableMapper();
+ if (_var != null)
+ _previousDeferredVar = vm.resolveVariable(_var);
+
if (null != _varStatus)
{
- _updateLoopStatus();
+ _previousDeferredVarStatus = vm.resolveVariable(_varStatus);
_propertyReplacementMap = new HashMap<String, Object>(9, 1);
- _propertyReplacementMap.put("begin", new Integer(_currentBegin));
- _propertyReplacementMap.put("end", new Integer(_currentEnd));
- _propertyReplacementMap.put("step", new Integer(_currentStep));
- _propertyReplacementMap.put("count", new Integer(_currentCount));
- _propertyReplacementMap.put("index", new Integer(_currentIndex));
- _propertyReplacementMap.put("current", _varReplacement);
- _propertyReplacementMap.put(
- "first",
- (_isFirst)? Boolean.TRUE:Boolean.FALSE);
- _propertyReplacementMap.put(
- "last",
- (_isLast)? Boolean.TRUE:Boolean.FALSE);
+ _propertyReplacementMap.put("begin", _currentBegin);
+ _propertyReplacementMap.put("end", _currentEnd);
+ _propertyReplacementMap.put("step", _currentStep);
+ _propertyReplacementMap.put("count", _currentCount);
+ _propertyReplacementMap.put("index", _currentIndex);
+ // FIXME: Can we support "current" efficiently?
+ // _propertyReplacementMap.put("current", _varReplacement);
+ _propertyReplacementMap.put("first", _isFirst);
+ _propertyReplacementMap.put("last", _isLast);
}
if (_LOG.isFiner())
@@ -192,6 +189,10 @@
_LOG.finer("Iterating from " + _currentIndex + " to " + _currentEnd +
" by " + _currentStep);
}
+
+ // Update the variables
+ _updateVars();
+
return EVAL_BODY_INCLUDE;
}
@@ -200,102 +201,46 @@
{
_currentIndex += _currentStep;
- if (null != _var || null != _varStatus)
- {
- //pu: If items not defined (syntax 2), the return type of 'var' is an
- // int according to JSTL specs, and apache impl returns index. Mimic.
- _varReplacement = (null == _items)?
- String.valueOf(_currentIndex):
- _items.substring(2, _items.length() - 1) + "[" + _currentIndex + "]";
- }
-
//pu: if there is no varStatus set, no point in keeping loop status
// variables updated.
if (null != _varStatus)
{
//pu: _isFirst is not yet updated after first iteration
boolean isSecondIteration = (_isFirst)? true:false;
- _updateLoopStatus();
if (isSecondIteration)
{
- _propertyReplacementMap.put(
- "first",
- (_isFirst)? Boolean.TRUE:Boolean.FALSE);
+ _propertyReplacementMap.put("first", _isFirst);
}
if (_isLast)
{
- _propertyReplacementMap.put(
- "last",
- (_isLast)? Boolean.TRUE:Boolean.FALSE);
+ _propertyReplacementMap.put("last", _isLast);
}
- _propertyReplacementMap.put("count", new Integer(_currentCount));
- _propertyReplacementMap.put("index", new Integer(_currentIndex));
- _propertyReplacementMap.put("current", _varReplacement);
+ _propertyReplacementMap.put("count", _currentCount);
+ _propertyReplacementMap.put("index", _currentIndex);
+ // FIXME Can we support "current" efficiently?
+ // _propertyReplacementMap.put("current", _varReplacement);
}
+ // If we're at the end, bail
if (_currentEnd < _currentIndex)
- return SKIP_BODY;
- return EVAL_BODY_AGAIN;
- }
-
- public String transformId(String id)
- {
- if (_parentELContext != null)
- id = _parentELContext.transformId(id);
-
- // SEPARATOR_CHAR would be nice; but JSF does not allow
- // the separator char in an ID - just in client IDs.
- // return id + NamingContainer.SEPARATOR_CHAR + _currentIndex;
- return id + '_' + _currentIndex;
- }
- static String __transformExpression(
- String expression,
- String var,
- String subst)
- {
- String varDot = var + ".";
- Tokenizer tokens = new Tokenizer(expression);
- StringBuffer buf = new StringBuffer(expression.length());
- while(tokens.hasNext())
- {
- Token tok = tokens.next();
- String exp = tok.getText();
- if (tok.type == Tokenizer.VAR_TYPE)
- {
- if (var.equals(exp) || exp.startsWith(varDot))
- {
- buf.append(subst);
- buf.append(exp.substring(var.length()));
- continue;
- }
- }
-
- buf.append(exp);
- }
- return buf.toString();
- }
- public String transformExpression(String expression)
- {
- if (expression != null)
{
- String transformedExp = expression;
- int expressionStart = expression.indexOf("#{");
- if (expressionStart >= 0)
- {
- transformedExp = _transformExpression(expression);
+ // Restore EL state
+ VariableMapper vm =
+ pageContext.getELContext().getVariableMapper();
+ if (_var != null)
+ vm.setVariable(_var, _previousDeferredVar);
+ if (_varStatus != null)
+ vm.setVariable(_varStatus, _previousDeferredVarStatus);
- if (_parentELContext != null)
- transformedExp = _parentELContext.transformExpression(transformedExp);
- }
-
- if (_LOG.isFiner())
- _LOG.finer("Transformed expression:{0} to:{1}",
- new String[] {expression, transformedExp});
- return transformedExp;
+ return SKIP_BODY;
}
+
+ // Otherwise, update the variables and go again
+ _updateVars();
- return null;
+ return EVAL_BODY_AGAIN;
}
+
/**
* Release state.
*/
@@ -303,25 +248,46 @@
public void release()
{
super.release();
- //=-=pu: Does only the properties that has setters need to be released ?
- // What about variables like _propertyReplacementMap/_varReplacement etc. ?
_begin = null;
_end = null;
- _end = null;
- _items = null;
_step = null;
+ _items = null;
+ _itemsValue = null;
_var = null;
_varStatus = null;
- }
-
- protected ValueBinding createValueBinding(
- FacesContext context,
- String expression)
- {
- if (_parentELContext != null)
- expression = _parentELContext.transformExpression(expression);
+ _propertyReplacementMap = null;
+ _previousDeferredVar = null;
+ _previousDeferredVarStatus = null;
+ }
+
+ // Push new values into the VariableMapper and the pageContext
+ private void _updateVars()
+ {
+ VariableMapper vm =
+ pageContext.getELContext().getVariableMapper();
+ if (_var != null)
+ {
+ ValueExpression iterated = new IndexedValueExpression(_items,
+ _currentIndex);
+ vm.setVariable(_var, iterated);
+
+ Object items = _itemsValue;
+ Object item;
+ if (items instanceof List)
+ item = ((List) items).get(_currentIndex);
+ else
+ item = Array.get(items, _currentIndex);
- return context.getApplication().createValueBinding(expression);
+ pageContext.setAttribute(_var, item);
+ }
+
+ if (_varStatus != null)
+ {
+ pageContext.setAttribute(_varStatus, _propertyReplacementMap);
+ ValueExpression constant = new Constants(
+ new HashMap(_propertyReplacementMap));
+ vm.setVariable(_varStatus, constant);
+ }
}
private void _validateAttributes() throws JspTagException
@@ -349,154 +315,62 @@
if (_currentStep < 1)
throw new JspTagException("'step' < 1");
}
-
- private String _transformExpression(String expression)
+
+ // Basic ValueExpression that always returns a constant object
+ static private class Constants extends ValueExpression
+ implements Serializable
{
- boolean doVar = (_var != null);
- boolean doVarStatus = (_varStatus != null);
- if (!(doVar || doVarStatus))
- return expression;
- StringBuffer buf = new StringBuffer(expression.length());
- // ACW: see bug 3754666:
- Tokenizer tokens = new Tokenizer(expression);
- String varDot = _var+".";
- String varStatusDot = _varStatus+".";
- while(tokens.hasNext())
- {
- Token tok = tokens.next();
- String text = tok.getText();
- if (tok.type == Tokenizer.VAR_TYPE)
- {
- if (doVar && (_var.equals(text) || text.startsWith(varDot)))
- {
- text = _replaceVariableAndPropertiesInExpression(
- text, _var, _varReplacement, null);
- }
- else if (doVarStatus && (_varStatus.equals(text) || text.startsWith(varStatusDot)))
- {
- text = _replaceVariableAndPropertiesInExpression(
- text, _varStatus, null, _propertyReplacementMap);
- }
- }
- buf.append(text);
+ public Constants(Object o)
+ {
+ _o = o;
}
- return buf.toString();
- }
- /**
- * Replaces all occurance of 'variable' and the property (the key in map)
- * with the property replacement (value in the map).
- * If propertyReplacementMap were to be null, then all the occurance of
- * 'variable' will be replaced by 'variableReplacement'.
- * Returns a string modified thus.
- */
- private String _replaceVariableAndPropertiesInExpression(
- String subExpression,
- String variable,
- String variableReplacement,
- Map<String, Object> propertyReplacementMap)
- {
- int variableLength = variable.length();
- //pu: Now check whether the variable is followed by any property from
- // the supplied map.
- if (null != propertyReplacementMap)
- {
- String property;
- String propertyReplacement;
- for(Map.Entry<String, Object> entry : propertyReplacementMap.entrySet())
- {
- property = entry.getKey();
- String expressionAfterVar = subExpression.substring(variableLength);
- if (expressionAfterVar.startsWith("."+property))
- {
- int propertyLength = property.length();
- //pu: We found our property, but it could be followed
- // by an alphanumeric in which case we ignore and move on because
- // we just found it as a substring
- int endOfReplacement = propertyLength + 1;
- if (expressionAfterVar.length() > endOfReplacement)
- {
- if (Character.isLetterOrDigit(
- expressionAfterVar.charAt(endOfReplacement)))
- {
- continue;
- }
- }
- propertyReplacement = entry.getValue().toString();
- //pu: Replace both the variable plus the property following it.
- subExpression = _replaceSubString(
- subExpression,
- 0,
- variableLength + propertyLength + 1,
- propertyReplacement);
- //pu: If we handled atleast one property, break out from here.
- break;
- }
- }
+
+ public Object getValue(ELContext context)
+ {
+ return _o;
}
- //pu: If there were no properties to be replaced, replace the variable itself
- else
+
+ public void setValue(ELContext context, Object value)
{
- subExpression = _replaceSubString(subExpression, 0, variableLength, variableReplacement);
+ throw new PropertyNotWritableException();
}
+ public boolean isReadOnly(ELContext context)
+ {
+ return true;
+ }
- return subExpression;
- }
- /**
- * Given the 'str', replaces a substring starting from 'beginIndex'
- * of 'noOfChars' length with the string in 'replacement', returns the
- * string modified thus.
- */
- private String _replaceSubString(
- String str,
- int beginIndex,
- int noOfChars,
- String replacement)
- {
- StringBuffer buffer = new StringBuffer(str.length() +
- replacement.length() -
- noOfChars);
- buffer.append(str.substring(0, beginIndex));
- buffer.append(replacement);
- buffer.append(str.substring(beginIndex + noOfChars));
- return buffer.toString();
- }
- /**
- * Update the loop status variables.
- */
- private void _updateLoopStatus()
- {
- _currentCount = ((_currentIndex - _currentBegin)/_currentStep) + 1;
- _isFirst = (_currentIndex == _currentBegin);
- _isLast = (_currentIndex + _currentStep) > _currentEnd;
- }
+ public Class getType(ELContext context)
+ {
+ return _o.getClass();
+ }
+ public Class getExpectedType()
+ {
+ return _o.getClass();
+ }
- private Object _resolveObject(FacesContext context, String expression)
- {
- ValueBinding vb = createValueBinding(context, expression);
- return vb.getValue(context);
- }
+ public String getExpressionString()
+ {
+ return null;
+ }
- private int _resolveInteger(
- FacesContext context,
- String expression,
- int defaultValue)
- {
- if (expression == null)
- return defaultValue;
+ public boolean equals(Object obj)
+ {
+ return obj == this;
+ }
- if (UIComponentTag.isValueReference(expression))
+ public int hashCode()
{
- Object o = _resolveObject(context, expression);
- if (o instanceof Number)
- return ((Number) o).intValue();
- if (o == null)
- return defaultValue;
+ return _o.hashCode();
+ }
- expression = o.toString();
+ public boolean isLiteralText()
+ {
+ return true;
}
- return Integer.parseInt(expression);
+
+ private Object _o;
}
private int _currentBegin;
@@ -506,18 +380,23 @@
private int _currentCount;
private boolean _isFirst;
private boolean _isLast;
- private ELContextTag _parentELContext;
- private String _items;
- private String _begin;
- private String _end;
- private String _step;
+
+ private ValueExpression _items;
+ private Object _itemsValue;
+
+ private Integer _begin;
+ private Integer _end;
+ private Integer _step;
private String _var;
private String _varStatus;
- //pu: Map for properties referred off from 'varStatus' and their replacements
+
+ // Saved values on the VariableMapper
+ private ValueExpression _previousDeferredVar;
+ private ValueExpression _previousDeferredVarStatus;
+
+ // Map for properties referred off from 'varStatus' and their replacements
private Map<String, Object> _propertyReplacementMap;
- //pu: Represents replacement for 'var' upon every iteration
- private String _varReplacement;
private static final TrinidadLogger _LOG = TrinidadLogger.createTrinidadLogger(ForEachTag.class);
Modified: incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/convert/ConvertIntegerTag.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/convert/ConvertIntegerTag.java?view=diff&rev=469750&r1=469749&r2=469750
==============================================================================
--- incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/convert/ConvertIntegerTag.java (original)
+++ incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/convert/ConvertIntegerTag.java Tue Oct 31 18:02:55 2006
@@ -15,8 +15,10 @@
*/
package org.apache.myfaces.trinidadinternal.taglib.convert;
+import javax.faces.application.Application;
import javax.faces.convert.Converter;
-import javax.faces.webapp.ConverterTag;
+import javax.faces.context.FacesContext;
+import javax.faces.webapp.ConverterELTag;
import javax.servlet.jsp.JspException;
import org.apache.myfaces.trinidadinternal.convert.IntegerConverter;
@@ -25,28 +27,22 @@
* @version 2.0 (1.0) 2000/03/16 23:23:33
*/
-public class ConvertIntegerTag extends ConverterTag
+public class ConvertIntegerTag extends ConverterELTag
{
public ConvertIntegerTag()
{
}
- @Override
- public int doStartTag() throws JspException
- {
- super.setConverterId(IntegerConverter.CONVERTER_ID);
- return super.doStartTag();
- }
-
/**
*
*/
@Override
protected Converter createConverter() throws JspException
{
- IntegerConverter converter =
- (IntegerConverter)super.createConverter();
+ Application application = FacesContext.getCurrentInstance().getApplication();
+ IntegerConverter converter = (IntegerConverter)
+ application.createConverter(IntegerConverter.CONVERTER_ID);
return converter;
}
}
Modified: incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/ResetActionListenerTag.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/ResetActionListenerTag.java?view=diff&rev=469750&r1=469749&r2=469750
==============================================================================
--- incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/ResetActionListenerTag.java (original)
+++ incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/ResetActionListenerTag.java Tue Oct 31 18:02:55 2006
@@ -17,7 +17,7 @@
import javax.faces.component.ActionSource;
import javax.faces.component.UIComponent;
-import javax.faces.webapp.UIComponentTag;
+import javax.faces.webapp.UIComponentClassicTagBase;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.TagSupport;
@@ -32,7 +32,7 @@
@Override
public int doStartTag() throws JspException
{
- UIComponentTag tag = UIComponentTag.getParentUIComponentTag(pageContext);
+ UIComponentClassicTagBase tag = UIComponentClassicTagBase.getParentUIComponentClassicTagBase(pageContext);
if (tag == null)
{
throw new JspException(
Modified: incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/ReturnActionListener.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/ReturnActionListener.java?view=diff&rev=469750&r1=469749&r2=469750
==============================================================================
--- incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/ReturnActionListener.java (original)
+++ incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/ReturnActionListener.java Tue Oct 31 18:02:55 2006
@@ -15,6 +15,8 @@
*/
package org.apache.myfaces.trinidadinternal.taglib.listener;
+import javax.el.ValueExpression;
+
import javax.faces.component.StateHolder;
import javax.faces.event.ActionEvent;
import javax.faces.event.ActionListener;
@@ -45,19 +47,17 @@
public void processAction(ActionEvent event)
{
- Object value = getValue();
+ Object value = getProperty(VALUE_KEY);
RequestContext adf = RequestContext.getCurrentInstance();
adf.returnFromDialog(value, null);
}
- public Object getValue()
- {
- return getProperty(VALUE_KEY);
- }
-
- public void setValue(Object value)
+ public void setValue(ValueExpression value)
{
- setProperty(VALUE_KEY, value);
+ if (value.isLiteralText())
+ setProperty(VALUE_KEY, value.getValue(null));
+ else
+ setValueExpression(VALUE_KEY, value);
}
@Override
Modified: incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/ReturnActionListenerTag.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/ReturnActionListenerTag.java?view=diff&rev=469750&r1=469749&r2=469750
==============================================================================
--- incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/ReturnActionListenerTag.java (original)
+++ incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/ReturnActionListenerTag.java Tue Oct 31 18:02:55 2006
@@ -17,6 +17,8 @@
import org.apache.myfaces.trinidadinternal.taglib.util.TagUtils;
+import javax.el.ValueExpression;
+
import javax.servlet.jsp.tagext.TagSupport;
import javax.servlet.jsp.JspException;
@@ -35,7 +37,7 @@
*/
public class ReturnActionListenerTag extends TagSupport
{
- public void setValue(String value)
+ public void setValue(ValueExpression value)
{
_value = value;
}
@@ -69,21 +71,8 @@
ReturnActionListener listener = new ReturnActionListener();
if (_value != null)
- {
- String value = _value;
- if (TagUtils.isValueReference(value))
- {
- if (parentELContext != null)
- value = parentELContext.transformExpression(value);
-
- listener.setValueBinding(ReturnActionListener.VALUE_KEY,
- application.createValueBinding(value));
- }
- else
- {
- listener.setValue(value);
- }
- }
+ listener.setValue(_value);
+
((ActionSource) component).addActionListener(listener);
return super.doStartTag();
@@ -96,5 +85,5 @@
_value = null;
}
- private String _value;
+ private ValueExpression _value;
}
Modified: incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/SetActionListener.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/SetActionListener.java?view=diff&rev=469750&r1=469749&r2=469750
==============================================================================
--- incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/SetActionListener.java (original)
+++ incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/SetActionListener.java Tue Oct 31 18:02:55 2006
@@ -15,9 +15,10 @@
*/
package org.apache.myfaces.trinidadinternal.taglib.listener;
+import javax.el.ValueExpression;
+
import javax.faces.component.StateHolder;
import javax.faces.context.FacesContext;
-import javax.faces.el.ValueBinding;
import javax.faces.event.ActionEvent;
import javax.faces.event.ActionListener;
@@ -43,7 +44,7 @@
static public final FacesBean.Type TYPE = new FacesBean.Type();
static public final PropertyKey FROM_KEY =
TYPE.registerKey("from");
- // Must be a ValueBinding
+ // Must be a ValueExpression
static public final PropertyKey TO_KEY =
TYPE.registerKey("to");
@@ -58,23 +59,23 @@
public void processAction(ActionEvent event)
{
- ValueBinding to = getValueBinding(TO_KEY);
+ ValueExpression to = getValueExpression(TO_KEY);
if (to != null)
{
- Object from = getFrom();
+ Object from = getProperty(FROM_KEY);
try
{
- to.setValue(FacesContext.getCurrentInstance(), from);
+ to.setValue(FacesContext.getCurrentInstance().getELContext(), from);
}
catch (RuntimeException e)
{
if (_LOG.isWarning())
{
- ValueBinding fromBinding = getValueBinding(FROM_KEY);
+ ValueExpression fromExpression = getValueExpression(FROM_KEY);
String mes = "Error setting:'"+to.getExpressionString() +
"' to value:"+from;
- if (fromBinding != null)
- mes += " from:'"+fromBinding.getExpressionString()+"'";
+ if (fromExpression != null)
+ mes += " from:'"+fromExpression.getExpressionString()+"'";
_LOG.warning(mes, e);
}
@@ -83,14 +84,20 @@
}
}
- public Object getFrom()
+ public void setFrom(ValueExpression from)
{
- return getProperty(FROM_KEY);
+ if (from.isLiteralText())
+ setProperty(FROM_KEY, from.getValue(null));
+ else
+ setValueExpression(FROM_KEY, from);
}
- public void setFrom(Object from)
+ public void setTo(ValueExpression to)
{
- setProperty(FROM_KEY, from);
+ if (to.isLiteralText())
+ throw new IllegalArgumentException("setActionListener's 'to' must be an EL expression");
+
+ setValueExpression(TO_KEY, to);
}
@Override
Modified: incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/SetActionListenerTag.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/SetActionListenerTag.java?view=diff&rev=469750&r1=469749&r2=469750
==============================================================================
--- incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/SetActionListenerTag.java (original)
+++ incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/SetActionListenerTag.java Tue Oct 31 18:02:55 2006
@@ -17,6 +17,8 @@
import org.apache.myfaces.trinidadinternal.taglib.util.TagUtils;
+import javax.el.ValueExpression;
+
import javax.servlet.jsp.tagext.TagSupport;
import javax.servlet.jsp.JspException;
@@ -24,7 +26,7 @@
import javax.faces.component.ActionSource;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
-import javax.faces.webapp.UIComponentTag;
+import javax.faces.webapp.UIComponentClassicTagBase;
import org.apache.myfaces.trinidad.webapp.ELContextTag;
@@ -37,12 +39,12 @@
*/
public class SetActionListenerTag extends TagSupport
{
- public void setFrom(String from)
+ public void setFrom(ValueExpression from)
{
_from = from;
}
- public void setTo(String to)
+ public void setTo(ValueExpression to)
{
_to = to;
}
@@ -50,7 +52,7 @@
@Override
public int doStartTag() throws JspException
{
- UIComponentTag tag = UIComponentTag.getParentUIComponentTag(pageContext);
+ UIComponentClassicTagBase tag = UIComponentClassicTagBase.getParentUIComponentClassicTagBase(pageContext);
if (tag == null)
{
throw new JspException(
@@ -77,34 +79,13 @@
SetActionListener listener = new SetActionListener();
if (_from != null)
{
- if (TagUtils.isValueReference(_from))
- {
- String from = _from;
- if (parentELContext != null)
- from = parentELContext.transformExpression(from);
-
- listener.setValueBinding(SetActionListener.FROM_KEY,
- application.createValueBinding(from));
- }
- else
- {
- listener.setFrom(_from);
- }
-
- if (TagUtils.isValueReference(_to))
- {
- String to = _to;
- if (parentELContext != null)
- to = parentELContext.transformExpression(to);
-
- listener.setValueBinding(SetActionListener.TO_KEY,
- application.createValueBinding(to));
- }
- else
- {
+ listener.setFrom(_from);
+ if (_to.isLiteralText())
throw new JspException("setActionListener's 'to' attribute must " +
"be an EL expression.");
- }
+
+ if (_to != null)
+ listener.setTo(_to);
}
((ActionSource) component).addActionListener(listener);
@@ -120,6 +101,6 @@
_to = null;
}
- private String _from;
- private String _to;
+ private ValueExpression _from;
+ private ValueExpression _to;
}
Modified: incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/util/TagUtils.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/util/TagUtils.java?view=diff&rev=469750&r1=469749&r2=469750
==============================================================================
--- incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/util/TagUtils.java (original)
+++ incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/util/TagUtils.java Tue Oct 31 18:02:55 2006
@@ -30,7 +30,6 @@
import javax.faces.application.Application;
import javax.faces.context.FacesContext;
-import javax.faces.el.ValueBinding;
import org.apache.myfaces.trinidad.logging.TrinidadLogger;
@@ -50,14 +49,6 @@
{
}
- public static ValueBinding getValueBinding(String valueBindingExpression)
- {
- FacesContext context = FacesContext.getCurrentInstance();
- Application app = context.getApplication();
- ValueBinding vb = app.createValueBinding(valueBindingExpression);
- return vb;
- }
-
public static void assertNotNull(Object object)
{
if (null == object)
@@ -72,9 +63,12 @@
* @return
*/
public static String getString(
- String value)
+ Object value)
{
- return value;
+ if (value == null)
+ return null;
+
+ return value.toString();
}
/**
@@ -83,9 +77,15 @@
* @return
*/
public static boolean getBoolean(
- String value)
+ Object value)
{
- return Boolean.valueOf(value).booleanValue();
+ if (value == null)
+ return false;
+
+ if (value instanceof Boolean)
+ return ((Boolean) value).booleanValue();
+
+ return Boolean.valueOf(value.toString()).booleanValue();
}
/**
@@ -94,9 +94,15 @@
* @return
*/
public static int getInteger(
- String value)
+ Object value)
{
- return Integer.valueOf(value).intValue();
+ if (value == null)
+ return 0;
+
+ if (value instanceof Number)
+ return ((Number) value).intValue();
+
+ return Integer.valueOf(value.toString()).intValue();
}
@@ -106,10 +112,12 @@
* @return
*/
public static long getLong(
- String value)
+ Object value)
{
- return Long.valueOf(value).longValue();
+ if (value == null)
+ return 0;
+ return Long.valueOf(value.toString()).longValue();
}
/**
@@ -118,9 +126,12 @@
* @return
*/
public static double getDouble(
- String value)
+ Object value)
{
- return Double.valueOf(value).doubleValue();
+ if (value == null)
+ return 0;
+
+ return Double.valueOf(value.toString()).doubleValue();
}
@@ -130,10 +141,12 @@
* @return
*/
public static float getFloat(
- String value)
+ Object value)
{
- return Float.valueOf(value).floatValue();
+ if (value == null)
+ return 0;
+ return Float.valueOf(value.toString()).floatValue();
}
/**
@@ -143,9 +156,12 @@
* @return
*/
public static String[] getStringArray(
- String value) throws ParseException
+ Object value) throws ParseException
{
- return _getTokensArray(value);
+ if (value == null)
+ return null;
+
+ return _getTokensArray(value.toString());
}
/**
@@ -154,9 +170,15 @@
* @return
*/
public static Date getDate(
- String value)
+ Object value)
{
- return _parseISODate(value);
+ if (value == null)
+ return null;
+
+ if (value instanceof Date)
+ return ((Date) value);
+
+ return _parseISODate(value.toString());
}
/**
@@ -165,9 +187,15 @@
* @return
*/
public static Locale getLocale(
- String value)
+ Object value)
{
- return _getLocale(value);
+ if (value == null)
+ return null;
+
+ if (value instanceof Locale)
+ return ((Locale) value);
+
+ return _getLocale(value.toString());
}
/**
@@ -176,21 +204,15 @@
* @return
*/
public static TimeZone getTimeZone(
- String value)
+ Object value)
{
- return TimeZone.getTimeZone(value);
- }
+ if (value == null)
+ return null;
- public static boolean isValueReference(String expression)
- {
- if (null != expression)
- {
- int start = expression.indexOf("#{");
- if ((start >= 0) && (expression.indexOf('}', start + 1) >= 0))
- return true;
- }
+ if (value instanceof TimeZone)
+ return ((TimeZone) value);
- return false;
+ return TimeZone.getTimeZone(value.toString());
}
/**
@@ -198,9 +220,13 @@
* java.util.List of java.awt.Color objects and returns it.
* @throws ParseException In case of any parse errors upon such conversion.
*/
- public static List<Color> getColorList(String value) throws ParseException
+ public static List<Color> getColorList(Object value) throws ParseException
{
- String[] tokenArray = _getTokensArray(value);
+ if (value == null)
+ return null;
+
+ String valueStr = value.toString();
+ String[] tokenArray = _getTokensArray(valueStr);
if (tokenArray == null)
return null;
@@ -214,7 +240,7 @@
if (!colorCode.startsWith("#"))
throw new ParseException(
"Color code " + colorCode + " in '" + value + "' does not start with a '#'",
- value.indexOf(colorCode));
+ valueStr.indexOf(colorCode));
//pu: Allow NumberFormatException (RTE) to propogate as is, or transform to JspException ?.
int rgb = Integer.parseInt(colorCode.substring(1), 16);
Modified: incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/util/VirtualAttributeUtils.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/util/VirtualAttributeUtils.java?view=diff&rev=469750&r1=469749&r2=469750
==============================================================================
--- incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/util/VirtualAttributeUtils.java (original)
+++ incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/util/VirtualAttributeUtils.java Tue Oct 31 18:02:55 2006
@@ -15,7 +15,7 @@
*/
package org.apache.myfaces.trinidadinternal.taglib.util;
-import javax.faces.el.ValueBinding;
+import javax.el.ValueExpression;
import org.apache.myfaces.trinidad.bean.PropertyKey;
import org.apache.myfaces.trinidad.bean.FacesBean;
@@ -53,14 +53,14 @@
public static void setAccessKeyAttribute(
FacesBean bean,
- ValueBinding valueBinding,
+ ValueExpression valueExpression,
PropertyKey textKey,
PropertyKey accessKeyKey)
{
- bean.setValueBinding(accessKeyKey,
- new AccessKeyBinding(valueBinding));
- bean.setValueBinding(textKey,
- new StripAccessKeyBinding(valueBinding));
+ bean.setValueExpression(accessKeyKey,
+ new AccessKeyBinding(valueExpression));
+ bean.setValueExpression(textKey,
+ new StripAccessKeyBinding(valueExpression));
}
private VirtualAttributeUtils()
Modified: incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/uinode/UINodeFacesBean.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/uinode/UINodeFacesBean.java?view=diff&rev=469750&r1=469749&r2=469750
==============================================================================
--- incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/uinode/UINodeFacesBean.java (original)
+++ incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/uinode/UINodeFacesBean.java Tue Oct 31 18:02:55 2006
@@ -18,7 +18,7 @@
import java.util.HashSet;
import java.util.Set;
-import javax.faces.el.ValueBinding;
+import javax.el.ValueExpression;
import org.apache.myfaces.trinidad.bean.FacesBean;
@@ -167,14 +167,14 @@
AttributeKey attrKey = getAttributeKey(key);
if (attrKey != null)
{
- // We're no longer shadowing a ValueBinding (if one's present);
+ // We're no longer shadowing a ValueExpression (if one's present);
// re-establish that binding, or reset to null
Object attrValue;
- ValueBinding binding = getValueBinding(key);
- if (binding == null)
+ ValueExpression expression = getValueExpression(key);
+ if (expression == null)
attrValue = null;
else
- attrValue = new ValueBindingBoundValue(binding);
+ attrValue = new ValueExpressionBoundValue(expression);
_node.setAttributeValue(attrKey, attrValue);
}
@@ -186,9 +186,9 @@
}
@Override
- protected PropertyMap createBindingsMap()
+ protected PropertyMap createExpressionsMap()
{
- FlaggedPropertyMap bindings = new FlaggedPropertyMap()
+ FlaggedPropertyMap expressions = new FlaggedPropertyMap()
{
@Override
public Object put(PropertyKey key, Object value)
@@ -204,12 +204,12 @@
if (attrKey != null)
{
// If there's no local value, then we're not shadowing;
- // set up a new ValueBindingBoundValue
+ // set up a new ValueExpressionBoundValue
if (getLocalProperty(key) == null)
{
- ValueBinding binding = (ValueBinding) value;
+ ValueExpression expression = (ValueExpression) value;
_node.setAttributeValue(attrKey,
- new ValueBindingBoundValue(binding));
+ new ValueExpressionBoundValue(expression));
}
}
@@ -236,8 +236,7 @@
}
};
- bindings.setUseStateHolder(true);
- return bindings;
+ return expressions;
}
Modified: incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/uinode/bind/ConverterBoundValue.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/uinode/bind/ConverterBoundValue.java?view=diff&rev=469750&r1=469749&r2=469750
==============================================================================
--- incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/uinode/bind/ConverterBoundValue.java (original)
+++ incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/uinode/bind/ConverterBoundValue.java Tue Oct 31 18:02:55 2006
@@ -15,9 +15,10 @@
*/
package org.apache.myfaces.trinidadinternal.uinode.bind;
+import javax.el.ValueExpression;
+
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
-import javax.faces.el.ValueBinding;
import org.apache.myfaces.trinidad.bean.FacesBean;
import org.apache.myfaces.trinidad.component.UIXComponent;
@@ -52,15 +53,15 @@
Converter converter = (Converter)
bean.getProperty(UIXValue.CONVERTER_KEY);
- // OK, no explicit converter, look at the ValueBinding
+ // OK, no explicit converter, look at the ValueExpression
if (converter == null)
{
- ValueBinding binding = bean.getValueBinding(UIXValue.VALUE_KEY);
- if (binding != null)
+ ValueExpression expression = bean.getValueExpression(UIXValue.VALUE_KEY);
+ if (expression != null)
{
FacesContext fContext = (context == null) ?
FacesContext.getCurrentInstance() : context.getFacesContext();
- Class<?> type = binding.getType(fContext);
+ Class<?> type = expression.getType(fContext.getELContext());
converter = ConverterUtils.createConverter(fContext, type);
}
}
Modified: incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/FacesConfigTest.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/FacesConfigTest.java?view=diff&rev=469750&r1=469749&r2=469750
==============================================================================
--- incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/FacesConfigTest.java (original)
+++ incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/FacesConfigTest.java Tue Oct 31 18:02:55 2006
@@ -26,6 +26,8 @@
/* DISABLE THIS TEST: we cannot redistribute the web-facesconfig_1_1.dtd
without a proper license. Once in MyFaces Apache, we should be
able to refer to the MyFaces copy of the DTD for this test */
+ /* But now in 1.2, we have to disable it again - because we need
+ to use Schema Validation. */
public void testFacesConfigValidity() throws Throwable
{
/*
Modified: incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/MApplication.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/MApplication.java?view=diff&rev=469750&r1=469749&r2=469750
==============================================================================
--- incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/MApplication.java (original)
+++ incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/MApplication.java Tue Oct 31 18:02:55 2006
@@ -289,7 +289,7 @@
}
@Override
- public Iterator<Class<?>> getConverterTypes()
+ public Iterator<Class> getConverterTypes()
{
throw new UnsupportedOperationException("Should not be called during rendering");
}
Modified: incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/MFacesContext.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/MFacesContext.java?view=diff&rev=469750&r1=469749&r2=469750
==============================================================================
--- incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/MFacesContext.java (original)
+++ incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/MFacesContext.java Tue Oct 31 18:02:55 2006
@@ -38,6 +38,7 @@
import javax.faces.render.RenderKit;
import org.apache.myfaces.trinidadinternal.share.config.Configuration;
+import org.apache.myfaces.trinidadbuild.test.MockFacesContext12;
import org.apache.shale.test.mock.MockExternalContext;
import org.apache.shale.test.mock.MockFacesContext;
@@ -45,10 +46,11 @@
* Mock faces context for use with unit tests
* @author Arjuna Wijeyekoon
*/
-public class MFacesContext extends MockFacesContext
+public class MFacesContext extends MockFacesContext12
{
- public MFacesContext(boolean testMode)
+ public MFacesContext(Application application, boolean testMode)
{
+ super(application);
setCurrentInstance(this);
_external = new External(testMode);
}
Modified: incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/MValueBinding.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/MValueBinding.java?view=diff&rev=469750&r1=469749&r2=469750
==============================================================================
--- incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/MValueBinding.java (original)
+++ incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/MValueBinding.java Tue Oct 31 18:02:55 2006
@@ -41,6 +41,7 @@
Object var = vr.resolveVariable(context, varName);
if (period < 0)
return var;
+
return _resolveProperty(context, var, _expression.substring(period + 1));
}
@@ -55,7 +56,7 @@
PropertyResolver pr = context.getApplication().getPropertyResolver();
var = pr.getValue(var, propertyName);
-
+
if (period < 0)
return var;
return _resolveProperty(context, var, expr.substring(period + 1));
Modified: incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/RenderKitPerfTestCase.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/RenderKitPerfTestCase.java?view=diff&rev=469750&r1=469749&r2=469750
==============================================================================
--- incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/RenderKitPerfTestCase.java (original)
+++ incubator/adffaces/branches/faces-1_2-061031/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/RenderKitPerfTestCase.java Tue Oct 31 18:02:55 2006
@@ -122,7 +122,7 @@
// _fileWriter = new java.io.BufferedWriter(new java.io.FileWriter("c:\\tmp\\test.out", true));
//
- _facesContext = new MFacesContext(false);
+ _facesContext = new MFacesContext(MApplication.sharedInstance(), false);
ResponseWriter writer = new XhtmlResponseWriter(
_fileWriter == null ? new NullWriter() : _fileWriter,
XhtmlResponseWriter.XHTML_CONTENT_TYPE,