View Javadoc
1   /***************************************************************************
2    * Copyright (C) 2003-2009 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   **************************************************************************/
18  package org.exoplatform.ecm.webui.component.admin.taxonomy.action;
19  
20  import org.exoplatform.ecm.webui.component.admin.taxonomy.UITaxonomyManagerTrees;
21  import org.exoplatform.ecm.webui.component.admin.taxonomy.UITaxonomyTreeContainer;
22  import org.exoplatform.webui.config.annotation.ComponentConfig;
23  import org.exoplatform.webui.core.UIComponent;
24  import org.exoplatform.webui.core.UIContainer;
25  import org.exoplatform.webui.core.UIPopupWindow;
26  import org.exoplatform.webui.core.lifecycle.UIContainerLifecycle;
27  
28  /**
29   * Created by The eXo Platform SARL
30   * Author : Hoang Van Hung
31   *          hunghvit@gmail.com
32   * Apr 5, 2009
33   */
34  
35  @ComponentConfig(
36      lifecycle = UIContainerLifecycle.class
37  )
38  
39  public class UIActionTaxonomyManager extends UIContainer {
40  
41    public UIActionTaxonomyManager() throws Exception {
42      UIActionTypeForm uiActionTypeForm = getChild(UIActionTypeForm.class);
43      if (uiActionTypeForm == null) {
44        uiActionTypeForm = addChild(UIActionTypeForm.class, null, null);
45      }
46      addChild(UIActionForm.class, null, null);
47    }
48  
49    public void setDefaultConfig() throws Exception {
50      UIActionTypeForm uiActionType = getChild(UIActionTypeForm.class);
51      uiActionType.setDefaultActionType(null);
52      Class[] renderClasses = { UIActionTypeForm.class, UIActionForm.class };
53      setRenderedChildrenOfTypes(renderClasses);
54    }
55    
56    public void initPopupComponent(UIComponent uiComp, String id) throws Exception {
57      UITaxonomyManagerTrees uiManagerTrees = getAncestorOfType(UITaxonomyManagerTrees.class);
58      if (uiManagerTrees != null) {
59        uiManagerTrees.removeChildById(UITaxonomyTreeContainer.POPUP_PERMISSION);
60        uiManagerTrees.removeChildById(UITaxonomyTreeContainer.POPUP_TAXONOMYHOMEPATH);
61      }
62  
63      removeChildById(UIActionForm.POPUP_COMPONENT);
64      UIPopupWindow uiPopup = addChild(UIPopupWindow.class, null, id);
65      uiPopup.setShowMask(true);
66      uiPopup.setUIComponent(uiComp);
67      uiPopup.setWindowSize(640, 300);
68      uiPopup.setShow(true);
69      uiPopup.setResizable(true);
70    }
71  }