All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.gargoylesoftware.htmlunit.WebWindow Maven / Gradle / Ivy

There is a newer version: 2.70.0
Show newest version
/*
 * Copyright (c) 2002-2018 Gargoyle Software Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.gargoylesoftware.htmlunit;

import java.io.Serializable;

import javax.script.ScriptContext;

import com.gargoylesoftware.htmlunit.javascript.background.JavaScriptJobManager;

/**
 * An interface that represents one window in a browser. It could be a top level window or a frame.
 *
 * @author Mike Bowler
 * @author David K. Taylor
 * @author David D. Kilzer
 */
public interface WebWindow extends Serializable {

    /**
     * Returns the name of this window.
     *
     * @return the name of this window
     */
    String getName();

    /**
     * Sets the name of this window.
     *
     * @param name the new window name
     */
    void setName(String name);

    /**
     * Returns the currently loaded page or null if no page has been loaded.
     *
     * @return the currently loaded page or null if no page has been loaded
     */
    Page getEnclosedPage();

    /**
     * Sets the currently loaded page.
     *
     * @param page the new page or null if there is no page (ie empty window)
     */
    void setEnclosedPage(Page page);

    /**
     * Returns the window that contains this window. If this is a top
     * level window, then return this window.
     *
     * @return the parent window or this window if there is no parent
     */
    WebWindow getParentWindow();

    /**
     * Returns the top level window that contains this window. If this
     * is a top level window, then return this window.
     *
     * @return the top level window that contains this window or this
     * window if there is no parent.
     */
    WebWindow getTopWindow();

    /**
     * Returns the web client that "owns" this window.
     *
     * @return the web client or null if this window has been closed
     */
    WebClient getWebClient();

    /**
     * Returns this window's navigation history.
     *
     * @return this window's navigation history
     */
    History getHistory();

    /**
     * INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
* * Sets the JavaScript object that corresponds to this element. This is not guaranteed * to be set even if there is a JavaScript object for this HTML element. * * @param the object type * @param scriptObject the JavaScript object */ void setScriptableObject(T scriptObject); /** * INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
* * Returns the JavaScript object that corresponds to this element. * * @param the object type * @return the JavaScript object that corresponds to this element */ T getScriptableObject(); /** * INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
* * Returns the job manager for this window. * * @return the job manager for this window */ JavaScriptJobManager getJobManager(); /** * Indicates if this window is closed. No action should be performed on a closed window. * @return {@code true} when the window is closed */ boolean isClosed(); /** * Returns the width (in pixels) of the browser window viewport including, if rendered, the vertical scrollbar. * @return the inner width. */ int getInnerWidth(); /** * Sets the width (in pixels) of the browser window viewport including, if rendered, the vertical scrollbar. * @param innerWidth the inner width */ void setInnerWidth(int innerWidth); /** * Returns the width of the outside of the browser window. * It represents the width of the whole browser window including sidebar (if expanded), * window chrome and window resizing borders/handles. * @return the outer width */ int getOuterWidth(); /** * Sets the width of the outside of the browser window. * It represents the width of the whole browser window including sidebar (if expanded), * window chrome and window resizing borders/handles. * @param outerWidth the outer width */ void setOuterWidth(int outerWidth); /** * Returns the height (in pixels) of the browser window viewport including, if rendered, the horizontal scrollbar. * @return a inner height */ int getInnerHeight(); /** * Sets the height (in pixels) of the browser window viewport including, if rendered, the horizontal scrollbar. * @param innerHeight the inner height */ void setInnerHeight(int innerHeight); /** * Returns the height in pixels of the whole browser window. * It represents the height of the whole browser window including sidebar (if expanded), * window chrome and window resizing borders/handles. * @return the outer height */ int getOuterHeight(); /** * Sets the height in pixels of the whole browser window. * It represents the height of the whole browser window including sidebar (if expanded), * window chrome and window resizing borders/handles. * @param outerHeight the outer height */ void setOuterHeight(int outerHeight); /** * INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
* * Returns the {@link ScriptContext} * * @return the {@link ScriptContext} */ ScriptContext getScriptContext(); /** * INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
* * Returns a thread local object. * * @param key the object key * * @return the thread local object */ Object getThreadLocal(Object key); /** * INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
* * Puts a thread local object by {@code key}. * * @param key the object key * @param value the object value */ void putThreadLocal(Object key, Object value); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy