|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sourceforge.htmlunit.corejs.javascript.ScriptableObject
com.gargoylesoftware.htmlunit.javascript.SimpleScriptable
com.gargoylesoftware.htmlunit.javascript.host.Window
public class Window
A JavaScript object for a Window.
| Field Summary |
|---|
| Fields inherited from class net.sourceforge.htmlunit.corejs.javascript.ScriptableObject |
|---|
CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONST |
| Fields inherited from interface net.sourceforge.htmlunit.corejs.javascript.Scriptable |
|---|
NOT_FOUND |
| Constructor Summary | |
|---|---|
Window()
Creates an instance. |
|
| Method Summary | |
|---|---|
void |
addEventListener(String type,
net.sourceforge.htmlunit.corejs.javascript.Function listener,
boolean useCapture)
Allows the registration of event listeners on the event target. |
void |
alert(Object message)
The JavaScript function "alert()". |
String |
atob(String encodedData)
Decodes a string of data which has been encoded using base-64 encoding.. |
boolean |
attachEvent(String type,
net.sourceforge.htmlunit.corejs.javascript.Function listener)
Allows the registration of event listeners on the event target. |
void |
blur()
Removes focus from this element. |
String |
btoa(String stringToEncode)
Creates a base-64 encoded ASCII string from a string of binary data. |
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)
|
void |
captureEvents(String type)
Does nothing special anymore... |
void |
clearInterval(int intervalID)
Cancels the interval previously started using the setInterval method. |
void |
clearTimeout(int timeoutId)
Cancels a time-out previously set with the setTimeout method. |
void |
close()
Closes this window. |
void |
CollectGarbage()
An undocumented IE function. |
boolean |
confirm(String message)
The JavaScript function "confirm()". |
net.sourceforge.htmlunit.corejs.javascript.Scriptable |
construct(net.sourceforge.htmlunit.corejs.javascript.Context cx,
net.sourceforge.htmlunit.corejs.javascript.Scriptable scope,
Object[] args)
|
Popup |
createPopup()
Creates a popup window. |
void |
detachEvent(String type,
net.sourceforge.htmlunit.corejs.javascript.Function listener)
Allows the removal of event listeners on the event target. |
boolean |
dispatchEvent(Event event)
Dispatches an event into the event system (standards-conformant browsers only). |
void |
dump(String message)
Prints messages to the console. |
void |
execScript(String script,
Object language)
Executes the specified script code as long as the language is JavaScript or JScript. |
ScriptResult |
executeEvent(Event event)
Executes the event on this object only (needed for instance for onload on (i)frame tags). |
protected ScriptResult |
executeEvent(Event event,
EventListenersContainer eventListenersContainer)
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK. Executes the event on this window only. |
void |
focus()
Sets the focus to this element. |
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. |
ApplicationCache |
getApplicationCache()
Returns the application cache. |
Navigator |
getClientInformation()
Returns the JavaScript property "clientInformation". |
ClipboardData |
getClipboardData()
Returns the JavaScript property "clipboardData". |
boolean |
getClosed()
Indicates if this window is closed. |
ComputedCSSStyleDeclaration |
getComputedStyle(Element element,
String pseudo)
Returns computed style of the element. |
net.sourceforge.htmlunit.corejs.javascript.ScriptableObject |
getConsole()
Returns the console property. |
Object |
getControllers()
Gets the controllers. |
Event |
getCurrentEvent()
Returns the current event (used internally regardless of the emulation mode). |
DocumentProxy |
getDocument_js()
Returns the JavaScript property "document". |
Document |
getDocument()
Returns the window's current document. |
Object |
getEvent()
Returns the current event (used by JavaScript only when emulating IE). |
EventListenersContainer |
getEventListenersContainer()
Gets the container for event listeners. |
External |
getExternal()
Returns the "external" property. |
Object |
getFrameElement()
Returns the (i)frame in which the window is contained. |
WindowProxy |
getFrames_js()
Returns the value of the frames property. |
StorageList |
getGlobalStorage()
Returns the globalStorage property. |
History |
getHistory()
Returns the "history" property. |
int |
getInnerHeight()
Returns the innerHeight. |
int |
getInnerWidth()
Returns the innerWidth. |
int |
getLength()
Returns the number of frames contained by this window. |
Storage |
getLocalStorage()
Returns the localStorage property. |
Location |
getLocation()
Returns the location property. |
int |
getMozInnerScreenX()
Returns the value of "mozInnerScreenX" property. |
int |
getMozInnerScreenY()
Returns the value of "mozInnerScreenY" property. |
int |
getMozPaintCount()
Returns the value of "mozPaintCount" property. |
String |
getName()
Returns the value of the window's name property. |
Navigator |
getNavigator()
Returns the JavaScript property "navigator". |
Netscape |
getNetscape()
Returns the value of "netscape" property. |
Object |
getOnbeforeunload()
Returns the value of the window's onbeforeunload property. |
Object |
getOnchange()
Getter for the onchange event handler. |
Object |
getOnclick()
Returns the onclick property (caution this is not necessary a function if something else has been set). |
Object |
getOndblclick()
Returns the ondblclick property (caution this is not necessary a function if something else has been set). |
Object |
getOnerror()
Returns the value of the window's onerror property. |
Object |
getOnhashchange()
Returns the onhashchange property (caution this is not necessary a function if something else has been set). |
Object |
getOnload()
Returns the onload property. |
Object |
getOpener()
Returns the value of the opener property. |
int |
getOuterHeight()
Returns the outer height. |
int |
getOuterWidth()
Returns the outerWidth. |
int |
getPageXOffset()
Returns the value of "pageXOffset" property. |
int |
getPageYOffset()
Returns the value of "pageYOffset" property. |
WindowProxy |
getParent()
Returns the value of the parent property. |
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. |
Screen |
getScreen()
Returns the "screen" property. |
int |
getScrollX()
Returns the value of "scrollX" property. |
int |
getScrollY()
Returns the value of "scrollY" property. |
Selection |
getSelection()
Returns the current selection. |
Selection |
getSelectionImpl()
Returns the current selection. |
WindowProxy |
getSelf()
Returns the "self" property. |
Storage |
getSessionStorage()
Returns the sessionStorage property. |
String |
getStatus()
Returns the text from the status line. |
Storage |
getStorage(StorageHolder.Type storageType)
Gets the storage of the specified type. |
Object |
getTop()
Returns the value of the top property. |
WebWindow |
getWebWindow()
Returns the WebWindow associated with this Window. |
WindowProxy |
getWindow_js()
Returns the window property. |
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. |
boolean |
isConst(String name)
Used to allow re-declaration of constants (eg: "var undefined;"). |
void |
moveBy(int x,
int y)
Does nothing. |
void |
moveTo(int x,
int y)
Does nothing. |
WindowProxy |
open(Object url,
Object name,
Object features,
Object replace)
Opens a new window. |
void |
postMessage(String message,
String targetOrigin)
Posts a message. |
void |
print()
Prints the current page. |
String |
prompt(String message)
The JavaScript function "prompt()". |
void |
removeEventListener(String type,
net.sourceforge.htmlunit.corejs.javascript.Function listener,
boolean useCapture)
Allows the removal of event listeners on the event target. |
void |
resizeBy(int width,
int height)
Does nothing. |
void |
resizeTo(int width,
int height)
Does nothing. |
String |
ScriptEngine()
Gets the name of the scripting engine. |
int |
ScriptEngineBuildVersion()
Gets the build version of the scripting engine. |
int |
ScriptEngineMajorVersion()
Gets the major version of the scripting engine. |
int |
ScriptEngineMinorVersion()
Gets the minor version of the scripting engine. |
void |
scroll(int x,
int y)
Scrolls to the specified location on the page. |
void |
scrollBy(int x,
int y)
Scrolls the window content the specified distance. |
void |
scrollByLines(int lines)
Scrolls the window content down by the specified number of lines. |
void |
scrollByPages(int pages)
Scrolls the window content down by the specified number of pages. |
void |
scrollTo(int x,
int y)
Scrolls to the specified location on the page. |
void |
setConsole(net.sourceforge.htmlunit.corejs.javascript.ScriptableObject console)
Sets the console. |
void |
setControllers(Object value)
Sets the controllers. |
int |
setInterval(Object code,
int timeout,
Object language)
Sets a chunk of JavaScript to be invoked each time a specified number of milliseconds has elapsed. |
void |
setLocation(String newLocation)
Sets the location property. |
void |
setName(String name)
Sets the value of the window's name property. |
void |
setOnbeforeunload(Object onbeforeunload)
Sets the value of the window's onbeforeunload property. |
void |
setOnchange(Object onchange)
Setter for the onchange event handler. |
void |
setOnclick(Object newOnload)
Sets the value of the onclick event handler. |
void |
setOndblclick(Object newHandler)
Sets the value of the ondblclick event handler. |
void |
setOnerror(Object onerror)
Sets the value of the window's onerror property. |
void |
setOnhashchange(Object newHandler)
Sets the value of the onhashchange event handler. |
void |
setOnload(Object newOnload)
Sets the value of the onload event handler. |
void |
setOpener(Object newValue)
Sets the opener property. |
void |
setPrototypes(Map<Class<? extends SimpleScriptable>,net.sourceforge.htmlunit.corejs.javascript.Scriptable> map)
Sets the prototypes for HtmlUnit host classes. |
void |
setStatus(String message)
Sets the text from the status line. |
int |
setTimeout(Object code,
int timeout,
Object language)
Sets a chunk of JavaScript to be invoked at some specified time later. |
void |
setTop(Object o)
Sets the value of the top property. |
Object |
showModalDialog(String url,
Object arguments,
String features)
Creates a modal dialog box that displays the specified HTML document. |
Object |
showModelessDialog(String url,
Object arguments,
String features)
Creates a modeless dialog box that displays the specified HTML document. |
void |
stop()
Should implement the stop() function on the window object. |
void |
triggerOnError(ScriptException e)
Triggers the onerror handler, if one has been set. |
| Methods inherited from class com.gargoylesoftware.htmlunit.javascript.SimpleScriptable |
|---|
clone, defineFunctionProperties, defineProperty, equivalentValues, getBrowserVersion, getClassName, getDefaultValue, getDomNodeOrDie, getDomNodeOrNull, getScriptableFor, getStartingScope, getTransformerScriptableFor, getWindow, getWindow, getWithPreemption, hasInstance, initParentScope, isReadOnlySettable, makeScriptableFor, setCaseSensitive, setDomNode, setDomNode, setHtmlElement, setParentScope |
| Methods inherited from class net.sourceforge.htmlunit.corejs.javascript.ScriptableObject |
|---|
applyDescriptorToAttributeBitset, associateValue, avoidObjectDetection, buildDataDescriptor, callMethod, callMethod, checkPropertyChange, checkPropertyDefinition, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineOwnProperties, defineOwnProperty, 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, isDataDescriptor, isEmpty, isExtensible, isFalse, isGenericDescriptor, isGetterOrSetter, isSealed, isTrue, preventExtensions, put, put, putConst, putConstProperty, putProperty, putProperty, redefineProperty, sameValue, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setGetterOrSetter, setPrototype, size |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface net.sourceforge.htmlunit.corejs.javascript.Scriptable |
|---|
delete, delete, getClassName, getDefaultValue, getIds, getParentScope, getPrototype, has, has, hasInstance, put, put, setParentScope, setPrototype |
| Constructor Detail |
|---|
public Window()
| Method Detail |
|---|
public net.sourceforge.htmlunit.corejs.javascript.Scriptable getPrototype(Class<? extends SimpleScriptable> jsClass)
getPrototype in class SimpleScriptablejsClass - the class whose prototype is to be returned
public void setPrototypes(Map<Class<? extends SimpleScriptable>,net.sourceforge.htmlunit.corejs.javascript.Scriptable> map)
map - a Map of (Class, Scriptable)public void alert(Object message)
message - the messagepublic String btoa(String stringToEncode)
stringToEncode - string to encode
public String atob(String encodedData)
encodedData - the encoded string
public boolean confirm(String message)
message - the message
public String prompt(String message)
message - the message
public DocumentProxy getDocument_js()
public Document getDocument()
public ApplicationCache getApplicationCache()
public Object getEvent()
public Event getCurrentEvent()
public WindowProxy 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 no
WebClientOptions.isPopupBlockerEnabled(),
MSDN documentationpublic Popup createPopup()
public int 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 language
public void clearTimeout(int timeoutId)
timeoutId - identifier for the timeout to clear (returned by setTimeout)public Navigator getNavigator()
public Navigator getClientInformation()
public ClipboardData getClipboardData()
public WindowProxy getWindow_js()
public WindowProxy getSelf()
public Storage getLocalStorage()
public Storage getSessionStorage()
public Storage getStorage(StorageHolder.Type storageType)
storageType - the type
public StorageList getGlobalStorage()
public Location getLocation()
public void setLocation(String newLocation)
throws IOException
newLocation - the URL of the new content
IOException - when location loading failspublic net.sourceforge.htmlunit.corejs.javascript.ScriptableObject getConsole()
public void setConsole(net.sourceforge.htmlunit.corejs.javascript.ScriptableObject console)
console - the consolepublic void dump(String message)
message - the message to logpublic Screen getScreen()
public History getHistory()
public External getExternal()
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 getTop()
public void setTop(Object o)
o - the new valuepublic WindowProxy getParent()
public Object getOpener()
public void setOpener(Object newValue)
newValue - the new valuepublic Object getFrameElement()
null for a top level windowpublic WindowProxy getFrames_js()
public int getLength()
public WebWindow getWebWindow()
public void focus()
public void blur()
public void close()
public boolean getClosed()
true if this window is closed
public void moveTo(int x,
int y)
x - the horizontal positiony - the vertical position
public void moveBy(int x,
int y)
x - the horizontal positiony - the vertical position
public void resizeBy(int width,
int height)
width - the width offsetheight - the height offset
public void resizeTo(int width,
int height)
width - the width of the Window in pixel after resizeheight - the height of the Window in pixel after resize
public void scroll(int x,
int y)
x - the horizontal position to scroll toy - the vertical position to scroll to
public void scrollBy(int x,
int y)
x - the horizontal distance to scroll byy - the vertical distance to scroll bypublic void scrollByLines(int lines)
lines - the number of lines to scroll downpublic void scrollByPages(int pages)
pages - the number of pages to scroll down
public void scrollTo(int x,
int y)
x - the horizontal position to scroll toy - the vertical position to scroll topublic void setOnload(Object newOnload)
newOnload - the new handlerpublic void setOnclick(Object newOnload)
newOnload - the new handlerpublic Object getOnclick()
public void setOndblclick(Object newHandler)
newHandler - the new handlerpublic Object getOndblclick()
public Object getOnload()
public Object getOnhashchange()
public void setOnhashchange(Object newHandler)
newHandler - the new handlerpublic EventListenersContainer getEventListenersContainer()
public boolean attachEvent(String type,
net.sourceforge.htmlunit.corejs.javascript.Function listener)
type - the event type to listen for (like "load")listener - the event listener
true if the listener has been added
public void 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 detachEvent(String type,
net.sourceforge.htmlunit.corejs.javascript.Function listener)
type - the event type to listen for (like "onload")listener - the event listener
public void 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 getName()
public void setName(String name)
name - the value of the window's name propertypublic Object getOnbeforeunload()
public void setOnbeforeunload(Object onbeforeunload)
onbeforeunload - the value of the window's onbeforeunload propertypublic Object getOnerror()
public void setOnerror(Object onerror)
onerror - the value of the window's onerror propertypublic void triggerOnError(ScriptException e)
e - the error that needs to be reported
public 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.Callablecall 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.Functionpublic Object getWithFallback(String name)
Scriptable object.
getWithFallback in interface ScriptableWithFallbackGettername - the name of the requested property
Scriptable.NOT_FOUND if nothing is found
public Object get(int index,
net.sourceforge.htmlunit.corejs.javascript.Scriptable start)
get in interface net.sourceforge.htmlunit.corejs.javascript.Scriptableget 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.Scriptableget in class SimpleScriptablepublic static WindowProxy getProxy(WebWindow w)
w - the window whose proxy is to be returned
public void execScript(String script,
Object language)
script - the script code to executelanguage - the language of the specified code ("JavaScript" or "JScript")public String getStatus()
public void setStatus(String message)
message - the status line text
public int 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 language
public void clearInterval(int intervalID)
intervalID - specifies the interval to cancel as returned by the setInterval methodpublic int getInnerWidth()
public int getOuterWidth()
public int getInnerHeight()
public int getOuterHeight()
public void print()
public void captureEvents(String type)
type - the type of events to captureDocument.captureEvents(String)public void CollectGarbage()
public ComputedCSSStyleDeclaration getComputedStyle(Element element,
String pseudo)
element - the elementpseudo - a string specifying the pseudo-element to match (may be null)
public Selection getSelection()
public Selection getSelectionImpl()
public Object 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 window
public Object 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 window
public Object getControllers()
public void setControllers(Object value)
value - the new valuepublic int getMozInnerScreenX()
public int getMozInnerScreenY()
public int getMozPaintCount()
public String ScriptEngine()
public int ScriptEngineBuildVersion()
public int ScriptEngineMajorVersion()
public int ScriptEngineMinorVersion()
public void stop()
public int getPageXOffset()
public int getPageYOffset()
public int getScrollX()
public int getScrollY()
public Netscape getNetscape()
public ScriptResult executeEvent(Event event)
event - the event
protected ScriptResult executeEvent(Event event,
EventListenersContainer eventListenersContainer)
event - the eventeventListenersContainer - the container with the listeners
public boolean isConst(String name)
isConst in interface net.sourceforge.htmlunit.corejs.javascript.ConstPropertiesisConst in class net.sourceforge.htmlunit.corejs.javascript.ScriptableObjectcom.gargoylesoftware.htmlunit.javascript.NativeGlobalTestpublic boolean dispatchEvent(Event event)
event - the event to be dispatched
public Object getOnchange()
public void setOnchange(Object onchange)
onchange - the handler
public void postMessage(String message,
String targetOrigin)
message - the object passed to the windowtargetOrigin - the origin this window must be for the event to be dispatched
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||