com.gargoylesoftware.htmlunit.javascript.host.Window.getEventListenersContainer()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 JavaScript  
字(7.8k)|赞(0)|评价(0)|浏览(153)

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

Window.getEventListenersContainer介绍

[英]Gets the container for event listeners.
[中]获取事件侦听器的容器。

代码示例

代码示例来源:origin: org.jvnet.hudson/htmlunit

private void setHandlerForJavaScript(final String eventName, final Object handler) {
  if (handler instanceof Function) {
    getEventListenersContainer().setEventHandlerProp(eventName, handler);
  }
  // Otherwise, fail silently.
}

代码示例来源:origin: org.jenkins-ci/htmlunit

/**
 * Allows the registration of event listeners on the event target.
 * @param type the event type to listen for (like "onload")
 * @param listener the event listener
 * @param useCapture If <code>true</code>, indicates that the user wishes to initiate capture (not yet implemented)
 * @see <a href="http://developer.mozilla.org/en/docs/DOM:element.addEventListener">Mozilla documentation</a>
 */
public void jsxFunction_addEventListener(final String type, final Function listener, final boolean useCapture) {
  getEventListenersContainer().addEventListener(type, listener, useCapture);
}

代码示例来源:origin: org.jvnet.hudson/htmlunit

/**
 * Allows the registration of event listeners on the event target.
 * @param type the event type to listen for (like "onload")
 * @param listener the event listener
 * @param useCapture If <code>true</code>, indicates that the user wishes to initiate capture (not yet implemented)
 * @see <a href="http://developer.mozilla.org/en/docs/DOM:element.addEventListener">Mozilla documentation</a>
 */
public void jsxFunction_addEventListener(final String type, final Function listener, final boolean useCapture) {
  getEventListenersContainer().addEventListener(type, listener, useCapture);
}

代码示例来源:origin: org.jenkins-ci/htmlunit

/**
 * Sets the value of the onload event handler.
 * @param newOnload the new handler
 */
public void jsxSet_onload(final Object newOnload) {
  getEventListenersContainer().setEventHandlerProp("load", newOnload);
}

代码示例来源:origin: org.jenkins-ci/htmlunit

/**
 * Returns the ondblclick property (caution this is not necessary a function if something else has
 * been set).
 * @return the ondblclick property
 */
public Object jsxGet_ondblclick() {
  return getEventListenersContainer().getEventHandlerProp("dblclick");
}

代码示例来源:origin: org.jenkins-ci/htmlunit

private void setHandlerForJavaScript(final String eventName, final Object handler) {
  if (handler instanceof Function) {
    getEventListenersContainer().setEventHandlerProp(eventName, handler);
  }
  // Otherwise, fail silently.
}

代码示例来源:origin: org.jvnet.hudson/htmlunit

/**
 * Sets the value of the onload event handler.
 * @param newOnload the new handler
 */
public void jsxSet_onload(final Object newOnload) {
  getEventListenersContainer().setEventHandlerProp("load", newOnload);
}

代码示例来源:origin: org.jenkins-ci/htmlunit

/**
 * Sets the value of the ondblclick event handler.
 * @param newHandler the new handler
 */
public void jsxSet_ondblclick(final Object newHandler) {
  getEventListenersContainer().setEventHandlerProp("dblclick", newHandler);
}

代码示例来源:origin: net.disy.htmlunit/htmlunit

/**
 * Sets the value of the onload event handler.
 * @param newOnload the new handler
 */
public void jsxSet_onload(final Object newOnload) {
  getEventListenersContainer().setEventHandlerProp("load", newOnload);
}

代码示例来源:origin: net.disy.htmlunit/htmlunit

/**
 * Sets the value of the ondblclick event handler.
 * @param newHandler the new handler
 */
public void jsxSet_ondblclick(final Object newHandler) {
  getEventListenersContainer().setEventHandlerProp("dblclick", newHandler);
}

代码示例来源:origin: net.disy.htmlunit/htmlunit

/**
 * Returns the ondblclick property (caution this is not necessary a function if something else has
 * been set).
 * @return the ondblclick property
 */
public Object jsxGet_ondblclick() {
  return getEventListenersContainer().getEventHandlerProp("dblclick");
}

代码示例来源:origin: org.jvnet.hudson/htmlunit

/**
 * Allows the removal of event listeners on the event target.
 * @param type the event type to listen for (like "load")
 * @param listener the event listener
 * @param useCapture If <code>true</code>, indicates that the user wishes to initiate capture (not yet implemented)
 * @see <a href="http://developer.mozilla.org/en/docs/DOM:element.removeEventListener">Mozilla documentation</a>
 */
public void jsxFunction_removeEventListener(final String type, final Function listener, final boolean useCapture) {
  getEventListenersContainer().removeEventListener(type, listener, useCapture);
}

代码示例来源:origin: org.jenkins-ci/htmlunit

/**
 * Returns the onclick property (caution this is not necessary a function if something else has
 * been set).
 * @return the onclick property
 */
public Object jsxGet_onclick() {
  return getEventListenersContainer().getEventHandlerProp("click");
}

代码示例来源:origin: net.disy.htmlunit/htmlunit

/**
 * Allows the registration of event listeners on the event target.
 * @param type the event type to listen for (like "onload")
 * @param listener the event listener
 * @param useCapture If <code>true</code>, indicates that the user wishes to initiate capture (not yet implemented)
 * @see <a href="http://developer.mozilla.org/en/docs/DOM:element.addEventListener">Mozilla documentation</a>
 */
public void jsxFunction_addEventListener(final String type, final Function listener, final boolean useCapture) {
  getEventListenersContainer().addEventListener(type, listener, useCapture);
}

代码示例来源:origin: org.jvnet.hudson/htmlunit

/**
 * Allows the removal of event listeners on the event target.
 * @param type the event type to listen for (like "onload")
 * @param listener the event listener
 * @see <a href="http://msdn.microsoft.com/en-us/library/ms536411.aspx">MSDN documentation</a>
 */
public void jsxFunction_detachEvent(final String type, final Function listener) {
  getEventListenersContainer().removeEventListener(StringUtils.substring(type, 2), listener, false);
}

代码示例来源:origin: org.jenkins-ci/htmlunit

/**
 * Allows the registration of event listeners on the event target.
 * @param type the event type to listen for (like "load")
 * @param listener the event listener
 * @see <a href="http://msdn.microsoft.com/en-us/library/ms536343.aspx">MSDN documentation</a>
 * @return <code>true</code> if the listener has been added
 */
public boolean jsxFunction_attachEvent(final String type, final Function listener) {
  return getEventListenersContainer().addEventListener(StringUtils.substring(type, 2), listener, false);
}

代码示例来源:origin: org.jenkins-ci/htmlunit

/**
 * Allows the removal of event listeners on the event target.
 * @param type the event type to listen for (like "onload")
 * @param listener the event listener
 * @see <a href="http://msdn.microsoft.com/en-us/library/ms536411.aspx">MSDN documentation</a>
 */
public void jsxFunction_detachEvent(final String type, final Function listener) {
  getEventListenersContainer().removeEventListener(StringUtils.substring(type, 2), listener, false);
}

代码示例来源:origin: org.jenkins-ci/htmlunit

private Object getHandlerForJavaScript(final String eventName) {
  Object handler = getEventListenersContainer().getEventHandlerProp(eventName);
  if (handler == null && !getBrowserVersion().isIE()) {
    handler = Scriptable.NOT_FOUND;
  }
  return handler;
}

代码示例来源:origin: org.jvnet.hudson/htmlunit

private Object getHandlerForJavaScript(final String eventName) {
  Object handler = getEventListenersContainer().getEventHandlerProp(eventName);
  if (handler == null && !getBrowserVersion().isIE()) {
    handler = Scriptable.NOT_FOUND;
  }
  return handler;
}

代码示例来源:origin: net.sourceforge.htmlunit/htmlunit

/**
 * Defines an event handler (or maybe any other object).
 * @param eventName the event name (e.g. "click")
 * @param value the property ({@code null} to reset it)
 */
public void setEventHandler(final String eventName, final Object value) {
  final EventListenersContainer container;
  if (isEventHandlerOnWindow()) {
    container = getWindow().getEventListenersContainer();
  }
  else {
    container = getEventListenersContainer();
  }
  container.setEventHandler(eventName, value);
}

相关文章

微信公众号