How to use GWT interface hierarchy in Javascript side

25 views
Skip to first unread message

cs.ozgur

unread,
Dec 16, 2011, 2:57:05 AM12/16/11
to gwtexporter
Hi all,
First of all, I am so appreciated to use exporter tool. So far no
problem with it for me. However, there is one thing I want to know: is
there a way to use my GWT type hierarchy in JavaScript side.
In GWT-side, all type hierarchy resides interfaces and i want to use
this in JavaScript side. For example:
I exported Point type and Point implements IGeometry interface
in Javascript side, I have a code like that:

var pointViewer = Map.PointViewer(); // PointViewer is also exported.
var point = Map.Point(29.8, 14.9);
pointViewer.addGeometry(point);

The third line give me a type cast error if addGeometry wants an
IGeometry interface (this interface is also exported) as an argument.
However, if it wants a Point as an argument, it runs correctly.

Another thing is that:
if i used this method, which wants IGeometry as argument, in closure:
Map.Adapter.createGeometry( // static method which create an
IGeometry.
function(geometry)
{
pointViewer.addGeometry(geometry); // no matter which geometry
type it creates, this code runs correctly
});

May you explain this cases to me and I wonder there is a way to use
interfaces as method parameters like first example I tried. What can
you suggest to me. How should I use my hierarchy while exporting them.
Thanks in advance.

Pieter De Graef

unread,
Dec 16, 2011, 3:00:32 AM12/16/11
to gwtex...@googlegroups.com
Hi,

I'm having problems with interfaces myself. I have defined interfaces
that extend the Exportable interface plus implementations that also
extend the exportable interface.
This used to work with exporter 2.3.1-SNAPSHOT, but since
2.4.0-SNAPSHOT this fails. I don't know why, but I have logged an
issue for it.

2011/12/16 cs.ozgur <cs.o...@gmail.com>:

cs.ozgur

unread,
Dec 16, 2011, 3:27:16 AM12/16/11
to gwtexporter
Hi Pieter,
Thanks for your reply. I have seen your previous post, and i am sorry
because of reposting it.
I will try 2.3.1 and report the result.
Thanks again.

On Dec 16, 10:00 am, Pieter De Graef <pied...@gmail.com> wrote:
> Hi,
>
> I'm having problems with interfaces myself. I have defined interfaces
> that extend the Exportable interface plus implementations that also
> extend the exportable interface.
> This used to work with exporter 2.3.1-SNAPSHOT, but since
> 2.4.0-SNAPSHOT this fails. I don't know why, but I have logged an
> issue for it.
>

> 2011/12/16 cs.ozgur <cs.oz...@gmail.com>:

Reply all
Reply to author
Forward
0 new messages