Em sexta-feira, 22 de novembro de 2013 16h16min06s UTC-3, Goktug Gokdogan 
escreveu:

>
>
> On Thu, Nov 21, 2013 at 6:46 PM, Danilo Reinert 
> <[email protected]<javascript:>
> > wrote:
>
>> Hi all,
>>
>> Finally I've made an acceptable implementation of List<T> for 
>> JavaScriptObjects.
>>
>> Thanks to T. Broyer's suggestion on this 
>> topic<https://groups.google.com/d/msg/google-web-toolkit/_8X9WPL6qwM/C8GfwAM0ItAJ>
>>  I've 
>> achieved a performant solution for it.
>>
>>
> Can you give more details?
>

Well, I've implemented all required methods of the List contract, 
performing over a JsArray instead of creating a new ArrayList and 
populating it. You can instantiate my JsArrayList implementation passing a 
JsArray as argument and it works as expected.

My main test has been the CellTable widget. I'm using this JsArrayList into 
the ListDataProvider and everything is working ok.

The only not supported methods yet are:
addAll (both)
removeAll
retainAll 

For implementing the iterators I've based my implementation on public 
source of ArrayList.

 
>
>> The main problem was the toArray() method. Using this 
>> class<https://code.google.com/p/gwt-in-the-air/source/browse/trunk/src/net/ltgt/gwt/jscollections/client/JsArrays.java>,
>>  
>> It's possible to convert a JsArray to a Object[] without iterating over it. 
>>
>>
> The contract of toArray requires copy. How do you exactly handle that?
>

I'm using slice to produce a shallow copy of the array. I guess this 
approach meets the contract. What do you think?
 

>  
>
>> Now I finally can receive a json array from my RESTful backend 
>> application and throw it into a CellTable directly.
>>
>>
>> In order to make it possible I had to use the above mentioned JsArrays 
>> class and an own extension of JsArray (used only as a internal of the 
>> JsArrayList).
>>
>>
>> Would it be interesting for GWT core?
>>
>> --
>> D. Reinert
>>
>> -- 
>> http://groups.google.com/group/Google-Web-Toolkit-Contributors
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "GWT Contributors" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to 
>> [email protected]<javascript:>
>> .
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>

-- 
http://groups.google.com/group/Google-Web-Toolkit-Contributors
--- 
You received this message because you are subscribed to the Google Groups "GWT 
Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to