On 17 oct, 13:46, farmazone <[email protected]> wrote:
> Hello everybody!
>
> I am new to GWT but I found it very useful. Although I came to a
> problem I'd like to resolve.
>
> I want to have one interface to manage data from various tables.
>
> I fetch JSON data from database by RequestBuilder, then I create
> Overlay Types just like in manual with this function
>
> private final native static DataCollection<PageData> getPages(String
> json) /*-{
> return eval(json);
> }-*/;
Use JsonUtils.unsafeEval instead, or maybe rather (if using GWT 2.1)
JsonUtils.safeEval.
> where DataCollection extends JsArray and PageData extends DataItem
> that extends JavaScriptObject.
>
> here's DataCollection class:
>
> public class DataCollection<T extends DataItem> extends
> JsArray<DataItem> {
>
> protected DataCollection() {};
>
> public final DataItem getItem(int i){
> return get(i);
> }
>
> }
>
> DataItem just extends JavaScriptObject. I did not implemented any
> methods..
>
> So my question is how to cast the type <PageData> to the object that
> is returned by getItem method od DataCollection to achieve this:
> PageData pg=pagesCollection.getItem(0);
>
> I thought that when I define a variable DataCollection<PageData>
> pagesCollection; it will return <PageData> . I am wrong.
Because your getItem method returns DataItem instead of T. And
DataCollection should probably extend JsArray<T> too instead of
JsArray<DataItem>
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.