View Javadoc

1   /*
2    * Criado em 08/12/2004
3    *
4    */
5   package ecar.taglib.teste;
6   
7   import java.io.IOException;
8   
9   import javax.servlet.jsp.JspException;
10  import javax.servlet.jsp.JspWriter;
11  import javax.servlet.jsp.PageContext;
12  import javax.servlet.jsp.tagext.Tag;
13  
14  /**
15   * @author felipev
16   *
17   */
18  public class TagPai implements Tag{
19      
20      private String label;
21      
22      private PageContext page = null;
23      
24      /**
25       * Inicializa a montagem da tag para ser adicionada na tela de HTML.<br>
26       * 
27       * @author N/C
28  	 * @since N/C
29  	 * @version N/C
30  	 * @reutnr int
31  	 * @throws JspException
32       */
33      public int doStartTag() throws JspException {
34          JspWriter writer = this.page.getOut();
35          StringBuffer s = new StringBuffer();
36          s.append(getLabel()).append(": <BR>");
37          try {
38              writer.print(s.toString());
39          } catch (IOException e) {
40  			org.apache.log4j.Logger.getLogger(this.getClass()).error(e);
41          }
42          return Tag.EVAL_BODY_INCLUDE;
43      }
44      
45      /**
46       * Atribui valor especificado para PageContext page.<br>
47       * 
48       * @author N/C
49  	 * @since N/C
50  	 * @version N/C
51  	 * @param PageContext arg0
52       */
53      public void setPageContext(PageContext arg0) {
54  		this.page = arg0;
55  	}
56  
57      /**
58       * 
59       * 
60       * @author N/C
61  	 * @since N/C
62  	 * @version N/C
63  	 * @param Tag arg0
64       */
65  	public void setParent(Tag arg0) {
66  	}
67  
68  	/**
69  	 * Retorna null.<br>
70  	 * 
71  	 * @author N/C
72  	 * @since N/C
73  	 * @version N/C
74  	 * @return Tag
75  	 */
76  	public Tag getParent() {
77  		return null;
78  	}
79  	
80  	/**
81  	 * Encerra Tag.<br>
82  	 * 
83  	 * @author N/C
84  	 * @since N/C
85  	 * @version N/C
86  	 * @return int
87  	 * @throws JspException
88  	 */
89  	public int doEndTag() throws JspException {
90          JspWriter writer = this.page.getOut();
91          StringBuffer s = new StringBuffer();
92          s.append(" TERMINOU!");
93          try {
94              writer.print(s.toString());
95          } catch (IOException e) {
96  			org.apache.log4j.Logger.getLogger(this.getClass()).error(e);
97          }
98  		return Tag.EVAL_PAGE;
99  	}
100 
101 	/**
102 	 * @author N/C
103 	 * @since N/C
104 	 * @version N/C
105 	 */
106 	public void release() {
107 	}
108 	
109     /**
110      * Retorna PageContext page.<br>
111      * 
112      * @author N/C
113 	 * @since N/C
114 	 * @version N/C
115      * @return PageContext - (Returns the page)
116      */
117     public PageContext getPage() {
118         return page;
119     }
120     /**
121      * Atribui valoe especificado para PageContext page.<br>
122      * 
123      * @author N/C
124 	 * @since N/C
125 	 * @version N/C
126      * @param PageContext page - (The page to set)
127      */
128     public void setPage(PageContext page) {
129         this.page = page;
130     }
131 
132     /**
133      * Retorna String label.<br>
134      * 
135      * @author N/C
136 	 * @since N/C
137 	 * @version N/C
138      * @return String - (Returns the label)
139      */
140     public String getLabel() {
141         return label;
142     }
143     /**
144      * Atribui valor especificado String label.<br>
145      * 
146      * @author N/C
147 	 * @since N/C
148 	 * @version N/C
149      * @param String label - (The label to set)
150      */
151     public void setLabel(String label) {
152         this.label = label;
153     }
154 }