public class Window extends SimpleScriptable implements ScriptableWithFallbackGetter, net.sourceforge.htmlunit.corejs.javascript.Function
Modifier and Type | Field and Description |
---|---|
static int |
WINDOW_HEIGHT
HtmlUnit's "window" height, in pixels.
|
static int |
WINDOW_WIDTH
HtmlUnit's "window" width, in pixels.
|
Constructor and Description |
---|
Window()
Creates an instance.
|
Modifier and Type | Method and Description |
---|---|
Object |
call(net.sourceforge.htmlunit.corejs.javascript.Context cx,
net.sourceforge.htmlunit.corejs.javascript.Scriptable scope,
net.sourceforge.htmlunit.corejs.javascript.Scriptable thisObj,
Object[] args) |
net.sourceforge.htmlunit.corejs.javascript.Scriptable |
construct(net.sourceforge.htmlunit.corejs.javascript.Context cx,
net.sourceforge.htmlunit.corejs.javascript.Scriptable scope,
Object[] args) |
Object |
custom_eval(String scriptCode)
Executes the specified script code in the scope of this window.
|
Object |
get(int index,
net.sourceforge.htmlunit.corejs.javascript.Scriptable start) |
Object |
get(String name,
net.sourceforge.htmlunit.corejs.javascript.Scriptable start)
Gets a named property from the object.
|
Event |
getCurrentEvent()
Returns the current event (used internally regardless of the emulation mode).
|
Document |
getDocument()
Returns the window's current document.
|
EventListenersContainer |
getEventListenersContainer()
Gets the container for event listeners.
|
net.sourceforge.htmlunit.corejs.javascript.Scriptable |
getPrototype(Class<? extends SimpleScriptable> jsClass)
Returns the prototype object corresponding to the specified HtmlUnit class inside the window scope.
|
static WindowProxy |
getProxy(WebWindow w)
Returns the proxy for the specified window.
|
Selection |
getSelection()
Returns the current selection.
|
WebWindow |
getWebWindow()
Returns the WebWindow associated with this Window.
|
Object |
getWithFallback(String name)
Fallback called when no configured property is found with the given name
on the
Scriptable object. |
void |
initialize()
Initializes the object.
|
void |
initialize(Page enclosedPage)
Initialize the object.
|
void |
initialize(WebWindow webWindow)
Initializes this window.
|
void |
jsxFunction_addEventListener(String type,
net.sourceforge.htmlunit.corejs.javascript.Function listener,
boolean useCapture)
Allows the registration of event listeners on the event target.
|
void |
jsxFunction_alert(Object message)
The JavaScript function "alert()".
|
String |
jsxFunction_atob(String encodedData)
Decodes a string of data which has been encoded using base-64 encoding..
|
boolean |
jsxFunction_attachEvent(String type,
net.sourceforge.htmlunit.corejs.javascript.Function listener)
Allows the registration of event listeners on the event target.
|
void |
jsxFunction_blur()
Removes focus from this element.
|
String |
jsxFunction_btoa(String stringToEncode)
Creates a base-64 encoded ASCII string from a string of binary data.
|
void |
jsxFunction_captureEvents(String type)
Does nothing special anymore...
|
void |
jsxFunction_clearInterval(int intervalID)
Cancels the interval previously started using the setInterval method.
|
void |
jsxFunction_clearTimeout(int timeoutId)
Cancels a time-out previously set with the setTimeout method.
|
void |
jsxFunction_close()
Closes this window.
|
void |
jsxFunction_CollectGarbage()
An undocumented IE function.
|
boolean |
jsxFunction_confirm(String message)
The JavaScript function "confirm()".
|
Popup |
jsxFunction_createPopup()
Creates a popup window.
|
void |
jsxFunction_detachEvent(String type,
net.sourceforge.htmlunit.corejs.javascript.Function listener)
Allows the removal of event listeners on the event target.
|
void |
jsxFunction_execScript(String script,
Object language)
Executes the specified script code as long as the language is JavaScript or JScript.
|
void |
jsxFunction_focus()
Sets the focus to this element.
|
ComputedCSSStyleDeclaration |
jsxFunction_getComputedStyle(HTMLElement element,
String pseudo)
Returns computed style of the element.
|
Selection |
jsxFunction_getSelection()
Returns the current selection.
|
void |
jsxFunction_moveBy(int x,
int y)
Does nothing.
|
void |
jsxFunction_moveTo(int x,
int y)
Does nothing.
|
WindowProxy |
jsxFunction_open(Object url,
Object name,
Object features,
Object replace)
Opens a new window.
|
void |
jsxFunction_print()
Prints the current page.
|
String |
jsxFunction_prompt(String message)
The JavaScript function "prompt()".
|
void |
jsxFunction_removeEventListener(String type,
net.sourceforge.htmlunit.corejs.javascript.Function listener,
boolean useCapture)
Allows the removal of event listeners on the event target.
|
void |
jsxFunction_resizeBy(int width,
int height)
Does nothing.
|
void |
jsxFunction_resizeTo(int width,
int height)
Does nothing.
|
String |
jsxFunction_ScriptEngine()
Gets the name of the scripting engine.
|
int |
jsxFunction_ScriptEngineBuildVersion()
Gets the build version of the scripting engine.
|
int |
jsxFunction_ScriptEngineMajorVersion()
Gets the major version of the scripting engine.
|
int |
jsxFunction_ScriptEngineMinorVersion()
Gets the minor version of the scripting engine.
|
void |
jsxFunction_scroll(int x,
int y)
Scrolls to the specified location on the page.
|
void |
jsxFunction_scrollBy(int x,
int y)
Scrolls the window content the specified distance.
|
void |
jsxFunction_scrollByLines(int lines)
Scrolls the window content down by the specified number of lines.
|
void |
jsxFunction_scrollByPages(int pages)
Scrolls the window content down by the specified number of pages.
|
void |
jsxFunction_scrollTo(int x,
int y)
Scrolls to the specified location on the page.
|
int |
jsxFunction_setInterval(Object code,
int timeout,
Object language)
Sets a chunk of JavaScript to be invoked each time a specified number of milliseconds has elapsed.
|
int |
jsxFunction_setTimeout(Object code,
int timeout,
Object language)
Sets a chunk of JavaScript to be invoked at some specified time later.
|
Object |
jsxFunction_showModalDialog(String url,
Object arguments,
String features)
Creates a modal dialog box that displays the specified HTML document.
|
Object |
jsxFunction_showModelessDialog(String url,
Object arguments,
String features)
Creates a modeless dialog box that displays the specified HTML document.
|
void |
jsxFunction_stop()
Should implement the stop() function on the window object.
|
OfflineResourceList |
jsxGet_applicationCache()
Returns the application cache.
|
Navigator |
jsxGet_clientInformation()
Returns the JavaScript property "clientInformation".
|
ClipboardData |
jsxGet_clipboardData()
Returns the JavaScript property "clipboardData".
|
boolean |
jsxGet_closed()
Indicates if this window is closed.
|
Object |
jsxGet_controllers()
Gets the controllers.
|
DocumentProxy |
jsxGet_document()
Returns the JavaScript property "document".
|
Object |
jsxGet_event()
Returns the current event (used by JavaScript only when emulating IE).
|
External |
jsxGet_external()
Returns the "external" property.
|
Object |
jsxGet_frameElement()
Returns the (i)frame in which the window is contained.
|
WindowProxy |
jsxGet_frames()
Returns the value of the frames property.
|
StorageList |
jsxGet_globalStorage()
Returns the globalStorage property.
|
History |
jsxGet_history()
Returns the "history" property.
|
int |
jsxGet_innerHeight()
Returns the innerHeight.
|
int |
jsxGet_innerWidth()
Returns the innerWidth.
|
int |
jsxGet_length()
Returns the number of frames contained by this window.
|
Storage |
jsxGet_localStorage()
Returns the localStorage property.
|
Location |
jsxGet_location()
Returns the location property.
|
String |
jsxGet_name()
Returns the value of the window's name property.
|
Navigator |
jsxGet_navigator()
Returns the JavaScript property "navigator".
|
Object |
jsxGet_onbeforeunload()
Returns the value of the window's onbeforeunload property.
|
Object |
jsxGet_onclick()
Returns the onclick property (caution this is not necessary a function if something else has
been set).
|
Object |
jsxGet_ondblclick()
Returns the ondblclick property (caution this is not necessary a function if something else has
been set).
|
Object |
jsxGet_onerror()
Returns the value of the window's onerror property.
|
Object |
jsxGet_onload()
Returns the onload property.
|
Object |
jsxGet_opener()
Returns the value of the opener property.
|
int |
jsxGet_outerHeight()
Returns the outer height.
|
int |
jsxGet_outerWidth()
Returns the outerWidth.
|
int |
jsxGet_pageXOffset()
Returns the value of "pageXOffset" property.
|
int |
jsxGet_pageYOffset()
Returns the value of "pageYOffset" property.
|
WindowProxy |
jsxGet_parent()
Returns the value of the parent property.
|
Screen |
jsxGet_screen()
Returns the "screen" property.
|
int |
jsxGet_scrollX()
Returns the value of "scrollX" property.
|
int |
jsxGet_scrollY()
Returns the value of "scrollY" property.
|
WindowProxy |
jsxGet_self()
Returns the "self" property.
|
Storage |
jsxGet_sessionStorage()
Returns the sessionStorage property.
|
String |
jsxGet_status()
Returns the text from the status line.
|
Object |
jsxGet_top()
Returns the value of the top property.
|
WindowProxy |
jsxGet_window()
Returns the window property.
|
void |
jsxSet_controllers(Object value)
Sets the controllers.
|
void |
jsxSet_location(String newLocation)
Sets the location property.
|
void |
jsxSet_name(String name)
Sets the value of the window's name property.
|
void |
jsxSet_onbeforeunload(Object onbeforeunload)
Sets the value of the window's onbeforeunload property.
|
void |
jsxSet_onclick(Object newOnload)
Sets the value of the onclick event handler.
|
void |
jsxSet_ondblclick(Object newHandler)
Sets the value of the ondblclick event handler.
|
void |
jsxSet_onerror(Object onerror)
Sets the value of the window's onerror property.
|
void |
jsxSet_onload(Object newOnload)
Sets the value of the onload event handler.
|
void |
jsxSet_opener(Object newValue)
Sets the opener property.
|
void |
jsxSet_status(String message)
Sets the text from the status line.
|
void |
jsxSet_top(Object o)
Sets the value of the top property.
|
void |
setPrototypes(Map<Class<? extends SimpleScriptable>,net.sourceforge.htmlunit.corejs.javascript.Scriptable> map)
Sets the prototypes for HtmlUnit host classes.
|
void |
triggerOnError(ScriptException e)
Triggers the onerror handler, if one has been set.
|
clone, defineFunctionProperties, defineProperty, equivalentValues, getBrowserVersion, getClassName, getDefaultValue, getDomNodeOrDie, getDomNodeOrNull, getScriptableFor, getStartingScope, getTransformerScriptableFor, getWindow, getWindow, getWithPreemption, hasInstance, initParentScope, makeScriptableFor, setCaseSensitive, setDomNode, setDomNode, setHtmlElement
applyDescriptorToAttributeBitset, associateValue, avoidObjectDetection, buildDataDescriptor, callMethod, callMethod, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineOwnProperties, defineOwnProperty, defineProperty, defineProperty, defineProperty, delete, delete, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, get, getAllIds, getArrayPrototype, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getFunctionPrototype, getGetterOrSetter, getIds, getObjectPrototype, getOwnPropertyDescriptor, getParentScope, getProperty, getProperty, getPropertyIds, getPrototype, getSlot, getTopLevelScope, getTopScopeValue, getTypedProperty, getTypedProperty, getTypeOf, has, has, hasProperty, hasProperty, isAccessorDescriptor, isConst, isDataDescriptor, isEmpty, isExtensible, isFalse, isGenericDescriptor, isGetterOrSetter, isSealed, isTrue, preventExtensions, put, put, putConst, putConstProperty, putProperty, putProperty, redefineProperty, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setGetterOrSetter, setParentScope, setPrototype, size
public static final int WINDOW_WIDTH
public static final int WINDOW_HEIGHT
public net.sourceforge.htmlunit.corejs.javascript.Scriptable getPrototype(Class<? extends SimpleScriptable> jsClass)
getPrototype
in class SimpleScriptable
jsClass
- the class whose prototype is to be returnedpublic void setPrototypes(Map<Class<? extends SimpleScriptable>,net.sourceforge.htmlunit.corejs.javascript.Scriptable> map)
map
- a Map of (Class
, Scriptable
)public void jsxFunction_alert(Object message)
message
- the messagepublic String jsxFunction_btoa(String stringToEncode)
stringToEncode
- string to encodepublic String jsxFunction_atob(String encodedData)
encodedData
- the encoded stringpublic boolean jsxFunction_confirm(String message)
message
- the messagepublic String jsxFunction_prompt(String message)
message
- the messagepublic DocumentProxy jsxGet_document()
public Document getDocument()
public OfflineResourceList jsxGet_applicationCache()
public Object jsxGet_event()
public Event getCurrentEvent()
public WindowProxy jsxFunction_open(Object url, Object name, Object features, Object replace)
url
- when a new document is opened, url is a String that specifies a MIME type for the document.
When a new window is opened, url is a String that specifies the URL to render in the new windowname
- the namefeatures
- the featuresreplace
- whether to replace in the history list or noWebClient.isPopupBlockerEnabled()
,
MSDN documentationpublic Popup jsxFunction_createPopup()
public int jsxFunction_setTimeout(Object code, int timeout, Object language)
code
- specifies the function pointer or string that indicates the code to be executed
when the specified interval has elapsedtimeout
- specifies the number of millisecondslanguage
- specifies languagepublic void jsxFunction_clearTimeout(int timeoutId)
timeoutId
- identifier for the timeout to clear (returned by setTimeout)public Navigator jsxGet_navigator()
public Navigator jsxGet_clientInformation()
public ClipboardData jsxGet_clipboardData()
public WindowProxy jsxGet_window()
public WindowProxy jsxGet_self()
public Storage jsxGet_localStorage()
public Storage jsxGet_sessionStorage()
public StorageList jsxGet_globalStorage()
public Location jsxGet_location()
public void jsxSet_location(String newLocation) throws IOException
newLocation
- the URL of the new contentIOException
- when location loading failspublic Screen jsxGet_screen()
public History jsxGet_history()
public External jsxGet_external()
public void initialize(WebWindow webWindow)
webWindow
- the web window corresponding to this windowpublic void initialize(Page enclosedPage)
enclosedPage
- the page containing the JavaScriptpublic void initialize()
public Object jsxGet_top()
public void jsxSet_top(Object o)
o
- the new valuepublic WindowProxy jsxGet_parent()
public Object jsxGet_opener()
public void jsxSet_opener(Object newValue)
newValue
- the new valuepublic Object jsxGet_frameElement()
null
for a top level windowpublic WindowProxy jsxGet_frames()
public int jsxGet_length()
public WebWindow getWebWindow()
public void jsxFunction_focus()
public void jsxFunction_blur()
public void jsxFunction_close()
public boolean jsxGet_closed()
true
if this window is closedpublic void jsxFunction_moveTo(int x, int y)
x
- the horizontal positiony
- the vertical positionpublic void jsxFunction_moveBy(int x, int y)
x
- the horizontal positiony
- the vertical positionpublic void jsxFunction_resizeBy(int width, int height)
width
- the width offsetheight
- the height offsetpublic void jsxFunction_resizeTo(int width, int height)
width
- the width of the Window in pixel after resizeheight
- the height of the Window in pixel after resizepublic void jsxFunction_scroll(int x, int y)
x
- the horizontal position to scroll toy
- the vertical position to scroll topublic void jsxFunction_scrollBy(int x, int y)
x
- the horizontal distance to scroll byy
- the vertical distance to scroll bypublic void jsxFunction_scrollByLines(int lines)
lines
- the number of lines to scroll downpublic void jsxFunction_scrollByPages(int pages)
pages
- the number of pages to scroll downpublic void jsxFunction_scrollTo(int x, int y)
x
- the horizontal position to scroll toy
- the vertical position to scroll topublic void jsxSet_onload(Object newOnload)
newOnload
- the new handlerpublic void jsxSet_onclick(Object newOnload)
newOnload
- the new handlerpublic Object jsxGet_onclick()
public void jsxSet_ondblclick(Object newHandler)
newHandler
- the new handlerpublic Object jsxGet_ondblclick()
public Object jsxGet_onload()
public EventListenersContainer getEventListenersContainer()
public boolean jsxFunction_attachEvent(String type, net.sourceforge.htmlunit.corejs.javascript.Function listener)
type
- the event type to listen for (like "load")listener
- the event listenertrue
if the listener has been addedpublic void jsxFunction_addEventListener(String type, net.sourceforge.htmlunit.corejs.javascript.Function listener, boolean useCapture)
type
- the event type to listen for (like "onload")listener
- the event listeneruseCapture
- If true
, indicates that the user wishes to initiate capture (not yet implemented)public void jsxFunction_detachEvent(String type, net.sourceforge.htmlunit.corejs.javascript.Function listener)
type
- the event type to listen for (like "onload")listener
- the event listenerpublic void jsxFunction_removeEventListener(String type, net.sourceforge.htmlunit.corejs.javascript.Function listener, boolean useCapture)
type
- the event type to listen for (like "load")listener
- the event listeneruseCapture
- If true
, indicates that the user wishes to initiate capture (not yet implemented)public String jsxGet_name()
public void jsxSet_name(String name)
name
- the value of the window's name propertypublic Object jsxGet_onbeforeunload()
public void jsxSet_onbeforeunload(Object onbeforeunload)
onbeforeunload
- the value of the window's onbeforeunload propertypublic Object jsxGet_onerror()
public void jsxSet_onerror(Object onerror)
onerror
- the value of the window's onerror propertypublic void triggerOnError(ScriptException e)
e
- the error that needs to be reportedpublic Object call(net.sourceforge.htmlunit.corejs.javascript.Context cx, net.sourceforge.htmlunit.corejs.javascript.Scriptable scope, net.sourceforge.htmlunit.corejs.javascript.Scriptable thisObj, Object[] args)
call
in interface net.sourceforge.htmlunit.corejs.javascript.Callable
call
in interface net.sourceforge.htmlunit.corejs.javascript.Function
public net.sourceforge.htmlunit.corejs.javascript.Scriptable construct(net.sourceforge.htmlunit.corejs.javascript.Context cx, net.sourceforge.htmlunit.corejs.javascript.Scriptable scope, Object[] args)
construct
in interface net.sourceforge.htmlunit.corejs.javascript.Function
public Object getWithFallback(String name)
Scriptable
object.getWithFallback
in interface ScriptableWithFallbackGetter
name
- the name of the requested propertyScriptable.NOT_FOUND
if nothing is foundpublic Object get(int index, net.sourceforge.htmlunit.corejs.javascript.Scriptable start)
get
in interface net.sourceforge.htmlunit.corejs.javascript.Scriptable
get
in class net.sourceforge.htmlunit.corejs.javascript.ScriptableObject
public Object get(String name, net.sourceforge.htmlunit.corejs.javascript.Scriptable start)
SimpleScriptable.getWithPreemption(String)
.
For fallback case just implement ScriptableWithFallbackGetter
.
get
in interface net.sourceforge.htmlunit.corejs.javascript.Scriptable
get
in class SimpleScriptable
public static WindowProxy getProxy(WebWindow w)
w
- the window whose proxy is to be returnedpublic void jsxFunction_execScript(String script, Object language)
script
- the script code to executelanguage
- the language of the specified code ("JavaScript", "JScript" or "VBScript")public Object custom_eval(String scriptCode)
scriptCode
- some JavaScript codepublic String jsxGet_status()
public void jsxSet_status(String message)
message
- the status line textpublic int jsxFunction_setInterval(Object code, int timeout, Object language)
code
- specifies the function pointer or string that indicates the code to be executed
when the specified interval has elapsedtimeout
- specifies the number of millisecondslanguage
- specifies languagepublic void jsxFunction_clearInterval(int intervalID)
intervalID
- specifies the interval to cancel as returned by the setInterval methodpublic int jsxGet_innerWidth()
public int jsxGet_outerWidth()
public int jsxGet_innerHeight()
public int jsxGet_outerHeight()
public void jsxFunction_print()
public void jsxFunction_captureEvents(String type)
type
- the type of events to captureDocument.jsxFunction_captureEvents(String)
public void jsxFunction_CollectGarbage()
public ComputedCSSStyleDeclaration jsxFunction_getComputedStyle(HTMLElement element, String pseudo)
element
- the elementpseudo
- a string specifying the pseudo-element to match (may be null)public Selection jsxFunction_getSelection()
public Selection getSelection()
public Object jsxFunction_showModalDialog(String url, Object arguments, String features)
url
- the URL of the document to load and displayarguments
- object to be made available via window.dialogArguments in the dialog windowfeatures
- string that specifies the window ornaments for the dialog windowpublic Object jsxFunction_showModelessDialog(String url, Object arguments, String features)
url
- the URL of the document to load and displayarguments
- object to be made available via window.dialogArguments in the dialog windowfeatures
- string that specifies the window ornaments for the dialog windowpublic Object jsxGet_controllers()
public void jsxSet_controllers(Object value)
value
- the new valuepublic String jsxFunction_ScriptEngine()
public int jsxFunction_ScriptEngineBuildVersion()
public int jsxFunction_ScriptEngineMajorVersion()
public int jsxFunction_ScriptEngineMinorVersion()
public void jsxFunction_stop()
public int jsxGet_pageXOffset()
public int jsxGet_pageYOffset()
public int jsxGet_scrollX()
public int jsxGet_scrollY()
Copyright © 2002–2015 Gargoyle Software Inc.. All rights reserved.