|
|
|
|
Re: Binding details table to validation [message #1061190 is a reply to message #1061052] |
Thu, 30 May 2013 13:14 |
Simon Barnett Messages: 28 Registered: July 2012 |
Junior Member |
|
|
Ah, you're right.
The validation is actually initiated by a validation status provider which has been added to the binding context, as follows:-
bindingCtxt.addValidationStatusProvider(new ValidationStatusProvider() {
@Override
public IObservableValue getValidationStatus() {
/* validate the model */
return new ComputedValue() {
@Override
protected Object calculate() {
return BasicDiagnostic.toIStatus(Diagnostician.INSTANCE.validate((Impl) (editingDomain.getResourceSet().getResources().get(0).getContents().get(0))));
}
};
}
@Override
public IObservableList getTargets() {
return null;
}
@Override
public IObservableList getModels() {
return null;
};
});
When I add a text field to the details part of the form, I use the following code:-
bindingCtxt.bindValue(
WidgetProperties.text(SWT.Modify).observeDelayed(400, text),
EMFEditProperties.value(domain, feature).observeDetail(sel));
but when I add a table, I use:-
ViewerSupport.bind(
detailsTableViewer,
EMFProperties.list(detailsTableFeature).observeDetail(sel),
EMFProperties.values(columnFeatures.keySet().toArray(
new EStructuralFeature[0])));
As the table version has no connection to the binding context, my guess would be that changes to it don't invoke the validation through the validation status provider.
Does that sound sensible? And if so, how would I fix that?
|
|
|
Re: Binding details table to validation [message #1061194 is a reply to message #1061190] |
Thu, 30 May 2013 13:22 |
Ed Merks Messages: 33216 Registered: July 2009 |
Senior Member |
|
|
Simon,
That's beyond skills in data binding. Perhaps is a general data binding
(JFace) question or perhaps someone with more knowledge will chime in
here...
On 30/05/2013 3:14 PM, Simon Barnett wrote:
> Ah, you're right.
>
> The validation is actually initiated by a validation status provider
> which has been added to the binding context, as follows:-
>
>
> bindingCtxt.addValidationStatusProvider(new ValidationStatusProvider() {
>
> @Override
> public IObservableValue getValidationStatus() {
> /* validate the model */
> return new ComputedValue() {
>
> @Override
> protected Object calculate() {
> return
> BasicDiagnostic.toIStatus(Diagnostician.INSTANCE.validate((Impl)
> (editingDomain.getResourceSet().getResources().get(0).getContents().get(0))));
> }
> };
> }
>
> @Override
> public IObservableList getTargets() {
> return null;
> }
>
> @Override
> public IObservableList getModels() {
> return null;
> };
> });
>
>
> When I add a text field to the details part of the form, I use the
> following code:-
>
>
> bindingCtxt.bindValue(
> WidgetProperties.text(SWT.Modify).observeDelayed(400, text),
> EMFEditProperties.value(domain, feature).observeDetail(sel));
>
>
> but when I add a table, I use:-
>
>
> ViewerSupport.bind(
> detailsTableViewer,
> EMFProperties.list(detailsTableFeature).observeDetail(sel),
> EMFProperties.values(columnFeatures.keySet().toArray(
> new EStructuralFeature[0])));
>
>
> As the table version has no connection to the binding context, my
> guess would be that changes to it don't invoke the validation through
> the validation status provider.
>
> Does that sound sensible? And if so, how would I fix that?
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.02871 seconds