cmlenz      2002/08/01 09:43:27

  Modified:    src/taglib slide-jstl.tld
  Added:       src/taglib/common/org/apache/slide/taglib/tag
                        SetNodeTagSupport.java SetRevisionTagSupport.java
               src/taglib/jstl/org/apache/slide/taglib/tag/jstl
                        SetNodeTag.java SetRevisionTag.java
  Log:
  More new tags for the non-nested mode.
  I'll have to improve code-reuse between the two variants somehow
  
  Revision  Changes    Path
  1.1                  
jakarta-slide/src/taglib/common/org/apache/slide/taglib/tag/SetNodeTagSupport.java
  
  Index: SetNodeTagSupport.java
  ===================================================================
  /*
   * $Header: 
/home/cvs/jakarta-slide/src/taglib/common/org/apache/slide/taglib/tag/NodeTagSupport.java,v
 1.5 2002/08/01 15:43:53 cmlenz Exp $
   * $Revision: 1.5 $
   * $Date: 2002/08/01 15:43:53 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:  
   *       "This product includes software developed by the 
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. the names "The Jakarta Project", "Slide", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written 
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */ 
  
  package org.apache.slide.taglib.tag;
  
  import javax.servlet.jsp.JspException;
  import javax.servlet.jsp.PageContext;
  import javax.servlet.jsp.tagext.TagSupport;
  
  import org.apache.slide.common.SlideException;
  import org.apache.slide.taglib.bean.NamespaceBean;
  import org.apache.slide.taglib.bean.NodeBean;
  import org.apache.slide.taglib.util.Scopes;
  
  /**
   * Abstract foundation for tags that serve to select a particular 
   * <code>ObjectNode</code> in a Slide namespace (identified by the node's URI),
   * and expose a corresponding 
   * {@link org.apache.slide.taglib.bean.NodeBean NodeBean} as scripting 
   * variable.
   * 
   * @author <a href="mailto:[EMAIL PROTECTED]";>Christopher Lenz</a>
   * @version $Revision: 1.5 $
   */
  public abstract class SetNodeTagSupport
      extends TagSupport {
      
      
      // ----------------------------------------------------- Instance Variables
      
      
      /**
       * The associated bean that will be put in the PageContext attributes.
       */
      protected NodeBean node;
      
      
      /**
       * Value of 'uri' attribute.
       */
      protected String uri;
      
      
      /**
       * Value of 'resolveLinks' attribute.
       */
      protected String resolveLinks;
      
      
      /**
       * Name of the PageContext attribute under which the bean should be stored.
       */
      protected String attrName;
      
      
      /**
       * Scope where the PageContext should be stored.
       */
      private int scope;
      
      
      // ----------------------------------------------------------- Construction
      
      
      /**
       * Initialize inherited and local state.
       */
      public SetNodeTagSupport() {
          super();
          
          init();
      }
      
      
      // ------------------------------------------------------------ Tag Methods
      
      
      /**
       * Called by the JSP Engine when closing of this tag.
       *
       * @throws JspException not thrown
       */
      public int doEndTag()
          throws JspException {
          super.doEndTag();
          
          if (node != null) {
              pageContext.setAttribute(attrName, node, scope);
          }
          init();
          
          return EVAL_PAGE;
      }
      
      
      /**
       * Releases any resources we may have (or inherit).
       */
      public void release() {
          super.release();
          
          init();
      }
      
      
      // ------------------------------------------------------------- Properties
      
      
      /**
       * Sets the 'resolveLinks' attribute.
       *
       * @param resolveLinks the attribute value
       */
      public void setResolveLinks(String resolveLinks) {
          
          this.resolveLinks = resolveLinks;
      }
      
      
      /**
       * Sets the 'scope' attribute.
       * 
       * @param scope the attribute value
       */
      public void setScope(String scope) {
          
          this.scope = Scopes.valueOf(scope);
      }
      
      
      /**
       * Sets the 'uri' attribute.
       *
       * @param uri the attribute value
       */
      public void setUri(String uri) {
          
          this.uri = uri;
      }
      
      
      // ------------------------------------------------------ Protected Methods
      
      
      /**
       * Convenience method to support subclasses in retrieving the chosen node
       * from the namespace, and wrapping it in a 
       * {@link org.apache.slide.taglib.bean.NodeBean NodeBean}.
       * 
       * @param namespace the bean that represents the selected namespace
       * @param uri the URI of the node to retrieve
       * @param resolveLinks whether to resolve links when retrieving the node
       */
      protected NodeBean getNode(NamespaceBean namespace, String uri,
                                 boolean resolveLinks) {
          
          NodeBean bean = null;
          if ((namespace != null) && (uri != null)) {
              try {
                  bean = namespace.getNode(uri, resolveLinks);
              } catch (SlideException e) {
                  // ignore for now
              }
          }
          
          return bean;
      }
      
      
      // -------------------------------------------------------- Private Methods
      
      
      /**
       * Reset internal state.
       */
      private void init() {
          
          node = null;
          uri = null;
          resolveLinks = null;
          attrName = null;
          scope = PageContext.PAGE_SCOPE;
      }
      
      
  }
  
  
  
  
  
  1.1                  
jakarta-slide/src/taglib/common/org/apache/slide/taglib/tag/SetRevisionTagSupport.java
  
  Index: SetRevisionTagSupport.java
  ===================================================================
  /*
   * $Header: 
/home/cvs/jakarta-slide/src/taglib/common/org/apache/slide/taglib/tag/RevisionTagSupport.java,v
 1.5 2002/08/01 15:43:53 cmlenz Exp $
   * $Revision: 1.5 $
   * $Date: 2002/08/01 15:43:53 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:  
   *       "This product includes software developed by the 
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. the names "The Jakarta Project", "Slide", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written 
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */ 
  
  package org.apache.slide.taglib.tag;
  
  import javax.servlet.jsp.JspException;
  import javax.servlet.jsp.PageContext;
  import javax.servlet.jsp.tagext.TagSupport;
  
  import org.apache.slide.content.NodeRevisionNumber;
  import org.apache.slide.taglib.bean.NodeBean;
  import org.apache.slide.taglib.bean.RevisionBean;
  import org.apache.slide.taglib.util.Scopes;
  
  /**
   * Abstract foundation for tags that serve to select a revision of an object, 
   * and expose a corresponding
   * {@link org.apache.slide.taglib.bean.RevisionBean RevisionBean} as scripting 
   * variable.
   * 
   * @author <a href="mailto:[EMAIL PROTECTED]";>Christopher Lenz</a>
   * @version $Revision: 1.5 $
   */
  public abstract class SetRevisionTagSupport
      extends TagSupport {
      
      
      // ----------------------------------------------------- Instance Variables
      
      
      /**
       * The associated bean that will be put in the PageContext attributes.
       */
      protected RevisionBean revision;
      
      
      /**
       * Value of 'number' attribute.
       */
      protected String number;
      
      
      /**
       * Value of 'branch' attribute.
       */
      protected String branch;
      
      
      /**
       * Name of the PageContext attribute under which the bean is stored.
       */
      protected String attrName;
      
      
      /**
       * Scope where the PageContext should be stored.
       */
      private int scope;
      
      
      // ----------------------------------------------------------- Construction
      
      
      /**
       * Initialize inherited and local state.
       */
      public SetRevisionTagSupport() {
          super();
          
          init();
      }
      
      
      // ------------------------------------------------------------ Tag Methods
      
      
      /**
       * Called by the JSP Engine when closing of this tag.
       *
       * @throws JspException Not thrown
       */
      public int doEndTag()
          throws JspException {
          super.doEndTag();
          
          if (revision != null) {
              pageContext.setAttribute(attrName, revision, scope);
          }
          init();
          
          return EVAL_PAGE;
      }
      
      
      /**
       * Releases any resources we may have (or inherit).
       */
      public void release() {
          super.release();
          
          init();
      }
      
      
      // ------------------------------------------------------------- Properties
      
      
      /**
       * Sets the 'number' attribute.
       *
       * @param number the attribute value
       */
      public void setNumber(String number) {
          
          this.number = number;
      }
      
      
      /**
       * Sets the 'branch' attribute.
       *
       * @param branch the attribute value
       */
      public void setBranch(String branch) {
          
          this.branch = branch;
      }
      
      
      /**
       * Sets the 'scope' attribute.
       * 
       * @param scope the attribute value
       */
      public void setScope(String scope) {
          
          this.scope = Scopes.valueOf(scope);
      }
      
      
      // ------------------------------------------------------ Protected Methods
      
      
      /**
       * Convenience method to support subclasses in getting a specific revision 
       * of a node, and wrapping it in a 
       * {@link org.apache.slide.taglib.bean.RevisionBean RevisionBean}.
       * 
       * <p>Either specify the <code>number</code> or the <code>branch</code> 
       * argument. If both are specified, the <code>number</code> argument takes 
       * precedence.</p>
       * 
       * @param node the node of which the revision should be retrieved
       * @param number version number of the revision to retrieve
       * @param branch name of the branch of which to retrieve the latest 
       *        revision
       */
      protected RevisionBean getRevision(NodeBean node, 
                                         NodeRevisionNumber number,
                                         String branch) {
          if (node == null) {
              throw new NullPointerException();
          }
          
          RevisionBean bean = null;
          if (number != null) {
              bean = node.getRevision(number);
          } else if ((branch != null) && (branch.length() > 0)) {
              bean = node.getRevision(branch);
          } else {
              bean = node.getLatestRevision();
          }
          
          return bean;
      }
      
      
      // -------------------------------------------------------- Private Methods
      
      
      /**
       * Reset internal state.
       */
      private void init() {
          
          revision = null;
          number = null;
          branch = null;
          attrName = null;
          scope = PageContext.PAGE_SCOPE;
      }
      
      
  }
  
  
  
  
  
  1.1                  
jakarta-slide/src/taglib/jstl/org/apache/slide/taglib/tag/jstl/SetNodeTag.java
  
  Index: SetNodeTag.java
  ===================================================================
  /*
   * $Header: 
/home/cvs/jakarta-slide/src/taglib/jstl/org/apache/slide/taglib/tag/jstl/NodeTag.java,v
 1.3 2002/08/01 15:43:52 cmlenz Exp $
   * $Revision: 1.3 $
   * $Date: 2002/08/01 15:43:52 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:  
   *       "This product includes software developed by the 
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. the names "The Jakarta Project", "Slide", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written 
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */ 
  
  package org.apache.slide.taglib.tag.jstl;
  
  import javax.servlet.jsp.JspException;
  
  import org.apache.slide.taglib.bean.NamespaceBean;
  import org.apache.slide.taglib.tag.SetNodeTagSupport;
  
  
  /**
   * 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.3 $
   */
  public class SetNodeTag
      extends SetNodeTagSupport {
      
      
      // ------------------------------------------------------------ Tag Methods
      
      
      /**
       * Called by the JSP Engine when closing this tag.
       *
       * @throws JspException thrown on bad expressions
       */
      public int doEndTag()
          throws JspException {
          
          // evaluate the 'uri' attribute
          String evalUri = (String)
              JstlTagUtils.evaluateRequiredAttribute("node", "uri", uri,
                                                     String.class, this,
                                                     pageContext);
          
          // evaluate the 'resolveLinks' attribute
          Boolean evalResolveLinks = (Boolean)
              JstlTagUtils.evaluateOptionalAttribute("node", "resolveLinks",
                                                     resolveLinks, Boolean.class,
                                                     this, pageContext);
          
          // we trust the 'uri' attribute to be != null, because it is specified
          // as required attribute in the TLD
          NamespaceBean namespace = 
              JstlTagUtils.findNamespace(this, pageContext);
          node = getNode(namespace, evalUri, evalResolveLinks != null ? 
                                             evalResolveLinks.booleanValue() : 
                                             true);
          
          return super.doEndTag();
      }
      
      
      // --------------------------------------------------------- Public Methods
      
      
      /**
       * Set the 'var' attribute.
       *
       * @param var the attribute value
       */
      public void setVar(String var) {
          
          attrName = var;
      }
      
      
  }
  
  
  
  
  1.1                  
jakarta-slide/src/taglib/jstl/org/apache/slide/taglib/tag/jstl/SetRevisionTag.java
  
  Index: SetRevisionTag.java
  ===================================================================
  /*
   * $Header: 
/home/cvs/jakarta-slide/src/taglib/jstl/org/apache/slide/taglib/tag/jstl/RevisionTag.java,v
 1.3 2002/08/01 15:43:52 cmlenz Exp $
   * $Revision: 1.3 $
   * $Date: 2002/08/01 15:43:52 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:  
   *       "This product includes software developed by the 
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. the names "The Jakarta Project", "Slide", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written 
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */ 
  
  package org.apache.slide.taglib.tag.jstl;
  
  import javax.servlet.jsp.JspException;
  import javax.servlet.jsp.JspTagException;
  
  import org.apache.slide.content.NodeRevisionNumber;
  import org.apache.slide.taglib.bean.NodeBean;
  import org.apache.slide.taglib.tag.SetRevisionTagSupport;
  
  
  /**
   * Tag class for tags that represent a revision of a node.
   * 
   * @author <a href="mailto:[EMAIL PROTECTED]";>Christopher Lenz</a>
   * @version $Revision: 1.3 $
   */
  public class SetRevisionTag
      extends SetRevisionTagSupport {
      
      
      // ----------------------------------------------------- Instance Variables
      
      
      /**
       * Value of the 'node' attribute, which should be a JSP-EL expression 
       * referencing the NodeBean to use.
       */
      protected String node;
      
      
      // ----------------------------------------------------------- Construction
      
      
      /**
       * Initialize inherited and local state.
       */
      public SetRevisionTag() {
          super();
          
          init();
      }
      
      
      // ------------------------------------------------------------ Tag Methods
      
      
      /**
       * Called by the JSP Engine when closing this tag.
       *
       * @throws JspException if the 'number' attribute does not contain a 
       *         version number in a valid format
       */
      public int doEndTag()
          throws JspException {
          
          // evaluate the 'number' attribute
          String evalNumber = (String)
              JstlTagUtils.evaluateOptionalAttribute("revision", "number",
                                                     number, String.class, this,
                                                     pageContext);
          
          // evaluate the 'branch' attribute
          String evalBranch = (String)
              JstlTagUtils.evaluateOptionalAttribute("revision", "branch",
                                                     branch, String.class, this,
                                                     pageContext);
          
          // if neither revision number nor branch name have been specified,
          // first check whether we're inside an iteration over revisions
          NodeRevisionNumber nrn = null;
          if (evalNumber != null) {
              try {
                  nrn = new NodeRevisionNumber(evalNumber);
              }
              catch (NumberFormatException e) {
                  throw new JspException("The attribute 'number' of " +
                      "the 'revision' tag contains an invalid version " +
                      "number.");
              }
          }
          
          NodeBean nodeBean = null;
          try {
              nodeBean = (NodeBean)
                  JstlTagUtils.evaluateOptionalAttribute("revision", "node",
                                                         node, NodeBean.class,
                                                         this, pageContext);
          } catch (JspException e) {
              // ignore
          }
          if (nodeBean == null) {
              nodeBean = JstlTagUtils.findNode(this, pageContext);
              if (nodeBean == null) {
                  throw new JspTagException("The 'revision' tag must be " +
                      "nested inside a 'node' tag or an iteration over nodes, " +
                      "or the 'node' attribute must be set.");
              }
          }
          
          revision = getRevision(nodeBean, nrn, evalBranch);
          
          init();
          
          return super.doStartTag();
      }
      
      
      /**
       * Releases any resources we may have (or inherit).
       */
      public void release() {
          super.release();
          
          init();
      }
      
      
      // --------------------------------------------------------- Public Methods
      
      
      /**
       * Sets the 'node' attribute.
       *
       * @param node the attribute value
       */
      public void setNode(String node) {
          
          this.node = node;
      }
      
      
      /**
       * Set the 'var' attribute.
       *
       * @param var the attribute value
       */
      public void setVar(String var) {
          
          attrName = var;
      }
      
      
      // -------------------------------------------------------- Private Methods
      
      
      /**
       * Reset internal state.
       */
      private void init() {
          
          node = null;
      }
      
      
  }
  
  
  
  
  1.6       +74 -0     jakarta-slide/src/taglib/slide-jstl.tld
  
  Index: slide-jstl.tld
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/taglib/slide-jstl.tld,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- slide-jstl.tld    1 Aug 2002 15:36:30 -0000       1.5
  +++ slide-jstl.tld    1 Aug 2002 16:43:27 -0000       1.6
  @@ -120,6 +120,38 @@
       <required>false</required>
       <rtexprvalue>false</rtexprvalue>
      </attribute>
  +   <attribute>
  +    <name>scope</name>
  +    <required>false</required>
  +    <rtexprvalue>false</rtexprvalue>
  +   </attribute>
  +  </tag>
  +  
  +  <!-- The 'setNode' Tag -->
  +  <tag>
  +   <name>setNode</name>
  +   <tag-class>org.apache.slide.taglib.tag.jstl.SetNodeTag</tag-class>
  +   <body-content>JSP</body-content>
  +   <attribute>
  +    <name>uri</name>
  +    <required>true</required>
  +    <rtexprvalue>false</rtexprvalue>
  +   </attribute>
  +   <attribute>
  +    <name>resolveLinks</name>
  +    <required>false</required>
  +    <rtexprvalue>false</rtexprvalue>
  +   </attribute>
  +   <attribute>
  +    <name>var</name>
  +    <required>true</required>
  +    <rtexprvalue>false</rtexprvalue>
  +   </attribute>
  +   <attribute>
  +    <name>scope</name>
  +    <required>false</required>
  +    <rtexprvalue>false</rtexprvalue>
  +   </attribute>
     </tag>
     
     <!-- The 'revision' Tag -->
  @@ -138,7 +170,49 @@
       <rtexprvalue>false</rtexprvalue>
      </attribute>
      <attribute>
  +    <name>node</name>
  +    <required>false</required>
  +    <rtexprvalue>false</rtexprvalue>
  +   </attribute>
  +   <attribute>
       <name>var</name>
  +    <required>false</required>
  +    <rtexprvalue>false</rtexprvalue>
  +   </attribute>
  +   <attribute>
  +    <name>scope</name>
  +    <required>false</required>
  +    <rtexprvalue>false</rtexprvalue>
  +   </attribute>
  +  </tag>
  +  
  +  <!-- The 'setRevision' Tag -->
  +  <tag>
  +   <name>setRevision</name>
  +   <tag-class>org.apache.slide.taglib.tag.jstl.SetRevisionTag</tag-class>
  +   <body-content>JSP</body-content>
  +   <attribute>
  +    <name>number</name>
  +    <required>false</required>
  +    <rtexprvalue>false</rtexprvalue>
  +   </attribute>
  +   <attribute>
  +    <name>branch</name>
  +    <required>false</required>
  +    <rtexprvalue>false</rtexprvalue>
  +   </attribute>
  +   <attribute>
  +    <name>node</name>
  +    <required>false</required>
  +    <rtexprvalue>false</rtexprvalue>
  +   </attribute>
  +   <attribute>
  +    <name>var</name>
  +    <required>true</required>
  +    <rtexprvalue>false</rtexprvalue>
  +   </attribute>
  +   <attribute>
  +    <name>scope</name>
       <required>false</required>
       <rtexprvalue>false</rtexprvalue>
      </attribute>
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to