KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > info > magnolia > cms > gui > dialog > DialogLine


1 /**
2  *
3  * Magnolia and its source-code is licensed under the LGPL.
4  * You may copy, adapt, and redistribute this file for commercial or non-commercial use.
5  * When copying, adapting, or redistributing this document in keeping with the guidelines above,
6  * you are required to provide proper attribution to obinary.
7  * If you reproduce or distribute the document without making any substantive modifications to its content,
8  * please use the following attribution line:
9  *
10  * Copyright 1993-2006 obinary Ltd. (http://www.obinary.com) All rights reserved.
11  *
12  */

13 package info.magnolia.cms.gui.dialog;
14
15 import info.magnolia.cms.gui.misc.CssConstants;
16
17 import org.apache.commons.lang.StringUtils;
18
19
20 /**
21  * @author Vinzenz Wyser
22  * @version 2.0
23  */

24 public class DialogLine {
25
26     /**
27      * Empty constructor should only be used by DialogFactory.
28      */

29     protected DialogLine() {
30     }
31
32     public String JavaDoc getHtml() {
33         return this.getHtml(0, 2, 0);
34     }
35
36     public String JavaDoc getHtml(int colspanLine) {
37         return this.getHtml(0, colspanLine, 0);
38     }
39
40     public String JavaDoc getHtml(int colspanBeforeLine, int colspanLine) {
41         return this.getHtml(colspanBeforeLine, colspanLine, 0);
42     }
43
44     public String JavaDoc getHtml(int colspanBeforeLine, int colspanLine, int colspanAfterLine) {
45         String JavaDoc pre = StringUtils.EMPTY;
46         String JavaDoc post = StringUtils.EMPTY;
47         if (colspanBeforeLine != 0) {
48             pre = "<td colspan=\"" + colspanBeforeLine + "\"></td>"; //$NON-NLS-1$ //$NON-NLS-2$
49
}
50         if (colspanAfterLine != 0) {
51             pre = "<td colspan=\"" + colspanAfterLine + "\"></td>"; //$NON-NLS-1$ //$NON-NLS-2$
52
}
53         return "<tr>" //$NON-NLS-1$
54
+ pre
55             + "<td colspan=\"" //$NON-NLS-1$
56
+ colspanLine
57             + "\" class=\"" //$NON-NLS-1$
58
+ CssConstants.CSSCLASS_BOXLINE
59             + "\"></td>" //$NON-NLS-1$
60
+ post
61             + "</tr>"; //$NON-NLS-1$
62
}
63
64     public String JavaDoc getHtml(String JavaDoc width) {
65         StringBuffer JavaDoc html = new StringBuffer JavaDoc();
66         html.append("<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"width:" + width + ";\">"); //$NON-NLS-1$ //$NON-NLS-2$
67
html.append(this.getHtml(1));
68         html.append("</table>"); //$NON-NLS-1$
69
return html.toString();
70     }
71 }
72
Popular Tags