1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
package org.apache.tapestry.dojo.html; |
15 |
|
|
16 |
|
import org.apache.tapestry.IMarkupWriter; |
17 |
|
import org.apache.tapestry.IRequestCycle; |
18 |
|
import org.apache.tapestry.IScript; |
19 |
|
import org.apache.tapestry.TapestryUtils; |
20 |
|
import org.apache.tapestry.dojo.AbstractWidget; |
21 |
|
import org.apache.tapestry.json.JSONObject; |
22 |
|
|
23 |
|
import java.util.HashMap; |
24 |
|
import java.util.Map; |
25 |
|
|
26 |
|
|
27 |
|
|
28 |
|
|
29 |
|
|
30 |
|
|
31 |
0 |
public abstract class Dialog extends AbstractWidget |
32 |
|
{ |
33 |
|
public abstract boolean isHidden(); |
34 |
|
public abstract void setHidden(boolean hidden); |
35 |
|
|
36 |
|
public abstract String getBackgroundColor(); |
37 |
|
|
38 |
|
public abstract float getOpacity(); |
39 |
|
|
40 |
|
public abstract boolean getFollowScroll(); |
41 |
|
|
42 |
|
public abstract boolean getCloseOnBackgroundClick(); |
43 |
|
|
44 |
|
public abstract int getBlockDuration(); |
45 |
|
|
46 |
|
public abstract int getLifeTime(); |
47 |
|
|
48 |
|
public abstract String getToggle(); |
49 |
|
|
50 |
|
public abstract int getToggleDuration(); |
51 |
|
|
52 |
|
public void show() |
53 |
|
{ |
54 |
0 |
setHidden(false); |
55 |
0 |
} |
56 |
|
|
57 |
|
public void hide() |
58 |
|
{ |
59 |
0 |
setHidden(true); |
60 |
0 |
} |
61 |
|
|
62 |
|
|
63 |
|
|
64 |
|
|
65 |
|
public void renderWidget(IMarkupWriter writer, IRequestCycle cycle) |
66 |
|
{ |
67 |
0 |
if (!cycle.isRewinding()) |
68 |
|
{ |
69 |
0 |
writer.begin(getTemplateTagName()); |
70 |
0 |
renderIdAttribute(writer, cycle); |
71 |
0 |
renderInformalParameters(writer, cycle); |
72 |
|
} |
73 |
|
|
74 |
0 |
renderBody(writer, cycle); |
75 |
|
|
76 |
0 |
if (!cycle.isRewinding()) |
77 |
0 |
writer.end(); |
78 |
|
|
79 |
0 |
if (!cycle.isRewinding()) |
80 |
|
{ |
81 |
0 |
JSONObject json = new JSONObject(); |
82 |
0 |
json.put("bgColor", getBackgroundColor()); |
83 |
0 |
json.put("bgOpacity", getOpacity()); |
84 |
0 |
json.put("followScroll", getFollowScroll()); |
85 |
0 |
json.put("closeOnBackgroundClick", getCloseOnBackgroundClick()); |
86 |
0 |
json.put("blockDuration", getBlockDuration()); |
87 |
0 |
json.put("lifeTime", getLifeTime()); |
88 |
0 |
json.put("toggle", getToggle()); |
89 |
0 |
json.put("toggleDuration", getToggleDuration()); |
90 |
|
|
91 |
0 |
Map parms = new HashMap(); |
92 |
0 |
parms.put("component", this); |
93 |
0 |
parms.put("props", json.toString()); |
94 |
|
|
95 |
0 |
getScript().execute(this, cycle, TapestryUtils.getPageRenderSupport(cycle, this), parms); |
96 |
|
} |
97 |
0 |
} |
98 |
|
|
99 |
|
|
100 |
|
public abstract IScript getScript(); |
101 |
|
} |