1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.exoplatform.ecm.webui.component.explorer.popup.admin;
18
19 import org.exoplatform.ecm.webui.component.explorer.UIJCRExplorer;
20 import org.exoplatform.services.log.ExoLogger;
21 import org.exoplatform.services.log.Log;
22 import org.exoplatform.webui.application.WebuiRequestContext;
23 import org.exoplatform.webui.config.annotation.ComponentConfig;
24 import org.exoplatform.webui.core.UIContainer;
25 import org.exoplatform.webui.core.UIPageIterator;
26 import org.exoplatform.webui.core.UIPopupComponent;
27 import org.exoplatform.webui.core.UIPopupWindow;
28
29
30
31
32
33
34
35
36 @ComponentConfig(template = "system:/groovy/webui/core/UITabPane.gtmpl")
37 public class UIActionManager extends UIContainer implements UIPopupComponent {
38
39 private static final Log LOG = ExoLogger.getLogger(UIActionManager.class.getName());
40
41 public UIActionManager() throws Exception {
42 addChild(UIActionListContainer.class, null, null);
43 addChild(UIActionContainer.class, null, null).setRendered(false);
44 }
45
46 public void activate() {
47 try {
48 UIActionTypeForm uiActionTypeForm = findFirstComponentOfType(UIActionTypeForm.class);
49 uiActionTypeForm.update();
50 UIActionList uiActionList = findFirstComponentOfType(UIActionList.class);
51 uiActionList.updateGrid(getAncestorOfType(UIJCRExplorer.class).getCurrentNode(),
52 uiActionList.getChild(UIPageIterator.class).getCurrentPage());
53 } catch (Exception e) {
54 if (LOG.isErrorEnabled()) {
55 LOG.error("Unexpected error!", e.getMessage());
56 }
57 }
58 }
59
60
61
62
63 public void deActivate() {
64 try {
65 UIActionForm uiForm = findFirstComponentOfType(UIActionForm.class);
66 if (uiForm != null) {
67 uiForm.releaseLock();
68 }
69 } catch (Exception e) {
70 if (LOG.isErrorEnabled()) {
71 LOG.error("Unexpected error!", e.getMessage());
72 }
73 }
74 }
75
76 @Override
77 public void processRender(WebuiRequestContext context) throws Exception {
78 UIPopupWindow uiPopup = getAncestorOfType(UIPopupWindow.class);
79 if (uiPopup != null && !uiPopup.isShow()) {
80 uiPopup.setShowMask(true);
81 deActivate();
82 }
83 super.processRender(context);
84 }
85
86 public void setDefaultConfig() throws Exception {
87 UIActionContainer uiActionContainer = getChild(UIActionContainer.class);
88 UIActionTypeForm uiActionType = uiActionContainer.getChild(UIActionTypeForm.class);
89 uiActionType.setDefaultActionType();
90 Class[] renderClasses = { UIActionTypeForm.class, UIActionForm.class };
91 uiActionContainer.setRenderedChildrenOfTypes(renderClasses);
92 }
93
94 }