Models

A model, put simply, is a structure that can be represented as a directed graph and has the following characteristics:

  1. it can be represented as a set of nodes N and a set of paths between nodes P
  2. it contains a set of root or start nodes R
  3. each node in N provides a means by which to access its successor nodes (i.e. the nodes to which it is connected via a path in P
  4. it provides a means by which to add new nodes or components to the set N
  5. it can be described as either top-down or bottom-up, depending upon the way in which new nodes are added to the structure

A model also has knowledge of and can report changes to its structure to interested clients (e.g. when nodes are inserted or removed from the model or properties of a node in the model change). This abstraction allows ACTF to handle a multitude of structures, whether it be a GUI component hierarchy in a Java Swing application, a hierarchy of W3C Document Object Model (DOM) nodes in an XML document, a DOM rendered within a browser, a logic circuit diagram, or Unified Modeling Language (UML) class diagram.

All of these aspects of a model are embodied in the org.eclipse.actf.model.IModel interface. The org.eclipse.actf.model.IGuiModel interface represents graphical structures that embody GUIs. The primary methods of these interfaces include:


org.eclipse.actf.model.IModel:
String getName();
int getOrder(Object);
INodeLocator getNodeLocator();
ITreeNodeWalker getTreeWalker();
void printModel(Object, Writer);
void setNodeId(Object, String);
String getNodeId(Object);
String getNodeName(Object);
String getDefaultAliasPrefix();
void addModelChangeListener(IModelChangeListener);
void removeModelChangeListener(IModelChangeListener);
String [] getPackageNames();

org.eclipse.actf.model.IGuiModel:
ModelEventTypes[] getModelEventTypes(Class);
ModelEventType getModelEventType(Object);
void registerModelEventListener(ModelEventListener, ModelEventType[]);
void unregisterModelEventListener(ModelEventListener, ModelEventType[]);
boolean isUIThread();
void invokeOnUIThread(Runnable);
void asyncInvokeOnUIThread(Runnable);
boolean isVisible(Object);
boolean isValid(Object);
boolean requestFocusFor(Object);
Rectangle getBoundingRectangle(Object);
void highlight(Object);

These methods embody the unique characteristics of a model in ACTF. Some methods in the interfaces provide for the resolution of class and method names, invoking methods on the UI thread, accessing attributes of a component, the identification of this model and a few methods for specifying other details of the model. (For more information on the IModel or IGuiModel interface and their implementing classes, refer to the API documentation for the org.eclipse.actf.model package.)

There are a number of attributes associated with models supported by ACTF. These attributes are defined in a model configuration file in the resources directories of the core plugins of ACTF. By convention, each model file is named as <model_name>.xml where <model_name> is the name of the model. For instance, the SWT model (in the ACTF Java Validation Component) has a corresponding configuration file named swt.xml. Since this represents a Java model, the file is located in the org.eclipse.actf.javaco.core plugin. Within these configuration files, attributes are organized by pool ids. Some of the pre-defined pool ids and their contents are:

aliases
alias name-value pairs
model
general properties for this model
locator
Object-method name pairs indicating how to find unique instances of this object

The ACTF supported models are installed with model configuration files with predefined values for many of these attributes.

Note: Future work will include a manner by which models can be added and extended to ACTF using the Eclipse extention mechanisms.