Search in sources :

Example 1 with OAuth2MenuBaseAction

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

the class GPMenuBarBuilder method addOAuth2MenuItem.

/**
 * Add a MenuItem with sub menu
 *
 * @param tool
 * @param menu
 */
@Override
public void addOAuth2MenuItem(OAuth2MenuBarClientTool tool, Menu menu) {
    OAuth2MenuBaseAction action = (OAuth2MenuBaseAction) menuRegistar.get(tool.getId());
    final MenuItem item = new MenuItem(tool.getText());
    if (action != null) {
        action.setId(tool.getId());
        item.setIcon(action.getImage());
        item.setItemId(action.getId());
        item.addSelectionListener(action);
        this.menuActionBinder.addMenuActionEnableHandler(action, item);
        action.addMenuActionChangeIconHandler(new MenuActionChangeIconHandler() {

            @Override
            public void onActionChangeIcon(MenuActionChangeIconEvent event) {
                item.setIcon(event.getImage());
            }
        });
        action.setEnabled(tool.isEnabled());
        action.setGoogleAuthUrl(tool.getGoogleAuthUrl());
        action.setGoogleClientId(tool.getGoogleClientId());
        action.setScope(tool.getScope());
    }
    menu.add(item);
}
Also used : OAuth2MenuBaseAction(org.geosdi.geoplatform.gui.action.menu.OAuth2MenuBaseAction) MenuActionChangeIconHandler(org.geosdi.geoplatform.gui.action.menu.handler.MenuActionChangeIconHandler) SeparatorMenuItem(com.extjs.gxt.ui.client.widget.menu.SeparatorMenuItem) MenuItem(com.extjs.gxt.ui.client.widget.menu.MenuItem) MenuActionChangeIconEvent(org.geosdi.geoplatform.gui.action.menu.event.MenuActionChangeIconEvent)

Aggregations

MenuItem (com.extjs.gxt.ui.client.widget.menu.MenuItem)1 SeparatorMenuItem (com.extjs.gxt.ui.client.widget.menu.SeparatorMenuItem)1 OAuth2MenuBaseAction (org.geosdi.geoplatform.gui.action.menu.OAuth2MenuBaseAction)1 MenuActionChangeIconEvent (org.geosdi.geoplatform.gui.action.menu.event.MenuActionChangeIconEvent)1 MenuActionChangeIconHandler (org.geosdi.geoplatform.gui.action.menu.handler.MenuActionChangeIconHandler)1