Help
I have written a class to get a spreed sheet file from the sevrer and
extract the data. This worcks, but the data is displayed in alert
boxes to see if it worcks. I called the class CGetDataBase;
I wanted to creat labels and add them to a VerticalPanel I created in
the entrypoint function. And stored it as a mener veribol in
CGetDataBase as my_ver.
I then call builder.send request and create a RequestCallBack class.
In the function handleReponse, I cannot get access to my_ver, how can
I get this to work? Ok in C++ I could use a globol, I know messey
programming. How can I do this in java
public class cGetDatabase {
private String url;
VerticalPanel my_ver;
public cGetDatabase(String address, VerticalPanel ver)
{
this.url=address;
this.my_ver=ver;
}
public boolean Send()
{
RequestBuilder builder = new RequestBuilder(RequestBuilder.GET,
URL.encode(this.url));
builder.setTimeoutMillis(5000);
this.my_ver=null;
try {
Request request = builder.sendRequest(null, new
RequestCallback()
{
// this is in the RequestCallback class
public void onError(Request request, Throwable
exception)
{
// Couldn't connect to server (could be timeout, SOP
violation, etc.)
}
public void HandleResponse(String data)
{
String lines[];
lines=data.split("\r");
Label test = new Label("test");
// how can I access ver
// which is declered in
this.my_ver.add(test);
String line[];
for(int i=0; i<lines.length; i=i+1)
{
line=lines[i].split("\t");
String name=line[0];
String email=line[1];
Window.alert(name);
Window.alert(email);
}
}
public void onResponseReceived(Request request, Response
response)
{
if (200 == response.getStatusCode()) {
HandleResponse(response.getText());
} else {
// Handle the error. Can get the status text from
response.getStatusText()
Window.alert("Server could not respond");
}
}
});
} catch (RequestException e) {
// Couldn't connect to server
Window.alert("Could not connect to server");
}
return true;
}
}
-Ted get object created in parent class
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---