DhWindow Class

DhWindow Class

This Package | All Packages

public class DhWindow

Represents an HTML window object.

Constructors
Name Description
DhWindow() Creates a DhWindow object.
DhWindow(IHTMLWindow2 window, IHTMLDocument2 docPeer, DhDocument document) Creates a DhWindow object.

Methods
Name Description
close() Closes the window, and resets its document and window peers to null.
findWindow( IHTMLWindow2 windowPeer) Loops through all the known windows and tries to locate the one with the specified windowPeer.
getBrowser() Retrieves the representation of the browser object.
getClosed() Determines if the window is closed.
getDialogArguments() Retrieves the arguments passed to a modal dialog window.
getDocument() Retrieves the document contained in this window.
getEventPeer() Retrieves a peer that handles events for this window.
getFrame(String name) Retrieves the first frame that has the specified name.
getFrames() Retrieves an array of DhWindow objects, one for each frame enclosed in this window.
getHashString() Retrieves a hash string passed to the document.
getHistoryLength() Retrieves the number of entries in the window's history.
getName() Retrieves a string representing the name of the window.
getParent() Retrieves the parent of this window.
getPeer() Retrieves the underlying HTML peer element for this class.
getReturnValue() Retrieves the return value from a modal dialog window.
getSearchString() Retrieves a search string passed to the document.
getUrl() Retrieves a string representing the URL of the window's document.
getWindowPeer() Retrieves the underlying HTML peer element for this class.
goBackInHistory(int delta, DhEventHandler h) Loads the previous URL in the history list.
goForwardInHistory(int delta, DhEventHandler h) Loads the next URL in the history list.
goRelativeInHistory(int delta, DhEventHandler h) Loads the previous URL in the history list.
MessageBox( String s ) Displays a modal user message box.
navigate(String url, DhEventHandler h) Opens a new URL in this window with the specified name and properties and returns a DhWindow handle to the newly opened window.
open(String url, String name, DhWindowInfo wi, boolean fReplace) Opens a new URL in this window with the given name and properties and returns a DhWindow handle to the newly opened window.
setFocus(boolean focus) Sets or removes the focus of the current window.
setName(String name) Sets the name of the current window.
setReturnValue(Variant retValue) Retrieves the return value from a modal dialog window.
setStatus(String s ) Displays a string in the status bar of the window host (typically the browser).
showModalDialog(String dialogUrl, Variant dialogArgs, DhDialogInfo di) Opens an HTML dialog window using the URL as the source of the contents and dialoginfo to define the appearance of the dialog window.

Constructors

DhWindow.DhWindow

Syntax 1
public DhWindow();
Description

Creates a DhWindow object.



Syntax 2
public DhWindow( IHTMLWindow2 window, IHTMLDocument2 docPeer, DhDocument document );
Parameters
window
The peer for this window.
document
The document associated with this window.
Description

Creates a DhWindow object.

Methods

DhWindow.close

Syntax
public synchronized void close();
Description

Closes the window, and resets its document and window peers to null.

DhWindow.findWindow

Syntax
protected synchronized DhWindow findWindow( IHTMLWindow2 windowPeer );
Parameters
windowPeer
The windowPeer to be searched on.
Return Value

Returns the DhWindow object corresponding to the specified windowPeer.

Description

Loops through all the known windows and tries to locate the one with the specified windowPeer.

DhWindow.getBrowser

Syntax
final public DhBrowser getBrowser();
Return Value

Returns an object representing the browser.

Description

Retrieves the representation of the browser object.

DhWindow.getClosed

Syntax
final public synchronized boolean getClosed();
Return Value

Returns true if the window is closed; otherwise, returns false.

Description

Determines if the window is closed.

DhWindow.getDialogArguments

Syntax
final public Variant getDialogArguments();
Return Value

Returns arguments passed to this dialog window through showModalDialog().

Description

Retrieves the arguments passed to a modal dialog window.

DhWindow.getDocument

Syntax
public synchronized DhDocument getDocument();
Return Value

Returns the document associated with this window.

Description

Retrieves the document contained in this window. The result can be null if the document is not accessible (for example, because of security restrictions).

DhWindow.getEventPeer

Syntax
final public IUnknown getEventPeer();
Return Value

Returns an IUnknown object containing a reference to the peer that handles events for this window.

Description

Retrieves a peer that handles events for this window.

DhWindow.getFrame

Syntax
public DhWindow getFrame( String name );
Parameters
name
The name of the frame to locate.
Return Value

Returns the window defining the enclosed frame having the specified name.

Description

Retrieves the first frame that has the specified name. This name has to be unique. Otherwise, it returns null.

DhWindow.getFrames

Syntax
public DhWindow[] getFrames();
Return Value

Returns the array of windows defining the enclosed frames.

Description

Retrieves an array of DhWindow objects, one for each frame enclosed in this window.

DhWindow.getHashString

Syntax
final public String getHashString();
Return Value

Returns hash segment of the window's URL.

Description

Retrieves a hash string passed to the document. This is usually the string after the hash mark (#).

DhWindow.getHistoryLength

Syntax
final public int getHistoryLength();
Return Value

Returns the history length.

Description

Retrieves the number of entries in the window's history.

DhWindow.getName

Syntax
final public String getName();
Return Value

Returns the name of the window.

Description

Retrieves a string representing the name of the window.

DhWindow.getParent

Syntax
public DhWindow getParent();
Return Value

Returns the parent window of this window.

Description

Retrieves the parent of this window.

DhWindow.getPeer

Syntax
final public synchronized IUnknown getPeer();
Return Value

Returns the element peer underlying the HTML peer for this class.

Description

Retrieves the underlying HTML peer element for this class. This method returns null if the document is not bound to this class. Java code that is running in a trusted environment can freely cast the resulting reference to a specific element peer type (for example, wfc.html.om.IHTMLWindow2). This method always returns null if the code is running in a Web server environment.

Calling this method represents a very advanced usage scenario. Typically, you would never use this method.

DhWindow.getReturnValue

Syntax
final public Variant getReturnValue();
Return Value

Returns arguments passed to this dialog window through showModalDialog().

Description

Retrieves the return value from a modal dialog window.

DhWindow.getSearchString

Syntax
final public String getSearchString();
Return Value

Returns the search segment of URL of the window.

Description

Retrieves a search string passed to the document. This is usually the string after the question mark (?).

DhWindow.getUrl

Syntax
final public String getUrl();
Return Value

Returns the location URL of the window.

Description

Retrieves a string representing the URL of the window's document.

DhWindow.getWindowPeer

Syntax
protected synchronized IHTMLWindow2 getWindowPeer();
Return Value

Returns the element peer underlying the HTML peer for this class.

Description

Retrieves the underlying HTML peer element for this class. This method returns null if the document is not bound to this class. Java code that is running in a trusted environment can freely cast the resulting reference to a specific element peer type (for example, wfc.html.om.IHTMLWindow2). This method always returns null if the code is running in a Web server environment.

Calling this method represents a very advanced usage scenario. Typically, you would never use this method.

DhWindow.goBackInHistory

Syntax
final public void goBackInHistory( int delta, DhEventHandler h );
Parameters
delta
The number of pages to go back relative to the current page.
Description

Loads the previous URL in the history list.

DhWindow.goForwardInHistory

Syntax
final public void goForwardInHistory( int delta, DhEventHandler h );
Parameters
delta
The number of pages to go forward relative to the current page.
Description

Loads the next URL in the history list.

DhWindow.goRelativeInHistory

Syntax
final public void goRelativeInHistory( int delta, DhEventHandler h );
Parameters
delta
The number of pages to go back or forward relative to the current page.
Return Value

Returns a unique index representing this navigation.

Description

Loads the previous URL in the history list.

DhWindow.MessageBox

Syntax
final public void MessageBox( String s );
Parameters
s
The message to display.
Description

Displays a modal user message box.

DhWindow.navigate

Syntax
final public void navigate( String url, DhEventHandler h );
Parameters
url
A string defining the URL of the new location.
Description

Opens a new URL in this window with the specified name and properties and returns a DhWindow handle to the newly opened window.

DhWindow.open

Syntax
final public DhWindow open( String url, String name, DhWindowInfo wi, boolean fReplace );
Parameters
url
The string defining the URL of the new location.
name
The name of the window. This name cannot have spaces in it.
wi
A structure (DhWindowInfo class) defining the appearance and size of the new window.
fReplace
Set to true to replace the current contents.
Description

Opens a new URL in this window with the given name and properties and returns a DhWindow handle to the newly opened window.

DhWindow.setFocus

Syntax
final public void setFocus( boolean focus );
Parameters
focus
Set to true to set the focus; set to false to remove focus.
Description

Sets or removes the focus of the current window.

DhWindow.setName

Syntax
final public void setName( String name );
Parameters
name
The name of the window. This name cannot have punctuation in it.
Description

Sets the name of the current window.

DhWindow.setReturnValue

Syntax
final public void setReturnValue( Variant retValue );
Return Value

Returns arguments passed to this dialog through showModalDialog().

Description

Retrieves the return value from a modal dialog window.

DhWindow.setStatus

Syntax
final public void setStatus( String s );
Parameters
s
The string to display in the status bar.
Description

Displays a string in the status bar of the window host (typically the browser).

DhWindow.showModalDialog

Syntax
final public Variant showModalDialog( String dialogUrl, Variant dialogArgs, DhDialogInfo di );
Parameters
dialogUrl
A string defining the URL of the dialog window contents.
dialogArgs
Arguments to the document defining the contents.
di
A structure which defines the appearance of the dialog window.
Return Value

Returns a com.ms.com.Variant object that packages the returned values or values of the dialog window.

Description

Opens an HTML dialog window using the URL as the source of the contents and dialoginfo to define the appearance of the dialog window. It retrieves a Variant object that packages the return value or values of the dialog window.