Search in sources :

Example 1 with MenuBaseAction

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

the class GPMapToolbarWidget method createMenu.

/**
 * Create a Menu with an Item from each Action.
 *
 * @param actionTools the list of Action
 * @return the Menu
 */
private Menu createMenu(List<ToolbarActionTool> actionTools) {
    Menu menu = new Menu();
    MenuActionRegistar menuRegistar = BasicGinInjector.MainInjector.getInstance().getMenuActionRegistar();
    for (ToolbarActionTool actionTool : actionTools) {
        MenuBaseAction action = (MenuBaseAction) menuRegistar.get(actionTool.getId());
        MenuItem item = new MenuItem(action.getTitle());
        item.addSelectionListener(action);
        item.setIcon(action.getImage());
        menu.add(item);
    }
    return menu;
}
Also used : MenuActionRegistar(org.geosdi.geoplatform.gui.action.menu.MenuActionRegistar) MenuBaseAction(org.geosdi.geoplatform.gui.action.menu.MenuBaseAction) MenuItem(com.extjs.gxt.ui.client.widget.menu.MenuItem) Menu(com.extjs.gxt.ui.client.widget.menu.Menu)

Example 2 with MenuBaseAction

use of org.geosdi.geoplatform.gui.action.menu.MenuBaseAction 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)

Example 3 with MenuBaseAction

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

the class LayerTreeBasicMenu method buildBasicMenu.

private Menu buildBasicMenu() {
    Menu m = new Menu();
    MenuActionRegistar menuRegistar = BasicGinInjector.MainInjector.getInstance().getMenuActionRegistar();
    MenuBaseAction baseAction = (MenuBaseAction) menuRegistar.get("aboutGeoPlatform");
    SelectionListener selectionListener = (baseAction != null) ? baseAction : new SelectionListener<MenuEvent>() {

        @Override
        public void componentSelected(MenuEvent ce) {
        }
    };
    MenuItem item = new MenuItem(baseAction.getTitle(), baseAction.getImage(), selectionListener);
    m.add(item);
    return m;
}
Also used : MenuActionRegistar(org.geosdi.geoplatform.gui.action.menu.MenuActionRegistar) MenuBaseAction(org.geosdi.geoplatform.gui.action.menu.MenuBaseAction) MenuItem(com.extjs.gxt.ui.client.widget.menu.MenuItem) Menu(com.extjs.gxt.ui.client.widget.menu.Menu) SelectionListener(com.extjs.gxt.ui.client.event.SelectionListener) MenuEvent(com.extjs.gxt.ui.client.event.MenuEvent)

Example 4 with MenuBaseAction

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

the class GPMenuBarBuilder method addMenuItem.

/**
 * Add Simple MenuItem to Menu
 *
 * @param tool
 * @param menu
 */
@Override
public void addMenuItem(GPMenuItem tool, Menu menu) {
    MenuBaseAction action = (MenuBaseAction) menuRegistar.get(tool.getId());
    this.menuActionBinder.bindMenuBaseAction(action, tool, menu);
}
Also used : MenuBaseAction(org.geosdi.geoplatform.gui.action.menu.MenuBaseAction) OAuth2MenuBaseAction(org.geosdi.geoplatform.gui.action.menu.OAuth2MenuBaseAction)

Example 5 with MenuBaseAction

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

the class ManageRolesWidget method createGuiComponentDetail.

private GuiComponentDetail createGuiComponentDetail(String componentId) {
    GuiComponentDetail gc = new GuiComponentDetail();
    gc.setComponentId(componentId);
    // gc.setDescription(action.get....()); // TODO Manage description
    // TODO Manage icon
    MenuActionRegistar menuRegistar = BasicGinInjector.MainInjector.getInstance().getMenuActionRegistar();
    GeoPlatformAction action = menuRegistar.get(componentId);
    if (action != null) {
        if (action instanceof MenuBaseAction) {
            AbstractImagePrototype image = ((MenuBaseAction) action).getImage();
            if (image != null) {
                gc.setImage(image);
            }
        // }else{
        // action = ToolbarActionRegistar.get(entry.getKey(), null)
        }
    }
    if (gc.getImage() == null) {
        gc.setImage(defaultImage);
    }
    return gc;
}
Also used : AbstractImagePrototype(com.google.gwt.user.client.ui.AbstractImagePrototype) GuiComponentDetail(org.geosdi.geoplatform.gui.client.model.GuiComponentDetail) MenuActionRegistar(org.geosdi.geoplatform.gui.action.menu.MenuActionRegistar) MenuBaseAction(org.geosdi.geoplatform.gui.action.menu.MenuBaseAction) GeoPlatformAction(org.geosdi.geoplatform.gui.configuration.action.GeoPlatformAction)

Aggregations

MenuBaseAction (org.geosdi.geoplatform.gui.action.menu.MenuBaseAction)5 MenuItem (com.extjs.gxt.ui.client.widget.menu.MenuItem)3 MenuActionRegistar (org.geosdi.geoplatform.gui.action.menu.MenuActionRegistar)3 Menu (com.extjs.gxt.ui.client.widget.menu.Menu)2 MenuEvent (com.extjs.gxt.ui.client.event.MenuEvent)1 SelectionListener (com.extjs.gxt.ui.client.event.SelectionListener)1 CheckMenuItem (com.extjs.gxt.ui.client.widget.menu.CheckMenuItem)1 AbstractImagePrototype (com.google.gwt.user.client.ui.AbstractImagePrototype)1 OAuth2MenuBaseAction (org.geosdi.geoplatform.gui.action.menu.OAuth2MenuBaseAction)1 TreeMenuCompositeAction (org.geosdi.geoplatform.gui.action.menu.tree.TreeMenuCompositeAction)1 GuiComponentDetail (org.geosdi.geoplatform.gui.client.model.GuiComponentDetail)1 GeoPlatformAction (org.geosdi.geoplatform.gui.configuration.action.GeoPlatformAction)1 AbstractTreeMenuStrategy (org.geosdi.geoplatform.gui.impl.tree.menu.strategy.AbstractTreeMenuStrategy)1