org.eclipse.actf.model.mozdom
Class MozillaDomBrowserGuiModel

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
              extended by org.eclipse.actf.model.mozdom.MozillaDomBrowserGuiModel
All Implemented Interfaces:
IModel, IRenderableModel

public class MozillaDomBrowserGuiModel
extends DomBrowserGuiModel

implementation for the Mozilla DOM browser.

Author:
Mike Squillace

Field Summary
static String EVENT_DOM_ACTIVATE
           
static String EVENT_DOM_ATTRMODIFIED
           
static String EVENT_DOM_CHARDATAMODIFIED
           
static String EVENT_DOM_FOCUSIN
           
static String EVENT_DOM_FOCUSOUT
           
static String EVENT_DOM_MOUSECLICK
           
static String EVENT_DOM_MOUSEDOWN
           
static String EVENT_DOM_MOUSEMOVE
           
static String EVENT_DOM_MOUSEOUT
           
static String EVENT_DOM_MOUSEOVER
           
static String EVENT_DOM_MOUSEUP
           
static String EVENT_DOM_NODEINSERTED
           
static String EVENT_DOM_NODEINSERTEDINTODOC
           
static String EVENT_DOM_NODEREMOVED
           
static String EVENT_DOM_NODEREMOVEDFROMDOC
           
static String EVENT_DOM_SUBTREEMODIFIED
           
static String MOZDOM_ADAPTOR_CLASS
           
static String MOZDOM_MODEL
           
protected static String[] PACKAGE_LIST
           
 
Fields inherited from class org.eclipse.actf.model.mozdom.DomBrowserGuiModel
BASE_ELEMENT_TAGNAMES
 
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
MozillaDomBrowserGuiModel()
           
 
Method Summary
 Rectangle getBoundingRectangle(Object element)
          gets the rectangle bounding the given element default implementation returns null
 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 getIIDForTagName(String tagName)
           
 ModelEventType getModelEventType(Object eventId)
          get the ModelEventType instances associated with the given event id.
 ModelEventType[] getModelEventTypes(Class c)
          get the model event types for the given source type. default implementation returns null
 INodeLocator getNodeLocator()
          retrieves a locator for finding and identifying nodes in the model.
 String getNodeName(Object element)
          return the short name of this element. The id for an element is model-specific. For example, it may be the tag name of an element of a model representing a structure that conforms to W3the C DOM specification or the simple class name of the object. returns the qualified class name (i.e. without the package name) of the given element returns the tag name for the given HTML element (e.g. anchor, input)
 INodeWalker getNodeWalker()
          retrieve the NodeWalker for traversing elements in this model
 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:

  • java.lang
  • org.w3c.dom
  • org.w3c.dom.html
Includes packages: java.lang org.mozilla.interfaces
protected  String getTypeNamePrefix()
           
protected  String getTypeNameSuffix()
           
 void highlight(Object element)
          highlight or visually indicate the element that is being examined.
protected  void initEventIdMap()
          used to initialize the eventId map, which is keyed by eventId that corresponds to a ModelEventType instance.
 boolean isGuiRootType(Class c)
          
 boolean isVisible(Object comp)
          returns whether or not the specified component is currently visible
 void registerModelEventListener(IModelEventListener listener, ModelEventType[] eventTypes)
          register a listener to receive notification when events with the given eventTypes are fired within this model. equivalent to calling registerModelEventListener(listener, eventTypes, null)
 void registerModelEventListener(IModelEventListener listener, ModelEventType[] eventTypes, Object[] params)
          register a listener to receive notification when events with the given eventTypes are fired within this model.
 boolean requestFocusFor(Object comp)
          request the focus for the specified component. This method should be invoked, for example, just prior to validation for a report that reflects the state of the component while visible.
 String tagNameToTypeName(String tagName)
          get the DOM class/interface type name for the given HTML tag name cache the infor so we only need to build it once
 void unregisterModelEventListener(IModelEventListener listener, ModelEventType[] eventTypes)
          unregister a previously registered listener.
 
Methods inherited from class org.eclipse.actf.model.mozdom.DomBrowserGuiModel
asyncInvokeOnUIThread, getTypeName, invokeGetter, invokeGetter, invokeOnUIThread, isUIThread
 
Methods inherited from class org.eclipse.actf.model.AbstractRenderableModel
initEventIdMap, isValid
 
Methods inherited from class org.eclipse.actf.model.AbstractModel
addModelChangeListener, fireModelChangeEvent, getBaseType, getName, getNodeId, 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, getOrder, removeModelChangeListener, setNodeID
 

Field Detail

MOZDOM_MODEL

public static final String MOZDOM_MODEL
See Also:
Constant Field Values

MOZDOM_ADAPTOR_CLASS

public static final String MOZDOM_ADAPTOR_CLASS
See Also:
Constant Field Values

EVENT_DOM_FOCUSIN

public static final String EVENT_DOM_FOCUSIN
See Also:
Constant Field Values

EVENT_DOM_FOCUSOUT

public static final String EVENT_DOM_FOCUSOUT
See Also:
Constant Field Values

EVENT_DOM_ACTIVATE

public static final String EVENT_DOM_ACTIVATE
See Also:
Constant Field Values

EVENT_DOM_MOUSECLICK

public static final String EVENT_DOM_MOUSECLICK
See Also:
Constant Field Values

EVENT_DOM_MOUSEUP

public static final String EVENT_DOM_MOUSEUP
See Also:
Constant Field Values

EVENT_DOM_MOUSEDOWN

public static final String EVENT_DOM_MOUSEDOWN
See Also:
Constant Field Values

EVENT_DOM_MOUSEOVER

public static final String EVENT_DOM_MOUSEOVER
See Also:
Constant Field Values

EVENT_DOM_MOUSEOUT

public static final String EVENT_DOM_MOUSEOUT
See Also:
Constant Field Values

EVENT_DOM_MOUSEMOVE

public static final String EVENT_DOM_MOUSEMOVE
See Also:
Constant Field Values

EVENT_DOM_SUBTREEMODIFIED

public static final String EVENT_DOM_SUBTREEMODIFIED
See Also:
Constant Field Values

EVENT_DOM_NODEINSERTED

public static final String EVENT_DOM_NODEINSERTED
See Also:
Constant Field Values

EVENT_DOM_NODEINSERTEDINTODOC

public static final String EVENT_DOM_NODEINSERTEDINTODOC
See Also:
Constant Field Values

EVENT_DOM_NODEREMOVED

public static final String EVENT_DOM_NODEREMOVED
See Also:
Constant Field Values

EVENT_DOM_NODEREMOVEDFROMDOC

public static final String EVENT_DOM_NODEREMOVEDFROMDOC
See Also:
Constant Field Values

EVENT_DOM_ATTRMODIFIED

public static final String EVENT_DOM_ATTRMODIFIED
See Also:
Constant Field Values

EVENT_DOM_CHARDATAMODIFIED

public static final String EVENT_DOM_CHARDATAMODIFIED
See Also:
Constant Field Values

PACKAGE_LIST

protected static String[] PACKAGE_LIST
Constructor Detail

MozillaDomBrowserGuiModel

public MozillaDomBrowserGuiModel()
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 DomBrowserGuiModel
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:

Includes packages:

Specified by:
getPackageNames in interface IModel
Overrides:
getPackageNames in class DomBrowserGuiModel
Returns:
array of names of packages to be imported by a CodeProcessor or an array of length 0 for no imports

isVisible

public boolean isVisible(Object comp)
returns whether or not the specified component is currently visible

Specified by:
isVisible in interface IRenderableModel
Overrides:
isVisible in class AbstractRenderableModel
Parameters:
comp - - component to be tested
Returns:
whether or not the component is currently visible or showing on the screen

requestFocusFor

public boolean requestFocusFor(Object comp)
request the focus for the specified component. This method should be invoked, for example, just prior to validation for a report that reflects the state of the component while visible.

Specified by:
requestFocusFor in interface IRenderableModel
Overrides:
requestFocusFor in class AbstractRenderableModel
Parameters:
comp - - component for which focus is desired
Returns:
true if focus is successful, false otherwise

isGuiRootType

public boolean isGuiRootType(Class c)


getDomTypesPackage

protected String getDomTypesPackage()
Overrides:
getDomTypesPackage in class DomBrowserGuiModel

getTypeNamePrefix

protected String getTypeNamePrefix()
Overrides:
getTypeNamePrefix in class DomBrowserGuiModel

getTypeNameSuffix

protected String getTypeNameSuffix()
Overrides:
getTypeNameSuffix in class DomBrowserGuiModel

getNodeName

public String getNodeName(Object element)
return the short name of this element. The id for an element is model-specific. For example, it may be the tag name of an element of a model representing a structure that conforms to W3the C DOM specification or the simple class name of the object. returns the qualified class name (i.e. without the package name) of the given element returns the tag name for the given HTML element (e.g. anchor, input)

Specified by:
getNodeName in interface IModel
Overrides:
getNodeName in class AbstractModel
Parameters:
element - - element for which name is desired
Returns:
name of element or null if not available

getIIDForTagName

public String getIIDForTagName(String tagName)

tagNameToTypeName

public String tagNameToTypeName(String tagName)
get the DOM class/interface type name for the given HTML tag name cache the infor so we only need to build it once

Overrides:
tagNameToTypeName in class DomBrowserGuiModel
Parameters:
tagName - HTML 4.01 tag name
Returns:
type name corresponding to given tag name

initEventIdMap

protected void initEventIdMap()
Description copied from class: AbstractRenderableModel
used to initialize the eventId map, which is keyed by eventId that corresponds to a ModelEventType instance. Event ids are model-specific and typically defined as part of that model's definition.

Overrides:
initEventIdMap in class AbstractRenderableModel
See Also:
ModelEventType, AbstractRenderableModel.registerModelEventListener(IModelEventListener, ModelEventType[])

unregisterModelEventListener

public void unregisterModelEventListener(IModelEventListener listener,
                                         ModelEventType[] eventTypes)
Description copied from interface: IRenderableModel
unregister a previously registered listener. The eventTypes should be obtained from either of the getModelEventTypes methods.

Specified by:
unregisterModelEventListener in interface IRenderableModel
Overrides:
unregisterModelEventListener in class AbstractRenderableModel
Parameters:
listener - listener to be unregistered
eventTypes - event types for which listener is to be unregistered
See Also:
IRenderableModel.registerModelEventListener(IModelEventListener, ModelEventType[]), ModelEventType

getModelEventTypes

public ModelEventType[] getModelEventTypes(Class c)
Description copied from class: AbstractRenderableModel
get the model event types for the given source type. A ModelEventType object describes the types of events that can be fired within the context of this runtime model. If the sourceType is null, then all of the event types of which this model is aware will be returned else only events that can be fired by the given sourceType will be returned. default implementation returns null

Specified by:
getModelEventTypes in interface IRenderableModel
Overrides:
getModelEventTypes in class AbstractRenderableModel
Parameters:
c - type to be queried for events
Returns:
all events that can be fired by instances of the given type or all events of which this model is aware
See Also:
ModelEventType

getModelEventType

public ModelEventType getModelEventType(Object eventId)
Description copied from class: AbstractRenderableModel
get the ModelEventType instances associated with the given event id. The event id is model-specific and will usually be presented in the model's API. What constitutes an event id and how they are determined should be specified in clients that implement this model.

Specified by:
getModelEventType in interface IRenderableModel
Overrides:
getModelEventType in class AbstractRenderableModel
Parameters:
eventId - model-specific event id
Returns:
ModelEventType instances associated with this event id or null if no event types are associated with this id

getNodeWalker

public INodeWalker getNodeWalker()
retrieve the NodeWalker for traversing elements in this model

Specified by:
getNodeWalker in interface IModel
Overrides:
getNodeWalker in class AbstractModel
Returns:
walker for traversing nodes in this model or null if no walker is available

getBoundingRectangle

public Rectangle getBoundingRectangle(Object element)
Description copied from class: AbstractRenderableModel
gets the rectangle bounding the given element default implementation returns null

Specified by:
getBoundingRectangle in interface IRenderableModel
Overrides:
getBoundingRectangle in class AbstractRenderableModel
Parameters:
element - - element for which bounds are desired
Returns:
bounding rectangle of component

highlight

public void highlight(Object element)
Description copied from class: AbstractRenderableModel
highlight or visually indicate the element that is being examined. Highlighting may take place by placing a border around the element, flashing the element, or changing its background color.

Specified by:
highlight in interface IRenderableModel
Overrides:
highlight in class AbstractRenderableModel
Parameters:
element - - the element to be highlited

getNodeLocator

public INodeLocator getNodeLocator()
Description copied from class: AbstractModel
retrieves a locator for finding and identifying nodes in the model. The locator can provide an XPath expression that describes a node in the model or, given a valid XPath expression, find an object in the model.

Specified by:
getNodeLocator in interface IModel
Overrides:
getNodeLocator in class AbstractModel
Returns:
node locator

registerModelEventListener

public void registerModelEventListener(IModelEventListener listener,
                                       ModelEventType[] eventTypes)
Description copied from class: AbstractRenderableModel
register a listener to receive notification when events with the given eventTypes are fired within this model. The eventTypes should be obtained from one of the getModelEventTypes methods. equivalent to calling registerModelEventListener(listener, eventTypes, null)

Specified by:
registerModelEventListener in interface IRenderableModel
Overrides:
registerModelEventListener in class AbstractRenderableModel
Parameters:
listener - listener to be notified when specified events occur
eventTypes - event types for which listener is being registered
See Also:
IRenderableModel.getModelEventType(Object), IRenderableModel.getModelEventTypes(Class)

registerModelEventListener

public void registerModelEventListener(IModelEventListener listener,
                                       ModelEventType[] eventTypes,
                                       Object[] params)
Description copied from class: AbstractRenderableModel
register a listener to receive notification when events with the given eventTypes are fired within this model. The eventTypes should be obtained from one of the getModelEventTypes methods. Optional parameters can also be passed to facilitate additional side effects or for additional information about the context in which events are being fired.

Specified by:
registerModelEventListener in interface IRenderableModel
Overrides:
registerModelEventListener in class AbstractRenderableModel
Parameters:
listener - listener to be notified when specified events occur
eventTypes - event types for which listener is being registered
params - - additional parameters (may be null)
See Also:
IRenderableModel.getModelEventType(Object), IRenderableModel.getModelEventTypes(Class)