You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by jw...@apache.org on 2007/11/12 22:03:40 UTC
svn commit: r594297 [2/39] - in /myfaces/trinidad/branches/1.2.4-branch: ./
trinidad-api/
trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/
trinidad-api/src/main/java/org/apache/myfaces/trinidad/bean/
trinidad-api/src/main/jav...
Modified: myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXCollection.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXCollection.java?rev=594297&r1=594296&r2=594297&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXCollection.java (original)
+++ myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXCollection.java Mon Nov 12 13:03:17 2007
@@ -28,6 +28,8 @@
import java.util.Map;
import java.util.Set;
+import javax.faces.FacesException;
+import javax.faces.component.ContextCallback;
import javax.faces.component.NamingContainer;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
@@ -661,9 +663,9 @@
* @return the local clientId
*/
@Override
- protected final String getLocalClientId()
+ public final String getContainerClientId(FacesContext context)
{
- String id = super.getLocalClientId();
+ String id = getClientId(context);
String key = getClientRowKey();
if (key != null)
{
@@ -993,6 +995,52 @@
return iState._clientKeyMgr;
}
+ public boolean invokeOnComponent(FacesContext context,
+ String clientId,
+ ContextCallback callback)
+ throws FacesException
+ {
+ String thisClientId = getClientId(context);
+ if (clientId.equals(thisClientId))
+ {
+ if (_getAndMarkFirstInvokeForRequest(context, clientId))
+ _flushCachedModel();
+
+ callback.invokeContextCallback(context, this);
+ return true;
+ }
+ // If we're on a row, set the currency, and invoke
+ // inside
+ int thisClientIdLength = thisClientId.length();
+ if (clientId.startsWith(thisClientId) &&
+ (clientId.charAt(thisClientIdLength) == NamingContainer.SEPARATOR_CHAR))
+ {
+ if (_getAndMarkFirstInvokeForRequest(context, clientId))
+ _flushCachedModel();
+
+ String postId = clientId.substring(thisClientIdLength + 1);
+ int sepIndex = postId.indexOf(NamingContainer.SEPARATOR_CHAR);
+ // If there's no separator character afterwards, then this
+ // isn't a row key
+ if (sepIndex < 0)
+ return super.invokeOnComponent(context, clientId, callback);
+ String currencyString = postId.substring(0, sepIndex);
+ Object oldRowKey = getRowKey();
+ try
+ {
+ setCurrencyString(currencyString);
+ return super.invokeOnComponent(context, clientId, callback);
+ }
+ finally
+ {
+ // And restore the currency
+ setRowKey(oldRowKey);
+ }
+ }
+
+ return false;
+ }
+
/**
* Gets the CollectionModel to use with this component.
*
@@ -1122,6 +1170,25 @@
iState._model = createCollectionModel(iState._model, value);
}
}
+
+ //
+ // Returns true if this is the first request to invokeOnComponent()
+ //
+ static private boolean _getAndMarkFirstInvokeForRequest(
+ FacesContext context, String clientId)
+ {
+ // See if the request contains a marker that we've hit this
+ // method already for this clientId
+ Map<String, Object> requestMap = context.getExternalContext().getRequestMap();
+ String key = _INVOKE_KEY + clientId;
+ // Yep, we have, so return true
+ if (requestMap.containsKey(key))
+ return true;
+
+ // Stash TRUE for next time, and return false
+ requestMap.put(key, Boolean.TRUE);
+ return false;
+ }
/**
* Gets the internal state of this component.
@@ -1412,6 +1479,9 @@
// be Serializable:
private static final Object _NULL = new Object();
private static final Object[] _EMPTY_ARRAY = new Object[0];
+ private static final String _INVOKE_KEY =
+ UIXCollection.class.getName() + ".INVOKE";
+
private static final TrinidadLogger _LOG = TrinidadLogger.createTrinidadLogger(UIXCollection.class);
// An enum to throw into state-saving so that we get a nice
Modified: myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXComponent.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXComponent.java?rev=594297&r1=594296&r2=594297&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXComponent.java (original)
+++ myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXComponent.java Mon Nov 12 13:03:17 2007
@@ -18,15 +18,10 @@
*/
package org.apache.myfaces.trinidad.component;
-import java.io.IOException;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.el.MethodBinding;
-import javax.faces.event.FacesListener;
+import javax.el.MethodExpression;
+
import org.apache.myfaces.trinidad.bean.FacesBean;
import org.apache.myfaces.trinidad.event.AttributeChangeListener;
@@ -71,7 +66,7 @@
* specific request. An example of an attribute change events might
* include the width of a column that supported client-side resizing.
*/
- abstract public void setAttributeChangeListener(MethodBinding mb);
+ abstract public void setAttributeChangeListener(MethodExpression me);
/**
* Gets the method binding to an AttributeChangeListener. Attribute
@@ -81,39 +76,7 @@
* specific request. An example of an attribute change events might
* include the width of a column that supported client-side resizing.
*/
- abstract public MethodBinding getAttributeChangeListener();
+ abstract public MethodExpression getAttributeChangeListener();
abstract public void markInitialState();
-
- // JSF 1.2 methods that we're adding up front
- abstract public int getFacetCount();
- abstract public void encodeAll(FacesContext context) throws IOException;
-
-
- // Everything below here is a UIComponent method
-
- @SuppressWarnings("unchecked")
- @Override
- public abstract Map getAttributes();
-
- @SuppressWarnings("unchecked")
- @Override
- public abstract List getChildren();
-
- @SuppressWarnings("unchecked")
- @Override
- public abstract Map getFacets();
-
- @SuppressWarnings("unchecked")
- @Override
- public abstract Iterator getFacetsAndChildren();
-
- @SuppressWarnings("unchecked")
- @Override
- protected abstract FacesListener[] getFacesListeners(Class clazz);
-
- public abstract Object saveState(FacesContext context);
- public abstract void restoreState(FacesContext context, Object state);
- public abstract boolean isTransient();
- public abstract void setTransient(boolean trans);
}
Modified: myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXComponentBase.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXComponentBase.java?rev=594297&r1=594296&r2=594297&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXComponentBase.java (original)
+++ myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXComponentBase.java Mon Nov 12 13:03:17 2007
@@ -28,6 +28,11 @@
import java.util.NoSuchElementException;
import java.util.Properties;
+import javax.el.ELContext;
+import javax.el.ELException;
+import javax.el.MethodExpression;
+import javax.el.ValueExpression;
+
import javax.faces.component.NamingContainer;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
@@ -106,8 +111,7 @@
static private final PropertyKey _LISTENERS_KEY =
TYPE.registerKey("listeners", FacesListener[].class, PropertyKey.CAP_LIST);
static private final PropertyKey _ATTRIBUTE_CHANGE_LISTENER_KEY =
- TYPE.registerKey("attributeChangeListener", MethodBinding.class,
- PropertyKey.CAP_STATE_HOLDER);
+ TYPE.registerKey("attributeChangeListener", MethodExpression.class);
// =-=AEW "parent", "rendersChildren", "childCount", "children",
// "facets", "facetsAndChildren", "family" all are technically
// bean properties, but they aren't exposed here...
@@ -190,18 +194,63 @@
}
@Override
- public void setAttributeChangeListener(MethodBinding mb)
+ public void setAttributeChangeListener(MethodExpression mb)
{
setProperty(_ATTRIBUTE_CHANGE_LISTENER_KEY, mb);
}
+ @Deprecated
+ public void setAttributeChangeListener(MethodBinding mb)
+ {
+ setAttributeChangeListener(adaptMethodBinding(mb));
+ }
+
@Override
- public MethodBinding getAttributeChangeListener()
+ public MethodExpression getAttributeChangeListener()
{
- return (MethodBinding) getProperty(_ATTRIBUTE_CHANGE_LISTENER_KEY);
+ return (MethodExpression) getProperty(_ATTRIBUTE_CHANGE_LISTENER_KEY);
}
+ @Override
+ public ValueExpression getValueExpression(String name)
+ {
+ if (name == null)
+ throw new NullPointerException();
+
+ PropertyKey key = getPropertyKey(name);
+
+ // Support standard RI behavior where getValueBinding()
+ // doesn't complain about being asked for a ValueBinding -
+ // but continue supporting strict behavior at FacesBean layer.
+ if (!key.getSupportsBinding())
+ return null;
+
+ return getFacesBean().getValueExpression(key);
+ }
+
+ @Override
+ public void setValueExpression(String name,
+ ValueExpression expression)
+ {
+ if (name == null)
+ throw new NullPointerException();
+
+ if ((expression != null) && expression.isLiteralText())
+ {
+ ELContext context =
+ FacesContext.getCurrentInstance().getELContext();
+ getAttributes().put(name, expression.getValue(context));
+ }
+ else
+ {
+ PropertyKey key = getPropertyKey(name);
+ getFacesBean().setValueExpression(key, expression);
+ }
+ }
+
+
+
/**
*/
@Override
@@ -233,9 +282,8 @@
}
- @SuppressWarnings("unchecked")
@Override
- public Map getAttributes()
+ public Map<String, Object> getAttributes()
{
if (_attributes == null)
_init(null);
@@ -252,7 +300,7 @@
// NOTE - client ids cannot be cached because the generated
// value has to be dynamically calculated in some cases (UIData)
- String clientId = getLocalClientId();
+ String clientId = getId();
if (clientId == null)
{
clientId = (String) getProperty(_GENERATED_ID_KEY);
@@ -269,7 +317,7 @@
{
if (containerComponent instanceof NamingContainer)
{
- clientId = (containerComponent.getClientId(context) +
+ clientId = (containerComponent.getContainerClientId(context) +
NamingContainer.SEPARATOR_CHAR +
clientId);
break;
@@ -359,13 +407,11 @@
setBooleanProperty(RENDERED_KEY, rendered);
}
- @Override
public boolean isTransient()
{
return getBooleanProperty(TRANSIENT_KEY, false);
}
- @Override
public void setTransient(boolean newTransient)
{
setBooleanProperty(TRANSIENT_KEY, newTransient);
@@ -497,9 +543,8 @@
* <p>Create (if necessary) and return a List of the children associated
* with this component.</p>
*/
- @SuppressWarnings("unchecked")
@Override
- public List getChildren()
+ public List<UIComponent> getChildren()
{
if (_children == null)
_children = new ChildArrayList(this);
@@ -520,9 +565,8 @@
* <p>Create (if necessary) and return a Map of the facets associated
* with this component.</p>
*/
- @SuppressWarnings("unchecked")
@Override
- public Map getFacets()
+ public Map<String, UIComponent> getFacets()
{
if (_facets == null)
@@ -539,7 +583,7 @@
throw new NullPointerException();
if (_facets == null)
return null;
- return (UIComponent) getFacets().get(facetName);
+ return getFacets().get(facetName);
}
@@ -559,9 +603,8 @@
// TODO: Optimize to a compound iterator
- @SuppressWarnings("unchecked")
@Override
- public Iterator getFacetsAndChildren()
+ public Iterator<UIComponent> getFacetsAndChildren()
{
// =-=AEW Is this supposed to be an immutable Iterator?
if (_facets == null)
@@ -597,7 +640,6 @@
// ------------------------------------------- Event processing methods
- @SuppressWarnings("unchecked")
@Override
public void broadcast(FacesEvent event)
throws AbortProcessingException
@@ -630,7 +672,7 @@
if (event instanceof AttributeChangeEvent)
{
- broadcastToMethodBinding(event, getAttributeChangeListener());
+ broadcastToMethodExpression(event, getAttributeChangeListener());
}
}
@@ -638,7 +680,6 @@
// ------------------------------------------- Lifecycle Processing Methods
- @SuppressWarnings("unchecked")
@Override
public void decode(FacesContext context)
{
@@ -646,9 +687,7 @@
throw new NullPointerException();
// Find all the partialTriggers and save on the context
- // -= Simon Lessard =-
- // FIXME: JSF 1.2 specify <String, Object>
- Map<Object, Object> attrs = getAttributes();
+ Map<String, Object> attrs = getAttributes();
Object triggers = attrs.get("partialTriggers");
if (triggers instanceof String[])
{
@@ -848,13 +887,11 @@
getFacesBean().markInitialState();
}
- @Override
public Object saveState(FacesContext context)
{
return getFacesBean().saveState(context);
}
- @Override
public void restoreState(FacesContext context, Object stateObj)
{
getFacesBean().restoreState(context, stateObj);
@@ -909,7 +946,6 @@
* component.
* @param context the current FacesContext
*/
- @SuppressWarnings("unchecked")
protected void decodeChildrenImpl(FacesContext context)
{
Iterator<UIComponent> kids = getFacetsAndChildren();
@@ -945,7 +981,6 @@
* component.
* @param context the current FacesContext
*/
- @SuppressWarnings("unchecked")
protected void validateChildrenImpl(FacesContext context)
{
// Process all the facets and children of this component
@@ -977,7 +1012,6 @@
updateChildrenImpl(context);
}
- @SuppressWarnings("unchecked")
protected void updateChildrenImpl(FacesContext context)
{
// Process all the facets and children of this component
@@ -1007,7 +1041,6 @@
getFacesBean().removeEntry(_LISTENERS_KEY, listener);
}
- @SuppressWarnings("unchecked")
@Override
protected FacesListener[] getFacesListeners(Class clazz)
{
@@ -1145,15 +1178,6 @@
return n.intValue();
}
- /**
- * Returns the default local client identifier, relative to the current
- * naming container.
- */
- protected String getLocalClientId()
- {
- return getId();
- }
-
/**
* Return the number of facets. This is more efficient than
@@ -1174,6 +1198,7 @@
* This can be used to support MethodBindings such as the "actionListener"
* binding on ActionSource components:
* <tr:commandButton actionListener="#{mybean.myActionListener}">
+ * @deprecated
*/
protected final void broadcastToMethodBinding(
FacesEvent event,
@@ -1198,10 +1223,46 @@
}
/**
+ * Given a MethodBinding, create a MethodExpression that
+ * adapts it.
+ */
+ static public MethodExpression adaptMethodBinding(MethodBinding binding)
+ {
+ return new MethodBindingMethodExpression(binding);
+ }
+
+ /**
+ * Broadcast an event to a MethodExpression.
+ * This can be used to support MethodBindings such as the "actionListener"
+ * binding on ActionSource components:
+ * <tr:commandButton actionListener="#{mybean.myActionListener}">
+ */
+ protected final void broadcastToMethodExpression(
+ FacesEvent event,
+ MethodExpression method) throws AbortProcessingException
+ {
+ if (method != null)
+ {
+ try
+ {
+ FacesContext context = getFacesContext();
+ method.invoke(context.getELContext(), new Object[] { event });
+ }
+ catch (ELException ee)
+ {
+ Throwable t = ee.getCause();
+ // Unwrap AbortProcessingExceptions
+ if (t instanceof AbortProcessingException)
+ throw ((AbortProcessingException) t);
+ throw ee;
+ }
+ }
+ }
+
+ /**
* render a component. this is called by renderers whose
* getRendersChildren() return true.
*/
- @SuppressWarnings("unchecked")
void __encodeRecursive(FacesContext context, UIComponent component)
throws IOException
{
@@ -1216,7 +1277,7 @@
{
if (component.getChildCount() > 0)
{
- for(UIComponent child : (List<UIComponent>)component.getChildren())
+ for(UIComponent child : component.getChildren())
{
__encodeRecursive(context, child);
}
@@ -1228,7 +1289,6 @@
}
- @SuppressWarnings("unchecked")
static private UIComponent _findInsideOf(
UIComponent from,
String id)
Modified: myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/ExternalContextDecorator.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/ExternalContextDecorator.java?rev=594297&r1=594296&r2=594297&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/ExternalContextDecorator.java (original)
+++ myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/ExternalContextDecorator.java Mon Nov 12 13:03:17 2007
@@ -20,6 +20,7 @@
import java.io.IOException;
import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.net.URL;
import java.security.Principal;
@@ -56,12 +57,36 @@
}
@Override
+ public String getRequestCharacterEncoding()
+ {
+ return getExternalContext().getRequestCharacterEncoding();
+ }
+
+ @Override
+ public String getRequestContentType()
+ {
+ return getExternalContext().getRequestContentType();
+ }
+
+ @Override
public Object getResponse()
{
return getExternalContext().getResponse();
}
@Override
+ public String getResponseCharacterEncoding()
+ {
+ return getExternalContext().getResponseCharacterEncoding();
+ }
+
+ @Override
+ public String getResponseContentType()
+ {
+ return getExternalContext().getResponseContentType();
+ }
+
+ @Override
public Object getSession(boolean create)
{
return getExternalContext().getSession(create);
@@ -226,6 +251,31 @@
public Locale getRequestLocale()
{
return getExternalContext().getRequestLocale();
+ }
+
+ @Override
+ public void setRequest(Object request)
+ {
+ getExternalContext().setRequest(request);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public void setRequestCharacterEncoding(String encoding) throws UnsupportedEncodingException
+ {
+ getExternalContext().setRequestCharacterEncoding(encoding);
+ }
+
+ @Override
+ public void setResponse(Object response)
+ {
+ getExternalContext().setResponse(response);
+ }
+
+ @Override
+ public void setResponseCharacterEncoding(String encoding)
+ {
+ getExternalContext().setResponseCharacterEncoding(encoding);
}
@SuppressWarnings("unchecked")
Modified: myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/RequestContext.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/RequestContext.java?rev=594297&r1=594296&r2=594297&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/RequestContext.java (original)
+++ myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/RequestContext.java Mon Nov 12 13:03:17 2007
@@ -22,6 +22,7 @@
import java.util.List;
import java.util.Locale;
import java.util.Map;
+import java.util.Set;
import java.util.TimeZone;
import javax.faces.component.UIComponent;
@@ -399,6 +400,11 @@
* @see ComponentUtils#findRelativeComponent(UIComponent, String)
*/
public abstract void addPartialTargets(UIComponent from, String... targets);
+
+ /**
+ * Returns the set of partial targets related to a given UIComponent.
+ */
+ public abstract Set<UIComponent> getPartialTargets(UIComponent newTarget);
/**
* Adds a listener on a set of particular triggering components. If one of
Modified: myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/convert/ColorConverter.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/convert/ColorConverter.java?rev=594297&r1=594296&r2=594297&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/convert/ColorConverter.java (original)
+++ myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/convert/ColorConverter.java Mon Nov 12 13:03:17 2007
@@ -22,6 +22,8 @@
import java.text.ParseException;
+import javax.el.ValueExpression;
+
import javax.faces.application.FacesMessage;
import javax.faces.component.StateHolder;
import javax.faces.component.UIComponent;
@@ -413,6 +415,42 @@
}
/**
+ * <p>Set the {@link ValueExpression} used to calculate the value for the
+ * specified attribute if any.</p>
+ *
+ * @param name Name of the attribute for which to set a {@link ValueExpression}
+ * @param expression The {@link ValueExpression} to set, or <code>null</code>
+ * to remove any currently set {@link ValueExpression}
+ *
+ * @exception NullPointerException if <code>name</code>
+ * is <code>null</code>
+ * @exception IllegalArgumentException if <code>name</code> is not a valid
+ * attribute of this converter
+ */
+ public void setValueExpression(String name, ValueExpression expression)
+ {
+ ConverterUtils.setValueExpression(_facesBean, name, expression) ;
+ }
+
+
+ /**
+ * <p>Return the {@link ValueExpression} used to calculate the value for the
+ * specified attribute name, if any.</p>
+ *
+ * @param name Name of the attribute or property for which to retrieve a
+ * {@link ValueExpression}
+ *
+ * @exception NullPointerException if <code>name</code>
+ * is <code>null</code>
+ * @exception IllegalArgumentException if <code>name</code> is not a valid
+ * attribute of this converter
+ */
+ public ValueExpression getValueExpression(String name)
+ {
+ return ConverterUtils.getValueExpression(_facesBean, name);
+ }
+
+ /**
* <p>Set the {@link ValueBinding} used to calculate the value for the
* specified attribute if any.</p>
*
@@ -424,6 +462,7 @@
* is <code>null</code>
* @exception IllegalArgumentException if <code>name</code> is not a valid
* attribute of this converter
+ * @deprecated
*/
public void setValueBinding(String name, ValueBinding binding)
{
@@ -441,6 +480,7 @@
* is <code>null</code>
* @exception IllegalArgumentException if <code>name</code> is not a valid
* attribute of this converter
+ * @deprecated
*/
public ValueBinding getValueBinding(String name)
{
Modified: myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/convert/ConverterUtils.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/convert/ConverterUtils.java?rev=594297&r1=594296&r2=594297&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/convert/ConverterUtils.java (original)
+++ myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/convert/ConverterUtils.java Mon Nov 12 13:03:17 2007
@@ -18,6 +18,7 @@
*/
package org.apache.myfaces.trinidad.convert;
+import javax.el.ValueExpression;
import javax.faces.component.UIComponent;
import javax.faces.el.ValueBinding;
@@ -59,6 +60,19 @@
return bean;
}
+ static void setValueExpression(FacesBean bean, String name, ValueExpression expression)
+ {
+ PropertyKey key = _getPropertyKey(bean, name, true);
+ bean.setValueExpression(key, expression);
+ }
+
+ static ValueExpression getValueExpression(FacesBean bean, String name)
+ {
+ PropertyKey key = _getPropertyKey(bean, name, true);
+ return bean.getValueExpression(key);
+ }
+
+
static void setValueBinding(FacesBean bean, String name, ValueBinding binding)
{
PropertyKey key = _getPropertyKey(bean, name, true);
Modified: myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/convert/DateTimeConverter.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/convert/DateTimeConverter.java?rev=594297&r1=594296&r2=594297&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/convert/DateTimeConverter.java (original)
+++ myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/convert/DateTimeConverter.java Mon Nov 12 13:03:17 2007
@@ -33,6 +33,8 @@
import java.util.Set;
import java.util.TimeZone;
+import javax.el.ValueExpression;
+
import javax.faces.application.FacesMessage;
import javax.faces.component.StateHolder;
import javax.faces.component.UIComponent;
@@ -935,6 +937,42 @@
}
/**
+ * <p>Set the {@link ValueExpression} used to calculate the value for the
+ * specified attribute if any.</p>
+ *
+ * @param name Name of the attribute for which to set a {@link ValueExpression}
+ * @param expression The {@link ValueExpression} to set, or <code>null</code>
+ * to remove any currently set {@link ValueExpression}
+ *
+ * @exception NullPointerException if <code>name</code>
+ * is <code>null</code>
+ * @exception IllegalArgumentException if <code>name</code> is not a valid
+ * attribute of this converter
+ */
+ public void setValueExpression(String name, ValueExpression expression)
+ {
+ ConverterUtils.setValueExpression(_facesBean, name, expression) ;
+ }
+
+
+ /**
+ * <p>Return the {@link ValueExpression} used to calculate the value for the
+ * specified attribute name, if any.</p>
+ *
+ * @param name Name of the attribute or property for which to retrieve a
+ * {@link ValueExpression}
+ *
+ * @exception NullPointerException if <code>name</code>
+ * is <code>null</code>
+ * @exception IllegalArgumentException if <code>name</code> is not a valid
+ * attribute of this converter
+ */
+ public ValueExpression getValueExpression(String name)
+ {
+ return ConverterUtils.getValueExpression(_facesBean, name);
+ }
+
+ /**
* <p>Set the {@link ValueBinding} used to calculate the value for the
* specified attribute if any.</p>
*
@@ -946,6 +984,7 @@
* is <code>null</code>
* @exception IllegalArgumentException if <code>name</code> is not a valid
* attribute of this converter
+ * @deprecated
*/
public void setValueBinding(String name, ValueBinding binding)
{
@@ -964,6 +1003,7 @@
* is <code>null</code>
* @exception IllegalArgumentException if <code>name</code> is not a valid
* attribute of this converter
+ * @deprecated
*/
public ValueBinding getValueBinding(String name)
{
Modified: myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/convert/NumberConverter.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/convert/NumberConverter.java?rev=594297&r1=594296&r2=594297&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/convert/NumberConverter.java (original)
+++ myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/convert/NumberConverter.java Mon Nov 12 13:03:17 2007
@@ -28,6 +28,8 @@
import java.util.Locale;
import java.util.Map;
+import javax.el.ValueExpression;
+
import javax.faces.application.FacesMessage;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
@@ -334,6 +336,42 @@
}
/**
+ * <p>Set the {@link ValueExpression} used to calculate the value for the
+ * specified attribute if any.</p>
+ *
+ * @param name Name of the attribute for which to set a {@link ValueExpression}
+ * @param expression The {@link ValueExpression} to set, or <code>null</code>
+ * to remove any currently set {@link ValueExpression}
+ *
+ * @exception NullPointerException if <code>name</code>
+ * is <code>null</code>
+ * @exception IllegalArgumentException if <code>name</code> is not a valid
+ * attribute of this converter
+ */
+ public void setValueExpression(String name, ValueExpression expression)
+ {
+ ConverterUtils.setValueExpression(_facesBean, name, expression) ;
+ }
+
+
+ /**
+ * <p>Return the {@link ValueExpression} used to calculate the value for the
+ * specified attribute name, if any.</p>
+ *
+ * @param name Name of the attribute or property for which to retrieve a
+ * {@link ValueExpression}
+ *
+ * @exception NullPointerException if <code>name</code>
+ * is <code>null</code>
+ * @exception IllegalArgumentException if <code>name</code> is not a valid
+ * attribute of this converter
+ */
+ public ValueExpression getValueExpression(String name)
+ {
+ return ConverterUtils.getValueExpression(_facesBean, name);
+ }
+
+ /**
* <p>Set the {@link ValueBinding} used to calculate the value for the
* specified attribute if any.</p>
*
@@ -345,6 +383,7 @@
* is <code>null</code>
* @exception IllegalArgumentException if <code>name</code> is not a valid
* attribute of this converter
+ * @deprecated
*/
public void setValueBinding(String name, ValueBinding binding)
{
@@ -362,6 +401,7 @@
* is <code>null</code>
* @exception IllegalArgumentException if <code>name</code> is not a valid
* attribute of this converter
+ * @deprecated
*/
public ValueBinding getValueBinding(String name)
{
Modified: myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/event/SetActionListener.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/event/SetActionListener.java?rev=594297&r1=594296&r2=594297&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/event/SetActionListener.java (original)
+++ myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/event/SetActionListener.java Mon Nov 12 13:03:17 2007
@@ -18,9 +18,10 @@
*/
package org.apache.myfaces.trinidad.event;
+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;
@@ -35,7 +36,6 @@
*/
public class SetActionListener implements ActionListener, StateHolder
{
-
/**
* Creates a SetActionListener.
*/
@@ -50,23 +50,23 @@
*/
public void processAction(ActionEvent event)
{
- ValueBinding to = _bean.getValueBinding(Bean.TO_KEY);
+ ValueExpression to = _bean.getValueExpression(Bean.TO_KEY);
if (to != null)
{
Object from = getFrom();
try
{
- to.setValue(FacesContext.getCurrentInstance(), from);
+ to.setValue(FacesContext.getCurrentInstance().getELContext(), from);
}
catch (RuntimeException e)
{
if (_LOG.isWarning())
{
- ValueBinding fromBinding = _bean.getValueBinding(Bean.FROM_KEY);
+ ValueExpression fromExpression = _bean.getValueExpression(Bean.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);
}
@@ -75,21 +75,21 @@
}
}
- public ValueBinding getValueBinding(String name)
+ public ValueExpression getValueExpression(String name)
{
PropertyKey key = Bean.TYPE.findKey(name);
if (key == null)
return null;
- return _bean.getValueBinding(key);
+ return _bean.getValueExpression(key);
}
- public void setValueBinding(String name, ValueBinding binding)
+ public void setValueExpression(String name, ValueExpression binding)
{
PropertyKey key = Bean.TYPE.findKey(name);
if (key == null)
throw new IllegalArgumentException();
- _bean.setValueBinding(key, binding);
+ _bean.setValueExpression(key, binding);
}
public Object getFrom()
@@ -128,7 +128,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");
Modified: myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/ChildPropertyTreeModel.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/ChildPropertyTreeModel.java?rev=594297&r1=594296&r2=594297&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/ChildPropertyTreeModel.java (original)
+++ myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/ChildPropertyTreeModel.java Mon Nov 12 13:03:17 2007
@@ -23,7 +23,6 @@
import java.util.Collection;
import java.util.List;
-import javax.faces.el.PropertyResolver;
import javax.faces.model.DataModel;
import org.apache.myfaces.trinidad.logging.TrinidadLogger;
@@ -341,8 +340,7 @@
if (prop == null)
return null;
- PropertyResolver resolver = SortableModel.__getPropertyResolver();
- return resolver.getValue(parentData, prop);
+ return SortableModel.__resolveProperty(parentData, prop);
}
/**
Modified: myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/ProcessMenuModel.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/ProcessMenuModel.java?rev=594297&r1=594296&r2=594297&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/ProcessMenuModel.java (original)
+++ myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/ProcessMenuModel.java Mon Nov 12 13:03:17 2007
@@ -109,7 +109,7 @@
public ProcessMenuModel(
Object instance,
String viewIdProperty,
- Object maxPathKey
+ String maxPathKey
)throws IntrospectionException
{
super(instance, viewIdProperty);
@@ -151,7 +151,7 @@
*/
public boolean isImmediate()
{
- Object maxPathKey = getMaxPathKey();
+ String maxPathKey = getMaxPathKey();
if ( maxPathKey == null)
return ProcessUtils.isImmediate(this, false);
else
@@ -189,7 +189,7 @@
*/
public boolean isReadOnly()
{
- Object maxPathKey = getMaxPathKey();
+ String maxPathKey = getMaxPathKey();
if (maxPathKey == null)
return ProcessUtils.isReadOnly(this, true);
else
@@ -211,14 +211,14 @@
public boolean isVisited()
{
// Max Visited
- Object maxPathKey = getMaxPathKey();
+ String maxPathKey = getMaxPathKey();
if ( maxPathKey == null)
{
return ProcessUtils.isVisited(this, false);
}
else
{
- Object maxPath = ProcessUtils.getMaxVisitedRowKey(this, maxPathKey);
+ Object maxPath = ProcessUtils.getMaxVisitedRowKey(this, maxPathKey);
return ProcessUtils.isVisited(this, maxPath, false);
}
}
@@ -228,20 +228,20 @@
*/
public void clearMaxPath()
{
- Object maxPathKey = getMaxPathKey();
+ String maxPathKey = getMaxPathKey();
if ( maxPathKey != null)
ProcessUtils.clearMaxPath(maxPathKey);
}
- public void setMaxPathKey(Object maxPathKey)
+ public void setMaxPathKey(String maxPathKey)
{
_maxPathKey = maxPathKey;
}
- public Object getMaxPathKey()
+ public String getMaxPathKey()
{
return _maxPathKey;
}
- Object _maxPathKey = null;
+ private String _maxPathKey;
}
Modified: myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/ProcessUtils.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/ProcessUtils.java?rev=594297&r1=594296&r2=594297&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/ProcessUtils.java (original)
+++ myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/ProcessUtils.java Mon Nov 12 13:03:17 2007
@@ -425,13 +425,12 @@
@SuppressWarnings("unchecked")
public static Object getMaxVisitedRowKey(
MenuModel model,
- Object maxPathKey
+ String maxPathKey
)
{
//TODO - what if maxPathKey is null
ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext();
- //FIXME As of JSF 1.2, the request map is <String, Object>
- Map<Object, Object> requestMap = externalContext.getRequestMap();
+ Map<String, Object> requestMap = externalContext.getRequestMap();
@@ -442,9 +441,7 @@
//TODO - if I change this to use pageFlowScope it doesn't work.
// figure out why.
- // FIXME: -= Simon Lessard
- // session map is <String, Object> as of JSF 1.2
- Map<Object,Object> sessionMap = externalContext.getSessionMap();
+ Map<String,Object> sessionMap = externalContext.getSessionMap();
Map<Object,Object> maxPathMap = (Map<Object,Object>)sessionMap.get(maxPathKey);
if (maxPathMap == null)
@@ -507,13 +504,12 @@
@SuppressWarnings("unchecked")
public static void clearMaxPath(
- Object maxPathKey
+ String maxPathKey
)
{
if (maxPathKey != null)
{
- // FIXME As of JSF 1.2, the request map is <String, Object>
- Map<Object, Object> sessionMap = FacesContext.getCurrentInstance().getExternalContext().getSessionMap();
+ Map<String, Object> sessionMap = FacesContext.getCurrentInstance().getExternalContext().getSessionMap();
sessionMap.put(maxPathKey, null);
}
}
Modified: myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/SortableModel.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/SortableModel.java?rev=594297&r1=594296&r2=594297&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/SortableModel.java (original)
+++ myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/SortableModel.java Mon Nov 12 13:03:17 2007
@@ -23,10 +23,14 @@
import java.util.Comparator;
import java.util.List;
+import javax.el.ELContext;
+import javax.el.ELResolver;
+import javax.el.FunctionMapper;
+import javax.el.VariableMapper;
+
import javax.faces.FactoryFinder;
import javax.faces.application.ApplicationFactory;
import javax.faces.context.FacesContext;
-import javax.faces.el.PropertyResolver;
import javax.faces.model.DataModel;
import org.apache.myfaces.trinidad.logging.TrinidadLogger;
@@ -150,9 +154,7 @@
Object data = _model.getRowData();
try
{
- PropertyResolver resolver = __getPropertyResolver();
- Object propertyValue = resolver.getValue(data, property);
-
+ Object propertyValue = __resolveProperty(data, property);
// when the value is null, we don't know if we can sort it.
// by default let's support sorting of null values, and let the user
// turn off sorting if necessary:
@@ -250,8 +252,11 @@
// Make sure the model has that row 0! (It could be empty.)
if (_model.isRowAvailable())
{
+ FacesContext context = FacesContext.getCurrentInstance();
+ ELResolver resolver = _getELResolver(context);
+ ELContext elContext = _getELContext(context, resolver);
Comparator<Integer> comp =
- new Comp(__getPropertyResolver(), property);
+ new Comp(resolver, elContext, property);
if (!isAscending)
comp = new Inverter<Integer>(comp);
@@ -334,9 +339,10 @@
private final class Comp implements Comparator<Integer>
{
- public Comp(PropertyResolver resolver, String property)
+ public Comp(ELResolver resolver, ELContext context, String property)
{
_resolver = resolver;
+ _context = context;
_prop = property;
}
@@ -348,11 +354,11 @@
_model.setRowIndex(index1);
Object instance1 = _model.getRowData();
- Object value1 = _resolver.getValue(instance1, _prop);
+ Object value1 = _resolver.getValue(_context, instance1, _prop);
_model.setRowIndex(index2);
Object instance2 = _model.getRowData();
- Object value2 = _resolver.getValue(instance2, _prop);
+ Object value2 = _resolver.getValue(_context, instance2, _prop);
if (value1 == null)
return (value2 == null) ? 0 : -1;
@@ -376,7 +382,8 @@
}
}
- private final PropertyResolver _resolver;
+ private final ELResolver _resolver;
+ private final ELContext _context;
private final String _prop;
}
@@ -395,19 +402,73 @@
private final Comparator<T> _comp;
}
- static PropertyResolver __getPropertyResolver()
+ /**
+ * Quickie implementation of ELContext for use
+ * if we're not being called in the JSF lifecycle
+ */
+ private static final class ELContextImpl extends ELContext
+ {
+ public ELContextImpl(ELResolver resolver)
+ {
+ _resolver = resolver;
+ }
+
+ @Override
+ public ELResolver getELResolver()
+ {
+ return _resolver;
+ }
+
+ @Override
+ public FunctionMapper getFunctionMapper()
+ {
+ // Because we're only really being used to pass
+ // to an ELResolver, no FunctionMapper is needed
+ return null;
+ }
+
+ @Override
+ public VariableMapper getVariableMapper()
+ {
+ // Because we're only really being used to pass
+ // to an ELResolver, no VariableMapper is needed
+ return null;
+ }
+
+ private final ELResolver _resolver;
+ }
+
+ static Object __resolveProperty(Object object, String propertyName)
{
- // First try the FacesContext, which is a faster way to
- // get the PropertyResolver (and the 99.9% scenario)
FacesContext context = FacesContext.getCurrentInstance();
+ ELResolver resolver = _getELResolver(context);
+ ELContext elContext = _getELContext(context, resolver);
+ return resolver.getValue(elContext, object, propertyName);
+ }
+
+ static private ELContext _getELContext(
+ FacesContext context, ELResolver resolver)
+ {
+ // Hopefully, we have a FacesContext. If not, we're
+ // going to have to synthesize one!
+ if (context != null)
+ return context.getELContext();
+
+ return new ELContextImpl(resolver);
+ }
+
+ static private ELResolver _getELResolver(FacesContext context)
+ {
+ // First try the FacesContext, which is a faster way to
+ // get the ELResolver (and the 99.9% scenario)
if (context != null)
- return context.getApplication().getPropertyResolver();
+ return context.getApplication().getELResolver();
// If that fails, then we're likely outside of the JSF lifecycle.
// Look to the ApplicationFactory.
ApplicationFactory factory = (ApplicationFactory)
FactoryFinder.getFactory(FactoryFinder.APPLICATION_FACTORY);
- return factory.getApplication().getPropertyResolver();
+ return factory.getApplication().getELResolver();
}
Modified: myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/XMLMenuModel.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/XMLMenuModel.java?rev=594297&r1=594296&r2=594297&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/XMLMenuModel.java (original)
+++ myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/XMLMenuModel.java Mon Nov 12 13:03:17 2007
@@ -27,10 +27,12 @@
import java.util.List;
import java.util.Map;
+import javax.el.ELContext;
+import javax.el.ELResolver;
+import javax.el.PropertyNotFoundException;
+
+import javax.faces.application.Application;
import javax.faces.context.FacesContext;
-import javax.faces.el.PropertyNotFoundException;
-import javax.faces.el.PropertyResolver;
-import javax.faces.el.ValueBinding;
import javax.faces.webapp.UIComponentTag;
import org.apache.myfaces.trinidad.logging.TrinidadLogger;
@@ -471,14 +473,16 @@
if (node == null)
return null;
- FacesContext context = FacesContext.getCurrentInstance();
- PropertyResolver resolver = context.getApplication().getPropertyResolver();
- String value = null;
+ FacesContext context = FacesContext.getCurrentInstance();
+ ELContext elContext = context.getELContext();
+ ELResolver resolver = elContext.getELResolver();
+ String value = null;
try
{
Map<String, String> propMap =
- (Map<String, String>) resolver.getValue(node, _CUSTOM_ATTR_LIST);
+ (Map<String, String>) resolver.getValue(elContext,
+ node, _CUSTOM_ATTR_LIST);
// Need to check to see if propMap is null. If there are
// no custom properties for this itemNode, there will be
@@ -496,7 +500,7 @@
return null;
}
- // If it is an El expression, we must evaluate it
+ // If it is an EL expression, we must evaluate it
// and return its value
if ( value != null
&& UIComponentTag.isValueReference(value)
@@ -506,9 +510,9 @@
try
{
- FacesContext ctx = FacesContext.getCurrentInstance();
- ValueBinding binding = ctx.getApplication().createValueBinding(value);
- elValue = binding.getValue(ctx);
+ elValue = context.getApplication().evaluateExpressionGet(context,
+ value,
+ Object.class);
}
catch (Exception ex)
{
Modified: myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/skin/SkinAddition.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/skin/SkinAddition.java?rev=594297&r1=594296&r2=594297&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/skin/SkinAddition.java (original)
+++ myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/skin/SkinAddition.java Mon Nov 12 13:03:17 2007
@@ -18,8 +18,14 @@
*/
package org.apache.myfaces.trinidad.skin;
+import java.util.Collections;
+
+import javax.el.ValueExpression;
+
import javax.faces.el.ValueBinding;
+import org.apache.myfaces.trinidad.context.LocaleContext;
+
/**
* SkinAdditions are defined in trinidad-skins.xml file <skin-addition>
* They are used by custom component developers who have created custom
@@ -46,24 +52,26 @@
{
_styleSheetName = styleSheetName;
_resourceBundleName = resourceBundleName;
+ _translationSourceVE = null;
_translationSourceVB = null;
}
/**
- * Constructor takes a styleSheet name and a translationSource ValueBinding.
+ * Constructor takes a styleSheet name and a translationSource ValueExpression.
*/
public SkinAddition (
String styleSheetName,
- ValueBinding translationSourceValueBinding
+ ValueExpression translationSourceValueExpression
)
{
_styleSheetName = styleSheetName;
_resourceBundleName = null;
- _translationSourceVB = translationSourceValueBinding;
+ _translationSourceVE = translationSourceValueExpression;
+ _translationSourceVB = null;
}
/**
* Constructor takes a styleSheet name. resource bundle name and
- * translation source value binding will be null.
+ * translation source value expression will be null.
*/
public SkinAddition (
String styleSheetName
@@ -71,10 +79,27 @@
{
_styleSheetName = styleSheetName;
_resourceBundleName = null;
+ _translationSourceVE = null;
_translationSourceVB = null;
}
/**
+ * Constructor takes a styleSheet name and a translationSource ValueBinding.
+ * @deprecated
+ */
+ @Deprecated
+ public SkinAddition (
+ String styleSheetName,
+ ValueBinding translationSourceValueBinding
+ )
+ {
+ _styleSheetName = styleSheetName;
+ _resourceBundleName = null;
+ _translationSourceVE = null;
+ _translationSourceVB = translationSourceValueBinding;
+ }
+
+ /**
* Gets the SkinAddition's style sheet name.
*/
public String getStyleSheetName()
@@ -85,7 +110,7 @@
/**
* Gets the SkinAddition's resource bundle.
* Note: A skin cannot have both a resourceBundleName and a translation source
- * value binding. If they do, then the resourceBundleName takes precedence.
+ * value expression. If they do, then the resourceBundleName takes precedence.
*/
public String getResourceBundleName()
{
@@ -93,11 +118,24 @@
}
/**
+ * Gets the SkinAddition's translation source ValueExpresion. The
+ * ValueExpression can point to a Map or a ResourceBundle.
+ * Note: A skin cannot have both a resourceBundleName and a translation source
+ * value expression. If they do, then the resourceBundleName takes precedence.
+ */
+ public ValueExpression getTranslationSourceValueExpression()
+ {
+ return _translationSourceVE;
+ }
+
+ /**
* Gets the SkinAddition's translation source ValueBinding. The
* ValueBinding can point to a Map or a ResourceBundle.
* Note: A skin cannot have both a resourceBundleName and a translation source
* value binding. If they do, then the resourceBundleName takes precedence.
+ * @deprecated
*/
+ @Deprecated
public ValueBinding getTranslationSourceValueBinding()
{
return _translationSourceVB;
@@ -105,6 +143,7 @@
private final String _styleSheetName;
private final String _resourceBundleName;
+ private final ValueExpression _translationSourceVE;
private final ValueBinding _translationSourceVB;
}
Modified: myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/util/MessageFactory.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/util/MessageFactory.java?rev=594297&r1=594296&r2=594297&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/util/MessageFactory.java (original)
+++ myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/util/MessageFactory.java Mon Nov 12 13:03:17 2007
@@ -21,7 +21,8 @@
import javax.faces.application.FacesMessage;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
-import javax.faces.el.ValueBinding;
+
+import javax.el.ValueExpression;
import org.apache.myfaces.trinidad.logging.TrinidadLogger;
@@ -413,11 +414,11 @@
for (int i = 0; i < parameters.length; i++)
{
Object o = parameters[i];
- if (o instanceof ValueBinding)
+ if (o instanceof ValueExpression)
{
if (context == null)
context = FacesContext.getCurrentInstance();
- o = ((ValueBinding) o).getValue(context);
+ o = ((ValueExpression) o).getValue(context.getELContext());
}
resolvedParameters[i] = o;
@@ -442,7 +443,7 @@
for (int i = 0; i < parameters.length; i++)
{
- if (parameters[i] instanceof ValueBinding)
+ if (parameters[i] instanceof ValueExpression)
return true;
}
@@ -456,7 +457,7 @@
Object[] parameters)
{
_assertIsValidCustomMessageType(customMessagePattern);
- boolean isCustomMsgValueBound = (customMessagePattern instanceof ValueBinding);
+ boolean isCustomMsgValueBound = (customMessagePattern instanceof ValueExpression);
boolean containsBinding = _containsBinding(parameters);
if (isCustomMsgValueBound || containsBinding)
{
@@ -467,7 +468,7 @@
}
else
{
- ValueBinding customMessage = (ValueBinding)customMessagePattern;
+ ValueExpression customMessage = (ValueExpression)customMessagePattern;
return new CustomDetailErrorMessage(summary, customMessage,
parameters, containsBinding);
}
@@ -489,14 +490,14 @@
{
o = component.getAttributes().get("label");
if (o == null)
- o = component.getValueBinding("label");
+ o = component.getValueExpression ("label");
}
return o;
}
private static void _assertIsValidCustomMessageType(Object customMessagePattern)
{
- if (!(customMessagePattern instanceof ValueBinding ||
+ if (!(customMessagePattern instanceof ValueExpression ||
customMessagePattern instanceof String))
throw new IllegalArgumentException(_LOG.getMessage(
"CUSTOM_MESSAGE_SHOULD_BE_VALUEBINDING_OR_STRING_TYPE"));
@@ -600,7 +601,7 @@
CustomDetailErrorMessage(
String messageFormat,
- ValueBinding customDetailErrorMessage,
+ ValueExpression customDetailErrorMessage,
Object[] parameters,
boolean hasBoundParameters
)
@@ -617,7 +618,7 @@
public String getDetailMessage()
{
FacesContext context = FacesContext.getCurrentInstance();
- String detailMsgPattern = (String)_customDetailErrorMessage.getValue(context);
+ String detailMsgPattern = (String)_customDetailErrorMessage.getValue(context.getELContext());
if(detailMsgPattern == null)
{
// Set a default message that might get used by FacesException
@@ -641,7 +642,7 @@
return _getFormattedString(detailMsgPattern, params);
}
- private ValueBinding _customDetailErrorMessage;
+ private ValueExpression _customDetailErrorMessage;
private boolean _hasBoundParameters;
private static final long serialVersionUID = 1L;
}
Modified: myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/validator/ByteLengthValidator.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/validator/ByteLengthValidator.java?rev=594297&r1=594296&r2=594297&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/validator/ByteLengthValidator.java (original)
+++ myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/validator/ByteLengthValidator.java Mon Nov 12 13:03:17 2007
@@ -22,6 +22,8 @@
import java.nio.charset.IllegalCharsetNameException;
+import javax.el.ValueExpression;
+
import javax.faces.application.FacesMessage;
import javax.faces.component.StateHolder;
import javax.faces.component.UIComponent;
@@ -267,6 +269,43 @@
_isTransient = transientValue;
}
+
+ /**
+ * <p>Set the {@link ValueExpression} used to calculate the value for the
+ * specified attribute if any.</p>
+ *
+ * @param name Name of the attribute for which to set a {@link ValueExpression}
+ * @param expression The {@link ValueExpression} to set, or <code>null</code>
+ * to remove any currently set {@link ValueExpression}
+ *
+ * @exception NullPointerException if <code>name</code>
+ * is <code>null</code>
+ * @exception IllegalArgumentException if <code>name</code> is not a valid
+ * attribute of this converter
+ */
+ public void setValueExpression(String name, ValueExpression expression)
+ {
+ ValidatorUtils.setValueExpression(_facesBean, name, expression) ;
+ }
+
+
+ /**
+ * <p>Return the {@link ValueExpression} used to calculate the value for the
+ * specified attribute name, if any.</p>
+ *
+ * @param name Name of the attribute or property for which to retrieve a
+ * {@link ValueExpression}
+ *
+ * @exception NullPointerException if <code>name</code>
+ * is <code>null</code>
+ * @exception IllegalArgumentException if <code>name</code> is not a valid
+ * attribute of this converter
+ */
+ public ValueExpression getValueExpression(String name)
+ {
+ return ValidatorUtils.getValueExpression(_facesBean, name);
+ }
+
/**
* <p>Set the {@link ValueBinding} used to calculate the value for the
* specified attribute if any.</p>
@@ -279,6 +318,7 @@
* is <code>null</code>
* @exception IllegalArgumentException if <code>name</code> is not a valid
* attribute of this validator
+ * @deprecated
*/
public void setValueBinding(String name, ValueBinding binding)
{
@@ -296,6 +336,7 @@
* is <code>null</code>
* @exception IllegalArgumentException if <code>name</code> is not a valid
* attribute of this validator
+ * @deprecated
*/
public ValueBinding getValueBinding(String name)
{
Modified: myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/validator/DateRestrictionValidator.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/validator/DateRestrictionValidator.java?rev=594297&r1=594296&r2=594297&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/validator/DateRestrictionValidator.java (original)
+++ myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/validator/DateRestrictionValidator.java Mon Nov 12 13:03:17 2007
@@ -27,6 +27,8 @@
import java.util.Set;
import java.util.TimeZone;
+import javax.el.ValueExpression;
+
import javax.faces.application.FacesMessage;
import javax.faces.component.StateHolder;
import javax.faces.component.UIComponent;
@@ -279,6 +281,44 @@
}
// End of StateHolder Methods
+
+ /**
+ * <p>Set the {@link ValueExpression} used to calculate the value for the
+ * specified attribute if any.</p>
+ *
+ * @param name Name of the attribute for which to set a {@link ValueExpression}
+ * @param expression The {@link ValueExpression} to set, or <code>null</code>
+ * to remove any currently set {@link ValueExpression}
+ *
+ * @exception NullPointerException if <code>name</code>
+ * is <code>null</code>
+ * @exception IllegalArgumentException if <code>name</code> is not a valid
+ * attribute of this converter
+ */
+ public void setValueExpression(String name, ValueExpression expression)
+ {
+ ValidatorUtils.setValueExpression(_facesBean, name, expression) ;
+ }
+
+
+ /**
+ * <p>Return the {@link ValueExpression} used to calculate the value for the
+ * specified attribute name, if any.</p>
+ *
+ * @param name Name of the attribute or property for which to retrieve a
+ * {@link ValueExpression}
+ *
+ * @exception NullPointerException if <code>name</code>
+ * is <code>null</code>
+ * @exception IllegalArgumentException if <code>name</code> is not a valid
+ * attribute of this converter
+ */
+ public ValueExpression getValueExpression(String name)
+ {
+ return ValidatorUtils.getValueExpression(_facesBean, name);
+ }
+
+
/**
* <p>Set the {@link ValueBinding} used to calculate the value for the
* specified attribute if any.</p>
@@ -291,6 +331,7 @@
* is <code>null</code>
* @exception IllegalArgumentException if <code>name</code> is not a valid
* attribute of this validator
+ * @deprecated
*/
public void setValueBinding(String name, ValueBinding binding)
{
@@ -308,6 +349,7 @@
* is <code>null</code>
* @exception IllegalArgumentException if <code>name</code> is not a valid
* attribute of this validator
+ * @deprecated
*/
public ValueBinding getValueBinding(String name)
{
Modified: myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/validator/DateTimeRangeValidator.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/validator/DateTimeRangeValidator.java?rev=594297&r1=594296&r2=594297&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/validator/DateTimeRangeValidator.java (original)
+++ myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/validator/DateTimeRangeValidator.java Mon Nov 12 13:03:17 2007
@@ -20,6 +20,8 @@
import java.util.Date;
+import javax.el.ValueExpression;
+
import javax.faces.application.FacesMessage;
import javax.faces.component.StateHolder;
import javax.faces.component.UIComponent;
@@ -401,6 +403,44 @@
_facesBean.restoreState(context, state);
}
+
+ /**
+ * <p>Set the {@link ValueExpression} used to calculate the value for the
+ * specified attribute if any.</p>
+ *
+ * @param name Name of the attribute for which to set a {@link ValueExpression}
+ * @param expression The {@link ValueExpression} to set, or <code>null</code>
+ * to remove any currently set {@link ValueExpression}
+ *
+ * @exception NullPointerException if <code>name</code>
+ * is <code>null</code>
+ * @exception IllegalArgumentException if <code>name</code> is not a valid
+ * attribute of this converter
+ */
+ public void setValueExpression(String name, ValueExpression expression)
+ {
+ ValidatorUtils.setValueExpression(_facesBean, name, expression) ;
+ }
+
+
+ /**
+ * <p>Return the {@link ValueExpression} used to calculate the value for the
+ * specified attribute name, if any.</p>
+ *
+ * @param name Name of the attribute or property for which to retrieve a
+ * {@link ValueExpression}
+ *
+ * @exception NullPointerException if <code>name</code>
+ * is <code>null</code>
+ * @exception IllegalArgumentException if <code>name</code> is not a valid
+ * attribute of this converter
+ */
+ public ValueExpression getValueExpression(String name)
+ {
+ return ValidatorUtils.getValueExpression(_facesBean, name);
+ }
+
+
/**
* <p>Set the {@link ValueBinding} used to calculate the value for the
* specified attribute if any.</p>
@@ -413,6 +453,7 @@
* is <code>null</code>
* @exception IllegalArgumentException if <code>name</code> is not a valid
* attribute of this validator
+ * @deprecated
*/
public void setValueBinding(String name, ValueBinding binding)
{
@@ -430,6 +471,7 @@
* is <code>null</code>
* @exception IllegalArgumentException if <code>name</code> is not a valid
* attribute of this validator
+ * @deprecated
*/
public ValueBinding getValueBinding(String name)
{
Modified: myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/validator/DoubleRangeValidator.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/validator/DoubleRangeValidator.java?rev=594297&r1=594296&r2=594297&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/validator/DoubleRangeValidator.java (original)
+++ myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/validator/DoubleRangeValidator.java Mon Nov 12 13:03:17 2007
@@ -18,6 +18,8 @@
*/
package org.apache.myfaces.trinidad.validator;
+import javax.el.ValueExpression;
+
import javax.faces.application.FacesMessage;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
@@ -367,6 +369,43 @@
}
/**
+ * <p>Set the {@link ValueExpression} used to calculate the value for the
+ * specified attribute if any.</p>
+ *
+ * @param name Name of the attribute for which to set a {@link ValueExpression}
+ * @param expression The {@link ValueExpression} to set, or <code>null</code>
+ * to remove any currently set {@link ValueExpression}
+ *
+ * @exception NullPointerException if <code>name</code>
+ * is <code>null</code>
+ * @exception IllegalArgumentException if <code>name</code> is not a valid
+ * attribute of this converter
+ */
+ public void setValueExpression(String name, ValueExpression expression)
+ {
+ ValidatorUtils.setValueExpression(_facesBean, name, expression) ;
+ }
+
+
+ /**
+ * <p>Return the {@link ValueExpression} used to calculate the value for the
+ * specified attribute name, if any.</p>
+ *
+ * @param name Name of the attribute or property for which to retrieve a
+ * {@link ValueExpression}
+ *
+ * @exception NullPointerException if <code>name</code>
+ * is <code>null</code>
+ * @exception IllegalArgumentException if <code>name</code> is not a valid
+ * attribute of this converter
+ */
+ public ValueExpression getValueExpression(String name)
+ {
+ return ValidatorUtils.getValueExpression(_facesBean, name);
+ }
+
+
+ /**
* <p>Set the {@link ValueBinding} used to calculate the value for the
* specified attribute if any.</p>
*
@@ -378,6 +417,7 @@
* is <code>null</code>
* @exception IllegalArgumentException if <code>name</code> is not a valid
* attribute of this validator
+ * @deprecated
*/
public void setValueBinding(String name, ValueBinding binding)
{
@@ -395,6 +435,7 @@
* is <code>null</code>
* @exception IllegalArgumentException if <code>name</code> is not a valid
* attribute of this validator
+ * @deprecated
*/
public ValueBinding getValueBinding(String name)
{
Modified: myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/validator/LengthValidator.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/validator/LengthValidator.java?rev=594297&r1=594296&r2=594297&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/validator/LengthValidator.java (original)
+++ myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/validator/LengthValidator.java Mon Nov 12 13:03:17 2007
@@ -18,6 +18,8 @@
*/
package org.apache.myfaces.trinidad.validator;
+import javax.el.ValueExpression;
+
import javax.faces.application.FacesMessage;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
@@ -418,6 +420,43 @@
}
/**
+ * <p>Set the {@link ValueExpression} used to calculate the value for the
+ * specified attribute if any.</p>
+ *
+ * @param name Name of the attribute for which to set a {@link ValueExpression}
+ * @param expression The {@link ValueExpression} to set, or <code>null</code>
+ * to remove any currently set {@link ValueExpression}
+ *
+ * @exception NullPointerException if <code>name</code>
+ * is <code>null</code>
+ * @exception IllegalArgumentException if <code>name</code> is not a valid
+ * attribute of this converter
+ */
+ public void setValueExpression(String name, ValueExpression expression)
+ {
+ ValidatorUtils.setValueExpression(_facesBean, name, expression) ;
+ }
+
+
+ /**
+ * <p>Return the {@link ValueExpression} used to calculate the value for the
+ * specified attribute name, if any.</p>
+ *
+ * @param name Name of the attribute or property for which to retrieve a
+ * {@link ValueExpression}
+ *
+ * @exception NullPointerException if <code>name</code>
+ * is <code>null</code>
+ * @exception IllegalArgumentException if <code>name</code> is not a valid
+ * attribute of this converter
+ */
+ public ValueExpression getValueExpression(String name)
+ {
+ return ValidatorUtils.getValueExpression(_facesBean, name);
+ }
+
+
+ /**
* <p>Set the {@link ValueBinding} used to calculate the value for the
* specified attribute if any.</p>
*
@@ -429,6 +468,7 @@
* is <code>null</code>
* @exception IllegalArgumentException if <code>name</code> is not a valid
* attribute of this validator
+ * @deprecated
*/
public void setValueBinding(String name, ValueBinding binding)
{
@@ -446,6 +486,7 @@
* is <code>null</code>
* @exception IllegalArgumentException if <code>name</code> is not a valid
* attribute of this validator
+ * @deprecated
*/
public ValueBinding getValueBinding(String name)
{
Modified: myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/validator/LongRangeValidator.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/validator/LongRangeValidator.java?rev=594297&r1=594296&r2=594297&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/validator/LongRangeValidator.java (original)
+++ myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/validator/LongRangeValidator.java Mon Nov 12 13:03:17 2007
@@ -18,11 +18,14 @@
*/
package org.apache.myfaces.trinidad.validator;
+import javax.el.ValueExpression;
+
import javax.faces.application.FacesMessage;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.el.ValueBinding;
+
import javax.faces.validator.Validator;
import javax.faces.validator.ValidatorException;
@@ -369,6 +372,43 @@
}
/**
+ * <p>Set the {@link ValueExpression} used to calculate the value for the
+ * specified attribute if any.</p>
+ *
+ * @param name Name of the attribute for which to set a {@link ValueExpression}
+ * @param expression The {@link ValueExpression} to set, or <code>null</code>
+ * to remove any currently set {@link ValueExpression}
+ *
+ * @exception NullPointerException if <code>name</code>
+ * is <code>null</code>
+ * @exception IllegalArgumentException if <code>name</code> is not a valid
+ * attribute of this converter
+ */
+ public void setValueExpression(String name, ValueExpression expression)
+ {
+ ValidatorUtils.setValueExpression(_facesBean, name, expression) ;
+ }
+
+
+ /**
+ * <p>Return the {@link ValueExpression} used to calculate the value for the
+ * specified attribute name, if any.</p>
+ *
+ * @param name Name of the attribute or property for which to retrieve a
+ * {@link ValueExpression}
+ *
+ * @exception NullPointerException if <code>name</code>
+ * is <code>null</code>
+ * @exception IllegalArgumentException if <code>name</code> is not a valid
+ * attribute of this converter
+ */
+ public ValueExpression getValueExpression(String name)
+ {
+ return ValidatorUtils.getValueExpression(_facesBean, name);
+ }
+
+
+ /**
* <p>Set the {@link ValueBinding} used to calculate the value for the
* specified attribute if any.</p>
*
@@ -380,6 +420,7 @@
* is <code>null</code>
* @exception IllegalArgumentException if <code>name</code> is not a valid
* attribute of this validator
+ * @deprecated
*/
public void setValueBinding(String name, ValueBinding binding)
{
@@ -397,6 +438,7 @@
* is <code>null</code>
* @exception IllegalArgumentException if <code>name</code> is not a valid
* attribute of this validator
+ * @deprecated
*/
public ValueBinding getValueBinding(String name)
{
Modified: myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/validator/RegExpValidator.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/validator/RegExpValidator.java?rev=594297&r1=594296&r2=594297&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/validator/RegExpValidator.java (original)
+++ myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/validator/RegExpValidator.java Mon Nov 12 13:03:17 2007
@@ -22,6 +22,8 @@
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
+import javax.el.ValueExpression;
+
import javax.faces.application.FacesMessage;
import javax.faces.component.StateHolder;
import javax.faces.component.UIComponent;
@@ -169,6 +171,44 @@
_facesBean.restoreState(context, state);
}
+
+ /**
+ * <p>Set the {@link ValueExpression} used to calculate the value for the
+ * specified attribute if any.</p>
+ *
+ * @param name Name of the attribute for which to set a {@link ValueExpression}
+ * @param expression The {@link ValueExpression} to set, or <code>null</code>
+ * to remove any currently set {@link ValueExpression}
+ *
+ * @exception NullPointerException if <code>name</code>
+ * is <code>null</code>
+ * @exception IllegalArgumentException if <code>name</code> is not a valid
+ * attribute of this converter
+ */
+ public void setValueExpression(String name, ValueExpression expression)
+ {
+ ValidatorUtils.setValueExpression(_facesBean, name, expression) ;
+ }
+
+
+ /**
+ * <p>Return the {@link ValueExpression} used to calculate the value for the
+ * specified attribute name, if any.</p>
+ *
+ * @param name Name of the attribute or property for which to retrieve a
+ * {@link ValueExpression}
+ *
+ * @exception NullPointerException if <code>name</code>
+ * is <code>null</code>
+ * @exception IllegalArgumentException if <code>name</code> is not a valid
+ * attribute of this converter
+ */
+ public ValueExpression getValueExpression(String name)
+ {
+ return ValidatorUtils.getValueExpression(_facesBean, name);
+ }
+
+
/**
* <p>Set the {@link ValueBinding} used to calculate the value for the
* specified attribute if any.</p>
@@ -181,6 +221,7 @@
* is <code>null</code>
* @exception IllegalArgumentException if <code>name</code> is not a valid
* attribute of this validator
+ * @deprecated
*/
public void setValueBinding(String name, ValueBinding binding)
{
@@ -198,6 +239,7 @@
* is <code>null</code>
* @exception IllegalArgumentException if <code>name</code> is not a valid
* attribute of this validator
+ * @deprecated
*/
public ValueBinding getValueBinding(String name)
{
Modified: myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/validator/ValidatorUtils.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/validator/ValidatorUtils.java?rev=594297&r1=594296&r2=594297&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/validator/ValidatorUtils.java (original)
+++ myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/validator/ValidatorUtils.java Mon Nov 12 13:03:17 2007
@@ -17,6 +17,9 @@
* under the License.
*/
package org.apache.myfaces.trinidad.validator;
+
+import javax.el.ValueExpression;
+
import javax.faces.component.UIComponent;
import javax.faces.el.ValueBinding;
@@ -72,6 +75,18 @@
return bean;
}
+ static void setValueExpression(FacesBean bean, String name, ValueExpression expression)
+ {
+ PropertyKey key = _getPropertyKey(bean, name, true);
+ bean.setValueExpression(key, expression);
+ }
+
+ static ValueExpression getValueExpression(FacesBean bean, String name)
+ {
+ PropertyKey key = _getPropertyKey(bean, name, true);
+ return bean.getValueExpression(key);
+ }
+
static void setValueBinding(FacesBean bean, String name, ValueBinding binding)
{
PropertyKey key = _getPropertyKey(bean, name, true);
Modified: myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/webapp/UIXComponentTag.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/webapp/UIXComponentTag.java?rev=594297&r1=594296&r2=594297&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/webapp/UIXComponentTag.java (original)
+++ myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/webapp/UIXComponentTag.java Mon Nov 12 13:03:17 2007
@@ -26,6 +26,8 @@
import java.util.Date;
import java.util.Iterator;
+import javax.el.MethodExpression;
+
import javax.faces.component.UIComponent;
import javax.faces.component.UIViewRoot;
import javax.faces.context.FacesContext;
@@ -142,10 +144,14 @@
if (_attributeChangeListener != null)
{
- MethodBinding mb =
- createMethodBinding(_attributeChangeListener,
- new Class[]{AttributeChangeEvent.class});
- uixComponent.setAttributeChangeListener(mb);
+ MethodExpression me = getFacesContext().getApplication().
+ getExpressionFactory().createMethodExpression(
+ getFacesContext().getELContext(),
+ _attributeChangeListener,
+ null,
+ new Class[]{AttributeChangeEvent.class});
+
+ uixComponent.setAttributeChangeListener(me);
}
Modified: myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/site/xdoc/tagdoc/tr_forEach.xml
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/site/xdoc/tagdoc/tr_forEach.xml?rev=594297&r1=594296&r2=594297&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/site/xdoc/tagdoc/tr_forEach.xml (original)
+++ myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/site/xdoc/tagdoc/tr_forEach.xml Mon Nov 12 13:03:17 2007
@@ -25,34 +25,17 @@
<br/>
<p>
The forEach tag is a replacement for the JSTL
-<c:forEach> tag that works with ADF Faces components. In JSF
-1.1, <c:forEach> cannot be used with any JSF components or tags.
+<c:forEach> tag. Though as of JSF 1.2/JSP 2.1/JSTL 1.2,
+<c:forEach> can be used with any JSF components or tags,
+it does not support "varStatus". This tag adds support for varStatus
+(other than "current" which is not supported).
(<b>Note</b>: this tag is not supported in Facelets, because c:forEach
-is functional in Facelets. It will also be removed in JSF 1.2/JSP
-2.1, because c:forEach will become functional there too.) This tag
-brings that functionality to JSF, but it is limited to ADF Faces tags.
-This tag also has several limitations not found in <c:forEach>:
-
-<ul>
-
-<li><tr:forEach> does not currently support scenarios where the
-size of the "items" list or array changes from one request to the
-next. It may be possible to work around this in specific scenarios by
-manually deleting all children of the parent component
-(<tr:selectOneListbox> in the above example), but this has not
-yet been tested.</li>
-
-<li><tr:forEach> does not support arbitrary
+is fully functional in Facelets.) Unlike the old Trinidad tr:forEach
+built with JSF 1.1, however, this tag can be used with any JSP 2.1-based
+tag, JSF or non-JSF. This tag also has a limitation not found in <c:forEach>: <tr:forEach> does not currently support arbitrary
java.util.Collections; it can only iterate over java.util.Lists or
-arrays.</li>
-
-<li><tr:forEach> executes at the time the JSP tag executes. So
-it does not have access to any EL variables that are created by JSF
-components. For example, the <tr:table> creates an EL variable
-using the value of the "var" attribute. However, this EL variable is
-not available to <tr:forEach></li>
-
-</ul></p><h4>Example:</h4><source>
+arrays.</p>
+<h4>Example:</h4><source>
<tr:selectOneListbox value="#{someValue}">
<tr:forEach var="item" items="#{model.listOfItems}">
<tr:selectItem value="#{item.value}" text="#{item.text}"/>
@@ -105,7 +88,7 @@
<td>varStatus</td><td>String</td><td>No</td><td>
name of the loop status exposed when iterating. The properties
- 'index','count','begin','end','step','current','first','last'
+ 'index','count','begin','end','step','first','last'
are available through this
</td>
</tr>
Modified: myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/test/java/org/apache/myfaces/trinidad/bean/FacesBeanImplTest.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/test/java/org/apache/myfaces/trinidad/bean/FacesBeanImplTest.java?rev=594297&r1=594296&r2=594297&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/test/java/org/apache/myfaces/trinidad/bean/FacesBeanImplTest.java (original)
+++ myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/test/java/org/apache/myfaces/trinidad/bean/FacesBeanImplTest.java Mon Nov 12 13:03:17 2007
@@ -34,7 +34,9 @@
import junit.framework.TestCase;
import junit.framework.TestSuite;
-public class FacesBeanImplTest extends TestCase
+import org.apache.myfaces.trinidadbuild.test.FacesTestCase;
+
+public class FacesBeanImplTest extends FacesTestCase
{
public static final Test suite()
{
@@ -53,13 +55,15 @@
}
@Override
- public void setUp()
+ protected void setUp() throws Exception
{
+ super.setUp();
}
@Override
- public void tearDown()
+ protected void tearDown() throws Exception
{
+ super.tearDown();
}
public void testInitialValues()
Modified: myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/test/java/org/apache/myfaces/trinidad/bean/TestValueBinding.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/test/java/org/apache/myfaces/trinidad/bean/TestValueBinding.java?rev=594297&r1=594296&r2=594297&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/test/java/org/apache/myfaces/trinidad/bean/TestValueBinding.java (original)
+++ myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/test/java/org/apache/myfaces/trinidad/bean/TestValueBinding.java Mon Nov 12 13:03:17 2007
@@ -22,7 +22,13 @@
import javax.faces.context.FacesContext;
import javax.faces.el.ValueBinding;
-public class TestValueBinding extends ValueBinding implements StateHolder
+import java.io.Serializable;
+
+// =-=AdamWiner FIXME We shouldn't have to implement Serializable
+// on ValueBindings - FacesBeanImpl is not handling ValueExpressions
+// around non-serializable ValueBindings
+public class TestValueBinding extends ValueBinding implements StateHolder,
+ Serializable
{
public TestValueBinding()
{
Modified: myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/test/java/org/apache/myfaces/trinidad/component/AttributeChangeTester.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/test/java/org/apache/myfaces/trinidad/component/AttributeChangeTester.java?rev=594297&r1=594296&r2=594297&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/test/java/org/apache/myfaces/trinidad/component/AttributeChangeTester.java (original)
+++ myfaces/trinidad/branches/1.2.4-branch/trinidad-api/src/test/java/org/apache/myfaces/trinidad/component/AttributeChangeTester.java Mon Nov 12 13:03:17 2007
@@ -18,8 +18,9 @@
*/
package org.apache.myfaces.trinidad.component;
-import javax.faces.context.FacesContext;
-import javax.faces.el.MethodBinding;
+import javax.el.ELContext;
+import javax.el.MethodExpression;
+import javax.el.MethodInfo;
import org.apache.myfaces.trinidad.event.AttributeChangeEvent;
import org.apache.myfaces.trinidad.event.AttributeChangeListener;
@@ -27,7 +28,7 @@
/**
* Utility class for testing out AttributeChange events.
*/
-public class AttributeChangeTester extends MethodBinding
+public class AttributeChangeTester extends MethodExpression
implements AttributeChangeListener
{
public AttributeChangeTester()
@@ -41,8 +42,13 @@
_listenerCalled = true;
}
+ public MethodInfo getMethodInfo(ELContext context)
+ {
+ return null;
+ }
+
@Override
- public Object invoke(FacesContext context, Object params[])
+ public Object invoke(ELContext context, Object params[])
{
if (params.length != 1)
throw new IllegalStateException("Params not of length 1");
@@ -55,10 +61,24 @@
return null;
}
- @Override
- public Class<?> getType(FacesContext context)
+ public String getExpressionString()
{
return null;
+ }
+
+ public boolean isLiteralText()
+ {
+ return false;
+ }
+
+ public int hashCode()
+ {
+ return 0;
+ }
+
+ public boolean equals(Object o)
+ {
+ return o == this;
}
public void verify()