Okay... for starters, what version of GWT are you using? With 1.4, you're
not going to be able to use parameterized types on the client side. With
1.5, you can use parameterized types.
For 1.4:
AsyncCallback callback = new AsyncCallback() {
public void onSuccess(Object result) {
List list = (List)result;
Iterator i = list.iterator();
while (i.hasNext()) {
ProgrammerTO item = (ProgrammerTO)i.next();
// Do stuff
}
};
For 1.5:
AsyncCallback<List<ProgrammerTO>> callback = new
AsyncCallback<List<ProgrammerTO>>() {
public void onSuccess(List<ProgrammerTO> result() {
for (ProgrammerTO item : result) {
// Do stuff
}
}
};
With 1.4, you cast everything to the desired type. With 1.5, you
parameterize.
On Fri, Oct 10, 2008 at 10:59 AM, Shi <[EMAIL PROTECTED]> wrote:
>
> Hi, in MyServiceImpl class I have implemented a function thar returns
> a List<>:
>
> public List<ProgrammerTO> getAllProgrammer(){
> List<ProgrammerTO> listProgrammTO = new
> ArrayList<ProgrammerTO>();
> ProgrammerDAO programmDAO = new ProgrammerDAO();
> listProgrammTO = programmDAO.findAll();
> return listProgrammTO;
> }
>
>
> This method tries in the database all instances of programmer and
> returns the list.
> Pass this list to my application to be displayed, perhaps in a table:
>
> myService.getAllProgrammer(callback);
>
> The problem is that I do not know how to recover from this list
> returned:
>
> final AsyncCallback callback = new AsyncCallback(){
> public void onSuccess(Object listReturned) {
>
> List<ProgrammerTO>listProgramm=(List<ProgrammatoreTO>)
> listReturned;
> Iterator<ProgrammatoreTO> iter = listaProgrammer.iterator();
> tableProgrammer = new FlexTable();
> ................................
> };
>
> How can I use the object listReturned returned, and then convert it
> into List?
>
>
> thanks!
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---