com.gargoylesoftware.htmlunit.WebClient.openDialogWindow()方法的使用及代码示例

x33g5p2x  于2022-02-02 转载在 其他  
字(12.3k)|赞(0)|评价(0)|浏览(142)

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

WebClient.openDialogWindow介绍

[英]INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
Opens a new dialog window.
[中]内部API-随时可能更改-使用风险自负。
打开一个新的对话框窗口。

代码示例

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

/**
 * Creates a modeless dialog box that displays the specified HTML document.
 * @param url the URL of the document to load and display
 * @param arguments object to be made available via <tt>window.dialogArguments</tt> in the dialog window
 * @param features string that specifies the window ornaments for the dialog window
 * @return a reference to the new window object created for the modeless dialog
 * @see <a href="http://msdn.microsoft.com/en-us/library/ms536761.aspx">MSDN Documentation</a>
 */
public Object jsxFunction_showModelessDialog(final String url, final Object arguments, final String features) {
  final WebWindow ww = getWebWindow();
  final WebClient client = ww.getWebClient();
  try {
    final URL completeUrl = ((HtmlPage) getDomNodeOrDie()).getFullyQualifiedUrl(url);
    final DialogWindow dialog = client.openDialogWindow(completeUrl, ww, arguments);
    final Window jsDialog = (Window) dialog.getScriptObject();
    return jsDialog;
  }
  catch (final IOException e) {
    throw Context.throwAsScriptRuntimeEx(e);
  }
}

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

/**
 * Creates a modeless dialog box that displays the specified HTML document.
 * @param url the URL of the document to load and display
 * @param arguments object to be made available via <tt>window.dialogArguments</tt> in the dialog window
 * @param features string that specifies the window ornaments for the dialog window
 * @return a reference to the new window object created for the modeless dialog
 * @see <a href="http://msdn.microsoft.com/en-us/library/ms536761.aspx">MSDN Documentation</a>
 */
public Object jsxFunction_showModelessDialog(final String url, final Object arguments, final String features) {
  final WebWindow ww = getWebWindow();
  final WebClient client = ww.getWebClient();
  try {
    final URL completeUrl = ((HtmlPage) getDomNodeOrDie()).getFullyQualifiedUrl(url);
    final DialogWindow dialog = client.openDialogWindow(completeUrl, ww, arguments);
    final Window jsDialog = (Window) dialog.getScriptObject();
    return jsDialog;
  }
  catch (final IOException e) {
    throw Context.throwAsScriptRuntimeEx(e);
  }
}

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

/**
 * Creates a modeless dialog box that displays the specified HTML document.
 * @param url the URL of the document to load and display
 * @param arguments object to be made available via <tt>window.dialogArguments</tt> in the dialog window
 * @param features string that specifies the window ornaments for the dialog window
 * @return a reference to the new window object created for the modeless dialog
 * @see <a href="http://msdn.microsoft.com/en-us/library/ms536761.aspx">MSDN Documentation</a>
 */
public Object jsxFunction_showModelessDialog(final String url, final Object arguments, final String features) {
  final WebWindow ww = getWebWindow();
  final WebClient client = ww.getWebClient();
  try {
    final URL completeUrl = ((HtmlPage) getDomNodeOrDie()).getFullyQualifiedUrl(url);
    final DialogWindow dialog = client.openDialogWindow(completeUrl, ww, arguments);
    final Window jsDialog = (Window) dialog.getScriptObject();
    return jsDialog;
  }
  catch (final IOException e) {
    throw Context.throwAsScriptRuntimeEx(e);
  }
}

代码示例来源:origin: HtmlUnit/htmlunit

/**
 * Creates a modeless dialog box that displays the specified HTML document.
 * @param url the URL of the document to load and display
 * @param arguments object to be made available via <tt>window.dialogArguments</tt> in the dialog window
 * @param features string that specifies the window ornaments for the dialog window
 * @return a reference to the new window object created for the modeless dialog
 * @see <a href="http://msdn.microsoft.com/en-us/library/ms536761.aspx">MSDN Documentation</a>
 */
@JsxFunction(IE)
public Object showModelessDialog(final String url, final Object arguments, final String features) {
  final WebWindow webWindow = getWebWindow();
  final WebClient client = webWindow.getWebClient();
  try {
    final URL completeUrl = ((HtmlPage) getDomNodeOrDie()).getFullyQualifiedUrl(url);
    final DialogWindow dialog = client.openDialogWindow(completeUrl, webWindow, arguments);
    return dialog.getScriptableObject();
  }
  catch (final IOException e) {
    throw Context.throwAsScriptRuntimeEx(e);
  }
}

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

/**
 * Creates a modeless dialog box that displays the specified HTML document.
 * @param url the URL of the document to load and display
 * @param arguments object to be made available via <tt>window.dialogArguments</tt> in the dialog window
 * @param features string that specifies the window ornaments for the dialog window
 * @return a reference to the new window object created for the modeless dialog
 * @see <a href="http://msdn.microsoft.com/en-us/library/ms536761.aspx">MSDN Documentation</a>
 */
@JsxFunction(IE)
public Object showModelessDialog(final String url, final Object arguments, final String features) {
  final WebWindow webWindow = getWebWindow();
  final WebClient client = webWindow.getWebClient();
  try {
    final URL completeUrl = ((HtmlPage) getDomNodeOrDie()).getFullyQualifiedUrl(url);
    final DialogWindow dialog = client.openDialogWindow(completeUrl, webWindow, arguments);
    return dialog.getScriptableObject();
  }
  catch (final IOException e) {
    throw Context.throwAsScriptRuntimeEx(e);
  }
}

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

/**
 * Creates a modal dialog box that displays the specified HTML document.
 * @param url the URL of the document to load and display
 * @param arguments object to be made available via <tt>window.dialogArguments</tt> in the dialog window
 * @param features string that specifies the window ornaments for the dialog window
 * @return the value of the <tt>returnValue</tt> property as set by the modal dialog's window
 * @see <a href="http://msdn.microsoft.com/en-us/library/ms536759.aspx">MSDN Documentation</a>
 * @see <a href="https://developer.mozilla.org/en/DOM/window.showModalDialog">Mozilla Documentation</a>
 */
public Object jsxFunction_showModalDialog(final String url, final Object arguments, final String features) {
  final WebWindow ww = getWebWindow();
  final WebClient client = ww.getWebClient();
  try {
    final URL completeUrl = ((HtmlPage) getDomNodeOrDie()).getFullyQualifiedUrl(url);
    final DialogWindow dialog = client.openDialogWindow(completeUrl, ww, arguments);
    // TODO: Theoretically, we shouldn't return until the dialog window has been close()'ed...
    // But we have to return so that the window can be close()'ed...
    // Maybe we can use Rhino's continuation support to save state and restart when
    // the dialog window is close()'ed? Would only work in interpreted mode, though.
    final ScriptableObject jsDialog = (ScriptableObject) dialog.getScriptObject();
    return jsDialog.get("returnValue", jsDialog);
  }
  catch (final IOException e) {
    throw Context.throwAsScriptRuntimeEx(e);
  }
}

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

/**
 * Creates a modal dialog box that displays the specified HTML document.
 * @param url the URL of the document to load and display
 * @param arguments object to be made available via <tt>window.dialogArguments</tt> in the dialog window
 * @param features string that specifies the window ornaments for the dialog window
 * @return the value of the <tt>returnValue</tt> property as set by the modal dialog's window
 * @see <a href="http://msdn.microsoft.com/en-us/library/ms536759.aspx">MSDN Documentation</a>
 * @see <a href="https://developer.mozilla.org/en/DOM/window.showModalDialog">Mozilla Documentation</a>
 */
public Object jsxFunction_showModalDialog(final String url, final Object arguments, final String features) {
  final WebWindow ww = getWebWindow();
  final WebClient client = ww.getWebClient();
  try {
    final URL completeUrl = ((HtmlPage) getDomNodeOrDie()).getFullyQualifiedUrl(url);
    final DialogWindow dialog = client.openDialogWindow(completeUrl, ww, arguments);
    // TODO: Theoretically, we shouldn't return until the dialog window has been close()'ed...
    // But we have to return so that the window can be close()'ed...
    // Maybe we can use Rhino's continuation support to save state and restart when
    // the dialog window is close()'ed? Would only work in interpreted mode, though.
    final ScriptableObject jsDialog = (ScriptableObject) dialog.getScriptObject();
    return jsDialog.get("returnValue", jsDialog);
  }
  catch (final IOException e) {
    throw Context.throwAsScriptRuntimeEx(e);
  }
}

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

/**
 * Creates a modal dialog box that displays the specified HTML document.
 * @param url the URL of the document to load and display
 * @param arguments object to be made available via <tt>window.dialogArguments</tt> in the dialog window
 * @param features string that specifies the window ornaments for the dialog window
 * @return the value of the <tt>returnValue</tt> property as set by the modal dialog's window
 * @see <a href="http://msdn.microsoft.com/en-us/library/ms536759.aspx">MSDN Documentation</a>
 * @see <a href="https://developer.mozilla.org/en/DOM/window.showModalDialog">Mozilla Documentation</a>
 */
public Object jsxFunction_showModalDialog(final String url, final Object arguments, final String features) {
  final WebWindow ww = getWebWindow();
  final WebClient client = ww.getWebClient();
  try {
    final URL completeUrl = ((HtmlPage) getDomNodeOrDie()).getFullyQualifiedUrl(url);
    final DialogWindow dialog = client.openDialogWindow(completeUrl, ww, arguments);
    // TODO: Theoretically, we shouldn't return until the dialog window has been close()'ed...
    // But we have to return so that the window can be close()'ed...
    // Maybe we can use Rhino's continuation support to save state and restart when
    // the dialog window is close()'ed? Would only work in interpreted mode, though.
    final ScriptableObject jsDialog = (ScriptableObject) dialog.getScriptObject();
    return jsDialog.get("returnValue", jsDialog);
  }
  catch (final IOException e) {
    throw Context.throwAsScriptRuntimeEx(e);
  }
}

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

/**
 * Creates a modal dialog box that displays the specified HTML document.
 * @param url the URL of the document to load and display
 * @param arguments object to be made available via <tt>window.dialogArguments</tt> in the dialog window
 * @param features string that specifies the window ornaments for the dialog window
 * @return the value of the {@code returnValue} property as set by the modal dialog's window
 * @see <a href="http://msdn.microsoft.com/en-us/library/ms536759.aspx">MSDN Documentation</a>
 * @see <a href="https://developer.mozilla.org/en/DOM/window.showModalDialog">Mozilla Documentation</a>
 */
@JsxFunction({IE, FF52})
public Object showModalDialog(final String url, final Object arguments, final String features) {
  final WebWindow webWindow = getWebWindow();
  final WebClient client = webWindow.getWebClient();
  try {
    final URL completeUrl = ((HtmlPage) getDomNodeOrDie()).getFullyQualifiedUrl(url);
    final DialogWindow dialog = client.openDialogWindow(completeUrl, webWindow, arguments);
    // TODO: Theoretically, we shouldn't return until the dialog window has been close()'ed...
    // But we have to return so that the window can be close()'ed...
    // Maybe we can use Rhino's continuation support to save state and restart when
    // the dialog window is close()'ed? Would only work in interpreted mode, though.
    final ScriptableObject jsDialog = dialog.getScriptableObject();
    return jsDialog.get("returnValue", jsDialog);
  }
  catch (final IOException e) {
    throw Context.throwAsScriptRuntimeEx(e);
  }
}

代码示例来源:origin: HtmlUnit/htmlunit

/**
 * Creates a modal dialog box that displays the specified HTML document.
 * @param url the URL of the document to load and display
 * @param arguments object to be made available via <tt>window.dialogArguments</tt> in the dialog window
 * @param features string that specifies the window ornaments for the dialog window
 * @return the value of the {@code returnValue} property as set by the modal dialog's window
 * @see <a href="http://msdn.microsoft.com/en-us/library/ms536759.aspx">MSDN Documentation</a>
 * @see <a href="https://developer.mozilla.org/en/DOM/window.showModalDialog">Mozilla Documentation</a>
 */
@JsxFunction({IE, FF52})
public Object showModalDialog(final String url, final Object arguments, final String features) {
  final WebWindow webWindow = getWebWindow();
  final WebClient client = webWindow.getWebClient();
  try {
    final URL completeUrl = ((HtmlPage) getDomNodeOrDie()).getFullyQualifiedUrl(url);
    final DialogWindow dialog = client.openDialogWindow(completeUrl, webWindow, arguments);
    // TODO: Theoretically, we shouldn't return until the dialog window has been close()'ed...
    // But we have to return so that the window can be close()'ed...
    // Maybe we can use Rhino's continuation support to save state and restart when
    // the dialog window is close()'ed? Would only work in interpreted mode, though.
    final ScriptableObject jsDialog = dialog.getScriptableObject();
    return jsDialog.get("returnValue", jsDialog);
  }
  catch (final IOException e) {
    throw Context.throwAsScriptRuntimeEx(e);
  }
}

相关文章

WebClient类方法