1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.exoplatform.ecm.webui.component.admin.views;
18
19 import org.exoplatform.webui.application.WebuiRequestContext;
20 import org.exoplatform.webui.config.annotation.ComponentConfig;
21 import org.exoplatform.webui.config.annotation.EventConfig;
22 import org.exoplatform.webui.core.UIComponent;
23 import org.exoplatform.webui.event.Event;
24 import org.exoplatform.webui.event.EventListener;
25 import org.exoplatform.webui.ext.manager.UIAbstractManager;
26
27
28
29
30
31
32
33
34
35 @ComponentConfig(template = "system:/groovy/webui/core/UITabPane_New.gtmpl",
36 events = { @EventConfig(listeners = UIViewManager.SelectTabActionListener.class) })
37
38 public class UIViewManager extends UIAbstractManager {
39
40 private String selectedTabId = "";
41
42 public String getSelectedTabId()
43 {
44 return selectedTabId;
45 }
46
47 public void setSelectedTab(String renderTabId)
48 {
49 selectedTabId = renderTabId;
50 }
51
52 public void setSelectedTab(int index)
53 {
54 selectedTabId = getChild(index - 1).getId();
55 }
56
57 public UIViewManager() throws Exception{
58 addChild(UIViewContainer.class, null, null);
59 UITemplateContainer uiECMTemp = addChild(UITemplateContainer.class, null, "ECMTemplate") ;
60 uiECMTemp.addChild(UIECMTemplateList.class, null, null) ;
61 setSelectedTab("UIViewContainer");
62 }
63
64 public void refresh() throws Exception {
65 update();
66 }
67
68 public void update() throws Exception {
69 getChild(UIViewContainer.class).update() ;
70 UIECMTemplateList uiECMTemplateList = ((UITemplateContainer)getChildById("ECMTemplate")).getChild(UIECMTemplateList.class);
71 uiECMTemplateList.refresh(uiECMTemplateList.getUIPageIterator().getCurrentPage());
72 }
73
74 static public class SelectTabActionListener extends EventListener<UIViewManager>
75 {
76 public void execute(Event<UIViewManager> event) throws Exception
77 {
78 WebuiRequestContext context = event.getRequestContext();
79 String renderTab = context.getRequestParameter(UIComponent.OBJECTID);
80 if (renderTab == null)
81 return;
82 event.getSource().setSelectedTab(renderTab);
83 WebuiRequestContext parentContext = (WebuiRequestContext)context.getParentAppRequestContext();
84 if (parentContext != null)
85 {
86 parentContext.setResponseComplete(true);
87 }
88 else
89 {
90 context.setResponseComplete(true);
91 }
92 }
93 }
94 }
95