XWT Validation rules and constructors [message #638374] |
Wed, 10 November 2010 23:42  |
Eclipse User |
|
|
|
Hello,
I have a simple validation rule for XWT:
import org.eclipse.core.databinding.validation.ValidationStatus;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.e4.xwt.validation.AbstractValidationRule;
public class SuffixValidationRule extends AbstractValidationRule
{
public SuffixValidationRule()
{
super()
} // end ctor SuffixValidationRule
public IStatus validate( Object value )
{
if( !value.matches( /(^[\p{Upper}]|^[\p{Digit}])[\p{Alpha}]*/ ) )
ValidationStatus.error( "Valid characters: Letters, spaces.")
} // end method validate
@Override
public IStatus validateBack( Object value )
{
ValidationStatus.ok()
} // end method validateBack
} // end class SuffixValidationRule
I have tried to pass in objects into the constructor, but XWT does not allows me.
The reason I attempted to pass in objects is that I use OVal framework to validate the model, hence I would like to pass into to the rule the model instance as a parameter being validadted and any other relevant parameters.
Is there a way for me to do this? Any suggestion would be appreciated.
Thanks
|
|
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.32455 seconds