org.mozilla.mcp
Class MCP

java.lang.Object
  extended by org.mozilla.mcp.MCP

public class MCP
extends java.lang.Object

The main class for the Mozilla Control Program. Please see the package description for an overview.

Author:
edburns

Constructor Summary
MCP()
          Creates a new instance of MCP
 
Method Summary
 void addAjaxListener(AjaxListener listener)
          Add the argument AjaxListener to this MCP instance.
 void addKeyListener(java.awt.event.KeyListener listener)
          Add the argument KeyListener to the Canvas for this MCP instance.
 void addMouseListener(java.awt.event.MouseListener listener)
          Add the argument MouseListener to the Canvas for this MCP instance.
 void blockingClickElement(java.lang.String idOrName)
          Find the DOM element within the current page matching the argument id using findElement(java.lang.String).
 void blockingLoad(java.lang.String url)
          Load the url, blocking until the load has completed.
 void clickElement(java.lang.String id)
          Find the DOM element within the current page matching the argument id using findElement(java.lang.String).
 void deleteBrowserControl()
          Make invisible, and delete the BrowserControl instance for this MCP instance.
 org.w3c.dom.Element findElement(java.lang.String id)
          Return the DOM Element with the given id or name.
 boolean findInPage(java.lang.String toFind)
          Return true if and only if the argument toFind occurs within the current page.
 BrowserControl getBrowserControl()
          Return the Webclient BrowserControl instance used by this MCP instance.
 java.awt.Frame getRealizedVisibleBrowserWindow()
          Return the realized and visible java.awt.Frame containing the actual browser window.
 void removeAjaxListener(AjaxListener listener)
          Remove the argument AjaxListener to this MCP instance.
 void removeKeyListener(java.awt.event.KeyListener listener)
          Remove the argument KeyListener from the Canvas for this MCP instance.
 void removeMouseListener(java.awt.event.MouseListener listener)
          Remove the argument MouseListener from the Canvas for this MCP instance.
 void setAppData(java.lang.String absolutePathToNativeBrowserBinDir)
           
 void setBounds(int x, int y, int width, int height)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MCP

public MCP()
Creates a new instance of MCP

Method Detail

setAppData

public void setAppData(java.lang.String absolutePathToNativeBrowserBinDir)
                throws java.io.FileNotFoundException,
                       java.lang.ClassNotFoundException
Throws:
java.io.FileNotFoundException
java.lang.ClassNotFoundException

setBounds

public void setBounds(int x,
                      int y,
                      int width,
                      int height)

addAjaxListener

public void addAjaxListener(AjaxListener listener)

Add the argument AjaxListener to this MCP instance.


removeAjaxListener

public void removeAjaxListener(AjaxListener listener)

Remove the argument AjaxListener to this MCP instance.


addMouseListener

public void addMouseListener(java.awt.event.MouseListener listener)

Add the argument MouseListener to the Canvas for this MCP instance.


removeMouseListener

public void removeMouseListener(java.awt.event.MouseListener listener)

Remove the argument MouseListener from the Canvas for this MCP instance.


addKeyListener

public void addKeyListener(java.awt.event.KeyListener listener)

Add the argument KeyListener to the Canvas for this MCP instance.


removeKeyListener

public void removeKeyListener(java.awt.event.KeyListener listener)

Remove the argument KeyListener from the Canvas for this MCP instance.


getBrowserControl

public BrowserControl getBrowserControl()

Return the Webclient BrowserControl instance used by this MCP instance. This is useful for operations that require more complex browser control than that offered by MCP.


getRealizedVisibleBrowserWindow

public java.awt.Frame getRealizedVisibleBrowserWindow()

Return the realized and visible java.awt.Frame containing the actual browser window. There is no need to put this Frame inside of any surrounding Swing or AWT windows. It is sufficient to stand alone.


deleteBrowserControl

public void deleteBrowserControl()

Make invisible, and delete the BrowserControl instance for this MCP instance. Reset internal state of the instance so that a subsequent call to getRealizedVisibleBrowserWindow() will create a new Frame.


findElement

public org.w3c.dom.Element findElement(java.lang.String id)

Return the DOM Element with the given id or name. First, Document.getElementById() is called, passing the argument id. If an element is found, it is returned. Otherwise, the document is traversed and the first element encountered with a name equal to the argument id is returned. If no such element exists, null is returned.


findInPage

public boolean findInPage(java.lang.String toFind)

Return true if and only if the argument toFind occurs within the current page. Case is not significant. Users desiring more detailed find behavior should use getBrowserControl() to obtain a reference to the CurrentPage interface, which has more advanced methods pertaining to the current page.


clickElement

public void clickElement(java.lang.String id)

Find the DOM element within the current page matching the argument id using findElement(java.lang.String). Use java.awt.Robot to click the element. Return immediately after clicking the element.


blockingClickElement

public void blockingClickElement(java.lang.String idOrName)

Find the DOM element within the current page matching the argument id using findElement(java.lang.String). Use java.awt.Robot to click the element. Block until the document load triggered by the click has completed.


blockingLoad

public void blockingLoad(java.lang.String url)

Load the url, blocking until the load has completed.



Copyright © 2002-2007 Mozilla.org All Rights Reserved.