Search in sources :

Example 1 with ActionEnableHandler

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();
}
Also used : ActionEnableEvent(org.geosdi.geoplatform.gui.configuration.action.event.ActionEnableEvent) ActionEnableHandler(org.geosdi.geoplatform.gui.configuration.action.event.ActionEnableHandler)

Example 2 with ActionEnableHandler

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());
}
Also used : ActionEnableEvent(org.geosdi.geoplatform.gui.configuration.action.event.ActionEnableEvent) ActionEnableHandler(org.geosdi.geoplatform.gui.configuration.action.event.ActionEnableHandler)

Example 3 with ActionEnableHandler

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());
}
Also used : ActionEnableEvent(org.geosdi.geoplatform.gui.configuration.action.event.ActionEnableEvent) ActionEnableHandler(org.geosdi.geoplatform.gui.configuration.action.event.ActionEnableHandler)

Example 4 with ActionEnableHandler

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());
            }
        }
    });
}
Also used : GPTreeMenuGroupEnableEvent(org.geosdi.geoplatform.gui.configuration.composite.menu.puregwt.event.GPTreeMenuGroupEnableEvent) ActionEnableEvent(org.geosdi.geoplatform.gui.configuration.action.event.ActionEnableEvent) 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) Menu(com.extjs.gxt.ui.client.widget.menu.Menu) ActionEnableHandler(org.geosdi.geoplatform.gui.configuration.action.event.ActionEnableHandler)

Aggregations

ActionEnableEvent (org.geosdi.geoplatform.gui.configuration.action.event.ActionEnableEvent)4 ActionEnableHandler (org.geosdi.geoplatform.gui.configuration.action.event.ActionEnableHandler)4 CheckMenuItem (com.extjs.gxt.ui.client.widget.menu.CheckMenuItem)1 Menu (com.extjs.gxt.ui.client.widget.menu.Menu)1 MenuItem (com.extjs.gxt.ui.client.widget.menu.MenuItem)1 GPTreeMenuGroupEnableEvent (org.geosdi.geoplatform.gui.configuration.composite.menu.puregwt.event.GPTreeMenuGroupEnableEvent)1 AbstractTreeMenuStrategy (org.geosdi.geoplatform.gui.impl.tree.menu.strategy.AbstractTreeMenuStrategy)1