myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bom...@apache.org
Subject svn commit: r600315 - in /myfaces/commons/trunk: ./ myfaces-commons-converters/ myfaces-commons-converters/src/main/java/org/apache/myfaces/commons/converter/ myfaces-commons-utils/ myfaces-commons-utils/src/main/java/org/apache/myfaces/commons/util/ m...
Date Sun, 02 Dec 2007 15:48:51 GMT
Author: bommel
Date: Sun Dec  2 07:48:51 2007
New Revision: 600315

URL: http://svn.apache.org/viewvc?rev=600315&view=rev
Log:
next steps

Modified:
    myfaces/commons/trunk/myfaces-commons-converters/pom.xml
    myfaces/commons/trunk/myfaces-commons-converters/src/main/java/org/apache/myfaces/commons/converter/EnumConverter.java
    myfaces/commons/trunk/myfaces-commons-utils/pom.xml
    myfaces/commons/trunk/myfaces-commons-utils/src/main/java/org/apache/myfaces/commons/util/MessageUtils.java
    myfaces/commons/trunk/myfaces-commons-validators/pom.xml
    myfaces/commons/trunk/pom.xml

Modified: myfaces/commons/trunk/myfaces-commons-converters/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/commons/trunk/myfaces-commons-converters/pom.xml?rev=600315&r1=600314&r2=600315&view=diff
==============================================================================
--- myfaces/commons/trunk/myfaces-commons-converters/pom.xml (original)
+++ myfaces/commons/trunk/myfaces-commons-converters/pom.xml Sun Dec  2 07:48:51 2007
@@ -110,14 +110,14 @@
     <dependency>
       <groupId>org.apache.myfaces.core</groupId>
       <artifactId>myfaces-api</artifactId>
-      <version>1.1.5</version>
-      <scope>provided</scope>
     </dependency>
     <dependency>
-      <groupId>commons-validator</groupId>
-      <artifactId>commons-validator</artifactId>
-      <version>1.3.1</version>
-      <scope>compile</scope>
+      <groupId>javax.servlet.jsp</groupId>
+      <artifactId>jsp-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>commons-logging</groupId>
+      <artifactId>commons-logging</artifactId>
     </dependency>
     <dependency>
       <groupId>org.apache.myfaces.commons</groupId>

Modified: myfaces/commons/trunk/myfaces-commons-converters/src/main/java/org/apache/myfaces/commons/converter/EnumConverter.java
URL: http://svn.apache.org/viewvc/myfaces/commons/trunk/myfaces-commons-converters/src/main/java/org/apache/myfaces/commons/converter/EnumConverter.java?rev=600315&r1=600314&r2=600315&view=diff
==============================================================================
--- myfaces/commons/trunk/myfaces-commons-converters/src/main/java/org/apache/myfaces/commons/converter/EnumConverter.java
(original)
+++ myfaces/commons/trunk/myfaces-commons-converters/src/main/java/org/apache/myfaces/commons/converter/EnumConverter.java
Sun Dec  2 07:48:51 2007
@@ -16,9 +16,14 @@
 
 package org.apache.myfaces.commons.converter;
 
+import org.apache.myfaces.commons.util.MessageUtils;
+
 import javax.faces.component.StateHolder;
 import javax.faces.component.UIComponent;
 import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+import javax.faces.convert.ConverterException;
+import javax.faces.application.FacesMessage;
 
 /**
  * see Javadoc of <a href="http://java.sun.com/j2ee/javaserverfaces/1.2/docs/api/index.html">JSF
Specification</a>
@@ -74,7 +79,7 @@
                                            firstConstantOfEnum(), 
                                            MessageUtils.getLabel(facesContext, uiComponent)};
             
-            throw new ConverterException(MessageUtils.getErrorMessage(facesContext,
+            throw new ConverterException(MessageUtils.getMessage(FacesMessage.SEVERITY_ERROR,
                                                                        ENUM_ID,
                                                                        params));
         }
@@ -83,7 +88,7 @@
 	private void checkTargetClass(FacesContext facesContext, UIComponent uiComponent, Object
value) {
 		if (targetClass == null) {
             Object[] params = new Object[]{value, MessageUtils.getLabel(facesContext, uiComponent)};
-            throw new ConverterException(MessageUtils.getErrorMessage(facesContext, 
+            throw new ConverterException(MessageUtils.getMessage(FacesMessage.SEVERITY_ERROR,
                                                                        ENUM_NO_CLASS_ID,

                                                                        params));
         }

Modified: myfaces/commons/trunk/myfaces-commons-utils/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/commons/trunk/myfaces-commons-utils/pom.xml?rev=600315&r1=600314&r2=600315&view=diff
==============================================================================
--- myfaces/commons/trunk/myfaces-commons-utils/pom.xml (original)
+++ myfaces/commons/trunk/myfaces-commons-utils/pom.xml Sun Dec  2 07:48:51 2007
@@ -30,8 +30,6 @@
     <dependency>
       <groupId>org.apache.myfaces.core</groupId>
       <artifactId>myfaces-api</artifactId>
-      <version>1.1.5</version>
-      <scope>provided</scope>
     </dependency>
      <dependency>
       <groupId>commons-logging</groupId>

Modified: myfaces/commons/trunk/myfaces-commons-utils/src/main/java/org/apache/myfaces/commons/util/MessageUtils.java
URL: http://svn.apache.org/viewvc/myfaces/commons/trunk/myfaces-commons-utils/src/main/java/org/apache/myfaces/commons/util/MessageUtils.java?rev=600315&r1=600314&r2=600315&view=diff
==============================================================================
--- myfaces/commons/trunk/myfaces-commons-utils/src/main/java/org/apache/myfaces/commons/util/MessageUtils.java
(original)
+++ myfaces/commons/trunk/myfaces-commons-utils/src/main/java/org/apache/myfaces/commons/util/MessageUtils.java
Sun Dec  2 07:48:51 2007
@@ -25,7 +25,9 @@
 import javax.faces.application.Application;
 import javax.faces.application.ApplicationFactory;
 import javax.faces.application.FacesMessage;
+import javax.faces.component.UIComponent;
 import javax.faces.context.FacesContext;
+import javax.faces.el.ValueBinding;
 import java.text.MessageFormat;
 import java.util.Locale;
 import java.util.MissingResourceException;
@@ -404,5 +406,20 @@
         }
         return loader;
     }
+
+    public static String getLabel(FacesContext facesContext, UIComponent component) {
+        Object label = component.getAttributes().get("label");
+        if(label != null)
+          return label.toString();
+
+        ValueBinding expression = component.getValueBinding("label");
+        if (expression != null)
+          return expression.getExpressionString();
+
+        //If no label is not specified, use clientId
+        return component.getClientId( facesContext );
+      }
+
+
 
 }

Modified: myfaces/commons/trunk/myfaces-commons-validators/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/commons/trunk/myfaces-commons-validators/pom.xml?rev=600315&r1=600314&r2=600315&view=diff
==============================================================================
--- myfaces/commons/trunk/myfaces-commons-validators/pom.xml (original)
+++ myfaces/commons/trunk/myfaces-commons-validators/pom.xml Sun Dec  2 07:48:51 2007
@@ -106,14 +106,10 @@
     <dependency>
       <groupId>org.apache.myfaces.core</groupId>
       <artifactId>myfaces-api</artifactId>
-      <version>1.1.5</version>
-      <scope>provided</scope>
     </dependency>
     <dependency>
       <groupId>javax.servlet.jsp</groupId>
       <artifactId>jsp-api</artifactId>
-      <version>2.0</version>
-      <scope>provided</scope>
     </dependency>
     <dependency>
       <groupId>commons-logging</groupId>

Modified: myfaces/commons/trunk/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/commons/trunk/pom.xml?rev=600315&r1=600314&r2=600315&view=diff
==============================================================================
--- myfaces/commons/trunk/pom.xml (original)
+++ myfaces/commons/trunk/pom.xml Sun Dec  2 07:48:51 2007
@@ -89,6 +89,18 @@
         <version>1.0.4</version>
         <scope>compile</scope>
       </dependency>
+      <dependency>
+        <groupId>org.apache.myfaces.core</groupId>
+        <artifactId>myfaces-api</artifactId>
+        <version>1.1.5</version>
+        <scope>provided</scope>
+      </dependency>
+      <dependency>
+        <groupId>javax.servlet.jsp</groupId>
+        <artifactId>jsp-api</artifactId>
+        <version>2.0</version>
+        <scope>provided</scope>
+      </dependency>      
     </dependencies>
   </dependencyManagement>
 



Mime
View raw message