View Javadoc
1   /*
2    * Copyright (C) 2003-2007 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.ecm.webui.component.explorer.symlink;
18  
19  import org.exoplatform.services.log.ExoLogger;
20  import org.exoplatform.services.log.Log;
21  import org.exoplatform.webui.config.annotation.ComponentConfig;
22  import org.exoplatform.webui.core.UIContainer;
23  import org.exoplatform.webui.core.UIPopupComponent;
24  import org.exoplatform.webui.core.UIPopupWindow;
25  import org.exoplatform.webui.core.lifecycle.UIContainerLifecycle;
26  
27  /**
28   * Created by The eXo Platform SARL
29   * Author : Dang Van Minh
30   *          minh.dang@exoplatform.com
31   * May 24, 2007 2:12:48 PM
32   */
33  @ComponentConfig(
34      lifecycle = UIContainerLifecycle.class
35  )
36  public class UISymLinkManager extends UIContainer implements UIPopupComponent {
37    private static final Log LOG  = ExoLogger.getLogger(UISymLinkManager.class.getName());
38  
39    final static public String EXTARNAL_METADATA_POPUP = "AddMetadataPopup" ;
40  
41    public UISymLinkManager() throws Exception {
42      addChild(UISymLinkForm.class, null, null);
43      addChild(UISymLinkContainer.class, null, null).setRendered(false);
44    }
45  
46    public void enableLocalizationMode() {
47      UISymLinkForm linkForm = this.getChild(UISymLinkForm.class);
48      linkForm.enableLocalizationMode();
49    }
50  
51    public UIPopupWindow initPopupTaxonomy(String id) throws Exception {
52      UIPopupWindow uiPopup = getChildById(id);
53      if (uiPopup == null) {
54        uiPopup = addChild(UIPopupWindow.class, null, id);
55      }
56      uiPopup.setWindowSize(700, 350);
57      uiPopup.setShow(false);
58      uiPopup.setResizable(true);
59      return uiPopup;
60    }
61  
62    public void activate() {
63      try {
64        UISymLinkForm uiUploadForm = getChild(UISymLinkForm.class);
65        uiUploadForm.initFieldInput();
66      } catch (Exception e) {
67        if (LOG.isErrorEnabled()) {
68          LOG.error("Unexpected error!", e.getMessage());
69        }
70      }
71    }
72  
73    public void deActivate() {}
74  
75    public void initMetadataPopup() throws Exception {
76      removeChildById(EXTARNAL_METADATA_POPUP) ;
77      UIPopupWindow uiPopup = addChild(UIPopupWindow.class, null, EXTARNAL_METADATA_POPUP) ;
78      uiPopup.setShowMask(true);
79      uiPopup.setWindowSize(400, 400);
80      uiPopup.setRendered(true);
81      uiPopup.setShow(true) ;
82      uiPopup.setResizable(true) ;
83    }
84    public void useWorkspaceSelector() {
85      UISymLinkForm child = getChild(UISymLinkForm.class);
86      if (child!=null)  {
87        child.useWorkspaceSelector();
88      }
89    }
90  }