Skip to main content



      Home
Home » Eclipse Projects » Rich Client Platform (RCP) » JFace DataBinding
JFace DataBinding [message #464250] Wed, 28 February 2007 13:47 Go to next message
Eclipse UserFriend
Hi,
I am using JFace databinding M5 version code for my application and
it works without any problems for simple controls like text boxes and
combos. But now i have a special requirement as explained below.
I have a currency field which has a text box for Dollars and
another text box next to it for cents. The user can either type dollars
like 25.50 or 25 and on focus out, i want to convert the decimal dollars
value to corresponding cents. I am not able to get this functionality
working. After I enter 25.50 in dollars text box, setDollars() method in
model is called for updating the model. There, I am calculating the cents
and setting it to the cents textbox and firing property change for cents.
Then I change the value of dollars to absolute value of the input, set it
and call property change for dollars text box.
In the screen, i get cents refreshed but the dollars still show the
typed value instead of newly set absolute value.
Any pointers to this problem will be helpful.
Thanks for reading and I hope this is clear.

-Sudhakar R
Re: JFace DataBinding [message #464421 is a reply to message #464250] Sat, 03 March 2007 08:55 Go to previous message
Eclipse UserFriend
Have a look at:
http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jface.t ests.databinding/src/org/eclipse/jface/tests/binding/scenari os/CustomConverterScenarios.java?view=co

In this solution, we use an intermediate model object (PriceModelObject) so
that we can bind the two text (or spinner) controls to the dollars and cents
property (respectively) of the intermediate object. The real model object's
attribute is then bound to the "price" attribute of the intermediate object.

Boris

"Sudhakar" <sudhakar82@gmail.com> schrieb im Newsbeitrag
news:2b4be0d6d675f9ec1b8b1da6ab017700$1@www.eclipse.org...
> Hi,
> I am using JFace databinding M5 version code for my application and
> it works without any problems for simple controls like text boxes and
> combos. But now i have a special requirement as explained below.
> I have a currency field which has a text box for Dollars and another
> text box next to it for cents. The user can either type dollars like 25.50
> or 25 and on focus out, i want to convert the decimal dollars value to
> corresponding cents. I am not able to get this functionality working.
> After I enter 25.50 in dollars text box, setDollars() method in model is
> called for updating the model. There, I am calculating the cents and
> setting it to the cents textbox and firing property change for cents. Then
> I change the value of dollars to absolute value of the input, set it and
> call property change for dollars text box. In the screen, i get cents
> refreshed but the dollars still show the typed value instead of newly set
> absolute value.
> Any pointers to this problem will be helpful.
> Thanks for reading and I hope this is clear.
>
> -Sudhakar R
>
Previous Topic:Error Marking and Content Assistance
Next Topic:Difference between RCP and normal PlugIn ?
Goto Forum:
  


Current Time: Tue Apr 15 02:27:14 EDT 2025

Powered by FUDForum. Page generated in 0.02704 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top