1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.exoplatform.ecm.webui.component.explorer;
18
19 import org.exoplatform.ecm.webui.tree.selectone.UIOneNodePathSelector;
20 import org.exoplatform.ecm.webui.tree.selectone.UIWorkspaceList;
21 import org.exoplatform.services.cms.drives.DriveData;
22 import org.exoplatform.services.cms.drives.ManageDriveService;
23 import org.exoplatform.services.wcm.utils.WCMCoreUtils;
24 import org.exoplatform.webui.config.annotation.ComponentConfig;
25 import org.exoplatform.webui.core.UIContainer;
26 import org.exoplatform.webui.core.UIPopupWindow;
27 import org.exoplatform.webui.core.lifecycle.UIContainerLifecycle;
28 import org.exoplatform.webui.form.UIFormSelectBox;
29
30
31
32
33
34
35
36
37 @ComponentConfig(
38 lifecycle = UIContainerLifecycle.class
39 )
40 public class UIJcrExplorerEditContainer extends UIContainer {
41
42 public UIJcrExplorerEditContainer() throws Exception {
43 addChild(UIJcrExplorerEditForm.class, null, null);
44 }
45
46 public UIPopupWindow initPopup(String id) throws Exception {
47 removeChildById(id);
48 UIPopupWindow uiPopup = addChild(UIPopupWindow.class, null, id);
49 uiPopup.setShowMask(true);
50 uiPopup.setWindowSize(700, 350);
51 uiPopup.setShow(true);
52 uiPopup.setResizable(true);
53 return uiPopup;
54 }
55
56 public UIPopupWindow initPopupDriveBrowser(String id, String driveName) throws Exception {
57 String repository = getAncestorOfType(UIJCRExplorerPortlet.class).getPreferenceRepository();
58 UIPopupWindow uiPopup = initPopup(id);
59 UIOneNodePathSelector uiOneNodePathSelector = createUIComponent(UIOneNodePathSelector.class, null, null);
60 UIWorkspaceList uiWorkspaceList= uiOneNodePathSelector.getChild(UIWorkspaceList.class);
61 uiOneNodePathSelector.setShowRootPathSelect(true);
62 uiWorkspaceList.getChild(UIFormSelectBox.class).setRendered(false);
63 ManageDriveService manageDrive = getApplicationComponent(ManageDriveService.class);
64 DriveData driveData = manageDrive.getDriveByName(driveName);
65 uiOneNodePathSelector.setRootNodeLocation(repository, driveData.getWorkspace(), driveData.getHomePath());
66 uiOneNodePathSelector.init(WCMCoreUtils.getUserSessionProvider());
67 uiPopup.setUIComponent(uiOneNodePathSelector);
68 uiOneNodePathSelector.setSourceComponent(this.getChild(UIJcrExplorerEditForm.class),
69 new String[] { UIJcrExplorerEditForm.PARAM_PATH_INPUT });
70 uiPopup.setRendered(true);
71 uiPopup.setShow(true);
72 uiPopup.setShowMask(true);
73 return uiPopup;
74 }
75 }