View Javadoc
1   /*
2    * Copyright (C) 2003-2008 eXo Platform SAS.
3    *
4    * This program is free software; you can redistribute it and/or
5    * modify it under the terms of the GNU Affero General Public License
6    * as published by the Free Software Foundation; either version 3
7    * of the License, or (at your option) any later version.
8    *
9    * This program is distributed in the hope that it will be useful,
10   * but WITHOUT ANY WARRANTY; without even the implied warranty of
11   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12   * GNU General Public License for more details.
13   *
14   * You should have received a copy of the GNU General Public License
15   * along with this program; if not, see<http://www.gnu.org/licenses/>.
16   */
17  package org.exoplatform.wcm.webui.selector.content.folder;
18  
19  import org.exoplatform.ecm.webui.selector.UISelectable;
20  import org.exoplatform.wcm.webui.selector.content.UIContentBrowsePanel;
21  import org.exoplatform.webui.config.annotation.ComponentConfig;
22  import org.exoplatform.webui.config.annotation.EventConfig;
23  import org.exoplatform.webui.core.lifecycle.Lifecycle;
24  import org.exoplatform.webui.event.Event;
25  import org.exoplatform.webui.event.EventListener;
26  
27  /**
28   * Created by The eXo Platform SAS.
29   *
30   * @author : Hoa.Pham hoa.pham@exoplatform.com Jun 23, 2008
31   */
32  
33  @ComponentConfig(
34    lifecycle = Lifecycle.class,
35    template = "classpath:groovy/wcm/webui/selector/content/folder/UIContentBrowsePanel.gtmpl",
36    events = {
37      @EventConfig(listeners = UIContentBrowsePanel.ChangeContentTypeActionListener.class),
38      @EventConfig(listeners = UIContentBrowsePanelFolder.SelectActionListener.class)
39    }
40  )
41  
42  public class UIContentBrowsePanelFolder extends UIContentBrowsePanel{
43  
44    private String _initPath = "";
45    private String _initDrive = "";
46  
47    public void setInitPath(String initDrive, String initPath) {
48      this._initPath = initPath;
49      this._initDrive = initDrive;
50    }
51  
52    public String getInitDrive() { return this._initDrive; }
53    public String getInitPath() { return this._initPath; }
54  
55    public static class SelectActionListener extends EventListener<UIContentBrowsePanel> {
56      public void execute(Event<UIContentBrowsePanel> event) throws Exception {
57        UIContentBrowsePanel contentBrowsePanel = event.getSource();
58        String returnFieldName = contentBrowsePanel.getReturnFieldName();
59        ((UISelectable) (contentBrowsePanel.getSourceComponent())).doSelect(returnFieldName,
60                                                                            event.getRequestContext()
61                                                                                 .getRequestParameter(OBJECTID));
62      }
63    }
64  }