org.springframework.richclient.form
Class SimpleValidationResultsReporter

java.lang.Object
  extended by org.springframework.richclient.form.SimpleValidationResultsReporter
All Implemented Interfaces:
ValidationListener, ValidationResultsReporter

public class SimpleValidationResultsReporter
extends Object
implements ValidationResultsReporter

An implementation of ValidationResultsReporter that reports only a single message from the configured validation results model to the associated message receiver. More details of the searching process can be found in the getValidationMessage(ValidationResults) method.

Author:
Keith Donald, Jan Hoskens

Constructor Summary
SimpleValidationResultsReporter(ValidationResultsModel resultsModel, Messagable messageReceiver)
          Constructor.
 
Method Summary
 void clearErrors()
          Clear the messageReceiver.
protected  ValidationMessage getValidationMessage(ValidationResults resultsModel)
           Get the message that should be reported.
 boolean hasErrors()
          Return the "has errors" status of the validation results model(s).
 void validationResultsChanged(ValidationResults results)
          Handle a change in the validation results model.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleValidationResultsReporter

public SimpleValidationResultsReporter(ValidationResultsModel resultsModel,
                                       Messagable messageReceiver)
Constructor.

Parameters:
formModel - ValidatingFormModel to monitor and report on.
messageReceiver - The receiver for validation messages.
Method Detail

clearErrors

public void clearErrors()
Clear the messageReceiver.


validationResultsChanged

public void validationResultsChanged(ValidationResults results)
Handle a change in the validation results model. Update the message receiver based on our current results model state.

Specified by:
validationResultsChanged in interface ValidationListener
Parameters:
results - the set of valiation results, this set will incude results for all properties even if the listener is only listening for changes to a specific properties results.

getValidationMessage

protected ValidationMessage getValidationMessage(ValidationResults resultsModel)

Get the message that should be reported.

Searching takes following rules into account: Any custom Severities will be placed in order according to their given magnitude.

Parameters:
resultsModel - Search this model to find the message.
Returns:
the message to display on the Messagable.

hasErrors

public boolean hasErrors()
Description copied from interface: ValidationResultsReporter
Return the "has errors" status of the validation results model(s).

Specified by:
hasErrors in interface ValidationResultsReporter
Returns:
true if this model or any child model is marked as having errors
See Also:
ValidationResultsReporter.hasErrors()


Copyright © 2004-2008 The Spring Framework. All Rights Reserved.