Created
July 7, 2009 11:37
-
-
Save hojberg/142034 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.zecure.client.presenters; | |
import com.google.gwt.http.client.Request; | |
import com.google.gwt.http.client.RequestBuilder; | |
import com.google.gwt.http.client.RequestCallback; | |
import com.google.gwt.http.client.RequestException; | |
import com.google.gwt.http.client.Response; | |
import java.util.ArrayList; | |
import com.zecure.client.views.SalesListView; | |
import com.zecure.client.models.Sale; | |
public class SalePresenter { | |
private SalesListView salesListView; | |
public SalePresenter(SalesListView salesListView) { | |
this.salesListView = salesListView; | |
} | |
public void loadSales() { | |
RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, "http://0.0.0.0:3000/sales.json"); | |
try { | |
Request req = builder.sendRequest( null, new RequestCallback() { | |
public void onError(Request request, Throwable exception) { | |
// i dont have access to this.salesListView | |
this.salesListView.mainPanel.add( "DOOP" ); | |
} | |
public void onResponseReceived(Request request, Response response) { | |
int statusCode = response.getStatusCode(); | |
if( statusCode == 200 || statusCode == 201 ) { | |
// i dont have access to this.salesListView | |
this.salesListView.mainPanel.add( "WOOP" ); | |
} | |
} | |
}); | |
} | |
catch (RequestException e) {} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment