-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathPopupPanel.java
More file actions
executable file
·83 lines (81 loc) · 2.09 KB
/
Copy pathPopupPanel.java
File metadata and controls
executable file
·83 lines (81 loc) · 2.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
package javaforce.webui;
/** Popup Panel (or Window)
*
* @author pquiring
*/
public class PopupPanel extends Panel {
private TitleBar titleBar;
private Block block;
private boolean modal;
/** Creates a new PopupPanel. */
public PopupPanel(String title) {
init(title);
}
/** Creates a new Popup panel with another Panel enclosed. */
public PopupPanel(String title, Panel panel) {
init(title);
add(panel);
}
private void init(String title) {
initInvisible();
titleBar = new TitleBar(title, this);
add(titleBar);
setClass("popuppanel");
super.setVisible(false);
modal = false;
block = new Block();
block.setClass("modal");
block.initInvisible();
setPosition(0, 0);
}
/** Modal windows block all other windows underneath it. */
public void setModal(boolean state) {
modal = state;
}
public void setOnClose(Runnable onClose) {
titleBar.setOnClose(onClose);
}
public String html() {
StringBuilder sb = new StringBuilder();
if (modal) {
sb.append(block.html());
}
sb.append("<div" + getAttrs() + "'>");
int cnt = count();
for(int a=0;a<cnt;a++) {
sb.append(get(a).html());
}
sb.append("</div>");
return sb.toString();
}
public void setVisible(boolean state) {
if (modal) {
if (state) {
client.sendEvent(block.id, "setzindex", new String[] {"idx=" + getClient().getZIndex()});
} else {
getClient().releaseZIndex();
}
block.setVisible(state);
}
if (state) {
sendEvent("setzindex", new String[] {"idx=" + getClient().getZIndex()});
} else {
getClient().releaseZIndex();
}
super.setVisible(state);
}
public void setClient(WebUIClient client) {
super.setClient(client);
titleBar.setClient(client);
block.setClient(client);
}
public void setTitleBarSize(int sz) {
titleBar.setHeight(sz);
}
public void setTitle(String title) {
titleBar.setText(title);
}
public boolean isPopup() {
return true;
}
}