Package org.htmlunit

# Class WebWindowImpl

java.lang.Object
org.htmlunit.WebWindowImpl

All Implemented Interfaces:
  `Serializable`, `WebWindow`

Direct Known Subclasses:
  `DialogWindow`, `FrameWindow`, `TopLevelWindow`

public abstract class WebWindowImpl extends Object implements WebWindow
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
Base class for common WebWindow functionality. While public, this class is not exposed in any other places of the API. Internally we can cast to this class when we need access to functionality that is not present in `WebWindow`

See Also:
  - Serialized Form

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `WebWindowImpl(WebClient webClient)`
  Creates a window and associates it with the client.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addChildWindow(WebWindowImpl child)`
  INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
  `protected void`
  `destroyChildren()`
  Destroy our children.
  `org.htmlunit.css.ComputedCssStyleDeclaration`
  `getComputedStyle(DomElement element, String pseudoElement)`
  INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
  Returns computed style of the element.
  `Page`
  `getEnclosedPage()`
  Returns the currently loaded page or null if no page has been loaded.
  `History`
  `getHistory()`
  Returns this window's navigation history.
  `int`
  `getInnerHeight()`
  Returns the height (in pixels) of the browser window viewport including, if rendered, the horizontal scrollbar.
  `int`
  `getInnerWidth()`
  Returns the width (in pixels) of the browser window viewport including, if rendered, the vertical scrollbar.
  `org.htmlunit.javascript.background.JavaScriptJobManager`
  `getJobManager()`
  INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
  Returns the job manager for this window.
  `String`
  `getName()`
  Returns the name of this window.
  `int`
  `getOuterHeight()`
  Returns the height in pixels of the whole browser window.
  `int`
  `getOuterWidth()`
  Returns the width of the outside of the browser window.
  `Screen`
  `getScreen()`
  `<T> T`
  `getScriptableObject()`
  INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
  Returns the JavaScript object that corresponds to this element.
  `WebClient`
  `getWebClient()`
  Returns the web client that "owns" this window.
  `boolean`
  `isClosed()`
  Indicates if this window is closed.
  `protected abstract boolean`
  `isJavaScriptInitializationNeeded(Page page)`
  Returns `true` if this window needs JavaScript initialization to occur when the enclosed page is set.
  `protected void`
  `performRegistration()`
  Registers the window with the client.
  `void`
  `removeChildWindow(WebWindowImpl window)`
  INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
  `protected void`
  `setClosed()`
  Sets this window as closed.
  `void`
  `setEnclosedPage(Page page)`
  Sets the currently loaded page.
  `void`
  `setInnerHeight(int innerHeight)`
  Sets the height (in pixels) of the browser window viewport including, if rendered, the horizontal scrollbar.
  `void`
  `setInnerWidth(int innerWidth)`
  Sets the width (in pixels) of the browser window viewport including, if rendered, the vertical scrollbar.
  `void`
  `setJobManager(org.htmlunit.javascript.background.JavaScriptJobManager jobManager)`
  INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
  `void`
  `setName(String name)`
  Sets the name of this window.
  `void`
  `setOuterHeight(int outerHeight)`
  Sets the height in pixels of the whole browser window.
  `void`
  `setOuterWidth(int outerWidth)`
  Sets the width of the outside of the browser window.
  `<T extends org.htmlunit.javascript.HtmlUnitScriptable>
  void`
  `setScriptableObject(T scriptObject)`
  INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
  Sets the JavaScript object that corresponds to this element.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

  ### Methods inherited from interface org.htmlunit.WebWindow

  `getParentWindow, getTopWindow`

- ## Constructor Details

  - ### WebWindowImpl

    public WebWindowImpl(WebClient webClient)
    Creates a window and associates it with the client.
    Parameters:
      `webClient` - the web client that "owns" this window

- ## Method Details

  - ### performRegistration

    protected void performRegistration()
    Registers the window with the client.

  - ### getWebClient

    public WebClient getWebClient()
    Returns the web client that "owns" this window.
    Specified by:
      `getWebClient` in interface `WebWindow`
    Returns:
      the web client or null if this window has been closed

  - ### getScreen

    public Screen getScreen()
    Specified by:
      `getScreen` in interface `WebWindow`
    Returns:
      the screen this window belongs to

  - ### getEnclosedPage

    public Page getEnclosedPage()
    Returns the currently loaded page or null if no page has been loaded.
    Specified by:
      `getEnclosedPage` in interface `WebWindow`
    Returns:
      the currently loaded page or null if no page has been loaded

  - ### setEnclosedPage

    public void setEnclosedPage(Page page)
    Sets the currently loaded page.
    Specified by:
      `setEnclosedPage` in interface `WebWindow`
    Parameters:
      `page` - the new page or null if there is no page (ie empty window)

  - ### isJavaScriptInitializationNeeded

    protected abstract boolean isJavaScriptInitializationNeeded(Page page)
    Returns `true` if this window needs JavaScript initialization to occur when the enclosed page is set.
    Parameters:
      `page` - the page that will become the enclosing page
    Returns:
      `true` if this window needs JavaScript initialization to occur when the enclosed page is set

  - ### setScriptableObject

    public <T extends org.htmlunit.javascript.HtmlUnitScriptable> void setScriptableObject(T scriptObject)
    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.
    Specified by:
      `setScriptableObject` in interface `WebWindow`
    Type Parameters:
      `T` - the object type
    Parameters:
      `scriptObject` - the JavaScript object

  - ### getScriptableObject

    public <T> T getScriptableObject()
    INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
    Returns the JavaScript object that corresponds to this element.
    Specified by:
      `getScriptableObject` in interface `WebWindow`
    Type Parameters:
      `T` - the object type
    Returns:
      the JavaScript object that corresponds to this element

  - ### getJobManager

    public org.htmlunit.javascript.background.JavaScriptJobManager getJobManager()
    INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
    Returns the job manager for this window.
    Specified by:
      `getJobManager` in interface `WebWindow`
    Returns:
      the job manager for this window

  - ### setJobManager

    public void setJobManager(org.htmlunit.javascript.background.JavaScriptJobManager jobManager)

    INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.

    Sets the JavaScript job manager for this window.

    Parameters:
      `jobManager` - the JavaScript job manager to use

  - ### addChildWindow

    public void addChildWindow(WebWindowImpl child)

    INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.

    Adds a child to this window, for shutdown purposes.

    Parameters:
      `child` - the child window to associate with this window

  - ### destroyChildren

    protected void destroyChildren()
    Destroy our children.

  - ### removeChildWindow

    public void removeChildWindow(WebWindowImpl window)

    INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.

    Destroy the child window.
    Parameters:
      `window` - the child to destroy

  - ### getName

    public String getName()
    Returns the name of this window.
    Specified by:
      `getName` in interface `WebWindow`
    Returns:
      the name of this window

  - ### setName

    public void setName(String name)
    Sets the name of this window.
    Specified by:
      `setName` in interface `WebWindow`
    Parameters:
      `name` - the new window name

  - ### getHistory

    public History getHistory()
    Returns this window's navigation history.
    Specified by:
      `getHistory` in interface `WebWindow`
    Returns:
      this window's navigation history

  - ### isClosed

    public boolean isClosed()
    Indicates if this window is closed. No action should be performed on a closed window.
    Specified by:
      `isClosed` in interface `WebWindow`
    Returns:
      `true` when the window is closed

  - ### setClosed

    protected void setClosed()
    Sets this window as closed.

  - ### getInnerWidth

    public int getInnerWidth()
    Returns the width (in pixels) of the browser window viewport including, if rendered, the vertical scrollbar.
    Specified by:
      `getInnerWidth` in interface `WebWindow`
    Returns:
      the inner width.

  - ### setInnerWidth

    public void setInnerWidth(int innerWidth)
    Sets the width (in pixels) of the browser window viewport including, if rendered, the vertical scrollbar.
    Specified by:
      `setInnerWidth` in interface `WebWindow`
    Parameters:
      `innerWidth` - the inner width

  - ### getOuterWidth

    public int getOuterWidth()
    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.
    Specified by:
      `getOuterWidth` in interface `WebWindow`
    Returns:
      the outer width

  - ### setOuterWidth

    public void setOuterWidth(int outerWidth)
    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.
    Specified by:
      `setOuterWidth` in interface `WebWindow`
    Parameters:
      `outerWidth` - the outer width

  - ### getInnerHeight

    public int getInnerHeight()
    Returns the height (in pixels) of the browser window viewport including, if rendered, the horizontal scrollbar.
    Specified by:
      `getInnerHeight` in interface `WebWindow`
    Returns:
      a inner height

  - ### setInnerHeight

    public void setInnerHeight(int innerHeight)
    Sets the height (in pixels) of the browser window viewport including, if rendered, the horizontal scrollbar.
    Specified by:
      `setInnerHeight` in interface `WebWindow`
    Parameters:
      `innerHeight` - the inner height

  - ### getOuterHeight

    public int getOuterHeight()
    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.
    Specified by:
      `getOuterHeight` in interface `WebWindow`
    Returns:
      the outer height

  - ### setOuterHeight

    public void setOuterHeight(int outerHeight)
    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.
    Specified by:
      `setOuterHeight` in interface `WebWindow`
    Parameters:
      `outerHeight` - the outer height

  - ### getComputedStyle

    public org.htmlunit.css.ComputedCssStyleDeclaration getComputedStyle(DomElement element, String pseudoElement)
    INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
    Returns computed style of the element. Computed style represents the final computed values of all CSS properties for the element. This method's return value is of the same type as that of `element.style`, but the value returned by this method is read-only.
    Specified by:
      `getComputedStyle` in interface `WebWindow`
    Parameters:
      `element` - the element
      `pseudoElement` - a string specifying the pseudo-element to match (may be `null`); e.g. ':before'
    Returns:
      the computed style