Search in sources :

Example 1 with TreeMenuCompositeAction

use of org.geosdi.geoplatform.gui.action.menu.tree.TreeMenuCompositeAction in project geo-platform by geosdi.

the class GPMenuActionBinder method bindMenuCheckAction.

@Override
public void bindMenuCheckAction(MenuCheckAction action, GPCheckMenuItem tool, final Menu menu) {
    checkArgument(tool != null, "The Parameter tool must not be null.");
    checkArgument(menu != null, "The Parameter menu must not be null.");
    final CheckMenuItem item = new CheckMenuItem(tool.getText());
    item.setItemId(tool.getId());
    menu.add(item);
    if (action != null) {
        action.setId(tool.getId());
        item.addSelectionListener(action);
        this.addMenuActionEnableHandler(action, item);
        action.addMenuActionChangeCheckHandler(new MenuActionChangeCheckHandler() {

            @Override
            public void onActionCheckChange(MenuActionChangeCheckEvent event) {
                item.setChecked(event.isCheck());
                item.fireEvent(Events.Select, new MenuEvent(menu, item));
            }
        });
        action.setChecked(tool.isChecked());
        action.setEnabled(tool.isEnabled());
        if ((action instanceof TreeMenuCompositeAction) && (this.menuCreator instanceof AbstractTreeMenuStrategy)) {
            ((TreeMenuCompositeAction) action).addTreeMenuSelectionHandler();
        }
    }
}
Also used : CheckMenuItem(com.extjs.gxt.ui.client.widget.menu.CheckMenuItem) AbstractTreeMenuStrategy(org.geosdi.geoplatform.gui.impl.tree.menu.strategy.AbstractTreeMenuStrategy) MenuActionChangeCheckHandler(org.geosdi.geoplatform.gui.action.menu.handler.MenuActionChangeCheckHandler) MenuActionChangeCheckEvent(org.geosdi.geoplatform.gui.action.menu.event.MenuActionChangeCheckEvent) MenuEvent(com.extjs.gxt.ui.client.event.MenuEvent) TreeMenuCompositeAction(org.geosdi.geoplatform.gui.action.menu.tree.TreeMenuCompositeAction)

Example 2 with TreeMenuCompositeAction

use of org.geosdi.geoplatform.gui.action.menu.tree.TreeMenuCompositeAction in project geo-platform by geosdi.

the class GPMenuActionBinder method bindMenuBaseAction.

/**
 * @param action
 * @param tool
 * @param menu
 */
@Override
public void bindMenuBaseAction(MenuAction action, GPMenuItem tool, final Menu menu) {
    checkArgument(tool != null, "The Parameter tool must not be null.");
    checkArgument(menu != null, "The Parameter menu must not be null.");
    final MenuItem item = new MenuItem(tool.getText());
    item.setItemId(tool.getId());
    if (action != null) {
        action.setId(tool.getId());
        if (action instanceof MenuBaseAction) {
            item.setIcon(((MenuBaseAction) action).getImage());
        }
        item.addSelectionListener(action);
        this.addMenuActionEnableHandler(action, item);
        action.setEnabled((action.isMustBeEnabled()) ? action.isMustBeEnabled() : tool.isEnabled());
        if ((action instanceof TreeMenuCompositeAction) && (this.menuCreator instanceof AbstractTreeMenuStrategy)) {
            ((TreeMenuCompositeAction) action).addTreeMenuSelectionHandler();
        }
    }
    menu.add(item);
}
Also used : MenuBaseAction(org.geosdi.geoplatform.gui.action.menu.MenuBaseAction) 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) TreeMenuCompositeAction(org.geosdi.geoplatform.gui.action.menu.tree.TreeMenuCompositeAction)

Aggregations

CheckMenuItem (com.extjs.gxt.ui.client.widget.menu.CheckMenuItem)2 TreeMenuCompositeAction (org.geosdi.geoplatform.gui.action.menu.tree.TreeMenuCompositeAction)2 AbstractTreeMenuStrategy (org.geosdi.geoplatform.gui.impl.tree.menu.strategy.AbstractTreeMenuStrategy)2 MenuEvent (com.extjs.gxt.ui.client.event.MenuEvent)1 MenuItem (com.extjs.gxt.ui.client.widget.menu.MenuItem)1 MenuBaseAction (org.geosdi.geoplatform.gui.action.menu.MenuBaseAction)1 MenuActionChangeCheckEvent (org.geosdi.geoplatform.gui.action.menu.event.MenuActionChangeCheckEvent)1 MenuActionChangeCheckHandler (org.geosdi.geoplatform.gui.action.menu.handler.MenuActionChangeCheckHandler)1