You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ma...@apache.org on 2007/09/12 19:05:02 UTC

svn commit: r575013 - in /myfaces/trinidad/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/convert: DateTimeConverter.java NumberConverter.java

Author: matzew
Date: Wed Sep 12 10:05:01 2007
New Revision: 575013

URL: http://svn.apache.org/viewvc?rev=575013&view=rev
Log:
TRINIDAD-700 - EL isn't evalutaed for the datestyle / timestyle attrs of tr:convertDateTime

fix is inside the constructor of the Converter itself:

Since we're explicitly setting the time style
and date style and type, the value binding will be ignored.
Instead of using setters in the constructor, we should put
that default into the getters. 

True for the Trinidad API NumberConverter clazz as well.

Modified:
    myfaces/trinidad/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/convert/DateTimeConverter.java
    myfaces/trinidad/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/convert/NumberConverter.java

Modified: myfaces/trinidad/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/convert/DateTimeConverter.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/convert/DateTimeConverter.java?rev=575013&r1=575012&r2=575013&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/convert/DateTimeConverter.java (original)
+++ myfaces/trinidad/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/convert/DateTimeConverter.java Wed Sep 12 10:05:01 2007
@@ -217,21 +217,11 @@
   public static final String CONVERT_BOTH_MESSAGE_ID =
       "org.apache.myfaces.trinidad.convert.DateTimeConverter.CONVERT_BOTH";
 
-
   /**
    * Creates a DateTimeConverter
    */
   public DateTimeConverter()
   {
-    /**
-     * @todo a kind of hack? Default value set of the faces bean are not returned
-     * if property has not been set, when default values are set on the property
-     * key. TYPE hangs of the faces bean and can be created separately.
-     * the setProperty is on the faces bean, how to make them get the default!
-     */
-    setTimeStyle("short");
-    setDateStyle("shortish");
-    setType("date");
   }
 
   /**
@@ -839,7 +829,7 @@
   public String getType()
   {
     Object type = _facesBean.getProperty(_TYPE_KEY);
-    return ComponentUtils.resolveString(type);
+    return ComponentUtils.resolveString(type, "date");
   }
 
   /**
@@ -868,7 +858,7 @@
   public String getDateStyle()
   {
     Object dateStyle = _facesBean.getProperty(_DATE_STYLE_KEY);
-    return ComponentUtils.resolveString(dateStyle);
+    return ComponentUtils.resolveString(dateStyle, "shortish");
   }
 
   /**
@@ -894,7 +884,7 @@
   public String getTimeStyle()
   {
     Object timeStyle = _facesBean.getProperty(_TIME_STYLE_KEY);
-    return ComponentUtils.resolveString(timeStyle);
+    return ComponentUtils.resolveString(timeStyle, "short");
   }
 
   /**

Modified: myfaces/trinidad/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/convert/NumberConverter.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/convert/NumberConverter.java?rev=575013&r1=575012&r2=575013&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/convert/NumberConverter.java (original)
+++ myfaces/trinidad/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/convert/NumberConverter.java Wed Sep 12 10:05:01 2007
@@ -115,17 +115,6 @@
 {
 
   /**
-   * Create an instance of the converter
-   */
-  public NumberConverter()
-  {
-    //The defaults
-    setGroupingUsed(true);
-    setIntegerOnly(false);
-    setType("number");
-  }
-
-  /**
    * <p>The standard converter id for this converter.</p>
    */
     public static final String CONVERTER_ID = "org.apache.myfaces.trinidad.Number";
@@ -541,7 +530,7 @@
   public  boolean isGroupingUsed()
   {
     Object grpUSed = _facesBean.getProperty(_GROUPING_USED_KEY);
-    return ComponentUtils.resolveBoolean(grpUSed);
+    return ComponentUtils.resolveBoolean(grpUSed, true);
   }
 
   @Override
@@ -554,7 +543,7 @@
   public boolean isIntegerOnly()
   {
     Object isInt = _facesBean.getProperty(_INTEGER_ONLY_KEY);
-    return ComponentUtils.resolveBoolean(isInt);
+    return ComponentUtils.resolveBoolean(isInt, false);
   }
 
   /**
@@ -663,7 +652,7 @@
   public String getType()
   {
     Object type = _facesBean.getProperty(_TYPE_KEY);
-    return ComponentUtils.resolveString(type);
+    return ComponentUtils.resolveString(type, "number");
   }
 
   /**