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