com.google.gwt.user.client.Event.preventDefault()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(5.7k)|赞(0)|评价(0)|浏览(180)

本文整理了Java中com.google.gwt.user.client.Event.preventDefault()方法的一些代码示例,展示了Event.preventDefault()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Event.preventDefault()方法的具体详情如下:
包路径:com.google.gwt.user.client.Event
类名称:Event
方法名:preventDefault

Event.preventDefault介绍

暂无

代码示例

代码示例来源:origin: com.google.gwt/gwt-servlet

/**
 * If a keyboard event is currently being handled on this text box, calling
 * this method will suppress it. This allows listeners to easily filter
 * keyboard input.
 */
public void cancelKey() {
 if (currentEvent != null) {
  currentEvent.preventDefault();
 }
}

代码示例来源:origin: com.google.gwt/gwt-servlet

/**
 * Prevents the browser from taking its default action for the given event.
 * 
 * @param evt the event whose default action is to be prevented
 * @deprecated Use {@link Event#preventDefault()} instead.
 */
@Deprecated
public static void eventPreventDefault(Event evt) {
 evt.preventDefault();
}

代码示例来源:origin: com.google.gwt/gwt-servlet

private static void dispatchDragEvent(Event evt) {
 // Some drag events must call preventDefault to prevent native text selection.
 evt.preventDefault();
 dispatchEvent(evt);
}

代码示例来源:origin: com.google.gwt/gwt-servlet

private void eatEvent(Event event) {
 event.stopPropagation();
 event.preventDefault();
}

代码示例来源:origin: com.google.gwt/gwt-servlet

/**
 * This method is called directly by native code when event preview is being
 * used.
 * 
 * @param evt a handle to the event being previewed
 * @return <code>false</code> to cancel the event
 */
public static boolean previewEvent(Event evt) {
 // Fire a NativePreviewEvent to NativePreviewHandlers
 boolean ret = Event.fireNativePreviewEvent(evt);
 // If the preview cancels the event, stop it from bubbling and performing
 // its default action. Check for a null evt to allow unit tests to run.
 if (!ret && evt != null) {
  evt.stopPropagation();
  evt.preventDefault();
 }
 return ret;
}

代码示例来源:origin: stackoverflow.com

NodeList nodeList = document.getElementsByTagName("a");
     for (int i = 0; i < nodeList.getLength(); i++)
     {
       Node node= nodeList.item(i);
       EventTarget eventTarget = (EventTarget) node;
       eventTarget.addEventListener("click", new EventListener()
       {
         @Override
         public void handleEvent(Event evt)
         {
           EventTarget target = evt.getCurrentTarget();
           HTMLAnchorElement anchorElement = (HTMLAnchorElement) target;
           String href = anchorElement.getHref();
           //handle opening URL outside JavaFX WebView
           System.out.println(href);
           evt.preventDefault();
         }
       }, false);
     }

代码示例来源:origin: com.google.gwt/gwt-servlet

@Override
public void onBrowserEvent(Event event) {
 super.onBrowserEvent(event);
 if (DOM.eventGetType(event) == Event.ONCLICK && impl.handleAsClick(event)) {
  History.newItem(getTargetHistoryToken());
  event.preventDefault();
 }
}

代码示例来源:origin: com.google.gwt/gwt-servlet

public void onMouseDown(MouseDownEvent event) {
 dragging = true;
 DOM.setCapture(dragHandle.getElement());
 dragStartX = event.getClientX();
 dragStartY = event.getClientY();
 DOM.eventGetCurrentEvent().preventDefault();
}

代码示例来源:origin: com.google.gwt/gwt-servlet

event.preventDefault();
 return;
case 32:
 event.preventDefault();
event.preventDefault();

代码示例来源:origin: com.google.gwt/gwt-servlet

event.preventDefault();
break;
event.preventDefault();
break;
 event.preventDefault();

代码示例来源:origin: com.google.gwt/gwt-servlet

event.getClientY() - getAbsoluteTop());
DOM.setCapture(getElement());
event.preventDefault();
onSplitterResize(event.getClientX() - getAbsoluteLeft(),
  event.getClientY() - getAbsoluteTop());
event.preventDefault();

代码示例来源:origin: info.magnolia.ui/magnolia-ui-vaadin-common-widgets

@Override
  public void run() {
    if (touchStart != null) {
      // Open the context menu if finger
      // is held in place long enough.
      target.showContextMenu(touchStart);
      event.preventDefault();
      touchStart = null;
    }
  }
};

代码示例来源:origin: com.google.gwt/gwt-servlet

isCapturing = true;
 event.preventDefault();
if (isCapturing) {
 event.preventDefault();

代码示例来源:origin: com.google.gwt/gwt-servlet

if (KeyCodes.isArrowKey(event.getKeyCode())) {
 event.stopPropagation();
 event.preventDefault();
 return;

代码示例来源:origin: pt.ist/svgwt

/****************************************************/
public void onBrowserEvent(Event event) {
  event.preventDefault();
  if(_disabled) return;
  BrowserEvent<?> browserEvent = BrowserEventSupport.lookupBrowserEvent(event, this);
  onBrowserEvent(browserEvent);
  DomEvent.fireNativeEvent(event, this, getElement());
}

代码示例来源:origin: org.gwtbootstrap3/gwtbootstrap3

@Override
public void onBrowserEvent(Event event) {
  super.onBrowserEvent(event);
  if (getTargetHistoryToken() != null) {
    // implementation is based on Hyperlink#onBrowserEvent
    if (DOM.eventGetType(event) == Event.ONCLICK && impl.handleAsClick(event)) {
      History.newItem(getTargetHistoryToken());
      event.preventDefault();
    }
  }
}

代码示例来源:origin: gwtbootstrap3/gwtbootstrap3

@Override
public void onBrowserEvent(Event event) {
  super.onBrowserEvent(event);
  if (getTargetHistoryToken() != null) {
    // implementation is based on Hyperlink#onBrowserEvent
    if (DOM.eventGetType(event) == Event.ONCLICK && impl.handleAsClick(event)) {
      History.newItem(getTargetHistoryToken());
      event.preventDefault();
    }
  }
}

代码示例来源:origin: com.extjs/gxt

@Override
public void onBrowserEvent(Event event) {
 if (disabled && event.getTypeInt() == Event.ONCLICK && Element.is(event.getEventTarget())
   && fly((Element) Element.as(event.getEventTarget())).is(checkBoxSelector)) {
  event.preventDefault();
 }
 super.onBrowserEvent(event);
}

代码示例来源:origin: com.haulmont.cuba/cuba-web-toolkit

private void beginMovingWindow(Event event) {
  if (draggable) {
    showDraggingCurtain();
    dragging = true;
    startX = WidgetUtil.getTouchOrMouseClientX(event);
    startY = WidgetUtil.getTouchOrMouseClientY(event);
    origX = getElement().getAbsoluteLeft();
    origY = getElement().getAbsoluteTop();
    DOM.setCapture(getElement());
    event.preventDefault();
  }
}

代码示例来源:origin: com.arcbees/gwtchosen

private boolean choicesClick(Event e) {
  e.preventDefault();
  Element target = e.getEventTarget().cast();
  GQuery $e = $(target);
  if (activeField
      && !($e.hasClass(getCss().searchChoice()) || !$e.parents("." + getCss().searchChoice()).isEmpty())
      && !resultsShowing) {
    resultsShow();
  }
  return true;
}

相关文章