Issue about databinding validation and cursor [message #530140] |
Wed, 28 April 2010 15:58 |
Carusyte Missing name Messages: 27 Registered: July 2009 |
Junior Member |
|
|
I am binding a text control with a string property of a model, if things go right (i.e when the validation returns error status), the cursor moves naturally as I type in the text control, and the wizard updates messages; but if I type in correct content, the cursor would jump to the start of input which is very annoying. I can't figure out what's wrong in the code:
// here's the binding code
dbc = new DataBindingContext();
IObservableValue ovView = SWTObservables.observeText(filePath_txt,
SWT.Modify);
IObservableValue ovModel = BeansObservables.observeValue(
getModel(), "filePath");
UpdateValueStrategy strategy = getUpdateValueStrategy();
binding = dbc.bindValue(ovView, ovModel, strategy, null);
WizardPageSupport wps = WizardPageSupport.create(this, dbc);
....
// get the strategy
private UpdateValueStrategy getUpdateValueStrategy() {
return new UpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE)
.setBeforeSetValidator(new FileValidator());
}
class FileValidator implements IValidator {
...
// roughly speaking, it validates whether the file path entered in filePath_txt control is right, and this part of code works properly
@Override
public IStatus validate(Object value) {
...
}
}
Any kind of help would be appreciated!
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03028 seconds