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.popup.admin;
18  
19  import org.exoplatform.ecm.webui.component.explorer.UIJCRExplorer;
20  import org.exoplatform.webui.core.UIPopupComponent;
21  import org.exoplatform.ecm.webui.tree.selectone.UIOneNodePathSelector;
22  import org.exoplatform.webui.config.annotation.ComponentConfig;
23  import org.exoplatform.webui.config.annotation.EventConfig;
24  import org.exoplatform.webui.core.UIContainer;
25  import org.exoplatform.webui.event.Event;
26  import org.exoplatform.webui.event.EventListener;
27  
28  /**
29   * Created by The eXo Platform SARL
30   * Author : Dang Van Minh
31   *          minh.dang@exoplatform.com
32   * Oct 18, 2006
33   * 10:29:16 AM
34   */
35  @ComponentConfig(
36      template = "app:/groovy/webui/component/explorer/UITabPaneWithAction.gtmpl",
37      events = @EventConfig(listeners = UIRelationManager.CloseActionListener.class)
38  )
39  public class UIRelationManager extends UIContainer implements UIPopupComponent {
40  
41    final static public String[] ACTIONS = {"Close"} ;
42  
43    public UIRelationManager() throws Exception {
44      addChild(UIRelationsAddedList.class, null, null) ;
45      addChild(UIOneNodePathSelector.class, null, null).setRendered(false) ;
46    }
47  
48    public String[] getActions() { return ACTIONS ; }
49  
50    static public class CloseActionListener extends EventListener<UIRelationManager> {
51      public void execute(Event<UIRelationManager> event) throws Exception {
52        UIJCRExplorer uiExplorer = event.getSource().getAncestorOfType(UIJCRExplorer.class) ;
53        uiExplorer.getCurrentNode().save() ;
54        uiExplorer.setIsHidePopup(false) ;
55        uiExplorer.cancelAction() ;
56        uiExplorer.updateAjax(event);
57      }
58    }
59  
60    public void activate() { }
61  
62    public void deActivate() { }
63  }