## com.gargoylesoftware.htmlunit
Class TopLevelWindow

    java.lang.Object
      com.gargoylesoftware.htmlunit.WebWindowImpl
          com.gargoylesoftware.htmlunit.TopLevelWindow

All Implemented Interfaces:
  WebWindow, java.io.Serializable

    public class TopLevelWindow

extends WebWindowImpl

A window representing a top level browser window.

Version:
  $Revision: 4756 $
Author:
  Mike Bowler, David K. Taylor, David D. Kilzer, Ahmed Ashour
See Also:
  Serialized Form

Constructor Summary
`TopLevelWindow(java.lang.String name, WebClient webClient)` Creates an instance.

Method Summary
`void` `close()` Closes this window.
`WebWindow` `getOpener()` Returns the opener property.
`WebWindow` `getParentWindow()` Returns the window that contains this window.
`WebWindow` `getTopWindow()` Returns the top level window that contains this window.
`protected boolean` `isJavaScriptInitializationNeeded()` Returns `true` if this window needs JavaScript initialization to occur when the enclosed page is set.
`void` `setOpener(WebWindow opener)` Sets the opener property.
`java.lang.String` `toString()` Returns a string representation of this object.

Methods inherited from class com.gargoylesoftware.htmlunit.WebWindowImpl
`addChildWindow, getEnclosedPage, getHistory, getJobManager, getName, getScriptObject, getWebClient, performRegistration, setEnclosedPage, setJobManager, setName, setScriptObject`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### TopLevelWindow

    public TopLevelWindow(java.lang.String name,
                          WebClient webClient)

  Creates an instance.

  Parameters:
    `name` - the name of the new window
    `webClient` - the web client that "owns" this window

Method Detail

### getParentWindow

    public WebWindow getParentWindow()

  Returns the window that contains this window. If this is a top level window, then return this window. Since this is a top level window, return this window.

  Returns:
    the parent window or this window if there is no parent

### getTopWindow

    public WebWindow getTopWindow()

  Returns the top level window that contains this window. If this is a top level window, then return this window. Since this is a top level window, return this window.

  Returns:
    the top level window that contains this window or this window if there is no parent.

### isJavaScriptInitializationNeeded

    protected boolean isJavaScriptInitializationNeeded()

  Returns `true` if this window needs JavaScript initialization to occur when the enclosed page is set.

  Specified by:
    `isJavaScriptInitializationNeeded` in class `WebWindowImpl`
  Returns:
    `true` if this window needs JavaScript initialization to occur when the enclosed page is set

### toString

    public java.lang.String toString()

  Returns a string representation of this object.

  Overrides:
    `toString` in class `java.lang.Object`
  Returns:
    a string representation of this object

### setOpener

    public void setOpener(WebWindow opener)

  Sets the opener property. This is the WebWindow that caused this new window to be opened.

  Parameters:
    `opener` - the new opener

### getOpener

    public WebWindow getOpener()

  Returns the opener property. This is the WebWindow that caused this new window to be opened.

  Returns:
    the opener

### close

    public void close()

  Closes this window.

Copyright © 2002-2011 Gargoyle Software Inc.. All Rights Reserved.