KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > albel > tags > table > RowHandlerTag


1 package albel.tags.table;
2
3 import javax.servlet.jsp.*;
4 import javax.servlet.*;
5 import javax.servlet.jsp.tagext.*;
6 import javax.servlet.http.*;
7 import albel.tags.table.utils.*;
8 import albel.tags.table.model.*;
9 import albel.tags.table.controll.*;
10 /**
11  * @author albel
12  * This tag contains handler definition of table data rows.
13  */

14 public class RowHandlerTag extends BodyTagSupport
15 {
16     
17     /**
18      * Object that exists in request to handle data changes in the table
19      */

20     private String JavaDoc handlerObject;
21     
22     /**
23      * Class that will be created to handle table data changes
24      */

25     private String JavaDoc handlerClass;
26     
27     public RowHandlerTag()
28     {
29         super();
30     }
31     
32     ////////////////////////////////////////////////////////////////
33
/// ///
34
/// User methods. ///
35
/// ///
36
/// Modify these methods to customize your tag handler. ///
37
/// ///
38
////////////////////////////////////////////////////////////////
39

40     
41     //
42
// methods called from doStartTag()
43
//
44
/**
45      *
46      * Fill in this method to perform other operations from doStartTag().
47      *
48      */

49     public void otherDoStartTagOperations()
50     {
51         
52         //
53
// TODO: code that performs other operations in doStartTag
54
// should be placed here.
55
// It will be called after initializing variables,
56
// finding the parent, setting IDREFs, etc, and
57
// before calling theBodyShouldBeEvaluated().
58
//
59
// For example, to print something out to the JSP, use the following:
60
//
61
// try {
62
// JspWriter out = pageContext.getOut();
63
// out.println("something");
64
// } catch (java.io.IOException ex) {
65
// // do something
66
// }
67
//
68
//
69

70         
71     }
72     
73     /**
74      *
75      * Fill in this method to determine if the tag body should be evaluated
76      * Called from doStartTag().
77      *
78      */

79     public boolean theBodyShouldBeEvaluated()
80     {
81         
82         //
83
// TODO: code that determines whether the body should be
84
// evaluated should be placed here.
85
// Called from the doStartTag() method.
86
//
87
return true;
88         
89     }
90     
91     
92     //
93
// methods called from doEndTag()
94
//
95
/**
96      *
97      * Fill in this method to perform other operations from doEndTag().
98      *
99      */

100     public void otherDoEndTagOperations()
101     {
102         
103         //
104
// TODO: code that performs other operations in doEndTag
105
// should be placed here.
106
// It will be called after initializing variables,
107
// finding the parent, setting IDREFs, etc, and
108
// before calling shouldEvaluateRestOfPageAfterEndTag().
109
//
110

111         
112     }
113     
114     /**
115      *
116      * Fill in this method to determine if the rest of the JSP page
117      * should be generated after this tag is finished.
118      * Called from doEndTag().
119      *
120      */

121     public boolean shouldEvaluateRestOfPageAfterEndTag()
122     {
123         
124         //
125
// TODO: code that determines whether the rest of the page
126
// should be evaluated after the tag is processed
127
// should be placed here.
128
// Called from the doEndTag() method.
129
//
130
return true;
131         
132     }
133     
134     
135     ////////////////////////////////////////////////////////////////
136
/// ///
137
/// Tag Handler interface methods. ///
138
/// ///
139
/// Do not modify these methods; instead, modify the ///
140
/// methods that they call. ///
141
/// ///
142
////////////////////////////////////////////////////////////////
143

144     
145     /**
146      * Methos calls Manager to setup row handler
147      */

148     public int doStartTag() throws JspException
149     {
150         TableTag tableTag=(TableTag)this.getParent().getParent().getParent();
151         HttpServletRequest request=(HttpServletRequest)pageContext.getRequest();
152         HttpRequestAttributesMap attrsReq=new HttpRequestAttributesMap(request);
153         HttpSessionAttributesMap attrsSes=new HttpSessionAttributesMap(request.getSession());
154         try
155         {
156             Manager.setupRowHandler(attrsSes,attrsReq,tableTag.getId(), getHandlerClass(), getHandlerObject());
157         }
158         catch (albel.tags.table.model.TableTagException tex)
159         {
160             throw new JspException();
161         }
162         return this.EVAL_BODY_INCLUDE;
163     }
164     
165     
166     /**
167      * Dummy javadoc comment to get things started.
168      */

169     public int doEndTag() throws JspException
170     {
171         // Dummy body to get things going.
172
return EVAL_PAGE;
173     }
174     
175     /**
176      * Getter for property handlerObject.
177      * @return Value of property handlerObject.
178      */

179     public String JavaDoc getHandlerObject()
180     {
181         return this.handlerObject;
182     }
183     
184     /**
185      * Setter for property handlerObject.
186      * @param handlerObject New value of property handlerObject.
187      */

188     public void setHandlerObject(String JavaDoc handlerObject)
189     {
190         this.handlerObject = handlerObject;
191     }
192     
193     /**
194      * Getter for property handlerClass.
195      * @return Value of property handlerClass.
196      */

197     public String JavaDoc getHandlerClass()
198     {
199         return this.handlerClass;
200     }
201     
202     /**
203      * Setter for property handlerClass.
204      * @param handlerClass New value of property handlerClass.
205      */

206     public void setHandlerClass(String JavaDoc handlerClass)
207     {
208         this.handlerClass = handlerClass;
209     }
210     
211 }
212
Popular Tags