|
|||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.mozilla.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 org.mozilla.javascript.ScriptableObject |
---|
CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONST |
Fields inherited from interface org.mozilla.javascript.Scriptable |
---|
NOT_FOUND |
Constructor Summary | |
---|---|
Window(JavaScriptEngine scriptEngine)
Creates an instance. |
Method Summary | |
---|---|
java.lang.Object |
custom_eval(java.lang.String scriptCode)
Executes the specified script code in the scope of this window. |
java.lang.Object |
get(java.lang.String name,
org.mozilla.javascript.Scriptable start)
Get a named property from the object. |
JavaScriptEngine |
getJavaScriptEngine()
Gets the Javascript Engine responsible for this object. |
org.mozilla.javascript.Scriptable |
getPrototype(java.lang.Class jsClass)
Returns the prototype object corresponding to the specified HtmlUnit class inside the window scope. |
WebWindow |
getWebWindow()
Return the WebWindow associated with this Window |
java.lang.Object |
getWithFallback(java.lang.String name)
Looks at attributes with the given name Fallback called when no configured property is found with the given name on the Scriptable object. |
void |
initialize()
Initialize the object. |
void |
initialize(Page enclosedPage)
Initialize the object. |
void |
initialize(WebWindow webWindow)
Initialize the object. |
void |
jsxFunction_addEventListener(java.lang.String type,
org.mozilla.javascript.Function listener,
boolean useCapture)
Allows the registration of event listeners on the event target |
void |
jsxFunction_alert(java.lang.Object message)
The javascript function "alert()" |
boolean |
jsxFunction_attachEvent(java.lang.String type,
org.mozilla.javascript.Function listener)
Allows the registration of event listeners on the event target |
void |
jsxFunction_blur()
Remove focus from this element |
void |
jsxFunction_captureEvents(java.lang.String type)
Does nothing special anymore... just like FF |
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()
Close this window |
boolean |
jsxFunction_confirm(java.lang.String message)
The javascript function "confirm()" |
static Popup |
jsxFunction_createPopup(org.mozilla.javascript.Context context,
org.mozilla.javascript.Scriptable scriptable,
java.lang.Object[] args,
org.mozilla.javascript.Function function)
Creates a popup window Open a new window |
void |
jsxFunction_detachEvent(java.lang.String type,
org.mozilla.javascript.Function listener)
Allows the removal of event listeners on the event target |
java.lang.Object |
jsxFunction_execScript(java.lang.String script,
java.lang.String language)
Executes the specified script code as long as the laguage is JavaScript or JScript. |
void |
jsxFunction_focus()
Set the focus to this element. |
java.lang.Object |
jsxFunction_getComputedStyle(NodeImpl element,
java.lang.String pseudoElt)
Returns computed style of the element. |
void |
jsxFunction_moveBy(int x,
int y)
Does nothing. |
void |
jsxFunction_moveTo(int x,
int y)
Does nothing. |
static java.lang.Object |
jsxFunction_open(org.mozilla.javascript.Context context,
org.mozilla.javascript.Scriptable scriptable,
java.lang.Object[] args,
org.mozilla.javascript.Function function)
Open a new window |
void |
jsxFunction_print()
Prints the current page. |
java.lang.String |
jsxFunction_prompt(java.lang.String message)
The javascript function "prompt()" |
void |
jsxFunction_removeEventListener(java.lang.String type,
org.mozilla.javascript.Function listener,
boolean useCapture)
Allows the removal of event listeners on the event target |
void |
jsxFunction_resizeTo(int width,
int height)
Does nothing. |
void |
jsxFunction_scroll(int x,
int y)
Does nothing. |
void |
jsxFunction_scrollBy(int x,
int y)
Does nothing. |
void |
jsxFunction_scrollByLines(int lines)
Does nothing. |
void |
jsxFunction_scrollByPages(int pages)
Does nothing. |
void |
jsxFunction_scrollTo(int x,
int y)
Does nothing. |
static int |
jsxFunction_setInterval(org.mozilla.javascript.Context context,
org.mozilla.javascript.Scriptable scriptable,
java.lang.Object[] args,
org.mozilla.javascript.Function function)
Set a chunk of javascript to be invoked each time a specified number of milliseconds has elapsed Current implementation does nothing. |
static int |
jsxFunction_setTimeout(org.mozilla.javascript.Context context,
org.mozilla.javascript.Scriptable scriptable,
java.lang.Object[] args,
org.mozilla.javascript.Function function)
Set a chunk of javascript to be invoked at some specified time later. |
boolean |
jsxGet_closed()
Indicates if this window is closed |
Document |
jsxGet_document()
Return the javascript property "document" |
java.lang.Object |
jsxGet_event()
Return the current event |
java.lang.Object |
jsxGet_frameElement()
Return the (i)frame in which the window is contained. |
HTMLCollection |
jsxGet_frames()
Return the value of the frames property. |
History |
jsxGet_history()
Return the "history" property |
int |
jsxGet_innerHeight()
Return the innerHeight. |
int |
jsxGet_innerWidth()
Return the innerWidth. |
Location |
jsxGet_location()
Return the location property |
java.lang.String |
jsxGet_name()
Return the value of the name property |
Navigator |
jsxGet_navigator()
Return the javascript property "navigator" |
java.lang.Object |
jsxGet_onclick()
Return the onclick property (caution this is not necessary a function if something else has been set) |
java.lang.Object |
jsxGet_ondblclick()
Return the ondblclick property (caution this is not necessary a function if something else has been set) |
java.lang.String |
jsxGet_onerror()
Return the value of the onerror property |
java.lang.Object |
jsxGet_onload()
Return the onload property (caution this is not necessary a function if something else has been set) |
java.lang.Object |
jsxGet_opener()
Return the value of the opener property. |
int |
jsxGet_outerHeight()
Return the outer height. |
int |
jsxGet_outerWidth()
Return the outerWidth. |
SimpleScriptable |
jsxGet_parent()
Return the value of the parent property |
Screen |
jsxGet_screen()
Return the "screen" property |
Window |
jsxGet_self()
Return the "self" property |
java.lang.String |
jsxGet_status()
Return the text from the status line. |
SimpleScriptable |
jsxGet_top()
Return the value of the top property |
Window |
jsxGet_window()
Return the window property. |
void |
jsxSet_location(java.lang.String newLocation)
Set the location property. |
void |
jsxSet_name(java.lang.String newName)
Set the value of the newName property |
void |
jsxSet_onclick(java.lang.Object newOnload)
Set the value of the onclick event handler. |
void |
jsxSet_ondblclick(java.lang.Object newHandler)
Set the value of the ondblclick event handler. |
void |
jsxSet_onerror(java.lang.String newValue)
Set the value of the onerror property |
void |
jsxSet_onload(java.lang.Object newOnload)
Set the value of the onload event handler. |
void |
jsxSet_status(java.lang.String message)
Set the text from the status line. |
void |
setEvent(java.lang.Object event)
Sets the current event |
void |
setPrototypes(java.util.Map map)
Sets the prototypes for HtmlUnit host classes |
Methods inherited from class com.gargoylesoftware.htmlunit.javascript.SimpleScriptable |
---|
getBooleanArg, getClassName, getDefaultValue, getDomNodeOrDie, getDomNodeOrNull, getHtmlElementOrDie, getHtmlElementOrNull, getIntArg, getObjectArg, getStringArg, makeScriptableFor, setDomNode, setHtmlElement |
Methods inherited from class org.mozilla.javascript.ScriptableObject |
---|
associateValue, avoidObjectDetection, callMethod, callMethod, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineProperty, defineProperty, defineProperty, defineProperty, delete, delete, deleteProperty, deleteProperty, get, getAllIds, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getFunctionPrototype, getGetterOrSetter, getIds, getObjectPrototype, getParentScope, getProperty, getProperty, getPropertyIds, getPrototype, getTopLevelScope, getTopScopeValue, has, has, hasInstance, hasProperty, hasProperty, isConst, isSealed, put, put, putConst, putConstProperty, putProperty, putProperty, redefineProperty, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setGetterOrSetter, setParentScope, setPrototype |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.mozilla.javascript.Scriptable |
---|
delete, delete, get, getClassName, getDefaultValue, getIds, getParentScope, getPrototype, has, has, hasInstance, put, put, setParentScope, setPrototype |
Constructor Detail |
---|
public Window(JavaScriptEngine scriptEngine)
scriptEngine
- The JavaScript engine responsible for the new window instance.Method Detail |
---|
public java.lang.Object custom_eval(java.lang.String scriptCode)
scriptCode
- some javascript code
public java.lang.Object get(java.lang.String name, org.mozilla.javascript.Scriptable start)
SimpleScriptable.getWithPreemption(String)
.
For fallback case just implement ScriptableWithFallbackGetter
.
get
in interface org.mozilla.javascript.Scriptable
get
in class SimpleScriptable
public JavaScriptEngine getJavaScriptEngine()
public org.mozilla.javascript.Scriptable getPrototype(java.lang.Class jsClass)
jsClass
- the class whose prototype is to be returned
public WebWindow getWebWindow()
public java.lang.Object getWithFallback(java.lang.String name)
Scriptable
object.
getWithFallback
in interface ScriptableWithFallbackGetter
name
- the name of the requested property
Scriptable.NOT_FOUND
if nothing is foundpublic void initialize()
public void initialize(Page enclosedPage)
enclosedPage
- The page containing the javascript.public void initialize(WebWindow webWindow) throws java.lang.Exception
webWindow
- The web window containing the javascript.
java.lang.Exception
- If an error occurs.public void jsxFunction_addEventListener(java.lang.String type, org.mozilla.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_alert(java.lang.Object message)
message
- The messagepublic boolean jsxFunction_attachEvent(java.lang.String type, org.mozilla.javascript.Function listener)
type
- the event type to listen for (like "load")listener
- the event listener
true
if the listener has been addedpublic void jsxFunction_blur()
public void jsxFunction_captureEvents(java.lang.String type)
type
- the type of eventspublic void jsxFunction_clearInterval(int intervalID)
intervalID
- specifies the interval to cancel as returned by the setInterval method.public void jsxFunction_clearTimeout(int timeoutId)
timeoutId
- identifier for the timeout to clear (returned by setTimeout)public void jsxFunction_close()
public boolean jsxFunction_confirm(java.lang.String message)
message
- The message
public static Popup jsxFunction_createPopup(org.mozilla.javascript.Context context, org.mozilla.javascript.Scriptable scriptable, java.lang.Object[] args, org.mozilla.javascript.Function function)
context
- The javascript Contextscriptable
- The object that the function was called on.args
- The arguments passed to the function.function
- The function object that was invoked.
public void jsxFunction_detachEvent(java.lang.String type, org.mozilla.javascript.Function listener)
type
- the event type to listen for (like "onload")listener
- the event listenerpublic java.lang.Object jsxFunction_execScript(java.lang.String script, java.lang.String language)
script
- the script code to executelanguage
- the language of the specified code ("JavaScript", "JScript" or "VBScript")
null
, like Internet Explorerpublic void jsxFunction_focus()
public java.lang.Object jsxFunction_getComputedStyle(NodeImpl element, java.lang.String pseudoElt)
element
- the elementpseudoElt
- is a string specifying the pseudo-element to match, can be null.
public void jsxFunction_moveBy(int x, int y)
x
- The horizontal positiony
- The vertical positionpublic void jsxFunction_moveTo(int x, int y)
x
- The horizontal positiony
- The vertical positionpublic static java.lang.Object jsxFunction_open(org.mozilla.javascript.Context context, org.mozilla.javascript.Scriptable scriptable, java.lang.Object[] args, org.mozilla.javascript.Function function)
context
- The javascript Contextscriptable
- The object that the function was called on.args
- The arguments passed to the function.function
- The function object that was invoked.
public void jsxFunction_print()
public java.lang.String jsxFunction_prompt(java.lang.String message)
message
- The message
public void jsxFunction_removeEventListener(java.lang.String type, org.mozilla.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 void jsxFunction_resizeTo(int width, int height)
width
- The width of the Window in pixel after resize.height
- The height of the Window in pixel after resize.public 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 static int jsxFunction_setInterval(org.mozilla.javascript.Context context, org.mozilla.javascript.Scriptable scriptable, java.lang.Object[] args, org.mozilla.javascript.Function function)
context
- The javascript Contextscriptable
- The object that the function was called on.args
- The arguments passed to the function.function
- The function object that was invoked.
public static int jsxFunction_setTimeout(org.mozilla.javascript.Context context, org.mozilla.javascript.Scriptable scriptable, java.lang.Object[] args, org.mozilla.javascript.Function function)
context
- The javascript Contextscriptable
- The object that the function was called on.args
- The arguments passed to the function.function
- The function object that was invoked.
public boolean jsxGet_closed()
true
if this window is closedpublic Document jsxGet_document()
public java.lang.Object jsxGet_event()
null
if no event is currently availablepublic java.lang.Object jsxGet_frameElement()
null
for a top level windowpublic HTMLCollection jsxGet_frames()
public History jsxGet_history()
public int jsxGet_innerHeight()
public int jsxGet_innerWidth()
public Location jsxGet_location()
public java.lang.String jsxGet_name()
public Navigator jsxGet_navigator()
public java.lang.Object jsxGet_onclick()
public java.lang.Object jsxGet_ondblclick()
public java.lang.String jsxGet_onerror()
public java.lang.Object jsxGet_onload()
public java.lang.Object jsxGet_opener()
null
for a top level windowpublic int jsxGet_outerHeight()
public int jsxGet_outerWidth()
public SimpleScriptable jsxGet_parent()
public Screen jsxGet_screen()
public Window jsxGet_self()
public java.lang.String jsxGet_status()
public SimpleScriptable jsxGet_top()
public Window jsxGet_window()
public void jsxSet_location(java.lang.String newLocation) throws java.io.IOException
newLocation
- The url of the new content.
java.io.IOException
- when location loading failspublic void jsxSet_name(java.lang.String newName)
newName
- The new window namepublic void jsxSet_onclick(java.lang.Object newOnload)
newOnload
- The new handlerpublic void jsxSet_ondblclick(java.lang.Object newHandler)
newHandler
- The new handlerpublic void jsxSet_onerror(java.lang.String newValue)
newValue
- The valuepublic void jsxSet_onload(java.lang.Object newOnload)
newOnload
- The new handlerpublic void jsxSet_status(java.lang.String message)
message
- the status line textpublic void setEvent(java.lang.Object event)
event
- the eventpublic void setPrototypes(java.util.Map map)
map
- a Map of (Class
, Scriptable
)
|
|||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |