[cvs] expresso commit by mtraum: IfErrorExists tag now supports the 'inverse'

JCorporate Ltd jcorp at jcorporate.com
Sat May 14 02:58:21 UTC 2005


Log Message:
-----------
IfErrorExists tag now supports the 'inverse' attribute

Modified Files:
--------------
    expresso/expresso-web/expresso/doc:
        ChangeLog.xml
    expresso/expresso-web/WEB-INF/tld:
        expresso.tld
    expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/ext/taglib:
        IfErrorExists.java
    expresso/expresso-web/expresso/doc/edg:
        taglib.xml

Revision Data
-------------
Index: expresso.tld
===================================================================
RCS file: /home/javacorp/.cvs/expresso/expresso/expresso-web/WEB-INF/tld/expresso.tld,v
retrieving revision 1.33
retrieving revision 1.34
diff -Lexpresso-web/WEB-INF/tld/expresso.tld -Lexpresso-web/WEB-INF/tld/expresso.tld -u -r1.33 -r1.34
--- expresso-web/WEB-INF/tld/expresso.tld
+++ expresso-web/WEB-INF/tld/expresso.tld
@@ -199,6 +199,12 @@
 			A tag to check if the controller generated errors
 			and stored it in the page context.
 		</info>
+		<attribute>
+			<name>inverse</name>
+			<required>false</required>
+			<rtexprvalue>false</rtexprvalue>
+		</attribute>
+
 	</tag>
 	<tag>
 		<name>IfLoggedIn</name>
Index: IfErrorExists.java
===================================================================
RCS file: /home/javacorp/.cvs/expresso/expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/ext/taglib/IfErrorExists.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/ext/taglib/IfErrorExists.java -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/ext/taglib/IfErrorExists.java -u -r1.7 -r1.8
--- expresso-web/WEB-INF/src/com/jcorporate/expresso/ext/taglib/IfErrorExists.java
+++ expresso-web/WEB-INF/src/com/jcorporate/expresso/ext/taglib/IfErrorExists.java
@@ -64,11 +64,12 @@
 
 package com.jcorporate.expresso.ext.taglib;
 
-import com.jcorporate.expresso.core.controller.ErrorCollection;
-
 import javax.servlet.jsp.JspTagException;
 import javax.servlet.jsp.PageContext;
 
+import com.jcorporate.expresso.core.controller.ErrorCollection;
+import com.jcorporate.expresso.core.misc.StringUtil;
+
 
 /**
  * @author Shash Chatterjee
@@ -78,6 +79,8 @@
     private ErrorCollection errorCollection = null;
     private java.lang.String name = null;
     private java.lang.String nameToUse = null;
+    private boolean inverse = false;
+
 
     public IfErrorExists() {
         super();
@@ -93,7 +96,7 @@
         nameToUse = name;
 
         try {
-            if (nameToUse == null || "".equals(nameToUse)) {
+            if (nameToUse == null || StringUtil.EMPTY_STRING.equals(nameToUse)) {
                 nameToUse = ErrorCollection.ERRORCOLLECTIONKEY;
             }
 
@@ -105,19 +108,30 @@
 
             if (errorCollection != null) {
                 if (errorCollection.getErrorCount() > 0) {
-                    return EVAL_BODY_INCLUDE;
+                    if (!inverse)
+                        return EVAL_BODY_INCLUDE;
+                    return SKIP_BODY;
                 }
             }
         } catch (Exception e) {
             throw new JspTagException("IfErrorExists Tag Error: " +
                     e.getMessage());
         }
+        if (!inverse)
+            return SKIP_BODY;
+        return EVAL_BODY_INCLUDE;
+    }
 
-        return SKIP_BODY;
+    public boolean getInverse() {
+        return this.inverse;
     }
 
     public java.lang.String getName() {
         return nameToUse;
+    }
+    
+    public void setInverse(boolean newInverse) {
+        this.inverse = newInverse;
     }
 
     public void setName(java.lang.String newName) {
Index: ChangeLog.xml
===================================================================
RCS file: /home/javacorp/.cvs/expresso/expresso/expresso-web/expresso/doc/ChangeLog.xml,v
retrieving revision 1.308
retrieving revision 1.309
diff -Lexpresso-web/expresso/doc/ChangeLog.xml -Lexpresso-web/expresso/doc/ChangeLog.xml -u -r1.308 -r1.309
--- expresso-web/expresso/doc/ChangeLog.xml
+++ expresso-web/expresso/doc/ChangeLog.xml
@@ -6,6 +6,11 @@
 	<project name="Expresso">
 		<version name="5.7" releaseDate="Not released yet">
 			<comment>Continued Updates</comment>
+			<new-feature title="IfErrorExists tag now supports the 'inverse' attribue">
+				<explanation>The IfErrorExists tag contained in the expresso taglib now supports inverse.
+                </explanation>
+				<contributor>Francesco Galli</contributor>
+			</new-feature>
 			<new-feature title="Struts extended tags now support xhtml">
 				<explanation>The struts extended tags now support xhtml in the same way is is supported under struts, through the use
 				of &lt;html:html xhtml="true"&gt;.
Index: taglib.xml
===================================================================
RCS file: /home/javacorp/.cvs/expresso/expresso/expresso-web/expresso/doc/edg/taglib.xml,v
retrieving revision 1.21
retrieving revision 1.22
diff -Lexpresso-web/expresso/doc/edg/taglib.xml -Lexpresso-web/expresso/doc/edg/taglib.xml -u -r1.21 -r1.22
--- expresso-web/expresso/doc/edg/taglib.xml
+++ expresso-web/expresso/doc/edg/taglib.xml
@@ -1142,6 +1142,26 @@
 			<para>
 If finds the Expresso ErrorCollection in the page context, then the body
 of the tag will be processed. No tag attributes are needed.
+				<table>
+					<title>IfErrorExists Attributes</title>
+					<tgroup cols='2'>
+						<tbody>
+							<row>
+								<entry>
+<emphasis role='bold'>Attribute Name</emphasis>
+								</entry>
+								<entry>
+<emphasis role='bold'>Description</emphasis>
+								</entry>
+							</row>
+							<row>
+								<entry>inverse</entry>
+								<entry>If this attribute is set to true, the tag will mean
+                "IfNotErrorExists". [RT Expr]</entry>
+							</row>
+						</tbody>
+					</tgroup>
+				</table>
 			</para>
 		</sect2>
 		<sect2>


More information about the cvs mailing list