Try using an AsyncDataProvider instead of ListDataProvider.

(also: embrace asynchrony!)

On Thursday, March 15, 2012 2:47:55 AM UTC+1, jmbz84 wrote:
>
> Hello, 
>
> I'm trying to use gwt CellBrowser and RequestFactory to show some 
> stored data as Cells in the cellbrowser. But I can't do it because of 
> the context of requestfactory. 
>
>
> Any Ideas ? 
>
> class CustomTreeModel implements TreeViewModel { 
> { 
> ... 
> .. 
> ... 
>
> List<ComposerProxy> composerproxy = new ArrayList<ComposerProxy>(); 
>
> private void setComposer() { 
>                 testRequestFactory = GWT.create(TestRequestFactory.class); 
>                 testRequestFactory.initialize(new SimpleEventBus()); 
>
>                 request.getQuery("select a from Composer a").fire( 
>                                 new Receiver<List<ComposerProxy>>() { 
>
>                                         @Override 
>                                         public void 
> onSuccess(List<ComposerProxy> arg0) { 
>                                             //Here Is my problem, How 
> can I transfer the value of arg0 to composerproxy in order to use it 
> on my CellBrowser () 
>                                            // Tried with a for() to 
> insert each ComposerProxy individually  and with a separate method 
> insertcomposerproxy(arg0) but didnt work 
>                                             composerproxy=arg0; 
>
>                                         } 
>                                 }); 
>
>         } 
>
> } 
>
> public <T> NodeInfo<?> getNodeInfo(T value) { 
>
>                 if (value == null) { 
>
>                         setComposer(); 
>
>                          // LEVEL 0. 
>                         // We passed null as the root value. Return the 
> composers. 
>                         // Create a data provider that contains the list 
> of composers. 
>
>                         //HERE IS MY PROBLEM. The composerproxy 
> variable is empty. 
>
>                         ListDataProvider<ComposerProxy> dataProvider = new 
> ListDataProvider<ComposerProxy>( 
>                                         composerproxy); 
>
>
>
>                         // Create a cell to display a composer. 
>                         Cell<ComposerProxy> cell = new 
> AbstractCell<ComposerProxy>() { 
>                                 @Override 
>                                 public void render(Context context, 
> ComposerProxy value, 
>                                                 SafeHtmlBuilder sb) { 
>                                         if (value != null) { 
>                                                 
> sb.appendEscaped(value.getName()); 
>
>                                         } 
>                                 } 
>                         }; 
>                         // Return a node info that pairs the data provider 
> and the cell. 
>                         return new 
> DefaultNodeInfo<ComposerProxy>(dataProvider, cell); 
>                 } 
> ...... 
> ..... 
> ..... 
> ..... 
>
> } 
>
>
>
> PD: The getQuery() function works fine and the arg0 variable has data.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/hkJGM5Mw4c4J.
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.

Reply via email to