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;
}
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);
}
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;
}
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);
}
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;
}
Aggregations