private boolean isRowDisabled(Element tr) { if (tr == null) { return true; } String index = tr.getAttribute("item-index"); if (index == null || "".equals(index)) { return true; } String enabled = tr.getAttribute("item-enabled"); if (enabled == null || "".equals(enabled) || "false".equals(enabled)) { return true; } int itemIndex = Integer.parseInt(index); Action menuItem = list.get(itemIndex); return !presentationFactory.getPresentation(menuItem).isEnabled(); }
@Override public void performAction(String actionId, Map<String, String> parameters) { final Action action; if (actionId != null && (action = getAction(actionId)) != null) { final Presentation presentation = presentationFactory.getPresentation(action); final ActionEvent actionEvent = new ActionEvent(presentation, this, parameters); action.update(actionEvent); if (presentation.isEnabled() && presentation.isVisible()) { action.actionPerformed(actionEvent); } } }
@Override public void onActionSelected(Action action) { ActionEvent e = new ActionEvent(presentationFactory.getPresentation(action), actionManager); action.update(e); if (e.getPresentation().isEnabled() && e.getPresentation().isVisible()) { view.hide(); action.actionPerformed(e); } }
/** * Finds and runs an action cancelling original key event * * @param actionIds list containing action ids * @param keyEvent original key event */ private void runActions(List<String> actionIds, Event keyEvent) { for (String actionId : actionIds) { Action action = actionManager.getAction(actionId); if (action == null) { continue; } ActionEvent e = new ActionEvent(presentationFactory.getPresentation(action), actionManager); action.update(e); if (e.getPresentation().isEnabled()) { /** Stop handling the key event */ keyEvent.preventDefault(); keyEvent.stopPropagation(); /** Perform the action */ action.actionPerformed(e); } } }
private void handleKey(NativeEvent event) { SignalEvent signalEvent = SignalEventUtils.create((Event) event, false); CharCodeWithModifiers keyBinding = keyBindingAgent.getKeyBinding(JavaExtension.JAVA_CLASS_STRUCTURE); if (signalEvent == null || keyBinding == null) { return; } int digest = CharCodeWithModifiers.computeKeyDigest(signalEvent); if (digest == keyBinding.getKeyDigest()) { Action action = actionManager.getAction(JavaExtension.JAVA_CLASS_STRUCTURE); if (action != null) { ActionEvent e = new ActionEvent(presentationFactor.getPresentation(action), actionManager); action.update(e); if (e.getPresentation().isEnabled()) { event.preventDefault(); event.stopPropagation(); action.actionPerformed(e); } } } } }
public ActionButton( Action action, ActionManager actionManager, Presentation presentation, ToolbarResources toolbarResources) { this.actionManager = actionManager; this.toolbarResources = toolbarResources; panel = new FlowPanel(); initWidget(panel); panel.setStyleName(toolbarResources.toolbar().iconButtonPanel()); this.action = action; this.presentation = presentation; addDomHandlers(); renderImage(); setEnabled(presentation.isEnabled()); setVisible(presentation.isVisible()); if (presentation.getDescription() != null) { tooltip = Tooltip.create( (elemental.dom.Element) panel.getElement(), PositionController.VerticalAlign.BOTTOM, PositionController.HorizontalAlign.MIDDLE, presentation.getDescription()); } }
setEnabled(presentation.isEnabled()); setVisible(presentation.isVisible());
i, 0, presentation.isEnabled() ? POPUP_RESOURCES.popup().popupMenuIconField() : POPUP_RESOURCES.popup().popupMenuIconFieldDisabled()); i, work, presentation.isEnabled() ? POPUP_RESOURCES.popup().popupMenuCheckField() : POPUP_RESOURCES.popup().popupMenuCheckFieldDisabled()); i, work, presentation.isEnabled() ? POPUP_RESOURCES.popup().popupMenuTitleField() : POPUP_RESOURCES.popup().popupMenuTitleFieldDisabled()); i, work, presentation.isEnabled() ? POPUP_RESOURCES.popup().popupMenuHotKeyField() : POPUP_RESOURCES.popup().popupMenuHotKeyFieldDisabled()); i, work, presentation.isEnabled() ? POPUP_RESOURCES.popup().popupMenuSubMenuField() : POPUP_RESOURCES.popup().popupMenuSubMenuFieldDisabled());