JBoss.orgCommunity Documentation

Add your own ActionListener

With the Webui framework, you will be notified if any given action is triggered. You just need to call your own action listener ($ACTIONNAME) ActionListener. For example, to create your own action listener for CacheView, do as follows:

1. Call CacheViewActionListener.

2. Add a static inner class called CacheViewActionListener that extends org.exoplatform.ecm.webui.component.admin.listener.UIECMAdminControlPanelActionListener.

You will see the expected code below:



public class CacheViewComponent extends UIAbstractManagerComponent {
        public static class CacheViewActionListener extends UIECMAdminControlPanelActionListener
<UIWCMCacheComponent>{
    public void processEvent(Event
    <UIWCMCacheComponent>event) throws Exception {
        UIECMAdminPortlet portlet = event.getSource().getAncestorOfType(UIECMAdminPortlet.class);
        UIECMAdminWorkingArea uiWorkingArea = portlet.getChild(UIECMAdminWorkingArea.class);
        uiWorkingArea.setChild(UIWCMCachePanel.class) ;
        event.getRequestContext().addUIComponentToUpdateByAjax(uiWorkingArea);
        }
        }
        }

3. Create the src/main/java directory and launch mvn eclipse:eclipse. You can then launch your eclipse and import this new project.

4. Create a new configuration file called conf/portal/configuration.xml to register your action (see Register your UI Action) with the org.exoplatform.webui.ext.UIExtensionManager service.