Package org.htmlunit
Class WebClient.CurrentWindowTracker
- java.lang.Object
-
- org.htmlunit.WebClient.CurrentWindowTracker
-
- All Implemented Interfaces:
java.io.Serializable
,WebWindowListener
- Enclosing class:
- WebClient
private static final class WebClient.CurrentWindowTracker extends java.lang.Object implements WebWindowListener, java.io.Serializable
Keeps track of the current window. Inspired by WebTest's logic to track the current response.
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
ensureOneTopLevelWindow_
private WebClient
webClient_
-
Constructor Summary
Constructors Constructor Description CurrentWindowTracker(WebClient webClient, boolean ensureOneTopLevelWindow)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
afterWebWindowClosedListenersProcessed(WebWindowEvent event)
Postprocessing to make sure we have always one top level window open.void
webWindowClosed(WebWindowEvent event)
A web window has been closed.void
webWindowContentChanged(WebWindowEvent event)
The contents of a web window has been changed.void
webWindowOpened(WebWindowEvent event)
A web window has been opened.
-
-
-
Field Detail
-
webClient_
private final WebClient webClient_
-
ensureOneTopLevelWindow_
private final boolean ensureOneTopLevelWindow_
-
-
Constructor Detail
-
CurrentWindowTracker
CurrentWindowTracker(WebClient webClient, boolean ensureOneTopLevelWindow)
-
-
Method Detail
-
webWindowClosed
public void webWindowClosed(WebWindowEvent event)
A web window has been closed. Closing the last window of the WebClient will automatically open a new one. You will receive an additional open event in this case.- Specified by:
webWindowClosed
in interfaceWebWindowListener
- Parameters:
event
- the event
-
afterWebWindowClosedListenersProcessed
public void afterWebWindowClosedListenersProcessed(WebWindowEvent event)
Postprocessing to make sure we have always one top level window open.
-
webWindowContentChanged
public void webWindowContentChanged(WebWindowEvent event)
The contents of a web window has been changed.- Specified by:
webWindowContentChanged
in interfaceWebWindowListener
- Parameters:
event
- the event
-
webWindowOpened
public void webWindowOpened(WebWindowEvent event)
A web window has been opened.Caution: the
WebClient.getCurrentWindow()
might be not updated so far. This usually takes place AFTER the event was processed- Specified by:
webWindowOpened
in interfaceWebWindowListener
- Parameters:
event
- the event (the oldPage and newPage properties will benull
because the event is generated after the window is opened but before the content is loaded)
-
-