Hello World! for my GWT project I am using the library gwt-dnd for the
functionality of drag & drop. I have two lists box, in the left a list
of widget with data collected from the database. From db, I exstact
the object Person, that contains attributes:id, nome, cognome,email,
and I add these to the list:


public void onSuccess(List<Person> result) {
Iterator<Person> iter = result.iterator();
                        int i = 1;
                        while(iter.hasNext()){
                                i++;
                                Person item = iter.next();
                                dualListBox.addLeft(item.getId() + ") " + 
item.getNome() +" " +
item.getCognome() +" (" + item.getEmail() + ")" ) ;
                        }

In the right list, I can drag the widget from the left. On this list I
do a query to save the data in database.
I want to add each Person in a Team, adding the "id" of the person and
the "id" of the Team in a table Person-Team. The id_Team is written
correctly in the table Person-Team, but the data of Person are not
captured well, then not properly sort of conversion from a widget
object.
I do like this:

Person person = new Person();
ArrayList<Widget> widgetRight = dualListBox.getWidgetRight();
Iterator<Widget> iterWidget = widgetRight.iterator();
int indexSpace1, indexSpace2, indexParentesi1,indexParentesi2;
String dati;
while(iterWidget.hasNext()){
  Widget item = iterWidget.next();
  dati = item.toString();
  indexSpace1 = dati.indexOf( " " );
  indexSpace2 = dati.indexOf(" ", indexSpace1+1);
  person.setNome(dati.substring(indexSpace1+1, indexSpace2 ));
  indexParentesi1 = dati.indexOf("(", indexSpace2+1);
  person.setCognome(dati.substring(indexSpace2, indexParentesi1-1));
  indexParentesi2 = dati.indexOf(")", indexParentesi1+1);
  person.setEmail(dati.substring(indexParentesi1+1, indexParentesi2));

  comunicationService.getIdPerson(person.getNome(),
person.getCognome(), person.getEmail(), callback9);
}

final AsyncCallback callback9 = new AsyncCallback(){

                public void onFailure(Throwable caught) {
                        // TODO Auto-generated method stub

                }

                public void onSuccess(Object result) {
                        long idNew =  
Long.valueOf(result.toString()).longValue();
                        lab = new Label("nome = " +person.getNome() + " Cognome 
= "+
person.getCognome()+" Email =  "+ programmerTO.getEmail() + " id =" +
idNew);
                        panelFormContent.add(lab);
                        idList = new ArrayList<Long>();

                        idList.add(idNew);

                        Iterator<Long> iterId = idList.iterator();
                         while(iterId.hasNext()){
                                 long itemId = iterId.next();
                                 comunicationService.createPersonTeam(itemId, 
idTeamRet,
callback10);
                         }
                }};


Writing in the Label name, id, surname and email is this:
nome = id="ext-gen163" Cognome = class="gwt-HTML dragdrop-draggable
dragdrop-handle">3) enrico spanu Email = [EMAIL PROTECTED] id =0

So, only the email is properly captured by the string. How can I do
this kind of conversion so that it works?
Thanks!!
ps: I apologize if I have posted without first completing the post
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
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