org.eclipse.actf.model.javapp
Class AwtGuiModel

java.lang.Object
  extended by org.eclipse.actf.model.AbstractModel
      extended by org.eclipse.actf.model.AbstractGuiModel
          extended by org.eclipse.actf.model.javapp.AwtGuiModel
All Implemented Interfaces:
IGuiModel, IModel
Direct Known Subclasses:
SwingGuiModel

public class AwtGuiModel
extends AbstractGuiModel

This class embodies essential characteristics of the Java AWT model. Documents wishing to describe an AWT GUI should use the 'awt' value in the 'amodel' attribute of the root <gui> tag.

Author:
Mike Squillace

Field Summary
static String AWT_MODEL
           
 
Fields inherited from class org.eclipse.actf.model.AbstractGuiModel
eventIdMap
 
Fields inherited from class org.eclipse.actf.model.AbstractModel
baseType, configuration, locator, runtimeContext, treeNodeWalker
 
Constructor Summary
  AwtGuiModel()
          create a new AwtGuiModel
protected AwtGuiModel(String name)
           
 
Method Summary
 void asyncInvokeOnUIThread(Runnable runnable)
          asyncronously executes the given Runnable from within the UI thread.
 String[] getAlternateMethodNames(String rootName)
          alternate method names returned include: 'set' + rootName 'add' + rootName 'create' + rootName First char of rootName is converted to upper case
 String getDefaultAliasPrefix()
          returns the default alias prefix.
 String[] getPackageNames()
           Includes packages: java.lang java.awt java.awt.event
 void invokeOnUIThread(Runnable runnable)
          executes the given Runnable from within the UI thread.
 boolean isTopDown()
          return false since AWT GUIs are typically (and most effectively) bottom-up
 boolean isUIThread()
          returns whether or not the currently executing thread is the UI thread.
 boolean isVisible(Object component)
          returns whether or not the specified component is currently visible
 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.
 void setNodeID(Object comp, String id)
          set the id for a component in the hierarchy This implementation uses the setName(String) method to assign a component an id.
 
Methods inherited from class org.eclipse.actf.model.AbstractGuiModel
getBoundingRectangle, getModelEventType, getModelEventTypes, highlight, initEventIdMap, isValid, registerModelEventListener, unregisterModelEventListener
 
Methods inherited from class org.eclipse.actf.model.AbstractModel
addModelChangeListener, fireModelChangeEvent, getBaseType, getName, getNodeId, getNodeLocator, getNodeName, getOrder, getTreeWalker, removeModelChangeListener, setFilters, setModelType
 
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, getOrder, getTreeWalker, removeModelChangeListener
 

Field Detail

AWT_MODEL

public static final String AWT_MODEL
See Also:
Constant Field Values
Constructor Detail

AwtGuiModel

public AwtGuiModel()
create a new AwtGuiModel


AwtGuiModel

protected AwtGuiModel(String name)
Method Detail

getAlternateMethodNames

public String[] getAlternateMethodNames(String rootName)
alternate method names returned include:

First char of rootName is converted to upper case

Parameters:
rootName - root name of method
Returns:
list of alternate method names based upon root name

getDefaultAliasPrefix

public String getDefaultAliasPrefix()
Description copied from class: AbstractModel
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:
"java.awt"

getPackageNames

public String[] getPackageNames()

Includes packages:

Specified by:
getPackageNames in interface IModel
Overrides:
getPackageNames in class AbstractModel
Returns:
list of packages that any code processor should import
See Also:
org.eclipse.actf.core.processor.CodeProcessor

isTopDown

public boolean isTopDown()
return false since AWT GUIs are typically (and most effectively) bottom-up

Returns:
false

setNodeID

public void setNodeID(Object comp,
                      String id)
set the id for a component in the hierarchy This implementation uses the setName(String) method to assign a component an id.

Specified by:
setNodeID in interface IModel
Overrides:
setNodeID in class AbstractModel
Parameters:
comp - - component for which id is to be set
id - - id for component

isUIThread

public boolean isUIThread()
returns whether or not the currently executing thread is the UI thread. For AWT, the UI thread is the event dispatch thread.

Returns:
true if the current thread is the event dispatch thread, false otherwise
See Also:
IGuiModel.isUIThread()

isVisible

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

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

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.

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

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.

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

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 IGuiModel
Overrides:
requestFocusFor in class AbstractGuiModel
Parameters:
comp - - component for which focus is desired
Returns:
true if focus is successful, false otherwise