KickJava   Java API By Example, From Geeks To Geeks.

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


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-2005 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.control.Button;
16 import info.magnolia.cms.gui.misc.CssConstants;
17 import info.magnolia.cms.i18n.TemplateMessagesUtil;
18
19 import java.io.IOException JavaDoc;
20 import java.io.Writer JavaDoc;
21
22 import org.apache.commons.lang.StringUtils;
23
24
25 /**
26  * @author Vinzenz Wyser
27  * @version 2.0
28  */

29 public class DialogTab extends DialogSuper {
30
31     /**
32      * Empty constructor should only be used by DialogFactory.
33      */

34     protected DialogTab() {
35     }
36
37     public void drawHtmlPreSubs(Writer JavaDoc out) throws IOException JavaDoc {
38         String JavaDoc parentId = this.getParent().getId();
39         String JavaDoc id = this.getId();
40         // add tab button to tab set
41
if (StringUtils.isNotEmpty(this.getLabel())) {
42             Button control = new Button();
43             control.setLabel(TemplateMessagesUtil.get(this.getRequest(), this.getLabel()));
44             control.setOnclick("mgnlDialogShiftTab('" + parentId + "','" + id + "');"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
45
this.getParent().addOption(control);
46         }
47         // add tab to js object
48
out.write("<script type=\"text/javascript\">"); //$NON-NLS-1$
49
out.write("mgnlControlSets['" //$NON-NLS-1$
50
+ parentId + "'].items[mgnlControlSets['" //$NON-NLS-1$
51
+ parentId + "'].items.length]='" //$NON-NLS-1$
52
+ id + "';"); //$NON-NLS-1$
53
out.write("</script>"); //$NON-NLS-1$
54
// tab page
55
out.write("<div id=\"" + id + "_div\" class=\"" + CssConstants.CSSCLASS_TAB + "\">"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
56
out.write("<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">"); //$NON-NLS-1$
57
out.write("<tr><td class=\"" + CssConstants.CSSCLASS_TAB + "\">"); //$NON-NLS-1$ //$NON-NLS-2$
58
out
59             .write("<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" style=\"table-layout:fixed\">"); //$NON-NLS-1$
60
out.write("<col width=\"200\" /><col />"); //$NON-NLS-1$
61
}
62
63     public void drawHtmlPostSubs(Writer JavaDoc out) throws IOException JavaDoc {
64         out.write("</table>"); //$NON-NLS-1$
65
out.write("</td></tr></table></div>"); //$NON-NLS-1$
66
}
67 }
68
Popular Tags