本文整理了Java中com.gargoylesoftware.htmlunit.javascript.host.Window.getCurrentEvent()
方法的一些代码示例,展示了Window.getCurrentEvent()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Window.getCurrentEvent()
方法的具体详情如下:
包路径:com.gargoylesoftware.htmlunit.javascript.host.Window
类名称:Window
方法名:getCurrentEvent
[英]Returns the current event (used internally regardless of the emulation mode).
[中]返回当前事件(无论模拟模式如何,都在内部使用)。
代码示例来源:origin: net.sourceforge.htmlunit/htmlunit
/**
* Executes the event on this object only (needed for instance for onload on (i)frame tags).
* @param event the event
* @see #fireEvent(Event)
*/
public void executeEventLocally(final Event event) {
final EventListenersContainer eventListenersContainer = getEventListenersContainer();
final Window window = getWindow();
final Object[] args = new Object[] {event};
final Event previousEvent = window.getCurrentEvent();
window.setCurrentEvent(event);
try {
event.setEventPhase(Event.AT_TARGET);
eventListenersContainer.executeAtTargetListeners(event, args);
}
finally {
window.setCurrentEvent(previousEvent); // reset event
}
}
代码示例来源:origin: HtmlUnit/htmlunit
/**
* Executes the event on this object only (needed for instance for onload on (i)frame tags).
* @param event the event
* @see #fireEvent(Event)
*/
public void executeEventLocally(final Event event) {
final EventListenersContainer eventListenersContainer = getEventListenersContainer();
final Window window = getWindow();
final Object[] args = new Object[] {event};
final Event previousEvent = window.getCurrentEvent();
window.setCurrentEvent(event);
try {
event.setEventPhase(Event.AT_TARGET);
eventListenersContainer.executeAtTargetListeners(event, args);
}
finally {
window.setCurrentEvent(previousEvent); // reset event
}
}
代码示例来源:origin: net.sourceforge.htmlunit/htmlunit
final Event previousEvent = window.getCurrentEvent();
window.setCurrentEvent(event);
代码示例来源:origin: HtmlUnit/htmlunit
final Event previousEvent = window.getCurrentEvent();
window.setCurrentEvent(event);
代码示例来源:origin: org.jvnet.hudson/htmlunit
/**
* Submits the form (at the end of the current script execution).
*
* @throws IOException if an IO error occurs
*/
public void jsxFunction_submit()
throws IOException {
boolean postpone = false;
final Event currentEvent = getWindow().getCurrentEvent();
if (currentEvent != null) {
// Use target instead of srcElement because target is read-only,
// but srcElement is writable from JavaScript.
final SimpleScriptable src = (SimpleScriptable) currentEvent.jsxGet_target();
postpone = src.getDomNodeOrNull() instanceof HtmlSubmitInput;
}
if (postpone) {
final SgmlPage page = getDomNodeOrDie().getPage();
final JavaScriptEngine jsEngine = page.getWebClient().getJavaScriptEngine();
final PostponedAction action = new PostponedAction() {
public void execute() throws IOException {
getHtmlForm().submit((SubmittableElement) null);
}
};
jsEngine.addPostponedAction(action);
}
else {
getHtmlForm().submit((SubmittableElement) null);
}
}
代码示例来源:origin: org.jenkins-ci/htmlunit
/**
* Submits the form (at the end of the current script execution).
*
* @throws IOException if an IO error occurs
*/
public void jsxFunction_submit()
throws IOException {
boolean postpone = false;
final Event currentEvent = getWindow().getCurrentEvent();
if (currentEvent != null) {
// Use target instead of srcElement because target is read-only,
// but srcElement is writable from JavaScript.
final SimpleScriptable src = (SimpleScriptable) currentEvent.jsxGet_target();
postpone = src.getDomNodeOrNull() instanceof HtmlSubmitInput;
}
if (postpone) {
final SgmlPage page = getDomNodeOrDie().getPage();
final JavaScriptEngine jsEngine = page.getWebClient().getJavaScriptEngine();
final PostponedAction action = new PostponedAction() {
public void execute() throws IOException {
getHtmlForm().submit((SubmittableElement) null);
}
};
jsEngine.addPostponedAction(action);
}
else {
getHtmlForm().submit((SubmittableElement) null);
}
}
代码示例来源:origin: net.disy.htmlunit/htmlunit
/**
* Submits the form (at the end of the current script execution).
*
* @throws IOException if an IO error occurs
*/
public void jsxFunction_submit()
throws IOException {
boolean postpone = false;
final Event currentEvent = getWindow().getCurrentEvent();
if (currentEvent != null) {
// Use target instead of srcElement because target is read-only,
// but srcElement is writable from JavaScript.
final SimpleScriptable src = (SimpleScriptable) currentEvent.jsxGet_target();
postpone = src.getDomNodeOrNull() instanceof HtmlSubmitInput;
}
if (postpone) {
final SgmlPage page = getDomNodeOrDie().getPage();
final JavaScriptEngine jsEngine = page.getWebClient().getJavaScriptEngine();
final PostponedAction action = new PostponedAction() {
public void execute() throws IOException {
getHtmlForm().submit((SubmittableElement) null);
}
};
jsEngine.addPostponedAction(action);
}
else {
getHtmlForm().submit((SubmittableElement) null);
}
}
代码示例来源:origin: org.jvnet.hudson/htmlunit
final Event previousEvent = window.getCurrentEvent();
window.setCurrentEvent(event);
代码示例来源:origin: org.jenkins-ci/htmlunit
final Event previousEvent = window.getCurrentEvent();
window.setCurrentEvent(event);
代码示例来源:origin: net.disy.htmlunit/htmlunit
final Event previousEvent = window.getCurrentEvent();
window.setCurrentEvent(event);
代码示例来源:origin: net.disy.legato/legato-testing
final Event previousEvent = window.getCurrentEvent();
window.setCurrentEvent(event);
内容来源于网络,如有侵权,请联系作者删除!