use of org.geosdi.geoplatform.gui.configuration.action.event.ActionEnableHandler in project geo-platform by geosdi.
the class GPSecureButton method initializeSecureAction.
private void initializeSecureAction(GeoPlatformSecureAction<ButtonEvent> action) {
action.addActionEnableHandler(new ActionEnableHandler() {
@Override
public void onActionEnabled(ActionEnableEvent event) {
if (event.isEnabled()) {
GPSecureButton.super.enable();
} else {
GPSecureButton.super.disable();
}
}
});
this.secureAction = action;
this.enable();
}
use of org.geosdi.geoplatform.gui.configuration.action.event.ActionEnableHandler in project geo-platform by geosdi.
the class BasicEditorPanel method prepareButton.
/**
* <p>Inject in button all Action Properties and assign to the Action the
* {@link ActionEnableHandler} Handler to Enable / Disable it. </p>
*
* @param button
* @param action
* @param tool
*/
protected final void prepareButton(final Button button, ToolbarAction action, WidgetGenericTool<IGeoPlatformEditor> tool) {
button.setId(action.getId());
button.setToolTip(action.getTooltip());
button.setIcon(action.getImage());
button.addSelectionListener(action);
action.addActionEnableHandler(new ActionEnableHandler() {
@Override
public void onActionEnabled(ActionEnableEvent event) {
button.setEnabled(event.isEnabled());
}
});
action.setEnabled(tool.isEnabled());
}
use of org.geosdi.geoplatform.gui.configuration.action.event.ActionEnableHandler in project geo-platform by geosdi.
the class GPMapToolbarWidget method prepareButton.
/**
* Prepare a Button from a Item and set an enable handler Action.
*
* @param button the Button to prepare
* @param action the enable Action
* @param tool the Item of reference
*/
private void prepareButton(final Button button, ToolbarAction action, WidgetGenericTool<IGeoPlatformToolbar> tool) {
button.setId(action.getId());
button.setToolTip(action.getTooltip());
if (action.getImage() != null) {
button.setIcon(action.getImage());
}
if ((tool.getText() != null) && !(tool.getText().isEmpty())) {
button.setText(tool.getText());
}
button.addSelectionListener(action);
action.addActionEnableHandler(new ActionEnableHandler() {
@Override
public void onActionEnabled(ActionEnableEvent event) {
button.setEnabled(event.isEnabled());
}
});
action.setEnabled(tool.isEnabled());
}
use of org.geosdi.geoplatform.gui.configuration.action.event.ActionEnableHandler in project geo-platform by geosdi.
the class GPMenuActionBinder method addMenuActionEnableHandler.
/**
* @param action
* @param item
*/
@Override
public void addMenuActionEnableHandler(MenuAction action, final MenuItem item) {
checkArgument(action != null, "The Parameter action must not be null.");
checkArgument(item != null, "The Parameter item must not be null.");
action.addActionEnableHandler(new ActionEnableHandler() {
@Override
public void onActionEnabled(ActionEnableEvent event) {
item.setEnabled(event.isEnabled());
if ((menuCreator instanceof AbstractTreeMenuStrategy) && (item.getParentMenu() != null) && (item.getParentMenu().getParentItem() != null) && (item.getParentMenu().getParentItem() instanceof MenuItem) && ((MenuItem) (item.getParentMenu().getParentItem())).getSubMenu() != null) {
Menu menu = item.getParentMenu();
GPMenuActionHandlerManager.fireEventFromSource(new GPTreeMenuGroupEnableEvent(), menu.getId());
}
}
});
}
Aggregations