[Databinding] Transform Boolean value bound to checkbox control into string and save it as a map val [message #516701] |
Wed, 24 February 2010 10:38  |
Eclipse User |
|
|
|
I have the following need:
params = new HashMap<String, String>();
final IMapProperty selfMap = Properties.selfMap(String.class,
String.class);
final IObservableMap observableParams = selfMap.observe(params);
final IObservableValue mapEntry = Observables
..observeMapEntry(observableParams, key);
Button button = new Button(parent, SWT.CHECK);
control = SWTObservables.observeSelection(button);
bindValue(control, mapEntry);
First of all, this setup does only saves something into the map if I
click the checkbox.
Furthermore I want not the Boolean value saved into the map but a
special String value when the Boolean is true and another one when its
false. Since I would not like to use a UpdateValueStrategy with a
converter is there another way to achieve the transformation from
Boolean -> String using some kind of DecoratedValue?
Thanks,
Phil
|
|
|
Re: [Databinding] Transform Boolean value bound to checkbox control into string and save it as a map [message #518429 is a reply to message #516701] |
Thu, 04 March 2010 00:56  |
Eclipse User |
|
|
|
Philipp Kursawe wrote:
> I have the following need:
>
> params = new HashMap<String, String>();
> final IMapProperty selfMap = Properties.selfMap(String.class,
> String.class);
> final IObservableMap observableParams = selfMap.observe(params);
>
> final IObservableValue mapEntry = Observables
> .observeMapEntry(observableParams, key);
>
> Button button = new Button(parent, SWT.CHECK);
> control = SWTObservables.observeSelection(button);
> bindValue(control, mapEntry);
>
> First of all, this setup does only saves something into the map if I
> click the checkbox.
>
> Furthermore I want not the Boolean value saved into the map but a
> special String value when the Boolean is true and another one when its
> false. Since I would not like to use a UpdateValueStrategy with a
> converter is there another way to achieve the transformation from
> Boolean -> String using some kind of DecoratedValue?
Converters are the recommended approach here.
Matthew
|
|
|
Powered by
FUDForum. Page generated in 0.25151 seconds