/** * 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); } } }
@Override public void handleEvent(Event evt) { if (((Element) popup.getElement()).contains((Node) evt.getTarget())) { if (((Element) selectorLeft.getElement()).contains((Node) evt.getTarget())) { delegate.onSelectorLeftClicked(); } else if (((Element) selectorLeftBottom.getElement()) .contains((Node) evt.getTarget())) { delegate.onSelectorLeftBottomClicked(); } else if (((Element) selectorFullEditor.getElement()) .contains((Node) evt.getTarget())) { delegate.onSelectorFullEditorClicked(); } else if (((Element) selectorBottom.getElement()).contains((Node) evt.getTarget())) { delegate.onSelectorBottomClicked(); } else if (((Element) selectorRight.getElement()).contains((Node) evt.getTarget())) { delegate.onSelectorRightClicked(); } else if (((Element) selectorLeftRightBottom.getElement()) .contains((Node) evt.getTarget())) { delegate.onSelectorLeftRightBottomClicked(); } else { return; } hidePopup(); return; } if (((Element) button.getElement()).contains((Node) evt.getTarget())) { return; } hidePopup(); } };
break; case KeyCodes.KEY_ENTER: evt.preventDefault(); evt.stopImmediatePropagation(); validateItem(); break;
@Override public void handleEvent(final Event evt) { if (evt instanceof MouseEvent) { final MouseEvent mouseEvent = (MouseEvent) evt; final EventTarget target = mouseEvent.getTarget(); if (target instanceof Element) { final Element elementTarget = (Element) target; if (!PopupWidget.this.popupElement.contains(elementTarget)) { hide(); evt.preventDefault(); } } } // else won't happen } };
Event.CLICK, event -> { event.stopPropagation(); event.preventDefault(); event.stopPropagation(); event.preventDefault(); };
final JavaScriptObject jso = (JavaScriptObject) event.getTarget(); if (InputElement.is(jso) || AreaElement.is(jso)) { return;