Your example looks correct. I heavily 'drank the koolaid" of Overlay
types earlier this year and have not regretted it. To the extend that
there are areas where I'd like to use them, but can't, because of
their inability to implement interfaces
. In particular, when using Deferred Binding to wrap native browser
objects, sometimes I need a JSO created differently for each DB. Each
JSO is "effectively final" because only one concrete type of the
interface ever exists in any permutation, so theoretically it's
possible for the JSO design to work within these restrictions, but a
little hairy. (essentially, if type-tightening fails, you're screwed)
The classic example is Canvas drawing. I have an interface which
exports drawing methods (moveTo, lineTo, transform, etc) One
implementation might be a wrapper around the CanvasRenderingContext2D
from the <CANVAS> tag. Another might be a Flash, SVG, or Silverlight
implementation.
-Ray
On Fri, Aug 29, 2008 at 12:26 AM, Ian Petersen <[EMAIL PROTECTED]> wrote:
>
> On Fri, Aug 29, 2008 at 3:05 AM, Reinier Zwitserloot <[EMAIL PROTECTED]>
> wrote:
>> I don't use GWT-Serialization to talk to my server. The server sends
>> timestamps as milliseconds. I'd like to turn these milliseconds into
>> javascript Date objects.
>>
>> How do I accomplish this?
>>
>> As I mentioned when long emulation was on the table, timestamps are
>> one of those numbers which are not representable with ints, but they
>> fit perfectly in the range where doubles still represent integral
>> numbers without loss of precision.
>
> I don't think you want to use longs--someone measured them at 250
> times slower than JS doubles, or something like that. I think you
> want the following:
>
> public final class JSDate extends JSO {
>
> protected JSDate() {
> }
>
> public static native create(double millis) /*-{
> return new Date(millis);
> }-*/;
>
> // implement relevant date methods here, like getYear:
>
> public native int getYear() /*-{
> return this.getYear();
> }-*/;
> }
>
> Not sure though--I haven't used the new overlay stuff myself, and I
> typed the above directly into the browser without testing.
>
> Ian
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/Google-Web-Toolkit-Contributors
-~----------~----~----~----~------~----~------~--~---