PageRenderTime 23ms CodeModel.GetById 9ms app.highlight 8ms RepoModel.GetById 1ms app.codeStats 0ms

/webportal/src/main/java/au/org/emii/portal/composer/ExternalContentComposer.java

http://alageospatialportal.googlecode.com/
Java | 79 lines | 60 code | 19 blank | 0 comment | 3 complexity | 98dadc95747379f7bef61d583da03df8 MD5 | raw file
 1package au.org.emii.portal.composer;
 2
 3import org.zkoss.zk.ui.SuspendNotAllowedException;
 4import org.zkoss.zk.ui.event.Event;
 5import org.zkoss.zk.ui.event.EventListener;
 6import org.zkoss.zk.ui.event.Events;
 7import org.zkoss.zul.Iframe;
 8import org.zkoss.zul.Window;
 9
10public class ExternalContentComposer extends Window {
11
12    private static final long serialVersionUID = 1L;
13    String src;
14
15    @Override
16    public void doOverlapped() {
17        super.doOverlapped();
18
19        this.getFellow("hide").addEventListener("onClick", new EventListener() {
20
21            public void onEvent(Event event) throws Exception {
22                close();
23            }
24        });
25        
26        this.getFellow("reset").addEventListener("onClick", new EventListener() {
27
28            public void onEvent(Event event) throws Exception {
29                Events.echoEvent("setSrc", event.getTarget().getParent().getParent(), null);
30            }
31        });
32
33        this.getFellow("breakout").addEventListener("onClick", new EventListener() {
34
35            public void onEvent(Event event) throws Exception {
36                close();
37            }
38        });
39    }
40
41    @Override
42    public void doModal() throws InterruptedException, SuspendNotAllowedException  {
43        super.doModal();
44
45        this.getFellow("hide").addEventListener("onClick", new EventListener() {
46
47            public void onEvent(Event event) throws Exception {
48                close();
49            }
50        });
51
52        this.getFellow("reset").addEventListener("onClick", new EventListener() {
53
54            public void onEvent(Event event) throws Exception {
55                Events.echoEvent("setSrc", event.getTarget().getParent().getParent(), null);
56            }
57        });
58
59        this.getFellow("breakout").addEventListener("onClick", new EventListener() {
60
61            public void onEvent(Event event) throws Exception {
62                close();
63            }
64        });
65    }
66
67    public void setSrc(Event event) {
68        if(event.getData() == null) {
69            ((Iframe)getFellow("externalContentIframe")).setSrc("");
70            Events.echoEvent("setSrc", event.getTarget(), src);
71        } else {
72            ((Iframe)getFellow("externalContentIframe")).setSrc(src);
73        }
74    }
75
76    void close() {
77        detach();
78    }
79}