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

Modified Files:
        FieldInfoTag.java 
Log Message:
introduces also 'defaultvalue' which also serves as fall back for node-less 
operation


See also: 
http://cvs.mmbase.org/viewcvs/applications/taglib/src/org/mmbase/bridge/jsp/taglib


Index: FieldInfoTag.java
===================================================================
RCS file: 
/var/cvs/applications/taglib/src/org/mmbase/bridge/jsp/taglib/FieldInfoTag.java,v
retrieving revision 1.113
retrieving revision 1.114
diff -u -b -r1.113 -r1.114
--- FieldInfoTag.java   19 Aug 2008 09:41:24 -0000      1.113
+++ FieldInfoTag.java   22 Aug 2008 13:02:07 -0000      1.114
@@ -43,7 +43,7 @@
  * @author Michiel Meeuwissen
  * @author Jaco de Groot
  * @author Gerard van de Looi
- * @version $Id: FieldInfoTag.java,v 1.113 2008/08/19 09:41:24 michiel Exp $
+ * @version $Id: FieldInfoTag.java,v 1.114 2008/08/22 13:02:07 michiel Exp $
  */
 public class FieldInfoTag extends FieldReferrerTag implements Writer {
     private static Logger log;
@@ -74,6 +74,7 @@
     protected static final int TYPE_DATATYPEDESCRIPTION = 9;
     protected static final int TYPE_DATATYPEXML   = 10;
     protected static final int TYPE_FORID   = 11;
+    protected static final int TYPE_DEFAULTVALUE  = 12;
 
     protected static final int TYPE_UNSET     = 100;
 
@@ -107,6 +108,7 @@
     // public would be defendable because typehandlers perhaps could need it.
     protected int getType() throws JspTagException {
         String t = type.getString(this).toLowerCase();
+        log.debug(t);
         if ("".equals(t)) {
             return TYPE_UNSET;
         } else if ("name".equals(t)) {
@@ -117,6 +119,8 @@
             return TYPE_VALUE;
         } else if ("guivalue".equals(t)) {
             return TYPE_GUIVALUE;
+        } else if ("guivalue".equals(t)) {
+            return TYPE_DEFAULTVALUE;
        } else if ("type".equals(t)) {
             return TYPE_TYPE;
        } else if ("typedescription".equals(t)) {
@@ -286,7 +290,9 @@
                     private final Field f = new DataTypeField(getCloudVar(), 
dt);
                     public Field getFieldVar() { return f; }
                     public String getId() { return null; }
-                    public Node getNodeVar() throws JspTagException { return 
FieldInfoTag.this.getNode(); }
+                    public Node getNodeVar() throws JspTagException {
+                        return FieldInfoTag.this.getNode(false);
+                    }
 
                 };
             field = fieldProvider.getFieldVar();
@@ -340,7 +346,7 @@
                 if (node != null) {
                     infoType = TYPE_GUIVALUE;
                 } else {
-                    infoType = TYPE_UNSET;
+                    infoType = TYPE_DEFAULTVALUE;
                 }
             }
             break;
@@ -349,7 +355,7 @@
         case TYPE_USEINPUT:
             if (field.isReadOnly()) {
                 // ignore useinput
-                infoType = TYPE_UNSET;
+                infoType = TYPE_DEFAULTVALUE;
                 break;
             }
         case TYPE_VALUE:
@@ -369,6 +375,7 @@
         }
 
         Locale locale = getLocale();;
+        log.debug("Using locale " + locale);
 
         switch(infoType) {
         case TYPE_NAME:
@@ -461,6 +468,11 @@
         case TYPE_DATATYPEDESCRIPTION:
             show = dataType.getLocalizedDescription().get(locale);
             break;
+        case TYPE_DEFAULTVALUE:
+            show = Casting.toString(dataType.getDefaultValue(locale, 
getCloudVar(), field));
+            break;
+        case TYPE_UNSET:
+            throw new JspTagException("Type attribute not used");
         default:
             log.debug("Unknown info type " + infoType);
             break;
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs

Reply via email to