[cvs] expresso commit by rimovm: Add prepareAttribute() functions so that it

JCorporate Ltd jcorp at jcorporate.com
Fri Jan 21 20:08:57 UTC 2005


Log Message:
-----------
Add prepareAttribute() functions so that it builds against Struts 1.2.6 and is backwards compatible as well (at least it compiles against it without any warnings))

Modified Files:
--------------
    expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/ext/struts/taglib/html:
        ExBaseFieldTag.java
        ExButtonTag.java
        ExCheckboxTag.java
        ExImageTag.java
        ExLinkTag.java
        ExRadioTag.java
        ExSelectTag.java
        ExSubmitTag.java
        ExTextareaTag.java

Revision Data
-------------
Index: ExSubmitTag.java
===================================================================
RCS file: /home/javacorp/.cvs/expresso/expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/ext/struts/taglib/html/ExSubmitTag.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/ext/struts/taglib/html/ExSubmitTag.java -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/ext/struts/taglib/html/ExSubmitTag.java -u -r1.11 -r1.12
--- expresso-web/WEB-INF/src/com/jcorporate/expresso/ext/struts/taglib/html/ExSubmitTag.java
+++ expresso-web/WEB-INF/src/com/jcorporate/expresso/ext/struts/taglib/html/ExSubmitTag.java
@@ -225,4 +225,22 @@
         // Evaluate the remainder of this page
         return (EVAL_PAGE);
     }
-}
\ No newline at end of file
+
+    /**
+     * Created to replace missing struts 1.2 function that had been removed.
+     * @since Expresso 5.7
+     * @param buffer StringBuffer the string buffer we're adding all the
+     * attributes to.
+     * @param attributeName String the name of the attribute
+     * @param attributeValue String the value of the attribute.
+     */
+    protected void prepareAttribute(StringBuffer buffer, String attributeName, Object attributeValue) {
+        if (attributeValue != null) {
+            buffer.append(" ");
+            buffer.append(attributeName);
+            buffer.append("=\"");
+            buffer.append(attributeValue.toString());
+            buffer.append("\"");
+        }
+    }
+}
Index: ExLinkTag.java
===================================================================
RCS file: /home/javacorp/.cvs/expresso/expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/ext/struts/taglib/html/ExLinkTag.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/ext/struts/taglib/html/ExLinkTag.java -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/ext/struts/taglib/html/ExLinkTag.java -u -r1.11 -r1.12
--- expresso-web/WEB-INF/src/com/jcorporate/expresso/ext/struts/taglib/html/ExLinkTag.java
+++ expresso-web/WEB-INF/src/com/jcorporate/expresso/ext/struts/taglib/html/ExLinkTag.java
@@ -124,12 +124,12 @@
             // We're not working with a Transition object, so processing is as for
             // standard Struts
             Map params = TagUtils.getInstance().computeParameters(
-                    pageContext, paramId, paramName, 
+                    pageContext, paramId, paramName,
                     paramProperty, paramScope,
                     name, property, scope, transaction);
             try {
                 url = TagUtils.getInstance().computeURLWithCharEncoding(
-                        pageContext, forward, href, page, 
+                        pageContext, forward, href, page,
                         null, action, params, anchor, false, false);
             } catch (MalformedURLException e) {
                 TagUtils.getInstance().saveException(pageContext, e);
@@ -208,5 +208,21 @@
 
         return urlForLink;
     }
-
+    /**
+     * Created to replace missing struts 1.2 function that had been removed.
+     * @since Expresso 5.7
+     * @param buffer StringBuffer the string buffer we're adding all the
+     * attributes to.
+     * @param attributeName String the name of the attribute
+     * @param attributeValue String the value of the attribute.
+     */
+    protected void prepareAttribute(StringBuffer buffer, String attributeName, Object attributeValue) {
+        if (attributeValue != null) {
+            buffer.append(" ");
+            buffer.append(attributeName);
+            buffer.append("=\"");
+            buffer.append(attributeValue.toString());
+            buffer.append("\"");
+        }
+    }
 }
Index: ExSelectTag.java
===================================================================
RCS file: /home/javacorp/.cvs/expresso/expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/ext/struts/taglib/html/ExSelectTag.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/ext/struts/taglib/html/ExSelectTag.java -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/ext/struts/taglib/html/ExSelectTag.java -u -r1.13 -r1.14
--- expresso-web/WEB-INF/src/com/jcorporate/expresso/ext/struts/taglib/html/ExSelectTag.java
+++ expresso-web/WEB-INF/src/com/jcorporate/expresso/ext/struts/taglib/html/ExSelectTag.java
@@ -233,4 +233,23 @@
         //return (EVAL_BODY_TAG);
         return (EVAL_BODY_BUFFERED);
     }
+
+    /**
+     * Created to replace missing struts 1.2 function that had been removed.
+     * @since Expresso 5.7
+     * @param buffer StringBuffer the string buffer we're adding all the
+     * attributes to.
+     * @param attributeName String the name of the attribute
+     * @param attributeValue String the value of the attribute.
+     */
+    protected void prepareAttribute(StringBuffer buffer, String attributeName, Object attributeValue) {
+        if (attributeValue != null) {
+            buffer.append(" ");
+            buffer.append(attributeName);
+            buffer.append("=\"");
+            buffer.append(attributeValue.toString());
+            buffer.append("\"");
+        }
+    }
+
 }
Index: ExRadioTag.java
===================================================================
RCS file: /home/javacorp/.cvs/expresso/expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/ext/struts/taglib/html/ExRadioTag.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/ext/struts/taglib/html/ExRadioTag.java -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/ext/struts/taglib/html/ExRadioTag.java -u -r1.9 -r1.10
--- expresso-web/WEB-INF/src/com/jcorporate/expresso/ext/struts/taglib/html/ExRadioTag.java
+++ expresso-web/WEB-INF/src/com/jcorporate/expresso/ext/struts/taglib/html/ExRadioTag.java
@@ -156,6 +156,22 @@
 
     }
 
-
+    /**
+     * Created to replace missing struts 1.2 function that had been removed.
+     * @since Expresso 5.7
+     * @param buffer StringBuffer the string buffer we're adding all the
+     * attributes to.
+     * @param attributeName String the name of the attribute
+     * @param attributeValue String the value of the attribute.
+     */
+    protected void prepareAttribute(StringBuffer buffer, String attributeName, Object attributeValue) {
+        if (attributeValue != null) {
+            buffer.append(" ");
+            buffer.append(attributeName);
+            buffer.append("=\"");
+            buffer.append(attributeValue.toString());
+            buffer.append("\"");
+        }
+    }
 }
 
Index: ExBaseFieldTag.java
===================================================================
RCS file: /home/javacorp/.cvs/expresso/expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/ext/struts/taglib/html/ExBaseFieldTag.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/ext/struts/taglib/html/ExBaseFieldTag.java -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/ext/struts/taglib/html/ExBaseFieldTag.java -u -r1.12 -r1.13
--- expresso-web/WEB-INF/src/com/jcorporate/expresso/ext/struts/taglib/html/ExBaseFieldTag.java
+++ expresso-web/WEB-INF/src/com/jcorporate/expresso/ext/struts/taglib/html/ExBaseFieldTag.java
@@ -84,13 +84,25 @@
  * @author Michael P. Nash
  */
 public abstract class ExBaseFieldTag
-        extends BaseFieldTag {
+    extends BaseFieldTag {
+
+    /**
+     * The bean name for the tag.
+     */
     private String name = null;
 
+    /**
+     * Sets the bean name of the tag.
+     * @param newName String the new tag name.
+     */
     public void setName(String newName) {
         name = newName;
     }
 
+    /**
+     * Retrieve the name attribute of the tag.
+     * @return String the name attribute of the tag.
+     */
     public String getName() {
         return name;
     }
@@ -133,9 +145,10 @@
             // Create an appropriate "input" element based on our parameters
             StringBuffer results = new StringBuffer("<input ");
 
+
             prepareAttribute( results, "type", type );
             prepareAttribute( results, "name", myInput.getName() );
-            
+
             if (accesskey != null) {
                 prepareAttribute( results, "accessKey", accesskey );
             }
@@ -199,4 +212,22 @@
         // return (EVAL_BODY_TAG);
         return (EVAL_BODY_BUFFERED);
     }
-}
\ No newline at end of file
+
+    /**
+     * Created to replace missing struts 1.2 function that had been removed.
+     * @since Expresso 5.7
+     * @param buffer StringBuffer the string buffer we're adding all the
+     * attributes to.
+     * @param attributeName String the name of the attribute
+     * @param attributeValue String the value of the attribute.
+     */
+    protected void prepareAttribute(StringBuffer buffer, String attributeName, Object attributeValue) {
+        if (attributeValue != null) {
+            buffer.append(" ");
+            buffer.append(attributeName);
+            buffer.append("=\"");
+            buffer.append(attributeValue.toString());
+            buffer.append("\"");
+        }
+    }
+}
Index: ExButtonTag.java
===================================================================
RCS file: /home/javacorp/.cvs/expresso/expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/ext/struts/taglib/html/ExButtonTag.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/ext/struts/taglib/html/ExButtonTag.java -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/ext/struts/taglib/html/ExButtonTag.java -u -r1.9 -r1.10
--- expresso-web/WEB-INF/src/com/jcorporate/expresso/ext/struts/taglib/html/ExButtonTag.java
+++ expresso-web/WEB-INF/src/com/jcorporate/expresso/ext/struts/taglib/html/ExButtonTag.java
@@ -194,4 +194,22 @@
         // Evaluate the remainder of this page
         return (EVAL_PAGE);
     }
-}
\ No newline at end of file
+
+    /**
+     * Created to replace missing struts 1.2 function that had been removed.
+     * @since Expresso 5.7
+     * @param buffer StringBuffer the string buffer we're adding all the
+     * attributes to.
+     * @param attributeName String the name of the attribute
+     * @param attributeValue String the value of the attribute.
+     */
+    protected void prepareAttribute(StringBuffer buffer, String attributeName, Object attributeValue) {
+        if (attributeValue != null) {
+            buffer.append(" ");
+            buffer.append(attributeName);
+            buffer.append("=\"");
+            buffer.append(attributeValue.toString());
+            buffer.append("\"");
+        }
+    }
+}
Index: ExCheckboxTag.java
===================================================================
RCS file: /home/javacorp/.cvs/expresso/expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/ext/struts/taglib/html/ExCheckboxTag.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/ext/struts/taglib/html/ExCheckboxTag.java -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/ext/struts/taglib/html/ExCheckboxTag.java -u -r1.13 -r1.14
--- expresso-web/WEB-INF/src/com/jcorporate/expresso/ext/struts/taglib/html/ExCheckboxTag.java
+++ expresso-web/WEB-INF/src/com/jcorporate/expresso/ext/struts/taglib/html/ExCheckboxTag.java
@@ -168,4 +168,22 @@
 
         return (EVAL_BODY_INCLUDE);
     }
-}
\ No newline at end of file
+
+    /**
+     * Created to replace missing struts 1.2 function that had been removed.
+     * @since Expresso 5.7
+     * @param buffer StringBuffer the string buffer we're adding all the
+     * attributes to.
+     * @param attributeName String the name of the attribute
+     * @param attributeValue String the value of the attribute.
+     */
+    protected void prepareAttribute(StringBuffer buffer, String attributeName, Object attributeValue) {
+        if (attributeValue != null) {
+            buffer.append(" ");
+            buffer.append(attributeName);
+            buffer.append("=\"");
+            buffer.append(attributeValue.toString());
+            buffer.append("\"");
+        }
+    }
+}
Index: ExImageTag.java
===================================================================
RCS file: /home/javacorp/.cvs/expresso/expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/ext/struts/taglib/html/ExImageTag.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/ext/struts/taglib/html/ExImageTag.java -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/ext/struts/taglib/html/ExImageTag.java -u -r1.12 -r1.13
--- expresso-web/WEB-INF/src/com/jcorporate/expresso/ext/struts/taglib/html/ExImageTag.java
+++ expresso-web/WEB-INF/src/com/jcorporate/expresso/ext/struts/taglib/html/ExImageTag.java
@@ -1,7 +1,7 @@
 /* ====================================================================
  * The Jcorporate Apache Style Software License, Version 1.2 05-07-2002
  *
- * Copyright (c) 1995-2002 Jcorporate Ltd. All rights reserved. 
+ * Copyright (c) 1995-2002 Jcorporate Ltd. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -21,27 +21,27 @@
  *        (http://www.jcorporate.com/)."
  *    Alternately, this acknowledgment may appear in the software itself,
  *    if and wherever such third-party acknowledgments normally appear.
- * 
+ *
  * 4. "Jcorporate" and product names such as "Expresso" must
  *    not be used to endorse or promote products derived from this
  *    software without prior written permission. For written permission,
  *    please contact info at jcorporate.com.
- *  
+ *
  * 5. Products derived from this software may not be called "Expresso",
- *    or other Jcorporate product names; nor may "Expresso" or other 
- *    Jcorporate product names appear in their name, without prior 
+ *    or other Jcorporate product names; nor may "Expresso" or other
+ *    Jcorporate product names appear in their name, without prior
  *    written permission of Jcorporate Ltd.
- *  
- * 6. No product derived from this software may compete in the same  
+ *
+ * 6. No product derived from this software may compete in the same
  *    market space, i.e. framework, without prior written permission
  *    of Jcorporate Ltd. For written permission, please contact
  *    partners at jcorporate.com.
- *    
+ *
  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  * DISCLAIMED.  IN NO EVENT SHALL JCORPORATE LTD OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
  * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
@@ -53,13 +53,13 @@
  *
  * This software consists of voluntary contributions made by many
  * individuals on behalf of the Jcorporate Ltd. Contributions back
- * to the project(s) are encouraged when you make modifications. 
- * Please send them to support at jcorporate.com. For more information 
- * on Jcorporate Ltd. and its products, please see 
+ * to the project(s) are encouraged when you make modifications.
+ * Please send them to support at jcorporate.com. For more information
+ * on Jcorporate Ltd. and its products, please see
  * <http://www.jcorporate.com/>.
  *
- * Portions of this software are based upon other open source 
- * products and are subject to their respective licenses. 
+ * Portions of this software are based upon other open source
+ * products and are subject to their respective licenses.
  */
 
 package com.jcorporate.expresso.ext.struts.taglib.html;
@@ -216,5 +216,23 @@
 
         // Evaluate the remainder of this page
         return (EVAL_PAGE);
+    }
+
+    /**
+     * Created to replace missing struts 1.2 function that had been removed.
+     * @since Expresso 5.7
+     * @param buffer StringBuffer the string buffer we're adding all the
+     * attributes to.
+     * @param attributeName String the name of the attribute
+     * @param attributeValue String the value of the attribute.
+     */
+    protected void prepareAttribute(StringBuffer buffer, String attributeName, Object attributeValue) {
+        if (attributeValue != null) {
+            buffer.append(" ");
+            buffer.append(attributeName);
+            buffer.append("=\"");
+            buffer.append(attributeValue.toString());
+            buffer.append("\"");
+        }
     }
 }
Index: ExTextareaTag.java
===================================================================
RCS file: /home/javacorp/.cvs/expresso/expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/ext/struts/taglib/html/ExTextareaTag.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/ext/struts/taglib/html/ExTextareaTag.java -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/ext/struts/taglib/html/ExTextareaTag.java -u -r1.12 -r1.13
--- expresso-web/WEB-INF/src/com/jcorporate/expresso/ext/struts/taglib/html/ExTextareaTag.java
+++ expresso-web/WEB-INF/src/com/jcorporate/expresso/ext/struts/taglib/html/ExTextareaTag.java
@@ -1,7 +1,7 @@
 /* ====================================================================
  * The Jcorporate Apache Style Software License, Version 1.2 05-07-2002
  *
- * Copyright (c) 1995-2002 Jcorporate Ltd. All rights reserved. 
+ * Copyright (c) 1995-2002 Jcorporate Ltd. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -21,27 +21,27 @@
  *        (http://www.jcorporate.com/)."
  *    Alternately, this acknowledgment may appear in the software itself,
  *    if and wherever such third-party acknowledgments normally appear.
- * 
+ *
  * 4. "Jcorporate" and product names such as "Expresso" must
  *    not be used to endorse or promote products derived from this
  *    software without prior written permission. For written permission,
  *    please contact info at jcorporate.com.
- *  
+ *
  * 5. Products derived from this software may not be called "Expresso",
- *    or other Jcorporate product names; nor may "Expresso" or other 
- *    Jcorporate product names appear in their name, without prior 
+ *    or other Jcorporate product names; nor may "Expresso" or other
+ *    Jcorporate product names appear in their name, without prior
  *    written permission of Jcorporate Ltd.
- *  
- * 6. No product derived from this software may compete in the same  
+ *
+ * 6. No product derived from this software may compete in the same
  *    market space, i.e. framework, without prior written permission
  *    of Jcorporate Ltd. For written permission, please contact
  *    partners at jcorporate.com.
- *    
+ *
  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  * DISCLAIMED.  IN NO EVENT SHALL JCORPORATE LTD OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
  * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
@@ -53,13 +53,13 @@
  *
  * This software consists of voluntary contributions made by many
  * individuals on behalf of the Jcorporate Ltd. Contributions back
- * to the project(s) are encouraged when you make modifications. 
- * Please send them to support at jcorporate.com. For more information 
- * on Jcorporate Ltd. and its products, please see 
+ * to the project(s) are encouraged when you make modifications.
+ * Please send them to support at jcorporate.com. For more information
+ * on Jcorporate Ltd. and its products, please see
  * <http://www.jcorporate.com/>.
  *
- * Portions of this software are based upon other open source 
- * products and are subject to their respective licenses. 
+ * Portions of this software are based upon other open source
+ * products and are subject to their respective licenses.
  */
 
 package com.jcorporate.expresso.ext.struts.taglib.html;
@@ -163,5 +163,23 @@
         // Continue processing this page
         //return (EVAL_BODY_TAG);
         return (EVAL_BODY_BUFFERED);
+    }
+
+    /**
+     * Created to replace missing struts 1.2 function that had been removed.
+     * @since Expresso 5.7
+     * @param buffer StringBuffer the string buffer we're adding all the
+     * attributes to.
+     * @param attributeName String the name of the attribute
+     * @param attributeValue String the value of the attribute.
+     */
+    protected void prepareAttribute(StringBuffer buffer, String attributeName, Object attributeValue) {
+        if (attributeValue != null) {
+            buffer.append(" ");
+            buffer.append(attributeName);
+            buffer.append("=\"");
+            buffer.append(attributeValue.toString());
+            buffer.append("\"");
+        }
     }
 }


More information about the cvs mailing list