int / float values in a table [message #10554] |
Thu, 28 May 2009 04:22  |
Eclipse User |
|
|
|
Hello,
unfortunately I have some problems with my table. I have several columns
which only accept floats or ints as input, which is why I created a
FloatCellEditor, respectively an IntegerCellEditor.
Everything works fine, except of a visual thing:
If i enter a cell and activate it (so that the "old" value gets
highlighted and the cursor blinks) the previously empty cell is filled
with the value 0. Well, this seems logical because the value of this
cell in the model is actually 0, which is the default.
If the cell is deactivated, it becomes cleared, because my LabelProvider
checks if a value is 0 and then returns an empty String instead.
How can I achieve this behaviour for an active cell?
Best regards,
Lars
|
|
|
Re: int / float values in a table [message #10788 is a reply to message #10554] |
Thu, 04 June 2009 09:10   |
Eclipse User |
|
|
|
Hi Lars,
Wouldn't you want to display a zero if that's the value in your model
object? I would expect the empty string to stand for "no value" (null) - you
could implement this by using java.lang.Float instead of float, or
java.lang.Integer instead of int.
Boris
"Lars Bischoff" <molehillrocker@googlemail.com> wrote in message
news:gvlhko$mkv$1@build.eclipse.org...
> Hello,
>
> unfortunately I have some problems with my table. I have several columns
> which only accept floats or ints as input, which is why I created a
> FloatCellEditor, respectively an IntegerCellEditor.
>
> Everything works fine, except of a visual thing:
> If i enter a cell and activate it (so that the "old" value gets
> highlighted and the cursor blinks) the previously empty cell is filled
> with the value 0. Well, this seems logical because the value of this cell
> in the model is actually 0, which is the default.
>
> If the cell is deactivated, it becomes cleared, because my LabelProvider
> checks if a value is 0 and then returns an empty String instead.
>
> How can I achieve this behaviour for an active cell?
>
> Best regards,
> Lars
|
|
|
Re: int / float values in a table [message #12004 is a reply to message #10788] |
Fri, 05 June 2009 04:30  |
Eclipse User |
|
|
|
Hello Boris,
using Float and Integer instead of the corresponding primitive types was
my first thought too, but unfortunately this is not conducive to the
performance. Since my tables contain >10.000 rows where each row has ~20
columns I'd need 10.000 row objects + (10.000 * 20 cells) = 210.000
objects per table. However, there are at least 10 tables open at the
same time...
I figured out a little workaround now, if the user deletes a cell-entry
via delete or backspace key, I just write a zero back into the model :)
Best regards,
Lars
Boris Bokowski schrieb:
> Hi Lars,
>
> Wouldn't you want to display a zero if that's the value in your model
> object? I would expect the empty string to stand for "no value" (null) - you
> could implement this by using java.lang.Float instead of float, or
> java.lang.Integer instead of int.
>
> Boris
>
> "Lars Bischoff" <molehillrocker@googlemail.com> wrote in message
> news:gvlhko$mkv$1@build.eclipse.org...
>> Hello,
>>
>> unfortunately I have some problems with my table. I have several columns
>> which only accept floats or ints as input, which is why I created a
>> FloatCellEditor, respectively an IntegerCellEditor.
>>
>> Everything works fine, except of a visual thing:
>> If i enter a cell and activate it (so that the "old" value gets
>> highlighted and the cursor blinks) the previously empty cell is filled
>> with the value 0. Well, this seems logical because the value of this cell
>> in the model is actually 0, which is the default.
>>
>> If the cell is deactivated, it becomes cleared, because my LabelProvider
>> checks if a value is 0 and then returns an empty String instead.
>>
>> How can I achieve this behaviour for an active cell?
>>
>> Best regards,
>> Lars
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.03855 seconds