org.eclipse.actf.model
Interface IModel

All Known Subinterfaces:
IRenderableModel
All Known Implementing Classes:
AbstractModel, AbstractRenderableModel, DomBrowserGuiModel, DomModel, IA2GuiModel, MozillaDomBrowserGuiModel, MsaaGuiModel

public interface IModel

a model embodies any object that can be represented as a directed graph. Such a structure possesses the following characteristics:

This abstraction allows ACTF componentry to examine and manipulate structures composed of a variety of nodes and or created and assembled in a multitude of runtime platforms. Supported models are declared using the org.eclipse.actf.model.modelTypes extension point.

The IRenderableModel sub-interface is used by ACTF to examine and manipulate structures that can be rendered, like a graphical user interface (GUI) or Document Object Model (DOM) tree in a browser. Besides the properties of a general model structure, it reveals more GUI-specific behaviors and attributes.

Author:
Mike Squillace
See Also:
IRenderableModel

Method Summary
 void addModelChangeListener(IModelChangeListener listener)
          adds a listener to receive notifications when this model's structure or properties of its nodes are changed
 String getBaseType()
           
 String getDefaultAliasPrefix()
          returns the default alias prefix.
 String getName()
          return the type of the model.
 String getNodeId(Object element)
          return the id for this component.
 INodeLocator getNodeLocator()
          retrieves a locator for finding and identifying nodes in the model.
 String getNodeName(Object element)
          return the short name of this element.
 INodeWalker getNodeWalker()
          retrieve the NodeWalker for traversing elements in this model
 int getOrder(Object head)
          get the order of the graph-based model starting at the given head.
 String[] getPackageNames()
          returns an array of the names of packages to be imported by CodeProcessors.
 String getTypeName(String nodeName)
          returns the type name associated with this nodeName.
 void removeModelChangeListener(IModelChangeListener listener)
          remove the given listener from the list of listeners to be notified when this model is updated
 void setNodeID(Object comp, String id)
          set the id for a component in the model
 

Method Detail

getName

String getName()
return the type of the model. This may be one of the pre-defined constants in org.eclipse.actf.core.config.Configuration.

Returns:
name of model implemented by this model class
See Also:
IConfiguration

getOrder

int getOrder(Object head)
get the order of the graph-based model starting at the given head. The order of a graph is the number of verticies or nodes that comprise it.

Returns:
order of the subgraph

getNodeLocator

INodeLocator getNodeLocator()
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.

Returns:
node locator

getNodeWalker

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

Returns:
walker for traversing nodes in this model or null if no walker is available

setNodeID

void setNodeID(Object comp,
               String id)
set the id for a component in the model

Parameters:
comp - - component for which id is to be set
id - - id for component

getNodeId

String getNodeId(Object element)
return the id for this component. The id for a component is model-specific. For example, it may be the id attribute of an element of a model representing a structure that conforms to the W3C Document Object Model (DOM) specification or data unique to that object in some other model.

Note: This method should never return null and should always make an attempt to return a unique id that identifies this node from all other nodes in this model.

Parameters:
element - - element for which id is desired
Returns:
unique id of element

getNodeName

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.

Parameters:
element - - element for which name is desired
Returns:
name of element or null if not available

getTypeName

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.

Parameters:
nodeName - - as returned by getNodeName
Returns:
type name for the node name specified
See Also:
#getNodeName(Object)Object), getPackageNames()

getDefaultAliasPrefix

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

Returns:
alias prefix (not including trailing '.')

addModelChangeListener

void addModelChangeListener(IModelChangeListener listener)
adds a listener to receive notifications when this model's structure or properties of its nodes are changed

Parameters:
listener - - listener to be notified of updates to the model

removeModelChangeListener

void removeModelChangeListener(IModelChangeListener listener)
remove the given listener from the list of listeners to be notified when this model is updated

Parameters:
listener - - listener to be removed

getPackageNames

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').

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

getBaseType

String getBaseType()