use of org.eclipse.core.databinding.validation.MultiValidator in project portfolio by buchen.
the class SecurityTaxonomyPage method setupWeightMultiValidator.
private void setupWeightMultiValidator(Label sumOfWeights, TaxonomyDesignation designation, final List<IObservableValue> weightObservables) {
MultiValidator multiValidator = new WeightsAreGreaterThan100Validator(sumOfWeights, designation.getTaxonomy(), weightObservables);
bindings.getBindingContext().addValidationStatusProvider(multiValidator);
validators.add(multiValidator);
for (int ii = 0; ii < weightObservables.size(); ii++) {
IObservableValue observable = weightObservables.get(ii);
ClassificationLink link = designation.getLinks().get(ii);
UpdateValueStrategy strategy = new UpdateValueStrategy();
strategy.setAfterConvertValidator(new GreaterThanZeroValidator());
validators.add(bindings.getBindingContext().bindValue(multiValidator.observeValidatedValue(observable), BeanProperties.value("weight").observe(link), strategy, // $NON-NLS-1$
null));
}
}
use of org.eclipse.core.databinding.validation.MultiValidator in project portfolio by buchen.
the class SecurityTaxonomyPage method setupClassificationMultiValidator.
private void setupClassificationMultiValidator(TaxonomyDesignation designation, final List<IObservableValue> classificationObservables) {
MultiValidator multiValidator = new ClassificationNotTwiceValidator(classificationObservables);
bindings.getBindingContext().addValidationStatusProvider(multiValidator);
validators.add(multiValidator);
for (int ii = 0; ii < classificationObservables.size(); ii++) {
IObservableValue observable = classificationObservables.get(ii);
ClassificationLink link = designation.getLinks().get(ii);
UpdateValueStrategy strategy = new UpdateValueStrategy();
strategy.setAfterConvertValidator(new NotNullValidator());
validators.add(bindings.getBindingContext().bindValue(multiValidator.observeValidatedValue(observable), BeanProperties.value("classification").observe(link), strategy, // $NON-NLS-1$
null));
}
}
Aggregations