Package org.htmlunit
Class TopLevelWindow
- java.lang.Object
-
- org.htmlunit.WebWindowImpl
-
- org.htmlunit.TopLevelWindow
-
- All Implemented Interfaces:
java.io.Serializable,WebWindow
public class TopLevelWindow extends WebWindowImpl
A window representing a top level browser window.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedTopLevelWindow(java.lang.String name, WebClient webClient)Creates an instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes this window.voidclose(boolean ignoreOnbeforeunloadAccepted)INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
Closes this window.WebWindowgetOpener()Returns the opener property.WebWindowgetParentWindow()Returns the window that contains this window.WebWindowgetTopWindow()Returns the top level window that contains this window.protected booleanisJavaScriptInitializationNeeded(Page page)Returnstrueif this window needs JavaScript initialization to occur when the enclosed page is set.voidsetOpener(WebWindow opener)Sets the opener property.java.lang.StringtoString()Returns a string representation of this object.-
Methods inherited from class org.htmlunit.WebWindowImpl
addChildWindow, destroyChildren, getComputedStyle, getEnclosedPage, getHistory, getInnerHeight, getInnerWidth, getJobManager, getName, getOuterHeight, getOuterWidth, getScreen, getScriptableObject, getWebClient, isClosed, performRegistration, removeChildWindow, setClosed, setEnclosedPage, setInnerHeight, setInnerWidth, setJobManager, setName, setOuterHeight, setOuterWidth, setScriptableObject
-
-
-
-
Constructor Detail
-
TopLevelWindow
protected TopLevelWindow(java.lang.String name, WebClient webClient)Creates an instance.- Parameters:
name- the name of the new windowwebClient- 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(Page page)
Returnstrueif this window needs JavaScript initialization to occur when the enclosed page is set.- Specified by:
isJavaScriptInitializationNeededin classWebWindowImpl- Parameters:
page- the page that will become the enclosing page- Returns:
trueif 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:
toStringin classjava.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.
-
close
public void close(boolean ignoreOnbeforeunloadAccepted)
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
Closes this window.- Parameters:
ignoreOnbeforeunloadAccepted- if true the result of triggering the OnbeforeunloadAccepted event will be ignored
-
-