Author: michiel
Date: 2010-06-03 11:41:25 +0200 (Thu, 03 Jun 2010)
New Revision: 42400
Added:
mmbase/trunk/applications/taglib/src/main/java/org/mmbase/bridge/jsp/taglib/NodeManagerTEI.java
mmbase/trunk/applications/taglib/src/main/java/org/mmbase/bridge/jsp/taglib/NodeManagerTag.java
Log:
a tag to provide a nodemanager as a node
Copied:
mmbase/trunk/applications/taglib/src/main/java/org/mmbase/bridge/jsp/taglib/NodeManagerTEI.java
(from rev 42399,
mmbase/branches/MMBase-1_9/applications/taglib/src/main/java/org/mmbase/bridge/jsp/taglib/NodeManagerTEI.java)
===================================================================
---
mmbase/trunk/applications/taglib/src/main/java/org/mmbase/bridge/jsp/taglib/NodeManagerTEI.java
(rev 0)
+++
mmbase/trunk/applications/taglib/src/main/java/org/mmbase/bridge/jsp/taglib/NodeManagerTEI.java
2010-06-03 09:41:25 UTC (rev 42400)
@@ -0,0 +1,46 @@
+/*
+
+This software is OSI Certified Open Source Software.
+OSI Certified is a certification mark of the Open Source Initiative.
+
+The license (Mozilla version 1.0) can be read at the MMBase site.
+See http://www.MMBase.org/license
+
+*/
+package org.mmbase.bridge.jsp.taglib;
+
+import org.mmbase.bridge.NodeManager;
+import javax.servlet.jsp.tagext.VariableInfo;
+import javax.servlet.jsp.tagext.TagData;
+import javax.servlet.jsp.tagext.TagExtraInfo;
+
+/**
+ * The TEI class for NodeProviders. A NodeProvider can export one or more
+ * 'Nodes', and it also can export fields (if the `fields' attribute is
+ * given).
+ *
+ * @author Michiel Meeuwissen
+ * @version $Id: NodeProviderTEI.java 35335 2009-05-21 08:14:41Z michiel $
+ */
+
+public class NodeManagerTEI extends TagExtraInfo {
+
+ public NodeManagerTEI() {
+ super();
+ }
+
+ public VariableInfo[] getVariableInfo(TagData data){
+ String id = "";
+ Object idObject = data.getAttribute("jspvar");
+ if (idObject != null){
+ id = "" + idObject;
+ }
+ VariableInfo[] variableInfo = new VariableInfo[1];
+ variableInfo[0] = new VariableInfo(id,
+ NodeManager.class.getName(),
+ true,
+ VariableInfo.NESTED);
+ return variableInfo;
+ }
+
+}
Copied:
mmbase/trunk/applications/taglib/src/main/java/org/mmbase/bridge/jsp/taglib/NodeManagerTag.java
(from rev 42399,
mmbase/branches/MMBase-1_9/applications/taglib/src/main/java/org/mmbase/bridge/jsp/taglib/NodeManagerTag.java)
===================================================================
---
mmbase/trunk/applications/taglib/src/main/java/org/mmbase/bridge/jsp/taglib/NodeManagerTag.java
(rev 0)
+++
mmbase/trunk/applications/taglib/src/main/java/org/mmbase/bridge/jsp/taglib/NodeManagerTag.java
2010-06-03 09:41:25 UTC (rev 42400)
@@ -0,0 +1,79 @@
+/*
+
+This software is OSI Certified Open Source Software.
+OSI Certified is a certification mark of the Open Source Initiative.
+
+The license (Mozilla version 1.0) can be read at the MMBase site.
+See http://www.MMBase.org/license
+
+*/
+package org.mmbase.bridge.jsp.taglib;
+
+import java.io.IOException;
+
+import javax.servlet.jsp.JspTagException;
+import javax.servlet.jsp.tagext.BodyTag;
+
+import org.mmbase.bridge.*;
+import org.mmbase.bridge.util.Queries;
+import org.mmbase.bridge.jsp.taglib.util.Attribute;
+import org.mmbase.bridge.jsp.taglib.util.Notfound;
+
+import org.mmbase.util.logging.Logger;
+import org.mmbase.util.logging.Logging;
+
+/**
+ * NodeTag provides the fields of a node
+ *
+ * @author Michiel Meeuwissen
+ * @version $Id: NodeTag.java 38670 2009-09-17 14:43:09Z michiel $
+ */
+
+public class NodeManagerTag extends AbstractNodeProviderTag implements BodyTag
{
+ private static final Logger log =
Logging.getLoggerInstance(NodeManagerTag.class);
+
+ private Attribute name = Attribute.NULL;
+ private Attribute notfound = Attribute.NULL;
+
+
+ public void setName(String n) throws JspTagException {
+ this.name = getAttribute(n, false);
+ }
+
+ public void setNotfound(String i) throws JspTagException {
+ notfound = getAttribute(i, true);
+ }
+
+
+ public int doStartTag() throws JspTagException{
+ NodeManager node = getCloudVar().getNodeManager(name.getString(this));
+ setNodeVar(node);
+ fillVars();
+ //log.debug("found node " + node.getValue("gui()"));
+ return EVAL_BODY;
+ }
+
+
+ /**
+ * this method writes the content of the body back to the jsp page
+ **/
+ public int doAfterBody() throws JspTagException { // write the body if
there was one
+ if (EVAL_BODY == EVAL_BODY_BUFFERED) {
+ if (bodyContent != null) {
+ try {
+ bodyContent.writeOut(bodyContent.getEnclosingWriter());
+ } catch (IOException ioe){
+ throw new TaglibException(ioe);
+ }
+ }
+ }
+ return SKIP_BODY;
+ }
+
+
+ public int doEndTag() throws JspTagException {
+ super.doAfterBody(); // if modified
+ return super.doEndTag();
+ }
+
+}
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs