Re: Doubt about object passed to a constructor in GWT
Thank you for your suggestions!! -- Forwarded message -- From: Jens Date: Dec 8, 11:54 pm Subject: Doubt about object passed to a constructor in GWT To: Google Web Toolkit Do what feels best for you, its just personal preference I think. I prefer to only have one DAO per domain class so if I need both, an user with person and an user without person, I would go with: - UserDAO.findByXyz(int xyz) which delegates to UserDAO.findByXyz(xyz, true) or UserDAO.findByXyz(xyz, false) depending on what you think should be your default case. - UserDAO.findByXyz(int xyz, boolean withPerson) which allows you to not follow the default case if needed. -- 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 google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: Doubt about object passed to a constructor in GWT
Maybe I thought about a possible solution: UserPersonDAO create a new class that contains all the queries that involve both objects and UserTO PersonTO. What do you think? -- 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 google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Doubt about object passed to a constructor in GWT
Hello everyone! In the database I have a table "persons" with fields: id, first_name, last_name, cod_fs with id PK and a table "users" (id, username, password, person_id) with id PK and person_id FK REFERENCES persons (id) . I translated this report in my GWT project in models "PersonTO" and "UserTO". The code UserTO is as follows: package com.google.gwt.client.to; import java.io.Serializable; public class UserTO implements Serializable { private int id; private String username; private String password; private PersonTO personTO; public UserTO() { } public UserTO(int id, String username, String password, PersonTO person ) { this.id = id; this.username = username; this.password = password; this.personTO = person; } public PersonTO getPersonTO() { return personTO; } public void setPerson(PersonTO person) { this.personTO = person; } and other getter/setter methods ... The database queries are made within the class UserDAO, but I do not know how to invoke the constructor UserTO properly: package com.google.gwt.server.dao; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import com.google.gwt.client.exceptions.DBException; import com.google.gwt.client.to.PersonTO; import com.google.gwt.client.to.UserTO; public class UserDAO extends BaseDAO { private static String findUserFromCfSQL = "SELECT id,username,password,person_id FROM users WHERE person_id = (SELECT id FROM persons WHERE cod_fiscale = ?)"; public UserTO getUserFromCF(String cod_fiscale) throws DBException { Connection conn = null; PreparedStatement prepStat = null; ResultSet rs = null; UserTO user = null; try { conn = this.getConnection(); prepStat = conn.prepareStatement(findUserFromCfSQL); prepStat.setString(1, cod_fiscale); rs = prepStat.executeQuery(); ** user = new UserTO(rs.getInt(1), rs.getString(2), rs.getString(3), (PersonTO)rs.getObject(4)); *** return user; } catch (SQLException ex) { ex.printStackTrace(); throw new DBException(); } finally { try { prepStat.close(); conn.close(); } catch (SQLException ex) { ex.printStackTrace(); throw new DBException(); } } } } (PersonTO)rs.getObject(4))Of course it is wrong, because in ResultSet at index 4 there is an object of type Integer, but I do not know whether it is right to call for a service that returns the object PersonDAO to pass it through to the constructor new UserTO(...) Someone would know this dilemma? -- 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 google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: Drag&Drop + database
I solved! The problem was in the toString of widgets' text. widget.toString returns a result like this: 1) ciao ciao ([EMAIL PROTECTED]) So, it is clear that to capture the right data to be included in db is necessary to consider the sottoscringhe created by parentheses ")", "(" ")" , and not by spaces --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Drag&Drop + database
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 result) { Iterator 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 widgetRight = dualListBox.getWidgetRight(); Iterator 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(); idList.add(idNew); Iterator 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 -~--~~~~--~~--~--~---
Drag&Drop + database
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 result) { Iterator 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: ArrayList widgetRight = dualListBox.getWidgetRight(); Iterator 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); programmerTO.setNome(dati.substring(indexSpace1+1, indexSpace2 )); indexParentesi1 = dati.indexOf("(", indexSpace2+1); programmerTO.setCognome(dati.substring(indexSpace2, indexParentesi1-1)); indexParentesi2 = dati.indexOf(")", indexParentesi1+1); programmerTO.setEmail(dati.substring(indexParentesi1+1, indexParentesi2)); --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[ERROR] Uncaught exception escaped java.lang.NumberFormatException: For input string: "1"
Hi, I want to capture the contents of a widget as a string, and then subdivide this string and assign each subpart to a different variable. The first substring I would like to convert into long, but the following error appears: [ERROR] Uncaught exception escaped java.lang.NumberFormatException: For input string: "1" at java.lang.NumberFormatException.forInputString(NumberFormatException.java: 48) at java.lang.Long.parseLong(Long.java:403) at java.lang.Long.(Long.java:671) at gwt.client.MouseListBox.programmerList(MouseListBox.java:70) at gwt.client.DualListBox.getListRight(DualListBox.java:107) at gwt.client.Management$3.onSuccess(Management.java:118) at com.google.gwt.user.client.rpc.impl.RequestCallbackAdapter.onResponseReceived(RequestCallbackAdapter.java: 215) at com.google.gwt.http.client.Request.fireOnResponseReceivedImpl(Request.java: 254) at com.google.gwt.http.client.Request.fireOnResponseReceivedAndCatch(Request.java: 226) at com.google.gwt.http.client.Request.fireOnResponseReceived(Request.java: 217) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java: 39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java: 25) at java.lang.reflect.Method.invoke(Method.java:597) --- I tried both with the costructor that valueOf (..): programmer.setId( new Long( dati.substring ( 0, indexParentesi ) )); programmer.setId( Long.valueOf( dati.substring ( 0, indexParentesi ) ).longValue() ); but I have the same exception. how can I parse without that error? 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 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 -~--~~~~--~~--~--~---
Re: Conversion Object to List
Oh! Thank you very much! It work!! On Oct 11, 7:04 pm, "Isaac Truett" <[EMAIL PROTECTED]> wrote: > Your ProgrammerTO needs to implement the Serializable interface and > you need to compile it along with your service impl so that the server > can use it. > > On Sat, Oct 11, 2008 at 12:48 PM, Shi <[EMAIL PROTECTED]> wrote: > > > So... > > >> 1. Does ProgrammerTO meet the criteria for GWT serialization? If > >> you're not sure, post the class definition and we can figure it out. > > > I'm not sure of this, the class gwt.client.to.ProgrammerTO is: > > > public class ProgrammatoreTO { > > > private long id; > > private String name; > > private String surname; > > private String email; > > > public String getEmail() { > > return email; > > } > > public void setEmail(String email) { > > this.email = email; > > } > > public long getId() { > > return id; > > } > > public void setId(long id) { > > this.id = id; > > } > > public String getName() { > > return name; > > } > > public void setName(String name) { > > this.name = name; > > } > > public String getSurname() { > > return surname; > > } > > public void setSurname(String surname) { > > this.surname = surname; > > } > > public String toString() { > > String ret; > > > ret = "\n Id programmer : " + id + "\n name : " + > > name + > > "\n Surname : " + surname + "\n email : " + email; > > return ret; > > } > > > public boolean equals(Object obj) { > > if (this == obj) return true; > > if (obj == null) > > if(this.getName() == null && this.getSurname() == > > null && > > this.getEmail() == null) > > return true; > > return super.equals(obj); > > } > > > } > > >> 2. Is ProgrammerTO javac-compiled and available on the server's classpath? > > > When I make changes to the class ComunicationServiceImpl.java launch > > within /src/ the following command to update the classpath: > > > javac -Xlint:unchecked -cp .:/home/user/workspace/GWT/project/gwt- > > user.jar:/home/user/workspace/GWT/project/gwt-dev-linux.jar:/home/user/ > > workspace/GWT/project/gwt-servlet.jar gwt/server/ > > ComunicationServiceImpl.java > > > To the classpath must also add the path ProgrammerTO? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Conversion Object to List
So... > 1. Does ProgrammerTO meet the criteria for GWT serialization? If > you're not sure, post the class definition and we can figure it out. I'm not sure of this, the class gwt.client.to.ProgrammerTO is: public class ProgrammatoreTO { private long id; private String name; private String surname; private String email; public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public long getId() { return id; } public void setId(long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getSurname() { return surname; } public void setSurname(String surname) { this.surname = surname; } public String toString() { String ret; ret = "\n Id programmer :" + id + "\n name :" + name + "\n Surname : " + surname + "\n email :" + email; return ret; } public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) if(this.getName() == null && this.getSurname() == null && this.getEmail() == null) return true; return super.equals(obj); } } > 2. Is ProgrammerTO javac-compiled and available on the server's classpath? When I make changes to the class ComunicationServiceImpl.java launch within /src/ the following command to update the classpath: javac -Xlint:unchecked -cp .:/home/user/workspace/GWT/project/gwt- user.jar:/home/user/workspace/GWT/project/gwt-dev-linux.jar:/home/user/ workspace/GWT/project/gwt-servlet.jar gwt/server/ ComunicationServiceImpl.java To the classpath must also add the path ProgrammerTO? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Conversion Object to List
Hi! Thank you for having responded! I'm using GWT 1.5 I felt like you wrote me a worning but it appears that triggers the "onFailure": [WARN] StandardContext[]Exception while dispatching incoming RPC call com.google.gwt.user.client.rpc.SerializationException: java.lang.reflect.InvocationTargetException at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeWithCustomSerializer(ServerSerializationStreamWriter.java: 686) at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeImpl(ServerSerializationStreamWriter.java: 649) at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serialize(ServerSerializationStreamWriter.java: 583) . Caused by: com.google.gwt.user.client.rpc.SerializationException: Type 'gwt.client.to.ProgrammerTO' was not included in the set of types which can be serialized by this SerializationPolicy or its Class object could not be loaded. For security purposes, this type will not be serialized. at com.google.gwt.user.server.rpc.impl.StandardSerializationPolicy.validateSerialize(StandardSerializationPolicy.java: 83) at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serialize(ServerSerializationStreamWriter.java: 581) at com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamWriter.writeObject(AbstractSerializationStreamWriter.java: 129) at com.google.gwt.user.client.rpc.core.java.util.Collection_CustomFieldSerializerBase.serialize(Collection_CustomFieldSerializerBase.java: 43) at com.google.gwt.user.client.rpc.core.java.util.ArrayList_CustomFieldSerializer.serialize(ArrayList_CustomFieldSerializer.java: 36) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) You know what could be? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Conversion Object to List
Sorry, in the last part of the code I wrote bad some words: final AsyncCallback callback = new AsyncCallback(){ public void onSuccess(Object listReturned) { ListlistProgrammer=(List) listReturned; Iterator iter = listProgrammer.iterator(); tableProgrammer = new FlexTable(); }; --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Conversion Object to List
Hi, in MyServiceImpl class I have implemented a function thar returns a List<>: public List getAllProgrammer(){ List listProgrammTO = new ArrayList(); 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) { ListlistProgramm=(List) listReturned; Iterator 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 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 -~--~~~~--~~--~--~---
Re: Problem import class external path /client/ HELP!
Changing the file: the error is: Compiling module gwt.GwtApplication Computing all possible rebind results for 'gwt.client.GwtApplication' Rebinding gwt.client.GwtApplication Checking rule [ERROR] Unable to find type 'gwt.client.GwtApplication' [ERROR] Hint: Previous compiler errors may have made this type unavailable [ERROR] Hint: Check the inheritance chain from your module; it may not be inheriting a required module or a module may not be adding its source path entries properly [ERROR] Build failed I do not understand .. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Problem import class external path /client/ HELP!
Thank you for reply me! How should specify the source package in the file .gwt.xml? I changed the file .gwt.xml: and the error is: Compiling module gwt.GwtApplication Computing all possible rebind results for 'gwt.client.GwtApplication' Rebinding gwt.client.GwtApplication Checking rule [ERROR] Unable to find type 'gwt.client.GwtApplication' [ERROR] Hint: Previous compiler errors may have made this type unavailable [ERROR] Hint: Check the inheritance chain from your module; it may not be inheriting a required module or a module may not be adding its source path entries properly [ERROR] Build failed My version GWT is: 1.5.2 --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Problem import class external path /client/ HELP!
Hi! Mine is a project with the classes (in the package DAO) that communicate with the database. The problem is that GWT apparently does not recognize the classes out of /src/client. The struct of my project is: /src/ /src/dao/ /src/to/ /src/client/ /src/server/ /src/public/ The compilation of my GWT application from this result: [ERROR] Errors in '~/src/gwt/client/ComunicationService.java' [ERROR] Line 6: The import to cannot be resolved [ERROR] Line 18: ProgrammerTO cannot be resolved to a type [ERROR] Line 18: GWT does not yet support the Java 5.0 language enhancements; only 1.4 compatible source may be used . [ERROR] Build failed If I move with a refactoring to.ProgrammerTO in / src / client / to get another type of error: [ERROR] Line 19: The type List is not generic; it cannot be parameterized with arguments [ERROR] Line 19: GWT does not yet support the Java 5.0 language enhancements; only 1.4 compatible source may be used I tried to make a refactoring moving packages "to" and "dao" in / src / client / but appeared several errors due to incompatibility with the GWT java.sql * e * java.text. How can I fix these problems? Thanks in advance! I hope someone can help me! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Problem import class external path /client/ HELP!
Hi! Mine is a project with the classes (in the package DAO) that communicate with the database. The problem is that GWT apparently does not recognize the classes out of /src/client. The struct of my project is: /src/ /src/dao/ /src/to/ /src/client/ /src/server/ /src/public/ The compilation of my GWT application from this result: [ERROR] Errors in '~/src/gwt/client/ComunicationService.java' [ERROR] Line 6: The import to cannot be resolved [ERROR] Line 18: ProgrammerTO cannot be resolved to a type [ERROR] Line 18: GWT does not yet support the Java 5.0 language enhancements; only 1.4 compatible source may be used . [ERROR] Build failed If I move with a refactoring to.ProgrammerTO in / src / client / to get another type of error: [ERROR] Line 19: The type List is not generic; it cannot be parameterized with arguments [ERROR] Line 19: GWT does not yet support the Java 5.0 language enhancements; only 1.4 compatible source may be used I tried to make a refactoring moving packages "to" and "dao" in / src / client / but appeared several errors due to incompatibility with the GWT java.sql * e * java.text. How can I fix these problems? Thanks in advance! I hope someone can help me! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Operator OR || does not work
It work whit that review: if ( ( fName.getValueAsString.equals("") ) || ( fLastName.getValueAsString.equals("") ) || (email.getValueAsString.equals("")) ) { .. 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 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 -~--~~~~--~~--~--~---
Operator OR || does not work
Hey, some of you know why GWT applications do not recognize the operator || (OR) , still the END && works ? For example: I want that if the form is not entirely completed, is not written anything in the database, but the IF does not work why the operator || does not work fName,fLastName and email are TextField --- regConfirmButton = new Button("REGISTRATION"); regConfirmButton.addListener(new ButtonListenerAdapter(){ public void onClick(Button button, EventObject e){ if ( ( fName.equals("") ) || ( fLastName.equals("") ) || (email.equals("")) ) { MessageBox.alert("Form not completed");} else loginService.createProgrammer(fName.getValueAsString(), fLastName.getValueAsString(), email.getValueAsString(), callback); }}}); --- --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Number of event ButtonListener
thanks very much, it works! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Number of event ButtonListener
HI! I have a question from you: You can insert into a single method onClick of a ButtonListenerAdapter more than one function that interacts with the database, relied on interface Service? My problem is that the first function returns a value (id) I retrieved from the database and who I uses as a parameter for the second function, but when I click on the button the first time, it seems that the first callback does not retain the value of id that I gained from the database. Instead the second click on the button I get what I want. -- Login.java long id_programmer = 0; Button regConfirmButton = new Button("Confirm"); regConfirmButton.addListener(new ButtonListenerAdapter(){ public void onClick(Button button, EventObject e){ loginService.getIdProgrammer(fName.getValueAsString(), fLastName.getValueAsString(), email.getValueAsString(), callback1 ); loginService.createUser(userNew.getValueAsString(),passwNew.getValueAsString(), id_programmer, callback2); if( id_programmer > 0){ MessageBox.alert("Registration was successful"); }else MessageBox.alert("Programmer not found in database"); } }); final AsyncCallback callback1 = new AsyncCallback(){ public void onSuccess(Object result) { long ok = Long.valueOf(result.toString()).longValue(); id_programmer = ok; //String s =Long.valueOf(id_programmer).toString(); //Label lab = new Label(s); //panelHoriz.add(lab); } public void onFailure(Throwable arg0) { } }; LoginServiceImpl.java public long getIdProgrammer(String name, String lastName, String email) { long ret = 0; List listprogrTO = new ArrayList(); ProgrammerDAO progrDAO = new ProgrammerDAO(); listprogrTO = progrDAO.findByLastName(lastName); Iterator iter = listprogrTO.iterator(); while(iter.hasNext()){ ProgrammerTO progrItem = iter.next(); if( nome.equals( progrItem.getName() ) && email.equals( progrItem.getEmail() ) ) ret = progrItem.getId(); } return ret; } public void createUser(String username, String password, Long id_progr){ RegistrationTO registrTO = new RegistrationTO(); RegistrationDAO registrDAO = new RegistrationDAO(); registrTO.setUsername(username); registrTO.setPassword(password); registrTO.setId_programmer(id_progr); registrDAO.create(registrTO); } --- So, with the first function I verify that the person you want to register as a Programmer, and the second runs the registered with the login data on the database. Why after the first click is on the second maintain the value of your function, but doing tests in callback1 I see that the id_programmer is set correctly at the right value received from query? Already thanks for having reached the end of this 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 -~--~~~~--~~--~--~---
Re: GWT
You edited the file -compile.cmd with the addition of path that are missing? Keepeek-Force-1 wrote: > Hi, > i had the same problem. > I added output path in StockWatcher-shell.cmd and everything is now > ok. > It looks like that : > @java -Xmx256M -cp "%~dp0\src;%~dp0\bin;C:/Developpement/gwt- > windows-1.5.2/gwt-user.jar;C:/Developpement/gwt-windows-1.5.2/gwt-dev- > windows.jar;C:/Developpement/gwt-windows-1.5.2/StockWatcher/out/ > production/StockWatcher" com.google.gwt.dev.GWTShell -out "%~dp0\www" > %* com.google.gwt.sample.stockwatcher.StockWatcher/StockWatcher.html > > I hope that s help > kf1 > > On 5 sep, 22:28, Daniel <[EMAIL PROTECTED]> wrote: > > Hi all, > > > > GWT is great! > > > > I'm following through the tutorial, but I've gotten stuck on the RPC > > stuff. �When I run it I get this error: > > > > - > > > > [ERROR] Unable to instantiate > > 'com.google.gwt.sample.stockwatcher.server.StockPriceServiceImpl' > > java.lang.ClassNotFoundException: > > com.google.gwt.sample.stockwatcher.server.StockPriceServiceImpl > > � � � � at java.net.URLClassLoader$1.run(URLClassLoader.java:200) > > � � � � at java.security.AccessController.doPrivileged(Native Method) > > � � � � at java.net.URLClassLoader.findClass(URLClassLoader.java:188) > > � � � � at java.lang.ClassLoader.loadClass(ClassLoader.java:306) > > � � � � at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276) > > � � � � at java.lang.ClassLoader.loadClass(ClassLoader.java:251) > > � � � � at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) > > � � � � at java.lang.Class.forName0(Native Method) > > � � � � at java.lang.Class.forName(Class.java:169) > > � � � � at > > com.google.gwt.dev.shell.GWTShellServlet.tryGetOrLoadServlet(GWTShellServlet.java: > > 952) > > � � � � at > > com.google.gwt.dev.shell.GWTShellServlet.service(GWTShellServlet.java: > > 278) > > � � � � at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) > > � � � � at > > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java: > > 237) > > � � � � at > > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java: > > 157) > > � � � � at > > org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java: > > 214) > > � � � � at > > org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java: > > 104) > > � � � � at > > org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java: > > 520) > > � � � � at > > org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java: > > 198) > > � � � � at > > org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java: > > 152) > > � � � � at > > org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java: > > 104) > > � � � � at > > org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java: > > 520) > > � � � � at > > org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java: > > 137) > > � � � � at > > org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java: > > 104) > > � � � � at > > org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java: > > 118) > > � � � � at > > org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java: > > 102) > > � � � � at > > org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java: > > 520) > > � � � � at > > org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java: > > 109) > > � � � � at > > org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java: > > 104) > > � � � � at > > org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java: > > 520) > > � � � � at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java: > > 929) > > � � � � at > > org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java: > > 160) > > � � � � at > > org.apache.coyote.http11.Http11Processor.process(Http11Processor.java: > > 799) > > � � � � at org.apache.coyote.http11.Http11Protocol > > $Http11ConnectionHandler.processConnection(Http11Protocol.java:705) > > � � � � at > > org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java: > > 577) > > � � � � at org.apache.tomcat.util.threads.ThreadPool > > $ControlRunnable.run(ThreadPool.java:683) > > � � � � at java.lang.Thread.run(Thread.java:619) > > > > followed by: > > > > [ERROR] Unable to dispatch request > > > > - > > > > I'm guessing that gwt doesn't compile the server side stuff > > automatically for debugging? > > > > If so, would I just create a directory called "stockPrices" in "www/ > > com.google.gwt.sample.stockwatcher.StockWatcher", and compile the > > servlet there, and if so, would I still need to create entries in a > > "WEB-INF/whatever.xml" file? > > > > Just a little confused because the tutorial made it seem like gwt >
Re: Exception: This widget's parent does not implement HasWidgets
Thanks to both, I am reviewing the entire project to understand how to change it. Some things I had not written in the code above for simpler, but in my project the button has the ClickListener..for example. Thanks for your help Shi --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Exception: This widget's parent does not implement HasWidgets
Hi, thank you for answers! So, I try to explain better. I have a menu created by MenuHome that contains items, HOME and LOGIN. Until yesterday I had left the code as that shown by gregor, but this does not work as I will. If in Login clicking on the button loginButton want to call another Widget (perhaps in this widget make a call to another), how do I tell him to clear all there was in the panel except the menu when click on HOME, so delete the contents of vPanel2 and keep intact vPanel with the menu, ? It's for this reason that I thought I had to instantiate MenuHome in Login, just to be able to use the clear () when I was comfortable, but know that this does not work and I do not know what else to do so. Dean S.Jones I understand what you have said but are not able to apply it to my example I hope that I made you understand, I apologize for my bad English... 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 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 -~--~~~~--~~--~--~---
Exception: This widget's parent does not implement HasWidgets
Hi! I'm trying to make my class MenuHome as a container through the abstract class com.google.gwt.user.client.ui.Composite.java but I have always the same problem: This widget's parent does not implement HasWidgets. In the main class I want a panel that could contain all the widget children (instances of other classes) and then be able to remove any time a widget you do not have to see, perhaps with a command vPanel2.clean() When run my application, when I click on LOGIN shows this exception. How could solve? My code simplified: -MenuHome.java---container import com.google.gwt.user.client.Command; import com.google.gwt.user.client.ui.Composite; import com.google.gwt.user.client.ui.MenuBar; import com.google.gwt.user.client.ui.VerticalPanel; public class MenuHome extends Composite { private VerticalPanel vPanel; private Login login; public VerticalPanel vPanel2; public MenuHome() { super(); Command cmd = new Command(){ public void execute(){ vPanel2.clear(); } }; Command cmdOpen = new Command(){ public void execute(){ if(vPanel2.getWidgetCount() == 0){ login = new Login(); vPanel2.add(login); } } }; vPanel = new VerticalPanel(); MenuBar menu = new MenuBar(); vPanel2 = new VerticalPanel(); menu.addItem("HOME", cmd); menu.addItem("LOGIN", cmdOpen); vPanel.add(menu); vPanel.add(vPanel2); initWidget(vPanel); } protected void onAttach() { super.onAttach(); } } --Login.javaclass child import com.google.gwt.user.client.ui.Composite; import com.google.gwt.user.client.ui.HasHorizontalAlignment; import com.google.gwt.user.client.ui.HasVerticalAlignment; import com.google.gwt.user.client.ui.HasWidgets; import com.google.gwt.user.client.ui.VerticalPanel; import com.google.gwt.user.client.ui.Widget; import com.gwtext.client.widgets.Button; public class Login extends Composite{ MenuHome mhome = new MenuHome(); private VerticalPanel panelVert; private Button loginButton; public Login(){ panelVert = new VerticalPanel(); panelVert.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); panelVert.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); loginButton = new Button("Login"); panelVert.add(loginButton); initWidget(panelVert); mhome.vPanel2.add(panelVert); //<-the error add the panel to the //main container of class MenuHome } } - Error [ERROR] Uncaught exception escaped java.lang.IllegalStateException: This widget's parent does not implement HasWidgets at com.google.gwt.user.client.ui.Widget.removeFromParent(Widget.java: 67) at com.google.gwt.user.client.ui.ComplexPanel.add(ComplexPanel.java: 77) at com.google.gwt.user.client.ui.VerticalPanel.add(VerticalPanel.java: 53) at com.gwt.client.Login.(Login.java:55) at com.gwt.client.MenuHome$2.execute(MenuHome.java:29) at com.google.gwt.user.client.CommandExecutor.doExecuteCommands(CommandExecutor.java: 311) at com.google.gwt.user.client.CommandExecutor $2.run(CommandExecutor.java:206) at com.google.gwt.user.client.Timer.fireImpl(Timer.java:164) at com.google.gwt.user.client.Timer.fireAndCatch(Timer.java:150) at com.google.gwt.user.client.Timer.fire(Timer.java:142) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java: 39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java: 25) at java.lang.reflect.Method.invoke(Method.java:597) at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java: 103) at com.google.gwt.dev.shell.moz.MethodDispatch.invoke(MethodDispatch.java: 80) at org.eclipse.swt.internal.gtk.OS._g_main_context_iteration(Native Method) at org.eclipse.swt.internal.gtk.OS.g_main_context_iteration(OS.java: 1428) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2840) at com.google.gwt.dev.GWTShell.pumpEventLoop(GWTShell.java:720) at com.google.gwt.dev.GWTShell.run(GWTShell.java:593) at com.google.gwt.dev.GWTShell.main(GW
Re: GWT
In javac must specify the path to the servlet. In my case I did so: $ cd /MyApplicationGWT/src/ $ javac -cp .:/usr/gwt-linux-1.5.1/gwt-user.jar:/usr/gwt-linux-1.5.1/ gwt-dev-linux.jar:/usr/gwt-linux-1.5.1/gwt-servlet.jar com/gwt/server/ LoginServiceImpl.java Run Home-shell (for my example) and work! Thank you for having helped Daniel by email ;) Shi --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Error This UIObject's element is not set;
Dohhh! thank you very much for your help! I you have been very useful!! Shi --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Failed to load module com.gwt.LoginCliente". Please see the log in the development shell for details.
Hi,thank you for yours answers! The problem is built using modules Clypal Studio without calling applicationCreator of GWT. Using clypal study, the application can be tested only with the compiler of its Clypal but it seems does not support gwtext. Here's why those mistakes continue. Shi --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Error This UIObject's element is not set;
Hi, I'm trying to "compose" the widget, but I get the same mistake.I simplified the code of 2 modules that I consider: - import com.google.gwt.user.client.ui.RootPanel; import com.google.gwt.user.client.ui.VerticalPanel; import com.google.gwt.user.client.ui.Composite; public class MenuHome extends Composite { public void Composite() { VerticalPanel vPanel = new VerticalPanel(); vPanel.setTitle("GOOD!"); vPanel.setWidth("100%"); vPanel.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER); initWidget(vPanel); RootPanel.get().add(vPanel);} } - import com.google.gwt.core.client.EntryPoint; import com.google.gwt.user.client.ui.RootPanel; import com.google.gwt.user.client.Window; public class Home implements EntryPoint { private MenuHome menuhome; public void onModuleLoad() { Window.setTitle("Title"); menuhome = new MenuHome(); RootPanel.get().add(menuhome); } } -- MenuHome.gwt.xml - Home.gwt.xml -- MenuHome.html MenuHome - Home.html Home -- ERROR: [ERROR] Unable to load module entry point class com.gwt.client.Home (see associated exception for details) java.lang.AssertionError: This UIObject's element is not set; you may be missing a call to either Composite.initWidget() or UIObject.setElement() at com.google.gwt.user.client.ui.UIObject.getElement(UIObject.java: 511) at com.google.gwt.user.client.ui.ComplexPanel.add(ComplexPanel.java: 83) at com.google.gwt.user.client.ui.AbsolutePanel.add(AbsolutePanel.java: 80) at com.gwt.client.Home.onModuleLoad(Home.java:13) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java: 39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java: 25) at java.lang.reflect.Method.invoke(Method.java:597) at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:320) at com.google.gwt.dev.shell.BrowserWidget.attachModuleSpace(BrowserWidget.java: 329) at com.google.gwt.dev.shell.moz.BrowserWidgetMoz.access $100(BrowserWidgetMoz.java:35) at com.google.gwt.dev.shell.moz.BrowserWidgetMoz $ExternalObjectImpl.gwtOnLoad(BrowserWidgetMoz.java:59) at org.eclipse.swt.internal.gtk.OS._g_main_context_iteration(Native Method) at org.eclipse.swt.internal.gtk.OS.g_main_context_iteration(OS.java: 1428) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2840) at com.google.gwt.dev.GWTShell.pumpEventLoop(GWTShell.java:720) at com.google.gwt.dev.GWTShell.run(GWTShell.java:593) at com.google.gwt.dev.GWTShell.main(GWTShell.java:357) someone knows the problem?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 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 -~--~~~~--~~--~--~---
[ERROR]Failed to load module com.gwt.LoginCliente". Please see the log in the development shell for details.
Hi, I'm new here, and beginners with GWT. I am using the plugin Cypal STudio for GWT, but I can not go forward because when I try to debug an error I always, when I declare and initialize variables in the onModuleLoad() method or I declare outside of the method and I initialize inside the method. I noticed that this happens with variables declared like instance of class imported from gwtext. The module is this: package com.gwt.client; import com.google.gwt.core.client.EntryPoint; import com.google.gwt.user.client.Window; import com.gwtext.client.widgets.Panel; public class LoginCliente implements EntryPoint { private Panel loginPanel = null; public void onModuleLoad() { Window.alert("ciao"); Panel formPanel = new Panel(); }} -- LoginCliente.gwt.xml -- Have you any idea? thank you! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---