-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
root
committed
Oct 10, 2011
1 parent
8747d45
commit 0f18bb1
Showing
17 changed files
with
563 additions
and
15 deletions.
There are no files selected for viewing
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>vote</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>com.google.gdt.eclipse.core.webAppProjectValidator</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>com.google.gwt.eclipse.core.gwtProjectValidator</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>com.google.appengine.eclipse.core.projectValidator</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>com.google.appengine.eclipse.core.enhancerbuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
<nature>com.google.appengine.eclipse.core.gaeNature</nature> | ||
<nature>com.google.gwt.eclipse.core.gwtNature</nature> | ||
</natures> | ||
</projectDescription> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<module rename-to='vote'> | ||
<!-- Inherit the core Web Toolkit stuff. --> | ||
<inherits name='com.google.gwt.user.User'/> | ||
|
||
<!-- Inherit the default GWT style sheet. You can change --> | ||
<!-- the theme of your GWT application by uncommenting --> | ||
<!-- any one of the following lines. --> | ||
<inherits name='com.google.gwt.user.theme.clean.Clean'/> | ||
<!-- <inherits name='com.google.gwt.user.theme.standard.Standard'/> --> | ||
<!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> --> | ||
<!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/> --> | ||
|
||
<!-- Other module inherits --> | ||
|
||
<!-- Specify the app entry point class. --> | ||
<entry-point class='org.simmi.client.Vote'/> | ||
|
||
<!-- Specify the paths for translatable code --> | ||
<source path='client'/> | ||
<source path='shared'/> | ||
|
||
</module> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package org.simmi.client; | ||
|
||
import com.google.gwt.user.client.rpc.RemoteService; | ||
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath; | ||
|
||
/** | ||
* The client side stub for the RPC service. | ||
*/ | ||
@RemoteServiceRelativePath("greet") | ||
public interface GreetingService extends RemoteService { | ||
String greetServer(String name) throws IllegalArgumentException; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package org.simmi.client; | ||
|
||
import com.google.gwt.user.client.rpc.AsyncCallback; | ||
|
||
/** | ||
* The async counterpart of <code>GreetingService</code>. | ||
*/ | ||
public interface GreetingServiceAsync { | ||
void greetServer(String input, AsyncCallback<String> callback) | ||
throws IllegalArgumentException; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
package org.simmi.client; | ||
|
||
import com.google.gwt.core.client.EntryPoint; | ||
import com.google.gwt.core.client.GWT; | ||
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 com.google.gwt.user.client.ui.Grid; | ||
import com.google.gwt.user.client.ui.Image; | ||
import com.google.gwt.user.client.ui.RootPanel; | ||
|
||
/** | ||
* Entry point classes define <code>onModuleLoad()</code>. | ||
*/ | ||
public class Vote implements EntryPoint { | ||
/** | ||
* The message displayed to the user when the server cannot be reached or | ||
* returns an error. | ||
*/ | ||
private static final String SERVER_ERROR = "An error occurred while " | ||
+ "attempting to contact the server. Please check your network " | ||
+ "connection and try again."; | ||
|
||
/** | ||
* Create a remote service proxy to talk to the server-side Greeting service. | ||
*/ | ||
private final GreetingServiceAsync greetingService = GWT | ||
.create(GreetingService.class); | ||
|
||
/** | ||
* This is the entry point method. | ||
*/ | ||
public void onModuleLoad() { | ||
RootPanel rp = RootPanel.get(); | ||
final Grid grid = new Grid( 8, 10 ); | ||
grid.setSize("100%", "100%"); | ||
|
||
RequestBuilder rb = new RequestBuilder( RequestBuilder.POST, "/list.txt" ); | ||
try { | ||
rb.sendRequest("", new RequestCallback() { | ||
@Override | ||
public void onResponseReceived(Request request, Response response) { | ||
String list = response.getText(); | ||
String[] lines = list.split("\n"); | ||
|
||
int i = 0; | ||
for( String name : lines ) { | ||
String[] split = name.split("\t"); | ||
if( split.length > 2 ) { | ||
grid.setWidget( i/10, i%10, new Image( split[2] ) ); | ||
} | ||
|
||
i++; | ||
} | ||
} | ||
|
||
@Override | ||
public void onError(Request request, Throwable exception) { | ||
|
||
} | ||
}); | ||
} catch (RequestException e) { | ||
e.printStackTrace(); | ||
} | ||
|
||
rp.add( grid ); | ||
} | ||
} |
Oops, something went wrong.