com.gargoylesoftware.htmlunit.javascript.background
Class BackgroundJavaScriptFactory

java.lang.Object
  extended by com.gargoylesoftware.htmlunit.javascript.background.BackgroundJavaScriptFactory

public class BackgroundJavaScriptFactory
extends Object

A factory for all the things we have to construct from outside of the JavaScript engine.

Version:
$Revision: 8931 $
Author:
Ronald Brill

Constructor Summary
protected BackgroundJavaScriptFactory()
          The constructor.
 
Method Summary
 JavaScriptJob createDownloadBehaviorJob(URL url, net.sourceforge.htmlunit.corejs.javascript.Function callback, WebClient client)
          Creates a new instance.
 JavaScriptExecutor createJavaScriptExecutor(WebClient webClient)
          Creates the JavaScriptExecutor that will be used to handle JS.
 JavaScriptJob createJavaScriptJob(int initialDelay, Integer period, Runnable runnable)
          Creates a new job.
 com.gargoylesoftware.htmlunit.javascript.background.JavaScriptFunctionJob createJavaScriptJob(int initialDelay, Integer period, String label, WebWindow window, net.sourceforge.htmlunit.corejs.javascript.Function function)
          Creates a new JavaScript execution job, where the JavaScript code to execute is a function.
 JavaScriptJob createJavaScriptJob(int initialDelay, Integer period, String label, WebWindow window, String script)
          Creates a new JavaScript execution job, where the JavaScript code to execute is a string.
 JavaScriptJobManager createJavaScriptJobManager(WebWindow webWindow)
          Creates a new JavaScriptJobManager for the given window.
 JavaScriptJob createJavascriptXMLHttpRequestJob(net.sourceforge.htmlunit.corejs.javascript.ContextFactory contextFactory, net.sourceforge.htmlunit.corejs.javascript.ContextAction action)
          Creates a new job for XMLHttpRequestProcessing.
static void setFactory(BackgroundJavaScriptFactory factory)
          Set the factory to a new one.
static BackgroundJavaScriptFactory theFactory()
          Returns the current factory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BackgroundJavaScriptFactory

protected BackgroundJavaScriptFactory()
The constructor.

Method Detail

theFactory

public static BackgroundJavaScriptFactory theFactory()
Returns the current factory.

Returns:
the active factory

setFactory

public static void setFactory(BackgroundJavaScriptFactory factory)
Set the factory to a new one.

Parameters:
factory - the new factory.

createJavaScriptJob

public JavaScriptJob createJavaScriptJob(int initialDelay,
                                         Integer period,
                                         String label,
                                         WebWindow window,
                                         String script)
Creates a new JavaScript execution job, where the JavaScript code to execute is a string.

Parameters:
initialDelay - the initial amount of time to wait before executing this job
period - the amount of time to wait between executions of this job (may be null)
label - the label for the job
window - the window to which the job belongs
script - the JavaScript code to execute
Returns:
JavaScriptJob the created job

createJavaScriptJob

public com.gargoylesoftware.htmlunit.javascript.background.JavaScriptFunctionJob createJavaScriptJob(int initialDelay,
                                                                                                     Integer period,
                                                                                                     String label,
                                                                                                     WebWindow window,
                                                                                                     net.sourceforge.htmlunit.corejs.javascript.Function function)
Creates a new JavaScript execution job, where the JavaScript code to execute is a function.

Parameters:
initialDelay - the initial amount of time to wait before executing this job
period - the amount of time to wait between executions of this job (may be null)
label - the label for the job
window - the window to which the job belongs
function - the JavaScript code to execute
Returns:
JavaScriptJob the created job

createJavascriptXMLHttpRequestJob

public JavaScriptJob createJavascriptXMLHttpRequestJob(net.sourceforge.htmlunit.corejs.javascript.ContextFactory contextFactory,
                                                       net.sourceforge.htmlunit.corejs.javascript.ContextAction action)
Creates a new job for XMLHttpRequestProcessing.

Parameters:
contextFactory - the ContextFactory
action - the action
Returns:
JavaScriptJob the created job

createJavaScriptJob

public JavaScriptJob createJavaScriptJob(int initialDelay,
                                         Integer period,
                                         Runnable runnable)
Creates a new job.

Parameters:
initialDelay - the initial amount of time to wait before executing this job
period - the amount of time to wait between executions of this job (may be null)
runnable - the runnable to run
Returns:
JavaScriptJob the created job

createDownloadBehaviorJob

public JavaScriptJob createDownloadBehaviorJob(URL url,
                                               net.sourceforge.htmlunit.corejs.javascript.Function callback,
                                               WebClient client)
Creates a new instance.

Parameters:
url - the URL to download
callback - the callback function to call
client - the web client this if for
Returns:
JavaScriptJob the created job

createJavaScriptExecutor

public JavaScriptExecutor createJavaScriptExecutor(WebClient webClient)
Creates the JavaScriptExecutor that will be used to handle JS.

Parameters:
webClient - the WebClient of the executor
Returns:
the executor.

createJavaScriptJobManager

public JavaScriptJobManager createJavaScriptJobManager(WebWindow webWindow)
Creates a new JavaScriptJobManager for the given window.

Parameters:
webWindow - the window the JavaScriptJobManager will work for
Returns:
the new JavaScriptJobManager


Copyright © 2002–2014 Gargoyle Software Inc.. All rights reserved.