You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-dev@jakarta.apache.org by cm...@apache.org on 2002/08/01 18:41:57 UTC

cvs commit: jakarta-slide/src/taglib/common/org/apache/slide/taglib/tag RevisionTagSupport.java

cmlenz      2002/08/01 09:41:57

  Modified:    src/taglib/common/org/apache/slide/taglib/tag
                        RevisionTagSupport.java
  Log:
  - Added scope attribute
  
  Revision  Changes    Path
  1.6       +29 -7     jakarta-slide/src/taglib/common/org/apache/slide/taglib/tag/RevisionTagSupport.java
  
  Index: RevisionTagSupport.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/taglib/common/org/apache/slide/taglib/tag/RevisionTagSupport.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- RevisionTagSupport.java	1 Aug 2002 15:43:53 -0000	1.5
  +++ RevisionTagSupport.java	1 Aug 2002 16:41:57 -0000	1.6
  @@ -67,10 +67,10 @@
   import javax.servlet.jsp.PageContext;
   import javax.servlet.jsp.tagext.TagSupport;
   
  -import org.apache.slide.common.SlideException;
   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, 
  @@ -112,6 +112,12 @@
       protected String attrName;
       
       
  +    /**
  +     * Scope where the PageContext should be stored.
  +     */
  +    private int scope;
  +    
  +    
       // ----------------------------------------------------------- Construction
       
       
  @@ -140,7 +146,7 @@
           
           if (revision != null) {
               if (attrName != null) {
  -                pageContext.setAttribute(attrName, revision);
  +                pageContext.setAttribute(attrName, revision, scope);
               }
               
               return EVAL_BODY_INCLUDE;
  @@ -160,8 +166,9 @@
           super.doEndTag();
           
           if (attrName != null) {
  -            pageContext.removeAttribute(attrName);
  +            pageContext.removeAttribute(attrName, scope);
           }
  +        init();
           
           return EVAL_PAGE;
       }
  @@ -202,6 +209,17 @@
       }
       
       
  +    /**
  +     * Sets the 'scope' attribute.
  +     * 
  +     * @param scope the attribute value
  +     */
  +    public void setScope(String scope) {
  +        
  +        this.scope = Scopes.valueOf(scope);
  +    }
  +    
  +    
       // --------------------------------------------------------- Public Methods
       
       
  @@ -236,6 +254,9 @@
       protected RevisionBean getRevision(NodeBean node, 
                                          NodeRevisionNumber number,
                                          String branch) {
  +        if (node == null) {
  +            throw new NullPointerException();
  +        }
           
           RevisionBean bean = null;
           if (number != null) {
  @@ -262,6 +283,7 @@
           number = null;
           branch = null;
           attrName = null;
  +        scope = PageContext.PAGE_SCOPE;
       }
       
       
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>