Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » databinding number format
databinding number format [message #329124] Fri, 13 June 2008 11:13 Go to next message
Eclipse UserFriend
Originally posted by: lukas.myslivec.com

Hello,

i am useing jface databinding to bind an int attribute of my to a text
field. But the text field formats the int what i dont like.

for example:

int intVal = 2500
the text field shows "2.500".

could that be disabled?


thanks for any help

/lukas
Re: databinding number format [message #329131 is a reply to message #329124] Fri, 13 June 2008 14:33 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: eclipse-news.rizzoweb.com

lukas wrote:
> Hello,
>
> i am useing jface databinding to bind an int attribute of my to a text
> field. But the text field formats the int what i dont like.
>
> for example:
>
> int intVal = 2500
> the text field shows "2.500".
>
> could that be disabled?

Conversion can be overridden in several ways:
1) You can call setConverter() on the UpdateValueStrategy that is passed
in when you call DataBindingContext.bindValue(). However, I think that
will effectively eliminate all of the default conversions; not a problem
if that particular binding only ever binds to integer values in the
model, but if it can be something else, you have to handle all the
potential conversions.
2) You can subclass UpdateValueStrategy and override the method
createConverter() which is called to create the default converter if
none is specified via setConverter(). This might be a better option if
you need to apply the special conversion in multiple places and to
bindings that may not always be converting integer values.

Option 1 is simpler if you know for sure your situation is always
integer <-> Text binding.

Hope this helps,
Eric
Re: databinding number format [message #329709 is a reply to message #329131] Tue, 01 July 2008 15:34 Go to previous message
Eclipse UserFriend
Originally posted by: lukas.myslivec.com

Thank you!

i choose option 2. It works perfect!

/lukas
Previous Topic:3.4 .link files under OS-X 10.5.3
Next Topic:Restructuring the layout
Goto Forum:
  


Current Time: Sat Jul 27 16:27:15 GMT 2024

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

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

Back to the top