EMF databinding to multiple fields [message #481591] |
Fri, 21 August 2009 17:05 |
Sue Messages: 14 Registered: July 2009 |
Junior Member |
|
|
I'm trying to figure out how to bind enablement of a field to multiple
values in my model. So, if my model is:
Person
isOld()
isTall()
I want to enable a text field if both of those values are true. When then
are changed, either by UI action or undo/redo, I would like the enablement
of the text field to change accordingly.
The only way I know to do this is to bind the enablement to each
separately. But this is an "OR" relationship and not the desired "AND"
relationship.
For example:
emfDbc.bindValue(SWTObservables.observeEnabled(_txt),
EMFEditObservables.observeValue(_editor.getEditingDomain(), model,
ModelPackage.Literals.MODEL__OLD), null, null);
emfDbc.bindValue(SWTObservables.observeEnabled(_txt),
EMFEditObservables.observeValue(_editor.getEditingDomain(), model,
ModelPackage.Literals.MODEL__TALL), null, null);
Is there a way to combine these enablements. I tried to use a
WritableValue but it seems like this requires that value to be changed
when either field gets changed. This is doable, but I have a lot of
different combinations and that would mean creating a bunch of
WritableValues and updating them all when the values change.
|
|
|
Re: EMF databinding to multiple fields [message #481643 is a reply to message #481591] |
Sat, 22 August 2009 07:09 |
Ed Merks Messages: 33140 Registered: July 2009 |
Senior Member |
|
|
Sue,
I see you reposted this to the EMF newsgroup, where Matthew was so kind
to answer it.
Sue wrote:
> I'm trying to figure out how to bind enablement of a field to multiple
> values in my model. So, if my model is:
>
> Person
> isOld()
> isTall()
>
> I want to enable a text field if both of those values are true. When
> then are changed, either by UI action or undo/redo, I would like the
> enablement of the text field to change accordingly.
>
> The only way I know to do this is to bind the enablement to each
> separately. But this is an "OR" relationship and not the desired
> "AND" relationship.
>
> For example:
>
> emfDbc.bindValue(SWTObservables.observeEnabled(_txt),
> EMFEditObservables.observeValue(_editor.getEditingDomain(), model,
> ModelPackage.Literals.MODEL__OLD), null, null);
>
> emfDbc.bindValue(SWTObservables.observeEnabled(_txt),
> EMFEditObservables.observeValue(_editor.getEditingDomain(), model,
> ModelPackage.Literals.MODEL__TALL), null, null);
>
> Is there a way to combine these enablements. I tried to use a
> WritableValue but it seems like this requires that value to be changed
> when either field gets changed. This is doable, but I have a lot of
> different combinations and that would mean creating a bunch of
> WritableValues and updating them all when the values change.
>
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.02748 seconds