com.meterware.httpunit.dom
Class DomWindow

java.lang.Object
  extended by org.mozilla.javascript.ScriptableObject
      extended by com.meterware.httpunit.javascript.ScriptingEngineImpl
          extended by com.meterware.httpunit.dom.AbstractDomComponent
              extended by com.meterware.httpunit.dom.DomWindow
All Implemented Interfaces:
ScriptingEngine, ScriptingEventHandler, ScriptingHandler, java.io.Serializable, org.mozilla.javascript.ConstProperties, org.mozilla.javascript.debug.DebuggableObject, org.mozilla.javascript.Scriptable

public class DomWindow
extends AbstractDomComponent
implements org.mozilla.javascript.Scriptable

Author:
Russell Gold
See Also:
Serialized Form

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
DomWindow(DomWindowProxy implementation)
           
DomWindow(HTMLDocumentImpl document)
          construct me from a document
 
Method Summary
 void alert(java.lang.String message)
          Displays an alert box with the specified message.
 void close()
          Closes the current window.
 boolean confirm(java.lang.String prompt)
          Displays a prompt, asking for a yes or no answer and returns the answer.
protected  void discardDocumentWriteBuffer()
           
 void focus()
           
 org.w3c.dom.html.HTMLDocument getDocument()
           
protected  java.lang.String getDocumentWriteBuffer()
           
 org.w3c.dom.html.HTMLDocument getOwnerDocument()
          Returns the document associated with this window.
 DomWindow getSelf()
           
 DomWindow getWindow()
           
 void moveTo(int x, int y)
           
 DomWindow open(java.lang.String urlString, java.lang.String name, java.lang.String features, boolean replace)
          Opens a named window.
 java.lang.String prompt(java.lang.String message, java.lang.String defaultResponse)
          Displays a promptand returns the user's textual reply, which could be the default reply.
 void setProxy(DomWindowProxy proxy)
           
 void setTimeout(int timeout)
           
 
Methods inherited from class com.meterware.httpunit.dom.AbstractDomComponent
clearCaches, createAnonymousFunctionName, get, getClassName, getJavaPropertyName, has, newScriptingEngine, put
 
Methods inherited from class com.meterware.httpunit.javascript.ScriptingEngineImpl
clearErrorMessages, doEvent, doEventScript, evaluateExpression, getErrorMessages, handleEvent, handleScriptException, runScript, supportsScriptLanguage
 
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, equivalentValues, get, getAllIds, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getDefaultValue, getFunctionPrototype, getGetterOrSetter, getIds, getObjectPrototype, getParentScope, getProperty, getProperty, getPropertyIds, getPrototype, getTopLevelScope, getTopScopeValue, has, hasInstance, hasProperty, hasProperty, isConst, isGetterOrSetter, isSealed, put, putConst, putConstProperty, putProperty, putProperty, redefineProperty, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setGetterOrSetter, setParentScope, setPrototype
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.mozilla.javascript.Scriptable
delete, delete, get, get, getClassName, getDefaultValue, getIds, getParentScope, getPrototype, has, has, hasInstance, put, put, setParentScope, setPrototype
 

Constructor Detail

DomWindow

public DomWindow(HTMLDocumentImpl document)
construct me from a document

Parameters:
document -

DomWindow

public DomWindow(DomWindowProxy implementation)
Method Detail

setProxy

public void setProxy(DomWindowProxy proxy)

getWindow

public DomWindow getWindow()

getSelf

public DomWindow getSelf()

getDocument

public org.w3c.dom.html.HTMLDocument getDocument()

getOwnerDocument

public org.w3c.dom.html.HTMLDocument getOwnerDocument()
Returns the document associated with this window. Uses the same name as that used by elements in the DOM.


open

public DomWindow open(java.lang.String urlString,
                      java.lang.String name,
                      java.lang.String features,
                      boolean replace)
Opens a named window.

Parameters:
urlString - the location (relative to the current page) from which to populate the window.
name - the name of the window.
features - special features for the window.
replace - if true, replaces the contents of an existing window.
Returns:
a new populated window object

close

public void close()
Closes the current window. Has no effect if this "window" is actually a nested frame.


alert

public void alert(java.lang.String message)
Displays an alert box with the specified message.

Parameters:
message - the message to display

confirm

public boolean confirm(java.lang.String prompt)
Displays a prompt, asking for a yes or no answer and returns the answer.

Parameters:
prompt - the prompt text to display
Returns:
true if the user answered 'yes'

prompt

public java.lang.String prompt(java.lang.String message,
                               java.lang.String defaultResponse)
Displays a promptand returns the user's textual reply, which could be the default reply.

Parameters:
message - the prompt text to display
defaultResponse - the response to return if the user doesn't enter anything
Returns:
the reply selected by the user.

setTimeout

public void setTimeout(int timeout)

focus

public void focus()

moveTo

public void moveTo(int x,
                   int y)

getDocumentWriteBuffer

protected java.lang.String getDocumentWriteBuffer()
Overrides:
getDocumentWriteBuffer in class ScriptingEngineImpl

discardDocumentWriteBuffer

protected void discardDocumentWriteBuffer()
Overrides:
discardDocumentWriteBuffer in class ScriptingEngineImpl


Copyright © 2011. All Rights Reserved.