chrriis.dj.nativeswing.swtimpl
Class WebBrowserObject

java.lang.Object
  extended by chrriis.dj.nativeswing.swtimpl.WebBrowserObject

public abstract class WebBrowserObject
extends Object

A helper class to simplify the development of native components that leverage a web browser plugin (like the JFlashPlayer).

Author:
Christopher Deckers

Nested Class Summary
static class WebBrowserObject.ObjectHTMLConfiguration
           
 
Constructor Summary
WebBrowserObject(JWebBrowser webBrowser)
           
 
Method Summary
protected  void finalize()
           
protected  String getAdditionalHeadDefinitions()
           
static String getEmbeddedObjectJavascriptName()
           
protected  String getJavascriptDefinitions()
           
 String getLoadedResource()
           
 String getLocalFileURL(File localFile)
           
protected abstract  WebBrowserObject.ObjectHTMLConfiguration getObjectHtmlConfiguration()
           
 Object getObjectProperty(String property)
           
protected static WebServer.WebServerContent getWebServerContent(WebServer.HTTPRequest httpRequest)
           
 boolean hasContent()
           
 void invokeObjectFunction(String functionName, Object... args)
          Invoke a function on the object, with optional arguments (Strings, numbers, booleans, or array).
 Object invokeObjectFunctionWithResult(String functionName, Object... args)
          Invoke a function on the object and waits for a result, with optional arguments (Strings, numbers, booleans, or array).
 void load(String resourcePath)
           
 void setBackground(Color background)
          Set the background color of the object, which by default is the color of the native component.
 void setObjectProperty(String property, Object value)
          Set the value of a property of the object (a String, number, boolean, or array).
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WebBrowserObject

public WebBrowserObject(JWebBrowser webBrowser)
Method Detail

getLoadedResource

public String getLoadedResource()

hasContent

public boolean hasContent()

finalize

protected void finalize()
                 throws Throwable
Overrides:
finalize in class Object
Throws:
Throwable

load

public void load(String resourcePath)

getLocalFileURL

public String getLocalFileURL(File localFile)

getEmbeddedObjectJavascriptName

public static String getEmbeddedObjectJavascriptName()

getWebServerContent

protected static WebServer.WebServerContent getWebServerContent(WebServer.HTTPRequest httpRequest)

getObjectHtmlConfiguration

protected abstract WebBrowserObject.ObjectHTMLConfiguration getObjectHtmlConfiguration()

getJavascriptDefinitions

protected String getJavascriptDefinitions()

getAdditionalHeadDefinitions

protected String getAdditionalHeadDefinitions()

setObjectProperty

public void setObjectProperty(String property,
                              Object value)
Set the value of a property of the object (a String, number, boolean, or array).


getObjectProperty

public Object getObjectProperty(String property)
Returns:
The value, potentially a String, Number, boolean.

invokeObjectFunction

public void invokeObjectFunction(String functionName,
                                 Object... args)
Invoke a function on the object, with optional arguments (Strings, numbers, booleans, or array).


invokeObjectFunctionWithResult

public Object invokeObjectFunctionWithResult(String functionName,
                                             Object... args)
Invoke a function on the object and waits for a result, with optional arguments (Strings, numbers, booleans, or array).

Returns:
The value, potentially a String, Number, boolean.

setBackground

public void setBackground(Color background)
Set the background color of the object, which by default is the color of the native component.

Parameters:
background - The background to set.