Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [riena-dev] Unbind the modelBinding and rebind to an other attribute

Hi Elias,
 
sorry, i can not reproduce your described function.
 
After pushing the rebind button, still both labelridgets are bound. On editing text, all 3 fields get the new value.
 
I tested on win32 and Ekke Gentz on OSx. Both with Riena 1.0.0 and Eclipse 3.4.1. -> We have the same result.
 
Please have a look at the attached jpgs.
 
 
But i got an idea, that your riena installation works exactly the way we need.
 
 
Thanks in advance
Flo

2009/2/24 Elias Volanakis <elias@xxxxxxxxxxxxxxxxx>
Florian,

I don't think your use case is any different:

> Referring your example: I'd like to unbind the labelRidget, before the
> labelRidget2 is bound. So the valueUpdate from the text only
>  updates the labelRidget2. The labelRidget should not be updated
> anymore (After binding the labelRidget2).

But that is what already happens in the snippet I posted -- i.e. after
pressing rebind labelRidget1 STILL has the value "Pirchner",
labelRidget2 has the value "Florian" and labelRidget1 is not changed
if you type in the text box...

In other words, this:

textRidget.bindToModel(BeansObservables.observeValue(labelRidget2,
ILabelRidget.PROPERTY_TEXT));

will unbind labelRidget1 (or whatever was previously bound) and then
bind labelRidget2.

Isn't that exactly what you wanted? Or did I completely misunderstand you?

Kind regards,
Elias


On Tue, Feb 24, 2009 at 12:14 PM, Florian Pirchner
<florian.pirchner@xxxxxxxxx> wrote:
> Hi Elias,
>
> thanks for the snippet special created for me with text -> Florian -
> Pirchner. ;-)
>
>
> My usecase is different.
>
> If i am binding an IObservableValue, i would like to remove the old binded
> IObservableValue.
> Referring your example: I'd like to unbind the labelRidget, before the
> labelRidget2 is bound. So the valueUpdate from the text only updates the
> labelRidget2. The labelRidget should not be updated anymore (After binding
> the labelRidget2).
>
>
> I am not sure that i understand the reply right:
>>textRidget.bindToModel(...model1....)
>>// textRidget now bound to model 1
>>// later:
>>textRidget.bindToModel(...model2...) //
>>// textRidget now bound to model 2 and NOT bound to model1
>
> textRidget now bound to model 2 and NOT bound to model1
> If i push the "rebind" button, Output and Output2 are updated directly with
> the textValue. So i think model1 (as labelRidget from your snippet) is also
> bound? Or did i get something wrong?
>
>
>
> Redview requires the function in the designer mode. The user can bind each
> attribute of a bean.
>
> For example:
> In the first step the user binds the attribute "name". Redview creates the
> binding using the related ridget and calles updateFromModel(). So the
> swtControl shows the correct value of the bean.
> After this step the user recognizes that he binded the wrong attribute. So
> he will change the bounded attribute to "street". Again redview uses the
> ridget (which is already bound to name) and binds it to the attribute
> "street" of the bean. After calling updateFromModel() the control does not
> show the value of the attribute street, but again the value of the attribute
> name.
> Before binding the attribute "street", I would like to remove the binding to
> "name".
>
>
> I modified your snippet and made 2 different snippets.
> SnippedChangedBean.java
> SnippetChangedAttribute.java
>
> SnippedChangedBean simulates the binding of two beans. If you press the
> button, the beans are alternate bound to the ridget. Bean1, bean2, bean1,
> bean2,..
> On the first button Press, the Value changes from "value text of Bean 1" to
> "value text of Bean 2". Correct. Each other press only changes the beanName
> which was last bound. Not the value.
> Try pressing the button several times.
>
> SnippedChangedAttribute simulates the alternate binding of two different
> attributes of the same bean on pushing the button. "text1", "text2",
> "text1", "text2",... are bound alternate.
> On the first button Press, the Value changes from "value of Text 2" to
> "value of Text 1". Each other press only changes the property which was last
> bound. Not the value.
> Try pressing the button several times.
>
> Currently it works for redview. I am destroying the whole bindingDelegate
> and controller, and creating them completely new, if a bindingAttribute
> changes.
>
>
> Thanks, Flo
>
>
>
>
> -------- Original-Nachricht -------- Betreff: Re: [riena-dev] Unbind the
> modelBinding and rebind to an other attribute
> Datum: Mon, 23 Feb 2009 20:01:52 -0800
> Von: Elias Volanakis <elias@xxxxxxxxxxxxxxxxx>
> Antwort an: Riena Developers list <riena-dev@xxxxxxxxxxx>
> An: Riena Developers list <riena-dev@xxxxxxxxxxx>
> Referenzen: <AcmT83pLvTQ/Db9pQBmJUWIT5H5XsA==>
> <d58a25cf0902202310x3cfc7eedl1afb09fa0f1501fe@xxxxxxxxxxxxxx>
>
> Florian,
> there is no API for unbinding. However you should be able to re-bind, i.e.:
> textRidget.bindToModel(...model1....)
> // textRidget now bound to model 1
> // later:
> textRidget.bindToModel(...model2...) //
> // textRidget now bound to model 2 and NOT bound to model1
> See attached snippet.
> Elias.
> On Fri, Feb 20, 2009 at 11:10 PM, Florian Pirchner
> <florian.pirchner@xxxxxxxxx> wrote:
>> Hi riena-team,
>>
>> i have a question to a very special binding case:
>>
>> Redview can be run in different modes. One of them is a designer mode,
>> which
>> offers a very dynamically behavior on manipulating the ui. With a designer
>> editor the ui elements like controls, layouts and layoutdatas can be
>> designed. The editor offers a direct update. This means, that changes to
>> the
>> model are directly reflected to the ui. This works quite well..
>>
>> Now i am implementing the modelBindings. With the great riena binding api
>> it
>> is also easy to accieve this. But i am not sure how to process binding
>> changes in the designer editor best. If a ridget is already bound to the
>> model and the bindingAttribute changes, i have to unbind the modelBinding
>> and create a new one. I am not sure how to do this riena like. There is no
>> api like ridget.unbindFromModel(). So i have to destroy the controller
>> completely an create it again. It works well, but maybe there is a better
>> way.
>>
>> For example:
>> TextRidget is bound to the attribute "lastName" of the Adress bean. The
>> designer shows "Pirchner".
>> Now the designer decides to bind an other attribute like
>> Address.firstName.
>> After the rebinding, the designer should show "Flo".
>> So i have to unbind the TextRidget<->Adress.lastName binding and create a
>> new one: TextRidget<->Adress.firstName
>>
>> Thanks in advance for your answer
>> Flo
>>
>>
>
> --
> Elias Volanakis
> Technical Lead
> Innoopract (EclipseSource)
> 351 NW 12th Avenue
> Portland, Oregon 97209
> elias@xxxxxxxxxxxxxxxxx
> evolanakis@xxxxxxxxxxxxxx
> Tel: +1-503-552-1457
> Fax: +1-503-715-4915
> Mobile: +1-503-929-5537
> ---
> Innoopract is becoming EclipseSource - www.eclipsesource.com
> _______________________________________________
> riena-dev mailing list
> riena-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/riena-dev
>
>



--
Elias Volanakis
Technical Lead
Innoopract (EclipseSource)
351 NW 12th Avenue
Portland, Oregon 97209

elias@xxxxxxxxxxxxxxxxx
evolanakis@xxxxxxxxxxxxxx
Tel: +1-503-552-1457
Fax: +1-503-715-4915
Mobile: +1-503-929-5537
---
Innoopract is becoming EclipseSource - www.eclipsesource.com
_______________________________________________
riena-dev mailing list
riena-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/riena-dev

Attachment: afterClick.jpg
Description: JPEG image

Attachment: afterClick_typingChars.jpg
Description: JPEG image

Attachment: beforeClick.jpg
Description: JPEG image


Back to the top