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.ecm.webui.selector;
18  
19  import org.exoplatform.ecm.webui.form.UIFormInputSetWithAction;
20  import org.exoplatform.webui.config.annotation.ComponentConfig;
21  import org.exoplatform.webui.config.annotation.EventConfig;
22  import org.exoplatform.webui.core.UIComponent;
23  import org.exoplatform.webui.core.lifecycle.UIFormLifecycle;
24  import org.exoplatform.webui.event.Event;
25  import org.exoplatform.webui.event.EventListener;
26  import org.exoplatform.webui.form.UIForm;
27  import org.exoplatform.webui.form.UIFormInputInfo;
28  
29  /**
30   * Created by The eXo Platform SAS
31   * Author : Ly Dinh Quang
32   *          quang.ly@exoplatform.com
33   *          xxx5669@yahoo.com
34   * Oct 9, 2008
35   */
36  @ComponentConfig(
37      lifecycle = UIFormLifecycle.class,
38      template = "classpath:groovy/ecm/webui/form/UIFormWithoutAction.gtmpl",
39      events = {
40        @EventConfig(listeners = UIAnyPermission.AddAnyPermissionActionListener.class)
41      }
42  )
43  public class UIAnyPermission extends UIForm {
44    static private String ANYPERMISSION = "anyPermission";
45  
46    public UIAnyPermission() throws Exception {
47      UIFormInputSetWithAction rootNodeInfo = new UIFormInputSetWithAction(ANYPERMISSION);
48      rootNodeInfo.addUIFormInput(new UIFormInputInfo("any", "any", null));
49      String[] actionInfor = {"AddAnyPermission"};
50      rootNodeInfo.setActionInfo("any", actionInfor);
51      rootNodeInfo.showActionInfo(true);
52      addUIComponentInput(rootNodeInfo);
53    }
54  
55    static public class AddAnyPermissionActionListener extends EventListener<UIAnyPermission> {
56      public void execute(Event<UIAnyPermission> event) throws Exception {
57        UIAnyPermission uiAnyPermission = event.getSource();
58        uiAnyPermission.<UIComponent>getParent().broadcast(event, event.getExecutionPhase()) ;
59      }
60    }
61  }