KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > fr > improve > struts > taglib > layout > CellTag


1 package fr.improve.struts.taglib.layout;
2
3 import javax.servlet.jsp.JspException JavaDoc;
4
5 import fr.improve.struts.taglib.layout.event.ComputeLayoutSpanEvent;
6 import fr.improve.struts.taglib.layout.event.EndLayoutEvent;
7 import fr.improve.struts.taglib.layout.event.LayoutEventListener;
8 import fr.improve.struts.taglib.layout.event.StartLayoutEvent;
9
10 /**
11  * Tag whose body content is developer written HTML code.
12  * If another struts-layout tag is nested in this one, no layout code will be generated.
13  *
14  * @author jnribette
15  */

16 public class CellTag extends LayoutTagSupport implements LayoutEventListener {
17     protected String JavaDoc styleClass;
18     protected String JavaDoc width;
19     protected String JavaDoc height;
20     protected int colspan = 1;
21     private String JavaDoc align;
22     
23     public int doStartLayoutTag() throws JspException JavaDoc {
24         // Compute colspan value.
25
int lc_colspan = ((Integer JavaDoc)new ComputeLayoutSpanEvent(this, colspan).send()).intValue();
26         
27         // Generate td.
28
StringBuffer JavaDoc lc_buffer = new StringBuffer JavaDoc("<td colspan=\"");
29         lc_buffer.append(lc_colspan);
30         if (styleClass!=null) {
31             lc_buffer.append("\" class=\"");
32             lc_buffer.append(styleClass);
33         }
34         if (width!=null){
35             lc_buffer.append("\" width=\"");
36             lc_buffer.append(width);
37         }
38         if (height!=null){
39             lc_buffer.append("\" height=\"");
40             lc_buffer.append(height);
41         }
42         if (align!=null) {
43             lc_buffer.append("\" align=\"");
44             lc_buffer.append(align);
45         }
46         lc_buffer.append("\">");
47         
48         new StartLayoutEvent(this, lc_buffer.toString()).send();
49         return EVAL_BODY_INCLUDE;
50     }
51     
52     public int doEndLayoutTag() throws JspException JavaDoc {
53         new EndLayoutEvent(this, "</td>").send();
54         return EVAL_PAGE;
55     }
56     
57     public void release() {
58         styleClass = null;
59         width = null;
60         height = null;
61         colspan = 1;
62         align = null;
63     }
64     
65     public void setStyleClass(String JavaDoc in_styleClass) {
66         styleClass = in_styleClass;
67     }
68     
69     public String JavaDoc getHeight() {
70         return height;
71     }
72     public void setHeight(String JavaDoc height) {
73         this.height = height;
74     }
75     public String JavaDoc getWidth() {
76         return width;
77     }
78     public void setWidth(String JavaDoc width) {
79         this.width = width;
80     }
81     public String JavaDoc getStyleClass() {
82         return styleClass;
83     }
84     public int getColspan() {
85         return colspan;
86     }
87     public void setColspan(int colspan) {
88         this.colspan = colspan;
89     }
90     /**
91      * @see fr.improve.struts.taglib.layout.event.LayoutEventListener#processEndLayoutEvent(EndLayoutEvent)
92      */

93     public Object JavaDoc processEndLayoutEvent(EndLayoutEvent in_event) throws JspException JavaDoc {
94         return Boolean.FALSE;
95     }
96
97     /**
98      * @see fr.improve.struts.taglib.layout.event.LayoutEventListener#processStartLayoutEvent(StartLayoutEvent)
99      */

100     public Object JavaDoc processStartLayoutEvent(StartLayoutEvent in_event) throws JspException JavaDoc {
101         return Boolean.FALSE;
102     }
103
104     public String JavaDoc getAlign() {
105         return align;
106     }
107
108     public void setAlign(String JavaDoc align) {
109         this.align = align;
110     }
111 }
112
Popular Tags