You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2009/10/26 15:32:46 UTC
svn commit: r829813 - in /myfaces/tobago/trunk: ./ core/
extension/facelets/src/main/java/org/apache/myfaces/tobago/facelets/
tobago-jsf-compat/ tobago-jsf-compat/src/main/java-jsf-1.1/org/
tobago-jsf-compat/src/main/java-jsf-1.1/org/apache/ tobago-jsf...
Author: lofwyr
Date: Mon Oct 26 14:32:44 2009
New Revision: 829813
URL: http://svn.apache.org/viewvc?rev=829813&view=rev
Log:
TOBAGO-658: JSF 1.2 compatibility
split sources into two different directories
Added:
myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.1/org/
myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.1/org/apache/
myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.1/org/apache/myfaces/
myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.1/org/apache/myfaces/tobago/
myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.1/org/apache/myfaces/tobago/application/
myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.1/org/apache/myfaces/tobago/application/LabelValueBindingFacesMessage.java (contents, props changed)
- copied, changed from r828992, myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/application/LabelValueBindingFacesMessage.java
myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.1/org/apache/myfaces/tobago/compat/
myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.1/org/apache/myfaces/tobago/compat/FacesUtils.java (contents, props changed)
- copied, changed from r828992, myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/compat/FacesUtils.java
myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.1/org/apache/myfaces/tobago/event/
myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.1/org/apache/myfaces/tobago/event/ValueBindingTabChangeListener.java (contents, props changed)
- copied, changed from r828992, myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/event/ValueBindingTabChangeListener.java
myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.1/org/apache/myfaces/tobago/util/
myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.1/org/apache/myfaces/tobago/util/MessageUtils.java (contents, props changed)
- copied, changed from r828992, myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/util/MessageUtils.java
myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.1/org/apache/myfaces/tobago/util/ValueBindingComparator.java (contents, props changed)
- copied, changed from r828992, myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/util/ValueBindingComparator.java
myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/
myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/
myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/
myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/
myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/application/
myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/application/LabelValueExpressionFacesMessage.java (contents, props changed)
- copied, changed from r828992, myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/application/LabelValueExpressionFacesMessage.java
myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/compat/
myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/compat/FacesUtils.java (contents, props changed)
- copied, changed from r828992, myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/compat/FacesUtils.java
myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/component/
myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/component/MethodBindingToMethodExpression.java (contents, props changed)
- copied, changed from r828992, myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/component/MethodBindingToMethodExpression.java
myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/component/MethodExpressionToMethodBinding.java (contents, props changed)
- copied, changed from r828992, myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/component/MethodExpressionToMethodBinding.java
myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/event/
myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/event/MethodExpressionStateChangeListener.java (contents, props changed)
- copied, changed from r828992, myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/event/MethodExpressionStateChangeListener.java
myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/event/MethodExpressionTabChangeListener.java (contents, props changed)
- copied, changed from r828992, myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/event/MethodExpressionTabChangeListener.java
myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/event/MethodExpressionTreeExpansionListener.java (contents, props changed)
- copied, changed from r828992, myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/event/MethodExpressionTreeExpansionListener.java
myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/event/ValueExpressionTabChangeListener.java (contents, props changed)
- copied, changed from r828992, myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/event/ValueExpressionTabChangeListener.java
myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/internal/
myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/internal/taglib/
myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/internal/taglib/TobagoELTag.java (contents, props changed)
- copied, changed from r828992, myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/internal/taglib12/TobagoELTag.java
myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/util/
myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/util/MessageUtils.java (contents, props changed)
- copied, changed from r828992, myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/util/MessageUtils.java
myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/util/ValueExpressionComparator.java (contents, props changed)
- copied, changed from r828992, myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/util/ValueExpressionComparator.java
Removed:
myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/application/LabelValueBindingFacesMessage.java
myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/application/LabelValueExpressionFacesMessage.java
myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/compat/FacesUtils.java
myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/compat/FacesUtils12.java
myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/component/MethodBindingToMethodExpression.java
myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/component/MethodExpressionToMethodBinding.java
myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/event/MethodExpressionStateChangeListener.java
myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/event/MethodExpressionTabChangeListener.java
myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/event/MethodExpressionTreeExpansionListener.java
myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/event/ValueBindingTabChangeListener.java
myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/event/ValueExpressionTabChangeListener.java
myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/internal/taglib12/TobagoELTag.java
myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/util/MessageUtils.java
myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/util/ValueBindingComparator.java
myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/util/ValueExpressionComparator.java
Modified:
myfaces/tobago/trunk/core/pom.xml
myfaces/tobago/trunk/extension/facelets/src/main/java/org/apache/myfaces/tobago/facelets/TabChangeListenerHandler.java
myfaces/tobago/trunk/pom.xml
myfaces/tobago/trunk/tobago-jsf-compat/pom.xml
myfaces/tobago/trunk/tobago-tool/tobago-tool-annotation/src/main/java/org/apache/myfaces/tobago/apt/annotation/TagGeneration.java
myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/CreateComponentAnnotationVisitor.java
Modified: myfaces/tobago/trunk/core/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/pom.xml?rev=829813&r1=829812&r2=829813&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/pom.xml (original)
+++ myfaces/tobago/trunk/core/pom.xml Mon Oct 26 14:32:44 2009
@@ -520,6 +520,8 @@
<dependency>
<groupId>org.apache.myfaces.core</groupId>
<artifactId>myfaces-api</artifactId>
+ <!-- XXX needed for retro-->
+ <!-- <scope>compile</scope> -->
</dependency>
<dependency>
<groupId>org.apache.myfaces.core</groupId>
Modified: myfaces/tobago/trunk/extension/facelets/src/main/java/org/apache/myfaces/tobago/facelets/TabChangeListenerHandler.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/extension/facelets/src/main/java/org/apache/myfaces/tobago/facelets/TabChangeListenerHandler.java?rev=829813&r1=829812&r2=829813&view=diff
==============================================================================
--- myfaces/tobago/trunk/extension/facelets/src/main/java/org/apache/myfaces/tobago/facelets/TabChangeListenerHandler.java (original)
+++ myfaces/tobago/trunk/extension/facelets/src/main/java/org/apache/myfaces/tobago/facelets/TabChangeListenerHandler.java Mon Oct 26 14:32:44 2009
@@ -17,26 +17,21 @@
* limitations under the License.
*/
-import com.sun.facelets.tag.TagHandler;
+import com.sun.facelets.FaceletContext;
import com.sun.facelets.tag.TagAttribute;
-import com.sun.facelets.tag.TagConfig;
import com.sun.facelets.tag.TagAttributeException;
+import com.sun.facelets.tag.TagConfig;
import com.sun.facelets.tag.TagException;
-import com.sun.facelets.FaceletContext;
-import com.sun.facelets.el.LegacyValueBinding;
-import com.sun.facelets.util.FacesAPI;
-
-import java.io.IOException;
-
-import org.apache.myfaces.tobago.event.TabChangeSource;
+import com.sun.facelets.tag.TagHandler;
+import org.apache.myfaces.tobago.compat.FacesUtils;
import org.apache.myfaces.tobago.event.TabChangeListener;
-import org.apache.myfaces.tobago.event.ValueExpressionTabChangeListener;
-import org.apache.myfaces.tobago.event.ValueBindingTabChangeListener;
+import org.apache.myfaces.tobago.event.TabChangeSource;
+import javax.el.ELException;
+import javax.el.ValueExpression;
import javax.faces.FacesException;
import javax.faces.component.UIComponent;
-import javax.el.ValueExpression;
-import javax.el.ELException;
+import java.io.IOException;
/*
* Date: 20.04.2006
@@ -90,12 +85,8 @@
}
}
if (valueExpression != null) {
- if (FacesAPI.getVersion() >= 12) {
- changeSource.addTabChangeListener(new ValueExpressionTabChangeListener(type.getValue(), valueExpression));
- } else {
- changeSource.addTabChangeListener(new ValueBindingTabChangeListener(type.getValue(),
- new LegacyValueBinding(valueExpression)));
- }
+ FacesUtils.addBindingOrExpressionTabChangeListener(
+ changeSource, type.getValue(), valueExpression);
} else {
changeSource.addTabChangeListener(listener);
}
Modified: myfaces/tobago/trunk/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/pom.xml?rev=829813&r1=829812&r2=829813&view=diff
==============================================================================
--- myfaces/tobago/trunk/pom.xml (original)
+++ myfaces/tobago/trunk/pom.xml Mon Oct 26 14:32:44 2009
@@ -457,7 +457,6 @@
<groupId>net.sf.retrotranslator</groupId>
<artifactId>retrotranslator-runtime</artifactId>
<optional>true</optional>
- <scope>provided</scope>
<version>1.2.1</version>
</dependency>
<dependency>
@@ -1359,25 +1358,25 @@
<groupId>org.apache.myfaces.core</groupId>
<artifactId>myfaces-api</artifactId>
<version>${myfaces11.version}</version>
- <scope>provided</scope>
+ <optional>true</optional>
</dependency>
<dependency>
<groupId>org.apache.myfaces.core</groupId>
<artifactId>myfaces-impl</artifactId>
<version>${myfaces11.version}</version>
- <scope>provided</scope>
+ <optional>true</optional>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.0</version>
- <scope>provided</scope>
+ <optional>true</optional>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.4</version>
- <scope>provided</scope>
+ <optional>true</optional>
</dependency>
</dependencies>
</dependencyManagement>
@@ -1399,25 +1398,25 @@
<groupId>org.apache.myfaces.core</groupId>
<artifactId>myfaces-api</artifactId>
<version>${myfaces12.version}</version>
- <scope>provided</scope>
+ <optional>true</optional>
</dependency>
<dependency>
<groupId>org.apache.myfaces.core</groupId>
<artifactId>myfaces-impl</artifactId>
<version>${myfaces12.version}</version>
- <scope>provided</scope>
+ <optional>true</optional>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.1</version>
- <scope>provided</scope>
+ <optional>true</optional>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
- <scope>provided</scope>
+ <optional>true</optional>
</dependency>
</dependencies>
</dependencyManagement>
@@ -1440,25 +1439,25 @@
<groupId>javax.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>${mojarra11.version}</version>
- <scope>provided</scope>
+ <optional>true</optional>
</dependency>
<dependency>
<groupId>javax.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>${mojarra11.version}</version>
- <scope>provided</scope>
+ <optional>true</optional>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.0</version>
- <scope>provided</scope>
+ <optional>true</optional>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.4</version>
- <scope>provided</scope>
+ <optional>true</optional>
</dependency>
</dependencies>
</dependencyManagement>
@@ -1493,25 +1492,25 @@
<groupId>javax.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>${mojarra12.version}</version>
- <scope>provided</scope>
+ <optional>true</optional>
</dependency>
<dependency>
<groupId>javax.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>${mojarra12.version}</version>
- <scope>provided</scope>
+ <optional>true</optional>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.1</version>
- <scope>provided</scope>
+ <optional>true</optional>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
- <scope>provided</scope>
+ <optional>true</optional>
</dependency>
</dependencies>
</dependencyManagement>
@@ -1546,25 +1545,25 @@
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>${mojarra20.version}</version>
- <scope>provided</scope>
+ <optional>true</optional>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>${mojarra20.version}</version>
- <scope>provided</scope>
+ <optional>true</optional>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.1</version>
- <scope>provided</scope>
+ <optional>true</optional>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
- <scope>provided</scope>
+ <optional>true</optional>
</dependency>
</dependencies>
</dependencyManagement>
Modified: myfaces/tobago/trunk/tobago-jsf-compat/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-jsf-compat/pom.xml?rev=829813&r1=829812&r2=829813&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-jsf-compat/pom.xml (original)
+++ myfaces/tobago/trunk/tobago-jsf-compat/pom.xml Mon Oct 26 14:32:44 2009
@@ -60,14 +60,10 @@
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
- <!-- note: version is overwritten for this compatibility sub project -->
- <version>2.1</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
- <!-- note: version is overwritten for this compatibility sub project -->
- <version>2.5</version>
</dependency>
<dependency>
<groupId>javax.el</groupId>
@@ -147,8 +143,6 @@
<dependency>
<groupId>org.apache.myfaces.core</groupId>
<artifactId>myfaces-api</artifactId>
- <!-- note: version is overwritten for this compatibility sub project -->
- <version>${myfaces12.version}</version>
</dependency>
</dependencies>
</profile>
@@ -180,8 +174,6 @@
<dependency>
<groupId>javax.faces</groupId>
<artifactId>jsf-api</artifactId>
- <!-- note: version is overwritten for this compatibility sub project -->
- <version>${mojarra12.version}</version>
</dependency>
</dependencies>
</profile>
Copied: myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.1/org/apache/myfaces/tobago/application/LabelValueBindingFacesMessage.java (from r828992, myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/application/LabelValueBindingFacesMessage.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.1/org/apache/myfaces/tobago/application/LabelValueBindingFacesMessage.java?p2=myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.1/org/apache/myfaces/tobago/application/LabelValueBindingFacesMessage.java&p1=myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/application/LabelValueBindingFacesMessage.java&r1=828992&r2=829813&rev=829813&view=diff
==============================================================================
(empty)
Propchange: myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.1/org/apache/myfaces/tobago/application/LabelValueBindingFacesMessage.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.1/org/apache/myfaces/tobago/application/LabelValueBindingFacesMessage.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Copied: myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.1/org/apache/myfaces/tobago/compat/FacesUtils.java (from r828992, myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/compat/FacesUtils.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.1/org/apache/myfaces/tobago/compat/FacesUtils.java?p2=myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.1/org/apache/myfaces/tobago/compat/FacesUtils.java&p1=myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/compat/FacesUtils.java&r1=828992&r2=829813&rev=829813&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/compat/FacesUtils.java (original)
+++ myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.1/org/apache/myfaces/tobago/compat/FacesUtils.java Mon Oct 26 14:32:44 2009
@@ -19,21 +19,20 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.myfaces.tobago.event.ValueBindingTabChangeListener;
import org.apache.myfaces.tobago.event.TabChangeSource;
+import org.apache.myfaces.tobago.event.ValueBindingTabChangeListener;
import org.apache.myfaces.tobago.util.ValueBindingComparator;
-import javax.faces.application.Application;
import javax.faces.component.ContextCallback;
-import javax.faces.component.UIComponent;
-import javax.faces.component.NamingContainer;
import javax.faces.component.EditableValueHolder;
+import javax.faces.component.NamingContainer;
+import javax.faces.component.UIComponent;
import javax.faces.component.ValueHolder;
import javax.faces.context.FacesContext;
-import javax.faces.el.ValueBinding;
+import javax.faces.convert.Converter;
import javax.faces.el.MethodBinding;
+import javax.faces.el.ValueBinding;
import javax.faces.webapp.UIComponentTag;
-import javax.faces.convert.Converter;
import java.util.Comparator;
@SuppressWarnings("deprecation")
@@ -43,24 +42,8 @@
public static final Class[] VALIDATOR_ARGS = {FacesContext.class, UIComponent.class, Object.class};
-
- static {
- try {
- Application.class.getMethod("getExpressionFactory");
- facesVersion = 12;
- } catch (NoSuchMethodException e) {
- facesVersion = 11;
- }
- }
-
- private static int facesVersion;
-
- public static boolean isJSF12() {
- return facesVersion == 12;
- }
-
public static boolean invokeOnComponent(FacesContext context, UIComponent component,
- String clientId, ContextCallback callback) {
+ String clientId, ContextCallback callback) {
String thisClientId = component.getClientId(context);
if (clientId.equals(thisClientId)) {
@@ -87,29 +70,23 @@
}
private static boolean invokeOnComponentFacetsAndChildren(FacesContext context, UIComponent component,
- String clientId, ContextCallback callback) {
+ String clientId, ContextCallback callback) {
for (java.util.Iterator<UIComponent> it = component.getFacetsAndChildren(); it.hasNext();) {
UIComponent child = it.next();
- if (facesVersion == 11) {
- if (child instanceof InvokeOnComponent) {
- if (LOG.isDebugEnabled()) {
- LOG.debug("Found InvokeOnComponent with clientId " + child.getClientId(context));
- }
- if (((InvokeOnComponent) child).invokeOnComponent(context, clientId, callback)) {
- return true;
- }
- } else {
- if (LOG.isDebugEnabled()) {
- LOG.debug("Did not found InvokeOnComponent " + child.getClass().getName() + " "
- + child.getClientId(context) + " " + child.getRendererType()
- + (child.getParent() != null ? child.getParent().getClass().getName() : "null"));
- }
+ if (child instanceof InvokeOnComponent) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Found InvokeOnComponent with clientId " + child.getClientId(context));
}
- } else {
- if (child.invokeOnComponent(context, clientId, callback)) {
+ if (((InvokeOnComponent) child).invokeOnComponent(context, clientId, callback)) {
return true;
}
+ } else {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Did not found InvokeOnComponent " + child.getClass().getName() + " "
+ + child.getClientId(context) + " " + child.getRendererType()
+ + (child.getParent() != null ? child.getParent().getClass().getName() : "null"));
+ }
}
}
return false;
@@ -117,142 +94,90 @@
public static Object getValueFromValueBindingOrValueExpression(FacesContext context, UIComponent component,
- String name) {
- if (facesVersion == 11) {
- return component.getValueBinding(name).getValue(context);
- } else {
- return FacesUtils12.getValueFromValueBindingOrValueExpression(context, component, name);
- }
+ String name) {
+ return component.getValueBinding(name).getValue(context);
}
public static boolean hasValueBindingOrValueExpression(UIComponent component, String name) {
- if (facesVersion == 11) {
- return component.getValueBinding(name) != null;
- } else {
- return FacesUtils12.hasValueBindingOrValueExpression(component, name);
- }
+ return component.getValueBinding(name) != null;
}
public static boolean isReadonlyValueBindingOrValueExpression(FacesContext context,
- UIComponent component, String name) {
- if (facesVersion == 11) {
- return component.getValueBinding(name).isReadOnly(context);
- } else {
- return FacesUtils12.isReadonlyValueBindingOrValueExpression(context, component, name);
- }
+ UIComponent component, String name) {
+ return component.getValueBinding(name).isReadOnly(context);
}
public static String getExpressionString(UIComponent component, String name) {
- if (facesVersion == 11) {
- return component.getValueBinding(name).getExpressionString();
- } else {
- return FacesUtils12.getExpressionString(component, name);
- }
+ return component.getValueBinding(name).getExpressionString();
}
public static void setValueOfBindingOrExpression(FacesContext context, Object value,
- UIComponent component, String bindingName) {
- if (facesVersion == 11) {
- ValueBinding vb = component.getValueBinding(bindingName);
- if (vb != null) {
- vb.setValue(context, value);
- }
- } else {
- FacesUtils12.setValueOfBindingOrExpression(context, value, component, bindingName);
+ UIComponent component, String bindingName) {
+ ValueBinding vb = component.getValueBinding(bindingName);
+ if (vb != null) {
+ vb.setValue(context, value);
}
}
- public static void setValueOfBindingOrExpression(FacesContext context, Object value,
- Object bindingOrExpression) {
- if (facesVersion == 11) {
- if (bindingOrExpression instanceof ValueBinding) {
- ValueBinding vb = (ValueBinding) bindingOrExpression;
- vb.setValue(context, value);
- }
- } else {
- FacesUtils12.setValueOfBindingOrExpression(context, value, bindingOrExpression);
+ public static void setValueOfBindingOrExpression(FacesContext context, Object value,
+ Object bindingOrExpression) {
+ if (bindingOrExpression instanceof ValueBinding) {
+ ValueBinding vb = (ValueBinding) bindingOrExpression;
+ vb.setValue(context, value);
}
}
public static void copyValueBindingOrValueExpression(UIComponent fromComponent, String fromName,
- UIComponent toComponent, String toName) {
- if (facesVersion == 11) {
- ValueBinding vb = fromComponent.getValueBinding(fromName);
- if (vb != null) {
- toComponent.setValueBinding(toName, vb);
- }
- } else {
- FacesUtils12.copyValueBindingOrValueExpression(fromComponent, fromName, toComponent, toName);
+ UIComponent toComponent, String toName) {
+ ValueBinding vb = fromComponent.getValueBinding(fromName);
+ if (vb != null) {
+ toComponent.setValueBinding(toName, vb);
}
}
public static Object getValueFromBindingOrExpression(Object obj) {
- if (facesVersion == 11) {
- if (obj instanceof ValueBinding) {
- return ((ValueBinding) obj).getValue(FacesContext.getCurrentInstance());
- }
- } else {
- return FacesUtils12.getValueFromBindingOrExpression(obj);
+ if (obj instanceof ValueBinding) {
+ return ((ValueBinding) obj).getValue(FacesContext.getCurrentInstance());
}
return null;
}
public static void setValidator(EditableValueHolder editableValueHolder, Object validator) {
- if (facesVersion == 11) {
- MethodBinding methodBinding =
- FacesContext.getCurrentInstance().getApplication().createMethodBinding(validator.toString(), VALIDATOR_ARGS);
- editableValueHolder.setValidator(methodBinding);
- } else {
- FacesUtils12.setValidator(editableValueHolder, validator);
- }
+ MethodBinding methodBinding =
+ FacesContext.getCurrentInstance().getApplication().createMethodBinding(validator.toString(), VALIDATOR_ARGS);
+ editableValueHolder.setValidator(methodBinding);
}
public static void setConverter(ValueHolder valueHolder, Object converterExpression) {
- if (facesVersion == 11) {
- if (converterExpression != null && converterExpression instanceof String) {
- String converterExpressionStr = (String) converterExpression;
- FacesContext context = FacesContext.getCurrentInstance();
- if (UIComponentTag.isValueReference(converterExpressionStr)) {
- ValueBinding valueBinding = context.getApplication().createValueBinding(converterExpressionStr);
- if (valueHolder instanceof UIComponent) {
- ((UIComponent) valueHolder).setValueBinding("converter", valueBinding);
- }
- } else {
- Converter converter = context.getApplication().createConverter(converterExpressionStr);
- valueHolder.setConverter(converter);
+ if (converterExpression != null && converterExpression instanceof String) {
+ String converterExpressionStr = (String) converterExpression;
+ FacesContext context = FacesContext.getCurrentInstance();
+ if (UIComponentTag.isValueReference(converterExpressionStr)) {
+ ValueBinding valueBinding = context.getApplication().createValueBinding(converterExpressionStr);
+ if (valueHolder instanceof UIComponent) {
+ ((UIComponent) valueHolder).setValueBinding("converter", valueBinding);
}
+ } else {
+ Converter converter = context.getApplication().createConverter(converterExpressionStr);
+ valueHolder.setConverter(converter);
}
- } else {
- FacesUtils12.setConverter(valueHolder, converterExpression);
}
}
public static void setBindingOrExpression(UIComponent component, String name, Object valueBindingOrExpression) {
- if (facesVersion == 11) {
- component.setValueBinding(name, (ValueBinding) valueBindingOrExpression);
- } else {
- FacesUtils12.setBindingOrExpression(component, name, valueBindingOrExpression);
- }
+ component.setValueBinding(name, (ValueBinding) valueBindingOrExpression);
}
public static void addBindingOrExpressionTabChangeListener(TabChangeSource source, String type,
- Object bindingOrExpression) {
- if (facesVersion == 11) {
- source.addTabChangeListener(new ValueBindingTabChangeListener(type, (ValueBinding) bindingOrExpression));
- } else {
- FacesUtils12.addBindingOrExpressionTabChangeListener(source, type, bindingOrExpression);
- }
+ Object bindingOrExpression) {
+ source.addTabChangeListener(new ValueBindingTabChangeListener(type, (ValueBinding) bindingOrExpression));
}
public static Comparator getBindingOrExpressionComparator(FacesContext facesContext, UIComponent child, String var,
- boolean descending, Comparator comparator) {
- if (facesVersion == 11) {
- ValueBinding valueBinding = child.getValueBinding("value");
- return new ValueBindingComparator(facesContext, var, valueBinding, descending, comparator);
- } else {
- return FacesUtils12.getBindingOrExpressionComparator(facesContext, child, var, descending, comparator);
- }
+ boolean descending, Comparator comparator) {
+ ValueBinding valueBinding = child.getValueBinding("value");
+ return new ValueBindingComparator(facesContext, var, valueBinding, descending, comparator);
}
}
Propchange: myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.1/org/apache/myfaces/tobago/compat/FacesUtils.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.1/org/apache/myfaces/tobago/compat/FacesUtils.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Copied: myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.1/org/apache/myfaces/tobago/event/ValueBindingTabChangeListener.java (from r828992, myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/event/ValueBindingTabChangeListener.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.1/org/apache/myfaces/tobago/event/ValueBindingTabChangeListener.java?p2=myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.1/org/apache/myfaces/tobago/event/ValueBindingTabChangeListener.java&p1=myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/event/ValueBindingTabChangeListener.java&r1=828992&r2=829813&rev=829813&view=diff
==============================================================================
(empty)
Propchange: myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.1/org/apache/myfaces/tobago/event/ValueBindingTabChangeListener.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.1/org/apache/myfaces/tobago/event/ValueBindingTabChangeListener.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Copied: myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.1/org/apache/myfaces/tobago/util/MessageUtils.java (from r828992, myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/util/MessageUtils.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.1/org/apache/myfaces/tobago/util/MessageUtils.java?p2=myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.1/org/apache/myfaces/tobago/util/MessageUtils.java&p1=myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/util/MessageUtils.java&r1=828992&r2=829813&rev=829813&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/util/MessageUtils.java (original)
+++ myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.1/org/apache/myfaces/tobago/util/MessageUtils.java Mon Oct 26 14:32:44 2009
@@ -17,109 +17,92 @@
* limitations under the License.
*/
-import org.apache.myfaces.tobago.compat.FacesUtils;
-import org.apache.myfaces.tobago.application.LabelValueExpressionFacesMessage;
import org.apache.myfaces.tobago.application.LabelValueBindingFacesMessage;
+import org.apache.myfaces.tobago.compat.FacesUtils;
-import javax.faces.context.FacesContext;
-import javax.faces.component.UIComponent;
import javax.faces.application.FacesMessage;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import java.text.MessageFormat;
import java.util.Locale;
-import java.util.ResourceBundle;
import java.util.MissingResourceException;
-import java.text.MessageFormat;
+import java.util.ResourceBundle;
// TODO merge with MessageFactory
public class MessageUtils {
- private static final String DETAIL_SUFFIX = "_detail";
-
- public static void addMessage(FacesContext facesContext, UIComponent component, FacesMessage.Severity severity,
- String messageId, Object[] args) {
- facesContext.addMessage(component.getClientId(facesContext),
- getMessage(facesContext, facesContext.getViewRoot().getLocale(), severity, messageId, args));
- }
-
- public static FacesMessage getMessage(FacesContext facesContext, Locale locale,
- FacesMessage.Severity severity, String messageId, Object... args) {
-
- String detail;
- ResourceBundle appBundle = getApplicationBundle(facesContext, locale);
- String summary = getBundleString(appBundle, messageId);
- if (summary != null) {
- detail = getBundleString(appBundle, messageId + DETAIL_SUFFIX);
- } else {
- ResourceBundle defBundle = getDefaultBundle(facesContext, locale);
- summary = getBundleString(defBundle, messageId);
+ private static final String DETAIL_SUFFIX = "_detail";
+
+ public static void addMessage(FacesContext facesContext, UIComponent component, FacesMessage.Severity severity,
+ String messageId, Object[] args) {
+ facesContext.addMessage(component.getClientId(facesContext),
+ getMessage(facesContext, facesContext.getViewRoot().getLocale(), severity, messageId, args));
+ }
+
+ public static FacesMessage getMessage(FacesContext facesContext, Locale locale,
+ FacesMessage.Severity severity, String messageId, Object... args) {
+
+ String detail;
+ ResourceBundle appBundle = getApplicationBundle(facesContext, locale);
+ String summary = getBundleString(appBundle, messageId);
if (summary != null) {
- detail = getBundleString(defBundle, messageId + DETAIL_SUFFIX);
- } else {
- //Try to find detail alone
detail = getBundleString(appBundle, messageId + DETAIL_SUFFIX);
- if (detail != null) {
- summary = null;
- } else {
+ } else {
+ ResourceBundle defBundle = getDefaultBundle(facesContext, locale);
+ summary = getBundleString(defBundle, messageId);
+ if (summary != null) {
detail = getBundleString(defBundle, messageId + DETAIL_SUFFIX);
+ } else {
+ //Try to find detail alone
+ detail = getBundleString(appBundle, messageId + DETAIL_SUFFIX);
if (detail != null) {
summary = null;
} else {
- //Neither detail nor summary found
- facesContext.getExternalContext().log("No message with id " + messageId + " found in any bundle");
- return new FacesMessage(severity, messageId, null);
+ detail = getBundleString(defBundle, messageId + DETAIL_SUFFIX);
+ if (detail != null) {
+ summary = null;
+ } else {
+ //Neither detail nor summary found
+ facesContext.getExternalContext().log("No message with id " + messageId + " found in any bundle");
+ return new FacesMessage(severity, messageId, null);
+ }
}
}
}
+
+ return new LabelValueBindingFacesMessage(severity, summary, detail, locale, args);
}
-
- if (FacesUtils.isJSF12()) {
- if (args != null && args.length > 0) {
- MessageFormat format;
- if (summary != null) {
- format = new MessageFormat(summary, locale);
- summary = format.format(args);
- }
-
- if (detail != null) {
- format = new MessageFormat(detail, locale);
- detail = format.format(args);
- }
+
+ private static String getBundleString(ResourceBundle bundle, String key) {
+ try {
+ return bundle == null ? null : bundle.getString(key);
+ } catch (MissingResourceException e) {
+ return null;
}
- return new LabelValueExpressionFacesMessage(severity, summary, detail);
- } else {
- return new LabelValueBindingFacesMessage(severity, summary, detail, locale, args);
}
- }
-
- private static String getBundleString(ResourceBundle bundle, String key) {
- try {
- return bundle == null ? null : bundle.getString(key);
- } catch (MissingResourceException e) {
- return null;
+
+ private static ResourceBundle getApplicationBundle(FacesContext facesContext, Locale locale) {
+ String bundleName = facesContext.getApplication().getMessageBundle();
+ return bundleName != null ? getBundle(facesContext, locale, bundleName) : null;
+ }
+
+ private static ResourceBundle getDefaultBundle(FacesContext facesContext, Locale locale) {
+ return getBundle(facesContext, locale, FacesMessage.FACES_MESSAGES);
}
- }
-
- private static ResourceBundle getApplicationBundle(FacesContext facesContext, Locale locale) {
- String bundleName = facesContext.getApplication().getMessageBundle();
- return bundleName != null ? getBundle(facesContext, locale, bundleName) : null;
- }
-
- private static ResourceBundle getDefaultBundle(FacesContext facesContext, Locale locale) {
- return getBundle(facesContext, locale, FacesMessage.FACES_MESSAGES);
- }
-
- private static ResourceBundle getBundle(FacesContext facesContext, Locale locale, String bundleName) {
- try {
- return ResourceBundle.getBundle(bundleName, locale, MessageUtils.class.getClassLoader());
- } catch (MissingResourceException ignore2) {
+
+ private static ResourceBundle getBundle(FacesContext facesContext, Locale locale, String bundleName) {
try {
- return ResourceBundle.getBundle(bundleName, locale, Thread.currentThread().getContextClassLoader());
- } catch (MissingResourceException damned) {
- facesContext.getExternalContext().log("resource bundle " + bundleName + " could not be found");
- return null;
+ return ResourceBundle.getBundle(bundleName, locale, MessageUtils.class.getClassLoader());
+ } catch (MissingResourceException ignore2) {
+ try {
+ return ResourceBundle.getBundle(bundleName, locale, Thread.currentThread().getContextClassLoader());
+ } catch (MissingResourceException damned) {
+ facesContext.getExternalContext().log("resource bundle " + bundleName + " could not be found");
+ return null;
+ }
}
}
- }
-
+
public static String getLabel(FacesContext facesContext, UIComponent component) {
Object label = component.getAttributes().get("label");
if (label != null) {
Propchange: myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.1/org/apache/myfaces/tobago/util/MessageUtils.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.1/org/apache/myfaces/tobago/util/MessageUtils.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.1/org/apache/myfaces/tobago/util/MessageUtils.java
------------------------------------------------------------------------------
svn:mergeinfo =
Copied: myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.1/org/apache/myfaces/tobago/util/ValueBindingComparator.java (from r828992, myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/util/ValueBindingComparator.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.1/org/apache/myfaces/tobago/util/ValueBindingComparator.java?p2=myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.1/org/apache/myfaces/tobago/util/ValueBindingComparator.java&p1=myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/util/ValueBindingComparator.java&r1=828992&r2=829813&rev=829813&view=diff
==============================================================================
(empty)
Propchange: myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.1/org/apache/myfaces/tobago/util/ValueBindingComparator.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.1/org/apache/myfaces/tobago/util/ValueBindingComparator.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Copied: myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/application/LabelValueExpressionFacesMessage.java (from r828992, myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/application/LabelValueExpressionFacesMessage.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/application/LabelValueExpressionFacesMessage.java?p2=myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/application/LabelValueExpressionFacesMessage.java&p1=myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/application/LabelValueExpressionFacesMessage.java&r1=828992&r2=829813&rev=829813&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/application/LabelValueExpressionFacesMessage.java (original)
+++ myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/application/LabelValueExpressionFacesMessage.java Mon Oct 26 14:32:44 2009
@@ -17,9 +17,9 @@
* limitations under the License.
*/
+import javax.el.ValueExpression;
import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;
-import javax.el.ValueExpression;
public class LabelValueExpressionFacesMessage extends FacesMessage {
public LabelValueExpressionFacesMessage() {
Propchange: myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/application/LabelValueExpressionFacesMessage.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/application/LabelValueExpressionFacesMessage.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Copied: myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/compat/FacesUtils.java (from r828992, myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/compat/FacesUtils.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/compat/FacesUtils.java?p2=myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/compat/FacesUtils.java&p1=myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/compat/FacesUtils.java&r1=828992&r2=829813&rev=829813&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/compat/FacesUtils.java (original)
+++ myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/compat/FacesUtils.java Mon Oct 26 14:32:44 2009
@@ -19,48 +19,27 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.myfaces.tobago.event.ValueBindingTabChangeListener;
import org.apache.myfaces.tobago.event.TabChangeSource;
-import org.apache.myfaces.tobago.util.ValueBindingComparator;
+import org.apache.myfaces.tobago.event.ValueExpressionTabChangeListener;
+import org.apache.myfaces.tobago.util.ValueExpressionComparator;
-import javax.faces.application.Application;
+import javax.el.MethodExpression;
+import javax.el.ValueExpression;
import javax.faces.component.ContextCallback;
-import javax.faces.component.UIComponent;
-import javax.faces.component.NamingContainer;
import javax.faces.component.EditableValueHolder;
+import javax.faces.component.NamingContainer;
+import javax.faces.component.UIComponent;
import javax.faces.component.ValueHolder;
import javax.faces.context.FacesContext;
-import javax.faces.el.ValueBinding;
-import javax.faces.el.MethodBinding;
-import javax.faces.webapp.UIComponentTag;
-import javax.faces.convert.Converter;
+import javax.faces.validator.MethodExpressionValidator;
import java.util.Comparator;
-@SuppressWarnings("deprecation")
public class FacesUtils {
private static final Log LOG = LogFactory.getLog(FacesUtils.class);
- public static final Class[] VALIDATOR_ARGS = {FacesContext.class, UIComponent.class, Object.class};
-
-
- static {
- try {
- Application.class.getMethod("getExpressionFactory");
- facesVersion = 12;
- } catch (NoSuchMethodException e) {
- facesVersion = 11;
- }
- }
-
- private static int facesVersion;
-
- public static boolean isJSF12() {
- return facesVersion == 12;
- }
-
public static boolean invokeOnComponent(FacesContext context, UIComponent component,
- String clientId, ContextCallback callback) {
+ String clientId, ContextCallback callback) {
String thisClientId = component.getClientId(context);
if (clientId.equals(thisClientId)) {
@@ -87,29 +66,12 @@
}
private static boolean invokeOnComponentFacetsAndChildren(FacesContext context, UIComponent component,
- String clientId, ContextCallback callback) {
+ String clientId, ContextCallback callback) {
for (java.util.Iterator<UIComponent> it = component.getFacetsAndChildren(); it.hasNext();) {
UIComponent child = it.next();
- if (facesVersion == 11) {
- if (child instanceof InvokeOnComponent) {
- if (LOG.isDebugEnabled()) {
- LOG.debug("Found InvokeOnComponent with clientId " + child.getClientId(context));
- }
- if (((InvokeOnComponent) child).invokeOnComponent(context, clientId, callback)) {
- return true;
- }
- } else {
- if (LOG.isDebugEnabled()) {
- LOG.debug("Did not found InvokeOnComponent " + child.getClass().getName() + " "
- + child.getClientId(context) + " " + child.getRendererType()
- + (child.getParent() != null ? child.getParent().getClass().getName() : "null"));
- }
- }
- } else {
- if (child.invokeOnComponent(context, clientId, callback)) {
- return true;
- }
+ if (child.invokeOnComponent(context, clientId, callback)) {
+ return true;
}
}
return false;
@@ -117,142 +79,91 @@
public static Object getValueFromValueBindingOrValueExpression(FacesContext context, UIComponent component,
- String name) {
- if (facesVersion == 11) {
- return component.getValueBinding(name).getValue(context);
- } else {
- return FacesUtils12.getValueFromValueBindingOrValueExpression(context, component, name);
- }
+ String name) {
+ return component.getValueExpression(name).getValue(context.getELContext());
}
public static boolean hasValueBindingOrValueExpression(UIComponent component, String name) {
- if (facesVersion == 11) {
- return component.getValueBinding(name) != null;
- } else {
- return FacesUtils12.hasValueBindingOrValueExpression(component, name);
- }
+ return component.getValueExpression(name) != null;
}
public static boolean isReadonlyValueBindingOrValueExpression(FacesContext context,
- UIComponent component, String name) {
- if (facesVersion == 11) {
- return component.getValueBinding(name).isReadOnly(context);
- } else {
- return FacesUtils12.isReadonlyValueBindingOrValueExpression(context, component, name);
- }
+ UIComponent component, String name) {
+ return component.getValueExpression(name).isReadOnly(context.getELContext());
}
public static String getExpressionString(UIComponent component, String name) {
- if (facesVersion == 11) {
- return component.getValueBinding(name).getExpressionString();
- } else {
- return FacesUtils12.getExpressionString(component, name);
- }
+ return component.getValueExpression(name).getExpressionString();
}
public static void setValueOfBindingOrExpression(FacesContext context, Object value,
- UIComponent component, String bindingName) {
- if (facesVersion == 11) {
- ValueBinding vb = component.getValueBinding(bindingName);
- if (vb != null) {
- vb.setValue(context, value);
- }
- } else {
- FacesUtils12.setValueOfBindingOrExpression(context, value, component, bindingName);
+ UIComponent component, String bindingName) {
+ ValueExpression ve = component.getValueExpression(bindingName);
+ if (ve != null) {
+ ve.setValue(context.getELContext(), value);
}
}
- public static void setValueOfBindingOrExpression(FacesContext context, Object value,
- Object bindingOrExpression) {
- if (facesVersion == 11) {
- if (bindingOrExpression instanceof ValueBinding) {
- ValueBinding vb = (ValueBinding) bindingOrExpression;
- vb.setValue(context, value);
- }
- } else {
- FacesUtils12.setValueOfBindingOrExpression(context, value, bindingOrExpression);
+ public static void setValueOfBindingOrExpression(FacesContext context, Object value,
+ Object bindingOrExpression) {
+ if (bindingOrExpression instanceof ValueExpression) {
+ ValueExpression ve = (ValueExpression) bindingOrExpression;
+ ve.setValue(context.getELContext(), value);
}
}
public static void copyValueBindingOrValueExpression(UIComponent fromComponent, String fromName,
- UIComponent toComponent, String toName) {
- if (facesVersion == 11) {
- ValueBinding vb = fromComponent.getValueBinding(fromName);
- if (vb != null) {
- toComponent.setValueBinding(toName, vb);
- }
- } else {
- FacesUtils12.copyValueBindingOrValueExpression(fromComponent, fromName, toComponent, toName);
+ UIComponent toComponent, String toName) {
+ ValueExpression ve = fromComponent.getValueExpression(fromName);
+ if (ve != null) {
+ toComponent.setValueExpression(toName, ve);
}
}
public static Object getValueFromBindingOrExpression(Object obj) {
- if (facesVersion == 11) {
- if (obj instanceof ValueBinding) {
- return ((ValueBinding) obj).getValue(FacesContext.getCurrentInstance());
- }
- } else {
- return FacesUtils12.getValueFromBindingOrExpression(obj);
+ if (obj instanceof ValueExpression) {
+ ValueExpression expression = (ValueExpression) obj;
+ return expression.getValue(FacesContext.getCurrentInstance().getELContext());
}
return null;
}
public static void setValidator(EditableValueHolder editableValueHolder, Object validator) {
- if (facesVersion == 11) {
- MethodBinding methodBinding =
- FacesContext.getCurrentInstance().getApplication().createMethodBinding(validator.toString(), VALIDATOR_ARGS);
- editableValueHolder.setValidator(methodBinding);
+ if (validator instanceof MethodExpression) {
+ editableValueHolder.addValidator(new MethodExpressionValidator((MethodExpression) validator));
} else {
- FacesUtils12.setValidator(editableValueHolder, validator);
+ LOG.error("Unknow instance for validator: " + (validator != null ? validator.getClass().getName() : validator));
}
}
public static void setConverter(ValueHolder valueHolder, Object converterExpression) {
- if (facesVersion == 11) {
- if (converterExpression != null && converterExpression instanceof String) {
- String converterExpressionStr = (String) converterExpression;
- FacesContext context = FacesContext.getCurrentInstance();
- if (UIComponentTag.isValueReference(converterExpressionStr)) {
- ValueBinding valueBinding = context.getApplication().createValueBinding(converterExpressionStr);
- if (valueHolder instanceof UIComponent) {
- ((UIComponent) valueHolder).setValueBinding("converter", valueBinding);
- }
- } else {
- Converter converter = context.getApplication().createConverter(converterExpressionStr);
- valueHolder.setConverter(converter);
- }
+ if (converterExpression instanceof ValueExpression) {
+ ValueExpression expression = (ValueExpression) converterExpression;
+ if (!expression.isLiteralText()) {
+ ((UIComponent) valueHolder).setValueExpression("converter", expression);
+ } else {
+ valueHolder.setConverter(FacesContext.getCurrentInstance()
+ .getApplication().createConverter(expression.getExpressionString()));
}
- } else {
- FacesUtils12.setConverter(valueHolder, converterExpression);
}
}
public static void setBindingOrExpression(UIComponent component, String name, Object valueBindingOrExpression) {
- if (facesVersion == 11) {
- component.setValueBinding(name, (ValueBinding) valueBindingOrExpression);
- } else {
- FacesUtils12.setBindingOrExpression(component, name, valueBindingOrExpression);
- }
+ component.setValueExpression(name, (ValueExpression) valueBindingOrExpression);
}
public static void addBindingOrExpressionTabChangeListener(TabChangeSource source, String type,
- Object bindingOrExpression) {
- if (facesVersion == 11) {
- source.addTabChangeListener(new ValueBindingTabChangeListener(type, (ValueBinding) bindingOrExpression));
- } else {
- FacesUtils12.addBindingOrExpressionTabChangeListener(source, type, bindingOrExpression);
+ Object bindingOrExpression) {
+ if (bindingOrExpression instanceof ValueExpression) {
+ source.addTabChangeListener(new ValueExpressionTabChangeListener(type, (ValueExpression) bindingOrExpression));
}
}
public static Comparator getBindingOrExpressionComparator(FacesContext facesContext, UIComponent child, String var,
- boolean descending, Comparator comparator) {
- if (facesVersion == 11) {
- ValueBinding valueBinding = child.getValueBinding("value");
- return new ValueBindingComparator(facesContext, var, valueBinding, descending, comparator);
- } else {
- return FacesUtils12.getBindingOrExpressionComparator(facesContext, child, var, descending, comparator);
- }
+ boolean descending, Comparator comparator) {
+ ValueExpression valueBinding = child.getValueExpression("value");
+ return new ValueExpressionComparator(facesContext, var, valueBinding, descending, comparator);
}
}
Propchange: myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/compat/FacesUtils.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/compat/FacesUtils.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Copied: myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/component/MethodBindingToMethodExpression.java (from r828992, myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/component/MethodBindingToMethodExpression.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/component/MethodBindingToMethodExpression.java?p2=myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/component/MethodBindingToMethodExpression.java&p1=myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/component/MethodBindingToMethodExpression.java&r1=828992&r2=829813&rev=829813&view=diff
==============================================================================
(empty)
Propchange: myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/component/MethodBindingToMethodExpression.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/component/MethodBindingToMethodExpression.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Copied: myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/component/MethodExpressionToMethodBinding.java (from r828992, myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/component/MethodExpressionToMethodBinding.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/component/MethodExpressionToMethodBinding.java?p2=myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/component/MethodExpressionToMethodBinding.java&p1=myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/component/MethodExpressionToMethodBinding.java&r1=828992&r2=829813&rev=829813&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/component/MethodExpressionToMethodBinding.java (original)
+++ myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/component/MethodExpressionToMethodBinding.java Mon Oct 26 14:32:44 2009
@@ -17,13 +17,13 @@
* limitations under the License.
*/
-import javax.faces.el.MethodBinding;
-import javax.faces.el.MethodNotFoundException;
-import javax.faces.el.EvaluationException;
+import javax.el.ELException;
+import javax.el.MethodExpression;
import javax.faces.component.StateHolder;
import javax.faces.context.FacesContext;
-import javax.el.MethodExpression;
-import javax.el.ELException;
+import javax.faces.el.EvaluationException;
+import javax.faces.el.MethodBinding;
+import javax.faces.el.MethodNotFoundException;
@SuppressWarnings("deprecation")
public class MethodExpressionToMethodBinding extends MethodBinding implements StateHolder {
Propchange: myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/component/MethodExpressionToMethodBinding.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/component/MethodExpressionToMethodBinding.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Copied: myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/event/MethodExpressionStateChangeListener.java (from r828992, myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/event/MethodExpressionStateChangeListener.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/event/MethodExpressionStateChangeListener.java?p2=myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/event/MethodExpressionStateChangeListener.java&p1=myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/event/MethodExpressionStateChangeListener.java&r1=828992&r2=829813&rev=829813&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/event/MethodExpressionStateChangeListener.java (original)
+++ myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/event/MethodExpressionStateChangeListener.java Mon Oct 26 14:32:44 2009
@@ -17,11 +17,11 @@
* limitations under the License.
*/
-import javax.el.MethodExpression;
import javax.el.ELContext;
-import javax.faces.event.AbortProcessingException;
-import javax.faces.context.FacesContext;
+import javax.el.MethodExpression;
import javax.faces.component.StateHolder;
+import javax.faces.context.FacesContext;
+import javax.faces.event.AbortProcessingException;
public class MethodExpressionStateChangeListener implements SheetStateChangeListener, StateHolder {
Propchange: myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/event/MethodExpressionStateChangeListener.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/event/MethodExpressionStateChangeListener.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Copied: myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/event/MethodExpressionTabChangeListener.java (from r828992, myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/event/MethodExpressionTabChangeListener.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/event/MethodExpressionTabChangeListener.java?p2=myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/event/MethodExpressionTabChangeListener.java&p1=myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/event/MethodExpressionTabChangeListener.java&r1=828992&r2=829813&rev=829813&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/event/MethodExpressionTabChangeListener.java (original)
+++ myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/event/MethodExpressionTabChangeListener.java Mon Oct 26 14:32:44 2009
@@ -17,11 +17,11 @@
* limitations under the License.
*/
-import javax.el.MethodExpression;
import javax.el.ELContext;
-import javax.faces.event.AbortProcessingException;
-import javax.faces.context.FacesContext;
+import javax.el.MethodExpression;
import javax.faces.component.StateHolder;
+import javax.faces.context.FacesContext;
+import javax.faces.event.AbortProcessingException;
public class MethodExpressionTabChangeListener implements TabChangeListener, StateHolder {
Propchange: myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/event/MethodExpressionTabChangeListener.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/event/MethodExpressionTabChangeListener.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Copied: myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/event/MethodExpressionTreeExpansionListener.java (from r828992, myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/event/MethodExpressionTreeExpansionListener.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/event/MethodExpressionTreeExpansionListener.java?p2=myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/event/MethodExpressionTreeExpansionListener.java&p1=myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/event/MethodExpressionTreeExpansionListener.java&r1=828992&r2=829813&rev=829813&view=diff
==============================================================================
(empty)
Propchange: myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/event/MethodExpressionTreeExpansionListener.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/event/MethodExpressionTreeExpansionListener.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/event/MethodExpressionTreeExpansionListener.java
------------------------------------------------------------------------------
svn:mergeinfo =
Copied: myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/event/ValueExpressionTabChangeListener.java (from r828992, myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/event/ValueExpressionTabChangeListener.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/event/ValueExpressionTabChangeListener.java?p2=myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/event/ValueExpressionTabChangeListener.java&p1=myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/event/ValueExpressionTabChangeListener.java&r1=828992&r2=829813&rev=829813&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/event/ValueExpressionTabChangeListener.java (original)
+++ myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/event/ValueExpressionTabChangeListener.java Mon Oct 26 14:32:44 2009
@@ -20,13 +20,15 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import javax.el.ValueExpression;
import javax.faces.component.StateHolder;
import javax.faces.component.UIComponentBase;
import javax.faces.context.FacesContext;
-import javax.el.ValueExpression;
public class ValueExpressionTabChangeListener implements TabChangeListener, StateHolder {
- private static final Log LOG = LogFactory.getLog(ValueBindingTabChangeListener.class);
+
+ private static final Log LOG = LogFactory.getLog(ValueExpressionTabChangeListener.class);
+
private String type;
private ValueExpression valueExpression;
Propchange: myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/event/ValueExpressionTabChangeListener.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/event/ValueExpressionTabChangeListener.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Copied: myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/internal/taglib/TobagoELTag.java (from r828992, myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/internal/taglib12/TobagoELTag.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/internal/taglib/TobagoELTag.java?p2=myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/internal/taglib/TobagoELTag.java&p1=myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/internal/taglib12/TobagoELTag.java&r1=828992&r2=829813&rev=829813&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/internal/taglib12/TobagoELTag.java (original)
+++ myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/internal/taglib/TobagoELTag.java Mon Oct 26 14:32:44 2009
@@ -1,4 +1,4 @@
-package org.apache.myfaces.tobago.internal.taglib12;
+package org.apache.myfaces.tobago.internal.taglib;
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -22,8 +22,8 @@
import org.apache.commons.logging.LogFactory;
import org.apache.myfaces.tobago.OnComponentCreated;
-import javax.faces.webapp.UIComponentELTag;
import javax.faces.component.UIComponent;
+import javax.faces.webapp.UIComponentELTag;
import javax.servlet.jsp.JspException;
Propchange: myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/internal/taglib/TobagoELTag.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/internal/taglib/TobagoELTag.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Copied: myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/util/MessageUtils.java (from r828992, myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/util/MessageUtils.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/util/MessageUtils.java?p2=myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/util/MessageUtils.java&p1=myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/util/MessageUtils.java&r1=828992&r2=829813&rev=829813&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/util/MessageUtils.java (original)
+++ myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/util/MessageUtils.java Mon Oct 26 14:32:44 2009
@@ -17,61 +17,59 @@
* limitations under the License.
*/
-import org.apache.myfaces.tobago.compat.FacesUtils;
import org.apache.myfaces.tobago.application.LabelValueExpressionFacesMessage;
-import org.apache.myfaces.tobago.application.LabelValueBindingFacesMessage;
+import org.apache.myfaces.tobago.compat.FacesUtils;
-import javax.faces.context.FacesContext;
-import javax.faces.component.UIComponent;
import javax.faces.application.FacesMessage;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import java.text.MessageFormat;
import java.util.Locale;
-import java.util.ResourceBundle;
import java.util.MissingResourceException;
-import java.text.MessageFormat;
+import java.util.ResourceBundle;
// TODO merge with MessageFactory
public class MessageUtils {
- private static final String DETAIL_SUFFIX = "_detail";
-
- public static void addMessage(FacesContext facesContext, UIComponent component, FacesMessage.Severity severity,
- String messageId, Object[] args) {
- facesContext.addMessage(component.getClientId(facesContext),
- getMessage(facesContext, facesContext.getViewRoot().getLocale(), severity, messageId, args));
- }
-
- public static FacesMessage getMessage(FacesContext facesContext, Locale locale,
- FacesMessage.Severity severity, String messageId, Object... args) {
-
- String detail;
- ResourceBundle appBundle = getApplicationBundle(facesContext, locale);
- String summary = getBundleString(appBundle, messageId);
- if (summary != null) {
- detail = getBundleString(appBundle, messageId + DETAIL_SUFFIX);
- } else {
- ResourceBundle defBundle = getDefaultBundle(facesContext, locale);
- summary = getBundleString(defBundle, messageId);
+ private static final String DETAIL_SUFFIX = "_detail";
+
+ public static void addMessage(FacesContext facesContext, UIComponent component, FacesMessage.Severity severity,
+ String messageId, Object[] args) {
+ facesContext.addMessage(component.getClientId(facesContext),
+ getMessage(facesContext, facesContext.getViewRoot().getLocale(), severity, messageId, args));
+ }
+
+ public static FacesMessage getMessage(FacesContext facesContext, Locale locale,
+ FacesMessage.Severity severity, String messageId, Object... args) {
+
+ String detail;
+ ResourceBundle appBundle = getApplicationBundle(facesContext, locale);
+ String summary = getBundleString(appBundle, messageId);
if (summary != null) {
- detail = getBundleString(defBundle, messageId + DETAIL_SUFFIX);
- } else {
- //Try to find detail alone
detail = getBundleString(appBundle, messageId + DETAIL_SUFFIX);
- if (detail != null) {
- summary = null;
- } else {
+ } else {
+ ResourceBundle defBundle = getDefaultBundle(facesContext, locale);
+ summary = getBundleString(defBundle, messageId);
+ if (summary != null) {
detail = getBundleString(defBundle, messageId + DETAIL_SUFFIX);
+ } else {
+ //Try to find detail alone
+ detail = getBundleString(appBundle, messageId + DETAIL_SUFFIX);
if (detail != null) {
summary = null;
} else {
- //Neither detail nor summary found
- facesContext.getExternalContext().log("No message with id " + messageId + " found in any bundle");
- return new FacesMessage(severity, messageId, null);
+ detail = getBundleString(defBundle, messageId + DETAIL_SUFFIX);
+ if (detail != null) {
+ summary = null;
+ } else {
+ //Neither detail nor summary found
+ facesContext.getExternalContext().log("No message with id " + messageId + " found in any bundle");
+ return new FacesMessage(severity, messageId, null);
+ }
}
}
}
- }
-
- if (FacesUtils.isJSF12()) {
+
if (args != null && args.length > 0) {
MessageFormat format;
if (summary != null) {
@@ -85,41 +83,38 @@
}
}
return new LabelValueExpressionFacesMessage(severity, summary, detail);
- } else {
- return new LabelValueBindingFacesMessage(severity, summary, detail, locale, args);
- }
- }
-
- private static String getBundleString(ResourceBundle bundle, String key) {
- try {
- return bundle == null ? null : bundle.getString(key);
- } catch (MissingResourceException e) {
- return null;
}
- }
-
- private static ResourceBundle getApplicationBundle(FacesContext facesContext, Locale locale) {
- String bundleName = facesContext.getApplication().getMessageBundle();
- return bundleName != null ? getBundle(facesContext, locale, bundleName) : null;
- }
-
- private static ResourceBundle getDefaultBundle(FacesContext facesContext, Locale locale) {
- return getBundle(facesContext, locale, FacesMessage.FACES_MESSAGES);
- }
-
- private static ResourceBundle getBundle(FacesContext facesContext, Locale locale, String bundleName) {
- try {
- return ResourceBundle.getBundle(bundleName, locale, MessageUtils.class.getClassLoader());
- } catch (MissingResourceException ignore2) {
+
+ private static String getBundleString(ResourceBundle bundle, String key) {
try {
- return ResourceBundle.getBundle(bundleName, locale, Thread.currentThread().getContextClassLoader());
- } catch (MissingResourceException damned) {
- facesContext.getExternalContext().log("resource bundle " + bundleName + " could not be found");
+ return bundle == null ? null : bundle.getString(key);
+ } catch (MissingResourceException e) {
return null;
}
}
- }
-
+
+ private static ResourceBundle getApplicationBundle(FacesContext facesContext, Locale locale) {
+ String bundleName = facesContext.getApplication().getMessageBundle();
+ return bundleName != null ? getBundle(facesContext, locale, bundleName) : null;
+ }
+
+ private static ResourceBundle getDefaultBundle(FacesContext facesContext, Locale locale) {
+ return getBundle(facesContext, locale, FacesMessage.FACES_MESSAGES);
+ }
+
+ private static ResourceBundle getBundle(FacesContext facesContext, Locale locale, String bundleName) {
+ try {
+ return ResourceBundle.getBundle(bundleName, locale, MessageUtils.class.getClassLoader());
+ } catch (MissingResourceException ignore2) {
+ try {
+ return ResourceBundle.getBundle(bundleName, locale, Thread.currentThread().getContextClassLoader());
+ } catch (MissingResourceException damned) {
+ facesContext.getExternalContext().log("resource bundle " + bundleName + " could not be found");
+ return null;
+ }
+ }
+ }
+
public static String getLabel(FacesContext facesContext, UIComponent component) {
Object label = component.getAttributes().get("label");
if (label != null) {
Propchange: myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/util/MessageUtils.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/util/MessageUtils.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Copied: myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/util/ValueExpressionComparator.java (from r828992, myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/util/ValueExpressionComparator.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/util/ValueExpressionComparator.java?p2=myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/util/ValueExpressionComparator.java&p1=myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/util/ValueExpressionComparator.java&r1=828992&r2=829813&rev=829813&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/util/ValueExpressionComparator.java (original)
+++ myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/util/ValueExpressionComparator.java Mon Oct 26 14:32:44 2009
@@ -20,8 +20,8 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import javax.faces.context.FacesContext;
import javax.el.ValueExpression;
+import javax.faces.context.FacesContext;
import java.util.Comparator;
import java.util.Map;
Propchange: myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/util/ValueExpressionComparator.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.2/org/apache/myfaces/tobago/util/ValueExpressionComparator.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Modified: myfaces/tobago/trunk/tobago-tool/tobago-tool-annotation/src/main/java/org/apache/myfaces/tobago/apt/annotation/TagGeneration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-tool/tobago-tool-annotation/src/main/java/org/apache/myfaces/tobago/apt/annotation/TagGeneration.java?rev=829813&r1=829812&r2=829813&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-tool/tobago-tool-annotation/src/main/java/org/apache/myfaces/tobago/apt/annotation/TagGeneration.java (original)
+++ myfaces/tobago/trunk/tobago-tool/tobago-tool-annotation/src/main/java/org/apache/myfaces/tobago/apt/annotation/TagGeneration.java Mon Oct 26 14:32:44 2009
@@ -1,5 +1,8 @@
package org.apache.myfaces.tobago.apt.annotation;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -17,6 +20,7 @@
* limitations under the License.
*/
+@Retention(value = RetentionPolicy.SOURCE)
public @interface TagGeneration {
String className();
}
Modified: myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/CreateComponentAnnotationVisitor.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/CreateComponentAnnotationVisitor.java?rev=829813&r1=829812&r2=829813&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/CreateComponentAnnotationVisitor.java (original)
+++ myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/CreateComponentAnnotationVisitor.java Mon Oct 26 14:32:44 2009
@@ -147,7 +147,7 @@
}
}
if (is12()) {
- tagInfo.setSuperClass("org.apache.myfaces.tobago.internal.taglib12.TobagoELTag");
+ tagInfo.setSuperClass("org.apache.myfaces.tobago.internal.taglib.TobagoELTag");
} else {
if (tagInfo.getBodyContent() != null) {
tagInfo.setSuperClass("org.apache.myfaces.tobago.internal.taglib.TobagoBodyTag");