Search in sources :

Example 1 with AggregateValidationStatus

use of org.eclipse.core.databinding.AggregateValidationStatus in project portfolio by buchen.

the class BindingHelper method createErrorLabel.

public final void createErrorLabel(Composite editArea) {
    // error label
    Label errorLabel = new Label(editArea, SWT.NONE);
    GridDataFactory.fillDefaults().span(2, 1).grab(true, false).applyTo(errorLabel);
    // error label
    // 
    context.bindValue(// 
    WidgetProperties.text().observe(errorLabel), // 
    new AggregateValidationStatus(context, AggregateValidationStatus.MAX_SEVERITY), // 
    null, new UpdateValueStrategy().setConverter(new StatusTextConverter()));
}
Also used : UpdateValueStrategy(org.eclipse.core.databinding.UpdateValueStrategy) Label(org.eclipse.swt.widgets.Label) AggregateValidationStatus(org.eclipse.core.databinding.AggregateValidationStatus)

Example 2 with AggregateValidationStatus

use of org.eclipse.core.databinding.AggregateValidationStatus in project portfolio by buchen.

the class AbstractTransactionDialog method createDialogArea.

@Override
protected Control createDialogArea(Composite parent) {
    Composite area = (Composite) super.createDialogArea(parent);
    Composite editArea = new Composite(area, SWT.NONE);
    FormLayout layout = new FormLayout();
    layout.marginWidth = 5;
    layout.marginHeight = 5;
    editArea.setLayout(layout);
    createFormElements(editArea);
    // $NON-NLS-1$
    IObservableValue<IStatus> calculationStatus = BeanProperties.value("calculationStatus").observe(model);
    this.context.addValidationStatusProvider(new MultiValidator() {

        @Override
        protected IStatus validate() {
            return calculationStatus.getValue();
        }
    });
    // $NON-NLS-1$
    context.bindValue(// $NON-NLS-1$
    PojoProperties.value("status").observe(status), new AggregateValidationStatus(context, AggregateValidationStatus.MAX_SEVERITY));
    return editArea;
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) IStatus(org.eclipse.core.runtime.IStatus) Composite(org.eclipse.swt.widgets.Composite) MultiValidator(org.eclipse.core.databinding.validation.MultiValidator) AggregateValidationStatus(org.eclipse.core.databinding.AggregateValidationStatus)

Aggregations

AggregateValidationStatus (org.eclipse.core.databinding.AggregateValidationStatus)2 UpdateValueStrategy (org.eclipse.core.databinding.UpdateValueStrategy)1 MultiValidator (org.eclipse.core.databinding.validation.MultiValidator)1 IStatus (org.eclipse.core.runtime.IStatus)1 FormLayout (org.eclipse.swt.layout.FormLayout)1 Composite (org.eclipse.swt.widgets.Composite)1 Label (org.eclipse.swt.widgets.Label)1