Hi,

I am trying to build a translator for entering latitude / longitude values. On the server, these values are stored as Double, as the number of seconds. In my input fields, I want the value to look like "12 34 56.7 N" for 12 degrees, 34 minutes and 56.7 seconds North. This would lead to a Double value of 12*3600+34*60+56.7 = 45296.7.

To do this, I wrote an abstract class LongitudeLatitudeTranslator, which extends AbstractTranslator<Double>, with two subclasses, LongitudeTranslator and LatitudeTranslator (to correctly handle the N/ S at the end for longitudes, and E/W for latitudes, but have the rest of the code in one place). And I put the following method AppModule class:

public static void contributeTranslatorSource(Configuration<Translator> configuration)
{
  configuration.add(new LatitudeTranslator());
  configuration.add(new LongitudeTranslator());
}

To use these translators, I put in my .tml files:

<t:TextField t:id="longitude" value="place.longitude" t:translate="longitude" />
and
<t:TextField t:id="latitude" value="place.latitude" t:translate="latitude" />

which works nicely (if there is a better, more elegant way to achieve the same, please let me know).

Now comes the problem: every now and then, when I restart my application, my new translatorsare not only used for fields marked with t:translate="latitude", but for all fields which are connected to a Double value, for instance

<t:TextField t:id="seaLevel" value="place.seaLevel" />

Restarting the application (without any change) sometimes goes back to the (for me) expected behaviour.

What did I do wrong here?

Best Regards,

Christoph




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to