Update of /var/cvs/applications/taglib/src/org/mmbase/bridge/jsp/taglib
In directory james.mmbase.org:/tmp/cvs-serv31263

Modified Files:
        FieldInfoTag.java 
Log Message:
  MMB-1589. Made it possible to also set the datatype using a variable which 
already has type DataType


See also: 
http://cvs.mmbase.org/viewcvs/applications/taglib/src/org/mmbase/bridge/jsp/taglib
See also: http://www.mmbase.org/jira/browse/MMB-1589


Index: FieldInfoTag.java
===================================================================
RCS file: 
/var/cvs/applications/taglib/src/org/mmbase/bridge/jsp/taglib/FieldInfoTag.java,v
retrieving revision 1.114
retrieving revision 1.115
diff -u -b -r1.114 -r1.115
--- FieldInfoTag.java   22 Aug 2008 13:02:07 -0000      1.114
+++ FieldInfoTag.java   2 Sep 2008 11:34:43 -0000       1.115
@@ -43,7 +43,7 @@
  * @author Michiel Meeuwissen
  * @author Jaco de Groot
  * @author Gerard van de Looi
- * @version $Id: FieldInfoTag.java,v 1.114 2008/08/22 13:02:07 michiel Exp $
+ * @version $Id: FieldInfoTag.java,v 1.115 2008/09/02 11:34:43 michiel Exp $
  */
 public class FieldInfoTag extends FieldReferrerTag implements Writer {
     private static Logger log;
@@ -163,17 +163,29 @@
     }
 
     private Attribute dataType = Attribute.NULL;
+    private DataType specifiedDataType = null;
+
     /**
      * @since MMBase-1.8
      */
     public void setDatatype(String d) throws JspTagException {
-        dataType = getAttribute(d, true);
+        dataType = getAttribute((String) d);
+        specifiedDataType = null;
     }
     /**
+     * @since MMBase-1.8.7
+     */
+    public void setDatatype(DataType d) throws JspTagException {
+        specifiedDataType = d;
+        dataType = Attribute.NULL;
+    }
+
+    /**
      * @since MMBase-1.8
      */
     public DataType getDataType() throws JspTagException {
         if (dataType != Attribute.NULL) {
+            if (specifiedDataType != null) throw new RuntimeException();
             String name = dataType.getString(this);
             DataType dt = null;
             DataTypeCollector collector = (DataTypeCollector) 
pageContext.getAttribute(DataTypeTag.KEY, DataTypeTag.SCOPE);
@@ -184,11 +196,11 @@
                 dt =  DataTypes.getDataType(name);
             }
             if (dt == null) {
-                throw new JspTagException("No datatype '" + dataType + "'");
+                throw new JspTagException("No datatype '" + name + "'");
             }
             return dt;
         } else {
-            return null;
+            return specifiedDataType;
         }
     }
 
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs

Reply via email to