org.eclipse.actf.validation.core
Class FocusValidationProcess

java.lang.Object
  extended by java.util.Observable
      extended by org.eclipse.actf.validation.core.AbstractValidationProcess
          extended by org.eclipse.actf.validation.core.FocusValidationProcess
All Implemented Interfaces:
IValidationProcess

public class FocusValidationProcess
extends AbstractValidationProcess

FocusValidationProcess handles all focus validation processes.

Author:
John Buslawski

Field Summary
 
Fields inherited from class org.eclipse.actf.validation.core.AbstractValidationProcess
context, contextCache, execPoint, lastNotification, notificationIncrement, notificationPercent, progress, ruleBase, workEstimate
 
Constructor Summary
protected FocusValidationProcess()
           
  FocusValidationProcess(IRuleBase iRuleBase, ExecutionPoint execPoint, IValidationContext context)
           
 
Method Summary
 void cacheControlList(Composite composite, List ctrlList)
           
protected  void calculateWork(ExecutionPoint execPoint, IRuleBase iRuleBase, IValidationContext context)
          visit the objects in the tree with the given target as the root.
 IValidationContext cloneContext(IRuleBase iRuleBase, IValidationContext context)
           
 boolean computeKeyboardTraversalList(Object target)
           
 void getArrowTraversables(Control ctrl, List ctrlList)
           
protected  Control[] getChildren(Control control, IGuiModel model)
           
protected  boolean getEnabled(Control control, IGuiModel model)
           
protected  Control getFocusControl(Control control, IGuiModel model)
           
protected  int getStyle(Control control, IGuiModel model)
           
 void init()
          perform any initialization necessary for the process.
 boolean isArrowTraversable(Control control, IGuiModel model)
           
 boolean isControlInFocusableList(Control ctrl)
           
 boolean isNonfocusableControl(Control ctrl)
           
 boolean listContainsString(String str, List strList)
           
protected  boolean pathMatchesExpression(Object target, String regexp)
          used by child classes within the model to determine if their path matches a reqular expression that identifies a rule base.
 void run()
          launch the validation process
protected  boolean setFocus(Control control, IGuiModel model)
           
protected  boolean traverse(Control control, IGuiModel model, int traversal)
           
 void validate(ExecutionPoint execPoint, IRuleBase iRuleBase, IValidationContext context)
          validate the objects in the tree with the given target as the root.
protected  void validateChildren(Object target, ExecutionPoint execPoint, IRuleBase iRuleBase, IValidationContext context, boolean validate)
          Validate the child components of the given target.
 void validateComponent(Object target, ExecutionPoint execPoint, IRuleBase iRuleBase, IValidationContext context)
          used to validate single components.
protected  void visitComponent(Object target, ExecutionPoint execPoint, IRuleBase iRuleBase, IValidationContext context)
          used to visit a single component.
 
Methods inherited from class org.eclipse.actf.validation.core.AbstractValidationProcess
getExecutionPoint, getNotificationPercent, getProgress, getRuleBase, getValidationContext, getWorkEstimate, incrementProgress, initProgressEstimates, isTerminated, resetProgress, setExecutionPoint, setNotificationPercent, setProgress, setRuleBase, setValidationContext
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FocusValidationProcess

public FocusValidationProcess(IRuleBase iRuleBase,
                              ExecutionPoint execPoint,
                              IValidationContext context)

FocusValidationProcess

protected FocusValidationProcess()
Method Detail

init

public void init()
          throws ValidationProcessException
Description copied from interface: IValidationProcess
perform any initialization necessary for the process. For example, some implementations of this interface try to estimate the work in this method.

Throws:
ValidationProcessException

run

public void run()
         throws ValidationProcessException
Description copied from interface: IValidationProcess
launch the validation process

Throws:
ValidationProcessException

validate

public void validate(ExecutionPoint execPoint,
                     IRuleBase iRuleBase,
                     IValidationContext context)
              throws ValidationProcessException
validate the objects in the tree with the given target as the root. All nodes should be instances of the appropriate type(s), which includes the primary type appropriate for the model and, optionally, a type that provides additional features and properties of the primary type, called its context.

Parameters:
execPoint - -- the ExecutionPoint that triggered this validation
iRuleBase - -- the IRuleBase that matches this target
context - -- the IValidationContext to use when evaluating rules
Throws:
ValidationProcessException

validateComponent

public void validateComponent(Object target,
                              ExecutionPoint execPoint,
                              IRuleBase iRuleBase,
                              IValidationContext context)
                       throws ValidationProcessException
used to validate single components.

Parameters:
target - -- the target object to validate
execPoint - -- the ExecutionPoint that triggered this validation
iRuleBase - -- the IRuleBase that matches this target
context - -- the IValidationContext to use when evaluating rules
Throws:
ValidationProcessException

validateChildren

protected void validateChildren(Object target,
                                ExecutionPoint execPoint,
                                IRuleBase iRuleBase,
                                IValidationContext context,
                                boolean validate)
                         throws ValidationProcessException
Validate the child components of the given target. The TreeWalkerFactory is used to get the appropriate tree walker, which fetches the children of this component. The traversal mode is also automatically set.

Parameters:
target - -- the target object whose children are to be validated
execPoint - -- the ExecutionPoint that triggered this validation
iRuleBase - -- the IRuleBase that matches this target
context - -- the IValidationContext to use when evaluating rules
validate - -- validate (true) or visit only
Throws:
ValidationProcessException

cloneContext

public IValidationContext cloneContext(IRuleBase iRuleBase,
                                       IValidationContext context)
                                throws ValidationProcessException
Parameters:
iRuleBase -
context -
Returns:
Throws:
ValidationProcessException

pathMatchesExpression

protected boolean pathMatchesExpression(Object target,
                                        String regexp)
used by child classes within the model to determine if their path matches a reqular expression that identifies a rule base. This is typically needed when a child component has a

Parameters:
target - - target object we are trying to match
regexp - - the regular expression that identifies a rule base
Returns:
validator for this component

calculateWork

protected void calculateWork(ExecutionPoint execPoint,
                             IRuleBase iRuleBase,
                             IValidationContext context)
                      throws ValidationProcessException
visit the objects in the tree with the given target as the root. This method is used primarily to walk the component tree starting with the target and estimate the amount of work (or number of components) when the tree is walked.

Parameters:
execPoint - -- the ExecutionPoint that triggered this validation
iRuleBase - -- the IRuleBase that matches this target
context - -- the IValidationContext to use when evaluating rules
Throws:
ValidationProcessException

visitComponent

protected void visitComponent(Object target,
                              ExecutionPoint execPoint,
                              IRuleBase iRuleBase,
                              IValidationContext context)
                       throws ValidationProcessException
used to visit a single component.

Parameters:
target - -- the target object to validate
execPoint - -- the ExecutionPoint that triggered this validation
iRuleBase - -- the IRuleBase that matches this target
context - -- the IValidationContext to use when evaluating rules
Throws:
ValidationProcessException

computeKeyboardTraversalList

public boolean computeKeyboardTraversalList(Object target)
                                     throws ValidationProcessException
Throws:
ValidationProcessException

getArrowTraversables

public void getArrowTraversables(Control ctrl,
                                 List ctrlList)

cacheControlList

public void cacheControlList(Composite composite,
                             List ctrlList)

listContainsString

public boolean listContainsString(String str,
                                  List strList)

isControlInFocusableList

public boolean isControlInFocusableList(Control ctrl)

isNonfocusableControl

public boolean isNonfocusableControl(Control ctrl)

isArrowTraversable

public boolean isArrowTraversable(Control control,
                                  IGuiModel model)

getStyle

protected int getStyle(Control control,
                       IGuiModel model)

getFocusControl

protected Control getFocusControl(Control control,
                                  IGuiModel model)

getChildren

protected Control[] getChildren(Control control,
                                IGuiModel model)

getEnabled

protected boolean getEnabled(Control control,
                             IGuiModel model)

setFocus

protected boolean setFocus(Control control,
                           IGuiModel model)

traverse

protected boolean traverse(Control control,
                           IGuiModel model,
                           int traversal)