1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.exoplatform.wcm.webui.selector.content;
18
19 import javax.jcr.Node;
20
21 import org.exoplatform.ecm.webui.tree.UIBaseNodeTreeSelector;
22 import org.exoplatform.webui.config.annotation.ComponentConfig;
23 import org.exoplatform.webui.config.annotation.EventConfig;
24 import org.exoplatform.webui.core.lifecycle.Lifecycle;
25 import org.exoplatform.webui.event.Event;
26 import org.exoplatform.webui.event.EventListener;
27
28
29
30
31
32
33
34 @ComponentConfig(
35 lifecycle = Lifecycle.class,
36 events = {
37 @EventConfig(listeners = UIContentBrowsePanel.ChangeContentTypeActionListener.class)
38 }
39 )
40
41 public abstract class UIContentBrowsePanel extends UIBaseNodeTreeSelector {
42
43 public static final String WEBCONTENT = "Web Contents";
44
45 public static final String DMSDOCUMENT = "DMS Documents";
46
47 public static final String MEDIA = "Medias";
48
49 private String contentType = WEBCONTENT;
50
51 public String getContentType() {
52 return contentType;
53 }
54
55 public void setContentType(String contentType) {
56 this.contentType = contentType;
57 }
58
59 public void onChange(Node node, Object context) throws Exception {}
60
61 public static class ChangeContentTypeActionListener extends EventListener<UIContentBrowsePanel> {
62 public void execute(Event<UIContentBrowsePanel> event) throws Exception {
63 UIContentBrowsePanel contentBrowsePanel = event.getSource();
64 contentBrowsePanel.contentType = event.getRequestContext().getRequestParameter(OBJECTID);
65 event.getRequestContext()
66 .addUIComponentToUpdateByAjax(contentBrowsePanel.getAncestorOfType(UIContentSelector.class)
67 .getChild(UIContentSearchForm.class));
68 }
69 }
70 }