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

Modified Files:
        QueryAddNodeTag.java 
Log Message:
made element attribute optional if query is a NodeQuery


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


Index: QueryAddNodeTag.java
===================================================================
RCS file: 
/var/cvs/applications/taglib/src/org/mmbase/bridge/jsp/taglib/containers/QueryAddNodeTag.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- QueryAddNodeTag.java        17 Jul 2008 13:53:16 -0000      1.1
+++ QueryAddNodeTag.java        24 Jul 2008 08:54:02 -0000      1.2
@@ -13,7 +13,7 @@
 
 import org.mmbase.bridge.*;
 import org.mmbase.bridge.util.Queries;
-import org.mmbase.bridge.jsp.taglib.ContextReferrerTag;
+import org.mmbase.bridge.jsp.taglib.*;
 import org.mmbase.bridge.jsp.taglib.util.Attribute;
 import org.mmbase.storage.search.*;
 //import org.mmbase.util.logging.*;
@@ -22,7 +22,7 @@
  *
  * @author Michiel Meeuwissen
  * @since  MMBase-1.9
- * @version $Id: QueryAddNodeTag.java,v 1.1 2008/07/17 13:53:16 michiel Exp $
+ * @version $Id: QueryAddNodeTag.java,v 1.2 2008/07/24 08:54:02 michiel Exp $
  */
 public class QueryAddNodeTag extends ContextReferrerTag implements 
QueryContainerReferrer {
 
@@ -33,11 +33,11 @@
     protected Attribute node         = Attribute.NULL;
 
     public void setContainer(String c) throws JspTagException {
-        container = getAttribute(c);
+        container = getAttribute(c, true);
     }
 
     public void setElement(String e) throws JspTagException {
-        element = getAttribute(e);
+        element = getAttribute(e, true);
     }
     public void setNumber(String n) throws JspTagException {
         node = getAttribute(n);
@@ -45,7 +45,16 @@
 
     public int doStartTag() throws JspTagException {
         Query query = getQuery(container);
-        Step step = query.getStep(element.getString(this));
+        Step step;
+        if (element == Attribute.NULL) {
+            if (query instanceof NodeQuery) {
+                step = ((NodeQuery) query).getNodeStep();
+            } else {
+                throw new TaglibException("No element specified, and the query 
is no node-query");
+            }
+        } else {
+            step = query.getStep(element.getString(this));
+        }
 
         for (String n : node.getList(this)) {
             query.addNode(step, Integer.parseInt(n));
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs

Reply via email to