KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > fr > improve > struts > taglib > layout > util > BasicPanel


1 package fr.improve.struts.taglib.layout.util;
2
3 import javax.servlet.jsp.JspException JavaDoc;
4 import javax.servlet.jsp.PageContext JavaDoc;
5 import javax.servlet.jsp.tagext.TagSupport JavaDoc;
6 /**
7  * Insert the type's description here.
8  * Creation date: (06/06/01 11:40:59)
9  * @author: Jean-NoŽl Ribette
10  */

11 public class BasicPanel implements PanelInterface {
12     protected String JavaDoc styleClass;
13     protected int colspan;
14     protected boolean isNested = false;
15     public void doAfterBody(StringBuffer JavaDoc buffer) {
16     buffer.append("</table></td></tr>\n");
17 }
18     public void doBeforeBody(StringBuffer JavaDoc buffer, String JavaDoc align) {
19     buffer.append("<tr><td");
20     if (styleClass!=null) {
21         buffer.append(" class=\"").append(styleClass).append("\"");
22     }
23     buffer.append("><table width=\"100%\"");
24     if (align!=null) {
25             buffer.append(" align=\"");
26             buffer.append(align);
27             buffer.append("\"");
28     }
29     buffer.append(" border=\"0\">\n");
30     }
31 /**
32  * doEndPanel method comment.
33  */

34 public void doEndPanel(StringBuffer JavaDoc buffer) {
35     buffer.append("</table></td></tr></table>\n");
36 }
37 /**
38  * Insert a blank line in the body of the panel
39  */

40 public void doPrintBlankLine(StringBuffer JavaDoc buffer, int cols) {
41     buffer.append("<tr><td colspan=\"" + cols + "\">&nbsp;</td></tr>\n");
42 }
43 /**
44  * doPrintTitle method comment.
45  */

46 public void doPrintTitle(StringBuffer JavaDoc buffer, String JavaDoc title) {
47     if (title!=null) {
48         buffer.append("<tr><th align=\"center\"");
49         if (styleClass != null) {
50             buffer.append(" class=\"").append(styleClass).append("\"");
51         }
52         buffer.append(">");
53         buffer.append(title);
54         buffer.append("</th></tr>\n");
55     }
56     //buffer.append("<tr>");
57
}
58 /**
59  * doStartPanel method comment.
60  */

61 public void doStartPanel(StringBuffer JavaDoc buffer, String JavaDoc align, String JavaDoc width) {
62     buffer.append("<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\"");
63     if (align!=null) {
64         buffer.append(" align=\"");
65         buffer.append(align);
66         buffer.append("\"");
67     }
68     if (width!=null) {
69         buffer.append(" width=\"");
70         buffer.append(width);
71         buffer.append("\"");
72     }
73     if (styleClass!=null) {
74         buffer.append(" class=\"");
75         buffer.append(styleClass);
76         buffer.append("\"");
77     }
78     buffer.append("><tr><td valign=\"top\">");
79     buffer.append("<table cellspacing=\"1\" cellpadding=\"1\" border=\"0\" width=\"100%\">\n");
80     }
81     public void init(PageContext JavaDoc pg, String JavaDoc in_styleClass, TagSupport JavaDoc in_panel) throws JspException JavaDoc {
82         this.styleClass = in_styleClass;
83         colspan = LayoutUtils.getSkin(pg.getSession()).getFieldInterface().getColumnNumber();
84     }
85 }
86
Popular Tags