public class Window extends SimpleScriptable implements ScriptableWithFallbackGetter
Constructor and Description |
---|
Window(JavaScriptEngine scriptEngine)
Creates an instance.
|
Modifier and Type | Method and Description |
---|---|
Object |
custom_eval(String scriptCode)
Executes the specified script code in the scope of this window.
|
Object |
get(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(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
|
Object |
getWithFallback(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(String type,
org.mozilla.javascript.Function listener,
boolean useCapture)
Allows the registration of event listeners on the event target
|
void |
jsxFunction_alert(Object message)
The javascript function "alert()"
|
boolean |
jsxFunction_attachEvent(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(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()
Close this window
|
boolean |
jsxFunction_confirm(String message)
The javascript function "confirm()"
|
static Popup |
jsxFunction_createPopup(org.mozilla.javascript.Context context,
org.mozilla.javascript.Scriptable scriptable,
Object[] args,
org.mozilla.javascript.Function function)
Creates a popup window Open a new window
|
void |
jsxFunction_detachEvent(String type,
org.mozilla.javascript.Function listener)
Allows the removal of event listeners on the event target
|
Object |
jsxFunction_execScript(String script,
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.
|
Object |
jsxFunction_getComputedStyle(Node element,
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 Object |
jsxFunction_open(org.mozilla.javascript.Context context,
org.mozilla.javascript.Scriptable scriptable,
Object[] args,
org.mozilla.javascript.Function function)
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,
org.mozilla.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.
|
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,
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,
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"
|
Object |
jsxGet_event()
Return the current event
|
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
|
String |
jsxGet_name()
Return the value of the name property
|
Navigator |
jsxGet_navigator()
Return the javascript property "navigator"
|
Object |
jsxGet_onclick()
Return the onclick property (caution this is not necessary a function if something else has
been set)
|
Object |
jsxGet_ondblclick()
Return the ondblclick property (caution this is not necessary a function if something else has
been set)
|
String |
jsxGet_onerror()
Return the value of the onerror property
|
Object |
jsxGet_onload()
Return the onload property (caution this is not necessary a function if something else has
been set)
|
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
|
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(String newLocation)
Set the location property.
|
void |
jsxSet_name(String newName)
Set the value of the newName property
|
void |
jsxSet_onclick(Object newOnload)
Set the value of the onclick event handler.
|
void |
jsxSet_ondblclick(Object newHandler)
Set the value of the ondblclick event handler.
|
void |
jsxSet_onerror(String newValue)
Set the value of the onerror property
|
void |
jsxSet_onload(Object newOnload)
Set the value of the onload event handler.
|
void |
jsxSet_status(String message)
Set the text from the status line.
|
void |
setEvent(Object event)
Sets the current event
|
void |
setPrototypes(Map map)
Sets the prototypes for HtmlUnit host classes
|
getBooleanArg, getClassName, getDefaultValue, getDomNodeOrDie, getDomNodeOrNull, getIntArg, getLog, getObjectArg, getScriptableFor, getStartingScope, getStringArg, getTransformerScriptableFor, getWindow, getWindow, getWithPreemption, makeScriptableFor, setDomNode, setDomNode, setHtmlElement
associateValue, callMethod, callMethod, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineProperty, defineProperty, defineProperty, defineProperty, delete, delete, deleteProperty, deleteProperty, equivalentValues, 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
public Window(JavaScriptEngine scriptEngine)
scriptEngine
- The JavaScript engine responsible for the new window instance.public JavaScriptEngine getJavaScriptEngine()
public org.mozilla.javascript.Scriptable getPrototype(Class jsClass)
getPrototype
in class SimpleScriptable
jsClass
- the class whose prototype is to be returnedpublic void setPrototypes(Map map)
map
- a Map of (Class
, Scriptable
)public void jsxFunction_alert(Object message)
message
- The messagepublic boolean jsxFunction_confirm(String message)
message
- The messagepublic String jsxFunction_prompt(String message)
message
- The messagepublic Document jsxGet_document()
public Object jsxGet_event()
null
if no event is currently availablepublic void setEvent(Object event)
event
- the eventpublic static Object jsxFunction_open(org.mozilla.javascript.Context context, org.mozilla.javascript.Scriptable scriptable, 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.WebClient.isPopupBlockerEnabled()
public static Popup jsxFunction_createPopup(org.mozilla.javascript.Context context, org.mozilla.javascript.Scriptable scriptable, 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, 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_clearTimeout(int timeoutId)
timeoutId
- identifier for the timeout to clear (returned by setTimeout)public Navigator jsxGet_navigator()
public Window jsxGet_window()
public Window jsxGet_self()
public Location jsxGet_location()
public void jsxSet_location(String newLocation) throws IOException
newLocation
- The url of the new content.IOException
- when location loading failspublic Screen jsxGet_screen()
public History jsxGet_history()
public void initialize(WebWindow webWindow) throws Exception
webWindow
- The web window containing the javascript.Exception
- If an error occurs.public void initialize(Page enclosedPage)
enclosedPage
- The page containing the javascript.public void initialize()
public SimpleScriptable jsxGet_top()
public SimpleScriptable jsxGet_parent()
public Object jsxGet_opener()
null
for a top level windowpublic Object jsxGet_frameElement()
null
for a top level windowpublic HTMLCollection jsxGet_frames()
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 offset.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 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 boolean jsxFunction_attachEvent(String type, org.mozilla.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, 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_detachEvent(String type, org.mozilla.javascript.Function listener)
type
- the event type to listen for (like "onload")listener
- the event listenerpublic void jsxFunction_removeEventListener(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 String jsxGet_name()
public void jsxSet_name(String newName)
newName
- The new window namepublic String jsxGet_onerror()
public void jsxSet_onerror(String newValue)
newValue
- The valuepublic 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(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 Object jsxFunction_execScript(String script, String language)
script
- the script code to executelanguage
- the language of the specified code ("JavaScript", "JScript" or "VBScript")null
, like Internet Explorerpublic Object custom_eval(String scriptCode)
scriptCode
- some javascript codepublic String jsxGet_status()
public void jsxSet_status(String message)
message
- the status line textpublic static int jsxFunction_setInterval(org.mozilla.javascript.Context context, org.mozilla.javascript.Scriptable scriptable, 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_clearInterval(int intervalID)
intervalID
- specifies the interval to cancel as returned by the setInterval method.public 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 eventspublic Object jsxFunction_getComputedStyle(Node element, String pseudoElt)
element
- the elementpseudoElt
- is a string specifying the pseudo-element to match, can be null.Copyright © 2002-2012 Gargoyle Software Inc.. All Rights Reserved.