You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by do...@apache.org on 2005/02/07 00:47:19 UTC

svn commit: r151643 - in incubator/beehive/trunk/netui: src/tags-html/org/apache/beehive/netui/tags/html/LabelBase.java src/tags-html/org/apache/beehive/netui/tags/html/Span.java test/webapps/drt/coreWeb/tags/labelDefaults/begin.jsp

Author: dolander
Date: Sun Feb  6 15:47:17 2005
New Revision: 151643

URL: http://svn.apache.org/viewcvs?view=rev&rev=151643
Log:
Add formatDefaultValue to the LabelBase so that it can be applied to the
Span and Label tags.



Modified:
    incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/LabelBase.java
    incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Span.java
    incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/tags/labelDefaults/begin.jsp

Modified: incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/LabelBase.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/LabelBase.java?view=diff&r1=151642&r2=151643
==============================================================================
--- incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/LabelBase.java (original)
+++ incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/LabelBase.java Sun Feb  6 15:47:17 2005
@@ -35,6 +35,7 @@
     protected Object _value;                      // The text of the Label.
     protected boolean _escapeWhiteSpace = true;   // escape white space flag
     protected boolean _formatterErrors = false;  // The formatter has errors.
+    protected boolean _formatDefaultValue = false; // Format the defaultValue
     private ArrayList _formatters;               // The formatters
 
     /**
@@ -53,6 +54,20 @@
     }
 
     /**
+     * Boolean indicating that if the if the defaultValue is displayed
+     * should the formatter be applied.  The default is "false" meaning
+     * any formatters will not be applied.
+     * @param formatDisplay Apply formatting to the default value.
+     * @netui:attribute required="false" rtexprvalue="true"
+     * description="Apply formatting to the default value of this Label or Span."
+     * @netui.tldx:attribute
+     */
+    public void setFormatDefaultValue(boolean formatDisplay)
+    {
+        _formatDefaultValue = formatDisplay;
+    }
+
+    /**
      * Sets the text of the Label.
      * @param value - the Label value or expression.
      * @netui:attribute required="true" rtexprvalue="true" type="java.lang.Object"
@@ -131,6 +146,7 @@
         _escapeWhiteSpace = true;
         _formatters = null;
         _formatterErrors = false;
+        _formatDefaultValue = false;
         _value = null;
     }
 

Modified: incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Span.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Span.java?view=diff&r1=151642&r2=151643
==============================================================================
--- incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Span.java (original)
+++ incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Span.java Sun Feb  6 15:47:17 2005
@@ -126,6 +126,7 @@
      */
     public int doEndTag() throws JspException
     {
+        boolean usingDefault = false;
         boolean bypassEscape = false;
 
         String scriptId = null;
@@ -140,6 +141,7 @@
             if (_defaultValue != null) {
                 labelObject = _defaultValue;
                 bypassEscape = HtmlUtils.containsEntity(_defaultValue.toString());
+                usingDefault = true;
             }
             else {
                 logger.warn(Bundle.getString("Tags_LabelExpressionNull", _value));
@@ -154,7 +156,8 @@
         }
 
         // push the evaluated expression when we are not client side bound...
-        String labelValue = formatText(labelObject);
+        String labelValue = (usingDefault && _formatDefaultValue) ?
+                labelObject.toString() : formatText(labelObject) ;
 
         // if there were errors in the formatters, report them.
         if (_formatterErrors) {

Modified: incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/tags/labelDefaults/begin.jsp
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/tags/labelDefaults/begin.jsp?view=diff&r1=151642&r2=151643
==============================================================================
--- incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/tags/labelDefaults/begin.jsp (original)
+++ incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/tags/labelDefaults/begin.jsp Sun Feb  6 15:47:17 2005
@@ -28,7 +28,7 @@
     <tr><td>Null Object, Date Formatter/No Default</td><td><netui:span value="${pageFlow.nullValue}"><netui:formatDate pattern="MM/dd/yyyy"/></netui:span></td></tr>
     <tr><td>Null Object, Date Formatter/Default</td><td><netui:span value="${pageFlow.nullValue}" defaultValue="[NULL]"><netui:formatDate pattern="MM/dd/yyyy"/></netui:span></td></tr>
     <tr><td>Null Object, Date Formatter/Bound Default</td><td><netui:span value="${pageFlow.nullValue}" defaultValue="${pageFlow.defaultDate}"><netui:formatDate pattern="MM/dd/yyyy"/></netui:span></td></tr>
-    <tr><td>Null Object, Date Formatter/Bound Null Default</td><td><netui:span value="${pageFlow.nullValue}" defaultValue="${pageFlow.nullValue}"><netui:formatDate pattern="MM/dd/yyyy"/></netui:span></td></tr>
+    <tr><td>Null Object, Date Formatter/Bound Null Default</td><td><netui:span formatDefaultValue="true" value="${pageFlow.nullValue}" defaultValue="${pageFlow.nullValue}"><netui:formatDate pattern="MM/dd/yyyy"/></netui:span></td></tr>
     </table>
     </netui:body>
 </netui:html>