org.eclipse.actf.model.mozdom
Class DomBrowserGuiModel

java.lang.Object
  extended by org.eclipse.actf.model.AbstractModel
      extended by org.eclipse.actf.model.AbstractRenderableModel
          extended by org.eclipse.actf.model.mozdom.DomBrowserGuiModel
All Implemented Interfaces:
IModel, IRenderableModel
Direct Known Subclasses:
MozillaDomBrowserGuiModel

public abstract class DomBrowserGuiModel
extends AbstractRenderableModel

implementation for an embedded browser widget. The widget is assumed to extend org.eclipse.swt.widgets.Composite and the DOM exposed by this widget is assumed to implement the W3C HTML 4.01 DOM specification.

Author:
Mike Squillace
See Also:
HTML DOM specification

Field Summary
protected static List BASE_ELEMENT_TAGNAMES
           
protected static String[] PACKAGE_LIST
           
 
Fields inherited from class org.eclipse.actf.model.AbstractRenderableModel
eventIdMap
 
Fields inherited from class org.eclipse.actf.model.AbstractModel
baseType, configuration, locator, nodeToTypeNameMap, runtimeContext, treeNodeWalker
 
Constructor Summary
DomBrowserGuiModel(String type)
           
 
Method Summary
 void asyncInvokeOnUIThread(Runnable runnable)
          asyncronously executes the given Runnable from within the UI thread. uses org.eclipse.swt.widgets.Display methods
 String getDefaultAliasPrefix()
          returns the default alias prefix. The default alias prefix (usually a package name) is used when a fully-qualified name is not used in the 'value' attribute of an <alias> tag
protected  String getDomTypesPackage()
           
 String[] getPackageNames()
          returns an array of the names of packages to be imported by CodeProcessors. Includes packages: java.lang org.w3c.dom org.w3c.dom.html
 String getTypeName(String nodeName)
          returns the type name associated with this nodeName. The nodeName parameter is most frequently formed by calling getNodeName. The name returned identifies the type that is represented by this node name in the graph.

If the specified nodeName was not obtained from getNodeName, then implementers should make a rough guess regarding the underlying type on the basis of the package names associated with this model via getPackageNames.

returns the original class name from which this node name was derived or, if unsuccessful, tries to form the correct class based on the package names associated with this implementation
protected  String getTypeNamePrefix()
           
protected  String getTypeNameSuffix()
           
 Object invokeGetter(Object obj, String name)
          invoke the getter method on the specified object.
 Object invokeGetter(Object obj, String name, Object arg)
          invoke the specified getter method on the given object, passing it the single parameter.
 void invokeOnUIThread(Runnable runnable)
          executes the given Runnable from within the UI thread. uses org.eclipse.swt.widgets.Display methods
 boolean isUIThread()
          returns whether or not the currently executing thread is the UI thread. uses org.eclipse.swt.widgets.Display methods
 String tagNameToTypeName(String tagName)
          get the DOM class/interface type name for the given HTML tag name
 
Methods inherited from class org.eclipse.actf.model.AbstractRenderableModel
getBoundingRectangle, getModelEventType, getModelEventTypes, highlight, initEventIdMap, initEventIdMap, isValid, isVisible, registerModelEventListener, registerModelEventListener, requestFocusFor, unregisterModelEventListener
 
Methods inherited from class org.eclipse.actf.model.AbstractModel
addModelChangeListener, fireModelChangeEvent, getBaseType, getName, getNodeId, getNodeLocator, getNodeName, getNodeWalker, getOrder, removeModelChangeListener, setFilters, setModelType, setNodeID
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.actf.model.IModel
addModelChangeListener, getBaseType, getName, getNodeId, getNodeLocator, getNodeName, getNodeWalker, getOrder, removeModelChangeListener, setNodeID
 

Field Detail

PACKAGE_LIST

protected static String[] PACKAGE_LIST

BASE_ELEMENT_TAGNAMES

protected static List BASE_ELEMENT_TAGNAMES
Constructor Detail

DomBrowserGuiModel

public DomBrowserGuiModel(String type)
Method Detail

getDefaultAliasPrefix

public String getDefaultAliasPrefix()
returns the default alias prefix. The default alias prefix (usually a package name) is used when a fully-qualified name is not used in the 'value' attribute of an <alias> tag

Specified by:
getDefaultAliasPrefix in interface IModel
Overrides:
getDefaultAliasPrefix in class AbstractModel
Returns:
alias prefix (not including trailing '.')

getPackageNames

public String[] getPackageNames()
returns an array of the names of packages to be imported by CodeProcessors. Any CodeProcessor used in the context of an IModel will, upon its instantiation and initialization, import the list of packages and make their traditional short-forms available. (Of course, short-forms are language-dependent.) Each element of the array is only a name for a package (e.g. 'my.java.package').

Includes packages:

Returns:
array of names of packages to be imported by a CodeProcessor or an array of length 0 for no imports

isUIThread

public boolean isUIThread()
returns whether or not the currently executing thread is the UI thread. The UI thread is the thread upon which actions effecting the state or drawing of a component or the event handlers associated with a component are to be executed. If this method returns false, the client will typically need to invoke the invokeOnUIThread method in order to effect the GUI.

uses org.eclipse.swt.widgets.Display methods

Returns:
true if the current thread is the UI thread, false otherwise
See Also:
IRenderableModel.invokeOnUIThread(Runnable)

invokeOnUIThread

public void invokeOnUIThread(Runnable runnable)
executes the given Runnable from within the UI thread. This method will typically be called if isUIThread returns false.

uses org.eclipse.swt.widgets.Display methods

Parameters:
runnable - - Runnable to be invoked in UI thread
See Also:
IRenderableModel.isUIThread()

asyncInvokeOnUIThread

public void asyncInvokeOnUIThread(Runnable runnable)
asyncronously executes the given Runnable from within the UI thread. That is, the Runnable is placed in a queue and control is returned immediately to the calling thread.

uses org.eclipse.swt.widgets.Display methods

Parameters:
runnable - - Runnable to be invoked in UI thread
See Also:
IRenderableModel.invokeOnUIThread(Runnable)

invokeGetter

public Object invokeGetter(Object obj,
                           String name)
                    throws Exception
invoke the getter method on the specified object. The method name must name a method that has no formal parameters.

Note: If the specified method is found and returns a boolean, then an unsuccessful invocation will result in a return value of false.

Parameters:
obj - - receiver
name - - method name
Returns:
result of invocation
Throws:
Exception

invokeGetter

public Object invokeGetter(Object obj,
                           String name,
                           Object arg)
                    throws Exception
invoke the specified getter method on the given object, passing it the single parameter.

Note: If the specified method is found and returns a boolean, then an unsuccessful invocation will result in a return value of false. *

Parameters:
obj - - the receiver
name - - the method name
arg - - single argument to method
Returns:
result of invokation
Throws:
Exception

getDomTypesPackage

protected String getDomTypesPackage()

getTypeNamePrefix

protected String getTypeNamePrefix()

getTypeNameSuffix

protected String getTypeNameSuffix()

tagNameToTypeName

public String tagNameToTypeName(String tagName)
get the DOM class/interface type name for the given HTML tag name

Parameters:
tagName - HTML 4.01 tag name
Returns:
type name corresponding to given tag name

getTypeName

public String getTypeName(String nodeName)
returns the type name associated with this nodeName. The nodeName parameter is most frequently formed by calling getNodeName. The name returned identifies the type that is represented by this node name in the graph.

If the specified nodeName was not obtained from getNodeName, then implementers should make a rough guess regarding the underlying type on the basis of the package names associated with this model via getPackageNames.

returns the original class name from which this node name was derived or, if unsuccessful, tries to form the correct class based on the package names associated with this implementation

Specified by:
getTypeName in interface IModel
Overrides:
getTypeName in class AbstractModel
Parameters:
nodeName - - as returned by getNodeName
Returns:
type name for the node name specified
See Also:
#getNodeName(Object)Object), IModel.getPackageNames()