Skip to content

Commit b5ba798

Browse files
committed

18 files changed

+737
-0
lines changed

.classpath

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="src" path="src"/>
4+
<classpathentry kind="src" path="test"/>
5+
<classpathentry kind="con" path="com.google.gwt.eclipse.core.GWT_CONTAINER"/>
6+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
7+
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/3"/>
8+
<classpathentry kind="output" path="war/WEB-INF/classes"/>
9+
</classpath>

.project

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>StockWatcher</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.jdt.core.javabuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
<buildCommand>
14+
<name>com.google.gwt.eclipse.core.gwtProjectValidator</name>
15+
<arguments>
16+
</arguments>
17+
</buildCommand>
18+
<buildCommand>
19+
<name>com.google.gdt.eclipse.core.webAppProjectValidator</name>
20+
<arguments>
21+
</arguments>
22+
</buildCommand>
23+
</buildSpec>
24+
<natures>
25+
<nature>org.eclipse.jdt.core.javanature</nature>
26+
<nature>com.google.gwt.eclipse.core.gwtNature</nature>
27+
<nature>com.google.gdt.eclipse.core.webAppNature</nature>
28+
</natures>
29+
</projectDescription>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#Thu Dec 03 14:38:21 EST 2009
2+
eclipse.preferences.version=1
3+
filesCopiedToWebInfLib=gwt-servlet.jar

README.txt

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
--- Generated by GWT WebAppCreator ---
2+
3+
Congratulations, you've successfully generated a starter project! What next?
4+
5+
-- Option A: Import your project into Eclipse (recommended) --
6+
7+
If you use Eclipse, you can simply import the generated project into Eclipse.
8+
We've tested against Eclipse 3.3 and 3.4. Later versions will likely also work,
9+
earlier versions may not.
10+
11+
In Eclipse, go to the File menu and choose:
12+
13+
File -> Import... -> Existing Projects into Workspace
14+
15+
Browse to the directory containing this file,
16+
select "StockWatcher".
17+
18+
Be sure to uncheck "Copy projects into workspace" if it is checked.
19+
20+
Click Finish.
21+
22+
You can now browse the project in Eclipse.
23+
24+
To launch your web app in GWT hosted mode, go to the Run menu and choose:
25+
26+
Run -> Open Debug Dialog...
27+
28+
Under Java Application, you should find a launch configuration
29+
named "StockWatcher". Select and click "Debug".
30+
31+
You can now use the built-in debugger to debug your web app in hosted mode.
32+
33+
To compile for web mode, just run your app in hosted mode and press the
34+
"Compile/Browse" button.
35+
36+
-- Option B: Build from the command line with Ant --
37+
38+
If you prefer to work from the command line, you can use Ant to build your
39+
project. (http://ant.apache.org/) Ant uses the generated 'build.xml' file
40+
which describes exactly how to build your project. This file has been tested
41+
to work against Ant 1.7.1. The following assumes 'ant' is on your command
42+
line path.
43+
44+
To run hosted mode, just type 'ant hosted'.
45+
46+
To compile your project for deployment, just type 'ant'.
47+
48+
To compile and also bundle into a .war file, type 'ant war'.
49+
50+
For a full listing of other targets, type 'ant -p'.
51+
52+
-- Option C: Using another IDE --
53+
54+
GWT projects can be run in other IDEs as well, but will require some manual
55+
setup. If you go this route, be sure to:
56+
57+
* Have your IDE build .class files into 'war/WEB-INF/classes'.
58+
* Add gwt-user.jar and gwt-dev-<platform>.jar to your project build path.
59+
* When creating a launch configuration, add a classpath entry for your 'src'
60+
folder (this is somewhat unusual but GWT needs access to your source files).
61+
62+
If you get stuck, try to mimic what the Ant 'build.xml' would do.

StockWatcherTest-dev.launch

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<launchConfiguration type="org.eclipse.jdt.junit.launchconfig">
3+
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
4+
<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
5+
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.google.gwt.sample.stockwatcher.client.StockWatcherTest"/>
6+
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
7+
<listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
8+
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry containerPath=&quot;org.eclipse.jdt.launching.JRE_CONTAINER&quot; javaProject=&quot;StockWatcher&quot; path=&quot;1&quot; type=&quot;4&quot;/&gt;&#13;&#10;"/>
9+
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/StockWatcher/src&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#13;&#10;"/>
10+
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/StockWatcher/test&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#13;&#10;"/>
11+
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry id=&quot;org.eclipse.jdt.launching.classpathentry.defaultClasspath&quot;&gt;&#13;&#10;&lt;memento project=&quot;StockWatcher&quot;/&gt;&#13;&#10;&lt;/runtimeClasspathEntry&gt;&#13;&#10;"/>
12+
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry externalArchive=&quot;/usr/local/google/jlabanca/gwt_all/gwt-2.0.0/gwt-dev.jar&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#13;&#10;"/>
13+
</listAttribute>
14+
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="StockWatcher"/>
15+
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dgwt.args=&quot;-logLevel WARN&quot; -Xmx256M"/>
16+
<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
17+
</launchConfiguration>

StockWatcherTest-prod.launch

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<launchConfiguration type="org.eclipse.jdt.junit.launchconfig">
3+
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
4+
<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
5+
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.google.gwt.sample.stockwatcher.client.StockWatcherTest"/>
6+
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
7+
<listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
8+
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry containerPath=&quot;org.eclipse.jdt.launching.JRE_CONTAINER&quot; javaProject=&quot;StockWatcher&quot; path=&quot;1&quot; type=&quot;4&quot;/&gt;&#13;&#10;"/>
9+
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/StockWatcher/src&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#13;&#10;"/>
10+
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/StockWatcher/test&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#13;&#10;"/>
11+
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry id=&quot;org.eclipse.jdt.launching.classpathentry.defaultClasspath&quot;&gt;&#13;&#10;&lt;memento project=&quot;StockWatcher&quot;/&gt;&#13;&#10;&lt;/runtimeClasspathEntry&gt;&#13;&#10;"/>
12+
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry externalArchive=&quot;/usr/local/google/jlabanca/gwt_all/gwt-2.0.0/gwt-dev.jar&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#13;&#10;"/>
13+
</listAttribute>
14+
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="StockWatcher"/>
15+
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dgwt.args=&quot;-prod -logLevel WARN -out www-test&quot; -Xmx256M"/>
16+
<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
17+
</launchConfiguration>

build.xml

+131
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<project name="StockWatcher" default="build" basedir=".">
3+
<!-- Configure path to GWT SDK -->
4+
<property name="gwt.sdk" location="/path/to/gwt.sdk" />
5+
6+
<path id="project.class.path">
7+
<pathelement location="war/WEB-INF/classes"/>
8+
<pathelement location="${gwt.sdk}/gwt-user.jar"/>
9+
<fileset dir="${gwt.sdk}" includes="gwt-dev*.jar"/>
10+
<!-- Add any additional non-server libs (such as JUnit) -->
11+
<fileset dir="war/WEB-INF/lib" includes="**/*.jar"/>
12+
</path>
13+
14+
<target name="libs" description="Copy libs to WEB-INF/lib">
15+
<mkdir dir="war/WEB-INF/lib" />
16+
<copy todir="war/WEB-INF/lib" file="${gwt.sdk}/gwt-servlet.jar" />
17+
<!-- Add any additional server libs that need to be copied -->
18+
</target>
19+
20+
<target name="javac" depends="libs" description="Compile java source">
21+
<mkdir dir="war/WEB-INF/classes"/>
22+
<javac srcdir="src" includes="**" encoding="utf-8"
23+
destdir="war/WEB-INF/classes"
24+
source="1.5" target="1.5" nowarn="true"
25+
debug="true" debuglevel="lines,vars,source">
26+
<classpath refid="project.class.path"/>
27+
</javac>
28+
<copy todir="war/WEB-INF/classes">
29+
<fileset dir="src" excludes="**/*.java"/>
30+
</copy>
31+
</target>
32+
33+
<target name="gwtc" depends="javac" description="GWT compile to JavaScript">
34+
<java failonerror="true" fork="true" classname="com.google.gwt.dev.Compiler">
35+
<classpath>
36+
<pathelement location="src"/>
37+
<path refid="project.class.path"/>
38+
</classpath>
39+
<!-- add jvmarg -Xss16M or similar if you see a StackOverflowError -->
40+
<jvmarg value="-Xmx256M"/>
41+
<!-- Additional arguments like -style PRETTY or -logLevel DEBUG -->
42+
<arg value="com.google.gwt.sample.stockwatcher.StockWatcher"/>
43+
</java>
44+
</target>
45+
46+
<target name="devmode" depends="javac" description="Run development mode">
47+
<java failonerror="true" fork="true" classname="com.google.gwt.dev.DevMode">
48+
<classpath>
49+
<pathelement location="src"/>
50+
<path refid="project.class.path"/>
51+
</classpath>
52+
<jvmarg value="-Xmx256M"/>
53+
<arg value="-startupUrl"/>
54+
<arg value="StockWatcher.html"/>
55+
<!-- Additional arguments like -style PRETTY or -logLevel DEBUG -->
56+
<arg value="com.google.gwt.sample.stockwatcher.StockWatcher"/>
57+
</java>
58+
</target>
59+
60+
<target name="javac.tests" depends="javac" description="Compiles test code">
61+
<javac srcdir="test" includes="**" encoding="utf-8"
62+
source="1.5" target="1.5" nowarn="true"
63+
debug="true" debuglevel="lines,vars,source">
64+
<classpath location="path_to_the_junit_jar"/>
65+
<classpath refid="project.class.path"/>
66+
</javac>
67+
</target>
68+
69+
<target name="test.dev" depends="javac.tests" description="Run development mode tests">
70+
<mkdir dir="reports/htmlunit.dev" />
71+
<junit fork="yes" printsummary="yes" haltonfailure="yes">
72+
<jvmarg line="-Xmx256m" />
73+
<sysproperty key="gwt.args" value="-logLevel WARN" />
74+
<sysproperty key="java.awt.headless" value="true" />
75+
<classpath>
76+
<pathelement location="src" />
77+
<pathelement location="test" />
78+
<path refid="project.class.path" />
79+
<pathelement location="path_to_the_junit_jar" />
80+
</classpath>
81+
<batchtest todir="reports/htmlunit.dev" >
82+
<fileset dir="test" >
83+
<include name="**/*Test.java" />
84+
</fileset>
85+
</batchtest>
86+
<formatter type="plain" />
87+
<formatter type="xml" />
88+
</junit>
89+
</target>
90+
91+
<target name="test.prod" depends="javac.tests" description="Run production mode tests">
92+
<mkdir dir="reports/htmlunit.prod" />
93+
<junit fork="yes" printsummary="yes" haltonfailure="yes">
94+
<jvmarg line="-Xmx256m" />
95+
<sysproperty key="gwt.args" value="-prod -logLevel WARN -out www-test" />
96+
<sysproperty key="java.awt.headless" value="true" />
97+
<classpath>
98+
<pathelement location="src" />
99+
<pathelement location="test" />
100+
<path refid="project.class.path" />
101+
<pathelement location="path_to_the_junit_jar" />
102+
</classpath>
103+
<batchtest todir="reports/htmlunit.prod" >
104+
<fileset dir="test" >
105+
<include name="**/*Test.java" />
106+
</fileset>
107+
</batchtest>
108+
<formatter type="plain" />
109+
<formatter type="xml" />
110+
</junit>
111+
</target>
112+
113+
<target name="test" description="Run development and production mode tests">
114+
<antcall target="test.dev" />
115+
<antcall target="test.prod" />
116+
</target>
117+
118+
<target name="hosted" depends="devmode" description="Run development mode (NOTE: the 'hosted' target is deprecated)" />
119+
120+
<target name="build" depends="gwtc" description="Build this project" />
121+
122+
<target name="war" depends="build" description="Create a war file">
123+
<zip destfile="StockWatcher.war" basedir="war"/>
124+
</target>
125+
126+
<target name="clean" description="Cleans this project">
127+
<delete dir="war/WEB-INF/classes" failonerror="false" />
128+
<delete dir="war/stockwatcher" failonerror="false" />
129+
</target>
130+
131+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 1.6.2//EN" "http://google-web-toolkit.googlecode.com/svn/tags/1.6.2/distro-source/core/src/gwt-module.dtd">
3+
<module rename-to='stockwatcher'>
4+
<!-- Inherit the core Web Toolkit stuff. -->
5+
<inherits name='com.google.gwt.user.User'/>
6+
7+
<!-- Inherit the default GWT style sheet. You can change -->
8+
<!-- the theme of your GWT application by uncommenting -->
9+
<!-- any one of the following lines. -->
10+
<inherits name='com.google.gwt.user.theme.standard.Standard'/>
11+
<!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
12+
<!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/> -->
13+
14+
<!-- Other module inherits -->
15+
16+
<!-- Specify the app entry point class. -->
17+
<entry-point class='com.google.gwt.sample.stockwatcher.client.StockWatcher'/>
18+
</module>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package com.google.gwt.sample.stockwatcher.client;
2+
3+
import com.google.gwt.user.client.rpc.RemoteService;
4+
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
5+
6+
/**
7+
* The client side stub for the RPC service.
8+
*/
9+
@RemoteServiceRelativePath("greet")
10+
public interface GreetingService extends RemoteService {
11+
String greetServer(String name);
12+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package com.google.gwt.sample.stockwatcher.client;
2+
3+
import com.google.gwt.user.client.rpc.AsyncCallback;
4+
5+
/**
6+
* The async counterpart of <code>GreetingService</code>.
7+
*/
8+
public interface GreetingServiceAsync {
9+
void greetServer(String input, AsyncCallback<String> callback);
10+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
package com.google.gwt.sample.stockwatcher.client;
2+
3+
public class StockPrice {
4+
5+
private String symbol;
6+
private double price;
7+
private double change;
8+
9+
public StockPrice() {
10+
}
11+
12+
public StockPrice(String symbol, double price, double change) {
13+
this.symbol = symbol;
14+
this.price = price;
15+
this.change = change;
16+
}
17+
18+
public String getSymbol() {
19+
return this.symbol;
20+
}
21+
22+
public double getPrice() {
23+
return this.price;
24+
}
25+
26+
public double getChange() {
27+
return this.change;
28+
}
29+
30+
public double getChangePercent() {
31+
return 100.0 * this.change / this.price;
32+
}
33+
34+
public void setSymbol(String symbol) {
35+
this.symbol = symbol;
36+
}
37+
38+
public void setPrice(double price) {
39+
this.price = price;
40+
}
41+
42+
public void setChange(double change) {
43+
this.change = change;
44+
}
45+
}

0 commit comments

Comments
 (0)