How to add an input field for a float?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

How to add an input field for a float?

Herbert König
Hi,

in:
e newCell addInputFieldAspect: #vorgabeMasse for: self observee selectedPosition

selectedPosition vorgabeMasse returns a Float. If I input '0.0' into
that field and submit, vorgabeMasse contains a String.

If the field would contain an integer the same code would work as
expected (vorgabeMasse would contain an integer afterwards).

I thought that would be the job of AIDAAspectAdaptor but didn't find
any code to make the magic happen :-))

Should I just convert the string in my input validation or is there a
way to input floats directly?

Thanks,

Herbert                          mailto:[hidden email]

_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: How to add an input field for a float?

Janko Mivšek
Hi Herbert!

It was nice to meet you in Berlin last week!

About floats, they are not supported in auto conversion routines in
Aida. Only dates, integers and fixed points are supported and even those
in 123.456,00 format, that is comma for decimals.

So, for other data types you need to provide your own accessor methods
which deal with text only. I usualy add 'Text' to the accessor name in
domain object, for instance if you have:

        anObject float: 12.3; float

then you should floatText methods:

        anObject floatText: '12.3'; floatText

This auto converting stuff should be enhanced, I know, but this opens
all possible and impossible internationalization + dialect specific
troubles, so putting that burden to the each developer with its specific
case is most general solution.

Best regards
Janko



Herbert König pravi:

> Hi,
>
> in:
> e newCell addInputFieldAspect: #vorgabeMasse for: self observee selectedPosition
>
> selectedPosition vorgabeMasse returns a Float. If I input '0.0' into
> that field and submit, vorgabeMasse contains a String.
>
> If the field would contain an integer the same code would work as
> expected (vorgabeMasse would contain an integer afterwards).
>
> I thought that would be the job of AIDAAspectAdaptor but didn't find
> any code to make the magic happen :-))
>
> Should I just convert the string in my input validation or is there a
> way to input floats directly?
>
> Thanks,
>
> Herbert                          mailto:[hidden email]
>
> _______________________________________________
> Aida mailing list
> [hidden email]
> http://lists.aidaweb.si/mailman/listinfo/aida
>

--
Janko Mivšek
Svetovalec za informatiko
Eranova d.o.o.
Ljubljana, Slovenija
www.eranova.si
tel:  01 514 22 55
faks: 01 514 22 56
gsm: 031 674 565
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: How to add an input field for a float?

Herbert König
Hi Janko,


JM> It was nice to meet you in Berlin last week!
yes I was very pleased meeting you!

JM> So, for other data types you need to provide your own accessor methods
JM> which deal with text only. I usualy add 'Text' to the accessor name in
JM> domain object, for instance if you have:
JM> anObject float: 12.3; float
JM> then you should floatText methods:
JM> anObject floatText: '12.3'; floatText

ok thanks, just didn't want to reinvent the wheel.


Cheers,

Herbert                            mailto:[hidden email]

_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida