3 import javajs.awt.Color;
4 import javajs.awt.Container;
9 * There is really no need here for awt.Dialog.
10 * We would not use FileDialog in an HTML5 context anyway.
13 public class JDialog extends Container {
15 private static final int headerHeight = 25;
16 private int defaultWidth = 600;
17 private int defaultHeight = 300;
19 private JContentPane contentPane;
22 private int zIndex = 9000;
24 public void setZIndex(int zIndex) {
32 add(contentPane = new JContentPane());
33 setBackground(Color.get3(210, 210, 240));
34 contentPane.setBackground(Color.get3(230, 230, 230));
37 public void setLocation(int[] loc) {
41 public JContentPane getContentPane() {
45 public void setTitle(String title) {
53 public void validate() {
58 public void setVisible(boolean tf) {
59 if (tf && html == null)
64 public void dispose() {
70 * SwingController.dispose(this);
80 public void repaint() {
85 * Set it into DOM, but don't show it yet.
86 * this.loc, this.manager, this.id, etc.
89 private void setDialog() {
94 * SwingController.setDialog(this);
99 System.out.println(html);
104 public String toHTML() {
105 renderWidth = getSubcomponentWidth();
106 if (renderWidth == 0)
107 renderWidth = defaultWidth;
108 renderHeight = contentPane.getSubcomponentHeight();
109 if (renderHeight == 0)
110 renderHeight = defaultHeight;
111 int h = renderHeight - headerHeight;
113 sb.append("\n<div id='" + id + "' class='JDialog' style='" + getCSSstyle(0, 0) + "z-index:" + zIndex + ";position:relative;top:0px;left:0px;reize:both;'>\n");
114 sb.append("\n<div id='" + id + "_title' class='JDialogTitle' style='width:100%;height:25px;padding:5px 5px 5px 5px;height:"+headerHeight+"px'>"
115 +"<span style='text-align:center;'>" + title + "</span><span style='position:absolute;text-align:right;right:1px;'>"
116 + "<input type=button id='" + id + "_closer' onclick='SwingController.windowClosing(this)' value='x' /></span></div>\n");
117 sb.append("\n<div id='" + id + "_body' class='JDialogBody' style='width:100%;height:"+h+"px;"
118 +"position: relative;left:0px;top:0px'>\n");
119 sb.append(contentPane.toHTML());
120 sb.append("\n</div></div>\n");
121 return sb.toString();