本文整理汇总了Java中elemental.events.Event.stopPropagation方法的典型用法代码示例。如果您正苦于以下问题:Java Event.stopPropagation方法的具体用法?Java Event.stopPropagation怎么用?Java Event.stopPropagation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类elemental.events.Event
的用法示例。
在下文中一共展示了Event.stopPropagation方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: runActions
import elemental.events.Event; //导入方法依赖的package包/类
/**
* 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() && e.getPresentation().isVisible()) {
/** Stop handling the key event */
keyEvent.preventDefault();
keyEvent.stopPropagation();
/** Perform the action */
action.actionPerformed(e);
}
}
}
示例2: handleEvent
import elemental.events.Event; //导入方法依赖的package包/类
@Override
public void handleEvent(Event evt) {
KeyboardEvent keyEvent = (KeyboardEvent) evt;
switch (keyEvent.getKeyCode()) {
case KeyboardEvent.KeyCode.ENTER:
commitIfValid(false);
break;
case KeyboardEvent.KeyCode.ESC:
cancel();
break;
default:
return;
}
evt.stopPropagation();
}
示例3: handleEvent
import elemental.events.Event; //导入方法依赖的package包/类
@Override
public void handleEvent(Event evt) {
for (Element clickTarget : clickTargets) {
if (clickTarget.contains((Node) evt.getTarget())) {
return;
}
}
forceHide();
if (stopOutsideClick) {
evt.stopPropagation();
}
}
示例4: handleEvent
import elemental.events.Event; //导入方法依赖的package包/类
@Override
public void handleEvent(Event evt) {
// Don't even bother to do anything unless we have someone ready to
// handle events.
if (getDelegate() == null
|| (primaryMouseButtonOnly
&& ((MouseEvent) evt).getButton() != MouseEvent.Button.PRIMARY)) {
return;
}
Element eventTarget = (Element) evt.getTarget();
if (CssUtils.containsClassName(eventTarget, css.expandControl())) {
onExpansionControlEvent(evt, eventTarget);
} else {
Element treeNodeBody =
CssUtils.getAncestorOrSelfWithClassName(eventTarget, css.treeNodeBody());
if (treeNodeBody != null) {
// this code emulate double click for tablets
if (Event.MOUSEDOWN.equals(evt.getType())) {
double currentClickMs = Duration.currentTimeMillis();
if (currentClickMs - previousClickMs < MouseGestureListener.MAX_CLICK_TIMEOUT_MS
&& treeNodeBody.equals(previousClickTreeNodeBody)) {
if (BrowserUtils.isAndroid() || BrowserUtils.isIPad() || BrowserUtils.isIphone()) {
evt.stopPropagation();
evt.preventDefault();
doActionsForDoubleClick(treeNodeBody, evt);
}
return;
} else {
this.previousClickMs = currentClickMs;
this.previousClickTreeNodeBody = treeNodeBody;
}
}
onTreeNodeBodyChildEvent(evt, treeNodeBody);
} else {
onOtherEvent(evt);
}
}
}
示例5: handleEvent
import elemental.events.Event; //导入方法依赖的package包/类
@Override
public void handleEvent(Event evt) {
evt.stopPropagation();
evt.preventDefault();
}