svn commit: r598492 - in /ofbiz/trunk/framework/widget: dtd/widget-form.xsd src/org/ofbiz/widget/form/ModelFormField.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r598492 - in /ofbiz/trunk/framework/widget: dtd/widget-form.xsd src/org/ofbiz/widget/form/ModelFormField.java

hansbak-2
Author: hansbak
Date: Mon Nov 26 18:18:08 2007
New Revision: 598492

URL: http://svn.apache.org/viewvc?rev=598492&view=rev
Log:
OFBIZ-1430 only show date part of a timestamp in the form display

Modified:
    ofbiz/trunk/framework/widget/dtd/widget-form.xsd
    ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java

Modified: ofbiz/trunk/framework/widget/dtd/widget-form.xsd
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/dtd/widget-form.xsd?rev=598492&r1=598491&r2=598492&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/dtd/widget-form.xsd (original)
+++ ofbiz/trunk/framework/widget/dtd/widget-form.xsd Mon Nov 26 18:18:08 2007
@@ -512,6 +512,9 @@
                 <xs:restriction base="xs:token">
                     <xs:enumeration value="text"/>
                     <xs:enumeration value="currency"/>
+                    <xs:enumeration value="date">
+                        <xs:annotation>Display only the date part of a timestamp field</xs:annotation>
+                    </xs:enumeration>
                 </xs:restriction>
             </xs:simpleType>
         </xs:attribute>

Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java?rev=598492&r1=598491&r2=598492&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java Mon Nov 26 18:18:08 2007
@@ -1723,6 +1723,7 @@
         protected FlexibleStringExpander description;
         protected String type;  // matches type of field, currently text or currency
         protected FlexibleStringExpander currency;
+        protected FlexibleStringExpander date;
 
         protected DisplayField() {
             super();
@@ -1741,6 +1742,7 @@
             this.type = element.getAttribute("type");
             this.setCurrency(element.getAttribute("currency"));
             this.setDescription(element.getAttribute("description"));
+            this.setDate(element.getAttribute("date"));
             this.alsoHidden = !"false".equals(element.getAttribute("also-hidden"));
         }
 
@@ -1781,8 +1783,10 @@
                     String errMsg = "Error formatting currency value [" + retVal + "]: " + e.toString();
                     Debug.logError(e, errMsg, module);
                     throw new IllegalArgumentException(errMsg);
-                }
-            }
+                }
+            } else if ("date".equals(type)) {
+             retVal = retVal.substring(0,10);
+            }
             return retVal;
         }
 
@@ -1794,7 +1798,7 @@
         }
 
         /**
-         * @param string
+         * @param Description
          */
         public void setDescription(String string) {
             description = new FlexibleStringExpander(string);
@@ -1805,6 +1809,12 @@
          */
         public void setCurrency(String string) {
             currency = new FlexibleStringExpander(string);
+        }
+        /**
+         * @param date
+         */
+        public void setDate(String string) {
+            date = new FlexibleStringExpander(string);
         }
     }