1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.exoplatform.wcm.webui.core;
18
19 import org.exoplatform.webui.config.annotation.ComponentConfig;
20 import org.exoplatform.webui.config.annotation.EventConfig;
21 import org.exoplatform.webui.core.UIPopupContainer;
22 import org.exoplatform.webui.event.Event;
23 import org.exoplatform.webui.event.EventListener;
24
25
26
27
28
29
30
31 @ComponentConfig(
32 template = "classpath:groovy/wcm/webui/core/UIPopupWindow.gtmpl",
33 events = @EventConfig(listeners = UIPopupWindow.CloseActionListener.class, name = "ClosePopup")
34 )
35 public class UIPopupWindow extends org.exoplatform.webui.core.UIPopupWindow {
36 private int top_ = -1;
37 private int left_ = -1;
38 private boolean isMiddle = false;
39
40
41
42
43 public boolean isMiddle() {
44 return isMiddle;
45 }
46
47
48
49
50 public void setMiddle(boolean isMiddle) {
51 this.isMiddle = isMiddle;
52 }
53
54 public int getWindowTop()
55 {
56 return top_;
57 }
58 public int getWindowLeft()
59 {
60 return left_;
61 }
62
63 public void setCoordindate(int top, int left) {
64 top_ = top;
65 left_ = left;
66 }
67 public static class CloseActionListener extends EventListener<UIPopupWindow> {
68 public void execute(Event<UIPopupWindow> event) throws Exception {
69 UIPopupWindow popupWindow = event.getSource();
70 UIPopupContainer popupContainer = popupWindow.getAncestorOfType(UIPopupContainer.class);
71 popupContainer.removeChildById(popupWindow.getId());
72 event.getRequestContext().addUIComponentToUpdateByAjax(popupContainer);
73 }
74 }
75 }