Search in sources :

Example 1 with GPTreeMenuGroupEnableEvent

use of org.geosdi.geoplatform.gui.configuration.composite.menu.puregwt.event.GPTreeMenuGroupEnableEvent in project geo-platform by geosdi.

the class GPMenuActionBinder method addMenuActionEnableHandler.

/**
 * @param action
 * @param item
 */
@Override
public void addMenuActionEnableHandler(MenuAction action, final MenuItem item) {
    checkArgument(action != null, "The Parameter action must not be null.");
    checkArgument(item != null, "The Parameter item must not be null.");
    action.addActionEnableHandler(new ActionEnableHandler() {

        @Override
        public void onActionEnabled(ActionEnableEvent event) {
            item.setEnabled(event.isEnabled());
            if ((menuCreator instanceof AbstractTreeMenuStrategy) && (item.getParentMenu() != null) && (item.getParentMenu().getParentItem() != null) && (item.getParentMenu().getParentItem() instanceof MenuItem) && ((MenuItem) (item.getParentMenu().getParentItem())).getSubMenu() != null) {
                Menu menu = item.getParentMenu();
                GPMenuActionHandlerManager.fireEventFromSource(new GPTreeMenuGroupEnableEvent(), menu.getId());
            }
        }
    });
}
Also used : GPTreeMenuGroupEnableEvent(org.geosdi.geoplatform.gui.configuration.composite.menu.puregwt.event.GPTreeMenuGroupEnableEvent) ActionEnableEvent(org.geosdi.geoplatform.gui.configuration.action.event.ActionEnableEvent) AbstractTreeMenuStrategy(org.geosdi.geoplatform.gui.impl.tree.menu.strategy.AbstractTreeMenuStrategy) MenuItem(com.extjs.gxt.ui.client.widget.menu.MenuItem) CheckMenuItem(com.extjs.gxt.ui.client.widget.menu.CheckMenuItem) Menu(com.extjs.gxt.ui.client.widget.menu.Menu) ActionEnableHandler(org.geosdi.geoplatform.gui.configuration.action.event.ActionEnableHandler)

Aggregations

CheckMenuItem (com.extjs.gxt.ui.client.widget.menu.CheckMenuItem)1 Menu (com.extjs.gxt.ui.client.widget.menu.Menu)1 MenuItem (com.extjs.gxt.ui.client.widget.menu.MenuItem)1 ActionEnableEvent (org.geosdi.geoplatform.gui.configuration.action.event.ActionEnableEvent)1 ActionEnableHandler (org.geosdi.geoplatform.gui.configuration.action.event.ActionEnableHandler)1 GPTreeMenuGroupEnableEvent (org.geosdi.geoplatform.gui.configuration.composite.menu.puregwt.event.GPTreeMenuGroupEnableEvent)1 AbstractTreeMenuStrategy (org.geosdi.geoplatform.gui.impl.tree.menu.strategy.AbstractTreeMenuStrategy)1