cmlenz 02/03/22 05:21:31
Modified: src/doc struts-taglib.xml
src/taglib slide-struts.tld
src/taglib/struts/org/apache/slide/taglib/tag/struts
NodeTag.java
Log:
Added the option to specify the URI of the node to access by the
<slide:node> tag by using bean lookup, with the attributes 'uriName',
'uriProperty' and 'uriScope', trying to keep close to the terminology used
by the Struts taglibs.
Revision Changes Path
1.8 +34 -1 jakarta-slide/src/doc/struts-taglib.xml
Index: struts-taglib.xml
===================================================================
RCS file: /home/cvs/jakarta-slide/src/doc/struts-taglib.xml,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- struts-taglib.xml 20 Mar 2002 16:03:27 -0000 1.7
+++ struts-taglib.xml 22 Mar 2002 13:21:31 -0000 1.8
@@ -258,11 +258,44 @@
</attribute>
<attribute>
<name>uri</name>
- <required>true</required>
+ <required>false</required>
<rtexprvalue>true</rtexprvalue>
<info>
<p>
Specifies the URI of the node to access.
+ </p>
+ </info>
+ </attribute>
+ <attribute>
+ <name>uriName</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ <info>
+ <p>
+ The name of the bean containing the URI of the node to access.
+ </p>
+ </info>
+ </attribute>
+ <attribute>
+ <name>uriProperty</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ <info>
+ <p>
+ Name of the property of the bean specified by
+ <code>uriName</code>, whose getter returns the URI of the node to
+ access.
+ </p>
+ </info>
+ </attribute>
+ <attribute>
+ <name>uriScope</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ <info>
+ <p>
+ The bean scope within which to search for the bean named by the
+ <code>uriName</code> property, or 'any scope' if not specified.
</p>
</info>
</attribute>
1.7 +16 -1 jakarta-slide/src/taglib/slide-struts.tld
Index: slide-struts.tld
===================================================================
RCS file: /home/cvs/jakarta-slide/src/taglib/slide-struts.tld,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- slide-struts.tld 27 Jan 2002 17:16:22 -0000 1.6
+++ slide-struts.tld 22 Mar 2002 13:21:31 -0000 1.7
@@ -51,7 +51,22 @@
<bodycontent>JSP</bodycontent>
<attribute>
<name>uri</name>
- <required>true</required>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>uriName</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>uriProperty</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>uriScope</name>
+ <required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
1.3 +106 -4
jakarta-slide/src/taglib/struts/org/apache/slide/taglib/tag/struts/NodeTag.java
Index: NodeTag.java
===================================================================
RCS file:
/home/cvs/jakarta-slide/src/taglib/struts/org/apache/slide/taglib/tag/struts/NodeTag.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- NodeTag.java 21 Sep 2001 16:59:02 -0000 1.2
+++ NodeTag.java 22 Mar 2002 13:21:31 -0000 1.3
@@ -1,7 +1,7 @@
/*
- * $Header:
/home/cvs/jakarta-slide/src/taglib/struts/org/apache/slide/taglib/tag/struts/NodeTag.java,v
1.2 2001/09/21 16:59:02 cmlenz Exp $
- * $Revision: 1.2 $
- * $Date: 2001/09/21 16:59:02 $
+ * $Header:
/home/cvs/jakarta-slide/src/taglib/struts/org/apache/slide/taglib/tag/struts/NodeTag.java,v
1.3 2002/03/22 13:21:31 cmlenz Exp $
+ * $Revision: 1.3 $
+ * $Date: 2002/03/22 13:21:31 $
*
* ====================================================================
*
@@ -70,18 +70,40 @@
import org.apache.slide.taglib.bean.NamespaceBean;
import org.apache.slide.taglib.bean.NodeBean;
import org.apache.slide.taglib.tag.NodeTagSupport;
+import org.apache.struts.util.RequestUtils;
/**
* Tag class for tags that represent a particular node in a Slide namespace.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Christopher Lenz</a>
- * @version $Revision: 1.2 $
+ * @version $Revision: 1.3 $
*/
public class NodeTag
extends NodeTagSupport {
+ // ---------------------------------------------------------- Instance Data
+
+
+ /**
+ * Value of the 'uriName' attribute.
+ */
+ protected String uriName;
+
+
+ /**
+ * Value of the 'uriProperty' attribute.
+ */
+ protected String uriProperty;
+
+
+ /**
+ * Value of the 'uriScope' attribute.
+ */
+ protected String uriScope;
+
+
// ------------------------------------------------------------ Tag Methods
@@ -93,6 +115,20 @@
public int doStartTag()
throws JspException {
+ if (uri == null) {
+ // the URI was not explicitly set, so it must be specified by a
+ // bean property, using the attribute 'uriName' and optionally
+ // 'uriProperty' and 'uriScope'
+ if (uriName == null) {
+ throw new JspException("Either attribute 'uri' or attribute " +
+ "'uriName'/'uriProperty' must be set " +
+ "for the <slide:node> tag.");
+ }
+ uri = (String)
+ RequestUtils.lookup(pageContext, uriName, uriProperty,
+ uriScope);
+ }
+
// parse the resolveLinks attribute
boolean rl = true;
if (resolveLinks != null) {
@@ -131,6 +167,72 @@
public void setId(String id) {
attrName = id;
+ }
+
+
+ /**
+ * Returns the 'uriName' attribute.
+ *
+ * @return value of the 'uriName' attribute
+ */
+ public String getUriName() {
+
+ return uriName;
+ }
+
+
+ /**
+ * Set the 'uriName' attribute.
+ *
+ * @param uriName the attribute value
+ */
+ public void setUriName(String uriName) {
+
+ this.uriName = uriName;
+ }
+
+
+ /**
+ * Returns the 'uriProperty' attribute.
+ *
+ * @return value of the 'uriProperty' attribute
+ */
+ public String getUriProperty() {
+
+ return uriProperty;
+ }
+
+
+ /**
+ * Set the 'uriProperty' attribute.
+ *
+ * @param uriName the attribute value
+ */
+ public void setUriProperty(String uriProperty) {
+
+ this.uriProperty = uriProperty;
+ }
+
+
+ /**
+ * Returns the 'uriScope' attribute.
+ *
+ * @return value of the 'uriScope' attribute
+ */
+ public String getUriScope() {
+
+ return uriScope;
+ }
+
+
+ /**
+ * Set the 'uriScope' attribute.
+ *
+ * @param uriName the attribute value
+ */
+ public void setUriScope(String uriScope) {
+
+ this.uriScope = uriScope;
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>