You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by aw...@apache.org on 2007/07/03 22:51:35 UTC
svn commit: r552975 [8/41] - in /myfaces/trinidad/branches/pre-1.2.2-branch:
plugins/ 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/apach...
Modified: myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/ComponentDefTag.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/ComponentDefTag.java?view=diff&rev=552975&r1=552974&r2=552975
==============================================================================
--- myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/ComponentDefTag.java (original)
+++ myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/ComponentDefTag.java Tue Jul 3 13:51:23 2007
@@ -26,7 +26,7 @@
import javax.servlet.jsp.JspException;
import org.apache.myfaces.trinidadinternal.taglib.util.TagUtils;
-import javax.faces.webapp.UIComponentTag;
+import javax.faces.webapp.UIComponentClassicTagBase;
import org.apache.myfaces.trinidad.logging.TrinidadLogger;
public class ComponentDefTag extends TagSupport
@@ -45,7 +45,7 @@
@Override
public int doStartTag() throws JspException
{
- UIComponentTag tag = UIComponentTag.getParentUIComponentTag(pageContext);
+ UIComponentClassicTagBase tag = UIComponentClassicTagBase.getParentUIComponentClassicTagBase(pageContext);
if (tag == null)
{
throw new JspException(_LOG.getMessage(
@@ -64,10 +64,6 @@
if (_var != null)
{
- if (TagUtils.isValueReference(_var))
- throw new JspException(_LOG.getMessage(
- "COMPONENTDEF_NOT_SUPPORT_EL"));
-
((UIXComponentRef) component).setVar(_var);
}
}
Modified: myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/ComponentRefTag.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/ComponentRefTag.java?view=diff&rev=552975&r1=552974&r2=552975
==============================================================================
--- myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/ComponentRefTag.java (original)
+++ myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/ComponentRefTag.java Tue Jul 3 13:51:23 2007
@@ -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: myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/FacetRefTag.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/FacetRefTag.java?view=diff&rev=552975&r1=552974&r2=552975
==============================================================================
--- myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/FacetRefTag.java (original)
+++ myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/FacetRefTag.java Tue Jul 3 13:51:23 2007
@@ -20,7 +20,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;
@@ -49,7 +49,7 @@
@Override
public int doStartTag() throws JspException
{
- UIComponentTag tag = UIComponentTag.getParentUIComponentTag(pageContext);
+ UIComponentClassicTagBase tag = UIComponentClassicTagBase.getParentUIComponentClassicTagBase(pageContext);
if (tag == null)
{
_LOG.warning("FACETREF_MUST_INSIDE_UICOMPONENT");
Modified: myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/ForEachTag.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/ForEachTag.java?view=diff&rev=552975&r1=552974&r2=552975
==============================================================================
--- myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/ForEachTag.java (original)
+++ myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/ForEachTag.java Tue Jul 3 13:51:23 2007
@@ -18,24 +18,27 @@
*/
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;
-import org.apache.myfaces.trinidadinternal.el.Tokenizer;
-import org.apache.myfaces.trinidadinternal.el.Tokenizer.Token;
//JSTL Core Library - <c:forEach> Tag
//===================================
@@ -58,47 +61,38 @@
/**
*
*/
-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(_LOG.getMessage(
"MUST_BE_SIMPLE_JSF_EL_EXPRESSION"));
_items = items;
}
- public void setBegin(String begin)
+ public void setBegin(ValueExpression begin)
{
- _begin = begin;
+ _beginVE = begin;
}
- public void setEnd(String end)
+ public void setEnd(ValueExpression end)
{
- _end = end;
+ _endVE = end;
}
- public void setStep(String step)
+ public void setStep(ValueExpression step)
{
- _step = step;
+ _stepVE = step;
}
public void setVar(String var)
{
- if (UIComponentTag.isValueReference(var))
- throw new IllegalArgumentException(_LOG.getMessage(
- "VAR_CANNOT_BE_EXPRESSION"));
-
_var = var;
}
public void setVarStatus(String varStatus)
{
- if (UIComponentTag.isValueReference(varStatus))
- throw new IllegalArgumentException(_LOG.getMessage(
- "VARSTATUS_CANNOT_BE_EXPRESSION"));
-
_varStatus = varStatus;
}
@@ -108,13 +102,20 @@
_validateAttributes();
FacesContext context = FacesContext.getCurrentInstance();
- _parentELContext = (ELContextTag)
- findAncestorWithClass(this, ELContextTag.class);
- _currentBegin = _resolveInteger(context, _begin, 0);
+ _currentBegin = (_begin == null) ? 0 : _begin.intValue();
+ _isFirst = true;
int length;
+
if (null != _items)
{
- Object items = _resolveObject(context, _items);
+ // AdamWiner: for reasons I cannot yet explain, using the JSP's
+ // ELContext is giving me big problems trying to grab Lists
+ // from inside of managed beans. Switching this one call
+ // to the JSF ELContext seems to resolve that. We certainly
+ // have to use the JSPs ELResolver for calling through
+ // to the VariableMapper
+ Object items = _items.getValue(context.getELContext());//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)
@@ -123,6 +124,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)
@@ -146,7 +149,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.
@@ -155,35 +159,37 @@
}
else
{
- _currentEnd = _resolveInteger(context, _end, 0);
+ _currentEnd = (_end == null) ? 0 : _end.intValue();
}
_currentIndex = _currentBegin;
- _currentStep = _resolveInteger(context, _step, 1);
+ _currentCount = 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.
+ _isLast = _currentIndex == _currentEnd;
+
+ // 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", Integer.valueOf(_currentBegin));
_propertyReplacementMap.put("end", Integer.valueOf(_currentEnd));
_propertyReplacementMap.put("step", Integer.valueOf(_currentStep));
_propertyReplacementMap.put("count", Integer.valueOf(_currentCount));
_propertyReplacementMap.put("index", Integer.valueOf(_currentIndex));
- _propertyReplacementMap.put("current", _varReplacement);
+ // FIXME: Can we support "current" efficiently?
+ // _propertyReplacementMap.put("current", _varReplacement);
_propertyReplacementMap.put(
"first",
(_isFirst)? Boolean.TRUE:Boolean.FALSE);
@@ -197,6 +203,10 @@
_LOG.finer("Iterating from " + _currentIndex + " to " + _currentEnd +
" by " + _currentStep);
}
+
+ // Update the variables
+ _updateVars();
+
return EVAL_BODY_INCLUDE;
}
@@ -204,103 +214,49 @@
public int doAfterBody()
{
_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 + "]";
- }
+ _currentCount += 1;
//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)
+ if (_isFirst)
{
- _propertyReplacementMap.put(
- "first",
- (_isFirst)? Boolean.TRUE:Boolean.FALSE);
+ _propertyReplacementMap.put("first", Boolean.FALSE);
+ _isFirst = false;
}
+
+ _isLast = (_currentIndex == _currentEnd);
if (_isLast)
{
- _propertyReplacementMap.put(
- "last",
- (_isLast)? Boolean.TRUE:Boolean.FALSE);
+ _propertyReplacementMap.put("last", _isLast);
}
_propertyReplacementMap.put("count", Integer.valueOf(_currentCount));
_propertyReplacementMap.put("index", Integer.valueOf(_currentIndex));
- _propertyReplacementMap.put("current", _varReplacement);
+ // 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);
-
- if (_parentELContext != null)
- transformedExp = _parentELContext.transformExpression(transformedExp);
- }
+ // Restore EL state
+ VariableMapper vm =
+ pageContext.getELContext().getVariableMapper();
+ if (_var != null)
+ vm.setVariable(_var, _previousDeferredVar);
+ if (_varStatus != null)
+ vm.setVariable(_varStatus, _previousDeferredVarStatus);
- 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.
*/
@@ -308,29 +264,85 @@
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;
+ _propertyReplacementMap = null;
+ _previousDeferredVar = null;
+ _previousDeferredVarStatus = null;
}
- protected ValueBinding createValueBinding(
+ // Push new values into the VariableMapper and the pageContext
+ private void _updateVars()
+ {
+ VariableMapper vm =
+ pageContext.getELContext().getVariableMapper();
+ if (_var != null)
+ {
+ // Catch programmer error where _var has been set but
+ // _items has not
+ if (_items != null)
+ {
+ ValueExpression iterated = new IndexedValueExpression(_items,
+ _currentIndex);
+ vm.setVariable(_var, iterated);
+ }
+
+ // Ditto (though, technically, one check for
+ // _items is sufficient, because if _items evaluated
+ // to null, we'd skip the whole loop)
+ Object items = _itemsValue;
+ if (items != null)
+ {
+ Object item;
+ if (items instanceof List)
+ item = ((List) items).get(_currentIndex);
+ else
+ item = Array.get(items, _currentIndex);
+
+ pageContext.setAttribute(_var, item);
+ }
+ }
+
+ if (_varStatus != null)
+ {
+ pageContext.setAttribute(_varStatus, _propertyReplacementMap);
+ ValueExpression constant = new Constants(
+ new HashMap(_propertyReplacementMap));
+ vm.setVariable(_varStatus, constant);
+ }
+ }
+
+ private Integer _evaluateInteger(
FacesContext context,
- String expression)
+ ValueExpression ve)
{
- if (_parentELContext != null)
- expression = _parentELContext.transformExpression(expression);
+ if (ve == null)
+ return null;
+
+ Object val = ve.getValue(context.getELContext());
+ if (val instanceof Integer)
+ return (Integer) val;
+ else if (val instanceof Number)
+ return Integer.valueOf(((Number) val).intValue());
- return context.getApplication().createValueBinding(expression);
+ return null;
}
private void _validateAttributes() throws JspTagException
{
+ // Evaluate these three ValueExpressions into integers
+ // For why we use FacesContext instead of PageContext, see
+ // above (the evaluation of _items)
+ FacesContext context = FacesContext.getCurrentInstance();
+ _end = _evaluateInteger(context, _endVE);
+ _begin = _evaluateInteger(context, _beginVE);
+ _step = _evaluateInteger(context, _stepVE);
+
if (null == _items)
{
if (null == _begin || null == _end)
@@ -344,7 +356,7 @@
_var.equals(_varStatus))
{
throw new JspTagException(
- "'var' and 'varStatus' should not have same value");
+ "'var' and 'varStatus' should not have the same value");
}
}
@@ -355,154 +367,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;
@@ -512,18 +432,28 @@
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 ValueExpression _beginVE;
+ private ValueExpression _endVE;
+ private ValueExpression _stepVE;
+
+ 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: myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/UIXCollectionTag.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/UIXCollectionTag.java?view=diff&rev=552975&r1=552974&r2=552975
==============================================================================
--- myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/UIXCollectionTag.java (original)
+++ myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/UIXCollectionTag.java Tue Jul 3 13:51:23 2007
@@ -1,58 +1,60 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.myfaces.trinidadinternal.taglib;
-
-import org.apache.myfaces.trinidad.bean.FacesBean;
-import org.apache.myfaces.trinidad.component.UIXCollection;
-import org.apache.myfaces.trinidad.webapp.UIXComponentTag;
-
-/**
- * Manually written because we don't auto-generate UIXCollection,
- * and we can't currently auto-generate only one of the two.
- */
-abstract public class UIXCollectionTag extends UIXComponentTag
-{
- /**
- * Construct an instance of the UIXCollectionTag.
- */
- public UIXCollectionTag()
- {
- }
-
- private String _var;
- public void setVar(String var)
- {
- _var = var;
- }
-
- @Override
- protected void setProperties(
- FacesBean bean)
- {
- super.setProperties(bean);
- setProperty(bean, UIXCollection.VAR_KEY, _var);
- }
-
- @Override
- public void release()
- {
- super.release();
- _var = null;
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.trinidadinternal.taglib;
+
+import org.apache.myfaces.trinidad.bean.FacesBean;
+import org.apache.myfaces.trinidad.component.UIXCollection;
+import org.apache.myfaces.trinidad.webapp.UIXComponentELTag;
+
+/**
+ * Manually written because we don't auto-generate UIXCollection,
+ * and we can't currently auto-generate only one of the two.
+ */
+abstract public class UIXCollectionTag extends UIXComponentELTag
+{
+ /**
+ * Construct an instance of the UIXCollectionTag.
+ */
+ public UIXCollectionTag()
+ {
+ }
+
+ private String _var;
+ public void setVar(String var)
+ {
+ _var = var;
+ }
+
+ @Override
+ protected void setProperties(
+ FacesBean bean)
+ {
+ super.setProperties(bean);
+ bean.setProperty(UIXCollection.VAR_KEY, _var);
+ }
+
+ @Override
+ public void release()
+ {
+ super.release();
+ _var = null;
+ }
+}
+
+
Modified: myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/convert/ConvertIntegerTag.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/convert/ConvertIntegerTag.java?view=diff&rev=552975&r1=552974&r2=552975
==============================================================================
--- myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/convert/ConvertIntegerTag.java (original)
+++ myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/convert/ConvertIntegerTag.java Tue Jul 3 13:51:23 2007
@@ -18,8 +18,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;
@@ -28,28 +30,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: myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/FileDownloadActionListener.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/FileDownloadActionListener.java?view=diff&rev=552975&r1=552974&r2=552975
==============================================================================
--- myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/FileDownloadActionListener.java (original)
+++ myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/FileDownloadActionListener.java Tue Jul 3 13:51:23 2007
@@ -22,10 +22,11 @@
import java.io.IOException;
import java.io.OutputStream;
+import javax.el.MethodExpression;
+import javax.el.ValueExpression;
+
import javax.faces.component.StateHolder;
import javax.faces.context.FacesContext;
-import javax.faces.el.MethodBinding;
-import javax.faces.el.ValueBinding;
import javax.faces.event.ActionEvent;
import javax.faces.event.ActionListener;
@@ -50,13 +51,13 @@
static public final FacesBean.Type TYPE = new FacesBean.Type();
static public final PropertyKey FILENAME_KEY =
TYPE.registerKey("filename");
- // Must be a ValueBinding
+ // Must be a ValueExpression
static public final PropertyKey CONTENT_TYPE_KEY =
TYPE.registerKey("contentType");
static public final PropertyKey METHOD_KEY =
TYPE.registerKey("method",
- MethodBinding.class,
- PropertyKey.CAP_NOT_BOUND | PropertyKey.CAP_STATE_HOLDER);
+ MethodExpression.class,
+ PropertyKey.CAP_NOT_BOUND);
static
{
@@ -90,11 +91,11 @@
// TODO: what about non-ASCII characters in the filename?
hsr.setHeader("Content-Disposition",
"attachment; filename=" + filename);
- MethodBinding method = getMethod();
+ MethodExpression method = getMethod();
OutputStream out = new BufferedOutputStream(hsr.getOutputStream());
try
{
- method.invoke(context, new Object[]{context, out});
+ method.invoke(context.getELContext(), new Object[]{context, out});
}
finally
{
@@ -111,12 +112,12 @@
context.responseComplete();
}
- public MethodBinding getMethod()
+ public MethodExpression getMethod()
{
- return (MethodBinding) getProperty(METHOD_KEY);
+ return (MethodExpression) getProperty(METHOD_KEY);
}
- public void setMethod(MethodBinding method)
+ public void setMethod(MethodExpression method)
{
setProperty(METHOD_KEY, method);
}
Modified: myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/FileDownloadActionListenerTag.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/FileDownloadActionListenerTag.java?view=diff&rev=552975&r1=552974&r2=552975
==============================================================================
--- myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/FileDownloadActionListenerTag.java (original)
+++ myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/FileDownloadActionListenerTag.java Tue Jul 3 13:51:23 2007
@@ -22,6 +22,9 @@
import java.io.OutputStream;
+import javax.el.MethodExpression;
+import javax.el.ValueExpression;
+
import javax.servlet.jsp.tagext.TagSupport;
import javax.servlet.jsp.JspException;
@@ -38,17 +41,17 @@
*/
public class FileDownloadActionListenerTag extends TagSupport
{
- public void setContentType(String contentType)
+ public void setContentType(ValueExpression contentType)
{
_contentType = contentType;
}
- public void setFilename(String filename)
+ public void setFilename(ValueExpression filename)
{
_filename = filename;
}
- public void setMethod(String method)
+ public void setMethod(MethodExpression method)
{
_method = method;
}
@@ -84,53 +87,17 @@
if (_filename != null)
{
- if (TagUtils.isValueReference(_filename))
- {
- String filename = _filename;
- if (parentELContext != null)
- filename = parentELContext.transformExpression(filename);
-
- listener.setValueBinding(FileDownloadActionListener.FILENAME_KEY,
- application.createValueBinding(filename));
- }
- else
- {
- listener.setFilename(_filename);
- }
+ listener.setValueExpression(FileDownloadActionListener.FILENAME_KEY,
+ _filename);
}
if (_contentType != null)
{
- if (TagUtils.isValueReference(_contentType))
- {
- String contentType = _contentType;
- if (parentELContext != null)
- contentType = parentELContext.transformExpression(contentType);
-
- listener.setValueBinding(FileDownloadActionListener.CONTENT_TYPE_KEY,
- application.createValueBinding(contentType));
- }
- else
- {
- listener.setContentType(_contentType);
- }
+ listener.setValueExpression(FileDownloadActionListener.CONTENT_TYPE_KEY,
+ _contentType);
}
-
- if (TagUtils.isValueReference(_method))
- {
- String method = _method;
- if (parentELContext != null)
- method = parentELContext.transformExpression(method);
-
- listener.setMethod(application.createMethodBinding(method,
- new Class[]{FacesContext.class, OutputStream.class}));
- }
- else
- {
- throw new JspException(_LOG.getMessage(
- "FILEDOWNLOADACTIONLISTENERS_METHOD_MUST_BE_EL_EXPRESSION"));
- }
+ listener.setMethod(_method);
((ActionSource) component).addActionListener(listener);
@@ -146,9 +113,10 @@
_method = null;
}
- private String _contentType;
- private String _filename;
- private String _method;
+ private ValueExpression _contentType;
+ private ValueExpression _filename;
+ private MethodExpression _method;
private static final TrinidadLogger _LOG = TrinidadLogger.createTrinidadLogger(
FileDownloadActionListenerTag.class);
}
+
Modified: myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/ResetActionListenerTag.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/ResetActionListenerTag.java?view=diff&rev=552975&r1=552974&r2=552975
==============================================================================
--- myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/ResetActionListenerTag.java (original)
+++ myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/ResetActionListenerTag.java Tue Jul 3 13:51:23 2007
@@ -20,7 +20,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;
@@ -34,7 +34,7 @@
@Override
public int doStartTag() throws JspException
{
- UIComponentTag tag = UIComponentTag.getParentUIComponentTag(pageContext);
+ UIComponentClassicTagBase tag = UIComponentClassicTagBase.getParentUIComponentClassicTagBase(pageContext);
if (tag == null)
{
throw new JspException(_LOG.getMessage(
Modified: myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/ReturnActionListener.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/ReturnActionListener.java?view=diff&rev=552975&r1=552974&r2=552975
==============================================================================
--- myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/ReturnActionListener.java (original)
+++ myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/ReturnActionListener.java Tue Jul 3 13:51:23 2007
@@ -18,6 +18,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;
@@ -47,19 +49,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: myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/ReturnActionListenerTag.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/ReturnActionListenerTag.java?view=diff&rev=552975&r1=552974&r2=552975
==============================================================================
--- myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/ReturnActionListenerTag.java (original)
+++ myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/ReturnActionListenerTag.java Tue Jul 3 13:51:23 2007
@@ -20,6 +20,8 @@
import org.apache.myfaces.trinidadinternal.taglib.util.TagUtils;
+import javax.el.ValueExpression;
+
import javax.servlet.jsp.tagext.TagSupport;
import javax.servlet.jsp.JspException;
@@ -27,7 +29,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;
import org.apache.myfaces.trinidad.logging.TrinidadLogger;
@@ -38,7 +40,7 @@
*/
public class ReturnActionListenerTag extends TagSupport
{
- public void setValue(String value)
+ public void setValue(ValueExpression value)
{
_value = value;
}
@@ -46,7 +48,8 @@
@Override
public int doStartTag() throws JspException
{
- UIComponentTag tag = UIComponentTag.getParentUIComponentTag(pageContext);
+ UIComponentClassicTagBase tag =
+ UIComponentClassicTagBase.getParentUIComponentClassicTagBase(pageContext);
if (tag == null)
{
throw new JspException(_LOG.getMessage(
@@ -72,21 +75,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();
@@ -99,7 +89,7 @@
_value = null;
}
- private String _value;
+ private ValueExpression _value;
private static final TrinidadLogger _LOG = TrinidadLogger.createTrinidadLogger(
ReturnActionListenerTag.class);
}
Modified: myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/SetActionListenerTag.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/SetActionListenerTag.java?view=diff&rev=552975&r1=552974&r2=552975
==============================================================================
--- myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/SetActionListenerTag.java (original)
+++ myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/SetActionListenerTag.java Tue Jul 3 13:51:23 2007
@@ -20,6 +20,8 @@
import org.apache.myfaces.trinidadinternal.taglib.util.TagUtils;
+import javax.el.ValueExpression;
+
import javax.servlet.jsp.tagext.TagSupport;
import javax.servlet.jsp.JspException;
@@ -27,7 +29,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.event.SetActionListener;
import org.apache.myfaces.trinidad.logging.TrinidadLogger;
@@ -40,12 +42,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;
}
@@ -53,7 +55,7 @@
@Override
public int doStartTag() throws JspException
{
- UIComponentTag tag = UIComponentTag.getParentUIComponentTag(pageContext);
+ UIComponentClassicTagBase tag = UIComponentClassicTagBase.getParentUIComponentClassicTagBase(pageContext);
if (tag == null)
{
throw new JspException(_LOG.getMessage(
@@ -80,34 +82,13 @@
SetActionListener listener = new SetActionListener();
if (_from != null)
{
- if (TagUtils.isValueReference(_from))
- {
- String from = _from;
- if (parentELContext != null)
- from = parentELContext.transformExpression(from);
-
- listener.setValueBinding("from",
- application.createValueBinding(from));
- }
- else
- {
- listener.setFrom(_from);
- }
-
- if (TagUtils.isValueReference(_to))
- {
- String to = _to;
- if (parentELContext != null)
- to = parentELContext.transformExpression(to);
-
- listener.setValueBinding("to",
- application.createValueBinding(to));
- }
- else
- {
+ listener.setValueExpression("from", _from);
+ if (_to.isLiteralText())
throw new JspException(_LOG.getMessage(
"SETACTIONLISTENERS_TO_MUST_BE_EL_EXPRESSION"));
- }
+
+ if (_to != null)
+ listener.setValueExpression("to", _to);
}
((ActionSource) component).addActionListener(listener);
@@ -123,8 +104,8 @@
_to = null;
}
- private String _from;
- private String _to;
+ private ValueExpression _from;
+ private ValueExpression _to;
private static final TrinidadLogger _LOG = TrinidadLogger.createTrinidadLogger(
SetActionListenerTag.class);
}
Modified: myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/util/TagUtils.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/util/TagUtils.java?view=diff&rev=552975&r1=552974&r2=552975
==============================================================================
--- myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/util/TagUtils.java (original)
+++ myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/util/TagUtils.java Tue Jul 3 13:51:23 2007
@@ -32,7 +32,6 @@
import javax.faces.application.Application;
import javax.faces.context.FacesContext;
-import javax.faces.el.ValueBinding;
import org.apache.myfaces.trinidad.logging.TrinidadLogger;
@@ -51,14 +50,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)
@@ -73,9 +64,12 @@
* @return
*/
public static String getString(
- String value)
+ Object value)
{
- return value;
+ if (value == null)
+ return null;
+
+ return value.toString();
}
/**
@@ -84,9 +78,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();
}
/**
@@ -95,9 +95,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();
}
@@ -107,10 +113,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();
}
/**
@@ -119,9 +127,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();
}
@@ -131,10 +142,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();
}
/**
@@ -144,9 +157,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());
}
/**
@@ -155,9 +171,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());
}
/**
@@ -166,9 +188,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());
}
/**
@@ -177,21 +205,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());
}
/**
@@ -199,9 +221,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 @@
//pu: If we do not have correct starter, stop here
if (!colorCode.startsWith("#"))
throw new ParseException(_LOG.getMessage(
- "COLOR_CODE_DOES_NOT_START_WITH_POUNDSIGN", new Object[]{colorCode, value}), value.indexOf(colorCode));
+ "COLOR_CODE_DOES_NOT_START_WITH_POUNDSIGN", new Object[]{colorCode, value}), valueStr.indexOf(colorCode));
//pu: Allow NumberFormatException (RTE) to propogate as is, or transform to JspException ?.
int rgb = Integer.parseInt(colorCode.substring(1), 16);
Modified: myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/util/VirtualAttributeUtils.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/util/VirtualAttributeUtils.java?view=diff&rev=552975&r1=552974&r2=552975
==============================================================================
--- myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/util/VirtualAttributeUtils.java (original)
+++ myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/util/VirtualAttributeUtils.java Tue Jul 3 13:51:23 2007
@@ -18,7 +18,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;
@@ -55,14 +55,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: myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/uinode/UINodeFacesBean.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/uinode/UINodeFacesBean.java?view=diff&rev=552975&r1=552974&r2=552975
==============================================================================
--- myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/uinode/UINodeFacesBean.java (original)
+++ myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/uinode/UINodeFacesBean.java Tue Jul 3 13:51:23 2007
@@ -21,7 +21,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;
@@ -174,14 +174,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);
}
@@ -193,9 +193,9 @@
}
@Override
- protected PropertyMap createBindingsMap()
+ protected PropertyMap createExpressionsMap()
{
- FlaggedPropertyMap bindings = new FlaggedPropertyMap()
+ FlaggedPropertyMap expressions = new FlaggedPropertyMap()
{
@Override
public Object put(PropertyKey key, Object value)
@@ -211,12 +211,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));
}
}
@@ -243,8 +243,7 @@
}
};
- bindings.setUseStateHolder(true);
- return bindings;
+ return expressions;
}
Modified: myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/uinode/bind/ConverterBoundValue.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/uinode/bind/ConverterBoundValue.java?view=diff&rev=552975&r1=552974&r2=552975
==============================================================================
--- myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/uinode/bind/ConverterBoundValue.java (original)
+++ myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/uinode/bind/ConverterBoundValue.java Tue Jul 3 13:51:23 2007
@@ -18,9 +18,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;
@@ -57,15 +58,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: myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/main/resources/META-INF/trinidad-version.txt
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/main/resources/META-INF/trinidad-version.txt?view=diff&rev=552975&r1=552974&r2=552975
==============================================================================
--- myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/main/resources/META-INF/trinidad-version.txt (original)
+++ myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/main/resources/META-INF/trinidad-version.txt Tue Jul 3 13:51:23 2007
@@ -1 +1 @@
-1_0_2
+1_2_2
Modified: myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/main/xrts/org/apache/myfaces/trinidadinternal/resource/LoggerBundle.xrts
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/main/xrts/org/apache/myfaces/trinidadinternal/resource/LoggerBundle.xrts?view=diff&rev=552975&r1=552974&r2=552975
==============================================================================
--- myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/main/xrts/org/apache/myfaces/trinidadinternal/resource/LoggerBundle.xrts (original)
+++ myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/main/xrts/org/apache/myfaces/trinidadinternal/resource/LoggerBundle.xrts Tue Jul 3 13:51:23 2007
@@ -126,15 +126,6 @@
<!-- CANNOT_FIND_PARTIAL_TRIGGER -->
<resource key="CANNOT_FIND_PARTIAL_TRIGGER">Could not find partial trigger {0} from {1}</resource>
-<!-- FAIL_SET_CHARACTER_ENCODING -->
-<resource key="FAIL_SET_CHARACTER_ENCODING">Failed to set character encoding {0}</resource>
-
-<!-- REQUEST_CHARACTER_ENCODING_DIABLED -->
-<resource key="REQUEST_CHARACTER_ENCODING_DIABLED">Detecting request character encoding is disable.</resource>
-
-<!-- FAIL_OBTAIN_SERVLETREQUEST_METHOD -->
-<resource key="FAIL_OBTAIN_SERVLETREQUEST_METHOD">Failed to obtain ServletRequest#setCharacterEncoding() method: {0}</resource>
-
<!-- NEEDED_COMPONENT_NULL_NO_SCRIPT_WRITTEN -->
<resource key="NEEDED_COMPONENT_NULL_NO_SCRIPT_WRITTEN">The component is null, but it is needed for the client id, so no script written</resource>
Modified: myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/FacesConfigTest.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/FacesConfigTest.java?view=diff&rev=552975&r1=552974&r2=552975
==============================================================================
--- myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/FacesConfigTest.java (original)
+++ myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/FacesConfigTest.java Tue Jul 3 13:51:23 2007
@@ -29,6 +29,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: myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/FacesConfigParser.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/FacesConfigParser.java?view=diff&rev=552975&r1=552974&r2=552975
==============================================================================
--- myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/FacesConfigParser.java (original)
+++ myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/FacesConfigParser.java Tue Jul 3 13:51:23 2007
@@ -315,7 +315,7 @@
try
{
- c = Class.forName(s);
+ c = _loadClass(s);
if (isArray)
c = _getArrayType(c);
}
@@ -354,6 +354,34 @@
private FacesConfigInfo.ComponentInfo _info;
private FacesConfigInfo.PropertyInfo _property;
+ }
+
+ /**
+ * Load a class, "trying harder" - supports "." syntax
+ * to access inner classes
+ */
+ static private Class _loadClass(String s) throws ClassNotFoundException
+ {
+ try
+ {
+ return Class.forName(s);
+ }
+ catch (ClassNotFoundException cnfe)
+ {
+ // If the inner class works, great
+ int lastPeriod = s.lastIndexOf('.');
+ String ifInnerClass =
+ s.substring(0, lastPeriod) + "$" + s.substring(lastPeriod + 1);
+ try
+ {
+ return Class.forName(ifInnerClass);
+ }
+ catch (ClassNotFoundException cnfe2)
+ {
+ // Otherwise, throw the original exception
+ throw cnfe;
+ }
+ }
}
private class RendererParser extends BaseNodeParser
Modified: myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/MApplication.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/MApplication.java?view=diff&rev=552975&r1=552974&r2=552975
==============================================================================
--- myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/MApplication.java (original)
+++ myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/MApplication.java Tue Jul 3 13:51:23 2007
@@ -18,11 +18,21 @@
*/
package org.apache.myfaces.trinidadinternal.renderkit;
+import java.io.Serializable;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Locale;
import java.util.Map;
+
+import javax.el.ELResolver;
+import javax.el.ExpressionFactory;
+import javax.el.ELContext;
+import javax.el.MapELResolver;
+import javax.el.MethodExpression;
+import javax.el.MethodInfo;
+import javax.el.ValueExpression;
+
import javax.faces.FacesException;
import javax.faces.application.Application;
import javax.faces.application.NavigationHandler;
@@ -296,7 +306,7 @@
}
@Override
- public Iterator<Class<?>> getConverterTypes()
+ public Iterator<Class> getConverterTypes()
{
throw new UnsupportedOperationException("Should not be called during rendering");
}
@@ -345,6 +355,109 @@
!expression.endsWith("}"))
throw new UnsupportedOperationException("Haven't implemented that much yet!");
return new MValueBinding(expression);
+ }
+
+ public Object evaluateExpressionGet(FacesContext context, String expression, Class expectedType)
+ {
+ // TODO handle coercion
+ return createValueBinding(expression).getValue(context);
+ }
+
+ public ExpressionFactory getExpressionFactory()
+ {
+ return _exprFactory;
+ }
+
+ @Override
+ public ELResolver getELResolver()
+ {
+ return new MELResolver(
+ getVariableResolver(), getPropertyResolver());
+ }
+
+ private ExpressionFactory _exprFactory = new ExpressionFactory()
+ {
+ public Object coerceToType(Object obj, Class<?> targetType)
+ {
+ return obj;
+ }
+
+ public MethodExpression createMethodExpression(
+ ELContext context,
+ String expression,
+ Class<?> expectedReturnType,
+ Class<?>[] expectedParamTypes)
+ {
+ return new NotSupportedMethodExpression(expression);
+ }
+
+ public ValueExpression createValueExpression(
+ ELContext context, String expression, Class<?> expectedType)
+ {
+ // TODO handle coercion
+ ValueBinding vb = MApplication.this.createValueBinding(expression);
+ return new ValueBindingValueExpression(vb);
+ }
+
+
+ public ValueExpression createValueExpression(
+ Object instance, Class<?> expectedType)
+ {
+ throw new UnsupportedOperationException("Not implemented yet");
+ }
+ };
+
+
+ /**
+ * A very rudimentary implementation, to support
+ * renderers that might create (but not evaluate) MethodExpressions
+ */
+ private class NotSupportedMethodExpression extends MethodExpression
+ implements Serializable
+ {
+ public NotSupportedMethodExpression(String expression)
+ {
+ _expression = expression;
+ }
+
+ @Override
+ public MethodInfo getMethodInfo(ELContext elContext)
+ {
+ throw new UnsupportedOperationException("Not implemented yet");
+ }
+
+ @Override
+ public Object invoke(ELContext elContext, Object[] objects)
+ {
+ throw new UnsupportedOperationException("Not implemented yet");
+ }
+
+ @Override
+ public String getExpressionString()
+ {
+ return _expression;
+ }
+
+ @Override
+ public boolean isLiteralText()
+ {
+ return false;
+ }
+
+
+ @Override
+ public boolean equals(Object object)
+ {
+ return (object == this);
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return System.identityHashCode(this);
+ }
+
+ private final String _expression;
}
private Map<String, String> _components = new HashMap<String, String>();
Modified: myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/MFacesContext.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/MFacesContext.java?view=diff&rev=552975&r1=552974&r2=552975
==============================================================================
--- myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/MFacesContext.java (original)
+++ myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/MFacesContext.java Tue Jul 3 13:51:23 2007
@@ -41,16 +41,18 @@
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;
/**
* Mock faces context for use with unit tests
*/
-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: myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/MRequestContext.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/MRequestContext.java?view=diff&rev=552975&r1=552974&r2=552975
==============================================================================
--- myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/MRequestContext.java (original)
+++ myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/MRequestContext.java Tue Jul 3 13:51:23 2007
@@ -23,6 +23,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;
import javax.faces.component.UIViewRoot;
@@ -237,6 +238,12 @@
public void addPartialTarget(UIComponent newTarget)
{
// throw new UnsupportedOperationException("Not implemented yet");
+ }
+
+ @Override
+ public Set<UIComponent> getPartialTargets(UIComponent from)
+ {
+ throw new UnsupportedOperationException("Not implemented yet");
}
@Override
Modified: myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/MValueBinding.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/MValueBinding.java?view=diff&rev=552975&r1=552974&r2=552975
==============================================================================
--- myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/MValueBinding.java (original)
+++ myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/MValueBinding.java Tue Jul 3 13:51:23 2007
@@ -44,6 +44,7 @@
Object var = vr.resolveVariable(context, varName);
if (period < 0)
return var;
+
return _resolveProperty(context, var, _expression.substring(period + 1));
}
@@ -58,7 +59,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: myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/RenderKitPerfTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/RenderKitPerfTestCase.java?view=diff&rev=552975&r1=552974&r2=552975
==============================================================================
--- myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/RenderKitPerfTestCase.java (original)
+++ myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/RenderKitPerfTestCase.java Tue Jul 3 13:51:23 2007
@@ -125,7 +125,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,
Modified: myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/RenderKitTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/RenderKitTestCase.java?view=diff&rev=552975&r1=552974&r2=552975
==============================================================================
--- myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/RenderKitTestCase.java (original)
+++ myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/RenderKitTestCase.java Tue Jul 3 13:51:23 2007
@@ -152,7 +152,7 @@
@Override
protected void setUp() throws IOException
{
- _facesContext = new MFacesContext(true);
+ _facesContext = new MFacesContext(MApplication.sharedInstance(), true);
_requestContext = new MRequestContext();
_requestContext.setSkinFamily(_skin);
_requestContext.setAgent(_agent);
Modified: myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/TestResponseWriter.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/TestResponseWriter.java?view=diff&rev=552975&r1=552974&r2=552975
==============================================================================
--- myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/TestResponseWriter.java (original)
+++ myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/TestResponseWriter.java Tue Jul 3 13:51:23 2007
@@ -562,6 +562,11 @@
// spurious diffs
private String _fixId(String valueStr)
{
+ // All our golden files were produced with "_id" in JSF 1.1;
+ // and now in 1.2, that's "j_id". Eliminate this diff.
+ if (valueStr.indexOf("j_id") >= 0)
+ valueStr = valueStr.replaceAll("j_id", "_id");
+
if (valueStr.indexOf("_id") >= 0)
{
String re = "_id[0-9]+";
Modified: myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/taglib/TLDTest.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/taglib/TLDTest.java?view=diff&rev=552975&r1=552974&r2=552975
==============================================================================
--- myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/taglib/TLDTest.java (original)
+++ myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/taglib/TLDTest.java Tue Jul 3 13:51:23 2007
@@ -32,6 +32,7 @@
public void testAdfFacesCoreValidity() throws Throwable
{
+ /* TODO: use Schema validation
URL dtdSource = getClass().getResource("/javax/servlet/jsp/resources/web-jsptaglibrary_1_2.dtd");
String publicID =
"-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN";
@@ -39,10 +40,12 @@
executeValidityTest(dtdSource,
publicID,
tldSource);
+ */
}
public void testAdfFacesHtmlValidity() throws Throwable
{
+ /* TODO: use Schema validation
URL dtdSource = getClass().getResource("/javax/servlet/jsp/resources/web-jsptaglibrary_1_2.dtd");
String publicID =
"-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN";
@@ -50,5 +53,6 @@
executeValidityTest(dtdSource,
publicID,
tldSource);
+ */
}
}
Modified: myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/page-facets-minimal-golden.xml
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/page-facets-minimal-golden.xml?view=diff&rev=552975&r1=552974&r2=552975
==============================================================================
--- myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/page-facets-minimal-golden.xml (original)
+++ myfaces/trinidad/branches/pre-1.2.2-branch/trinidad/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/page-facets-minimal-golden.xml Tue Jul 3 13:51:23 2007
@@ -161,21 +161,21 @@
>
<option
- value="submitForm('formId',1,{source:'mainId:_idXXX:_idXXX'});"
+ value="submitForm('formId',1,{source:'mainId:j_idXXX:j_idXXX'});"
id="uri-attr:mainId:_idXXX:_idXXX"
name="uri-attr:mainId:_idXXX:_idXXX"
>
choice1
</option>
<option
- value="submitForm('formId',1,{source:'mainId:_idXXX:_idXXX'});"
+ value="submitForm('formId',1,{source:'mainId:j_idXXX:j_idXXX'});"
id="uri-attr:mainId:_idXXX:_idXXX"
name="uri-attr:mainId:_idXXX:_idXXX"
>
choice2
</option>
<option
- value="submitForm('formId',1,{source:'mainId:_idXXX:_idXXX'});"
+ value="submitForm('formId',1,{source:'mainId:j_idXXX:j_idXXX'});"
id="uri-attr:mainId:_idXXX:_idXXX"
name="uri-attr:mainId:_idXXX:_idXXX"
>
@@ -189,7 +189,7 @@
</span>
<button
class="af_navigationPane_choice-button"
- onclick="var navLevelSelect = document.getElementById('mainId:_idXXX_af_choice_select'); eval(navLevelSelect.options[navLevelSelect.selectedIndex].value); return false;"
+ onclick="var navLevelSelect = document.getElementById('mainId:j_idXXX_af_choice_select'); eval(navLevelSelect.options[navLevelSelect.selectedIndex].value); return false;"
type="button"
>
Go
@@ -600,22 +600,22 @@
class="AFFieldText"
id="mainId:_idXXX"
name="mainId:_idXXX"
- onchange="_commandChoice('formId','mainId:_idXXX');return false;"
+ onchange="_commandChoice('formId','mainId:j_idXXX');return false;"
>
<option
selected="selected"
- value="mainId:null:0:_idXXX[1]"
+ value="mainId:j_idXXX:0:j_idXXX[1]"
>
First
</option>
<option
- value="mainId:null:1:_idXXX[1]"
+ value="mainId:j_idXXX:1:j_idXXX[1]"
>
Second
</option>
<option
- value="mainId:null:2:_idXXX[1]"
+ value="mainId:j_idXXX:2:j_idXXX[1]"
>
Third
</option>
@@ -639,7 +639,7 @@
<button
accesskey="x"
class="OraLink"
- onclick="_navSubmit('formId', 'goto', 'mainId:_idXXX',1,'1', '1',null);return false"
+ onclick="_navSubmit('formId', 'goto', 'mainId:j_idXXX',1,'1', '1',null);return false"
type="button"
>
Ne
@@ -685,7 +685,7 @@
>
<a
- onclick="submitForm('formId',1,{source:'mainId:_idXXX'});return false;"
+ onclick="submitForm('formId',1,{source:'mainId:j_idXXX'});return false;"
href="uri-attr:encoded-action-url:#"
>
privacy
@@ -696,7 +696,7 @@
>
<a
- onclick="submitForm('formId',1,{source:'mainId:_idXXX'});return false;"
+ onclick="submitForm('formId',1,{source:'mainId:j_idXXX'});return false;"
href="uri-attr:encoded-action-url:#"
>
appAbout