01: package org.wings.plaf.css.script;
02:
03: import org.wings.util.SStringBuilder;
04: import org.wings.script.ScriptListener;
05:
06: public class OnHeadersLoadedScript implements ScriptListener {
07: String script;
08: boolean wrapAsFunction;
09:
10: public OnHeadersLoadedScript(String script) {
11: this (script, true);
12: }
13:
14: public OnHeadersLoadedScript(String script, boolean wrapAsFunction) {
15: this .script = script;
16: this .wrapAsFunction = wrapAsFunction;
17: }
18:
19: public String getEvent() {
20: return null;
21: }
22:
23: public String getCode() {
24: return null;
25: }
26:
27: public String getScript() {
28: final SStringBuilder output = new SStringBuilder();
29:
30: output.append("wingS.global.onHeadersLoaded(");
31: if (wrapAsFunction)
32: output.append("function() {");
33: output.append(script);
34: if (wrapAsFunction)
35: output.append("}");
36: output.append(");");
37:
38: return output.toString();
39: }
40:
41: public int getPriority() {
42: return DEFAULT_PRIORITY;
43: }
44: }
|