1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.exoplatform.ecm.webui.component.explorer.search;
18
19 import org.exoplatform.services.log.ExoLogger;
20 import org.exoplatform.services.log.Log;
21 import org.exoplatform.webui.application.WebuiRequestContext;
22 import org.exoplatform.webui.config.annotation.ComponentConfig;
23 import org.exoplatform.webui.config.annotation.EventConfig;
24 import org.exoplatform.webui.core.UIComponent;
25 import org.exoplatform.webui.core.UIPageIterator;
26 import org.exoplatform.webui.core.UIPopupComponent;
27 import org.exoplatform.webui.core.UITabPane;
28 import org.exoplatform.webui.event.Event;
29 import org.exoplatform.webui.event.EventListener;
30
31
32
33
34
35
36
37
38
39
40 @ComponentConfig(template = "system:/groovy/webui/core/UITabPane_New.gtmpl",
41 events = { @EventConfig(listeners = UIECMSearch.SelectTabActionListener.class) })
42 public class UIECMSearch extends UITabPane implements UIPopupComponent {
43
44 private static final Log LOG = ExoLogger.getLogger(UIECMSearch.class.getName());
45
46 static public String ADVANCED_RESULT = "AdvancedSearchResult" ;
47
48 public UIECMSearch() throws Exception {
49 addChild(UIContentNameSearch.class,null,null);
50 setSelectedTab("UIContentNameSearch");
51 addChild(UISearchContainer.class, null, null) ;
52 addChild(UIJCRAdvancedSearch.class, null, null);
53 addChild(UISavedQuery.class, null, null);
54 UISearchResult uiSearchResult = addChild(UISearchResult.class, null, ADVANCED_RESULT);
55 UIPageIterator uiPageIterator = uiSearchResult.getChild(UIPageIterator.class) ;
56 uiPageIterator.setId("AdvanceSearchIterator") ;
57 }
58
59 public void activate() {
60 try {
61 UIJCRAdvancedSearch advanceSearch = getChild(UIJCRAdvancedSearch.class);
62 advanceSearch.update(null);
63 UISavedQuery uiQuery = getChild(UISavedQuery.class);
64 uiQuery.updateGrid(1);
65 } catch (Exception e) {
66 if (LOG.isErrorEnabled()) {
67 LOG.error("Unexpected error!", e.getMessage());
68 }
69 }
70 }
71
72 public void deActivate() {
73 }
74
75 static public class SelectTabActionListener extends EventListener<UIECMSearch>
76 {
77 public void execute(Event<UIECMSearch> event) throws Exception
78 {
79 WebuiRequestContext context = event.getRequestContext();
80 String renderTab = context.getRequestParameter(UIComponent.OBJECTID);
81 if (renderTab == null)
82 return;
83 event.getSource().setSelectedTab(renderTab);
84 context.setResponseComplete(true);
85 context.addUIComponentToUpdateByAjax(event.getSource().getParent());
86 }
87 }
88 }