Home » Eclipse Projects » Nebula » FormattedText not working in JFace data binding scenario
FormattedText not working in JFace data binding scenario [message #532592] |
Mon, 10 May 2010 14:22 |
Geejay Messages: 160 Registered: February 2010 |
Senior Member |
|
|
Hello
I am using the FormattedText widget, and to perform databinding I am using a
JFace, PojoObservables setup.
Here is the interesting code:
IObservableValue uiElement =
SWTObservables.observeSelection(field.getValueControl());
IObservableValue modelElement = PojoObservables.observeValue(modelObject,
field.getId());
IValidator validator = field.getUiValidators().iterator().next();
UpdateValueStrategy strategy = new
UpdateValueStrategy().setAfterConvertValidator(validator);
bindingContext.bindValue(uiElement, modelElement, strategy, null);
field.getValueControl() returns the text widget on the FormattedText widget,
i.e it calls FormattedText.getControl().
It seems that when I save a value which fails validation, and then reload
the model object into the UI, then I only get the first couple of digits in
the number in the text control.
Whats the correct process for binding to the FormattedText? Should I just be
setting the underlying Text widget?
|
|
|
Re: FormattedText not working in JFace data binding scenario [message #532700 is a reply to message #532592] |
Mon, 10 May 2010 21:19 |
Eric Wuillai Messages: 27 Registered: July 2009 |
Junior Member |
|
|
To perform databinding on a FormattedText, you can use
FormattedTextObservableValue. I added it recently (2 month ago).
Look at NumberFormatterDataBindingSnippet for an example.
Eric
> Hello
>
> I am using the FormattedText widget, and to perform databinding I am
> using a JFace, PojoObservables setup.
>
> Here is the interesting code:
>
> IObservableValue uiElement =
> SWTObservables.observeSelection(field.getValueControl());
> IObservableValue modelElement =
> PojoObservables.observeValue(modelObject, field.getId());
> IValidator validator = field.getUiValidators().iterator().next();
> UpdateValueStrategy strategy = new
> UpdateValueStrategy().setAfterConvertValidator(validator);
> bindingContext.bindValue(uiElement, modelElement, strategy, null);
>
> field.getValueControl() returns the text widget on the FormattedText
> widget, i.e it calls FormattedText.getControl().
>
> It seems that when I save a value which fails validation, and then
> reload the model object into the UI, then I only get the first couple of
> digits in the number in the text control.
>
> Whats the correct process for binding to the FormattedText? Should I
> just be setting the underlying Text widget?
|
|
|
Re: FormattedText not working in JFace data binding scenario [message #532795 is a reply to message #532700] |
Tue, 11 May 2010 09:05 |
Geejay Messages: 160 Registered: February 2010 |
Senior Member |
|
|
Hi Eric
I tried this out, but I couldn't get it to bind.
I noticed the snippet uses PropertyChangeSupport (BeansObservables), I am
actually trying to use PojoObservables. I also have a ControlDecorator setup
on the widget, which doesnt seem to fire.
Any ideas off the top of the head?
Thanks again
Greg
"Eric Wuillai" <eric@wdev91.com> wrote in message
news:hs9t98$odq$1@build.eclipse.org...
> To perform databinding on a FormattedText, you can use
> FormattedTextObservableValue. I added it recently (2 month ago).
> Look at NumberFormatterDataBindingSnippet for an example.
>
> Eric
>
>> Hello
>>
>> I am using the FormattedText widget, and to perform databinding I am
>> using a JFace, PojoObservables setup.
>>
>> Here is the interesting code:
>>
>> IObservableValue uiElement =
>> SWTObservables.observeSelection(field.getValueControl());
>> IObservableValue modelElement =
>> PojoObservables.observeValue(modelObject, field.getId());
>> IValidator validator = field.getUiValidators().iterator().next();
>> UpdateValueStrategy strategy = new
>> UpdateValueStrategy().setAfterConvertValidator(validator);
>> bindingContext.bindValue(uiElement, modelElement, strategy, null);
>>
>> field.getValueControl() returns the text widget on the FormattedText
>> widget, i.e it calls FormattedText.getControl().
>>
>> It seems that when I save a value which fails validation, and then
>> reload the model object into the UI, then I only get the first couple of
>> digits in the number in the text control.
>>
>> Whats the correct process for binding to the FormattedText? Should I
>> just be setting the underlying Text widget?
|
|
|
Re: FormattedText not working in JFace data binding scenario [message #599598 is a reply to message #532592] |
Mon, 10 May 2010 21:19 |
Eric Wuillai Messages: 27 Registered: July 2009 |
Junior Member |
|
|
To perform databinding on a FormattedText, you can use
FormattedTextObservableValue. I added it recently (2 month ago).
Look at NumberFormatterDataBindingSnippet for an example.
Eric
> Hello
>
> I am using the FormattedText widget, and to perform databinding I am
> using a JFace, PojoObservables setup.
>
> Here is the interesting code:
>
> IObservableValue uiElement =
> SWTObservables.observeSelection(field.getValueControl());
> IObservableValue modelElement =
> PojoObservables.observeValue(modelObject, field.getId());
> IValidator validator = field.getUiValidators().iterator().next();
> UpdateValueStrategy strategy = new
> UpdateValueStrategy().setAfterConvertValidator(validator);
> bindingContext.bindValue(uiElement, modelElement, strategy, null);
>
> field.getValueControl() returns the text widget on the FormattedText
> widget, i.e it calls FormattedText.getControl().
>
> It seems that when I save a value which fails validation, and then
> reload the model object into the UI, then I only get the first couple of
> digits in the number in the text control.
>
> Whats the correct process for binding to the FormattedText? Should I
> just be setting the underlying Text widget?
|
|
|
Re: FormattedText not working in JFace data binding scenario [message #599605 is a reply to message #532700] |
Tue, 11 May 2010 09:05 |
Geejay Messages: 160 Registered: February 2010 |
Senior Member |
|
|
Hi Eric
I tried this out, but I couldn't get it to bind.
I noticed the snippet uses PropertyChangeSupport (BeansObservables), I am
actually trying to use PojoObservables. I also have a ControlDecorator setup
on the widget, which doesnt seem to fire.
Any ideas off the top of the head?
Thanks again
Greg
"Eric Wuillai" <eric@wdev91.com> wrote in message
news:hs9t98$odq$1@build.eclipse.org...
> To perform databinding on a FormattedText, you can use
> FormattedTextObservableValue. I added it recently (2 month ago).
> Look at NumberFormatterDataBindingSnippet for an example.
>
> Eric
>
>> Hello
>>
>> I am using the FormattedText widget, and to perform databinding I am
>> using a JFace, PojoObservables setup.
>>
>> Here is the interesting code:
>>
>> IObservableValue uiElement =
>> SWTObservables.observeSelection(field.getValueControl());
>> IObservableValue modelElement =
>> PojoObservables.observeValue(modelObject, field.getId());
>> IValidator validator = field.getUiValidators().iterator().next();
>> UpdateValueStrategy strategy = new
>> UpdateValueStrategy().setAfterConvertValidator(validator);
>> bindingContext.bindValue(uiElement, modelElement, strategy, null);
>>
>> field.getValueControl() returns the text widget on the FormattedText
>> widget, i.e it calls FormattedText.getControl().
>>
>> It seems that when I save a value which fails validation, and then
>> reload the model object into the UI, then I only get the first couple of
>> digits in the number in the text control.
>>
>> Whats the correct process for binding to the FormattedText? Should I
>> just be setting the underlying Text widget?
|
|
|
Goto Forum:
Current Time: Tue Apr 23 16:33:44 GMT 2024
Powered by FUDForum. Page generated in 0.04149 seconds
|