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 UIAddTranslationManager extends UIContainer implements UIPopupComponent {
37    private static final Log LOG  = ExoLogger.getLogger(UIAddTranslationManager.class.getName());
38  
39    final static public String EXTARNAL_METADATA_POPUP = "AddMetadataPopup" ;
40  
41    public UIAddTranslationManager() throws Exception {
42      addChild(UIAddTranslationForm.class, null, null);
43      addChild(UISymLinkContainer.class, null, null).setRendered(false);
44    }
45  
46    public UIPopupWindow initPopupTaxonomy(String id) throws Exception {
47      UIPopupWindow uiPopup = getChildById(id);
48      if (uiPopup == null) {
49        uiPopup = addChild(UIPopupWindow.class, null, id);
50      }
51      uiPopup.setWindowSize(700, 350);
52      uiPopup.setShow(false);
53      uiPopup.setResizable(true);
54      return uiPopup;
55    }
56  
57    public void activate() {
58      try {
59        UIAddTranslationForm uiUploadForm = getChild(UIAddTranslationForm.class);
60        uiUploadForm.initFieldInput();
61      } catch (Exception e) {
62        if (LOG.isErrorEnabled()) {
63          LOG.error("Unexpected error!", e.getMessage());
64        }
65      }
66    }
67  
68    public void deActivate() {}
69  
70    public void initMetadataPopup() throws Exception {
71      removeChildById(EXTARNAL_METADATA_POPUP) ;
72      UIPopupWindow uiPopup = addChild(UIPopupWindow.class, null, EXTARNAL_METADATA_POPUP) ;
73      uiPopup.setShowMask(true);
74      uiPopup.setWindowSize(400, 400);
75      uiPopup.setRendered(true);
76      uiPopup.setShow(true) ;
77      uiPopup.setResizable(true) ;
78    }
79    public void useWorkspaceSelector() {
80      UIAddTranslationForm child = getChild(UIAddTranslationForm.class);
81      if (child!=null)  {
82        child.useWorkspaceSelector();
83      }
84    }
85  }