Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » scout » Max Fraction Digits stuck at 2
Max Fraction Digits stuck at 2 [message #995051] Sat, 29 December 2012 00:20 Go to next message
Sebastian Boccardi is currently offline Sebastian Boccardi
Messages: 47
Registered: September 2012
Location: Montevideo
Member
Hi,

I have some columns in a table with:

@Override
protected int getConfiguredMaxFractionDigits() {
   return 4;
}

@Override
protected int getConfiguredMinFractionDigits() {
   return 4;
}


But when i try to enter any number with that fraction, like 0.3333 it keeps rounding them up to 2 fraction digits. I tried a Double Column and a BigDecimal column.

Anyone tried this? I'm missing a configuration for that column?


Sebastian
Re: Max Fraction Digits stuck at 2 [message #995495 is a reply to message #995051] Sun, 30 December 2012 08:32 Go to previous messageGo to next message
Adrian Moser
Messages: 67
Registered: March 2011
Member
Sebastian, I cannot reproduce this using a simple AbstractDoubleColumn:

        @Order(10.0)
        public class DoubleColumn extends AbstractDoubleColumn {

          @Override
          protected boolean getConfiguredEditable() {
            return true;
          }

          @Override
          protected String getConfiguredHeaderText() {
            return TEXTS.get("Company");
          }

          @Override
          protected int getConfiguredMaxFractionDigits() {
            return 4;
          }

          @Override
          protected int getConfiguredMinFractionDigits() {
            return 4;
          }
        }


Are you using a special format on the column (getConfiguredFormat()/setFormat())?

Adrian
Re: Max Fraction Digits stuck at 2 [message #995556 is a reply to message #995495] Sun, 30 December 2012 13:01 Go to previous messageGo to next message
Sebastian Boccardi is currently offline Sebastian Boccardi
Messages: 47
Registered: September 2012
Location: Montevideo
Member
My column is defined exactly as you entered it. But every time i change the value its rounding to 2 decimals. So the last 2 digits are always 0.

Look at the image attached, after the execCompleteEdit i found something mentioning a 2 fractionDigits for that field.

index.php/fa/12847/0/
  • Attachment: fractions.png
    (Size: 46.91KB, Downloaded 273 times)
Re: Max Fraction Digits stuck at 2 [message #995825 is a reply to message #995556] Mon, 31 December 2012 07:49 Go to previous messageGo to next message
Jeremie Bresson is currently online Jeremie Bresson
Messages: 762
Registered: October 2011
Senior Member
From what I understood in your screenshot, you are using an editable Double Column...

Your problem is that the editingField does not consider the properties of the column (Format, MinFractionDigits, MaxFractionDigits...) when the field is instanciated. You can file a bug for this.

In my opininion the current workarround is to override execPrepareEdit(ITableRow). You can call super.execPrepareEdit(row) cast the IFormField to a IDoubleField and set your properties...

Let me know if you need an example.

---

I found an other bug with NumberField format and fraction digit: Bug 396979
Re: Max Fraction Digits stuck at 2 [message #995892 is a reply to message #995825] Mon, 31 December 2012 12:32 Go to previous messageGo to next message
Sebastian Boccardi is currently offline Sebastian Boccardi
Messages: 47
Registered: September 2012
Location: Montevideo
Member
Ok, the workarounds works, seems Bug 396979 covers the problem.....

Thanks Jeremie
Re: Max Fraction Digits stuck at 2 [message #995899 is a reply to message #995051] Mon, 31 December 2012 13:04 Go to previous messageGo to next message
Claudio Guglielmo is currently offline Claudio Guglielmo
Messages: 127
Registered: March 2010
Senior Member
Hi there

The bug has already been fixed for SR 2, see:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=392425

Regards
Claudio
Re: Max Fraction Digits stuck at 2 [message #995939 is a reply to message #995892] Mon, 31 December 2012 15:25 Go to previous messageGo to next message
Jeremie Bresson is currently offline Jeremie Bresson
Messages: 118
Registered: November 2010
Senior Member
Bug 396979 is not about "editable double-column properties -> double-field properties". It is just about AbstractNumberField<T> (where T can be a Float) getConfiguredFormat and fraction-digit being set even if the format is set.

I need to review the code modified with 392425 to see if your case "editable double-column properties -> double-field properties" is now covered.
Re: Max Fraction Digits stuck at 2 [message #996542 is a reply to message #995939] Wed, 02 January 2013 10:27 Go to previous messageGo to next message
Jeremie Bresson is currently online Jeremie Bresson
Messages: 762
Registered: October 2011
Senior Member
Jeremie Bresson wrote on Mon, 31 December 2012 16:25

I need to review the code modified with 392425 to see if your case "editable double-column properties -> double-field properties" is now covered.


It should be OK.
Re: Max Fraction Digits stuck at 2 [message #997044 is a reply to message #996542] Thu, 03 January 2013 13:33 Go to previous message
Adrian Moser
Messages: 67
Registered: March 2011
Member
I did my test on Sun, 30 December 2012 with the latest Eclipse Scout version.
Therefore I can confirm the problem is solved, as Claudio says.

Adrian
Previous Topic:Trouble with images being cached
Next Topic:SVG field external link
Goto Forum:
  


Current Time: Thu Oct 23 08:13:32 GMT 2014

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

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