/** * Creates an instance of SgmlPage. * * @param webResponse the web response that was used to create this page * @param webWindow the window that this page is being loaded into */ public SgmlPage(final WebResponse webResponse, final WebWindow webWindow) { super(null); webResponse_ = webResponse; enclosingWindow_ = webWindow; webClient_ = webWindow.getWebClient(); }
/** * Creates an instance of SgmlPage. * * @param webResponse the web response that was used to create this page * @param webWindow the window that this page is being loaded into */ public SgmlPage(final WebResponse webResponse, final WebWindow webWindow) { super(null); webResponse_ = webResponse; enclosingWindow_ = webWindow; webClient_ = webWindow.getWebClient(); }
/** * Sets the focus to this element. */ public void jsxFunction_focus() { webWindow_.getWebClient().setCurrentWindow(webWindow_); }
/** * Sets the focus to this element. */ public void jsxFunction_focus() { webWindow_.getWebClient().setCurrentWindow(webWindow_); }
/** * Indicates if this window is closed. * @return <code>true</code> if this window is closed */ public boolean jsxGet_closed() { return !getWebWindow().getWebClient().getWebWindows().contains(getWebWindow()); }
/** * Sets the focus to this element. */ @JsxFunction public void focus() { final WebWindow window = getWebWindow(); window.getWebClient().setCurrentWindow(window); }
/** * Indicates if Java is enabled. * @return true/false (see {@link com.gargoylesoftware.htmlunit.WebClient#isAppletEnabled()} */ public boolean jsxFunction_javaEnabled() { return getWindow().getWebWindow().getWebClient().isAppletEnabled(); }
/** * Indicates if this window is closed. * @return {@code true} if this window is closed */ @JsxGetter @CanSetReadOnly(CanSetReadOnlyStatus.IGNORE) public boolean isClosed() { final WebWindow webWindow = getWebWindow(); return !webWindow.getWebClient().containsWebWindow(webWindow); }
/** * Sets this location's URL, triggering a server hit and loading the resultant document * into this location's window. * @param url This location's new URL * @throws IOException if there is a problem loading the new location */ private void setUrl(final URL url) throws IOException { window_.getWebWindow().getWebClient().getPage(window_.getWebWindow(), new WebRequest(url)); }
/** * Notifies the registered {@link IncorrectnessListener} of something that is not fully correct. * @param message the notification to send to the registered {@link IncorrectnessListener} */ protected void notifyIncorrectness(final String message) { final WebClient client = getPage().getEnclosingWindow().getWebClient(); final IncorrectnessListener incorrectnessListener = client.getIncorrectnessListener(); incorrectnessListener.notify(message, this); }
/** * Returns the property "cookieEnabled". * @return the property "cookieEnabled" */ public boolean jsxGet_cookieEnabled() { return getWindow().getWebWindow().getWebClient().getCookieManager().isCookiesEnabled(); }
/** * Sets the web client's current homepage. Part of the <tt>#default#homePage</tt> * default IE behavior implementation. * @param url the new homepage URL */ public void setHomePage(final String url) { getDomNodeOrDie().getPage().getEnclosingWindow().getWebClient().setHomePage(url); }
/** * Returns the {@code cookieEnabled} property. * @return the {@code cookieEnabled} property */ @JsxGetter public boolean isCookieEnabled() { return getWindow().getWebWindow().getWebClient().getCookieManager().isCookiesEnabled(); }
/** * Returns the {@code width} property. * @return the {@code width} property */ @JsxGetter public int getWidth() { return ((Window) getParentScope()).getWebWindow().getWebClient().getOptions().getScreenWidth(); }
/** * Causes the web client to navigate to the current home page. Part of the * <tt>#default#homePage</tt> default IE behavior implementation. * @throws IOException if loading home page fails */ public void navigateHomePage() throws IOException { final WebClient webClient = getDomNodeOrDie().getPage().getEnclosingWindow().getWebClient(); webClient.getPage(webClient.getHomePage()); }
private HtmlElement getFirstChildElement(final DomNode parent) { if (parent instanceof HtmlNoScript && getPage().getEnclosingWindow().getWebClient().isJavaScriptEnabled()) { return null; } DomNode node = parent.getFirstChild(); while (node != null && node instanceof HtmlElement == false) { node = node.getNextSibling(); } return (HtmlElement) node; }
private Worker(final Context cx, final Window owningWindow, final String url) throws Exception { setParentScope(owningWindow); setPrototype(getPrototype(getClass())); final WebClient webClient = getWindow().getWebWindow().getWebClient(); workerScope_ = new DedicatedWorkerGlobalScope(owningWindow, cx, webClient.getBrowserVersion(), this); workerScope_.loadAndExecute(url, null); }
/** * Causes the web client to navigate to the current home page. Part of the * <tt>#default#homePage</tt> default IE behavior implementation. * @throws IOException if loading home page fails */ public void navigateHomePage() throws IOException { final WebClient webClient = getDomNodeOrDie().getPage().getEnclosingWindow().getWebClient(); webClient.getPage(webClient.getOptions().getHomePage()); }
/** * Returns whether the specified media is supported by the object that displays the document object. * @param media the media query * @return whether the specified media is supported or not */ @JsxFunction public boolean matchMedium(final String media) { final CSSErrorHandler errorHandler = getWindow().getWebWindow().getWebClient().getCssErrorHandler(); final MediaList mediaList = CSSStyleSheet.parseMedia(errorHandler, media); return CSSStyleSheet.isActive(this, mediaList); }
/** * Gets the browser version currently used. * @return the browser version */ public BrowserVersion getBrowserVersion() { final DomNode node = getDomNodeOrNull(); if (node != null) { return node.getPage().getWebClient().getBrowserVersion(); } return getWindow().getWebWindow().getWebClient().getBrowserVersion(); }