Author: michiel
Date: 2009-09-17 16:43:09 +0200 (Thu, 17 Sep 2009)
New Revision: 38670
Modified:
mmbase/trunk/applications/taglib/src/main/java/org/mmbase/bridge/jsp/taglib/NodeTag.java
Log:
added the attribute emptynumberiscurrentnode
Modified:
mmbase/trunk/applications/taglib/src/main/java/org/mmbase/bridge/jsp/taglib/NodeTag.java
===================================================================
---
mmbase/trunk/applications/taglib/src/main/java/org/mmbase/bridge/jsp/taglib/NodeTag.java
2009-09-17 14:06:44 UTC (rev 38669)
+++
mmbase/trunk/applications/taglib/src/main/java/org/mmbase/bridge/jsp/taglib/NodeTag.java
2009-09-17 14:43:09 UTC (rev 38670)
@@ -38,6 +38,8 @@
private Attribute element = Attribute.NULL;
private Attribute notfound = Attribute.NULL;
+ private Attribute emptyNumberIsCurrentNode = Attribute.NULL;
+
/**
* Release all allocated resources.
*/
@@ -57,7 +59,14 @@
this.number = getAttribute(number, false);
}
+ /**
+ * @since MMBase-1.9.2
+ */
+ public void setEmptynumberiscurrentnode(String e) throws JspTagException {
+ this.emptyNumberIsCurrentNode = getAttribute(e, false);
+ }
+
public void setNotfound(String i) throws JspTagException {
notfound = getAttribute(i, true);
}
@@ -137,34 +146,8 @@
// We don't change this, because it was always like follows.
// It would not be backwards compatible.
- if (number != Attribute.NULL) {
- // explicity indicated which node (by number or alias)
- Cloud c = getCloudVar();
- if (! c.hasNode(n) || ! c.mayRead(n)) {
- switch(Notfound.get(notfound, this)) {
- case Notfound.MESSAGE:
- try {
- getPageContext().getOut().write("Node '" + n + "'
does not exist or may not be read");
- } catch (java.io.IOException ioe) {
- log.warn(ioe);
- }
- case Notfound.SKIP:
- return SKIP_BODY;
- case Notfound.PROVIDENULL:
- node = null;
- break;
- default:
- node = c.getNode(n); // throws Exception
- }
- } else {
- node = c.getNode(n); // does not throw Exception
- }
- if (node != null) {
- if
(node.getCloud().hasNodeManager(node.getNodeManager().getName())) { // rather
clumsy way to check virtuality
-
nodeHelper.setGeneratingQuery(Queries.createNodeQuery(node));
- }
- }
- } else {
+ if (number == Attribute.NULL ||
+ (n.length() == 0 && emptyNumberIsCurrentNode.getBoolean(this,
false))) {
// get the node from a parent element.
NodeProvider nodeProvider = null;
@@ -176,7 +159,7 @@
} else {
node = (Node) org.mmbase.util.Casting.unWrap(node);
}
-
+
String elString = element.getString(this);
if (elString.length() != 0) {
try {
@@ -214,6 +197,33 @@
nodeHelper.setGeneratingQuery(Queries.createNodeQuery(node));
}
}
+ } else {
+ // explicity indicated which node (by number or alias)
+ Cloud c = getCloudVar();
+ if (! c.hasNode(n) || ! c.mayRead(n)) {
+ switch(Notfound.get(notfound, this)) {
+ case Notfound.MESSAGE:
+ try {
+ getPageContext().getOut().write("Node '" + n + "'
does not exist or may not be read");
+ } catch (java.io.IOException ioe) {
+ log.warn(ioe);
+ }
+ case Notfound.SKIP:
+ return SKIP_BODY;
+ case Notfound.PROVIDENULL:
+ node = null;
+ break;
+ default:
+ node = c.getNode(n); // throws Exception
+ }
+ } else {
+ node = c.getNode(n); // does not throw Exception
+ }
+ if (node != null) {
+ if
(node.getCloud().hasNodeManager(node.getNodeManager().getName())) { // rather
clumsy way to check virtuality
+
nodeHelper.setGeneratingQuery(Queries.createNodeQuery(node));
+ }
+ }
}
}
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs