Merging releases/1.6@4385:4459 into trunk.
svn merge --accept=postpone -r4385:4459 https://google-web-toolkit.googlecode.com/svn/releases/1.6 .
I had to manually merge the following things:
- Consistent line endings for ProxyCreator; 1.6@4388
- PermutationWorkerFactory actually fails compiles on error; 1.6@4405
- CompilingClassLoader CompilationUnit-based JSNI injection (for Emma); 1.6@4446
- Pruner sort & format; 1.6@4458
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@4488 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/build-tools/ant-gwt/src/com/google/gwt/ant/taskdefs/SvnInfo.java b/build-tools/ant-gwt/src/com/google/gwt/ant/taskdefs/SvnInfo.java
index 280c200..f326367 100644
--- a/build-tools/ant-gwt/src/com/google/gwt/ant/taskdefs/SvnInfo.java
+++ b/build-tools/ant-gwt/src/com/google/gwt/ant/taskdefs/SvnInfo.java
@@ -1,12 +1,12 @@
/*
* Copyright 2008 Google Inc.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -25,27 +25,29 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-
/**
* A Svn interface task, because the initial solution of <exec> and
- * <propertyregex> is unhappy in ant 1.6.5, and while that's old, it's not
- * quite "too old" for us to care.
+ * <propertyregex> is unhappy in ant 1.6.5, and while that's old, it's not quite
+ * "too old" for us to care.
*/
public class SvnInfo extends Task {
// URL line from svn info output, selecting the very last term of the URL as
// the branch specifier
private static final String URL_REGEX = "\\s*URL:\\s*https?://.*/([^/]*)\\s*";
-
-
+
+ private String fileprop;
+
+ private String outprop;
+
+ private String workdir;
+
public SvnInfo() {
super();
}
@Override
public void execute() throws BuildException {
- String result;
-
if (outprop == null) {
throw new BuildException(
"<svninfo> task requires an outputproperty attribute");
@@ -73,34 +75,37 @@
getProject().setNewProperty(outprop, branch + "@" + revision);
if (fileprop != null) {
- getProject().setNewProperty(fileprop, branch + "-"
- + revision.replaceAll(":", "-"));
+ getProject().setNewProperty(fileprop,
+ branch + "-" + revision.replaceAll(":", "-"));
}
}
/**
- * Establishes the property containing the SVN output string, branch@rev.
- * @param propname Name of a property
+ * Establishes the directory used as the SVN workspace to fetch version
+ * information.
+ *
+ * @param srcdir workspace directory name
*/
- public void setOutputProperty(String propname) {
- outprop = propname;
+ public void setDirectory(String srcdir) {
+ workdir = srcdir;
}
/**
* Establishes the property containing the SVN output string, branch@rev.
- * @param propname Name of a property
+ *
+ * @param propname Name of a property
*/
public void setOutputFileProperty(String propname) {
fileprop = propname;
}
/**
- * Establishes the directory used as the SVN workspace to fetch version
- * information about
- * @param srcdir workspace directory name
+ * Establishes the property containing the SVN output string, branch@rev.
+ *
+ * @param propname Name of a property
*/
- public void setDirectory(String srcdir) {
- workdir = srcdir;
+ public void setOutputProperty(String propname) {
+ outprop = propname;
}
private String getSvnBranch(File workdir) {
@@ -109,24 +114,24 @@
LineNumberReader svnout = runCommand(workdir, "svn", "info");
try {
String line = svnout.readLine();
-
+
Pattern urlRegex = Pattern.compile(URL_REGEX);
while (line != null) {
Matcher m = urlRegex.matcher(line);
-
+
if (m.matches()) {
branchName = m.group(1);
if (branchName == null || "".equals(branchName)) {
- throw new BuildException("svn info didn't get branch from URL line "
- + line);
+ throw new BuildException(
+ "svn info didn't get branch from URL line " + line);
}
break;
}
line = svnout.readLine();
}
} catch (IOException e) {
- throw new BuildException("<svninfo> cannot read svn info's output stream",
- e);
+ throw new BuildException(
+ "<svninfo> cannot read svn info's output stream", e);
}
return branchName;
}
@@ -138,8 +143,8 @@
try {
line = svnout.readLine();
} catch (IOException e) {
- throw new BuildException("<svninfo> cannot read svnversion's output stream",
- e);
+ throw new BuildException(
+ "<svninfo> cannot read svnversion's output stream", e);
}
if (line == null || "".equals(line)) {
throw new BuildException("svnversion didn't give any answer");
@@ -147,13 +152,13 @@
return line;
}
- private LineNumberReader runCommand (File workdir, String... cmd) {
+ private LineNumberReader runCommand(File workdir, String... cmd) {
String cmdString = "";
for (String arg : cmd) {
cmdString = cmdString + arg + " ";
}
cmdString = cmdString.substring(0, cmdString.length() - 1);
-
+
ProcessBuilder svnPb = new ProcessBuilder(cmd);
svnPb.directory(workdir);
Process svnproc;
@@ -162,9 +167,9 @@
} catch (IOException e) {
throw new BuildException("cannot launch command " + cmdString, e);
}
-
- LineNumberReader svnerr =
- new LineNumberReader(new InputStreamReader(svnproc.getErrorStream()));
+
+ LineNumberReader svnerr = new LineNumberReader(new InputStreamReader(
+ svnproc.getErrorStream()));
try {
String line = svnerr.readLine();
String errorText = "";
@@ -173,20 +178,15 @@
errorText = errorText + " " + line + "\n";
line = svnerr.readLine();
}
- throw new BuildException(cmdString + " returned error output:\n"
+ throw new BuildException(cmdString + " returned error output:\n"
+ errorText);
}
} catch (IOException e) {
- throw new BuildException("cannot read error stream from " + cmdString,
- e);
+ throw new BuildException("cannot read error stream from " + cmdString, e);
}
-
- LineNumberReader svnout =
- new LineNumberReader(new InputStreamReader(svnproc.getInputStream()));
+
+ LineNumberReader svnout = new LineNumberReader(new InputStreamReader(
+ svnproc.getInputStream()));
return svnout;
}
-
- private String fileprop;
- private String outprop;
- private String workdir;
}
diff --git a/dev-ext/build.xml b/dev-ext/build.xml
new file mode 100644
index 0000000..8be986b
--- /dev/null
+++ b/dev-ext/build.xml
@@ -0,0 +1,24 @@
+<project name="dev-ext" default="build" basedir=".">
+ <property name="gwt.root" location=".." />
+ <property name="project.tail" value="dev-ext" />
+ <import file="${gwt.root}/common.ant.xml" />
+
+ <property.ensure name="gwt.dev.src" location="${gwt.root}/dev/core/src" />
+ <property.ensure name="gwt.dev.bin" location="${gwt.build.out}/dev/core/bin" />
+
+ <target name="build" description="Packages this project into a jar">
+ <mkdir dir="${gwt.build.lib}" />
+ <gwt.jar>
+ <fileset dir="${gwt.dev.src}">
+ <include name="com/google/gwt/core/ext/*.java" />
+ </fileset>
+ <fileset dir="${gwt.dev.bin}">
+ <include name="com/google/gwt/core/ext/*.class" />
+ </fileset>
+ </gwt.jar>
+ </target>
+
+ <target name="clean" description="Cleans this project's intermediate and output files">
+ <delete file="${project.lib}" />
+ </target>
+</project>
diff --git a/dev/core/src/com/google/gwt/core/ext/typeinfo/JClassType.java b/dev/core/src/com/google/gwt/core/ext/typeinfo/JClassType.java
index 3acd448..17f0d83 100644
--- a/dev/core/src/com/google/gwt/core/ext/typeinfo/JClassType.java
+++ b/dev/core/src/com/google/gwt/core/ext/typeinfo/JClassType.java
@@ -27,12 +27,6 @@
HasMetaData {
/**
- * Cached set of supertypes for this type (including itself). If null,
- * the set has not been calculated yet.
- */
- private Set<JClassType> flattenedSupertypes;
-
- /**
* Returns all of the superclasses and superinterfaces for a given type
* including the type itself.
*/
@@ -327,6 +321,12 @@
}
}
+ /**
+ * Cached set of supertypes for this type (including itself). If null,
+ * the set has not been calculated yet.
+ */
+ private Set<JClassType> flattenedSupertypes;
+
public abstract void addImplementedInterface(JClassType intf);
public abstract void addMetaData(String tagName, String[] values);
diff --git a/dev/core/src/com/google/gwt/core/linker/SingleScriptLinker.java b/dev/core/src/com/google/gwt/core/linker/SingleScriptLinker.java
index 790c1cc..7a69716 100644
--- a/dev/core/src/com/google/gwt/core/linker/SingleScriptLinker.java
+++ b/dev/core/src/com/google/gwt/core/linker/SingleScriptLinker.java
@@ -26,7 +26,6 @@
import com.google.gwt.core.ext.linker.impl.SelectionScriptLinker;
import com.google.gwt.dev.About;
import com.google.gwt.dev.util.DefaultTextOutput;
-import com.google.gwt.dev.util.Util;
import java.util.Collection;
import java.util.Set;
@@ -73,16 +72,13 @@
DefaultTextOutput out = new DefaultTextOutput(true);
- // Emit the selection script in a function closure.
- out.print("(function () {");
- out.newlineOpt();
+ // Emit the selection script.
String bootstrap = generateSelectionScript(logger, context, artifacts);
bootstrap = context.optimizeJavaScript(logger, bootstrap);
out.print(bootstrap);
- out.print("})();");
out.newlineOpt();
- // Emit the module's JS in another closure
+ // Emit the module's JS a closure.
out.print("(function () {");
out.newlineOpt();
out.print("var $gwt_version = \"" + About.GWT_VERSION_NUM + "\";");
@@ -116,22 +112,15 @@
}
out.print(js[0]);
- // Add a callback to the selection script
+ // Generate the call to tell the bootstrap code that we're ready to go.
out.newlineOpt();
- out.print("if (" + context.getModuleFunctionName() + ") {");
- out.newlineOpt();
- out.print(" var __gwt_initHandlers = " + context.getModuleFunctionName()
- + ".__gwt_initHandlers;");
- out.print(" " + context.getModuleFunctionName()
- + ".onScriptLoad(gwtOnLoad);");
- out.newlineOpt();
- out.print("}");
+ out.print("if (" + context.getModuleFunctionName() + ") "
+ + context.getModuleFunctionName() + ".onScriptLoad();");
out.newlineOpt();
out.print("})();");
out.newlineOpt();
- byte[] selectionScriptBytes = Util.getBytes(out.toString());
- return emitBytes(logger, selectionScriptBytes, context.getModuleName()
+ return emitString(logger, out.toString(), context.getModuleName()
+ ".nocache.js");
}
diff --git a/dev/core/src/com/google/gwt/core/linker/SingleScriptTemplate.js b/dev/core/src/com/google/gwt/core/linker/SingleScriptTemplate.js
index d7c6c3d..3668e91 100644
--- a/dev/core/src/com/google/gwt/core/linker/SingleScriptTemplate.js
+++ b/dev/core/src/com/google/gwt/core/linker/SingleScriptTemplate.js
@@ -1,5 +1,5 @@
/*
- * Copyright 2007 Google Inc.
+ * Copyright 2008 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
@@ -14,7 +14,7 @@
* the License.
*/
-window.__MODULE_FUNC__ = function() {
+function __MODULE_FUNC__() {
// ---------------- INTERNAL GLOBALS ----------------
// Cache symbols locally for good obfuscation
@@ -77,17 +77,23 @@
}
// Determine our own script's URL via magic :)
+ // This function produces one side-effect, it sets base to the module's
+ // base url.
//
function computeScriptBase() {
- // see if gwt.js left a marker for us
- var thisScript, markerScript;
+ var thisScript
+ ,markerId = "__gwt_marker___MODULE_NAME__"
+ ,markerScript;
- // try writing a marker
- $doc.write('<script id="__gwt_marker___MODULE_NAME__"></script>');
- markerScript = $doc.getElementById("__gwt_marker___MODULE_NAME__");
- if (markerScript) {
- // this script should be the previous element
- thisScript = markerScript.previousSibling;
+ $doc.write('<script id="' + markerId + '"></script>');
+ markerScript = $doc.getElementById(markerId);
+
+ // Our script element is assumed to be the closest previous script element
+ // to the marker, so start at the marker and walk backwards until we find
+ // a script.
+ thisScript = markerScript && markerScript.previousSibling;
+ while (thisScript && thisScript.tagName != 'SCRIPT') {
+ thisScript = thisScript.previousSibling;
}
// Gets the part of a url up to and including the 'path' portion.
@@ -217,6 +223,12 @@
// --------------- STRAIGHT-LINE CODE ---------------
+ if (isHostedMode()) {
+ alert("Single-script hosted mode not yet implemented. See issue " +
+ "http://code.google.com/p/google-web-toolkit/issues/detail?id=2079");
+ return;
+ }
+
// do it early for compile/browse rebasing
computeScriptBase();
processMetas();
@@ -243,7 +255,9 @@
// For everyone that supports DOMContentLoaded.
if ($doc.addEventListener) {
- $doc.addEventListener("DOMContentLoaded", onBodyDone, false);
+ $doc.addEventListener("DOMContentLoaded", function() {
+ onBodyDone();
+ }, false);
}
// Fallback. If onBodyDone() gets fired twice, it's not a big deal.
diff --git a/dev/core/src/com/google/gwt/core/linker/XSLinker.java b/dev/core/src/com/google/gwt/core/linker/XSLinker.java
index 8d2d9fc..0511b40 100644
--- a/dev/core/src/com/google/gwt/core/linker/XSLinker.java
+++ b/dev/core/src/com/google/gwt/core/linker/XSLinker.java
@@ -96,14 +96,8 @@
// Generate the call to tell the bootstrap code that we're ready to go.
out.newlineOpt();
- out.print("if (" + context.getModuleFunctionName() + ") {");
- out.newlineOpt();
- out.print(" var __gwt_initHandlers = " + context.getModuleFunctionName()
- + ".__gwt_initHandlers;");
- out.print(" " + context.getModuleFunctionName()
- + ".onScriptLoad(gwtOnLoad);");
- out.newlineOpt();
- out.print("}");
+ out.print("if (" + context.getModuleFunctionName() + ") "
+ + context.getModuleFunctionName() + ".onScriptLoad();");
out.newlineOpt();
out.print("})();");
out.newlineOpt();
diff --git a/dev/core/src/com/google/gwt/dev/About.java b/dev/core/src/com/google/gwt/dev/About.java
index b64eb5a..e6dabfb 100644
--- a/dev/core/src/com/google/gwt/dev/About.java
+++ b/dev/core/src/com/google/gwt/dev/About.java
@@ -42,11 +42,14 @@
}
GWT_SVNREV = props.getProperty("gwt.svnrev");
- if (GWT_SVNREV == null) {
+ // Check for null or sentinel value (break up to avoid text replace)
+ if (GWT_SVNREV == null || GWT_SVNREV.equals("@GWT_" + "SVNREV@")) {
GWT_SVNREV = "unknown";
}
+
GWT_VERSION_NUM = props.getProperty("gwt.version");
- if (GWT_VERSION_NUM == null) {
+ // Check for null or sentinel value (break up to avoid text replace)
+ if (GWT_VERSION_NUM == null || GWT_VERSION_NUM.equals("@GWT_" + "VERSION@")) {
GWT_VERSION_NUM = "0.0.0";
}
GWT_VERSION = GWT_NAME + " " + GWT_VERSION_NUM;
diff --git a/dev/core/src/com/google/gwt/dev/ArgProcessorBase.java b/dev/core/src/com/google/gwt/dev/ArgProcessorBase.java
index 3f38920..641ae7a 100644
--- a/dev/core/src/com/google/gwt/dev/ArgProcessorBase.java
+++ b/dev/core/src/com/google/gwt/dev/ArgProcessorBase.java
@@ -20,7 +20,7 @@
/**
* Base class for new-style argument processors.
*/
-abstract class ArgProcessorBase extends ToolBase {
+public abstract class ArgProcessorBase extends ToolBase {
/*
* Overridden to make public.
*/
diff --git a/dev/core/src/com/google/gwt/dev/CompileArgProcessor.java b/dev/core/src/com/google/gwt/dev/CompileArgProcessor.java
index 56eb33c..d0964de 100644
--- a/dev/core/src/com/google/gwt/dev/CompileArgProcessor.java
+++ b/dev/core/src/com/google/gwt/dev/CompileArgProcessor.java
@@ -25,6 +25,11 @@
registerHandler(new ArgHandlerLogLevel(options));
registerHandler(new ArgHandlerTreeLoggerFlag(options));
registerHandler(new ArgHandlerWorkDirRequired(options));
- registerHandler(new ArgHandlerModuleName(options));
+ registerHandler(new ArgHandlerModuleName(options) {
+ @Override
+ public String getPurpose() {
+ return super.getPurpose() + " to compile";
+ }
+ });
}
}
diff --git a/dev/core/src/com/google/gwt/dev/CompilePerms.java b/dev/core/src/com/google/gwt/dev/CompilePerms.java
index a35da85..5efa683 100644
--- a/dev/core/src/com/google/gwt/dev/CompilePerms.java
+++ b/dev/core/src/com/google/gwt/dev/CompilePerms.java
@@ -175,24 +175,21 @@
/**
* Compile a single permutation.
+ *
+ * @throws UnableToCompleteException if the permutation compile fails
*/
public static PermutationResult compile(TreeLogger logger,
- Permutation permutation, UnifiedAst unifiedAst) {
- try {
- return JavaToJavaScriptCompiler.compilePermutation(logger, unifiedAst,
- permutation.getRebindAnswers());
- } catch (UnableToCompleteException e) {
- // We intentionally don't pass in the exception here since the real
- // cause has been logged.
- return null;
- }
+ Permutation permutation, UnifiedAst unifiedAst)
+ throws UnableToCompleteException {
+ return JavaToJavaScriptCompiler.compilePermutation(logger, unifiedAst,
+ permutation.getRebindAnswers());
}
/**
* Compile multiple permutations.
*/
- public static void compile(TreeLogger logger,
- Precompilation precompilation, Permutation[] perms, int localWorkers,
+ public static void compile(TreeLogger logger, Precompilation precompilation,
+ Permutation[] perms, int localWorkers,
List<FileBackedObject<PermutationResult>> resultFiles)
throws UnableToCompleteException {
final TreeLogger branch = logger.branch(TreeLogger.INFO, "Compiling "
diff --git a/dev/core/src/com/google/gwt/dev/CompilePermsServer.java b/dev/core/src/com/google/gwt/dev/CompilePermsServer.java
index 3971ef7..93111de 100644
--- a/dev/core/src/com/google/gwt/dev/CompilePermsServer.java
+++ b/dev/core/src/com/google/gwt/dev/CompilePermsServer.java
@@ -282,27 +282,32 @@
} catch (ClassNotFoundException e) {
logger.log(TreeLogger.ERROR, "Probable client/server mismatch or "
+ "classpath misconfiguration", e);
- } catch (UnableToCompleteException e) {
- logger.log(TreeLogger.ERROR, "Internal compiler error", e);
}
return false;
}
static void compilePermutation(TreeLogger logger, UnifiedAst ast,
ObjectInputStream in, ObjectOutputStream out)
- throws ClassNotFoundException, IOException, UnableToCompleteException {
+ throws ClassNotFoundException, IOException {
FileBackedObject<PermutationResult> resultFile = (FileBackedObject<PermutationResult>) in.readObject();
Permutation p = (Permutation) in.readObject();
logger.log(TreeLogger.SPAM, "Permutation read");
- PermutationResult result = CompilePerms.compile(logger.branch(
- TreeLogger.DEBUG, "Compiling"), p, ast);
- logger.log(TreeLogger.DEBUG, "Successfully compiled permutation");
+ Throwable caught = null;
+ try {
+ PermutationResult result = CompilePerms.compile(logger.branch(
+ TreeLogger.DEBUG, "Compiling"), p, ast);
+ resultFile.set(logger, result);
+ logger.log(TreeLogger.DEBUG, "Successfully compiled permutation");
+ } catch (UnableToCompleteException e) {
+ caught = e;
+ } catch (Throwable e) {
+ logger.log(TreeLogger.ERROR, "Compile failed", e);
+ caught = e;
+ }
- resultFile.set(logger, result);
-
- // Send a placeholder null indicating no Throwable
- out.writeObject(null);
+ // Might send a placeholder null indicating no Throwable.
+ out.writeObject(caught);
out.flush();
logger.log(TreeLogger.SPAM, "Sent result");
}
diff --git a/dev/core/src/com/google/gwt/dev/ExternalPermutationWorkerFactory.java b/dev/core/src/com/google/gwt/dev/ExternalPermutationWorkerFactory.java
index 312e4bd..2b0790e 100644
--- a/dev/core/src/com/google/gwt/dev/ExternalPermutationWorkerFactory.java
+++ b/dev/core/src/com/google/gwt/dev/ExternalPermutationWorkerFactory.java
@@ -150,7 +150,6 @@
logger.log(TreeLogger.ERROR, "Error from external worker", t);
throw new UnableToCompleteException();
}
-
} catch (IOException e) {
logger.log(TreeLogger.WARN, "Lost communication with remote process", e);
throw new TransientWorkerException(
diff --git a/dev/core/src/com/google/gwt/dev/GWTShell.java b/dev/core/src/com/google/gwt/dev/GWTShell.java
index 705eb28..c9955de 100644
--- a/dev/core/src/com/google/gwt/dev/GWTShell.java
+++ b/dev/core/src/com/google/gwt/dev/GWTShell.java
@@ -174,7 +174,9 @@
protected void compile(TreeLogger logger, ModuleDef moduleDef)
throws UnableToCompleteException {
LegacyCompilerOptions newOptions = new GWTCompilerOptionsImpl(options);
- new GWTCompiler(newOptions).run(logger, moduleDef);
+ if (!new GWTCompiler(newOptions).run(logger, moduleDef)) {
+ throw new UnableToCompleteException();
+ }
}
@Override
diff --git a/dev/core/src/com/google/gwt/dev/HostedMode.java b/dev/core/src/com/google/gwt/dev/HostedMode.java
index cebda22..90a4920 100644
--- a/dev/core/src/com/google/gwt/dev/HostedMode.java
+++ b/dev/core/src/com/google/gwt/dev/HostedMode.java
@@ -31,13 +31,11 @@
import com.google.gwt.dev.util.arg.ArgHandlerModuleName;
import com.google.gwt.dev.util.arg.ArgHandlerWarDir;
import com.google.gwt.dev.util.arg.ArgHandlerWorkDirOptional;
-import com.google.gwt.dev.util.log.PrintWriterTreeLogger;
import com.google.gwt.util.tools.ArgHandlerString;
import com.google.gwt.util.tools.Utility;
import java.io.File;
import java.io.IOException;
-import java.io.PrintWriter;
import java.net.BindException;
import java.util.HashMap;
import java.util.Map;
@@ -150,7 +148,12 @@
registerHandler(new ArgHandlerExtraDir(options));
registerHandler(new ArgHandlerWorkDirOptional(options));
registerHandler(new ArgHandlerLocalWorkers(options));
- registerHandler(new ArgHandlerModuleName(options));
+ registerHandler(new ArgHandlerModuleName(options) {
+ @Override
+ public String getPurpose() {
+ return super.getPurpose() + " to host";
+ }
+ });
}
@Override
@@ -233,9 +236,6 @@
System.exit(-1);
}
- protected final PrintWriterTreeLogger console = new PrintWriterTreeLogger(
- new PrintWriter(System.err, true));
-
/**
* Hiding super field because it's actually the same object, just with a
* stronger type.
@@ -264,10 +264,6 @@
*/
private boolean tempWorkDir = false;
- {
- console.setMaxDetail(TreeLogger.WARN);
- }
-
/**
* Default constructor for testing; no public API yet.
*/
@@ -346,7 +342,7 @@
+ "'; add servlet tags to your web.xml instead");
}
- link(loadLogger, module, false);
+ link(loadLogger, module);
} catch (UnableToCompleteException e) {
// Already logged.
return false;
@@ -400,7 +396,7 @@
shouldRefreshPage = true;
module = loadModule(getTopLogger(), module.getCanonicalName(), false);
}
- link(getTopLogger(), module, true);
+ link(getTopLogger(), module);
return shouldRefreshPage;
} catch (UnableToCompleteException e) {
// Already logged.
@@ -429,8 +425,8 @@
* the link, otherwise do not include them
* @throws UnableToCompleteException
*/
- private void link(TreeLogger logger, ModuleDef module,
- boolean includePublicFiles) throws UnableToCompleteException {
+ private void link(TreeLogger logger, ModuleDef module)
+ throws UnableToCompleteException {
// TODO: move the module-specific computations to a helper function.
File moduleOutDir = new File(options.getWarDir(), module.getName());
File moduleExtraDir = (options.getExtraDir() == null) ? null : new File(
@@ -441,10 +437,6 @@
module, options);
linkerStacks.put(module.getName(), linkerStack);
- if (!includePublicFiles) {
- linkerStack.getArtifacts().clear();
- }
-
ArtifactSet artifacts = linkerStack.invokeLink(logger);
linkerStack.produceOutputDirectory(logger, artifacts, moduleOutDir,
moduleExtraDir);
diff --git a/dev/core/src/com/google/gwt/dev/HostedModeBase.java b/dev/core/src/com/google/gwt/dev/HostedModeBase.java
index 0685260..92e8b13 100644
--- a/dev/core/src/com/google/gwt/dev/HostedModeBase.java
+++ b/dev/core/src/com/google/gwt/dev/HostedModeBase.java
@@ -501,17 +501,14 @@
*/
public final void run() {
try {
- if (!startUp()) {
- // Failed to initalize.
- return;
+ if (startUp()) {
+ // Eager AWT init for OS X to ensure safe coexistence with SWT.
+ BootStrapPlatform.initGui();
+
+ // Tomcat's running now, so launch browsers for startup urls now.
+ launchStartupUrls(getTopLogger());
}
- // Eager AWT initialization for OS X to ensure safe coexistence with SWT.
- BootStrapPlatform.initGui();
-
- // Tomcat's running now, so launch browsers for startup urls now.
- launchStartupUrls(getTopLogger());
-
pumpEventLoop();
} catch (Exception e) {
e.printStackTrace();
diff --git a/dev/core/src/com/google/gwt/dev/PermutationWorker.java b/dev/core/src/com/google/gwt/dev/PermutationWorker.java
index be16ba2..124c497 100644
--- a/dev/core/src/com/google/gwt/dev/PermutationWorker.java
+++ b/dev/core/src/com/google/gwt/dev/PermutationWorker.java
@@ -34,7 +34,7 @@
*
* @throws TransientWorkerException if the Permutation should be tried again
* on another worker
- * @throws UnableToCompleteException due to a fatal error
+ * @throws UnableToCompleteException if the compile fails for any reason
*/
void compile(TreeLogger logger, Permutation permutation,
FileBackedObject<PermutationResult> resultFile)
diff --git a/dev/core/src/com/google/gwt/dev/PermutationWorkerFactory.java b/dev/core/src/com/google/gwt/dev/PermutationWorkerFactory.java
index 6c50d96..cc324c5 100644
--- a/dev/core/src/com/google/gwt/dev/PermutationWorkerFactory.java
+++ b/dev/core/src/com/google/gwt/dev/PermutationWorkerFactory.java
@@ -78,7 +78,6 @@
} catch (UnableToCompleteException e) {
logger.log(TreeLogger.ERROR,
"Unrecoverable exception, shutting down", e);
- threadDeathResult = Result.FAIL;
return;
}
}
diff --git a/dev/core/src/com/google/gwt/dev/javac/CompilationState.java b/dev/core/src/com/google/gwt/dev/javac/CompilationState.java
index 0ad7a78..3ada290 100644
--- a/dev/core/src/com/google/gwt/dev/javac/CompilationState.java
+++ b/dev/core/src/com/google/gwt/dev/javac/CompilationState.java
@@ -261,5 +261,6 @@
exposedUnits = Collections.unmodifiableSet(new HashSet<CompilationUnit>(
unitMap.values()));
exposedClassFileMap = null;
+ exposedClassFileMapBySource = null;
}
}
diff --git a/dev/core/src/com/google/gwt/dev/javac/CompilationUnit.java b/dev/core/src/com/google/gwt/dev/javac/CompilationUnit.java
index 210995c..f5a77bd 100644
--- a/dev/core/src/com/google/gwt/dev/javac/CompilationUnit.java
+++ b/dev/core/src/com/google/gwt/dev/javac/CompilationUnit.java
@@ -15,7 +15,11 @@
*/
package com.google.gwt.dev.javac;
+import com.google.gwt.dev.asm.ClassReader;
+import com.google.gwt.dev.asm.Opcodes;
+import com.google.gwt.dev.asm.commons.EmptyVisitor;
import com.google.gwt.dev.jdt.TypeRefVisitor;
+import com.google.gwt.dev.shell.CompilingClassLoader;
import org.eclipse.jdt.core.compiler.CategorizedProblem;
import org.eclipse.jdt.internal.compiler.ASTVisitor;
@@ -26,9 +30,12 @@
import org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope;
import org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding;
+import java.util.ArrayList;
import java.util.Collections;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.IdentityHashMap;
+import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -39,6 +46,25 @@
*/
public abstract class CompilationUnit {
+ static class AnonymousClassVisitor extends EmptyVisitor {
+ /*
+ * array of classNames of inner clases that aren't synthetic.
+ */
+ List<String> classNames = new ArrayList<String>();
+
+ public List<String> getInnerClassNames() {
+ return classNames;
+ }
+
+ @Override
+ public void visitInnerClass(String name, String outerName,
+ String innerName, int access) {
+ if ((access & Opcodes.ACC_SYNTHETIC) == 0) {
+ classNames.add(name);
+ }
+ }
+ }
+
/**
* Tracks the state of a compilation unit through the compile and recompile
* process.
@@ -128,12 +154,45 @@
return result;
}
+ /**
+ * Map from the className in javac to the className in jdt. String represents
+ * the part of className after the compilation unit name. Emma-specific.
+ */
+ private Map<String, String> anonymousClassMap = null;
private CompilationUnitDeclaration cud;
private CategorizedProblem[] errors;
private Set<CompiledClass> exposedCompiledClasses;
private Set<String> fileNameRefs;
+ private List<JsniMethod> jsniMethods = null;
private State state = State.FRESH;
+ /*
+ * Check if the unit has one or more anonymous classes. 'javac' below refers
+ * to the compiler that was used to compile the java files on disk. Returns
+ * true if our heuristic for constructing the anonymous class mappings worked.
+ */
+ public boolean constructAnonymousClassMappings(byte classBytes[]) {
+ // map from the name in javac to the name in jdt
+ anonymousClassMap = new HashMap<String, String>();
+ List<String> javacClasses = getJavacClassNames(classBytes);
+ List<String> jdtClasses = getJdtClassNames();
+ if (javacClasses.size() == jdtClasses.size()) {
+ int size = javacClasses.size();
+ for (int i = 0; i < size; i++) {
+ if (!javacClasses.get(i).equals(jdtClasses.get(i))) {
+ anonymousClassMap.put(javacClasses.get(i), jdtClasses.get(i));
+ }
+ }
+ return true;
+ }
+ anonymousClassMap = Collections.emptyMap();
+ return false;
+ }
+
+ public boolean createdClassMapping() {
+ return anonymousClassMap != null;
+ }
+
/**
* Overridden to finalize; always returns object identity.
*/
@@ -142,12 +201,33 @@
return super.equals(obj);
}
+ public Map<String, String> getAnonymousClassMap() {
+ /*
+ * Return an empty map so that class-rewriter does not need to check for
+ * null. A null value indicates that anonymousClassMap was never created
+ * which is the case for many units. An example is a class containing jsni
+ * units but no inner classes.
+ */
+ if (anonymousClassMap == null) {
+ return Collections.emptyMap();
+ }
+ return anonymousClassMap;
+ }
+
/**
* Returns the user-relevant location of the source file. No programmatic
* assumptions should be made about the return value.
*/
public abstract String getDisplayLocation();
+ public boolean getJsniInjected() {
+ return jsniMethods != null;
+ }
+
+ public List<JsniMethod> getJsniMethods() {
+ return jsniMethods;
+ }
+
/**
* Returns the last modified time of the compilation unit.
*/
@@ -163,6 +243,15 @@
*/
public abstract String getTypeName();
+ public boolean hasAnonymousClasses() {
+ for (CompiledClass cc : getCompiledClasses()) {
+ if (isAnonymousClass(cc)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
/**
* Overridden to finalize; always returns identity hash code.
*/
@@ -189,7 +278,7 @@
public abstract boolean isGenerated();
/**
- *
+ *
* @return true if the Compilation Unit is from a super-source.
*/
public abstract boolean isSuperSource();
@@ -257,6 +346,10 @@
state = State.COMPILED;
}
+ void setJsniMethods(List<JsniMethod> jsniMethods) {
+ this.jsniMethods = Collections.unmodifiableList(jsniMethods);
+ }
+
/**
* Changes the compilation unit's internal state.
*/
@@ -290,12 +383,39 @@
}
}
+ private List<String> getJavacClassNames(byte classBytes[]) {
+ AnonymousClassVisitor cv = new AnonymousClassVisitor();
+ new ClassReader(classBytes).accept(cv, 0);
+ List<String> classNames = cv.getInnerClassNames();
+ List<String> namesToRemove = new ArrayList<String>();
+ for (String className : classNames) {
+ if (!CompilingClassLoader.isClassnameGenerated(className)) {
+ namesToRemove.add(className);
+ }
+ }
+ classNames.removeAll(namesToRemove);
+ Collections.sort(classNames, new GeneratedClassnameComparator());
+ return classNames;
+ }
+
+ private List<String> getJdtClassNames() {
+ List<String> classNames = new ArrayList<String>();
+ for (CompiledClass cc : getCompiledClasses()) {
+ if (isAnonymousClass(cc)) {
+ classNames.add(cc.getBinaryName());
+ }
+ }
+ Collections.sort(classNames, new GeneratedClassnameComparator());
+ return classNames;
+ }
+
/**
* Removes all accumulated state associated with compilation.
*/
private void invalidate() {
cud = null;
fileNameRefs = null;
+ jsniMethods = null;
if (exposedCompiledClasses != null) {
for (CompiledClass compiledClass : exposedCompiledClasses) {
compiledClass.invalidate();
@@ -303,4 +423,12 @@
exposedCompiledClasses = null;
}
}
+
+ private boolean isAnonymousClass(CompiledClass cc) {
+ if (!cc.getRealClassType().isLocalType()) {
+ return false;
+ }
+ return CompilingClassLoader.isClassnameGenerated(cc.getBinaryName());
+ }
+
}
diff --git a/dev/core/src/com/google/gwt/dev/javac/CompiledClass.java b/dev/core/src/com/google/gwt/dev/javac/CompiledClass.java
index 44e8e90..29ad532 100644
--- a/dev/core/src/com/google/gwt/dev/javac/CompiledClass.java
+++ b/dev/core/src/com/google/gwt/dev/javac/CompiledClass.java
@@ -27,9 +27,6 @@
import org.eclipse.jdt.internal.compiler.lookup.LocalTypeBinding;
import org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding;
-import java.util.Collections;
-import java.util.List;
-
/**
* Encapsulates the state of a single compiled class file.
*/
@@ -61,7 +58,6 @@
protected final CompilationUnit unit;
// The state below is transient.
- private List<JsniMethod> jsniMethods;
private NameEnvironmentAnswer nameEnvironmentAnswer;
private JRealClassType realClassType;
// Can be killed after parent is CHECKED.
@@ -106,10 +102,6 @@
return enclosingClass;
}
- public List<JsniMethod> getJsniMethods() {
- return jsniMethods;
- }
-
/**
* Returns the enclosing package, e.g. {@code java.util}.
*/
@@ -163,17 +155,12 @@
void invalidate() {
nameEnvironmentAnswer = null;
typeDeclaration = null;
- jsniMethods = null;
if (realClassType != null) {
realClassType.invalidate();
realClassType = null;
}
}
- void setJsniMethods(List<JsniMethod> jsniMethods) {
- this.jsniMethods = Collections.unmodifiableList(jsniMethods);
- }
-
void setRealClassType(JRealClassType realClassType) {
this.realClassType = realClassType;
}
diff --git a/dev/core/src/com/google/gwt/dev/javac/GeneratedClassnameComparator.java b/dev/core/src/com/google/gwt/dev/javac/GeneratedClassnameComparator.java
new file mode 100644
index 0000000..e7280b2
--- /dev/null
+++ b/dev/core/src/com/google/gwt/dev/javac/GeneratedClassnameComparator.java
@@ -0,0 +1,82 @@
+/*
+ * Copyright 2008 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.dev.javac;
+
+import java.util.Comparator;
+
+class GeneratedClassnameComparator implements Comparator<String> {
+
+ public int compare(String arg0, String arg1) {
+ String pattern = "\\$";
+ String splits0[] = arg0.split(pattern);
+ String splits1[] = arg1.split(pattern);
+ if (splits0.length != splits1.length) {
+ return splits0.length - splits1.length;
+ }
+ for (int i = 0; i < splits0.length; i++) {
+ int answer = compareWithoutDollars(splits0[i], splits1[i]);
+ if (answer != 0) {
+ return answer;
+ }
+ }
+ return 0;
+ }
+
+ /*
+ * 3 cases: (i) both can be converted to integer: compare the integral value.
+ * (ii) only one can be converted to integer: the one with integral value is
+ * lower. (iii) none can be converted to integer: compare the strings.
+ */
+ private int compareWithoutDollars(String arg0, String arg1) {
+ boolean arg0IsInt = false;
+ boolean arg1IsInt = false;
+ int int0 = 0, int1 = 0;
+ if ((arg0 == null) != (arg1 == null)) {
+ return (arg0 == null) ? -1 : 1;
+ }
+ if (arg0 == null) {
+ return 0;
+ }
+
+ if (arg0.charAt(0) != '-') {
+ try {
+ int0 = Integer.parseInt(arg0);
+ arg0IsInt = true;
+ } catch (NumberFormatException ex) {
+ // ignored
+ }
+ }
+
+ if (arg1.charAt(0) != '-') {
+ try {
+ int1 = Integer.parseInt(arg1);
+ arg1IsInt = true;
+ } catch (NumberFormatException ex) {
+ // ignored
+ }
+ }
+
+ if (arg0IsInt != arg1IsInt) {
+ return arg0IsInt ? -1 : 1;
+ }
+
+ // now either both are int or both are Strings
+ if (arg0IsInt) {
+ return int0 - int1;
+ }
+ return arg0.compareTo(arg1);
+ }
+}
diff --git a/dev/core/src/com/google/gwt/dev/javac/JsniCollector.java b/dev/core/src/com/google/gwt/dev/javac/JsniCollector.java
index 2df9839..0bc1d6f 100644
--- a/dev/core/src/com/google/gwt/dev/javac/JsniCollector.java
+++ b/dev/core/src/com/google/gwt/dev/javac/JsniCollector.java
@@ -65,7 +65,7 @@
private final String[] paramNames;
private final String source;
private final JsProgram program;
-
+
private JsniMethodImpl(String name, String source, String[] paramNames,
int line, String location, JsProgram program) {
this.name = name;
@@ -143,10 +143,13 @@
if (unit.getState() == State.COMPILED) {
String loc = unit.getDisplayLocation();
String source = unit.getSource();
+ assert unit.getJsniMethods() == null;
+ List<JsniMethod> jsniMethods = new ArrayList<JsniMethod>();
for (CompiledClass compiledClass : unit.getCompiledClasses()) {
- assert compiledClass.getJsniMethods() == null;
- collectJsniMethods(logger, loc, source, compiledClass, program);
+ jsniMethods.addAll(collectJsniMethods(logger, loc, source,
+ compiledClass, program));
}
+ unit.setJsniMethods(jsniMethods);
}
}
}
@@ -154,8 +157,8 @@
/**
* TODO: log real errors, replacing GenerateJavaScriptAST?
*/
- private static void collectJsniMethods(TreeLogger logger, String loc,
- String source, CompiledClass compiledClass, JsProgram program) {
+ private static List<JsniMethod> collectJsniMethods(TreeLogger logger,
+ String loc, String source, CompiledClass compiledClass, JsProgram program) {
TypeDeclaration typeDecl = compiledClass.getTypeDeclaration();
int[] lineEnds = typeDecl.compilationResult.getLineSeparatorPositions();
List<JsniMethod> jsniMethods = new ArrayList<JsniMethod>();
@@ -184,7 +187,7 @@
startLine, loc, program));
}
}
- compiledClass.setJsniMethods(jsniMethods);
+ return jsniMethods;
}
private static Interval findJsniSource(String source,
diff --git a/dev/core/src/com/google/gwt/dev/jjs/impl/ControlFlowAnalyzer.java b/dev/core/src/com/google/gwt/dev/jjs/impl/ControlFlowAnalyzer.java
index bcac220..d401d5e 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/impl/ControlFlowAnalyzer.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/impl/ControlFlowAnalyzer.java
@@ -121,11 +121,12 @@
boolean doSkip = false;
JExpression lhs = x.getLhs();
if (lhs.hasSideEffects() || isVolatileField(lhs)) {
- // If the lhs has side effects, skipping it would lose the side
- // effect.
- // If the lhs is volatile, also keep it. This behavior provides a
- // useful
- // idiom for test cases to prevent code from being pruned.
+ /*
+ * If the lhs has side effects, skipping it would lose the side
+ * effect. If the lhs is volatile, also keep it. This behavior
+ * provides a useful idiom for test cases to prevent code from being
+ * pruned.
+ */
} else if (lhs instanceof JLocalRef) {
// locals are ok to skip
doSkip = true;
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsRootScope.java b/dev/core/src/com/google/gwt/dev/js/ast/JsRootScope.java
index 95ce00a..62b564b 100644
--- a/dev/core/src/com/google/gwt/dev/js/ast/JsRootScope.java
+++ b/dev/core/src/com/google/gwt/dev/js/ast/JsRootScope.java
@@ -74,13 +74,33 @@
// B.2 Additional Properties (non-normative)
"escape", "unescape",
+ // Window props (http://www.w3schools.com/HTMLDOM/dom_obj_window.asp)
+ "closed", "defaultStatus", "document", "frames", "history", "length",
+ "location", "name", "opener", "outerHeight", "outerWidth",
+ "pageXOffset", "pageYOffset", "parent", "personalbar", "scrollbars",
+ "self", "status", "statusbar", "toolbar", "top",
+
+ // Window methods (http://www.w3schools.com/HTMLDOM/dom_obj_window.asp)
+ "alert", "blur", "clearInterval", "clearTimeout", "close", "confirm",
+ "createPopup", "focus", "moveBy", "moveTo", "open", "print", "prompt",
+ "resizeBy", "resizeTo", "scrollBy", "scrollTo", "setInterval",
+ "setTimeout",
+
+ // IE event methods
+ // (http://msdn.microsoft.com/en-us/library/ms535873(VS.85).aspx#)
+ "onafterprint", "onbeforedeactivate", "onbeforeprint",
+ "onbeforeunload", "onblur", "oncontrolselect", "ondeactivate",
+ "onerror", "onfocus", "onhashchange ", "onhelp", "onload", "onresize",
+ "onresizeend", "onscroll",
+ "onunload",
+
// Common browser-defined identifiers not defined in ECMAScript
- "window", "document", "event", "location", "history", "external",
+ "window", "dispatchEvent", "event", "external", "navigator", "screen",
"Debug", "Enumerator", "Global", "Image", "ActiveXObject", "VBArray",
"Components",
// Functions commonly defined on Object
- "toString", "getClass",
+ "toString", "getClass", "constructor", "prototype",
// GWT-defined identifiers
"$wnd", "$doc", "$moduleName", "$moduleBase", "$gwt_version",
diff --git a/dev/core/src/com/google/gwt/dev/shell/CompilingClassLoader.java b/dev/core/src/com/google/gwt/dev/shell/CompilingClassLoader.java
index 10bdbef..d5c86f2 100644
--- a/dev/core/src/com/google/gwt/dev/shell/CompilingClassLoader.java
+++ b/dev/core/src/com/google/gwt/dev/shell/CompilingClassLoader.java
@@ -23,7 +23,9 @@
import com.google.gwt.core.ext.typeinfo.JParameter;
import com.google.gwt.core.ext.typeinfo.TypeOracle;
import com.google.gwt.dev.javac.CompilationState;
+import com.google.gwt.dev.javac.CompilationUnit;
import com.google.gwt.dev.javac.CompiledClass;
+import com.google.gwt.dev.javac.JsniMethod;
import com.google.gwt.dev.shell.rewrite.HostedModeClassRewriter;
import com.google.gwt.dev.shell.rewrite.HostedModeClassRewriter.InstanceMethodOracle;
import com.google.gwt.dev.util.JsniRef;
@@ -45,14 +47,16 @@
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.Stack;
+import java.util.regex.Pattern;
/**
* An isolated {@link ClassLoader} for running all user code. All user files are
- * compiled from source code byte a {@link ByteCodeCompiler}. After compilation,
- * some byte code rewriting is performed to support
+ * compiled from source code byte a {@link ByteCodeCompiler}. After
+ * compilation, some byte code rewriting is performed to support
* <code>JavaScriptObject</code> and its subtypes.
*
* TODO: we should refactor this class to move the getClassInfoByDispId,
@@ -352,10 +356,12 @@
private static final String CLASS_DUMP_PATH = "rewritten-classes";
- private static boolean emmaIsAvailable = false;
+ private static boolean emmaAvailable = false;
private static EmmaStrategy emmaStrategy;
+ private static final Pattern GENERATED_CLASSNAME_PATTERN = Pattern.compile(".+\\$\\d+(\\$.*)?");
+
/**
* Caches the byte code for {@link JavaScriptHost}.
*/
@@ -376,10 +382,28 @@
Class<?> emmaBridge = Class.forName(EmmaStrategy.EMMA_RT_CLASSNAME,
false, Thread.currentThread().getContextClassLoader());
BRIDGE_CLASS_NAMES.put(EmmaStrategy.EMMA_RT_CLASSNAME, emmaBridge);
- emmaIsAvailable = true;
+ emmaAvailable = true;
} catch (ClassNotFoundException ignored) {
}
- emmaStrategy = EmmaStrategy.get(emmaIsAvailable);
+ emmaStrategy = EmmaStrategy.get(emmaAvailable);
+ }
+
+ /**
+ * Checks if the class names is generated. Accepts any classes whose names
+ * match .+$\d+($.*)? (handling named classes within anonymous classes).
+ * Checks if the class or any of its enclosing classes are anonymous or
+ * synthetic.
+ * <p>
+ * If new compilers have different conventions for anonymous and synthetic
+ * classes, this code needs to be updated.
+ * </p>
+ *
+ * @param className name of the class to be checked.
+ * @return true iff class or any of its enclosing classes are anonymous or
+ * synthetic.
+ */
+ public static boolean isClassnameGenerated(String className) {
+ return GENERATED_CLASSNAME_PATTERN.matcher(className).matches();
}
private static void classDump(String name, byte[] bytes) {
@@ -456,6 +480,11 @@
}
}
+ /**
+ * The set of units whose JSNI has already been injected.
+ */
+ private Set<CompilationUnit> alreadyInjected = new HashSet<CompilationUnit>();
+
private final HostedModeClassRewriter classRewriter;
private CompilationState compilationState;
@@ -464,10 +493,20 @@
private Class<?> gwtClass, javaScriptHostClass;
+ /**
+ * Used by {@link #findClass(String)} to prevent reentrant JSNI injection.
+ */
+ private boolean isInjectingClass = false;
+
private final TreeLogger logger;
private ShellJavaScriptHost shellJavaScriptHost;
+ /**
+ * Used by {@link #findClass(String)} to prevent reentrant JSNI injection.
+ */
+ private Stack<CompilationUnit> toInject = new Stack<CompilationUnit>();
+
private final TypeOracle typeOracle;
@SuppressWarnings("unchecked")
@@ -478,16 +517,6 @@
private final Map<Integer, Object> weakJsoCache = new ReferenceMap(
AbstractReferenceMap.HARD, AbstractReferenceMap.WEAK);
- /**
- * Used by {@link #findClass(String)} to prevent reentrant JSNI injection.
- */
- private boolean isInjectingClass = false;
-
- /**
- * Used by {@link #findClass(String)} to prevent reentrant JSNI injection.
- */
- private Stack<CompiledClass> toInject = new Stack<CompiledClass>();
-
public CompilingClassLoader(TreeLogger logger,
CompilationState compilationState, ShellJavaScriptHost javaScriptHost)
throws UnableToCompleteException {
@@ -568,8 +597,8 @@
* was previously cached and has not been garbage collected.
*
* @param javaObject the Object being wrapped
- * @return the mapped wrapper, or <code>null</code> if the Java object mapped
- * or if the wrapper has been garbage collected
+ * @return the mapped wrapper, or <code>null</code> if the Java object
+ * mapped or if the wrapper has been garbage collected
*/
public Object getWrapperForObject(Object javaObject) {
return weakJavaWrapperCache.get(javaObject);
@@ -604,13 +633,6 @@
new NullPointerException());
}
- // Don't mess with anything in the standard Java packages.
- //
- if (isInStandardJavaPackage(className)) {
- // make my superclass load it
- throw new ClassNotFoundException(className);
- }
-
// Check for a bridge class that spans hosted and user space.
if (BRIDGE_CLASS_NAMES.containsKey(className)) {
return BRIDGE_CLASS_NAMES.get(className);
@@ -650,10 +672,9 @@
* class is loaded.
*/
if (!classRewriter.isJsoIntf(className)) {
- CompiledClass compiledClass = compilationState.getClassFileMap().get(
- canonicalizeClassName(className));
- if (compiledClass != null) {
- toInject.push(compiledClass);
+ CompilationUnit unit = getUnitForClassName(className);
+ if (unit != null) {
+ toInject.push(unit);
}
}
@@ -664,7 +685,11 @@
* additional entries to be added.
*/
while (toInject.size() > 0) {
- injectJsniFor(toInject.remove(0));
+ CompilationUnit unit = toInject.remove(0);
+ if (!alreadyInjected.contains(unit)) {
+ injectJsniMethods(unit);
+ alreadyInjected.add(unit);
+ }
}
} finally {
isInjectingClass = false;
@@ -718,41 +743,71 @@
CompiledClass compiledClass = compilationState.getClassFileMap().get(
lookupClassName);
+ CompilationUnit unit = (compiledClass == null)
+ ? getUnitForClassName(className) : compiledClass.getUnit();
+ if (emmaAvailable) {
+ /*
+ * build the map for anonymous classes. Do so only if unit has anonymous
+ * classes, jsni methods, is not super-source and the map has not been
+ * built before.
+ */
+ List<JsniMethod> jsniMethods = (unit == null) ? null
+ : unit.getJsniMethods();
+ if (unit != null && !unit.isSuperSource() && unit.hasAnonymousClasses()
+ && jsniMethods != null && jsniMethods.size() > 0
+ && !unit.createdClassMapping()) {
+ String mainLookupClassName = unit.getTypeName().replace('.', '/');
+ byte mainClassBytes[] = emmaStrategy.getEmmaClassBytes(null,
+ mainLookupClassName, 0);
+ if (mainClassBytes != null) {
+ if (!unit.constructAnonymousClassMappings(mainClassBytes)) {
+ logger.log(TreeLogger.ERROR,
+ "Our heuristic for mapping anonymous classes between compilers "
+ + "failed. Unsafe to continue because the wrong jsni code "
+ + "could end up running. className = " + className);
+ return null;
+ }
+ } else {
+ logger.log(TreeLogger.ERROR, "main class bytes is null for unit = "
+ + unit + ", mainLookupClassName = " + mainLookupClassName);
+ }
+ }
+ }
+
byte classBytes[] = null;
if (compiledClass != null) {
classBytes = compiledClass.getBytes();
if (!compiledClass.getUnit().isSuperSource()) {
- /*
- * It is okay if Emma throws away the old classBytes since the actual
- * jsni injection happens in the rewriter. The injectJsniFor method
- * above simply defines the native methods in the browser.
- */
classBytes = emmaStrategy.getEmmaClassBytes(classBytes,
lookupClassName, compiledClass.getUnit().getLastModified());
} else {
logger.log(TreeLogger.SPAM, "no emma instrumentation for "
+ lookupClassName + " because it is from super-source");
}
- } else if (emmaIsAvailable) {
+ } else if (emmaAvailable) {
/*
* TypeOracle does not know about this class. Most probably, this class
* was referenced in one of the classes loaded from disk. Check if we can
* find it on disk. Typically this is a synthetic class added by the
- * compiler. If the synthetic class contains native methods, it will fail
- * later.
+ * compiler.
*/
- if (isSynthetic(className)) {
+ if (shouldLoadClassFromDisk(className)) {
/*
* modification time = 0 ensures that whatever is on the disk is always
* loaded.
*/
- logger.log(TreeLogger.SPAM, "EmmaStrategy: loading " + lookupClassName
+ logger.log(TreeLogger.DEBUG, "EmmaStrategy: loading " + lookupClassName
+ " from disk even though TypeOracle does not know about it");
classBytes = emmaStrategy.getEmmaClassBytes(null, lookupClassName, 0);
}
}
if (classBytes != null && classRewriter != null) {
- byte[] newBytes = classRewriter.rewrite(className, classBytes);
+ Map<String, String> anonymousClassMap = Collections.emptyMap();
+ if (unit != null) {
+ anonymousClassMap = unit.getAnonymousClassMap();
+ }
+ byte[] newBytes = classRewriter.rewrite(className, classBytes,
+ anonymousClassMap);
if (CLASS_DUMP) {
if (!Arrays.equals(classBytes, newBytes)) {
classDump(className, newBytes);
@@ -769,49 +824,36 @@
return name;
}
- private void injectJsniFor(CompiledClass compiledClass) {
- shellJavaScriptHost.createNativeMethods(logger, compiledClass,
- compiledClass.getJsniMethods(), this);
- }
-
/**
- * NOTE: This logic is also used in SerializableTypeOracleBuilder; don't
- * change this one without changing the other.
- */
- private boolean isInStandardJavaPackage(String className) {
- if (className.startsWith("java.")) {
- return true;
- }
-
- if (className.startsWith("javax.")) {
- return true;
- }
-
- return false;
- }
-
- /**
- * For safety, we only allow synthetic classes to be loaded this way. Accepts
- * any classes whose names match .+$\d+
+ * Returns the compilationUnit corresponding to the className.
* <p>
- * If new compilers have different conventions for synthetic classes, this
- * code needs to be updated.
- * </p>
- *
- * @param className class to be loaded from disk.
- * @return true iff class should be loaded from disk
+ * Not considering classnames where a $ sign appears.
*/
- private boolean isSynthetic(String className) {
- int index = className.lastIndexOf("$");
- if (index <= 0 || index == className.length() - 1) {
- return false;
+ private CompilationUnit getUnitForClassName(String className) {
+ String mainTypeName = className;
+ int index = mainTypeName.length();
+ CompilationUnit unit = null;
+ while (unit == null && index != -1) {
+ mainTypeName = mainTypeName.substring(0, index);
+ unit = compilationState.getCompilationUnitMap().get(mainTypeName);
+ index = mainTypeName.lastIndexOf('$');
}
- for (int i = index + 1; i < className.length(); i++) {
- if (!Character.isDigit(className.charAt(i))) {
- return false;
- }
+ return unit;
+ }
+
+ private void injectJsniMethods(CompilationUnit unit) {
+ if (unit == null || unit.getJsniMethods() == null) {
+ return;
}
- return true;
+ shellJavaScriptHost.createNativeMethods(logger, unit.getJsniMethods(), this);
+ }
+
+ private boolean isBaseClassInGwt(String className) {
+ return getUnitForClassName(className) != null;
+ }
+
+ private boolean shouldLoadClassFromDisk(String className) {
+ return isBaseClassInGwt(className) && isClassnameGenerated(className);
}
/**
diff --git a/dev/core/src/com/google/gwt/dev/shell/ShellJavaScriptHost.java b/dev/core/src/com/google/gwt/dev/shell/ShellJavaScriptHost.java
index f6fb3ff..967de58 100644
--- a/dev/core/src/com/google/gwt/dev/shell/ShellJavaScriptHost.java
+++ b/dev/core/src/com/google/gwt/dev/shell/ShellJavaScriptHost.java
@@ -17,7 +17,6 @@
import com.google.gwt.core.ext.TreeLogger;
import com.google.gwt.core.ext.UnableToCompleteException;
-import com.google.gwt.dev.javac.CompiledClass;
import com.google.gwt.dev.javac.JsniMethod;
import java.util.List;
@@ -42,8 +41,8 @@
* @param jsniMethods
* @param dispatchIdOracle
*/
- void createNativeMethods(TreeLogger logger, CompiledClass compiledClass,
- List<JsniMethod> jsniMethods, DispatchIdOracle dispatchIdOracle);
+ void createNativeMethods(TreeLogger logger, List<JsniMethod> jsniMethods,
+ DispatchIdOracle dispatchIdOracle);
/**
* Call this when a JavaScript exception is caught.
diff --git a/dev/core/src/com/google/gwt/dev/shell/rewrite/HostedModeClassRewriter.java b/dev/core/src/com/google/gwt/dev/shell/rewrite/HostedModeClassRewriter.java
index 418429b..393c364 100644
--- a/dev/core/src/com/google/gwt/dev/shell/rewrite/HostedModeClassRewriter.java
+++ b/dev/core/src/com/google/gwt/dev/shell/rewrite/HostedModeClassRewriter.java
@@ -33,15 +33,15 @@
* <ol>
* <li>Rewrites all native methods into non-native thunks to call JSNI via
* {@link com.google.gwt.dev.shell.JavaScriptHost}.</li>
- * <li>Rewrites all JSO types into an interface type (which retains the
- * original name) and an implementation type (which has a $ appended).</li>
- * <li>All JSO interface types are empty and mirror the original type
- * hierarchy.</li>
- * <li>All JSO impl types contain the guts of the original type, except that
- * all instance methods are reimplemented as statics.</li>
- * <li>Calls sites to JSO types rewritten to dispatch to impl types. Any
- * virtual calls are also made static. Static field references to JSO types
- * reference static fields in the the impl class.</li>
+ * <li>Rewrites all JSO types into an interface type (which retains the original
+ * name) and an implementation type (which has a $ appended).</li>
+ * <li>All JSO interface types are empty and mirror the original type hierarchy.
+ * </li>
+ * <li>All JSO impl types contain the guts of the original type, except that all
+ * instance methods are reimplemented as statics.</li>
+ * <li>Calls sites to JSO types rewritten to dispatch to impl types. Any virtual
+ * calls are also made static. Static field references to JSO types reference
+ * static fields in the the impl class.</li>
* <li>JavaScriptObject$ implements all the interface types and is the only
* instantiable type.</li>
* </ol>
@@ -167,8 +167,11 @@
*
* @param className the name of the class
* @param classBytes the bytes of the class
+ * @param anonymousClassMap a map between the anonymous class names of java
+ * compiler used to compile code and jdt. Emma-specific.
*/
- public byte[] rewrite(String className, byte[] classBytes) {
+ public byte[] rewrite(String className, byte[] classBytes,
+ Map<String, String> anonymousClassMap) {
String desc = toDescriptor(className);
assert (!jsoIntfDescs.contains(desc));
@@ -185,7 +188,7 @@
v = new WriteJsoImpl(v, jsoIntfDescs, mapper);
}
- v = new RewriteJsniMethods(v);
+ v = new RewriteJsniMethods(v, anonymousClassMap);
if (Double.parseDouble(System.getProperty("java.class.version")) < Opcodes.V1_6) {
v = new ForceClassVersion15(v);
diff --git a/dev/core/src/com/google/gwt/dev/shell/rewrite/RewriteJsniMethods.java b/dev/core/src/com/google/gwt/dev/shell/rewrite/RewriteJsniMethods.java
index a00ce8d..31de8ff 100644
--- a/dev/core/src/com/google/gwt/dev/shell/rewrite/RewriteJsniMethods.java
+++ b/dev/core/src/com/google/gwt/dev/shell/rewrite/RewriteJsniMethods.java
@@ -25,6 +25,7 @@
import com.google.gwt.dev.shell.JavaScriptHost;
import java.lang.reflect.Modifier;
+import java.util.Map;
/**
* Turns native method declarations into normal Java functions which perform the
@@ -224,9 +225,8 @@
/**
* Does all of the work necessary to do the dispatch to the appropriate
- * variant of
- * {@link JavaScriptHost#invokeNativeVoid JavaScriptHost.invokeNative*}.
- * And example output:
+ * variant of {@link JavaScriptHost#invokeNativeVoid
+ * JavaScriptHost.invokeNative*}. And example output:
*
* <pre>
* return JavaScriptHost.invokeNativeInt(
@@ -238,8 +238,8 @@
super.visitCode();
/*
- * If you modify the generated code, you must recompute the stack size
- * in visitEnd().
+ * If you modify the generated code, you must recompute the stack size in
+ * visitEnd().
*/
// First argument - JSNI signature
@@ -322,9 +322,12 @@
* The name of the class we're operating on.
*/
private String classDesc;
+ private Map<String, String> anonymousClassMap;
- public RewriteJsniMethods(ClassVisitor v) {
+ public RewriteJsniMethods(ClassVisitor v,
+ Map<String, String> anonymousClassMap) {
super(v);
+ this.anonymousClassMap = anonymousClassMap;
}
@Override
@@ -356,8 +359,8 @@
*
* @param name the name of the method; for example {@code "echo"}
* @param descriptor the descriptor for the method; for example {@code "(I)I"}
- * @return the JSNI signature for the method; for example,
- * {@code "@com.google.gwt.sample.hello.client.Hello::echo(I)"}
+ * @return the JSNI signature for the method; for example, {@code
+ * "@com.google.gwt.sample.hello.client.Hello::echo(I)"}
*/
private String getJsniSignature(String name, String descriptor) {
int argsIndexBegin = descriptor.indexOf('(');
@@ -367,6 +370,11 @@
+ descriptor;
String argsDescriptor = descriptor.substring(argsIndexBegin,
argsIndexEnd + 1);
- return "@" + classDesc.replace('/', '.') + "::" + name + argsDescriptor;
+ String classDescriptor = classDesc.replace('/', '.');
+ String newDescriptor = anonymousClassMap.get(classDesc);
+ if (newDescriptor != null) {
+ classDescriptor = newDescriptor.replace('/', '.');
+ }
+ return "@" + classDescriptor + "::" + name + argsDescriptor;
}
}
diff --git a/dev/core/src/com/google/gwt/dev/util/Util.java b/dev/core/src/com/google/gwt/dev/util/Util.java
index 6de59ba..feabaf3 100644
--- a/dev/core/src/com/google/gwt/dev/util/Util.java
+++ b/dev/core/src/com/google/gwt/dev/util/Util.java
@@ -729,6 +729,18 @@
return null;
}
+ /**
+ * @return null if the file could not be read
+ */
+ public static String readURLAsString(URL url) {
+ byte[] bytes = readURLAsBytes(url);
+ if (bytes != null) {
+ return toString(bytes, DEFAULT_ENCODING);
+ }
+
+ return null;
+ }
+
public static byte[] readURLConnectionAsBytes(URLConnection connection) {
// ENH: add a weak cache that has an additional check against the file date
InputStream input = null;
diff --git a/dev/core/src/com/google/gwt/dev/util/arg/ArgHandlerModuleName.java b/dev/core/src/com/google/gwt/dev/util/arg/ArgHandlerModuleName.java
index 4b010ed..0f29740 100644
--- a/dev/core/src/com/google/gwt/dev/util/arg/ArgHandlerModuleName.java
+++ b/dev/core/src/com/google/gwt/dev/util/arg/ArgHandlerModuleName.java
@@ -18,9 +18,9 @@
import com.google.gwt.util.tools.ArgHandlerExtra;
/**
- * Argument handler for module name, which has no option profix.
+ * Argument handler for one or more module names at the end of the command line.
*/
-public final class ArgHandlerModuleName extends ArgHandlerExtra {
+public class ArgHandlerModuleName extends ArgHandlerExtra {
private final OptionModuleName option;
@@ -36,12 +36,12 @@
@Override
public String getPurpose() {
- return "Specifies the name of the module to compile";
+ return "Specifies the name(s) of the module(s)";
}
@Override
public String[] getTagArgs() {
- return new String[] {"module"};
+ return new String[] {"module[s]"};
}
@Override
diff --git a/dev/core/src/com/google/gwt/util/tools/Utility.java b/dev/core/src/com/google/gwt/util/tools/Utility.java
index 7d89854..ed1d59c 100644
--- a/dev/core/src/com/google/gwt/util/tools/Utility.java
+++ b/dev/core/src/com/google/gwt/util/tools/Utility.java
@@ -225,10 +225,7 @@
throw new FileNotFoundException(partialPath);
}
ByteArrayOutputStream os = new ByteArrayOutputStream();
- int ch;
- while ((ch = in.read()) != -1) {
- os.write(ch);
- }
+ streamOut(in, os, 1024);
return new String(os.toByteArray(), "UTF-8");
} finally {
close(in);
diff --git a/dev/core/test/com/google/gwt/dev/javac/GeneratedClassnameComparatorTest.java b/dev/core/test/com/google/gwt/dev/javac/GeneratedClassnameComparatorTest.java
new file mode 100644
index 0000000..630d438
--- /dev/null
+++ b/dev/core/test/com/google/gwt/dev/javac/GeneratedClassnameComparatorTest.java
@@ -0,0 +1,49 @@
+package com.google.gwt.dev.javac;
+
+import junit.framework.TestCase;
+
+import java.util.Arrays;
+
+/**
+ *
+ * This class tests to see if the anonymous class names are sorted in the right
+ * order. For example, Foo$10 should be after Foo$2.
+ */
+public class GeneratedClassnameComparatorTest extends TestCase {
+
+ public void testBasicOrder() {
+ int max = 15;
+ String original[] = new String[max];
+ String expected[] = new String[max];
+ for (int i = 0; i < max; i++) {
+ String name = "Foo$" + (i + 1);
+ original[i] = name;
+ expected[i] = name;
+ }
+ Arrays.sort(original, new GeneratedClassnameComparator());
+ for (int i = 0; i < max; i++) {
+ assertEquals("index = " + i, expected[i], original[i]);
+ }
+ }
+
+ public void testHierarchicalOrder() {
+ String original[] = {
+ "Foo$1", "Foo$1$1$1", "Foo$1$2", "Foo$2", "Foo$2$1", "Foo$3",};
+ String expected[] = {
+ "Foo$1", "Foo$2", "Foo$3", "Foo$1$2", "Foo$2$1", "Foo$1$1$1"};
+ Arrays.sort(original, new GeneratedClassnameComparator());
+ for (int i = 0; i < original.length; i++) {
+ assertEquals("index = " + i, expected[i], original[i]);
+ }
+ }
+
+ public void testMixedNames() {
+ String original[] = {"Foo", "Foo$1", "Foo$1xyz", "Foo$2", "Foo$xyz"};
+ String expected[] = {"Foo", "Foo$1", "Foo$2", "Foo$1xyz", "Foo$xyz"};
+ Arrays.sort(original, new GeneratedClassnameComparator());
+ for (int i = 0; i < original.length; i++) {
+ assertEquals("index = " + i, expected[i], original[i]);
+ }
+ }
+
+}
diff --git a/dev/core/test/com/google/gwt/dev/shell/GeneratedClassnameTest.java b/dev/core/test/com/google/gwt/dev/shell/GeneratedClassnameTest.java
new file mode 100644
index 0000000..b5040c1
--- /dev/null
+++ b/dev/core/test/com/google/gwt/dev/shell/GeneratedClassnameTest.java
@@ -0,0 +1,27 @@
+package com.google.gwt.dev.shell;
+
+import junit.framework.TestCase;
+
+public class GeneratedClassnameTest extends TestCase {
+
+ /**
+ * Test if {@link CompilingClassLoader#isClassnameGenerated(String)} works
+ * correctly.
+ */
+ public void testGeneratedClassnames() {
+ String namesToAccept[] = {
+ "Test$1", "Test$10", "Test$Foo$1", "Test$1$Foo", "Test$10$Foo",
+ "$$345", "Test$1$Foo$"};
+ String namesToReject[] = {"Test1", "$345", "Test$2Foo", "Test$Foo$1Bar"};
+
+ for (String name : namesToAccept) {
+ assertTrue("className = " + name + " should have been accepted",
+ CompilingClassLoader.isClassnameGenerated(name));
+ }
+
+ for (String name : namesToReject) {
+ assertFalse("className = " + name + " should not have been accepted",
+ CompilingClassLoader.isClassnameGenerated(name));
+ }
+ }
+}
diff --git a/dev/linux/src/com/google/gwt/dev/shell/moz/ModuleSpaceMoz.java b/dev/linux/src/com/google/gwt/dev/shell/moz/ModuleSpaceMoz.java
index 59a650c..907055d 100644
--- a/dev/linux/src/com/google/gwt/dev/shell/moz/ModuleSpaceMoz.java
+++ b/dev/linux/src/com/google/gwt/dev/shell/moz/ModuleSpaceMoz.java
@@ -16,7 +16,6 @@
package com.google.gwt.dev.shell.moz;
import com.google.gwt.core.ext.TreeLogger;
-import com.google.gwt.dev.javac.CompiledClass;
import com.google.gwt.dev.javac.JsniMethod;
import com.google.gwt.dev.shell.CompilingClassLoader;
import com.google.gwt.dev.shell.DispatchIdOracle;
@@ -56,8 +55,7 @@
* @param jsniMethods
*/
public void createNativeMethods(TreeLogger logger,
- CompiledClass compiledClass, List<JsniMethod> jsniMethods,
- DispatchIdOracle dispatchIdOracle) {
+ List<JsniMethod> jsniMethods, DispatchIdOracle dispatchIdOracle) {
for (JsniMethod jsniMethod : jsniMethods) {
String body = Jsni.getJavaScriptForHostedMode(logger, dispatchIdOracle,
jsniMethod);
diff --git a/dev/mac/src/com/google/gwt/dev/shell/mac/ModuleSpaceSaf.java b/dev/mac/src/com/google/gwt/dev/shell/mac/ModuleSpaceSaf.java
index a7bb9c0..a98f5a0 100644
--- a/dev/mac/src/com/google/gwt/dev/shell/mac/ModuleSpaceSaf.java
+++ b/dev/mac/src/com/google/gwt/dev/shell/mac/ModuleSpaceSaf.java
@@ -16,7 +16,6 @@
package com.google.gwt.dev.shell.mac;
import com.google.gwt.core.ext.TreeLogger;
-import com.google.gwt.dev.javac.CompiledClass;
import com.google.gwt.dev.javac.JsniMethod;
import com.google.gwt.dev.shell.CompilingClassLoader;
import com.google.gwt.dev.shell.DispatchIdOracle;
@@ -56,8 +55,7 @@
}
public void createNativeMethods(TreeLogger logger,
- CompiledClass compiledClass, List<JsniMethod> jsniMethods,
- DispatchIdOracle dispatchIdOracle) {
+ List<JsniMethod> jsniMethods, DispatchIdOracle dispatchIdOracle) {
for (JsniMethod jsniMethod : jsniMethods) {
String body = Jsni.getJavaScriptForHostedMode(logger, dispatchIdOracle,
jsniMethod);
@@ -65,8 +63,8 @@
// The error has been logged; just ignore it for now.
continue;
}
- createNative(jsniMethod.location(),
- jsniMethod.line(), jsniMethod.name(), jsniMethod.paramNames(), body);
+ createNative(jsniMethod.location(), jsniMethod.line(), jsniMethod.name(),
+ jsniMethod.paramNames(), body);
}
}
@@ -105,7 +103,7 @@
int argc = args.length;
int[] argv = new int[argc];
// GC protect passed arguments on the Java stack for call duration.
- JsValueSaf[] jsValueArgs = new JsValueSaf[argc];
+ JsValueSaf[] jsValueArgs = new JsValueSaf[argc];
for (int i = 0; i < argc; ++i) {
JsValueSaf jsValue = jsValueArgs[i] = new JsValueSaf();
JsValueGlue.set(jsValue, isolatedClassLoader, types[i], args[i]);
diff --git a/dev/oophm/src/com/google/gwt/dev/shell/ModuleSpaceOOPHM.java b/dev/oophm/src/com/google/gwt/dev/shell/ModuleSpaceOOPHM.java
index c9a93b1..5250efa 100644
--- a/dev/oophm/src/com/google/gwt/dev/shell/ModuleSpaceOOPHM.java
+++ b/dev/oophm/src/com/google/gwt/dev/shell/ModuleSpaceOOPHM.java
@@ -16,7 +16,6 @@
package com.google.gwt.dev.shell;
import com.google.gwt.core.ext.TreeLogger;
-import com.google.gwt.dev.javac.CompiledClass;
import com.google.gwt.dev.javac.JsniMethod;
import com.google.gwt.dev.shell.JsValue.DispatchObject;
import com.google.gwt.dev.util.Jsni;
@@ -39,13 +38,11 @@
}
public void createNativeMethods(TreeLogger logger,
- CompiledClass compiledClass, List<JsniMethod> jsniMethods,
- DispatchIdOracle dispatchIdOracle) {
+ List<JsniMethod> jsniMethods, DispatchIdOracle dispatchIdOracle) {
if (jsniMethods.isEmpty()) {
return;
}
StringBuilder jsni = new StringBuilder();
- String sourceName = compiledClass.getSourceName();
for (JsniMethod jsniMethod : jsniMethods) {
String body = Jsni.getJavaScriptForHostedMode(logger, dispatchIdOracle,
jsniMethod);
@@ -67,11 +64,10 @@
jsni.append(body);
jsni.append(";\n\n");
}
- logger.log(TreeLogger.DEBUG, "Defining JSNI for " + sourceName);
channel.loadJsni(jsni.toString());
}
-// @Override
+ // @Override
protected void cleanupJsValues() {
Set<Integer> refIdsForCleanup = channel.getRefIdsForCleanup();
if (refIdsForCleanup.isEmpty()) {
@@ -87,12 +83,11 @@
}
/**
- *
+ *
*/
@Override
protected void createStaticDispatcher(TreeLogger logger) {
- channel.loadJsni(
- "function __defineStatic(__arg0) { window.__static = __arg0; }");
+ channel.loadJsni("function __defineStatic(__arg0) { window.__static = __arg0; }");
}
/**
diff --git a/dev/windows/src/com/google/gwt/dev/shell/ie/ModuleSpaceIE6.java b/dev/windows/src/com/google/gwt/dev/shell/ie/ModuleSpaceIE6.java
index 09413fb..9e91cef 100644
--- a/dev/windows/src/com/google/gwt/dev/shell/ie/ModuleSpaceIE6.java
+++ b/dev/windows/src/com/google/gwt/dev/shell/ie/ModuleSpaceIE6.java
@@ -16,7 +16,6 @@
package com.google.gwt.dev.shell.ie;
import com.google.gwt.core.ext.TreeLogger;
-import com.google.gwt.dev.javac.CompiledClass;
import com.google.gwt.dev.javac.JsniMethod;
import com.google.gwt.dev.shell.CompilingClassLoader;
import com.google.gwt.dev.shell.DispatchIdOracle;
@@ -99,8 +98,7 @@
}
public void createNativeMethods(TreeLogger logger,
- CompiledClass compiledClass, List<JsniMethod> jsniMethods,
- DispatchIdOracle dispatchIdOracle) {
+ List<JsniMethod> jsniMethods, DispatchIdOracle dispatchIdOracle) {
for (JsniMethod jsniMethod : jsniMethods) {
String body = Jsni.getJavaScriptForHostedMode(logger, dispatchIdOracle,
jsniMethod);
@@ -108,8 +106,8 @@
// The error has been logged; just ignore it for now.
continue;
}
- createNative(jsniMethod.location(),
- jsniMethod.line(), jsniMethod.name(), jsniMethod.paramNames(), body);
+ createNative(jsniMethod.location(), jsniMethod.line(), jsniMethod.name(),
+ jsniMethod.paramNames(), body);
}
}
diff --git a/distro-source/linux/build.xml b/distro-source/linux/build.xml
index d4fb171..5fde893 100755
--- a/distro-source/linux/build.xml
+++ b/distro-source/linux/build.xml
@@ -49,13 +49,10 @@
<include name="samples" />
<include name="samples/*" />
<include name="samples/*/src/**" />
- <include name="samples/*/bin/**" />
- <include name="samples/*/www/**" />
- <exclude name="samples/*/www/.*/**" />
+ <include name="samples/*/war/**" />
</tarfileset>
<tarfileset dir="${gwt.build.out}/samples-scripts/${dist.platform}" mode="755" prefix="${project.distname}/samples">
- <include name="*/*-compile" />
- <include name="*/*-shell" />
+ <include name="*/*" />
</tarfileset>
<includetar src="${gwt.tools.redist}/mozilla/mozilla-1.7.12.tar.gz" compression="gzip" prefix="${project.distname}" />
diff --git a/distro-source/mac/build.xml b/distro-source/mac/build.xml
index ca97f73..4114eb6 100755
--- a/distro-source/mac/build.xml
+++ b/distro-source/mac/build.xml
@@ -51,13 +51,10 @@
<include name="samples" />
<include name="samples/*" />
<include name="samples/*/src/**" />
- <include name="samples/*/bin/**" />
- <include name="samples/*/www/**" />
- <exclude name="samples/*/www/.*/**" />
+ <include name="samples/*/war/**" />
</tarfileset>
<tarfileset dir="${gwt.build.out}/samples-scripts/${dist.platform}" mode="755" prefix="${project.distname}/samples">
- <include name="*/*-compile" />
- <include name="*/*-shell" />
+ <include name="*/*" />
</tarfileset>
</gwt.tgz.cat>
diff --git a/distro-source/windows/build.xml b/distro-source/windows/build.xml
index 0749c6a..6110f07 100755
--- a/distro-source/windows/build.xml
+++ b/distro-source/windows/build.xml
@@ -39,13 +39,10 @@
<include name="samples" />
<include name="samples/*" />
<include name="samples/*/src/**" />
- <include name="samples/*/bin/**" />
- <include name="samples/*/www/**" />
- <exclude name="samples/*/www/.*/**" />
+ <include name="samples/*/war/**" />
</zipfileset>
<zipfileset dir="${gwt.build.out}/samples-scripts/${dist.platform}" prefix="${project.distname}/samples">
- <include name="*/*-compile.cmd" />
- <include name="*/*-shell.cmd" />
+ <include name="*/*" />
</zipfileset>
</zip>
diff --git a/eclipse/samples/DynaTable/.classpath b/eclipse/samples/DynaTable/.classpath
index 8996e78..26f2949 100644
--- a/eclipse/samples/DynaTable/.classpath
+++ b/eclipse/samples/DynaTable/.classpath
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="core/src"/>
+ <classpathentry kind="src" output="war" path="core/war"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry combineaccessrules="false" kind="src" path="/gwt-user"/>
- <classpathentry kind="output" path="bin"/>
+ <classpathentry kind="output" path="war/WEB-INF/classes"/>
</classpath>
diff --git a/eclipse/samples/DynaTable/.project b/eclipse/samples/DynaTable/.project
index cfe0e91..ff0de95 100644
--- a/eclipse/samples/DynaTable/.project
+++ b/eclipse/samples/DynaTable/.project
@@ -24,7 +24,7 @@
<link>
<name>core</name>
<type>2</type>
- <location>GWT_ROOT/samples/dynatable</location>
+ <locationURI>GWT_ROOT/samples/dynatable</locationURI>
</link>
</linkedResources>
</projectDescription>
diff --git a/eclipse/samples/DynaTable/DynaTable-gwtc.launch b/eclipse/samples/DynaTable/DynaTable-gwtc.launch
new file mode 100644
index 0000000..5284dbf
--- /dev/null
+++ b/eclipse/samples/DynaTable/DynaTable-gwtc.launch
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
+<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
+<listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.launching.JRE_CONTAINER" javaProject="DynaTable" path="1" type="4"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry internalArchive="/DynaTable/core/src" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry internalArchive="/gwt-user/core/src" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry internalArchive="/gwt-user/core/super" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry internalArchive="/gwt-dev-windows/core/super" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry id="org.eclipse.jdt.launching.classpathentry.defaultClasspath"> <memento exportedEntriesOnly="false" project="DynaTable"/> </runtimeClasspathEntry> "/>
+</listAttribute>
+<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.google.gwt.dev.Compiler"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="com.google.gwt.sample.dynatable.DynaTable"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="DynaTable"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-ea -Xmx256M -Dgwt.devjar=${gwt_devjar}"/>
+</launchConfiguration>
diff --git a/eclipse/samples/DynaTable/DynaTable.launch b/eclipse/samples/DynaTable/DynaTable.launch
new file mode 100644
index 0000000..6c971f5
--- /dev/null
+++ b/eclipse/samples/DynaTable/DynaTable.launch
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
+<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
+<listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.launching.JRE_CONTAINER" javaProject="DynaTable" path="1" type="4"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry internalArchive="/DynaTable/core/src" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry internalArchive="/gwt-user/core/src" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry internalArchive="/gwt-user/core/super" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry internalArchive="/gwt-dev-windows/core/super" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry id="org.eclipse.jdt.launching.classpathentry.defaultClasspath"> <memento exportedEntriesOnly="false" project="DynaTable"/> </runtimeClasspathEntry> "/>
+</listAttribute>
+<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.google.gwt.dev.HostedMode"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-startupUrl DynaTable.html com.google.gwt.sample.dynatable.DynaTable"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="DynaTable"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-ea -Xmx256M -Dgwt.devjar=${gwt_devjar}"/>
+</launchConfiguration>
diff --git a/eclipse/samples/DynaTable2/DynaTable2 hosted.launch b/eclipse/samples/DynaTable2/DynaTable2 hosted.launch
index 4231f27..21d67c1 100644
--- a/eclipse/samples/DynaTable2/DynaTable2 hosted.launch
+++ b/eclipse/samples/DynaTable2/DynaTable2 hosted.launch
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
-<listEntry value="/gwt-dev-windows/core/src/com/google/gwt/dev/HostedMode.java"/>
+<listEntry value="/DynaTable2"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
-<listEntry value="1"/>
+<listEntry value="4"/>
</listAttribute>
<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
<listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
diff --git a/eclipse/samples/Hello/.classpath b/eclipse/samples/Hello/.classpath
index 8996e78..26f2949 100644
--- a/eclipse/samples/Hello/.classpath
+++ b/eclipse/samples/Hello/.classpath
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="core/src"/>
+ <classpathentry kind="src" output="war" path="core/war"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry combineaccessrules="false" kind="src" path="/gwt-user"/>
- <classpathentry kind="output" path="bin"/>
+ <classpathentry kind="output" path="war/WEB-INF/classes"/>
</classpath>
diff --git a/eclipse/samples/Hello/.project b/eclipse/samples/Hello/.project
index 7e40312..45a8900 100644
--- a/eclipse/samples/Hello/.project
+++ b/eclipse/samples/Hello/.project
@@ -24,7 +24,7 @@
<link>
<name>core</name>
<type>2</type>
- <location>GWT_ROOT/samples/hello</location>
+ <locationURI>GWT_ROOT/samples/hello</locationURI>
</link>
</linkedResources>
</projectDescription>
diff --git a/eclipse/samples/Hello/Hello compile.launch b/eclipse/samples/Hello/Hello compile.launch
deleted file mode 100644
index 84a3a68..0000000
--- a/eclipse/samples/Hello/Hello compile.launch
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
-<listEntry value="/Hello"/>
-</listAttribute>
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
-<listEntry value="4"/>
-</listAttribute>
-<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
-<listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
-<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.launching.JRE_CONTAINER" javaProject="Hello" path="1" type="4"/> "/>
-<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry internalArchive="/Hello/core/src" path="3" type="2"/> "/>
-<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry internalArchive="/gwt-user/core/src" path="3" type="2"/> "/>
-<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry internalArchive="/gwt-user/core/super" path="3" type="2"/> "/>
-<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry internalArchive="/gwt-dev-windows/core/super" path="3" type="2"/> "/>
-<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry id="org.eclipse.jdt.launching.classpathentry.defaultClasspath"> <memento exportedEntriesOnly="false" project="Hello"/> </runtimeClasspathEntry> "/>
-</listAttribute>
-<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
-<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.google.gwt.dev.GWTCompiler"/>
-<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-out www com.google.gwt.sample.hello.Hello"/>
-<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="Hello"/>
-<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-ea -Dgwt.devjar=C:\gwt\trunk\build\staging\gwt-windows-0.0.0\gwt-dev-windows.jar"/>
-</launchConfiguration>
diff --git a/eclipse/samples/Hello/Hello-gwtc.launch b/eclipse/samples/Hello/Hello-gwtc.launch
new file mode 100644
index 0000000..d8c4a4d
--- /dev/null
+++ b/eclipse/samples/Hello/Hello-gwtc.launch
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
+<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
+<listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.launching.JRE_CONTAINER" javaProject="Hello" path="1" type="4"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry internalArchive="/Hello/core/src" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry internalArchive="/gwt-user/core/src" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry internalArchive="/gwt-user/core/super" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry internalArchive="/gwt-dev-windows/core/super" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry id="org.eclipse.jdt.launching.classpathentry.defaultClasspath"> <memento exportedEntriesOnly="false" project="Hello"/> </runtimeClasspathEntry> "/>
+</listAttribute>
+<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.google.gwt.dev.Compiler"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="com.google.gwt.sample.hello.Hello"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="Hello"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-ea -Xmx256M -Dgwt.devjar=${gwt_devjar}"/>
+</launchConfiguration>
diff --git a/eclipse/samples/Hello/Hello.launch b/eclipse/samples/Hello/Hello.launch
index bf03582..2698052 100644
--- a/eclipse/samples/Hello/Hello.launch
+++ b/eclipse/samples/Hello/Hello.launch
@@ -1,23 +1,17 @@
-<?xml version="1.0" encoding="UTF-8"?>
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
-<listEntry value="/Hello"/>
-</listAttribute>
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
-<listEntry value="4"/>
-</listAttribute>
<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
<listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
-<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.launching.JRE_CONTAINER" javaProject="Hello" path="1" type="4"/> "/>
-<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry internalArchive="/Hello/core/src" path="3" type="2"/> "/>
-<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry internalArchive="/gwt-user/core/src" path="3" type="2"/> "/>
-<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry internalArchive="/gwt-user/core/super" path="3" type="2"/> "/>
-<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry internalArchive="/gwt-dev-windows/core/super" path="3" type="2"/> "/>
-<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry id="org.eclipse.jdt.launching.classpathentry.defaultClasspath"> <memento exportedEntriesOnly="false" project="Hello"/> </runtimeClasspathEntry> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.launching.JRE_CONTAINER" javaProject="Hello" path="1" type="4"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry internalArchive="/Hello/core/src" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry internalArchive="/gwt-user/core/src" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry internalArchive="/gwt-user/core/super" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry internalArchive="/gwt-dev-windows/core/super" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry id="org.eclipse.jdt.launching.classpathentry.defaultClasspath"> <memento exportedEntriesOnly="false" project="Hello"/> </runtimeClasspathEntry> "/>
</listAttribute>
<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
-<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.google.gwt.dev.GWTShell"/>
-<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-out www com.google.gwt.sample.hello.Hello/Hello.html"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.google.gwt.dev.HostedMode"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-startupUrl Hello.html com.google.gwt.sample.hello.Hello"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="Hello"/>
-<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-ea -Dgwt.devjar=C:\gwt\trunk\build\staging\gwt-windows-0.0.0\gwt-dev-windows.jar"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-ea -Xmx256M -Dgwt.devjar=${gwt_devjar}"/>
</launchConfiguration>
diff --git a/eclipse/samples/I18N/.classpath b/eclipse/samples/I18N/.classpath
index 8996e78..26f2949 100644
--- a/eclipse/samples/I18N/.classpath
+++ b/eclipse/samples/I18N/.classpath
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="core/src"/>
+ <classpathentry kind="src" output="war" path="core/war"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry combineaccessrules="false" kind="src" path="/gwt-user"/>
- <classpathentry kind="output" path="bin"/>
+ <classpathentry kind="output" path="war/WEB-INF/classes"/>
</classpath>
diff --git a/eclipse/samples/I18N/I18N-gwtc.launch b/eclipse/samples/I18N/I18N-gwtc.launch
new file mode 100644
index 0000000..0de5f68
--- /dev/null
+++ b/eclipse/samples/I18N/I18N-gwtc.launch
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
+<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
+<listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.launching.JRE_CONTAINER" javaProject="I18N" path="1" type="4"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry internalArchive="/I18N/core/src" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry internalArchive="/gwt-user/core/src" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry internalArchive="/gwt-user/core/super" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry internalArchive="/gwt-dev-windows/core/super" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry id="org.eclipse.jdt.launching.classpathentry.defaultClasspath"> <memento exportedEntriesOnly="false" project="I18N"/> </runtimeClasspathEntry> "/>
+</listAttribute>
+<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.google.gwt.dev.Compiler"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="com.google.gwt.sample.i18n.I18N"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="I18N"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-ea -Xmx256M -Dgwt.devjar=${gwt_devjar}"/>
+</launchConfiguration>
diff --git a/eclipse/samples/I18N/I18N.launch b/eclipse/samples/I18N/I18N.launch
new file mode 100644
index 0000000..e531a50
--- /dev/null
+++ b/eclipse/samples/I18N/I18N.launch
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
+<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
+<listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.launching.JRE_CONTAINER" javaProject="I18N" path="1" type="4"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry internalArchive="/I18N/core/src" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry internalArchive="/gwt-user/core/src" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry internalArchive="/gwt-user/core/super" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry internalArchive="/gwt-dev-windows/core/super" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry id="org.eclipse.jdt.launching.classpathentry.defaultClasspath"> <memento exportedEntriesOnly="false" project="I18N"/> </runtimeClasspathEntry> "/>
+</listAttribute>
+<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.google.gwt.dev.HostedMode"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-startupUrl I18N.html com.google.gwt.sample.i18n.I18N"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="I18N"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-ea -Xmx256M -Dgwt.devjar=${gwt_devjar}"/>
+</launchConfiguration>
diff --git a/eclipse/samples/JSON/.classpath b/eclipse/samples/JSON/.classpath
index 8996e78..26f2949 100644
--- a/eclipse/samples/JSON/.classpath
+++ b/eclipse/samples/JSON/.classpath
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="core/src"/>
+ <classpathentry kind="src" output="war" path="core/war"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry combineaccessrules="false" kind="src" path="/gwt-user"/>
- <classpathentry kind="output" path="bin"/>
+ <classpathentry kind="output" path="war/WEB-INF/classes"/>
</classpath>
diff --git a/eclipse/samples/JSON/.project b/eclipse/samples/JSON/.project
index bd13bfd..201b21a 100644
--- a/eclipse/samples/JSON/.project
+++ b/eclipse/samples/JSON/.project
@@ -24,7 +24,7 @@
<link>
<name>core</name>
<type>2</type>
- <location>GWT_ROOT/samples/json</location>
+ <locationURI>GWT_ROOT/samples/json</locationURI>
</link>
</linkedResources>
</projectDescription>
diff --git a/eclipse/samples/JSON/JSON-gwtc.launch b/eclipse/samples/JSON/JSON-gwtc.launch
new file mode 100644
index 0000000..ff8f309
--- /dev/null
+++ b/eclipse/samples/JSON/JSON-gwtc.launch
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
+<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
+<listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.launching.JRE_CONTAINER" javaProject="JSON" path="1" type="4"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry internalArchive="/JSON/core/src" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry internalArchive="/gwt-user/core/src" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry internalArchive="/gwt-user/core/super" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry internalArchive="/gwt-dev-windows/core/super" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry id="org.eclipse.jdt.launching.classpathentry.defaultClasspath"> <memento exportedEntriesOnly="false" project="JSON"/> </runtimeClasspathEntry> "/>
+</listAttribute>
+<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.google.gwt.dev.Compiler"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="com.google.gwt.sample.json.JSON"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="JSON"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-ea -Xmx256M -Dgwt.devjar=${gwt_devjar}"/>
+</launchConfiguration>
diff --git a/eclipse/samples/JSON/JSON.launch b/eclipse/samples/JSON/JSON.launch
new file mode 100644
index 0000000..7c65850
--- /dev/null
+++ b/eclipse/samples/JSON/JSON.launch
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
+<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
+<listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.launching.JRE_CONTAINER" javaProject="JSON" path="1" type="4"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry internalArchive="/JSON/core/src" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry internalArchive="/gwt-user/core/src" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry internalArchive="/gwt-user/core/super" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry internalArchive="/gwt-dev-windows/core/super" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry id="org.eclipse.jdt.launching.classpathentry.defaultClasspath"> <memento exportedEntriesOnly="false" project="JSON"/> </runtimeClasspathEntry> "/>
+</listAttribute>
+<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.google.gwt.dev.HostedMode"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-startupUrl JSON.html com.google.gwt.sample.json.JSON"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="JSON"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-ea -Xmx256M -Dgwt.devjar=${gwt_devjar}"/>
+</launchConfiguration>
diff --git a/eclipse/samples/Mail/.classpath b/eclipse/samples/Mail/.classpath
index 8996e78..26f2949 100644
--- a/eclipse/samples/Mail/.classpath
+++ b/eclipse/samples/Mail/.classpath
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="core/src"/>
+ <classpathentry kind="src" output="war" path="core/war"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry combineaccessrules="false" kind="src" path="/gwt-user"/>
- <classpathentry kind="output" path="bin"/>
+ <classpathentry kind="output" path="war/WEB-INF/classes"/>
</classpath>
diff --git a/eclipse/samples/Mail/.project b/eclipse/samples/Mail/.project
index ebcf8d8..9b9ccaf 100644
--- a/eclipse/samples/Mail/.project
+++ b/eclipse/samples/Mail/.project
@@ -24,7 +24,7 @@
<link>
<name>core</name>
<type>2</type>
- <location>GWT_ROOT/samples/mail</location>
+ <locationURI>GWT_ROOT/samples/mail</locationURI>
</link>
</linkedResources>
</projectDescription>
diff --git a/eclipse/samples/Mail/Mail-gwtc.launch b/eclipse/samples/Mail/Mail-gwtc.launch
new file mode 100644
index 0000000..93f868b
--- /dev/null
+++ b/eclipse/samples/Mail/Mail-gwtc.launch
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
+<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
+<listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.launching.JRE_CONTAINER" javaProject="Mail" path="1" type="4"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry internalArchive="/Mail/core/src" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry internalArchive="/gwt-user/core/src" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry internalArchive="/gwt-user/core/super" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry internalArchive="/gwt-dev-windows/core/super" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry id="org.eclipse.jdt.launching.classpathentry.defaultClasspath"> <memento exportedEntriesOnly="false" project="Mail"/> </runtimeClasspathEntry> "/>
+</listAttribute>
+<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.google.gwt.dev.Compiler"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="com.google.gwt.sample.mail.Mail"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="Mail"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-ea -Xmx256M -Dgwt.devjar=${gwt_devjar}"/>
+</launchConfiguration>
diff --git a/eclipse/samples/Mail/Mail.launch b/eclipse/samples/Mail/Mail.launch
new file mode 100644
index 0000000..8969458
--- /dev/null
+++ b/eclipse/samples/Mail/Mail.launch
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
+<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
+<listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.launching.JRE_CONTAINER" javaProject="Mail" path="1" type="4"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry internalArchive="/Mail/core/src" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry internalArchive="/gwt-user/core/src" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry internalArchive="/gwt-user/core/super" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry internalArchive="/gwt-dev-windows/core/super" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry id="org.eclipse.jdt.launching.classpathentry.defaultClasspath"> <memento exportedEntriesOnly="false" project="Mail"/> </runtimeClasspathEntry> "/>
+</listAttribute>
+<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.google.gwt.dev.HostedMode"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-startupUrl Mail.html com.google.gwt.sample.mail.Mail"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="Mail"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-ea -Xmx256M -Dgwt.devjar=${gwt_devjar}"/>
+</launchConfiguration>
diff --git a/eclipse/samples/Showcase/.classpath b/eclipse/samples/Showcase/.classpath
index a8c5efa..9ced56b 100644
--- a/eclipse/samples/Showcase/.classpath
+++ b/eclipse/samples/Showcase/.classpath
@@ -1,8 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="core/src"/>
+ <classpathentry kind="src" output="war" path="core/war"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry combineaccessrules="false" kind="src" path="/gwt-dev-linux"/>
<classpathentry combineaccessrules="false" kind="src" path="/gwt-user"/>
- <classpathentry kind="output" path="bin"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/gwt-dev-windows"/>
+ <classpathentry kind="output" path="war/WEB-INF/classes"/>
</classpath>
diff --git a/eclipse/samples/Showcase/Showcase-gwtc.launch b/eclipse/samples/Showcase/Showcase-gwtc.launch
new file mode 100644
index 0000000..cc73877
--- /dev/null
+++ b/eclipse/samples/Showcase/Showcase-gwtc.launch
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
+<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
+<listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.launching.JRE_CONTAINER" javaProject="Showcase" path="1" type="4"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry internalArchive="/Showcase/core/src" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry internalArchive="/gwt-user/core/src" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry internalArchive="/gwt-user/core/super" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry internalArchive="/gwt-dev-windows/core/super" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry id="org.eclipse.jdt.launching.classpathentry.defaultClasspath"> <memento exportedEntriesOnly="false" project="Showcase"/> </runtimeClasspathEntry> "/>
+</listAttribute>
+<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.google.gwt.dev.Compiler"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="com.google.gwt.sample.showcase.Showcase"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="Showcase"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-ea -Xmx256M -Dgwt.devjar=${gwt_devjar}"/>
+</launchConfiguration>
diff --git a/eclipse/samples/Showcase/Showcase.launch b/eclipse/samples/Showcase/Showcase.launch
new file mode 100644
index 0000000..7c7f985
--- /dev/null
+++ b/eclipse/samples/Showcase/Showcase.launch
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
+<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
+<listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.launching.JRE_CONTAINER" javaProject="Showcase" path="1" type="4"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry internalArchive="/Showcase/core/src" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry internalArchive="/gwt-user/core/src" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry internalArchive="/gwt-user/core/super" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry internalArchive="/gwt-dev-windows/core/super" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry id="org.eclipse.jdt.launching.classpathentry.defaultClasspath"> <memento exportedEntriesOnly="false" project="Showcase"/> </runtimeClasspathEntry> "/>
+</listAttribute>
+<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.google.gwt.dev.HostedMode"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-startupUrl Showcase.html com.google.gwt.sample.showcase.Showcase"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="Showcase"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-ea -Xmx256M -Dgwt.devjar=${gwt_devjar}"/>
+</launchConfiguration>
diff --git a/eclipse/samples/SimpleRPC/.classpath b/eclipse/samples/SimpleRPC/.classpath
index 8996e78..26f2949 100644
--- a/eclipse/samples/SimpleRPC/.classpath
+++ b/eclipse/samples/SimpleRPC/.classpath
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="core/src"/>
+ <classpathentry kind="src" output="war" path="core/war"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry combineaccessrules="false" kind="src" path="/gwt-user"/>
- <classpathentry kind="output" path="bin"/>
+ <classpathentry kind="output" path="war/WEB-INF/classes"/>
</classpath>
diff --git a/eclipse/samples/SimpleRPC/.project b/eclipse/samples/SimpleRPC/.project
index 4aa9253..2bb608a 100644
--- a/eclipse/samples/SimpleRPC/.project
+++ b/eclipse/samples/SimpleRPC/.project
@@ -24,7 +24,7 @@
<link>
<name>core</name>
<type>2</type>
- <location>GWT_ROOT/samples/simplerpc</location>
+ <locationURI>GWT_ROOT/samples/simplerpc</locationURI>
</link>
</linkedResources>
</projectDescription>
diff --git a/eclipse/samples/SimpleRPC/SimpleRPC-gwtc.launch b/eclipse/samples/SimpleRPC/SimpleRPC-gwtc.launch
new file mode 100644
index 0000000..7147610
--- /dev/null
+++ b/eclipse/samples/SimpleRPC/SimpleRPC-gwtc.launch
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+<listEntry value="/SimpleRPC"/>
+</listAttribute>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+<listEntry value="4"/>
+</listAttribute>
+<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
+<listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.launching.JRE_CONTAINER" javaProject="SimpleRPC" path="1" type="4"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry internalArchive="/SimpleRPC/core/src" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry internalArchive="/gwt-user/core/src" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry internalArchive="/gwt-user/core/super" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry internalArchive="/gwt-dev-windows/core/super" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry id="org.eclipse.jdt.launching.classpathentry.defaultClasspath"> <memento exportedEntriesOnly="false" project="SimpleRPC"/> </runtimeClasspathEntry> "/>
+</listAttribute>
+<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.google.gwt.dev.Compiler"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="com.google.gwt.sample.simplerpc.SimpleRPC"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="SimpleRPC"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-ea -Xmx256M -Dgwt.devjar=${gwt_devjar}"/>
+</launchConfiguration>
diff --git a/eclipse/samples/SimpleRPC/SimpleRPC.launch b/eclipse/samples/SimpleRPC/SimpleRPC.launch
new file mode 100644
index 0000000..de170b8
--- /dev/null
+++ b/eclipse/samples/SimpleRPC/SimpleRPC.launch
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
+<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
+<listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.launching.JRE_CONTAINER" javaProject="SimpleRPC" path="1" type="4"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry internalArchive="/SimpleRPC/core/src" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry internalArchive="/gwt-user/core/src" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry internalArchive="/gwt-user/core/super" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry internalArchive="/gwt-dev-windows/core/super" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry id="org.eclipse.jdt.launching.classpathentry.defaultClasspath"> <memento exportedEntriesOnly="false" project="SimpleRPC"/> </runtimeClasspathEntry> "/>
+</listAttribute>
+<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.google.gwt.dev.HostedMode"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-startupUrl SimpleRPC.html com.google.gwt.sample.simplerpc.SimpleRPC"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="SimpleRPC"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-ea -Xmx256M -Dgwt.devjar=${gwt_devjar}"/>
+</launchConfiguration>
diff --git a/eclipse/samples/SimpleXML/.classpath b/eclipse/samples/SimpleXML/.classpath
index 8996e78..26f2949 100644
--- a/eclipse/samples/SimpleXML/.classpath
+++ b/eclipse/samples/SimpleXML/.classpath
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="core/src"/>
+ <classpathentry kind="src" output="war" path="core/war"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry combineaccessrules="false" kind="src" path="/gwt-user"/>
- <classpathentry kind="output" path="bin"/>
+ <classpathentry kind="output" path="war/WEB-INF/classes"/>
</classpath>
diff --git a/eclipse/samples/SimpleXML/.project b/eclipse/samples/SimpleXML/.project
index 72c2e13..5c0a10f 100644
--- a/eclipse/samples/SimpleXML/.project
+++ b/eclipse/samples/SimpleXML/.project
@@ -24,7 +24,7 @@
<link>
<name>core</name>
<type>2</type>
- <location>GWT_ROOT/samples/simplexml</location>
+ <locationURI>GWT_ROOT/samples/simplexml</locationURI>
</link>
</linkedResources>
</projectDescription>
diff --git a/eclipse/samples/SimpleXML/SimpleXML-gwtc.launch b/eclipse/samples/SimpleXML/SimpleXML-gwtc.launch
new file mode 100644
index 0000000..052f4f1
--- /dev/null
+++ b/eclipse/samples/SimpleXML/SimpleXML-gwtc.launch
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
+<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
+<listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.launching.JRE_CONTAINER" javaProject="SimpleXML" path="1" type="4"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry internalArchive="/SimpleXML/core/src" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry internalArchive="/gwt-user/core/src" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry internalArchive="/gwt-user/core/super" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry internalArchive="/gwt-dev-windows/core/super" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry id="org.eclipse.jdt.launching.classpathentry.defaultClasspath"> <memento exportedEntriesOnly="false" project="SimpleXML"/> </runtimeClasspathEntry> "/>
+</listAttribute>
+<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.google.gwt.dev.Compiler"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="com.google.gwt.sample.simplexml.SimpleXML"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="SimpleXML"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-ea -Xmx256M -Dgwt.devjar=${gwt_devjar}"/>
+</launchConfiguration>
diff --git a/eclipse/samples/SimpleXML/SimpleXML.launch b/eclipse/samples/SimpleXML/SimpleXML.launch
new file mode 100644
index 0000000..8276f65
--- /dev/null
+++ b/eclipse/samples/SimpleXML/SimpleXML.launch
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
+<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
+<listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.launching.JRE_CONTAINER" javaProject="SimpleXML" path="1" type="4"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry internalArchive="/SimpleXML/core/src" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry internalArchive="/gwt-user/core/src" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry internalArchive="/gwt-user/core/super" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry internalArchive="/gwt-dev-windows/core/super" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry id="org.eclipse.jdt.launching.classpathentry.defaultClasspath"> <memento exportedEntriesOnly="false" project="SimpleXML"/> </runtimeClasspathEntry> "/>
+</listAttribute>
+<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.google.gwt.dev.HostedMode"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-startupUrl SimpleXML.html com.google.gwt.sample.simplexml.SimpleXML"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="SimpleXML"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-ea -Xmx256M -Dgwt.devjar=${gwt_devjar}"/>
+</launchConfiguration>
diff --git a/reference/code-museum/src/com/google/gwt/museum/DefaultMuseum.gwt.xml b/reference/code-museum/src/com/google/gwt/museum/DefaultMuseum.gwt.xml
index 21d12fd..cee0aa1 100644
--- a/reference/code-museum/src/com/google/gwt/museum/DefaultMuseum.gwt.xml
+++ b/reference/code-museum/src/com/google/gwt/museum/DefaultMuseum.gwt.xml
@@ -3,5 +3,6 @@
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.museum.Museum'/>
<source path="client/defaultmuseum"/>
- <entry-point class="com.google.gwt.museum.client.defaultmuseum.DefaultMuseum"/>
-</module>
+ <!-- Specify the app entry point class. -->
+ <entry-point class='com.google.gwt.museum.client.defaultmuseum.Issue3190'/>
+ </module>
diff --git a/reference/code-museum/src/com/google/gwt/museum/client/common/EventReporter.java b/reference/code-museum/src/com/google/gwt/museum/client/common/EventReporter.java
index c7e674a..9790aad 100644
--- a/reference/code-museum/src/com/google/gwt/museum/client/common/EventReporter.java
+++ b/reference/code-museum/src/com/google/gwt/museum/client/common/EventReporter.java
@@ -16,7 +16,6 @@
package com.google.gwt.museum.client.common;
-import com.google.gwt.event.dom.client.HandlesAllKeyEvents;
import com.google.gwt.event.dom.client.BlurEvent;
import com.google.gwt.event.dom.client.BlurHandler;
import com.google.gwt.event.dom.client.ChangeEvent;
@@ -26,15 +25,17 @@
import com.google.gwt.event.dom.client.FocusEvent;
import com.google.gwt.event.dom.client.FocusHandler;
import com.google.gwt.event.dom.client.KeyDownEvent;
+import com.google.gwt.event.dom.client.KeyDownHandler;
import com.google.gwt.event.dom.client.KeyPressEvent;
+import com.google.gwt.event.dom.client.KeyPressHandler;
import com.google.gwt.event.dom.client.KeyUpEvent;
+import com.google.gwt.event.dom.client.KeyUpHandler;
import com.google.gwt.event.logical.shared.CloseEvent;
import com.google.gwt.event.logical.shared.CloseHandler;
import com.google.gwt.event.logical.shared.SelectionEvent;
import com.google.gwt.event.logical.shared.SelectionHandler;
import com.google.gwt.event.logical.shared.ValueChangeEvent;
import com.google.gwt.event.logical.shared.ValueChangeHandler;
-import com.google.gwt.event.shared.GwtEvent;
import com.google.gwt.user.client.ui.ChangeListener;
import com.google.gwt.user.client.ui.CheckBox;
import com.google.gwt.user.client.ui.ClickListener;
@@ -42,13 +43,11 @@
import com.google.gwt.user.client.ui.HasHTML;
import com.google.gwt.user.client.ui.HasText;
import com.google.gwt.user.client.ui.KeyboardListener;
-import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.MouseListener;
import com.google.gwt.user.client.ui.Panel;
import com.google.gwt.user.client.ui.SuggestionEvent;
import com.google.gwt.user.client.ui.SuggestionHandler;
import com.google.gwt.user.client.ui.UIObject;
-import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.user.client.ui.SuggestOracle.Suggestion;
@@ -59,11 +58,12 @@
* @param <T> target type
*/
@SuppressWarnings("deprecation")
-public class EventReporter<V, T> extends HandlesAllKeyEvents implements
+public class EventReporter<V, T> extends SimpleLogger implements
ChangeListener, FocusListener, ValueChangeHandler<V>,
SelectionHandler<Suggestion>, SuggestionHandler, KeyboardListener,
ChangeHandler, BlurHandler, FocusHandler, ClickHandler, ClickListener,
- CloseHandler<T>, MouseListener {
+ CloseHandler<T>, MouseListener, KeyDownHandler, KeyUpHandler,
+ KeyPressHandler {
/**
* Add/remove handlers via check box.
@@ -96,10 +96,8 @@
public abstract void removeHandler();
}
- private VerticalPanel panel = new VerticalPanel();
-
public EventReporter(Panel parent) {
- parent.add(this.panel);
+ parent.add(this);
}
public String getInfo(Object sender) {
@@ -211,17 +209,4 @@
public void onValueChange(ValueChangeEvent<V> event) {
report(event);
}
-
- // will be replaced by logging
- public void report(String s) {
- panel.insert(new Label(s), 0);
- if (panel.getWidgetCount() == 10) {
- panel.remove(9);
- }
- }
-
- private void report(GwtEvent<?> event) {
- report(getInfo(event.getSource()) + " fired " + event.toDebugString());
- }
-
}
diff --git a/reference/code-museum/src/com/google/gwt/museum/client/common/SimpleLogger.java b/reference/code-museum/src/com/google/gwt/museum/client/common/SimpleLogger.java
new file mode 100644
index 0000000..eeba505
--- /dev/null
+++ b/reference/code-museum/src/com/google/gwt/museum/client/common/SimpleLogger.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2009 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.google.gwt.museum.client.common;
+
+import com.google.gwt.event.shared.GwtEvent;
+import com.google.gwt.user.client.ui.Composite;
+import com.google.gwt.user.client.ui.HasHTML;
+import com.google.gwt.user.client.ui.HasText;
+import com.google.gwt.user.client.ui.Label;
+import com.google.gwt.user.client.ui.UIObject;
+import com.google.gwt.user.client.ui.VerticalPanel;
+
+/**
+ * Helper class to create visual tests.
+ *
+ * @param <V> value type
+ * @param <T> target type
+ */
+@SuppressWarnings("deprecation")
+public class SimpleLogger<V, T> extends Composite {
+
+ private VerticalPanel panel = new VerticalPanel();
+
+ public SimpleLogger() {
+ initWidget(panel);
+ }
+
+ public String getInfo(Object sender) {
+ if (sender instanceof HasText) {
+ return ((HasText) sender).getText();
+ } else if (sender instanceof UIObject
+ && ((UIObject) sender).getTitle() != null) {
+ return ((UIObject) sender).getTitle();
+ } else if (sender instanceof HasHTML) {
+ return ((HasHTML) sender).getHTML();
+ } else {
+ return sender.toString();
+ }
+ }
+
+ public void report(String s) {
+ panel.insert(new Label(s), 0);
+ if (panel.getWidgetCount() == 10) {
+ panel.remove(9);
+ }
+ }
+
+ public void report(GwtEvent<?> event) {
+ report(getInfo(event.getSource()) + " fired " + event.toDebugString());
+ }
+
+}
diff --git a/reference/code-museum/src/com/google/gwt/museum/client/defaultmuseum/DefaultMuseum.java b/reference/code-museum/src/com/google/gwt/museum/client/defaultmuseum/DefaultMuseum.java
index b49d292..19bf121 100644
--- a/reference/code-museum/src/com/google/gwt/museum/client/defaultmuseum/DefaultMuseum.java
+++ b/reference/code-museum/src/com/google/gwt/museum/client/defaultmuseum/DefaultMuseum.java
@@ -64,5 +64,6 @@
addIssue(new VisualsForTreeEvents());
addIssue(new VisualsForWindowEvents());
addIssue(new VisualsForDialogBox());
+ addIssue(new VisualsForSuggestBox());
}
}
diff --git a/reference/code-museum/src/com/google/gwt/museum/client/defaultmuseum/VisualsForCheckBoxAndRadioButtonEvents.java b/reference/code-museum/src/com/google/gwt/museum/client/defaultmuseum/VisualsForCheckBoxAndRadioButtonEvents.java
index 468b95a..1afbee1 100644
--- a/reference/code-museum/src/com/google/gwt/museum/client/defaultmuseum/VisualsForCheckBoxAndRadioButtonEvents.java
+++ b/reference/code-museum/src/com/google/gwt/museum/client/defaultmuseum/VisualsForCheckBoxAndRadioButtonEvents.java
@@ -18,6 +18,7 @@
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.event.dom.client.HandlesAllKeyEvents;
import com.google.gwt.museum.client.common.AbstractIssue;
import com.google.gwt.museum.client.common.EventReporter;
import com.google.gwt.user.client.ui.Button;
@@ -49,8 +50,7 @@
}
}));
b.addKeyboardListener(handler);
- handler.addKeyHandlersTo(b);
-
+ HandlesAllKeyEvents.addHandlers(b, handler);
b.addFocusHandler(handler);
b.addBlurHandler(handler);
b.addFocusListener(handler);
@@ -65,7 +65,8 @@
p.add(radio);
handler = new EventReporter<Boolean, Object>(p);
radio.addKeyboardListener(handler);
- handler.addKeyHandlersTo(radio);
+
+ HandlesAllKeyEvents.addHandlers(radio, handler);
radio.addBlurHandler(handler);
radio.addFocusHandler(handler);
radio.addClickHandler(handler);
diff --git a/reference/code-museum/src/com/google/gwt/museum/client/defaultmuseum/VisualsForEventsFiring.java b/reference/code-museum/src/com/google/gwt/museum/client/defaultmuseum/VisualsForEventsFiring.java
index 8450fd9..07efe27 100644
--- a/reference/code-museum/src/com/google/gwt/museum/client/defaultmuseum/VisualsForEventsFiring.java
+++ b/reference/code-museum/src/com/google/gwt/museum/client/defaultmuseum/VisualsForEventsFiring.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2008 Google Inc.
+ * Copyright 2009 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
@@ -29,8 +29,10 @@
import com.google.gwt.event.dom.client.ErrorHandler;
import com.google.gwt.event.dom.client.FocusEvent;
import com.google.gwt.event.dom.client.FocusHandler;
+import com.google.gwt.event.dom.client.HasChangeHandlers;
import com.google.gwt.event.dom.client.HasContextMenuHandlers;
import com.google.gwt.event.dom.client.HasDoubleClickHandlers;
+import com.google.gwt.event.dom.client.HasMouseWheelHandlers;
import com.google.gwt.event.dom.client.KeyDownEvent;
import com.google.gwt.event.dom.client.KeyDownHandler;
import com.google.gwt.event.dom.client.KeyPressEvent;
@@ -49,6 +51,8 @@
import com.google.gwt.event.dom.client.MouseOverHandler;
import com.google.gwt.event.dom.client.MouseUpEvent;
import com.google.gwt.event.dom.client.MouseUpHandler;
+import com.google.gwt.event.dom.client.MouseWheelEvent;
+import com.google.gwt.event.dom.client.MouseWheelHandler;
import com.google.gwt.event.dom.client.ScrollEvent;
import com.google.gwt.event.dom.client.ScrollHandler;
import com.google.gwt.event.logical.shared.ResizeEvent;
@@ -87,9 +91,28 @@
}
}
+ private static class CustomScrollPanel extends ScrollPanel implements
+ HasMouseWheelHandlers {
+ public CustomScrollPanel(Widget content) {
+ super(content);
+ }
+
+ public HandlerRegistration addMouseWheelHandler(MouseWheelHandler handler) {
+ return addDomHandler(handler, MouseWheelEvent.getType());
+ }
+ }
+
+ private static class CustomTextBox extends TextBox implements
+ HasChangeHandlers {
+ public HandlerRegistration addChangeHandler(ChangeHandler handler) {
+ return addDomHandler(handler, ChangeEvent.getType());
+ }
+ }
+
private static final int WINDOW_EVENT_SCROLL = -1;
private static final int WINDOW_EVENT_RESIZE = -2;
private static final int WINDOW_EVENT_CLOSING = -3;
+ private static final int VELOCITY_EVENT = -4;
/**
* The main grid used for layout.
@@ -143,8 +166,9 @@
*
* @param eventType the type of event defined in {@link Event}
* @param eventName the name of the event
+ * @return the index of the test
*/
- private void addDependentTest(int eventType, String eventName) {
+ private int addDependentTest(int eventType, String eventName) {
// Find the last test
int numRows = layout.getRowCount();
eventMap.put(new Integer(eventType), new Integer(numRows));
@@ -158,6 +182,7 @@
}
layout.setText(numRows, 0, eventName);
layout.setText(numRows, 1, "?");
+ return numRows;
}
/**
@@ -166,8 +191,9 @@
* @param eventType the type of event defined in {@link Event}
* @param eventName the name of the event
* @param trigger the widget that triggers the events
+ * @return the index of the test
*/
- private void addTest(int eventType, String eventName, Widget trigger) {
+ private int addTest(int eventType, String eventName, Widget trigger) {
int numRows = layout.getRowCount();
eventMap.put(new Integer(eventType), new Integer(numRows));
layout.setWidget(numRows, 0, trigger);
@@ -179,6 +205,7 @@
HasVerticalAlignment.ALIGN_MIDDLE);
formatter.setHorizontalAlignment(numRows, 0,
HasHorizontalAlignment.ALIGN_CENTER);
+ return numRows;
}
/**
@@ -206,7 +233,7 @@
private void prepKeyboardEvents() {
// Setup a text box to trigger the events
- TextBox textBox = new TextBox();
+ CustomTextBox textBox = new CustomTextBox();
// Setup the tests
textBox.setText("Type a letter");
@@ -377,25 +404,8 @@
+ "if supported)";
HTML scrollableContents = new HTML(scrollableMessage);
scrollableContents.setPixelSize(400, 400);
- scrollableContents.getElement().getStyle().setProperty("textAlign",
- "left");
- ScrollPanel scrollable = new ScrollPanel(scrollableContents) {
- @Override
- public void onBrowserEvent(Event event) {
- super.onBrowserEvent(event);
-
- // Verify that values associated with events are defined
- if (event.getTypeInt() == Event.ONMOUSEWHEEL) {
- event.getClientX();
- event.getClientY();
- event.getScreenX();
- event.getScreenY();
- event.getMouseWheelVelocityY();
- passTest(event);
- }
- }
- };
- scrollable.sinkEvents(Event.ONMOUSEWHEEL);
+ scrollableContents.getElement().getStyle().setProperty("textAlign", "left");
+ CustomScrollPanel scrollable = new CustomScrollPanel(scrollableContents);
// Setup the tests
scrollable.setAlwaysShowScrollBars(true);
@@ -403,12 +413,26 @@
addTest(Event.ONSCROLL, "scroll", scrollable);
addDependentTest(Event.ONMOUSEWHEEL, "mousewheel");
+ // Display the mouse wheel velocity
+ final int velocityIndex = addDependentTest(VELOCITY_EVENT, "velocityY");
+
// Add event handlers
scrollable.addScrollHandler(new ScrollHandler() {
public void onScroll(ScrollEvent event) {
passTest(event.getNativeEvent());
}
});
+ scrollable.addMouseWheelHandler(new MouseWheelHandler() {
+ public void onMouseWheel(MouseWheelEvent event) {
+ event.getClientX();
+ event.getClientY();
+ event.getScreenX();
+ event.getScreenY();
+ int velocityY = event.getDeltaY();
+ layout.setText(velocityIndex, 1, velocityY + "");
+ passTest(event.getNativeEvent());
+ }
+ });
}
private void prepWindowEvents() {
diff --git a/reference/code-museum/src/com/google/gwt/museum/client/defaultmuseum/VisualsForPopupEvents.java b/reference/code-museum/src/com/google/gwt/museum/client/defaultmuseum/VisualsForPopupEvents.java
index ffa898a..81fa475 100644
--- a/reference/code-museum/src/com/google/gwt/museum/client/defaultmuseum/VisualsForPopupEvents.java
+++ b/reference/code-museum/src/com/google/gwt/museum/client/defaultmuseum/VisualsForPopupEvents.java
@@ -24,12 +24,14 @@
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.HTML;
+import com.google.gwt.user.client.ui.HorizontalPanel;
+import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.PopupPanel;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
/**
- * A simple tree used to quickly exercise tree behavior.
+ * Visual tests for {@link PopupPanel}.
*/
public class VisualsForPopupEvents extends AbstractIssue {
static int xPos = 0;
@@ -37,10 +39,26 @@
@Override
public Widget createIssue() {
VerticalPanel panel = new VerticalPanel();
+ panel.setSpacing(3);
+ {
+ PopupPanel popup = createButton(true, false, panel);
+ Label partner0 = new Label("AutoHide Partner 0");
+ Label partner1 = new Label("AutoHide Partner 1");
+ popup.addAutoHidePartner(partner0.getElement());
+ popup.addAutoHidePartner(partner1.getElement());
+
+ HorizontalPanel hPanel = new HorizontalPanel();
+ hPanel.setBorderWidth(1);
+ hPanel.setSpacing(3);
+ hPanel.add(partner0);
+ hPanel.add(partner1);
+ panel.add(new Label(
+ "Clicking on partners should not autoHide this popup:"));
+ panel.add(hPanel);
+ }
createButton(true, true, panel);
- createButton(true, false, panel);
- createButton(false, true, panel);
createButton(false, false, panel);
+ createButton(false, true, panel);
return panel;
}
@@ -59,7 +77,8 @@
return false;
}
- private void createButton(boolean autoHide, boolean modal, VerticalPanel panel) {
+ private PopupPanel createButton(boolean autoHide, boolean modal,
+ VerticalPanel panel) {
final String text = " popup " + (modal ? " modal " : " non-modal ")
+ (autoHide ? "auto hide" : " persistent");
panel.add(new HTML("<h2>" + text + "</h2>"));
@@ -85,5 +104,7 @@
+ event.isAutoClosed());
}
});
+
+ return p;
}
}
\ No newline at end of file
diff --git a/reference/code-museum/src/com/google/gwt/museum/client/defaultmuseum/VisualsForSuggestBox.java b/reference/code-museum/src/com/google/gwt/museum/client/defaultmuseum/VisualsForSuggestBox.java
new file mode 100644
index 0000000..b0964e3
--- /dev/null
+++ b/reference/code-museum/src/com/google/gwt/museum/client/defaultmuseum/VisualsForSuggestBox.java
@@ -0,0 +1,132 @@
+/*
+ * Copyright 2009 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.museum.client.defaultmuseum;
+
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.event.dom.client.MouseDownEvent;
+import com.google.gwt.event.dom.client.MouseDownHandler;
+import com.google.gwt.museum.client.common.AbstractIssue;
+import com.google.gwt.user.client.Timer;
+import com.google.gwt.user.client.ui.Button;
+import com.google.gwt.user.client.ui.FlexTable;
+import com.google.gwt.user.client.ui.HTML;
+import com.google.gwt.user.client.ui.Label;
+import com.google.gwt.user.client.ui.MultiWordSuggestOracle;
+import com.google.gwt.user.client.ui.SuggestBox;
+import com.google.gwt.user.client.ui.VerticalPanel;
+import com.google.gwt.user.client.ui.Widget;
+
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * Visual test for suggest box.
+ */
+public class VisualsForSuggestBox extends AbstractIssue {
+ MultiWordSuggestOracle girlsNames = new MultiWordSuggestOracle();
+ MultiWordSuggestOracle girlsNamesWithDefault = new MultiWordSuggestOracle();
+
+ VisualsForSuggestBox() {
+ List<String> femaleNames = Arrays.asList("Jamie", "Jill", "Jackie",
+ "Susan", "Helen", "Emily", "Karen", "Emily", "Isabella", "Emma", "Ava",
+ "Madison", "Sophia", "Olivia", "Abigail", "Hannah", "Elizabeth",
+ "Addison", "Samantha", "Ashley", "Alyssa", "Mia", "Chloe", "Natalie",
+ "Sarah", "Alexis", "Grace", "Ella", "Brianna", "Hailey", "Taylor",
+ "Anna", "Kayla", "Lily", "Lauren", "Victoria", "Savannah", "Nevaeh",
+ "Jasmine", "Lillian", "Julia", "Sofia", "Kaylee", "Sydney",
+ "Gabriella", "Katherine", "Alexa", "Destiny", "Jessica", "Morgan",
+ "Kaitlyn", "Brooke", "Allison", "Makayla", "Avery", "Alexandra",
+ "Jocelyn");
+ girlsNames.addAll(femaleNames);
+ girlsNamesWithDefault.addAll(femaleNames);
+ girlsNamesWithDefault.setDefaultSuggestionsFromText(femaleNames);
+ }
+
+ /**
+ * This is the entry point method.
+ */
+ public Widget createIssue() {
+ VerticalPanel panel = new VerticalPanel();
+
+ panel.add(new HTML(
+ "Select the show button, nothing should open <br/> Type 'e' and select the button again, now a suggestion list should open and close."));
+ panel.add(manuallyShowAndHide());
+ panel.add(new Label(
+ "Click on suggest box, it should open automatically. Check that First item is not selected"));
+ panel.add(suggestBoxWithDefault());
+ return panel;
+ }
+
+ @Override
+ public String getInstructions() {
+ return "Follow the directions above each suggest box";
+ }
+
+ @Override
+ public String getSummary() {
+ return "suggest box visuals";
+ }
+
+ @Override
+ public boolean hasCSS() {
+ return false;
+ }
+
+ private Widget manuallyShowAndHide() {
+ FlexTable t = new FlexTable();
+ t.getFlexCellFormatter().setColSpan(0, 0, 20);
+ final SuggestBox box = simpleSuggestBox();
+ box.setAnimationEnabled(true);
+ t.setWidget(0, 0, box);
+
+ Button showSuggestions = new Button(
+ "show suggestions, then hide after 2 seconds", new ClickHandler() {
+ public void onClick(ClickEvent event) {
+ box.showSuggestionList();
+ new Timer() {
+
+ @Override
+ public void run() {
+ box.hideSuggestionList();
+ }
+
+ }.schedule(2000);
+ }
+ });
+ t.setWidget(1, 0, showSuggestions);
+ return t;
+ }
+
+ private SuggestBox simpleSuggestBox() {
+
+ SuggestBox b = new SuggestBox(girlsNames);
+ return b;
+ }
+
+ private SuggestBox suggestBoxWithDefault() {
+ final SuggestBox b = new SuggestBox(girlsNamesWithDefault);
+ b.setSelectsFirstItem(false);
+ b.getTextBox().addMouseDownHandler(new MouseDownHandler() {
+
+ public void onMouseDown(MouseDownEvent event) {
+ b.showSuggestionList();
+ }
+
+ });
+ return b;
+ }
+}
\ No newline at end of file
diff --git a/reference/code-museum/src/com/google/gwt/museum/client/defaultmuseum/VisualsForTextEvents.java b/reference/code-museum/src/com/google/gwt/museum/client/defaultmuseum/VisualsForTextEvents.java
index 5bff5ec..76cfe4a 100644
--- a/reference/code-museum/src/com/google/gwt/museum/client/defaultmuseum/VisualsForTextEvents.java
+++ b/reference/code-museum/src/com/google/gwt/museum/client/defaultmuseum/VisualsForTextEvents.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2008 Google Inc.
+ * Copyright 2009 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
@@ -18,6 +18,7 @@
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.event.dom.client.HandlesAllKeyEvents;
import com.google.gwt.museum.client.common.AbstractIssue;
import com.google.gwt.museum.client.common.EventReporter;
import com.google.gwt.user.client.ui.Button;
@@ -48,8 +49,7 @@
}
}));
b.addKeyboardListener(handler);
- handler.addKeyHandlersTo(b);
- b.addChangeHandler(handler);
+ HandlesAllKeyEvents.addHandlers(b, handler);
b.addChangeListener(handler);
b.addFocusHandler(handler);
b.addBlurHandler(handler);
@@ -62,7 +62,8 @@
p.add(rich);
handler = new EventReporter<String, Object>(p);
rich.addKeyboardListener(handler);
- handler.addKeyHandlersTo(rich);
+ HandlesAllKeyEvents.addHandlers(rich,handler);
+
rich.addBlurHandler(handler);
rich.addFocusHandler(handler);
rich.addClickHandler(handler);
diff --git a/reference/code-museum/src/com/google/gwt/museum/client/defaultmuseum/VisualsForTree.java b/reference/code-museum/src/com/google/gwt/museum/client/defaultmuseum/VisualsForTree.java
index ca8e319..8a280c1 100644
--- a/reference/code-museum/src/com/google/gwt/museum/client/defaultmuseum/VisualsForTree.java
+++ b/reference/code-museum/src/com/google/gwt/museum/client/defaultmuseum/VisualsForTree.java
@@ -18,8 +18,11 @@
import com.google.gwt.museum.client.common.AbstractIssue;
import com.google.gwt.user.client.ui.CheckBox;
+import com.google.gwt.user.client.ui.Focusable;
+import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.RadioButton;
+import com.google.gwt.user.client.ui.SimpleCheckBox;
import com.google.gwt.user.client.ui.SimplePanel;
import com.google.gwt.user.client.ui.Tree;
import com.google.gwt.user.client.ui.TreeItem;
@@ -30,8 +33,38 @@
* A simple tree used to quickly exercise tree behavior.
*/
public class VisualsForTree extends AbstractIssue {
+
+ static class DelegatingFocusPanel extends HorizontalPanel implements
+ Focusable {
+
+ public int getTabIndex() {
+ return getFocusable().getTabIndex();
+ }
+
+ public void setAccessKey(char key) {
+ getFocusable().setAccessKey(key);
+ }
+
+ public void setFocus(boolean focused) {
+ getFocusable().setFocus(focused);
+ }
+
+ public void setTabIndex(int index) {
+ getFocusable().setTabIndex(index);
+ }
+
+ private Focusable getFocusable() {
+ for (Widget widget : this.getChildren()) {
+ if (widget instanceof Focusable) {
+ return (Focusable) widget;
+ }
+ }
+ throw new IllegalArgumentException("No focusable children to focus on");
+ }
+ }
+
public static Tree createTree() {
- Tree t = new Tree();
+ Tree tree = new Tree();
TreeItem a = new TreeItem("a");
TreeItem b = new TreeItem(
"b, though this is a very, very long text field in order to trigger text wrapping bugs, if there are any such bugs currently in the tree.");
@@ -47,18 +80,38 @@
panel.setWidget(new Label("There should not be any space above me"));
TreeItem f = new TreeItem(panel);
- t.setSelectedItem(b);
- t.addItem(a);
- t.addItem(b);
- t.addItem(c);
- t.addItem(d);
- t.addItem(e);
- t.addItem(f);
+ tree.setSelectedItem(b);
+ tree.addItem(a);
+ tree.addItem(b);
+ tree.addItem(c);
+ tree.addItem(d);
+ tree.addItem(e);
+ tree.addItem(f);
b.addItem(ba);
b.addItem(bb);
bb.addItem(bba);
b.addItem(bc);
- return t;
+
+ // Focus checks
+ DelegatingFocusPanel focus = new DelegatingFocusPanel();
+ focus.add(new Label("first check box should have focus "));
+ focus.add(new SimpleCheckBox());
+ focus.add(new SimpleCheckBox());
+
+ final DelegatingFocusPanel focus2 = new DelegatingFocusPanel();
+ focus2.add(new Label("second check box should have focus "));
+ focus2.add(new SimpleCheckBox());
+ focus2.add(new SimpleCheckBox());
+
+ TreeItem customFocus = new TreeItem(focus2) {
+ @Override
+ public Focusable getFocusable() {
+ return (Focusable) focus2.getWidget(2);
+ }
+ };
+ tree.addItem(focus);
+ tree.addItem(customFocus);
+ return tree;
}
@Override
diff --git a/samples/build.xml b/samples/build.xml
index 81d72a3..3d44771 100644
--- a/samples/build.xml
+++ b/samples/build.xml
@@ -51,9 +51,7 @@
</antcall>
</gwt.timer>
<length property="gwt.sample.length">
- <fileset dir="${gwt.build.out}/samples">
- <include name="**/www/com*/**"/>
- </fileset>
+ <fileset dir="${gwt.build.out}/samples" includes="*/war/*/*.cache.html,*/war/*/*.cache.js"/>
</length>
<echo message="compiled size of all samples is ${gwt.sample.length} bytes."/>
</target>
diff --git a/samples/common.ant.xml b/samples/common.ant.xml
index 12df2bc..ef167f4 100755
--- a/samples/common.ant.xml
+++ b/samples/common.ant.xml
@@ -3,8 +3,8 @@
<property name="project.tail" value="samples/${sample.root}" />
<import file="${gwt.root}/common.ant.xml" />
- <property name="sample.package" value="${sample.root}" />
- <property name="sample.main" value="${sample.module}" />
+ <property name="sample.lower" value="${sample.root}" />
+ <property name="sample.upper" value="${sample.module}" />
<property.ensure name="gwt.user.jar" location="${gwt.build.lib}/gwt-user.jar" />
<!-- Platform shouldn't matter here, just picking one -->
@@ -13,18 +13,22 @@
<!-- Mirror directory for scripts; makes building distro easier -->
<property name="samples.scripts" value="${gwt.build.out}/samples-scripts" />
<!-- Use the uppercase name rather than the lowercase name -->
- <property name="sample.build" value="${gwt.build.out}/samples/${sample.main}" />
+ <property name="sample.build" value="${gwt.build.out}/samples/${sample.upper}" />
<target name="source" description="Copy source to the output folder">
<mkdir dir="${sample.build}/src" />
<copy todir="${sample.build}/src">
<fileset dir="src" />
</copy>
+ <mkdir dir="${sample.build}/war" />
+ <copy todir="${sample.build}/war">
+ <fileset dir="war" excludes="WEB-INF/classes/**"/>
+ </copy>
</target>
<target name="compile" description="Compile all java files">
- <mkdir dir="${sample.build}/bin" />
- <gwt.javac destdir="${sample.build}/bin">
+ <mkdir dir="${sample.build}/war/WEB-INF/classes" />
+ <gwt.javac destdir="${sample.build}/war/WEB-INF/classes">
<classpath>
<pathelement location="${gwt.user.jar}" />
<pathelement location="${gwt.dev.jar}" />
@@ -36,48 +40,47 @@
<outofdate>
<sourcefiles>
<fileset dir="src" />
- <fileset dir="${sample.build}/bin" />
+ <fileset dir="${sample.build}/war/WEB-INF/classes" />
<fileset file="${gwt.user.jar}" />
<fileset file="${gwt.dev.jar}" />
</sourcefiles>
- <targetfiles path="${sample.build}/www/com.google.gwt.sample.${sample.package}.${sample.module}/com.google.gwt.sample.${sample.package}.${sample.module}.nocache.js" />
+ <targetfiles path="${sample.build}/war/${sample.lower}/${sample.lower}.nocache.js" />
<sequential>
- <mkdir dir="${sample.build}/www" />
- <gwt.timer name="${sample.main}">
- <java dir="${sample.build}" classname="com.google.gwt.dev.GWTCompiler" classpath="src:${sample.build}/bin:${gwt.user.jar}:${gwt.dev.jar}" fork="yes" failonerror="true">
+ <mkdir dir="${sample.build}/war" />
+ <gwt.timer name="${sample.upper}">
+ <java dir="${sample.build}" classname="com.google.gwt.dev.Compiler" classpath="src:${sample.build}/war/WEB-INF/classes:${gwt.user.jar}:${gwt.dev.jar}" fork="yes" failonerror="true">
<jvmarg value="-Xmx256M"/>
- <arg value="-out" />
- <arg file="${sample.build}/www" />
- <arg value="com.google.gwt.sample.${sample.package}.${sample.module}" />
+ <arg value="-war" />
+ <arg file="${sample.build}/war" />
+ <arg value="com.google.gwt.sample.${sample.lower}.${sample.upper}" />
</java>
</gwt.timer>
<length property="sample.size">
- <fileset dir="${sample.build}/www/com.google.gwt.sample.${sample.package}.${sample.module}"/>
+ <fileset dir="${sample.build}/war/${sample.lower}" includes="*.cache.html,*.cache.js"/>
</length>
- <echo message="output size for ${sample.main} is ${sample.size} bytes"/>
+ <echo message="output size for ${sample.upper} is ${sample.size} bytes"/>
</sequential>
</outofdate>
</target>
- <macrodef name="applicationCreator">
+ <macrodef name="webAppCreator">
<attribute name="platform" />
<attribute name="extension" default="" />
<sequential>
<outofdate>
<sourcefiles />
<targetfiles>
- <pathelement location="${samples.scripts}/@{platform}/${sample.main}/${sample.main}-compile@{extension}" />
- <pathelement location="${samples.scripts}/@{platform}/${sample.main}/${sample.main}-shell@{extension}" />
+ <pathelement location="${samples.scripts}/@{platform}/${sample.upper}/build.xml" />
</targetfiles>
<sequential>
- <mkdir dir="${samples.scripts}/@{platform}/${sample.main}" />
- <java classname="com.google.gwt.user.tools.ApplicationCreator" classpath="${gwt.user.jar}:${gwt.dev.jar}" failonerror="true">
+ <mkdir dir="${samples.scripts}/@{platform}/${sample.upper}" />
+ <java classname="com.google.gwt.user.tools.WebAppCreator" classpath="${gwt.user.jar}:${gwt.dev.jar}" failonerror="true">
<!-- Relative path is important! Paths will be relative in final distro -->
<sysproperty key="gwt.devjar" value="../../gwt-dev-@{platform}.jar" />
- <arg value="-ignore" />
+ <arg value="-overwrite" />
<arg value="-out" />
- <arg file="${samples.scripts}/@{platform}/${sample.main}" />
- <arg value="com.google.gwt.sample.${sample.package}.client.${sample.main}" />
+ <arg file="${samples.scripts}/@{platform}/${sample.upper}" />
+ <arg value="com.google.gwt.sample.${sample.lower}.${sample.upper}" />
</java>
</sequential>
</outofdate>
@@ -85,9 +88,9 @@
</macrodef>
<target name="scripts" description="Create launch scripts">
- <applicationCreator platform="linux" />
- <applicationCreator platform="windows" extension=".cmd" />
- <applicationCreator platform="mac" />
+ <webAppCreator platform="linux" />
+ <webAppCreator platform="windows" extension=".cmd" />
+ <webAppCreator platform="mac" />
</target>
<target name="build" depends="source, compile, gwtc, scripts" description="Build and package this project" />
@@ -102,7 +105,7 @@
<delete dir="${sample.build}" />
<delete includeemptydirs="true">
<fileset dir="${samples.scripts}">
- <include name="*/${sample.main}/**" />
+ <include name="*/${sample.upper}/**" />
</fileset>
</delete>
</target>
diff --git a/samples/dynatable/src/com/google/gwt/sample/dynatable/DynaTable.gwt.xml b/samples/dynatable/src/com/google/gwt/sample/dynatable/DynaTable.gwt.xml
index a23f676..137a008 100644
--- a/samples/dynatable/src/com/google/gwt/sample/dynatable/DynaTable.gwt.xml
+++ b/samples/dynatable/src/com/google/gwt/sample/dynatable/DynaTable.gwt.xml
@@ -12,7 +12,7 @@
<!-- implied. License for the specific language governing permissions and -->
<!-- limitations under the License. -->
-<module>
+<module rename-to="dynatable">
<inherits name='com.google.gwt.user.User'/>
<entry-point class='com.google.gwt.sample.dynatable.client.DynaTable'/>
<servlet path='/calendar' class='com.google.gwt.sample.dynatable.server.SchoolCalendarServiceImpl'/>
diff --git a/samples/dynatable/src/com/google/gwt/sample/dynatable/DynaTable2.gwt.xml b/samples/dynatable/src/com/google/gwt/sample/dynatable/DynaTable2.gwt.xml
deleted file mode 100644
index 64a55e8..0000000
--- a/samples/dynatable/src/com/google/gwt/sample/dynatable/DynaTable2.gwt.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<!-- -->
-<!-- Copyright 2007 Google Inc. -->
-<!-- Licensed under the Apache License, Version 2.0 (the "License"); you -->
-<!-- may not use this file except in compliance with the License. You may -->
-<!-- may obtain a copy of the License at -->
-<!-- -->
-<!-- http://www.apache.org/licenses/LICENSE-2.0 -->
-<!-- -->
-<!-- Unless required by applicable law or agreed to in writing, software -->
-<!-- distributed under the License is distributed on an "AS IS" BASIS, -->
-<!-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or -->
-<!-- implied. License for the specific language governing permissions and -->
-<!-- limitations under the License. -->
-
-<module rename-to="dynatable" deploy-to="/gwtc">
- <inherits name='com.google.gwt.user.User'/>
- <entry-point class='com.google.gwt.sample.dynatable.client.DynaTable'/>
-</module>
-
-
diff --git a/samples/dynatable/src/com/google/gwt/sample/dynatable/public/DynaTable.css b/samples/dynatable/war/DynaTable.css
similarity index 100%
rename from samples/dynatable/src/com/google/gwt/sample/dynatable/public/DynaTable.css
rename to samples/dynatable/war/DynaTable.css
diff --git a/samples/dynatable/src/com/google/gwt/sample/dynatable/public/DynaTable.html b/samples/dynatable/war/DynaTable.html
similarity index 93%
rename from samples/dynatable/src/com/google/gwt/sample/dynatable/public/DynaTable.html
rename to samples/dynatable/war/DynaTable.html
index 7df5ec8..8ede80d 100644
--- a/samples/dynatable/src/com/google/gwt/sample/dynatable/public/DynaTable.html
+++ b/samples/dynatable/war/DynaTable.html
@@ -21,7 +21,7 @@
</head>
<body>
<iframe src="javascript:''" id='__gwt_historyFrame' tabIndex='-1' style='width:0;height:0;border:0'></iframe>
- <script type="text/javascript" language='javascript' src='com.google.gwt.sample.dynatable.DynaTable.nocache.js'></script>
+ <script type="text/javascript" language='javascript' src='dynatable/dynatable.nocache.js'></script>
<h1>School Schedule for Professors and Students</h1>
<table width="100%" border="0" summary="School Schedule for Professors and Students">
<tr valign="top">
diff --git a/samples/dynatable/war/WEB-INF/classes/marker b/samples/dynatable/war/WEB-INF/classes/marker
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/samples/dynatable/war/WEB-INF/classes/marker
diff --git a/samples/dynatable/war/WEB-INF/web.xml b/samples/dynatable/war/WEB-INF/web.xml
new file mode 100644
index 0000000..d1b2b78
--- /dev/null
+++ b/samples/dynatable/war/WEB-INF/web.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app>
+
+ <servlet>
+ <servlet-name>calendar</servlet-name>
+ <servlet-class>
+ com.google.gwt.sample.dynatable.server.SchoolCalendarServiceImpl
+ </servlet-class>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>calendar</servlet-name>
+ <url-pattern>/dynatable/calendar</url-pattern>
+ </servlet-mapping>
+
+</web-app>
diff --git a/samples/hello/src/com/google/gwt/sample/hello/Hello.gwt.xml b/samples/hello/src/com/google/gwt/sample/hello/Hello.gwt.xml
index 8cc53cd..e5432b9 100644
--- a/samples/hello/src/com/google/gwt/sample/hello/Hello.gwt.xml
+++ b/samples/hello/src/com/google/gwt/sample/hello/Hello.gwt.xml
@@ -12,7 +12,7 @@
<!-- implied. License for the specific language governing permissions and -->
<!-- limitations under the License. -->
-<module>
+<module rename-to="hello">
<inherits name="com.google.gwt.user.User"/>
<entry-point class="com.google.gwt.sample.hello.client.Hello"/>
</module>
diff --git a/samples/hello/src/com/google/gwt/sample/hello/public/Hello.html b/samples/hello/war/Hello.html
similarity index 91%
rename from samples/hello/src/com/google/gwt/sample/hello/public/Hello.html
rename to samples/hello/war/Hello.html
index eeedb3c..ba2d093 100644
--- a/samples/hello/src/com/google/gwt/sample/hello/public/Hello.html
+++ b/samples/hello/war/Hello.html
@@ -19,6 +19,6 @@
<title>Hello</title>
</head>
<body bgcolor="white">
- <script type="text/javascript" language="javascript" src="com.google.gwt.sample.hello.Hello.nocache.js"></script>
+ <script type="text/javascript" language="javascript" src="hello/hello.nocache.js"></script>
</body>
</html>
diff --git a/samples/hello/war/WEB-INF/classes/marker b/samples/hello/war/WEB-INF/classes/marker
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/samples/hello/war/WEB-INF/classes/marker
diff --git a/samples/i18n/src/com/google/gwt/sample/i18n/I18N.gwt.xml b/samples/i18n/src/com/google/gwt/sample/i18n/I18N.gwt.xml
index 69e34a2..ae0afae 100644
--- a/samples/i18n/src/com/google/gwt/sample/i18n/I18N.gwt.xml
+++ b/samples/i18n/src/com/google/gwt/sample/i18n/I18N.gwt.xml
@@ -12,7 +12,7 @@
<!-- implied. License for the specific language governing permissions and -->
<!-- limitations under the License. -->
-<module>
+<module rename-to="i18n">
<inherits name="com.google.gwt.user.User" />
<inherits name="com.google.gwt.i18n.I18N"/>
<entry-point class="com.google.gwt.sample.i18n.client.I18N" />
diff --git a/samples/i18n/src/com/google/gwt/sample/i18n/public/I18N.css b/samples/i18n/war/I18N.css
similarity index 100%
rename from samples/i18n/src/com/google/gwt/sample/i18n/public/I18N.css
rename to samples/i18n/war/I18N.css
diff --git a/samples/i18n/src/com/google/gwt/sample/i18n/public/I18N.html b/samples/i18n/war/I18N.html
similarity index 99%
rename from samples/i18n/src/com/google/gwt/sample/i18n/public/I18N.html
rename to samples/i18n/war/I18N.html
index fa1e8cc..93435c3 100644
--- a/samples/i18n/src/com/google/gwt/sample/i18n/public/I18N.html
+++ b/samples/i18n/war/I18N.html
@@ -38,7 +38,7 @@
<title>Internationalization Sample</title>
<script type="text/javascript" language="javascript"
- src="com.google.gwt.sample.i18n.I18N.nocache.js"></script>
+ src="i18n/i18n.nocache.js"></script>
</head>
diff --git a/samples/i18n/war/WEB-INF/classes/marker b/samples/i18n/war/WEB-INF/classes/marker
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/samples/i18n/war/WEB-INF/classes/marker
diff --git a/samples/json/src/com/google/gwt/sample/json/JSON.gwt.xml b/samples/json/src/com/google/gwt/sample/json/JSON.gwt.xml
index a0b8262..a8c264b 100644
--- a/samples/json/src/com/google/gwt/sample/json/JSON.gwt.xml
+++ b/samples/json/src/com/google/gwt/sample/json/JSON.gwt.xml
@@ -12,7 +12,7 @@
<!-- implied. License for the specific language governing permissions and -->
<!-- limitations under the License. -->
-<module>
+<module rename-to="json">
<inherits name='com.google.gwt.user.User'/>
<inherits name='com.google.gwt.http.HTTP'/>
<inherits name='com.google.gwt.json.JSON'/>
diff --git a/samples/json/src/com/google/gwt/sample/json/client/JSON.java b/samples/json/src/com/google/gwt/sample/json/client/JSON.java
index 7c20f98..47b16d7 100644
--- a/samples/json/src/com/google/gwt/sample/json/client/JSON.java
+++ b/samples/json/src/com/google/gwt/sample/json/client/JSON.java
@@ -15,6 +15,7 @@
*/
package com.google.gwt.sample.json.client;
+import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.http.client.Request;
@@ -50,7 +51,6 @@
/**
* Class for handling the response text associated with a request for a JSON
* object.
- *
*/
private class JSONResponseTextHandler implements RequestCallback {
public void onError(Request request, Throwable exception) {
@@ -84,13 +84,11 @@
* Default URL to use to fetch JSON objects. Note that the contents of this
* JSON result were as a result of requesting the following URL:
*
- *
- *
- *
* http://api.search.yahoo.com/ImageSearchService/V1/imageSearch?appid=YahooDemo
* &query=potato&results=2&output=json
*/
- private static final String DEFAULT_SEARCH_URL = "search-results.js";
+ private static final String DEFAULT_SEARCH_URL = GWT.getModuleBaseURL()
+ + "search-results.js";
/*
* Text displayed on the fetch button when we are in a default state.
@@ -102,14 +100,14 @@
*/
private static final String SEARCH_BUTTON_WAITING_TEXT = "Waiting for JSON Response...";
+ private Tree jsonTree = new Tree();
+
/*
* RequestBuilder used to issue HTTP GET requests.
*/
private final RequestBuilder requestBuilder = new RequestBuilder(
RequestBuilder.GET, DEFAULT_SEARCH_URL);
- private Tree jsonTree = new Tree();
-
private Button searchButton = new Button();
/**
diff --git a/samples/json/src/com/google/gwt/sample/json/public/JSON.css b/samples/json/war/JSON.css
similarity index 100%
rename from samples/json/src/com/google/gwt/sample/json/public/JSON.css
rename to samples/json/war/JSON.css
diff --git a/samples/json/src/com/google/gwt/sample/json/public/JSON.html b/samples/json/war/JSON.html
similarity index 92%
rename from samples/json/src/com/google/gwt/sample/json/public/JSON.html
rename to samples/json/war/JSON.html
index b3367e6..fd38344 100644
--- a/samples/json/src/com/google/gwt/sample/json/public/JSON.html
+++ b/samples/json/war/JSON.html
@@ -16,12 +16,11 @@
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
- <link type="text/css" rel='stylesheet' href='JSON.css'>
+ <link type="text/css" rel='stylesheet' href='JSON.css'>
<title>JSON Interoperability Example</title>
</head>
<body>
- <script type="text/javascript" language='javascript'
- src='com.google.gwt.sample.json.JSON.nocache.js'></script>
+ <script type="text/javascript" language='javascript' src='json/json.nocache.js'></script>
<h1>JSON Interop Using JSNI</h1>
diff --git a/samples/json/war/WEB-INF/classes/marker b/samples/json/war/WEB-INF/classes/marker
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/samples/json/war/WEB-INF/classes/marker
diff --git a/samples/mail/src/com/google/gwt/sample/mail/Mail.gwt.xml b/samples/mail/src/com/google/gwt/sample/mail/Mail.gwt.xml
index ac13a60..6cca2a8 100644
--- a/samples/mail/src/com/google/gwt/sample/mail/Mail.gwt.xml
+++ b/samples/mail/src/com/google/gwt/sample/mail/Mail.gwt.xml
@@ -12,8 +12,7 @@
<!-- implied. License for the specific language governing permissions and -->
<!-- limitations under the License. -->
-<module>
+<module rename-to="mail">
<inherits name='com.google.gwt.user.User'/>
<entry-point class='com.google.gwt.sample.mail.client.Mail'/>
- <stylesheet src='Mail.css'/>
</module>
diff --git a/samples/mail/src/com/google/gwt/sample/mail/client/Shortcuts.java b/samples/mail/src/com/google/gwt/sample/mail/client/Shortcuts.java
index 211aafe..c58b71a 100644
--- a/samples/mail/src/com/google/gwt/sample/mail/client/Shortcuts.java
+++ b/samples/mail/src/com/google/gwt/sample/mail/client/Shortcuts.java
@@ -51,9 +51,9 @@
*/
public Shortcuts(Images images) {
// Create the groups within the stack panel.
- add(images, new Mailboxes(images), images.mailgroup(), "Mail");
- add(images, new Tasks(), images.tasksgroup(), "Tasks");
- add(images, new Contacts(images), images.contactsgroup(), "Contacts");
+ add(new Mailboxes(images), images.mailgroup(), "Mail");
+ add(new Tasks(), images.tasksgroup(), "Tasks");
+ add(new Contacts(images), images.contactsgroup(), "Contacts");
initWidget(stackPanel);
}
@@ -64,8 +64,8 @@
stackPanel.showStack(0);
}
- private void add(Images images, Widget widget,
- AbstractImagePrototype imageProto, String caption) {
+ private void add(Widget widget, AbstractImagePrototype imageProto,
+ String caption) {
widget.addStyleName("mail-StackContent");
stackPanel.add(widget, createHeaderHTML(imageProto, caption), true);
}
diff --git a/samples/mail/src/com/google/gwt/sample/mail/public/Mail.css b/samples/mail/war/Mail.css
similarity index 100%
rename from samples/mail/src/com/google/gwt/sample/mail/public/Mail.css
rename to samples/mail/war/Mail.css
diff --git a/samples/mail/src/com/google/gwt/sample/mail/public/Mail.html b/samples/mail/war/Mail.html
similarity index 88%
rename from samples/mail/src/com/google/gwt/sample/mail/public/Mail.html
rename to samples/mail/war/Mail.html
index 2fd2947..8f34e6e 100644
--- a/samples/mail/src/com/google/gwt/sample/mail/public/Mail.html
+++ b/samples/mail/war/Mail.html
@@ -15,10 +15,10 @@
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <link type="text/css" rel='stylesheet' href='Mail.css'>
<title>Mail App</title>
</head>
<body>
- <script type="text/javascript" language='javascript'
- src='com.google.gwt.sample.mail.Mail.nocache.js'></script>
+ <script type="text/javascript" language='javascript' src='mail/mail.nocache.js'></script>
</body>
</html>
diff --git a/samples/mail/war/WEB-INF/classes/marker b/samples/mail/war/WEB-INF/classes/marker
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/samples/mail/war/WEB-INF/classes/marker
diff --git a/samples/mail/src/com/google/gwt/sample/mail/public/gradient.gif b/samples/mail/war/gradient.gif
similarity index 100%
rename from samples/mail/src/com/google/gwt/sample/mail/public/gradient.gif
rename to samples/mail/war/gradient.gif
Binary files differ
diff --git a/samples/mail/src/com/google/gwt/sample/mail/public/leftCorner.gif b/samples/mail/war/leftCorner.gif
similarity index 100%
rename from samples/mail/src/com/google/gwt/sample/mail/public/leftCorner.gif
rename to samples/mail/war/leftCorner.gif
Binary files differ
diff --git a/samples/mail/src/com/google/gwt/sample/mail/public/rightCorner.gif b/samples/mail/war/rightCorner.gif
similarity index 100%
rename from samples/mail/src/com/google/gwt/sample/mail/public/rightCorner.gif
rename to samples/mail/war/rightCorner.gif
Binary files differ
diff --git a/samples/showcase/src/com/google/gwt/sample/showcase/Showcase.gwt.xml b/samples/showcase/src/com/google/gwt/sample/showcase/Showcase.gwt.xml
index d25810a..4a3b79f 100644
--- a/samples/showcase/src/com/google/gwt/sample/showcase/Showcase.gwt.xml
+++ b/samples/showcase/src/com/google/gwt/sample/showcase/Showcase.gwt.xml
@@ -1,4 +1,4 @@
-<module>
+<module rename-to="showcase">
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name="com.google.gwt.core.Core"/>
<inherits name='com.google.gwt.user.User'/>
diff --git a/samples/showcase/src/com/google/gwt/sample/showcase/public/Showcase.html b/samples/showcase/war/Showcase.html
similarity index 81%
rename from samples/showcase/src/com/google/gwt/sample/showcase/public/Showcase.html
rename to samples/showcase/war/Showcase.html
index 0f4f1c9..33c7752 100644
--- a/samples/showcase/src/com/google/gwt/sample/showcase/public/Showcase.html
+++ b/samples/showcase/war/Showcase.html
@@ -10,7 +10,7 @@
lastLogOn: "2/2/2006"
};
</script>
- <script language='javascript' src='com.google.gwt.sample.showcase.Showcase.nocache.js'></script>
+ <script language='javascript' src='showcase/showcase.nocache.js'></script>
</head>
<body>
<iframe src="javascript:''" id="__gwt_historyFrame" style="position:absolute;width:0;height:0;border:0"></iframe>
diff --git a/samples/showcase/war/WEB-INF/classes/marker b/samples/showcase/war/WEB-INF/classes/marker
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/samples/showcase/war/WEB-INF/classes/marker
diff --git a/samples/simplerpc/src/com/google/gwt/sample/simplerpc/SimpleRPC.gwt.xml b/samples/simplerpc/src/com/google/gwt/sample/simplerpc/SimpleRPC.gwt.xml
index 76b3778..deee741 100644
--- a/samples/simplerpc/src/com/google/gwt/sample/simplerpc/SimpleRPC.gwt.xml
+++ b/samples/simplerpc/src/com/google/gwt/sample/simplerpc/SimpleRPC.gwt.xml
@@ -12,10 +12,8 @@
<!-- implied. License for the specific language governing permissions and -->
<!-- limitations under the License. -->
-<module>
+<module rename-to="simplerpc">
<inherits name='com.google.gwt.user.User'/>
<entry-point class='com.google.gwt.sample.simplerpc.client.SimpleRPC'/>
<servlet path='/simpleRPC' class='com.google.gwt.sample.simplerpc.server.SimpleRPCServiceImpl'/>
</module>
-
-
diff --git a/samples/simplerpc/src/com/google/gwt/sample/simplerpc/client/SimpleRPC.java b/samples/simplerpc/src/com/google/gwt/sample/simplerpc/client/SimpleRPC.java
index 18a1cc1..c405009 100644
--- a/samples/simplerpc/src/com/google/gwt/sample/simplerpc/client/SimpleRPC.java
+++ b/samples/simplerpc/src/com/google/gwt/sample/simplerpc/client/SimpleRPC.java
@@ -19,7 +19,6 @@
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.google.gwt.user.client.rpc.ServiceDefTarget;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.Panel;
@@ -142,21 +141,6 @@
* the asynchronous interface automatically.
*/
private SimpleRPCServiceAsync createSimpleRPCServiceAsync() {
- SimpleRPCServiceAsync simpleRPCService = GWT.create(SimpleRPCService.class);
- setServiceURL(simpleRPCService);
- return simpleRPCService;
- }
-
- /**
- * Sets the URL where our service implementation is running.
- * <p>
- * Note that due to the same origin security policy enforced by the browser
- * implementations the target URL must reside on the same domain, port and
- * protocol from which the host page was served.
- */
- private void setServiceURL(SimpleRPCServiceAsync simpleRPCService) {
- ServiceDefTarget endpoint = (ServiceDefTarget) simpleRPCService;
- String moduleRelativeURL = GWT.getModuleBaseURL() + "simpleRPC";
- endpoint.setServiceEntryPoint(moduleRelativeURL);
+ return GWT.<SimpleRPCServiceAsync> create(SimpleRPCService.class);
}
}
diff --git a/samples/simplerpc/src/com/google/gwt/sample/simplerpc/client/SimpleRPCException.java b/samples/simplerpc/src/com/google/gwt/sample/simplerpc/client/SimpleRPCException.java
index 9fa5b8f..4b646d3 100644
--- a/samples/simplerpc/src/com/google/gwt/sample/simplerpc/client/SimpleRPCException.java
+++ b/samples/simplerpc/src/com/google/gwt/sample/simplerpc/client/SimpleRPCException.java
@@ -13,24 +13,23 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
-
package com.google.gwt.sample.simplerpc.client;
-import com.google.gwt.user.client.rpc.SerializableException;
-
/**
* Simple RPC exception.
*/
-public class SimpleRPCException extends SerializableException {
+public class SimpleRPCException extends Exception {
- /**
- * Constructor for <code>SimpleRPCException</code>. Needed to support serialization.
+ /**
+ * Constructor for <code>SimpleRPCException</code>. Needed to support
+ * serialization.
*/
public SimpleRPCException() {
}
/**
* Constructor for <code>SimpleRPCException</code>.
+ *
* @param message message for the <code>SimplePRCException</code>
*/
public SimpleRPCException(String message) {
diff --git a/samples/simplerpc/src/com/google/gwt/sample/simplerpc/client/SimpleRPCService.java b/samples/simplerpc/src/com/google/gwt/sample/simplerpc/client/SimpleRPCService.java
index 8911550..93e9ce7 100644
--- a/samples/simplerpc/src/com/google/gwt/sample/simplerpc/client/SimpleRPCService.java
+++ b/samples/simplerpc/src/com/google/gwt/sample/simplerpc/client/SimpleRPCService.java
@@ -16,6 +16,7 @@
package com.google.gwt.sample.simplerpc.client;
import com.google.gwt.user.client.rpc.RemoteService;
+import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
import java.util.List;
import java.util.Map;
@@ -23,6 +24,7 @@
/**
* The sample service.
*/
+@RemoteServiceRelativePath("simpleRPC")
public interface SimpleRPCService extends RemoteService {
/**
* Returns a string from the server associated with the given index.
@@ -36,9 +38,6 @@
/**
* Given a list of indexes, returns a map of indexes --> string values.
*
- * @gwt.typeArgs indexes <java.lang.Integer>
- * @gwt.typeArgs <java.lang.String>
- *
* @param indexes indexes to be mapped
* @return map of indexes --> string values
*/
diff --git a/samples/simplerpc/src/com/google/gwt/sample/simplerpc/public/SimpleRPC.css b/samples/simplerpc/war/SimpleRPC.css
similarity index 100%
rename from samples/simplerpc/src/com/google/gwt/sample/simplerpc/public/SimpleRPC.css
rename to samples/simplerpc/war/SimpleRPC.css
diff --git a/samples/simplerpc/src/com/google/gwt/sample/simplerpc/public/SimpleRPC.html b/samples/simplerpc/war/SimpleRPC.html
similarity index 92%
rename from samples/simplerpc/src/com/google/gwt/sample/simplerpc/public/SimpleRPC.html
rename to samples/simplerpc/war/SimpleRPC.html
index 5e4e762..2b9f758 100644
--- a/samples/simplerpc/src/com/google/gwt/sample/simplerpc/public/SimpleRPC.html
+++ b/samples/simplerpc/war/SimpleRPC.html
@@ -21,8 +21,7 @@
</head>
<body>
<iframe src="javascript:''" id='__gwt_historyFrame' tabIndex='-1' style='width:0;height:0;border:0'></iframe>
- <script type="text/javascript" language='javascript' src='com.google.gwt.sample.simplerpc.SimpleRPC.nocache.js'>
- </script>
+ <script type="text/javascript" language='javascript' src='simplerpc/simplerpc.nocache.js'></script>
<h1> Simple RPC</h1>
<p>
Simple example of RPC, check out the DynaTable sample if you want to see real RPC coolness.
diff --git a/samples/simplerpc/war/WEB-INF/classes/marker b/samples/simplerpc/war/WEB-INF/classes/marker
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/samples/simplerpc/war/WEB-INF/classes/marker
diff --git a/samples/simplerpc/war/WEB-INF/web.xml b/samples/simplerpc/war/WEB-INF/web.xml
new file mode 100644
index 0000000..30af99f
--- /dev/null
+++ b/samples/simplerpc/war/WEB-INF/web.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app>
+
+ <servlet>
+ <servlet-name>simpleRPC</servlet-name>
+ <servlet-class>
+ com.google.gwt.sample.simplerpc.server.SimpleRPCServiceImpl
+ </servlet-class>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>simpleRPC</servlet-name>
+ <url-pattern>/simplerpc/simpleRPC</url-pattern>
+ </servlet-mapping>
+
+</web-app>
diff --git a/samples/simplexml/src/com/google/gwt/sample/simplexml/SimpleXML.gwt.xml b/samples/simplexml/src/com/google/gwt/sample/simplexml/SimpleXML.gwt.xml
index 2f0ddfc..7d531a4 100644
--- a/samples/simplexml/src/com/google/gwt/sample/simplexml/SimpleXML.gwt.xml
+++ b/samples/simplexml/src/com/google/gwt/sample/simplexml/SimpleXML.gwt.xml
@@ -12,7 +12,7 @@
<!-- implied. License for the specific language governing permissions and -->
<!-- limitations under the License. -->
-<module>
+<module rename-to="simplexml">
<inherits name="com.google.gwt.user.User"/>
<inherits name ="com.google.gwt.http.HTTP"/>
<inherits name ="com.google.gwt.xml.XML"/>
diff --git a/samples/simplexml/src/com/google/gwt/sample/simplexml/public/SimpleXML.css b/samples/simplexml/war/SimpleXML.css
similarity index 100%
rename from samples/simplexml/src/com/google/gwt/sample/simplexml/public/SimpleXML.css
rename to samples/simplexml/war/SimpleXML.css
diff --git a/samples/simplexml/src/com/google/gwt/sample/simplexml/public/SimpleXML.html b/samples/simplexml/war/SimpleXML.html
similarity index 91%
rename from samples/simplexml/src/com/google/gwt/sample/simplexml/public/SimpleXML.html
rename to samples/simplexml/war/SimpleXML.html
index 6c2ba07..c134c61 100644
--- a/samples/simplexml/src/com/google/gwt/sample/simplexml/public/SimpleXML.html
+++ b/samples/simplexml/war/SimpleXML.html
@@ -20,8 +20,7 @@
<link rel="stylesheet" type="text/css" href="SimpleXML.css">
</head>
<body bgcolor="white">
- <script type="text/javascript" language="javascript" src="com.google.gwt.sample.simplexml.SimpleXML.nocache.js">
- </script>
+ <script type="text/javascript" language="javascript" src="simplexml/simplexml.nocache.js"></script>
<h1> Simple XML Example</h1>
<p>
Simple example of loading an XML file from the server and parsing it.
diff --git a/samples/simplexml/war/WEB-INF/classes/marker b/samples/simplexml/war/WEB-INF/classes/marker
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/samples/simplexml/war/WEB-INF/classes/marker
diff --git a/tools/api-checker/build.xml b/tools/api-checker/build.xml
index 8afcaea..52e8864 100755
--- a/tools/api-checker/build.xml
+++ b/tools/api-checker/build.xml
@@ -37,7 +37,6 @@
<mkdir dir="${gwt.build.lib}" />
<gwt.jar>
- <fileset dir="src" excludes="**/package.html" />
<fileset dir="${javac.out}" />
</gwt.jar>
</target>
diff --git a/tools/api-checker/config/gwt15_16userApi.conf b/tools/api-checker/config/gwt15_16userApi.conf
index e55f642..020f74a 100644
--- a/tools/api-checker/config/gwt15_16userApi.conf
+++ b/tools/api-checker/config/gwt15_16userApi.conf
@@ -3,8 +3,38 @@
dirRoot_old @OLDROOT@/
name_old gwt15userApi
#sourceFiles and excludedFiles are specified as colon-separated list of files
-sourceFiles_old dev/core/super:user/src:user/super
-excludedFiles_old user/src/com/google/gwt/benchmarks:user/src/com/google/gwt/i18n/rebind:user/src/com/google/gwt/i18n/tools:user/src/com/google/gwt/json:user/src/com/google/gwt/junit:user/src/com/google/gwt/user/client/rpc/core/java/util/LinkedHashMap_CustomFieldSerializer.java:user/src/com/google/gwt/user/rebind:user/src/com/google/gwt/user/server:user/src/com/google/gwt/user/tools:user/super/com/google/gwt/benchmarks:user/super/com/google/gwt/junit
+sourceFiles_old dev/core/super\
+:user/src\
+:user/super\
+
+excludedFiles_old user/src/com/google/gwt/benchmarks/BenchmarkReport.java\
+:user/src/com/google/gwt/benchmarks/BenchmarkShell.java\
+:user/src/com/google/gwt/benchmarks/client/Benchmark.java\
+:user/src/com/google/gwt/benchmarks/rebind\
+:user/src/com/google/gwt/i18n/rebind\
+:user/src/com/google/gwt/i18n/tools\
+:user/src/com/google/gwt/junit/GWTMockUtilities.java\
+:user/src/com/google/gwt/junit/GWTDummyBridge.java\
+:user/src/com/google/gwt/junit/JUnitMessageQueue.java\
+:user/src/com/google/gwt/junit/JUnitShell.java\
+:user/src/com/google/gwt/junit/RunStyle.java\
+:user/src/com/google/gwt/junit/RunStyleExternalBrowser.java\
+:user/src/com/google/gwt/junit/RunStyleLocalHosted.java\
+:user/src/com/google/gwt/junit/RunStyleLocalWeb.java\
+:user/src/com/google/gwt/junit/RunStyleManual.java\
+:user/src/com/google/gwt/junit/RunStyleRemote.java\
+:user/src/com/google/gwt/junit/RunStyleRemoteWeb.java\
+:user/src/com/google/gwt/junit/RunStyleSelenium.java\
+:user/src/com/google/gwt/junit/client/GWTTestCase.java\
+:user/src/com/google/gwt/junit/client/impl/GWTRunner.java\
+:user/src/com/google/gwt/junit/rebind\
+:user/src/com/google/gwt/junit/remote\
+:user/src/com/google/gwt/junit/server\
+:user/src/com/google/gwt/junit/tools\
+:user/src/com/google/gwt/user/client/rpc/core/java/util/LinkedHashMap_CustomFieldSerializer.java\
+:user/src/com/google/gwt/user/rebind\
+:user/src/com/google/gwt/user/server\
+:user/src/com/google/gwt/user/tools\
##############################################
#new Api
@@ -12,12 +42,49 @@
dirRoot_new ./
name_new gwt16userApi
#sourceFiles and excludedFiles are specified as colon-separated list of files
-sourceFiles_new dev/core/super:user/src:user/super
-excludedFiles_new user/src/com/google/gwt/benchmarks:user/src/com/google/gwt/i18n/rebind:user/src/com/google/gwt/i18n/tools:user/src/com/google/gwt/json:user/src/com/google/gwt/junit:user/src/com/google/gwt/user/client/rpc/core/java/util/LinkedHashMap_CustomFieldSerializer.java:user/src/com/google/gwt/user/rebind:user/src/com/google/gwt/user/server:user/src/com/google/gwt/user/tools:user/super/com/google/gwt/benchmarks:user/super/com/google/gwt/junit
+sourceFiles_new dev/core/super\
+:user/src\
+:user/super\
+
+excludedFiles_new user/src/com/google/gwt/benchmarks/BenchmarkReport.java\
+:user/src/com/google/gwt/benchmarks/BenchmarkShell.java\
+:user/src/com/google/gwt/benchmarks/client/Benchmark.java\
+:user/src/com/google/gwt/benchmarks/rebind\
+:user/src/com/google/gwt/i18n/rebind\
+:user/src/com/google/gwt/i18n/tools\
+:user/src/com/google/gwt/junit/GWTMockUtilities.java\
+:user/src/com/google/gwt/junit/GWTDummyBridge.java\
+:user/src/com/google/gwt/junit/JUnitMessageQueue.java\
+:user/src/com/google/gwt/junit/JUnitShell.java\
+:user/src/com/google/gwt/junit/RunStyle.java\
+:user/src/com/google/gwt/junit/RunStyleExternalBrowser.java\
+:user/src/com/google/gwt/junit/RunStyleLocalHosted.java\
+:user/src/com/google/gwt/junit/RunStyleLocalWeb.java\
+:user/src/com/google/gwt/junit/RunStyleManual.java\
+:user/src/com/google/gwt/junit/RunStyleRemote.java\
+:user/src/com/google/gwt/junit/RunStyleRemoteWeb.java\
+:user/src/com/google/gwt/junit/RunStyleSelenium.java\
+:user/src/com/google/gwt/junit/client/GWTTestCase.java\
+:user/src/com/google/gwt/junit/client/impl/GWTRunner.java\
+:user/src/com/google/gwt/junit/rebind\
+:user/src/com/google/gwt/junit/remote\
+:user/src/com/google/gwt/junit/server\
+:user/src/com/google/gwt/junit/tools\
+:user/src/com/google/gwt/user/client/rpc/core/java/util/LinkedHashMap_CustomFieldSerializer.java\
+:user/src/com/google/gwt/user/rebind\
+:user/src/com/google/gwt/user/server\
+:user/src/com/google/gwt/user/tools\
##############################################
#excluded packages
-excludedPackages com.google.gwt.core.client.impl:com.google.gwt.i18n.client.impl:com.google.gwt.user.client.impl:com.google.gwt.user.client.rpc.impl:com.google.gwt.user.client.ui.impl:com.google.gwt.xml.client.impl
+excludedPackages com.google.gwt.core.client.impl\
+:com.google.gwt.i18n.client.impl\
+:com.google.gwt.i18n.client.impl.cldr\
+:com.google.gwt.i18n.client.impl.plurals\
+:com.google.gwt.user.client.impl\
+:com.google.gwt.user.client.rpc.impl\
+:com.google.gwt.user.client.ui.impl\
+:com.google.gwt.xml.client.impl\
##############################################
#Api whitelist
@@ -31,5 +98,6 @@
# to be hard. Come back and fix this issue, if more such cases come up.
java.lang.StringBuilder::append(Ljava/lang/StringBuffer;) OVERRIDABLE_METHOD_ARGUMENT_TYPE_CHANGE
com.google.gwt.user.client.ui.Button::Button(Ljava/lang/String;Lcom/google/gwt/user/client/ui/ClickListener;) OVERLOADED_METHOD_CALL
+com.google.gwt.user.client.ui.MultiWordSuggestOracle::addAll(Ljava/util/Collection;) FINAL_ADDED
com.google.gwt.user.client.ui.ToggleButton::ToggleButton(Lcom/google/gwt/user/client/ui/Image;Lcom/google/gwt/user/client/ui/Image;Lcom/google/gwt/user/client/ui/ClickListener;) OVERLOADED_METHOD_CALL
-com.google.gwt.user.client.ui.Tree::setImageBase(Ljava/lang/String;) MISSING
\ No newline at end of file
+com.google.gwt.user.client.ui.Tree::setImageBase(Ljava/lang/String;) MISSING
diff --git a/tools/api-checker/src/com/google/gwt/tools/apichecker/ApiCompatibilityChecker.java b/tools/api-checker/src/com/google/gwt/tools/apichecker/ApiCompatibilityChecker.java
index 30fb98b..ea1bbe2 100644
--- a/tools/api-checker/src/com/google/gwt/tools/apichecker/ApiCompatibilityChecker.java
+++ b/tools/api-checker/src/com/google/gwt/tools/apichecker/ApiCompatibilityChecker.java
@@ -784,8 +784,8 @@
try {
return new JarFile(str);
} catch (IOException ex) {
- System.err.println("exception in getting jar from name "
- + ex.getMessage());
+ System.err.println("exception in getting jar from fileName: " + str
+ + ", message: " + ex.getMessage());
return null;
}
}
@@ -858,7 +858,7 @@
"com/google/gwt/dev/jjs/intrinsic/com/google/gwt/lang",
"com/google/gwt/lang",}));
cu = new JarFileCompilationUnits(new JarFile[] {gwtDevJar},
- gwtIncludedPaths, null, logger);
+ gwtIncludedPaths, new HashSet<String>(), logger);
units.addAll(cu.getCompilationUnits());
return units;
}
diff --git a/user/build.xml b/user/build.xml
index 0539253..a17f78a 100755
--- a/user/build.xml
+++ b/user/build.xml
@@ -10,6 +10,8 @@
<fileset id="default.hosted.tests" dir="${javac.junit.out}"
includes="${gwt.junit.testcase.includes}" />
+ <fileset id="default.emma.tests" dir="${javac.junit.out}"
+ includes="**/EmmaClassLoadingTest.class" />
<!--
Default web mode test cases
-->
@@ -100,6 +102,12 @@
<pathelement location="${gwt.build}/out/dev/core/bin-test" />
</extraclasspaths>
</gwt.junit>
+ <gwt.junit test.args="${test.args}" test.out="${junit.out}/${build.host.platform}-hosted-mode-emma" test.cases="default.emma.tests" >
+ <extraclasspaths>
+ <pathelement location="${gwt.build}/out/dev/core/bin-test" />
+ <pathelement location="${gwt.tools.redist}/emma/emma.jar" />
+ </extraclasspaths>
+ </gwt.junit>
</target>
<target name="test.web" depends="compile, compile.tests" description="Run only web-mode tests for this project.">
diff --git a/user/src/com/google/gwt/dom/client/DOMImplIE6.java b/user/src/com/google/gwt/dom/client/DOMImplIE6.java
index 36fad77..ba1dfaa 100644
--- a/user/src/com/google/gwt/dom/client/DOMImplIE6.java
+++ b/user/src/com/google/gwt/dom/client/DOMImplIE6.java
@@ -41,16 +41,28 @@
@Override
public native int getAbsoluteLeft(Element elem) /*-{
- return (elem.getBoundingClientRect().left /
- this.@com.google.gwt.dom.client.DOMImplIE6::getZoomMultiple()()) +
- @com.google.gwt.user.client.impl.DocumentRootImpl::documentRoot.scrollLeft;
+ // getBoundingClientRect() throws a JS exception if the elem is not attached
+ // to the document, so we wrap it in a try/catch block
+ try {
+ return (elem.getBoundingClientRect().left /
+ this.@com.google.gwt.dom.client.DOMImplIE6::getZoomMultiple()()) +
+ @com.google.gwt.user.client.impl.DocumentRootImpl::documentRoot.scrollLeft;
+ } catch (e) {
+ return 0;
+ }
}-*/;
@Override
public native int getAbsoluteTop(Element elem) /*-{
- return (elem.getBoundingClientRect().top /
- this.@com.google.gwt.dom.client.DOMImplIE6::getZoomMultiple()()) +
- @com.google.gwt.user.client.impl.DocumentRootImpl::documentRoot.scrollTop;
+ // getBoundingClientRect() throws a JS exception if the elem is not attached
+ // to the document, so we wrap it in a try/catch block
+ try {
+ return (elem.getBoundingClientRect().top /
+ this.@com.google.gwt.dom.client.DOMImplIE6::getZoomMultiple()()) +
+ @com.google.gwt.user.client.impl.DocumentRootImpl::documentRoot.scrollTop;
+ } catch (e) {
+ return 0;
+ }
}-*/;
public native int getBodyOffsetLeft() /*-{
diff --git a/user/src/com/google/gwt/event/dom/client/BlurEvent.java b/user/src/com/google/gwt/event/dom/client/BlurEvent.java
index d641d2e..acbd82c 100644
--- a/user/src/com/google/gwt/event/dom/client/BlurEvent.java
+++ b/user/src/com/google/gwt/event/dom/client/BlurEvent.java
@@ -47,13 +47,13 @@
}
@Override
- protected void dispatch(BlurHandler handler) {
- handler.onBlur(this);
+ public final Type<BlurHandler> getAssociatedType() {
+ return TYPE;
}
@Override
- protected final Type<BlurHandler> getAssociatedType() {
- return TYPE;
+ protected void dispatch(BlurHandler handler) {
+ handler.onBlur(this);
}
}
diff --git a/user/src/com/google/gwt/event/dom/client/ChangeEvent.java b/user/src/com/google/gwt/event/dom/client/ChangeEvent.java
index 58b4278..f66f3cd 100644
--- a/user/src/com/google/gwt/event/dom/client/ChangeEvent.java
+++ b/user/src/com/google/gwt/event/dom/client/ChangeEvent.java
@@ -47,13 +47,13 @@
}
@Override
- protected void dispatch(ChangeHandler handler) {
- handler.onChange(this);
+ public final Type<ChangeHandler> getAssociatedType() {
+ return TYPE;
}
@Override
- protected final Type<ChangeHandler> getAssociatedType() {
- return TYPE;
+ protected void dispatch(ChangeHandler handler) {
+ handler.onChange(this);
}
}
diff --git a/user/src/com/google/gwt/event/dom/client/ClickEvent.java b/user/src/com/google/gwt/event/dom/client/ClickEvent.java
index 88f9a77..805c956 100644
--- a/user/src/com/google/gwt/event/dom/client/ClickEvent.java
+++ b/user/src/com/google/gwt/event/dom/client/ClickEvent.java
@@ -47,13 +47,13 @@
}
@Override
- protected void dispatch(ClickHandler handler) {
- handler.onClick(this);
+ public final Type<ClickHandler> getAssociatedType() {
+ return TYPE;
}
@Override
- protected final Type<ClickHandler> getAssociatedType() {
- return TYPE;
+ protected void dispatch(ClickHandler handler) {
+ handler.onClick(this);
}
}
diff --git a/user/src/com/google/gwt/event/dom/client/ContextMenuEvent.java b/user/src/com/google/gwt/event/dom/client/ContextMenuEvent.java
index 126ed99..513fd2b 100644
--- a/user/src/com/google/gwt/event/dom/client/ContextMenuEvent.java
+++ b/user/src/com/google/gwt/event/dom/client/ContextMenuEvent.java
@@ -47,13 +47,13 @@
}
@Override
- protected void dispatch(ContextMenuHandler handler) {
- handler.onContextMenu(this);
+ public final Type<ContextMenuHandler> getAssociatedType() {
+ return TYPE;
}
@Override
- protected final Type<ContextMenuHandler> getAssociatedType() {
- return TYPE;
+ protected void dispatch(ContextMenuHandler handler) {
+ handler.onContextMenu(this);
}
}
diff --git a/user/src/com/google/gwt/event/dom/client/DomEvent.java b/user/src/com/google/gwt/event/dom/client/DomEvent.java
index 7e2df65..b8b7135 100644
--- a/user/src/com/google/gwt/event/dom/client/DomEvent.java
+++ b/user/src/com/google/gwt/event/dom/client/DomEvent.java
@@ -131,6 +131,9 @@
private Event nativeEvent;
+ @Override
+ public abstract DomEvent.Type<H> getAssociatedType();
+
public final Event getNativeEvent() {
assertLive();
return nativeEvent;
@@ -161,7 +164,4 @@
assertLive();
nativeEvent.cancelBubble(true);
}
-
- @Override
- protected abstract DomEvent.Type<H> getAssociatedType();
}
diff --git a/user/src/com/google/gwt/event/dom/client/DoubleClickEvent.java b/user/src/com/google/gwt/event/dom/client/DoubleClickEvent.java
index 0d24cf4..972b645 100644
--- a/user/src/com/google/gwt/event/dom/client/DoubleClickEvent.java
+++ b/user/src/com/google/gwt/event/dom/client/DoubleClickEvent.java
@@ -47,13 +47,13 @@
}
@Override
- protected void dispatch(DoubleClickHandler handler) {
- handler.onDoubleClick(this);
+ public final Type<DoubleClickHandler> getAssociatedType() {
+ return TYPE;
}
@Override
- protected final Type<DoubleClickHandler> getAssociatedType() {
- return TYPE;
+ protected void dispatch(DoubleClickHandler handler) {
+ handler.onDoubleClick(this);
}
}
diff --git a/user/src/com/google/gwt/event/dom/client/ErrorEvent.java b/user/src/com/google/gwt/event/dom/client/ErrorEvent.java
index 62084de..0c9a007 100644
--- a/user/src/com/google/gwt/event/dom/client/ErrorEvent.java
+++ b/user/src/com/google/gwt/event/dom/client/ErrorEvent.java
@@ -47,13 +47,13 @@
}
@Override
- protected void dispatch(ErrorHandler handler) {
- handler.onError(this);
+ public final Type<ErrorHandler> getAssociatedType() {
+ return TYPE;
}
@Override
- protected final Type<ErrorHandler> getAssociatedType() {
- return TYPE;
+ protected void dispatch(ErrorHandler handler) {
+ handler.onError(this);
}
}
diff --git a/user/src/com/google/gwt/event/dom/client/FocusEvent.java b/user/src/com/google/gwt/event/dom/client/FocusEvent.java
index 898c03a..c2ca7bd 100644
--- a/user/src/com/google/gwt/event/dom/client/FocusEvent.java
+++ b/user/src/com/google/gwt/event/dom/client/FocusEvent.java
@@ -47,13 +47,13 @@
}
@Override
- protected void dispatch(FocusHandler handler) {
- handler.onFocus(this);
+ public final Type<FocusHandler> getAssociatedType() {
+ return TYPE;
}
@Override
- protected final Type<FocusHandler> getAssociatedType() {
- return TYPE;
+ protected void dispatch(FocusHandler handler) {
+ handler.onFocus(this);
}
}
diff --git a/user/src/com/google/gwt/event/dom/client/HandlesAllFocusEvents.java b/user/src/com/google/gwt/event/dom/client/HandlesAllFocusEvents.java
index 594b906..0d00ce3 100644
--- a/user/src/com/google/gwt/event/dom/client/HandlesAllFocusEvents.java
+++ b/user/src/com/google/gwt/event/dom/client/HandlesAllFocusEvents.java
@@ -27,7 +27,7 @@
* source.
*
* @param <H> receiver type, must implement both {@link FocusHandler} and
- * {@link BlurHandler} handlers
+ * {@link BlurHandler} handlers
* @param eventSource the event source
* @param reciever the receiver implementing both focus and blur handlers
*/
diff --git a/user/src/com/google/gwt/event/dom/client/HasAllFocusHandlers.java b/user/src/com/google/gwt/event/dom/client/HasAllFocusHandlers.java
index 7053d22..daa1f84 100644
--- a/user/src/com/google/gwt/event/dom/client/HasAllFocusHandlers.java
+++ b/user/src/com/google/gwt/event/dom/client/HasAllFocusHandlers.java
@@ -20,9 +20,10 @@
* This is a convenience interface that includes all focus handlers defined by
* the core GWT system.
*
- * <p> WARNING, PLEASE READ: As this interface is intended for developers who
- * wish to handle all focus events in GWT, in the unlikely event that a new
- * focus event is added, this interface will change.
+ * <p>
+ * WARNING, PLEASE READ: As this interface is intended for developers who wish
+ * to handle all focus events in GWT, in the unlikely event that a new focus
+ * event is added, this interface will change.
* </p>
*/
public interface HasAllFocusHandlers extends HasFocusHandlers, HasBlurHandlers {
diff --git a/user/src/com/google/gwt/event/dom/client/HasAllMouseHandlers.java b/user/src/com/google/gwt/event/dom/client/HasAllMouseHandlers.java
index b82c76e..c600a13 100644
--- a/user/src/com/google/gwt/event/dom/client/HasAllMouseHandlers.java
+++ b/user/src/com/google/gwt/event/dom/client/HasAllMouseHandlers.java
@@ -20,9 +20,9 @@
* This is a convenience interface that includes all mouse handlers defined by
* the core GWT system.
* <p>
- * WARNING, PLEASE READ: As this interface is intended for developers who
- * wish to handle all mouse events in GWT, new mouse event handlers will be
- * added to it. Therefore, updates can cause breaking API changes.
+ * WARNING, PLEASE READ: As this interface is intended for developers who wish
+ * to handle all mouse events in GWT, new mouse event handlers will be added to
+ * it. Therefore, updates can cause breaking API changes.
* </p>
*/
public interface HasAllMouseHandlers extends HasMouseDownHandlers,
diff --git a/user/src/com/google/gwt/event/dom/client/KeyCodeEvent.java b/user/src/com/google/gwt/event/dom/client/KeyCodeEvent.java
index 66dfff9..7f29144 100644
--- a/user/src/com/google/gwt/event/dom/client/KeyCodeEvent.java
+++ b/user/src/com/google/gwt/event/dom/client/KeyCodeEvent.java
@@ -51,7 +51,7 @@
public int getNativeKeyCode() {
return getNativeEvent().getKeyCode();
}
-
+
/**
* Is this a key down arrow?
*
diff --git a/user/src/com/google/gwt/event/dom/client/KeyDownEvent.java b/user/src/com/google/gwt/event/dom/client/KeyDownEvent.java
index f826bec..1b58b03 100644
--- a/user/src/com/google/gwt/event/dom/client/KeyDownEvent.java
+++ b/user/src/com/google/gwt/event/dom/client/KeyDownEvent.java
@@ -47,13 +47,13 @@
}
@Override
- protected void dispatch(KeyDownHandler handler) {
- handler.onKeyDown(this);
+ public final Type<KeyDownHandler> getAssociatedType() {
+ return TYPE;
}
@Override
- protected final Type<KeyDownHandler> getAssociatedType() {
- return TYPE;
+ protected void dispatch(KeyDownHandler handler) {
+ handler.onKeyDown(this);
}
}
diff --git a/user/src/com/google/gwt/event/dom/client/KeyDownHandler.java b/user/src/com/google/gwt/event/dom/client/KeyDownHandler.java
index 67ef308..7ad34b2 100644
--- a/user/src/com/google/gwt/event/dom/client/KeyDownHandler.java
+++ b/user/src/com/google/gwt/event/dom/client/KeyDownHandler.java
@@ -20,7 +20,7 @@
/**
* Handler interface for {@link KeyDownEvent} events.
*/
-public interface KeyDownHandler extends EventHandler {
+public interface KeyDownHandler extends EventHandler {
/**
* Called when {@link KeyDownEvent} is fired.
*
diff --git a/user/src/com/google/gwt/event/dom/client/KeyEvent.java b/user/src/com/google/gwt/event/dom/client/KeyEvent.java
index 18e7d2c..c6367e2 100644
--- a/user/src/com/google/gwt/event/dom/client/KeyEvent.java
+++ b/user/src/com/google/gwt/event/dom/client/KeyEvent.java
@@ -22,7 +22,7 @@
* (http://www.quirksmode.org/js/keys.html), we do some trivial normalization
* here, but do not attempt any complex patching, so user be warned.
*
- * @param <H> The event handler type
+ * @param <H> The event handler type
*/
public abstract class KeyEvent<H extends EventHandler> extends DomEvent<H> {
diff --git a/user/src/com/google/gwt/event/dom/client/KeyPressEvent.java b/user/src/com/google/gwt/event/dom/client/KeyPressEvent.java
index 1f8528e..f955e3c 100644
--- a/user/src/com/google/gwt/event/dom/client/KeyPressEvent.java
+++ b/user/src/com/google/gwt/event/dom/client/KeyPressEvent.java
@@ -46,6 +46,11 @@
protected KeyPressEvent() {
}
+ @Override
+ public final Type<KeyPressHandler> getAssociatedType() {
+ return TYPE;
+ }
+
/**
* Gets the char code for this event.
*
@@ -65,13 +70,8 @@
handler.onKeyPress(this);
}
- @Override
- protected final Type<KeyPressHandler> getAssociatedType() {
- return TYPE;
- }
-
private native char getCharCode(Event e)/*-{
- return e.charCode || e.keyCode;
- }-*/;
+ return e.charCode || e.keyCode;
+ }-*/;
}
diff --git a/user/src/com/google/gwt/event/dom/client/KeyUpEvent.java b/user/src/com/google/gwt/event/dom/client/KeyUpEvent.java
index f9cfdbd..5a07977 100644
--- a/user/src/com/google/gwt/event/dom/client/KeyUpEvent.java
+++ b/user/src/com/google/gwt/event/dom/client/KeyUpEvent.java
@@ -47,13 +47,13 @@
}
@Override
- protected void dispatch(KeyUpHandler handler) {
- handler.onKeyUp(this);
+ public final Type<KeyUpHandler> getAssociatedType() {
+ return TYPE;
}
@Override
- protected final Type<KeyUpHandler> getAssociatedType() {
- return TYPE;
+ protected void dispatch(KeyUpHandler handler) {
+ handler.onKeyUp(this);
}
}
diff --git a/user/src/com/google/gwt/event/dom/client/LoadEvent.java b/user/src/com/google/gwt/event/dom/client/LoadEvent.java
index 7e2bac5..3255c4b 100644
--- a/user/src/com/google/gwt/event/dom/client/LoadEvent.java
+++ b/user/src/com/google/gwt/event/dom/client/LoadEvent.java
@@ -47,13 +47,13 @@
}
@Override
- protected void dispatch(LoadHandler handler) {
- handler.onLoad(this);
+ public final Type<LoadHandler> getAssociatedType() {
+ return TYPE;
}
@Override
- protected final Type<LoadHandler> getAssociatedType() {
- return TYPE;
+ protected void dispatch(LoadHandler handler) {
+ handler.onLoad(this);
}
}
diff --git a/user/src/com/google/gwt/event/dom/client/LoseCaptureEvent.java b/user/src/com/google/gwt/event/dom/client/LoseCaptureEvent.java
index 270f0cd..857e8d0 100644
--- a/user/src/com/google/gwt/event/dom/client/LoseCaptureEvent.java
+++ b/user/src/com/google/gwt/event/dom/client/LoseCaptureEvent.java
@@ -47,13 +47,13 @@
}
@Override
- protected void dispatch(LoseCaptureHandler handler) {
- handler.onLoseCapture(this);
+ public final Type<LoseCaptureHandler> getAssociatedType() {
+ return TYPE;
}
@Override
- protected final Type<LoseCaptureHandler> getAssociatedType() {
- return TYPE;
+ protected void dispatch(LoseCaptureHandler handler) {
+ handler.onLoseCapture(this);
}
}
diff --git a/user/src/com/google/gwt/event/dom/client/MouseDownEvent.java b/user/src/com/google/gwt/event/dom/client/MouseDownEvent.java
index 23336ad..dd36ec2 100644
--- a/user/src/com/google/gwt/event/dom/client/MouseDownEvent.java
+++ b/user/src/com/google/gwt/event/dom/client/MouseDownEvent.java
@@ -47,13 +47,13 @@
}
@Override
- protected void dispatch(MouseDownHandler handler) {
- handler.onMouseDown(this);
+ public final Type<MouseDownHandler> getAssociatedType() {
+ return TYPE;
}
@Override
- protected final Type<MouseDownHandler> getAssociatedType() {
- return TYPE;
+ protected void dispatch(MouseDownHandler handler) {
+ handler.onMouseDown(this);
}
}
diff --git a/user/src/com/google/gwt/event/dom/client/MouseMoveEvent.java b/user/src/com/google/gwt/event/dom/client/MouseMoveEvent.java
index fd64fbb..cafa24c 100644
--- a/user/src/com/google/gwt/event/dom/client/MouseMoveEvent.java
+++ b/user/src/com/google/gwt/event/dom/client/MouseMoveEvent.java
@@ -47,13 +47,13 @@
}
@Override
- protected void dispatch(MouseMoveHandler handler) {
- handler.onMouseMove(this);
+ public final Type<MouseMoveHandler> getAssociatedType() {
+ return TYPE;
}
@Override
- protected final Type<MouseMoveHandler> getAssociatedType() {
- return TYPE;
+ protected void dispatch(MouseMoveHandler handler) {
+ handler.onMouseMove(this);
}
}
diff --git a/user/src/com/google/gwt/event/dom/client/MouseOutEvent.java b/user/src/com/google/gwt/event/dom/client/MouseOutEvent.java
index 96d817e..7b1d47e 100644
--- a/user/src/com/google/gwt/event/dom/client/MouseOutEvent.java
+++ b/user/src/com/google/gwt/event/dom/client/MouseOutEvent.java
@@ -47,6 +47,11 @@
protected MouseOutEvent() {
}
+ @Override
+ public final Type<MouseOutHandler> getAssociatedType() {
+ return TYPE;
+ }
+
/**
* Gets the element from which the mouse pointer was moved.
*
@@ -72,9 +77,4 @@
handler.onMouseOut(this);
}
- @Override
- protected final Type<MouseOutHandler> getAssociatedType() {
- return TYPE;
- }
-
}
diff --git a/user/src/com/google/gwt/event/dom/client/MouseOverEvent.java b/user/src/com/google/gwt/event/dom/client/MouseOverEvent.java
index 1925791..90a664c 100644
--- a/user/src/com/google/gwt/event/dom/client/MouseOverEvent.java
+++ b/user/src/com/google/gwt/event/dom/client/MouseOverEvent.java
@@ -47,6 +47,11 @@
protected MouseOverEvent() {
}
+ @Override
+ public final Type<MouseOverHandler> getAssociatedType() {
+ return TYPE;
+ }
+
/**
* Gets the element from which the mouse pointer was moved.
*
@@ -72,9 +77,4 @@
handler.onMouseOver(this);
}
- @Override
- protected final Type<MouseOverHandler> getAssociatedType() {
- return TYPE;
- }
-
}
diff --git a/user/src/com/google/gwt/event/dom/client/MouseUpEvent.java b/user/src/com/google/gwt/event/dom/client/MouseUpEvent.java
index 3a733db..9817f07 100644
--- a/user/src/com/google/gwt/event/dom/client/MouseUpEvent.java
+++ b/user/src/com/google/gwt/event/dom/client/MouseUpEvent.java
@@ -47,13 +47,13 @@
}
@Override
- protected void dispatch(MouseUpHandler handler) {
- handler.onMouseUp(this);
+ public final Type<MouseUpHandler> getAssociatedType() {
+ return TYPE;
}
@Override
- protected final Type<MouseUpHandler> getAssociatedType() {
- return TYPE;
+ protected void dispatch(MouseUpHandler handler) {
+ handler.onMouseUp(this);
}
}
diff --git a/user/src/com/google/gwt/event/dom/client/MouseWheelEvent.java b/user/src/com/google/gwt/event/dom/client/MouseWheelEvent.java
index f8248c5..d8fed04 100644
--- a/user/src/com/google/gwt/event/dom/client/MouseWheelEvent.java
+++ b/user/src/com/google/gwt/event/dom/client/MouseWheelEvent.java
@@ -47,13 +47,47 @@
}
@Override
- protected void dispatch(MouseWheelHandler handler) {
- handler.onMouseWheel(this);
- }
-
- @Override
- protected final Type<MouseWheelHandler> getAssociatedType() {
+ public final Type<MouseWheelHandler> getAssociatedType() {
return TYPE;
}
+ /**
+ * Get the change in the mouse wheel position along the Y-axis; positive if
+ * the mouse wheel is moving north (toward the top of the screen) or negative
+ * if the mouse wheel is moving south (toward the bottom of the screen).
+ *
+ * Note that delta values are not normalized across browsers or OSes.
+ *
+ * @return the delta of the mouse wheel along the y axis
+ */
+ public int getDeltaY() {
+ return getNativeEvent().getMouseWheelVelocityY();
+ }
+
+ /**
+ * Convenience method that returns <code>true</code> if {@link #getDeltaY()}
+ * is a negative value (ie, the velocity is directed toward the top of the
+ * screen).
+ *
+ * @return true if the velocity is directed toward the top of the screen
+ */
+ public boolean isNorth() {
+ return getDeltaY() < 0;
+ }
+
+ /**
+ * Convenience method that returns <code>true</code> if {@link #getDeltaY()}
+ * is a positive value (ie, the velocity is directed toward the bottom of the
+ * screen).
+ *
+ * @return true if the velocity is directed toward the bottom of the screen
+ */
+ public boolean isSouth() {
+ return getDeltaY() > 0;
+ }
+
+ @Override
+ protected void dispatch(MouseWheelHandler handler) {
+ handler.onMouseWheel(this);
+ }
}
diff --git a/user/src/com/google/gwt/event/dom/client/ScrollEvent.java b/user/src/com/google/gwt/event/dom/client/ScrollEvent.java
index ff8e836..21910e9 100644
--- a/user/src/com/google/gwt/event/dom/client/ScrollEvent.java
+++ b/user/src/com/google/gwt/event/dom/client/ScrollEvent.java
@@ -47,13 +47,13 @@
}
@Override
- protected void dispatch(ScrollHandler handler) {
- handler.onScroll(this);
+ public final Type<ScrollHandler> getAssociatedType() {
+ return TYPE;
}
@Override
- protected final Type<ScrollHandler> getAssociatedType() {
- return TYPE;
+ protected void dispatch(ScrollHandler handler) {
+ handler.onScroll(this);
}
}
diff --git a/user/src/com/google/gwt/event/logical/shared/BeforeSelectionEvent.java b/user/src/com/google/gwt/event/logical/shared/BeforeSelectionEvent.java
index 556335a..7ff45c6 100644
--- a/user/src/com/google/gwt/event/logical/shared/BeforeSelectionEvent.java
+++ b/user/src/com/google/gwt/event/logical/shared/BeforeSelectionEvent.java
@@ -87,6 +87,14 @@
canceled = true;
}
+ // The instance knows its BeforeSelectionHandler is of type I, but the TYPE
+ // field itself does not, so we have to do an unsafe cast here.
+ @SuppressWarnings("unchecked")
+ @Override
+ public Type<BeforeSelectionHandler<I>> getAssociatedType() {
+ return (Type) TYPE;
+ }
+
/**
* Gets the item.
*
@@ -110,14 +118,6 @@
handler.onBeforeSelection(this);
}
- // The instance knows its BeforeSelectionHandler is of type I, but the TYPE
- // field itself does not, so we have to do an unsafe cast here.
- @SuppressWarnings("unchecked")
- @Override
- protected Type<BeforeSelectionHandler<I>> getAssociatedType() {
- return (Type) TYPE;
- }
-
/**
* Sets the item.
*
diff --git a/user/src/com/google/gwt/event/logical/shared/CloseEvent.java b/user/src/com/google/gwt/event/logical/shared/CloseEvent.java
index c68536b..85006a7 100644
--- a/user/src/com/google/gwt/event/logical/shared/CloseEvent.java
+++ b/user/src/com/google/gwt/event/logical/shared/CloseEvent.java
@@ -50,8 +50,8 @@
* @param target the target
* @param autoClosed was the target closed automatically
*/
- public static <T> void fire(
- HasCloseHandlers<T> source, T target, boolean autoClosed) {
+ public static <T> void fire(HasCloseHandlers<T> source, T target,
+ boolean autoClosed) {
if (TYPE != null) {
HandlerManager handlers = source.getHandlers();
if (handlers != null) {
@@ -85,6 +85,14 @@
this.target = target;
}
+ // The instance knows its of type T, but the TYPE
+ // field itself does not, so we have to do an unsafe cast here.
+ @SuppressWarnings("unchecked")
+ @Override
+ public final Type<CloseHandler<T>> getAssociatedType() {
+ return (Type) TYPE;
+ }
+
/**
* Gets the target.
*
@@ -107,12 +115,4 @@
protected void dispatch(CloseHandler<T> handler) {
handler.onClose(this);
}
-
- // The instance knows its of type T, but the TYPE
- // field itself does not, so we have to do an unsafe cast here.
- @SuppressWarnings("unchecked")
- @Override
- protected final Type<CloseHandler<T>> getAssociatedType() {
- return (Type) TYPE;
- }
}
diff --git a/user/src/com/google/gwt/event/logical/shared/HighlightEvent.java b/user/src/com/google/gwt/event/logical/shared/HighlightEvent.java
index ad1b514..38f785f 100644
--- a/user/src/com/google/gwt/event/logical/shared/HighlightEvent.java
+++ b/user/src/com/google/gwt/event/logical/shared/HighlightEvent.java
@@ -73,6 +73,14 @@
this.highlighted = highlighted;
}
+ // Because of type erasure, our static type is
+ // wild carded, yet the "real" type should use our I param.
+ @SuppressWarnings("unchecked")
+ @Override
+ public final Type<HighlightHandler<V>> getAssociatedType() {
+ return (Type) TYPE;
+ }
+
/**
* Gets the value highlighted.
*
@@ -86,12 +94,4 @@
protected void dispatch(HighlightHandler<V> handler) {
handler.onHighlight(this);
}
-
- // Because of type erasure, our static type is
- // wild carded, yet the "real" type should use our I param.
- @SuppressWarnings("unchecked")
- @Override
- protected final Type<HighlightHandler<V>> getAssociatedType() {
- return (Type) TYPE;
- }
}
diff --git a/user/src/com/google/gwt/event/logical/shared/OpenEvent.java b/user/src/com/google/gwt/event/logical/shared/OpenEvent.java
index ca8c1a6..a6a11c2 100644
--- a/user/src/com/google/gwt/event/logical/shared/OpenEvent.java
+++ b/user/src/com/google/gwt/event/logical/shared/OpenEvent.java
@@ -71,6 +71,12 @@
this.target = target;
}
+ @SuppressWarnings("unchecked")
+ @Override
+ public final Type<OpenHandler<T>> getAssociatedType() {
+ return (Type) TYPE;
+ }
+
/**
* Gets the target.
*
@@ -80,17 +86,11 @@
return target;
}
- @Override
- protected void dispatch(OpenHandler<T> handler) {
- handler.onOpen(this);
- }
-
// Because of type erasure, our static type is
// wild carded, yet the "real" type should use our I param.
- @SuppressWarnings("unchecked")
@Override
- protected final Type<OpenHandler<T>> getAssociatedType() {
- return (Type) TYPE;
+ protected void dispatch(OpenHandler<T> handler) {
+ handler.onOpen(this);
}
}
diff --git a/user/src/com/google/gwt/event/logical/shared/ResizeEvent.java b/user/src/com/google/gwt/event/logical/shared/ResizeEvent.java
index 351b86c..f3b1393 100644
--- a/user/src/com/google/gwt/event/logical/shared/ResizeEvent.java
+++ b/user/src/com/google/gwt/event/logical/shared/ResizeEvent.java
@@ -75,6 +75,11 @@
this.height = height;
}
+ @Override
+ public Type<ResizeHandler> getAssociatedType() {
+ return TYPE;
+ }
+
/**
* Returns the new height.
*
@@ -103,9 +108,4 @@
protected void dispatch(ResizeHandler handler) {
handler.onResize(this);
}
-
- @Override
- protected Type<ResizeHandler> getAssociatedType() {
- return TYPE;
- }
}
diff --git a/user/src/com/google/gwt/event/logical/shared/SelectionEvent.java b/user/src/com/google/gwt/event/logical/shared/SelectionEvent.java
index c43ab56..342b179 100644
--- a/user/src/com/google/gwt/event/logical/shared/SelectionEvent.java
+++ b/user/src/com/google/gwt/event/logical/shared/SelectionEvent.java
@@ -72,6 +72,14 @@
this.selectedItem = selectedItem;
}
+ // The instance knows its BeforeSelectionHandler is of type I, but the TYPE
+ // field itself does not, so we have to do an unsafe cast here.
+ @SuppressWarnings("unchecked")
+ @Override
+ public Type<SelectionHandler<I>> getAssociatedType() {
+ return (Type) TYPE;
+ }
+
/**
* Gets the selected item.
*
@@ -85,12 +93,4 @@
protected void dispatch(SelectionHandler<I> handler) {
handler.onSelection(this);
}
-
- // The instance knows its BeforeSelectionHandler is of type I, but the TYPE
- // field itself does not, so we have to do an unsafe cast here.
- @SuppressWarnings("unchecked")
- @Override
- protected Type<SelectionHandler<I>> getAssociatedType() {
- return (Type) TYPE;
- }
}
diff --git a/user/src/com/google/gwt/event/logical/shared/ShowRangeEvent.java b/user/src/com/google/gwt/event/logical/shared/ShowRangeEvent.java
index 34d3c88..5733bff 100644
--- a/user/src/com/google/gwt/event/logical/shared/ShowRangeEvent.java
+++ b/user/src/com/google/gwt/event/logical/shared/ShowRangeEvent.java
@@ -21,7 +21,7 @@
/**
* Represents a show range event. This logical event should be used when a
- * widget displays a range of values to the user. This event should not be fired until a widget is displaying t
+ * widget displays a range of values to the user.
*
* @param <V> the type of range
*/
@@ -79,6 +79,14 @@
this.end = end;
}
+ // Because of type erasure, our static type is
+ // wild carded, yet the "real" type should use our I param.
+ @SuppressWarnings("unchecked")
+ @Override
+ public final Type<ShowRangeHandler<V>> getAssociatedType() {
+ return (Type) TYPE;
+ }
+
/**
* Gets the end of the range.
*
@@ -101,12 +109,4 @@
protected void dispatch(ShowRangeHandler<V> handler) {
handler.onShowRange(this);
}
-
- // Because of type erasure, our static type is
- // wild carded, yet the "real" type should use our I param.
- @SuppressWarnings("unchecked")
- @Override
- protected final Type<ShowRangeHandler<V>> getAssociatedType() {
- return (Type) TYPE;
- }
-}
\ No newline at end of file
+}
diff --git a/user/src/com/google/gwt/event/logical/shared/ValueChangeEvent.java b/user/src/com/google/gwt/event/logical/shared/ValueChangeEvent.java
index 5a769dc..5dfe97f 100644
--- a/user/src/com/google/gwt/event/logical/shared/ValueChangeEvent.java
+++ b/user/src/com/google/gwt/event/logical/shared/ValueChangeEvent.java
@@ -106,6 +106,14 @@
this.value = value;
}
+ // The instance knows its BeforeSelectionHandler is of type I, but the TYPE
+ // field itself does not, so we have to do an unsafe cast here.
+ @SuppressWarnings("unchecked")
+ @Override
+ public Type<ValueChangeHandler<I>> getAssociatedType() {
+ return (Type) TYPE;
+ }
+
/**
* Gets the value.
*
@@ -119,12 +127,4 @@
protected void dispatch(ValueChangeHandler<I> handler) {
handler.onValueChange(this);
}
-
- // The instance knows its BeforeSelectionHandler is of type I, but the TYPE
- // field itself does not, so we have to do an unsafe cast here.
- @SuppressWarnings("unchecked")
- @Override
- protected Type<ValueChangeHandler<I>> getAssociatedType() {
- return (Type) TYPE;
- }
}
diff --git a/user/src/com/google/gwt/event/shared/GwtEvent.java b/user/src/com/google/gwt/event/shared/GwtEvent.java
index 33787e2..c3a38d8 100644
--- a/user/src/com/google/gwt/event/shared/GwtEvent.java
+++ b/user/src/com/google/gwt/event/shared/GwtEvent.java
@@ -25,7 +25,6 @@
*
*/
public abstract class GwtEvent<H extends EventHandler> {
-
/**
* Type class used to register events with the {@link HandlerManager}.
* <p>
@@ -68,6 +67,14 @@
}
/**
+ * Returns the type used to register this event. Used by handler manager to
+ * dispatch events to the correct handlers.
+ *
+ * @return the type
+ */
+ public abstract Type<H> getAssociatedType();
+
+ /**
* Returns the source that last fired this event.
*
* @return object representing the source of this event
@@ -93,9 +100,8 @@
/**
* The toString() for abstract event is overridden to avoid accidently
- * including class literals in the the compiled output. Use
- * {@link GwtEvent} #toDebugString to get more information about the
- * event.
+ * including class literals in the the compiled output. Use {@link GwtEvent}
+ * #toDebugString to get more information about the event.
*/
@Override
public String toString() {
@@ -120,14 +126,6 @@
protected abstract void dispatch(H handler);
/**
- * Returns the type used to register this event. Used by handler manager to
- * dispatch events to the correct handlers.
- *
- * @return the type
- */
- protected abstract Type<H> getAssociatedType();
-
- /**
* Is the event current live?
*
* @return whether the event is live
@@ -137,8 +135,8 @@
}
/**
- * Kill the event. After the event has been killed, users cannot really on
- * its values or functions being available.
+ * Kill the event. After the event has been killed, users cannot really on its
+ * values or functions being available.
*/
protected void kill() {
dead = true;
diff --git a/user/src/com/google/gwt/user/client/DOM.java b/user/src/com/google/gwt/user/client/DOM.java
index 8ddd25b..082a87e 100644
--- a/user/src/com/google/gwt/user/client/DOM.java
+++ b/user/src/com/google/gwt/user/client/DOM.java
@@ -626,7 +626,10 @@
*
* @param evt the event whose key code is to be set
* @param key the new key code
+ * @deprecated this method only works in IE and should not have been added to
+ * the API
*/
+ @Deprecated
public static void eventSetKeyCode(Event evt, char key) {
impl.eventSetKeyCode(evt, key);
}
diff --git a/user/src/com/google/gwt/user/client/Event.java b/user/src/com/google/gwt/user/client/Event.java
index 4ec22fe..ff156f1 100644
--- a/user/src/com/google/gwt/user/client/Event.java
+++ b/user/src/com/google/gwt/user/client/Event.java
@@ -34,19 +34,6 @@
* from, and can be accessed in JavaScript code as expected. This is typically
* done by calling methods in the {@link com.google.gwt.user.client.DOM} class.
* </p>
- *
- * <h3>Event Attributes</h3>
- * <p>
- * In hosted mode, most accessors (eg. Event{@link #getKeyCode()} and
- * {@link Event#getButton()}) assert that the requested attribute is reliable
- * across all supported browsers. This means that attempting to retrieve an
- * attribute for an {@link Event} that does not support that attribute will
- * throw an {@link AssertionError}. For example, an {@link Event} of type
- * {@link Event#ONCLICK} will throw an {@link AssertionError} if you attempt
- * to get the mouse button that was clicked using {@link Event#getButton()}
- * because the mouse button attribute is not defined for {@link Event#ONCLICK}
- * on Internet Explorer.
- * </p>
*/
public class Event extends JavaScriptObject {
/**
@@ -144,6 +131,11 @@
isConsumed = true;
}
+ @Override
+ public Type<NativePreviewHandler> getAssociatedType() {
+ return TYPE;
+ }
+
public Event getNativeEvent() {
return nativeEvent;
}
@@ -176,11 +168,6 @@
}
@Override
- protected Type<NativePreviewHandler> getAssociatedType() {
- return TYPE;
- }
-
- @Override
protected void revive() {
super.revive();
isCanceled = false;
@@ -631,10 +618,6 @@
* Gets the mouse x-position on the user's display.
*
* @return the mouse x-position
- * @throws AssertionError if event type is not one of
- * {@link Event#MOUSEEVENTS}, {@link Event#ONMOUSEWHEEL},
- * {@link Event#ONCLICK}, {@link Event#ONDBLCLICK}, or
- * {@link Event#ONCONTEXTMENU}
*/
public final int getScreenX() {
return DOM.eventGetScreenX(this);
diff --git a/user/src/com/google/gwt/user/client/History.java b/user/src/com/google/gwt/user/client/History.java
index bbac932..795ed67 100644
--- a/user/src/com/google/gwt/user/client/History.java
+++ b/user/src/com/google/gwt/user/client/History.java
@@ -77,6 +77,7 @@
* Adds a listener to be informed of changes to the browser's history stack.
*
* @param listener the listener to be added
+ * @deprecated use {@link History#addValueChangeHandler(ValueChangeHandler)} instead
*/
@Deprecated
public static void addHistoryListener(HistoryListener listener) {
@@ -88,6 +89,7 @@
* to be informed of changes to the browser's history stack.
*
* @param handler the handler
+ * @return the registration used to remove this value change handler
*/
public static HandlerRegistration addValueChangeHandler(
ValueChangeHandler<String> handler) {
diff --git a/user/src/com/google/gwt/user/client/HistoryListener.java b/user/src/com/google/gwt/user/client/HistoryListener.java
index b4a607f..b8cc0c1 100644
--- a/user/src/com/google/gwt/user/client/HistoryListener.java
+++ b/user/src/com/google/gwt/user/client/HistoryListener.java
@@ -18,6 +18,9 @@
/**
* Implement this interface to receive notification of changes to the browser
* history state. It is used with {@link com.google.gwt.user.client.History}.
+ *
+ * @deprecated use
+ * {@link History#addValueChangeHandler(com.google.gwt.event.logical.shared.ValueChangeHandler)} instead
*/
@Deprecated
public interface HistoryListener extends java.util.EventListener {
diff --git a/user/src/com/google/gwt/user/client/Window.java b/user/src/com/google/gwt/user/client/Window.java
index 392bd01..58ab514 100644
--- a/user/src/com/google/gwt/user/client/Window.java
+++ b/user/src/com/google/gwt/user/client/Window.java
@@ -63,6 +63,11 @@
*/
private String message = null;
+ @Override
+ public Type<ClosingHandler> getAssociatedType() {
+ return TYPE;
+ }
+
/**
* Get the message that will be presented to the user in a confirmation
* dialog that asks the user whether or not she wishes to navigate away from
@@ -90,11 +95,6 @@
protected void dispatch(ClosingHandler handler) {
handler.onWindowClosing(this);
}
-
- @Override
- protected Type<ClosingHandler> getAssociatedType() {
- return TYPE;
- }
}
/**
@@ -331,6 +331,11 @@
this.scrollTop = scrollTop;
}
+ @Override
+ public Type<ScrollHandler> getAssociatedType() {
+ return TYPE;
+ }
+
/**
* Gets the window's scroll left.
*
@@ -353,11 +358,6 @@
protected void dispatch(ScrollHandler handler) {
handler.onWindowScroll(this);
}
-
- @Override
- protected Type<ScrollHandler> getAssociatedType() {
- return TYPE;
- }
}
/**
@@ -399,7 +399,6 @@
private static boolean resizeHandlersInitialized;
private static final WindowImpl impl = GWT.create(WindowImpl.class);
-
/**
* Adds a {@link CloseEvent} handler.
*
@@ -426,6 +425,8 @@
/**
* Adds a listener to receive window closing events.
*
+ * @deprecated use {@link Window#addWindowClosingHandler(ClosingHandler)} and
+ * {@link Window#addCloseHandler(CloseHandler)} instead
* @param listener the listener to be informed when the window is closing
*/
@Deprecated
@@ -449,6 +450,7 @@
* Adds a listener to receive window resize events.
*
* @param listener the listener to be informed when the window is resized
+ * @deprecated use {@link Window#addResizeHandler(ResizeHandler)} instead
*/
@Deprecated
public static void addWindowResizeListener(WindowResizeListener listener) {
@@ -472,6 +474,7 @@
* Adds a listener to receive window scroll events.
*
* @param listener the listener to be informed when the window is scrolled
+ * @deprecated use {@link Window#addWindowScrollHandler(ScrollHandler)} instead
*/
@Deprecated
public static void addWindowScrollListener(WindowScrollListener listener) {
diff --git a/user/src/com/google/gwt/user/client/WindowCloseListener.java b/user/src/com/google/gwt/user/client/WindowCloseListener.java
index aa5806c..5e6ed4a 100644
--- a/user/src/com/google/gwt/user/client/WindowCloseListener.java
+++ b/user/src/com/google/gwt/user/client/WindowCloseListener.java
@@ -19,6 +19,9 @@
* Implement this interface to receive closing events from the browser window.
*
* @see com.google.gwt.user.client.Window#addWindowCloseListener(WindowCloseListener)
+ * @deprecated use {@link Window.ClosingHandler} and
+ * {@link com.google.gwt.event.logical.shared.CloseHandler} instead
+ *
*/
@Deprecated
public interface WindowCloseListener extends java.util.EventListener {
diff --git a/user/src/com/google/gwt/user/client/WindowResizeListener.java b/user/src/com/google/gwt/user/client/WindowResizeListener.java
index 04cfd25..4240327 100644
--- a/user/src/com/google/gwt/user/client/WindowResizeListener.java
+++ b/user/src/com/google/gwt/user/client/WindowResizeListener.java
@@ -19,6 +19,8 @@
* Implement this interface to receive resize events from the browser window.
*
* @see com.google.gwt.user.client.Window#addWindowResizeListener(WindowResizeListener)
+ * @deprecated use {@link com.google.gwt.event.logical.shared.ResizeHandler}
+ * instead
*/
@Deprecated
public interface WindowResizeListener extends java.util.EventListener {
diff --git a/user/src/com/google/gwt/user/client/WindowScrollListener.java b/user/src/com/google/gwt/user/client/WindowScrollListener.java
index bf3f3a1..186bb78 100644
--- a/user/src/com/google/gwt/user/client/WindowScrollListener.java
+++ b/user/src/com/google/gwt/user/client/WindowScrollListener.java
@@ -19,6 +19,9 @@
* Implement this interface to receive scroll events from the browser window.
*
* @see com.google.gwt.user.client.Window#addWindowScrollListener(WindowScrollListener)
+ * @deprecated use
+ * {@link Window#addWindowScrollHandler(com.google.gwt.user.client.Window.ScrollHandler)}
+ * instead instead
*/
@Deprecated
public interface WindowScrollListener extends java.util.EventListener {
diff --git a/user/src/com/google/gwt/user/client/ui/Button.java b/user/src/com/google/gwt/user/client/ui/Button.java
index c7738c8..e571bbd 100644
--- a/user/src/com/google/gwt/user/client/ui/Button.java
+++ b/user/src/com/google/gwt/user/client/ui/Button.java
@@ -99,6 +99,7 @@
*
* @param html the HTML caption
* @param listener the click listener
+ * @deprecated use {@link Button#Button(String, ClickHandler)} instead
*/
@Deprecated
public Button(String html, ClickListener listener) {
diff --git a/user/src/com/google/gwt/user/client/ui/ChangeListener.java b/user/src/com/google/gwt/user/client/ui/ChangeListener.java
index cf75a46..c93a7e1 100644
--- a/user/src/com/google/gwt/user/client/ui/ChangeListener.java
+++ b/user/src/com/google/gwt/user/client/ui/ChangeListener.java
@@ -20,7 +20,10 @@
/**
* Event listener interface for 'change' events.
*
- * @deprecated use {@link com.google.gwt.event.dom.client.ChangeHandler} instead
+ * @deprecated we have now separated dom and logical change events. Use {@link com.google.gwt.event.dom.client.ChangeHandler} if the
+ * change listener was triggered by a dom change event or
+ * {@link com.google.gwt.event.logical.shared.ValueChangeHandler} if
+ * it was based on a logical event
*/
@Deprecated
public interface ChangeListener extends EventListener {
@@ -30,6 +33,12 @@
* sending the event.
*
* @param sender the widget that has changed
+ *
+ * @deprecated use
+ * {@link com.google.gwt.event.dom.client.ChangeHandler#onChange(com.google.gwt.event.dom.client.ChangeEvent)}
+ * if the change listener was triggered by a dom change event or
+ * {@link com.google.gwt.event.logical.shared.ValueChangeHandler#onValueChange(com.google.gwt.event.logical.shared.ValueChangeEvent)}
+ * if it was based on a logical event
*/
@Deprecated
void onChange(Widget sender);
diff --git a/user/src/com/google/gwt/user/client/ui/ChangeListenerCollection.java b/user/src/com/google/gwt/user/client/ui/ChangeListenerCollection.java
index ea4ca5a..c0504e2 100644
--- a/user/src/com/google/gwt/user/client/ui/ChangeListenerCollection.java
+++ b/user/src/com/google/gwt/user/client/ui/ChangeListenerCollection.java
@@ -23,7 +23,10 @@
* type {@link com.google.gwt.user.client.ui.ChangeListener}.
*
* @deprecated use <code>addDomHandler(myHandler, ChangeEvent.getType())</code>
- * instead to manage handlers for your widget
+ * for dom based change events and use
+ * <code>addHandler(myHandler, ValueChangeEvent.getType())</code>
+ * for logical change events instead to manage handlers for your
+ * widget
*/
@Deprecated
public class ChangeListenerCollection extends ArrayList<ChangeListener> {
diff --git a/user/src/com/google/gwt/user/client/ui/CheckBox.java b/user/src/com/google/gwt/user/client/ui/CheckBox.java
index a40700b..e2f96cf 100644
--- a/user/src/com/google/gwt/user/client/ui/CheckBox.java
+++ b/user/src/com/google/gwt/user/client/ui/CheckBox.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2008 Google Inc.
+ * Copyright 2009 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
@@ -34,10 +34,12 @@
* </p>
*
* <h3>CSS Style Rules</h3>
- * <ul class='css'>
- * <li>.gwt-CheckBox { }</li>
- * <li>.gwt-CheckBox-disabled { Applied when Checkbox is disabled }</li>
- * </ul>
+ * <dl>
+ * <dt>.gwt-CheckBox</dt>
+ * <dd>the outer element</dd>
+ * <dt>.gwt-CheckBox-disabled</dt>
+ * <dd>applied when Checkbox is disabled</dd>
+ * </dl>
*
* <p>
* <h3>Example</h3>
@@ -46,6 +48,7 @@
*/
public class CheckBox extends ButtonBase implements HasName, HasValue<Boolean> {
private Element inputElem, labelElem;
+ private boolean valueChangeHandlerInitialized;
/**
* Creates a check box with no label.
@@ -104,10 +107,11 @@
ValueChangeHandler<Boolean> handler) {
// Is this the first value change handler? If so, time to listen to clicks
// on the checkbox
- if (!isEventHandled(ValueChangeEvent.getType())) {
+ if (!valueChangeHandlerInitialized) {
+ valueChangeHandlerInitialized = true;
this.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
- // No need to compare old value and new value--click handler
+ // No need to compare old value and new value--click handler
// only fires on real click, and value always toggles
ValueChangeEvent.fire(CheckBox.this, isChecked());
}
@@ -166,7 +170,7 @@
/**
* Checks or unchecks this check box. Does not fire {@link ValueChangeEvent}.
- * (If you want the event to fire, use {@link #setValue(boolean, boolean)})
+ * (If you want the event to fire, use {@link #setValue(Boolean, boolean)})
*
* @param checked <code>true</code> to check the check box.
*/
@@ -220,7 +224,8 @@
}
/**
- * Checks or unchecks the text box.
+ * Checks or unchecks the text box.
+ *
* @param value true to check, false to uncheck. Must not be null.
* @thows IllegalArgumentException if value is null
*/
@@ -229,12 +234,12 @@
}
/**
- * Checks or unchecks the text box, firing {@link ValueChangeEvent}
- * if appropriate.
- *
+ * Checks or unchecks the text box, firing {@link ValueChangeEvent} if
+ * appropriate.
+ *
* @param value true to check, false to uncheck. Must not be null.
* @param fireEvents If true, and value has changed, fire a
- * {@link ValueChangeEvent}
+ * {@link ValueChangeEvent}
* @thows IllegalArgumentException if value is null
*/
public void setValue(Boolean value, boolean fireEvents) {
diff --git a/user/src/com/google/gwt/user/client/ui/ClickListener.java b/user/src/com/google/gwt/user/client/ui/ClickListener.java
index cf998cc..1c5e15d 100644
--- a/user/src/com/google/gwt/user/client/ui/ClickListener.java
+++ b/user/src/com/google/gwt/user/client/ui/ClickListener.java
@@ -19,6 +19,7 @@
/**
* Event listener interface for click events.
+ *
* @deprecated use {@link com.google.gwt.event.dom.client.ClickHandler} instead
*/
@Deprecated
diff --git a/user/src/com/google/gwt/user/client/ui/Composite.java b/user/src/com/google/gwt/user/client/ui/Composite.java
index c7ed3bd..a628c78 100644
--- a/user/src/com/google/gwt/user/client/ui/Composite.java
+++ b/user/src/com/google/gwt/user/client/ui/Composite.java
@@ -49,11 +49,11 @@
public void onBrowserEvent(Event event) {
// Fire any handler added to the composite itself.
super.onBrowserEvent(event);
-
+
// Delegate events to the widget.
widget.onBrowserEvent(event);
}
-
+
/**
* Provides subclasses access to the topmost widget that defines this
* composite.
diff --git a/user/src/com/google/gwt/user/client/ui/DelegatingChangeListenerCollection.java b/user/src/com/google/gwt/user/client/ui/DelegatingChangeListenerCollection.java
index e283f85..c32c990 100644
--- a/user/src/com/google/gwt/user/client/ui/DelegatingChangeListenerCollection.java
+++ b/user/src/com/google/gwt/user/client/ui/DelegatingChangeListenerCollection.java
@@ -38,6 +38,8 @@
* changeListeners.add(listener);
* }
*</pre>
+ *
+ * @deprecated use <code>Widget#delegateEvent</code> instead
*/
@Deprecated
public class DelegatingChangeListenerCollection extends
diff --git a/user/src/com/google/gwt/user/client/ui/DelegatingClickListenerCollection.java b/user/src/com/google/gwt/user/client/ui/DelegatingClickListenerCollection.java
index 0e66518..f6feae8 100644
--- a/user/src/com/google/gwt/user/client/ui/DelegatingClickListenerCollection.java
+++ b/user/src/com/google/gwt/user/client/ui/DelegatingClickListenerCollection.java
@@ -38,6 +38,8 @@
* clickListeners.add(listener);
* }
*</pre>
+ *
+ * @deprecated use <code>Widget#delegateEvent</code> instead
*/
@Deprecated
public class DelegatingClickListenerCollection extends ClickListenerCollection
diff --git a/user/src/com/google/gwt/user/client/ui/DelegatingFocusListenerCollection.java b/user/src/com/google/gwt/user/client/ui/DelegatingFocusListenerCollection.java
index 7c937e0..9d26eee 100644
--- a/user/src/com/google/gwt/user/client/ui/DelegatingFocusListenerCollection.java
+++ b/user/src/com/google/gwt/user/client/ui/DelegatingFocusListenerCollection.java
@@ -38,6 +38,8 @@
* focusListeners.add(listener);
* }
*</pre>
+ *
+ * @deprecated use <code>Widget#delegateEvent</code> instead
*/
@Deprecated
public class DelegatingFocusListenerCollection extends FocusListenerCollection
diff --git a/user/src/com/google/gwt/user/client/ui/DelegatingKeyboardListenerCollection.java b/user/src/com/google/gwt/user/client/ui/DelegatingKeyboardListenerCollection.java
index 6994c25..ccae9d2 100644
--- a/user/src/com/google/gwt/user/client/ui/DelegatingKeyboardListenerCollection.java
+++ b/user/src/com/google/gwt/user/client/ui/DelegatingKeyboardListenerCollection.java
@@ -27,7 +27,7 @@
* source of the event. To use a {@link DelegatingKeyboardListenerCollection},
* simply use the {@link DelegatingKeyboardListenerCollection} instead of a
* {@link KeyboardListenerCollection}. For example, in {@link SuggestBox}, the
- * following code is used to listen to keyboard events on the {@link SuggestBox}'s
+ * following code is used to listen to keyboard events on the {@link SuggestBox}
* underlying widget.
* </p>
*
@@ -39,13 +39,15 @@
* keyboardListeners.add(listener);
* }
*</pre>
+ *
+ * @deprecated use <code>Widget#delegateEvent</code> instead
*/
@Deprecated
public class DelegatingKeyboardListenerCollection extends
KeyboardListenerCollection implements KeyboardListener {
private final Widget owner;
-
+
/**
* Constructor for {@link DelegatingKeyboardListenerCollection}.
*
diff --git a/user/src/com/google/gwt/user/client/ui/DisclosureEvent.java b/user/src/com/google/gwt/user/client/ui/DisclosureEvent.java
index f5405d0..8488ed5 100644
--- a/user/src/com/google/gwt/user/client/ui/DisclosureEvent.java
+++ b/user/src/com/google/gwt/user/client/ui/DisclosureEvent.java
@@ -19,6 +19,10 @@
/**
* Event object containing information about {@link DisclosurePanel} changes.
+ *
+ * @deprecated use
+ * {@link com.google.gwt.event.logical.shared.CloseEvent} and
+ * {@link com.google.gwt.event.logical.shared.OpenEvent} instead
*/
@Deprecated
public class DisclosureEvent extends EventObject {
diff --git a/user/src/com/google/gwt/user/client/ui/DisclosureHandler.java b/user/src/com/google/gwt/user/client/ui/DisclosureHandler.java
index dd283e5..3145353 100644
--- a/user/src/com/google/gwt/user/client/ui/DisclosureHandler.java
+++ b/user/src/com/google/gwt/user/client/ui/DisclosureHandler.java
@@ -14,14 +14,15 @@
* the License.
*/
package com.google.gwt.user.client.ui;
-
+
import java.util.EventListener;
/**
* Event handler interface for {@link DisclosureEvent}.
*
* @deprecated use {@link com.google.gwt.event.logical.shared.CloseHandler}
- * and/or {@link com.google.gwt.event.logical.shared.OpenHandler} instead
+ * and/or {@link com.google.gwt.event.logical.shared.OpenHandler}
+ * instead
* @see DisclosurePanel
*/
@Deprecated
@@ -30,6 +31,8 @@
* Fired when the panel is closed.
*
* @param event event representing this action.
+ * @deprecated use {@link com.google.gwt.event.logical.shared.CloseHandler}
+ * instead
*/
@Deprecated
void onClose(DisclosureEvent event);
@@ -38,6 +41,7 @@
* Fired when the panel is opened.
*
* @param event event representing this action.
+ * @deprecated use {@link com.google.gwt.event.logical.shared.OpenHandler} instead
*/
@Deprecated
void onOpen(DisclosureEvent event);
diff --git a/user/src/com/google/gwt/user/client/ui/FiresDisclosureEvents.java b/user/src/com/google/gwt/user/client/ui/FiresDisclosureEvents.java
index 2731117..b91e4d0 100644
--- a/user/src/com/google/gwt/user/client/ui/FiresDisclosureEvents.java
+++ b/user/src/com/google/gwt/user/client/ui/FiresDisclosureEvents.java
@@ -15,7 +15,6 @@
*/
package com.google.gwt.user.client.ui;
-
/**
* A widget that implements this interface fires the events defined by the
* {@link DisclosureHandler} interface.
diff --git a/user/src/com/google/gwt/user/client/ui/FocusListener.java b/user/src/com/google/gwt/user/client/ui/FocusListener.java
index 23b707d..fa82aca 100644
--- a/user/src/com/google/gwt/user/client/ui/FocusListener.java
+++ b/user/src/com/google/gwt/user/client/ui/FocusListener.java
@@ -30,6 +30,9 @@
* Fired when a widget receives keyboard focus.
*
* @param sender the widget receiving focus.
+ * @deprecated use
+ * {@link com.google.gwt.event.dom.client.FocusHandler#onFocus(com.google.gwt.event.dom.client.FocusEvent)}
+ * instead
*/
@Deprecated
void onFocus(Widget sender);
@@ -38,6 +41,9 @@
* Fired when a widget loses keyboard focus.
*
* @param sender the widget losing focus.
+ * @deprecated use
+ * {@link com.google.gwt.event.dom.client.BlurHandler#onBlur(com.google.gwt.event.dom.client.BlurEvent)}
+ * instead
*/
@Deprecated
void onLostFocus(Widget sender);
diff --git a/user/src/com/google/gwt/user/client/ui/FocusListenerCollection.java b/user/src/com/google/gwt/user/client/ui/FocusListenerCollection.java
index b2981aa..5488f26 100644
--- a/user/src/com/google/gwt/user/client/ui/FocusListenerCollection.java
+++ b/user/src/com/google/gwt/user/client/ui/FocusListenerCollection.java
@@ -27,8 +27,8 @@
* type {@link com.google.gwt.user.client.ui.FocusListener}
*
* @deprecated use <code>addDomHandler(myHandler, FocusEvent.getType())</code>
- * and <code>addDomHandler(myHandler, BlurEvent.getType())</code>
- * to manage your widget's handlers instead
+ * and <code>addDomHandler(myHandler, BlurEvent.getType())</code> to
+ * manage your widget's handlers instead
*/
@Deprecated
public class FocusListenerCollection extends ArrayList<FocusListener> {
diff --git a/user/src/com/google/gwt/user/client/ui/Focusable.java b/user/src/com/google/gwt/user/client/ui/Focusable.java
new file mode 100644
index 0000000..a7828eb
--- /dev/null
+++ b/user/src/com/google/gwt/user/client/ui/Focusable.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2008 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.user.client.ui;
+
+/**
+ * A widget that implements this interface can receive keyboard focus.
+ */
+public interface Focusable {
+
+ /**
+ * Gets the widget's position in the tab index.
+ *
+ * @return the widget's tab index
+ */
+ int getTabIndex();
+
+ /**
+ * Sets the widget's 'access key'. This key is used (in conjunction with a
+ * browser-specific modifier key) to automatically focus the widget.
+ *
+ * @param key the widget's access key
+ */
+ void setAccessKey(char key);
+
+ /**
+ * Explicitly focus/unfocus this widget. Only one widget can have focus at a
+ * time, and the widget that does will receive all keyboard events.
+ *
+ * @param focused whether this widget should take focus or release it
+ */
+ void setFocus(boolean focused);
+
+ /**
+ * Sets the widget's position in the tab index. If more than one widget has
+ * the same tab index, each such widget will receive focus in an arbitrary
+ * order. Setting the tab index to <code>-1</code> will cause this widget to
+ * be removed from the tab order.
+ *
+ * @param index the widget's tab index
+ */
+ void setTabIndex(int index);
+}
diff --git a/user/src/com/google/gwt/user/client/ui/FormHandler.java b/user/src/com/google/gwt/user/client/ui/FormHandler.java
index f4f8ab8..cc18975 100644
--- a/user/src/com/google/gwt/user/client/ui/FormHandler.java
+++ b/user/src/com/google/gwt/user/client/ui/FormHandler.java
@@ -19,7 +19,9 @@
/**
* Handler interface for form submit events.
- * @deprecated use {@link FormPanel.SubmitCompleteHandler} and/or {@link FormPanel.SubmitHandler} instead
+ *
+ * @deprecated use {@link FormPanel.SubmitCompleteHandler} and/or
+ * {@link FormPanel.SubmitHandler} instead
*/
@Deprecated
public interface FormHandler extends EventListener {
@@ -29,12 +31,13 @@
*
* <p>
* The FormPanel must <em>not</em> be detached (i.e. removed from its parent
- * or otherwise disconnected from a {@link RootPanel}) until the submission
- * is complete. Otherwise, notification of submission will fail.
+ * or otherwise disconnected from a {@link RootPanel}) until the submission is
+ * complete. Otherwise, notification of submission will fail.
* </p>
*
* @param event an event object containing information about the form
* submission
+ * @deprecated use {@link FormPanel.SubmitHandler} instead
*/
@Deprecated
void onSubmit(FormSubmitEvent event);
@@ -44,6 +47,7 @@
*
* @param event an event object containing information about the form
* submission
+ * @deprecated use {@link FormPanel.SubmitCompleteHandler} instead
*/
@Deprecated
void onSubmitComplete(FormSubmitCompleteEvent event);
diff --git a/user/src/com/google/gwt/user/client/ui/FormHandlerCollection.java b/user/src/com/google/gwt/user/client/ui/FormHandlerCollection.java
index 66c6a4c..af6a126 100644
--- a/user/src/com/google/gwt/user/client/ui/FormHandlerCollection.java
+++ b/user/src/com/google/gwt/user/client/ui/FormHandlerCollection.java
@@ -19,8 +19,8 @@
/**
* Helper class for widgets that accept
- * {@link com.google.gwt.user.client.ui.FormHandler FormHandlers}. This
- * subclass of ArrayList assumes that all items added to it will be of type
+ * {@link com.google.gwt.user.client.ui.FormHandler FormHandlers}. This subclass
+ * of ArrayList assumes that all items added to it will be of type
* {@link com.google.gwt.user.client.ui.FormHandler}.
*
* @deprecated {@link FormPanel} now handles all handler management internally
diff --git a/user/src/com/google/gwt/user/client/ui/FormPanel.java b/user/src/com/google/gwt/user/client/ui/FormPanel.java
index 619849e..4aa7b90 100644
--- a/user/src/com/google/gwt/user/client/ui/FormPanel.java
+++ b/user/src/com/google/gwt/user/client/ui/FormPanel.java
@@ -88,12 +88,18 @@
/**
* Create a submit complete event
+ *
* @param resultsHtml the results from submitting the form
*/
protected SubmitCompleteEvent(String resultsHtml) {
this.resultHtml = resultsHtml;
}
+ @Override
+ public Type<SubmitCompleteHandler> getAssociatedType() {
+ return TYPE;
+ }
+
/**
* Gets the result text of the form submission.
*
@@ -110,11 +116,6 @@
protected void dispatch(SubmitCompleteHandler handler) {
handler.onSubmitComplete(this);
}
-
- @Override
- protected Type<SubmitCompleteHandler> getAssociatedType() {
- return TYPE;
- }
}
/**
@@ -160,6 +161,11 @@
this.canceled = true;
}
+ @Override
+ public Type<FormPanel.SubmitHandler> getAssociatedType() {
+ return TYPE;
+ }
+
/**
* Gets whether this form submit will be canceled.
*
@@ -174,14 +180,11 @@
handler.onSubmit(this);
}
- @Override
- protected Type<FormPanel.SubmitHandler> getAssociatedType() {
- return TYPE;
- }
-
/**
* This method is used for legacy support and should be removed when
* {@link FormHandler} is removed.
+ *
+ * @deprecated use {@link FormPanel.SubmitEvent#cancel()} instead
*/
@Deprecated
void setCanceled(boolean canceled) {
diff --git a/user/src/com/google/gwt/user/client/ui/FormSubmitCompleteEvent.java b/user/src/com/google/gwt/user/client/ui/FormSubmitCompleteEvent.java
index 0dd426a..74c8c44 100644
--- a/user/src/com/google/gwt/user/client/ui/FormSubmitCompleteEvent.java
+++ b/user/src/com/google/gwt/user/client/ui/FormSubmitCompleteEvent.java
@@ -38,8 +38,8 @@
/**
* Gets the result text of the form submission.
*
- * @return the result html, or <code>null</code> if there was an error
- * reading it
+ * @return the result html, or <code>null</code> if there was an error reading
+ * it
* @tip The result html can be <code>null</code> as a result of submitting a
* form to a different domain.
*/
diff --git a/user/src/com/google/gwt/user/client/ui/HTMLTable.java b/user/src/com/google/gwt/user/client/ui/HTMLTable.java
index 77bd5eb..ee099c1 100644
--- a/user/src/com/google/gwt/user/client/ui/HTMLTable.java
+++ b/user/src/com/google/gwt/user/client/ui/HTMLTable.java
@@ -823,6 +823,7 @@
* @param listener listener to add
* @deprecated add a click handler instead and use {@link HTMLTable#getCellForEvent(ClickEvent)} to get the cell information
*/
+ @Deprecated
public void addTableListener(TableListener listener) {
ListenerWrapper.Table.add(this, listener);
}
diff --git a/user/src/com/google/gwt/user/client/ui/HasFocus.java b/user/src/com/google/gwt/user/client/ui/HasFocus.java
index c869bd4..e0e999e 100644
--- a/user/src/com/google/gwt/user/client/ui/HasFocus.java
+++ b/user/src/com/google/gwt/user/client/ui/HasFocus.java
@@ -17,40 +17,11 @@
/**
* A widget that implements this interface can receive keyboard focus.
+ *
+ * @deprecated use {@link Focusable} instead
*/
-@SuppressWarnings("deprecation")
-public interface HasFocus extends SourcesFocusEvents, SourcesKeyboardEvents {
+@Deprecated
+public interface HasFocus extends Focusable, SourcesFocusEvents,
+ SourcesKeyboardEvents {
- /**
- * Gets the widget's position in the tab index.
- *
- * @return the widget's tab index
- */
- int getTabIndex();
-
- /**
- * Sets the widget's 'access key'. This key is used (in conjunction with a
- * browser-specific modifier key) to automatically focus the widget.
- *
- * @param key the widget's access key
- */
- void setAccessKey(char key);
-
- /**
- * Explicitly focus/unfocus this widget. Only one widget can have focus at a
- * time, and the widget that does will receive all keyboard events.
- *
- * @param focused whether this widget should take focus or release it
- */
- void setFocus(boolean focused);
-
- /**
- * Sets the widget's position in the tab index. If more than one widget has
- * the same tab index, each such widget will receive focus in an arbitrary
- * order. Setting the tab index to <code>-1</code> will cause this widget to
- * be removed from the tab order.
- *
- * @param index the widget's tab index
- */
- void setTabIndex(int index);
}
diff --git a/user/src/com/google/gwt/user/client/ui/KeyboardListener.java b/user/src/com/google/gwt/user/client/ui/KeyboardListener.java
index e0a90d1..fbf314e 100644
--- a/user/src/com/google/gwt/user/client/ui/KeyboardListener.java
+++ b/user/src/com/google/gwt/user/client/ui/KeyboardListener.java
@@ -20,32 +20,156 @@
/**
* Event listener interface for keyboard events.
*
- * @deprecated use {@link com.google.gwt.event.dom.client.KeyDownHandler}, {@link com.google.gwt.event.dom.client.KeyUpHandler} and/or {@link com.google.gwt.event.dom.client.KeyPressHandler}
- * instead
+ * @deprecated use {@link com.google.gwt.event.dom.client.KeyDownHandler},
+ * {@link com.google.gwt.event.dom.client.KeyUpHandler} and/or
+ * {@link com.google.gwt.event.dom.client.KeyPressHandler} instead
*/
@Deprecated
public interface KeyboardListener extends EventListener {
-
+ /**
+ * @deprecated use {@link com.google.gwt.event.dom.client.KeyCodes#KEY_ALT}
+ * instead
+ */
+ @Deprecated
int KEY_ALT = 18;
+
+ /**
+ * @deprecated use
+ * {@link com.google.gwt.event.dom.client.KeyCodes#KEY_BACKSPACE}
+ * instead
+ */
+ @Deprecated
int KEY_BACKSPACE = 8;
+
+ /**
+ * @deprecated use {@link com.google.gwt.event.dom.client.KeyCodes#KEY_CTRL}
+ * instead
+ */
+ @Deprecated
int KEY_CTRL = 17;
+
+ /**
+ * @deprecated use {@link com.google.gwt.event.dom.client.KeyCodes#KEY_DELETE}
+ * instead
+ */
+ @Deprecated
int KEY_DELETE = 46;
+
+ /**
+ * @deprecated use {@link com.google.gwt.event.dom.client.KeyCodes#KEY_DOWN}
+ * instead
+ */
+ @Deprecated
int KEY_DOWN = 40;
+
+ /**
+ * @deprecated use {@link com.google.gwt.event.dom.client.KeyCodes#KEY_END}
+ * instead
+ */
+ @Deprecated
int KEY_END = 35;
+
+ /**
+ * @deprecated use {@link com.google.gwt.event.dom.client.KeyCodes#KEY_ENTER}
+ * instead
+ */
+ @Deprecated
int KEY_ENTER = 13;
+
+ /**
+ * @deprecated use {@link com.google.gwt.event.dom.client.KeyCodes#KEY_ESCAPE}
+ * instead
+ */
+ @Deprecated
int KEY_ESCAPE = 27;
+
+ /**
+ * @deprecated use {@link com.google.gwt.event.dom.client.KeyCodes#KEY_HOME}
+ * instead
+ */
+ @Deprecated
int KEY_HOME = 36;
+
+ /**
+ * @deprecated use {@link com.google.gwt.event.dom.client.KeyCodes#KEY_LEFT}
+ * instead
+ */
+ @Deprecated
int KEY_LEFT = 37;
+
+ /**
+ * @deprecated use
+ * {@link com.google.gwt.event.dom.client.KeyCodes#KEY_PAGEDOWN}
+ * instead
+ */
+ @Deprecated
int KEY_PAGEDOWN = 34;
+
+ /**
+ * @deprecated use {@link com.google.gwt.event.dom.client.KeyCodes#KEY_PAGEUP}
+ * instead
+ */
+ @Deprecated
int KEY_PAGEUP = 33;
+
+ /**
+ * @deprecated use {@link com.google.gwt.event.dom.client.KeyCodes#KEY_RIGHT}
+ * instead
+ */
+ @Deprecated
int KEY_RIGHT = 39;
+
+ /**
+ * @deprecated use {@link com.google.gwt.event.dom.client.KeyCodes#KEY_SHIFT}
+ * instead
+ */
+ @Deprecated
int KEY_SHIFT = 16;
+
+ /**
+ * @deprecated use {@link com.google.gwt.event.dom.client.KeyCodes#KEY_TAB}
+ * instead
+ */
+ @Deprecated
int KEY_TAB = 9;
+
+ /**
+ * @deprecated use {@link com.google.gwt.event.dom.client.KeyCodes#KEY_UP}
+ * instead
+ */
+ @Deprecated
int KEY_UP = 38;
+ /**
+ * @deprecated use
+ * {@link com.google.gwt.event.dom.client.KeyCodeEvent#isAltKeyDown()}
+ * instead
+ */
+ @Deprecated
int MODIFIER_ALT = 4;
+
+ /**
+ * @deprecated use
+ * {@link com.google.gwt.event.dom.client.KeyCodeEvent#isControlKeyDown()}
+ * instead
+ */
+ @Deprecated
int MODIFIER_CTRL = 2;
+
+ /**
+ * @deprecated use
+ * {@link com.google.gwt.event.dom.client.KeyCodeEvent#isMetaKeyDown()}
+ * instead
+ */
+ @Deprecated
int MODIFIER_META = 8;
+
+ /**
+ * @deprecated use
+ * {@link com.google.gwt.event.dom.client.KeyCodeEvent#isShiftKeyDown()}
+ * instead
+ */
+ @Deprecated
int MODIFIER_SHIFT = 1;
/**
@@ -58,8 +182,14 @@
* value is a combination of the bits defined by
* {@link KeyboardListener#MODIFIER_SHIFT},
* {@link KeyboardListener#MODIFIER_CTRL}, and
- * {@link KeyboardListener#MODIFIER_ALT}.
+ * {@link KeyboardListener#MODIFIER_ALT}
+ *
+ *
+ * @deprecated use
+ * {@link com.google.gwt.event.dom.client.KeyDownHandler#onKeyDown(com.google.gwt.event.dom.client.KeyDownEvent)}
+ * instead
*/
+ @Deprecated
void onKeyDown(Widget sender, char keyCode, int modifiers);
/**
@@ -81,8 +211,12 @@
* value is a combination of the bits defined by
* {@link KeyboardListener#MODIFIER_SHIFT},
* {@link KeyboardListener#MODIFIER_CTRL}, and
- * {@link KeyboardListener#MODIFIER_ALT}.
+ * {@link KeyboardListener#MODIFIER_ALT}
+ * @deprecated use
+ * {@link com.google.gwt.event.dom.client.KeyPressHandler#onKeyPress(com.google.gwt.event.dom.client.KeyPressEvent)}
+ * instead
*/
+ @Deprecated
void onKeyPress(Widget sender, char keyCode, int modifiers);
/**
@@ -95,7 +229,11 @@
* value is a combination of the bits defined by
* {@link KeyboardListener#MODIFIER_SHIFT},
* {@link KeyboardListener#MODIFIER_CTRL}, and
- * {@link KeyboardListener#MODIFIER_ALT}.
+ * {@link KeyboardListener#MODIFIER_ALT}
+ * @deprecated use
+ * {@link com.google.gwt.event.dom.client.KeyUpHandler#onKeyUp(com.google.gwt.event.dom.client.KeyUpEvent)}
+ * instead
*/
+ @Deprecated
void onKeyUp(Widget sender, char keyCode, int modifiers);
}
diff --git a/user/src/com/google/gwt/user/client/ui/LazyPanel.java b/user/src/com/google/gwt/user/client/ui/LazyPanel.java
index 5aca1a2..58b0f53 100644
--- a/user/src/com/google/gwt/user/client/ui/LazyPanel.java
+++ b/user/src/com/google/gwt/user/client/ui/LazyPanel.java
@@ -21,11 +21,10 @@
* instantiated until {@link #setVisible}(true) or {@link #ensureWidget} is
* called.
* <p>
- * <h3>Example</h3>
- * {@example com.google.gwt.examples.LazyPanelExample}
+ * <h3>Example</h3> {@example com.google.gwt.examples.LazyPanelExample}
*/
public abstract class LazyPanel extends SimplePanel {
-
+
public LazyPanel() {
}
@@ -51,13 +50,13 @@
}
@Override
- /**
- * Sets whether this object is visible. If <code>visible</code> is
+ /*
+ * Sets whether this object is visible. If <code>visible</code> is
* <code>true</code>, creates the sole child widget if necessary by calling
* {@link #ensureWidget}.
*
- * @param visible <code>true</code> to show the object, <code>false</code>
- * to hide it
+ * @param visible <code>true</code> to show the object, <code>false</code> to
+ * hide it
*/
public void setVisible(boolean visible) {
if (visible) {
diff --git a/user/src/com/google/gwt/user/client/ui/ListenerWrapper.java b/user/src/com/google/gwt/user/client/ui/ListenerWrapper.java
index ce639b9..321815d 100644
--- a/user/src/com/google/gwt/user/client/ui/ListenerWrapper.java
+++ b/user/src/com/google/gwt/user/client/ui/ListenerWrapper.java
@@ -33,6 +33,7 @@
import com.google.gwt.event.dom.client.HasAllKeyHandlers;
import com.google.gwt.event.dom.client.HasChangeHandlers;
import com.google.gwt.event.dom.client.HasClickHandlers;
+import com.google.gwt.event.dom.client.HasErrorHandlers;
import com.google.gwt.event.dom.client.HasLoadHandlers;
import com.google.gwt.event.dom.client.HasMouseDownHandlers;
import com.google.gwt.event.dom.client.HasMouseMoveHandlers;
@@ -226,8 +227,10 @@
public static class Load extends ListenerWrapper<LoadListener> implements
LoadHandler, ErrorHandler {
- public static void add(HasLoadHandlers source, LoadListener listener) {
- source.addLoadHandler(new Load(listener));
+ public static <S extends HasLoadHandlers & HasErrorHandlers>void add(S source, LoadListener listener) {
+ Load l = new Load(listener);
+ source.addLoadHandler(l);
+ source.addErrorHandler(l);
}
public static void remove(Widget eventSource, LoadListener listener) {
diff --git a/user/src/com/google/gwt/user/client/ui/LoadListener.java b/user/src/com/google/gwt/user/client/ui/LoadListener.java
index fed7374..47acf54 100644
--- a/user/src/com/google/gwt/user/client/ui/LoadListener.java
+++ b/user/src/com/google/gwt/user/client/ui/LoadListener.java
@@ -20,9 +20,8 @@
/**
* Event listener interface for 'load' events.
*
- * @deprecated use {@link com.google.gwt.event.dom.client.LoadHandler}
- * and/or {@link com.google.gwt.event.dom.client.ErrorHandler}
- * instead
+ * @deprecated use {@link com.google.gwt.event.dom.client.LoadHandler} and/or
+ * {@link com.google.gwt.event.dom.client.ErrorHandler} instead
*/
@Deprecated
public interface LoadListener extends EventListener {
diff --git a/user/src/com/google/gwt/user/client/ui/MouseListener.java b/user/src/com/google/gwt/user/client/ui/MouseListener.java
index f80c5c8..0ad8fb8 100644
--- a/user/src/com/google/gwt/user/client/ui/MouseListener.java
+++ b/user/src/com/google/gwt/user/client/ui/MouseListener.java
@@ -20,8 +20,7 @@
/**
* Event listener interface for mouse events.
*
- * @deprecated use
- * {@link com.google.gwt.event.dom.client.MouseDownHandler},
+ * @deprecated use {@link com.google.gwt.event.dom.client.MouseDownHandler},
* {@link com.google.gwt.event.dom.client.MouseUpHandler},
* {@link com.google.gwt.event.dom.client.MouseOverHandler},
* {@link com.google.gwt.event.dom.client.MouseMoveHandler}, and/or
@@ -36,21 +35,33 @@
* @param sender the widget sending the event
* @param x the x coordinate of the mouse
* @param y the y coordinate of the mouse
+ * @deprecated use
+ * {@link com.google.gwt.event.dom.client.MouseDownHandler#onMouseDown(com.google.gwt.event.dom.client.MouseDownEvent)}
+ * instead
*/
+ @Deprecated
void onMouseDown(Widget sender, int x, int y);
/**
* Fired when the mouse enters a widget's area.
*
* @param sender the widget sending the event
+ * @deprecated use
+ * {@link com.google.gwt.event.dom.client.MouseOverHandler#onMouseOver(com.google.gwt.event.dom.client.MouseOverEvent)}
+ * instead
*/
+ @Deprecated
void onMouseEnter(Widget sender);
/**
* Fired when the mouse leaves a widget's area.
*
* @param sender the widget sending the event
+ * @deprecated use
+ * {@link com.google.gwt.event.dom.client.MouseOutHandler#onMouseOut(com.google.gwt.event.dom.client.MouseOutEvent)}
+ * instead
*/
+ @Deprecated
void onMouseLeave(Widget sender);
/**
@@ -59,7 +70,11 @@
* @param sender the widget sending the event
* @param x the x coordinate of the mouse
* @param y the y coordinate of the mouse
+ * @deprecated use
+ * {@link com.google.gwt.event.dom.client.MouseMoveHandler#onMouseMove(com.google.gwt.event.dom.client.MouseMoveEvent)}
+ * instead
*/
+ @Deprecated
void onMouseMove(Widget sender, int x, int y);
/**
@@ -68,6 +83,10 @@
* @param sender the widget sending the event
* @param x the x coordinate of the mouse
* @param y the y coordinate of the mouse
+ * @deprecated use
+ * {@link com.google.gwt.event.dom.client.MouseUpHandler#onMouseUp(com.google.gwt.event.dom.client.MouseUpEvent)}
+ * instead
*/
+ @Deprecated
void onMouseUp(Widget sender, int x, int y);
}
diff --git a/user/src/com/google/gwt/user/client/ui/MouseListenerAdapter.java b/user/src/com/google/gwt/user/client/ui/MouseListenerAdapter.java
index 10b5018..601ab6c 100644
--- a/user/src/com/google/gwt/user/client/ui/MouseListenerAdapter.java
+++ b/user/src/com/google/gwt/user/client/ui/MouseListenerAdapter.java
@@ -19,8 +19,7 @@
* An adapter to simplify mouse event listeners that do not need all events
* defined on the MouseListener interface.
*
- * @deprecated use
- * {@link com.google.gwt.event.dom.client.MouseDownHandler},
+ * @deprecated use {@link com.google.gwt.event.dom.client.MouseDownHandler},
* {@link com.google.gwt.event.dom.client.MouseUpHandler},
* {@link com.google.gwt.event.dom.client.MouseOverHandler},
* {@link com.google.gwt.event.dom.client.MouseMoveHandler}, and/or
diff --git a/user/src/com/google/gwt/user/client/ui/MouseListenerCollection.java b/user/src/com/google/gwt/user/client/ui/MouseListenerCollection.java
index 08c1336..390b2c6 100644
--- a/user/src/com/google/gwt/user/client/ui/MouseListenerCollection.java
+++ b/user/src/com/google/gwt/user/client/ui/MouseListenerCollection.java
@@ -66,12 +66,10 @@
*/
public void fireMouseEvent(Widget sender, Event event) {
final Element senderElem = sender.getElement();
- int x = DOM.eventGetClientX(event)
- - DOM.getAbsoluteLeft(senderElem)
+ int x = DOM.eventGetClientX(event) - DOM.getAbsoluteLeft(senderElem)
+ DOM.getElementPropertyInt(senderElem, "scrollLeft")
+ Window.getScrollLeft();
- int y = DOM.eventGetClientY(event)
- - DOM.getAbsoluteTop(senderElem)
+ int y = DOM.eventGetClientY(event) - DOM.getAbsoluteTop(senderElem)
+ DOM.getElementPropertyInt(senderElem, "scrollTop")
+ Window.getScrollTop();
diff --git a/user/src/com/google/gwt/user/client/ui/MouseWheelListener.java b/user/src/com/google/gwt/user/client/ui/MouseWheelListener.java
index b60bd93..65c4499 100644
--- a/user/src/com/google/gwt/user/client/ui/MouseWheelListener.java
+++ b/user/src/com/google/gwt/user/client/ui/MouseWheelListener.java
@@ -1,12 +1,12 @@
/*
* Copyright 2007 Google Inc.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -20,16 +20,16 @@
/**
* Event listener interface for mouse wheel events.
*
- * @deprecated use
- * {@link com.google.gwt.event.dom.client.MouseWheelHandler} instead
- *
+ * @deprecated use {@link com.google.gwt.event.dom.client.MouseWheelHandler}
+ * instead
+ *
*/
@Deprecated
public interface MouseWheelListener extends EventListener {
/**
* Fired when the user scrolls the mouse wheel over a widget.
- *
+ *
* @param sender the widget sending the event
* @param velocity the velocity information for the wheel event
*/
diff --git a/user/src/com/google/gwt/user/client/ui/MouseWheelVelocity.java b/user/src/com/google/gwt/user/client/ui/MouseWheelVelocity.java
index bf66739..86732d3 100644
--- a/user/src/com/google/gwt/user/client/ui/MouseWheelVelocity.java
+++ b/user/src/com/google/gwt/user/client/ui/MouseWheelVelocity.java
@@ -25,8 +25,10 @@
*
* @see com.google.gwt.user.client.DOM#eventGetMouseWheelVelocityY An
* explanation of the units used for mouse wheel velocity.
+ * @deprecated use
+ * {@link com.google.gwt.event.dom.client.MouseWheelEvent#getDeltaY()}
+ * instead
*/
-
@Deprecated
public class MouseWheelVelocity {
@@ -59,7 +61,11 @@
* if the mouse wheel is moving north (toward the top of the screen)
* or negative if the mouse wheel is moving south (toward the bottom
* of the screen)
+ * @deprecated use
+ * {@link com.google.gwt.event.dom.client.MouseWheelEvent#getDeltaY()}
+ * instead
*/
+ @Deprecated
public int getDeltaY() {
return vY;
}
@@ -75,7 +81,11 @@
*
* @return <code>true</code> if the velocity includes a component directed
* toword the top of the screen
+ * @deprecated use
+ * {@link com.google.gwt.event.dom.client.MouseWheelEvent#isNorth()}
+ * instead
*/
+ @Deprecated
public boolean isNorth() {
return getDeltaY() < 0;
}
@@ -86,7 +96,11 @@
*
* @return <code>true</code> if the velocity includes a component directed
* toword the bottom of the screen
+ * @deprecated use
+ * {@link com.google.gwt.event.dom.client.MouseWheelEvent#isSouth()}
+ * instead
*/
+ @Deprecated
public boolean isSouth() {
return getDeltaY() > 0;
}
diff --git a/user/src/com/google/gwt/user/client/ui/MultiWordSuggestOracle.java b/user/src/com/google/gwt/user/client/ui/MultiWordSuggestOracle.java
index a4f91b3..645dc23 100644
--- a/user/src/com/google/gwt/user/client/ui/MultiWordSuggestOracle.java
+++ b/user/src/com/google/gwt/user/client/ui/MultiWordSuggestOracle.java
@@ -38,29 +38,29 @@
* <p>
* <table width = "100%" border = "1">
* <tr>
- * <td><b> All Suggestions </b> </td>
- * <td><b>Query string</b> </td>
+ * <td><b> All Suggestions </b></td>
+ * <td><b>Query string</b></td>
* <td><b>Matching Suggestions</b></td>
* </tr>
* <tr>
- * <td> John Smith, Joe Brown, Jane Doe, Jane Smith, Bob Jones</td>
- * <td> Jo</td>
- * <td> John Smith, Joe Brown, Bob Jones</td>
+ * <td>John Smith, Joe Brown, Jane Doe, Jane Smith, Bob Jones</td>
+ * <td>Jo</td>
+ * <td>John Smith, Joe Brown, Bob Jones</td>
* </tr>
* <tr>
- * <td> John Smith, Joe Brown, Jane Doe, Jane Smith, Bob Jones</td>
- * <td> Smith</td>
- * <td> John Smith, Jane Smith</td>
+ * <td>John Smith, Joe Brown, Jane Doe, Jane Smith, Bob Jones</td>
+ * <td>Smith</td>
+ * <td>John Smith, Jane Smith</td>
* </tr>
* <tr>
- * <td> Georgia, New York, California</td>
- * <td> g</td>
- * <td> Georgia</td>
+ * <td>Georgia, New York, California</td>
+ * <td>g</td>
+ * <td>Georgia</td>
* </tr>
* </table>
* </p>
*/
-public final class MultiWordSuggestOracle extends SuggestOracle {
+public class MultiWordSuggestOracle extends SuggestOracle {
/**
* Suggestion class for {@link MultiWordSuggestOracle}.
@@ -127,9 +127,11 @@
*/
private char[] whitespaceChars;
+ private Response defaultResponse;
+
/**
- * Constructor for <code>MultiWordSuggestOracle</code>. This uses a space
- * as the whitespace character.
+ * Constructor for <code>MultiWordSuggestOracle</code>. This uses a space as
+ * the whitespace character.
*
* @see #MultiWordSuggestOracle(String)
*/
@@ -138,8 +140,8 @@
}
/**
- * Constructor for <code>MultiWordSuggestOracle</code> which takes in a set
- * of whitespace chars that filter its input.
+ * Constructor for <code>MultiWordSuggestOracle</code> which takes in a set of
+ * whitespace chars that filter its input.
* <p>
* Example: If <code>".,"</code> is passed in as whitespace, then the string
* "foo.bar" would match the queries "foo", "bar", "foo.bar", "foo...bar", and
@@ -186,7 +188,7 @@
*
* @param collection the collection
*/
- public void addAll(Collection<String> collection) {
+ public final void addAll(Collection<String> collection) {
for (String suggestion : collection) {
add(suggestion);
}
@@ -207,6 +209,15 @@
}
@Override
+ public void requestDefaultSuggestions(Request request, Callback callback) {
+ if (defaultResponse != null) {
+ callback.onSuggestionsReady(request, defaultResponse);
+ } else {
+ super.requestDefaultSuggestions(request, callback);
+ }
+ }
+
+ @Override
public void requestSuggestions(Request request, Callback callback) {
final List<MultiWordSuggestion> suggestions = computeItemsFor(
request.getQuery(), request.getLimit());
@@ -214,6 +225,45 @@
callback.onSuggestionsReady(request, response);
}
+ /**
+ * Sets the default suggestion collection.
+ *
+ * @param suggestionList the default list of suggestions
+ */
+ public void setDefaultSuggestions(Collection<Suggestion> suggestionList) {
+ this.defaultResponse = new Response(suggestionList);
+ }
+
+ /**
+ * A convenience method to set default suggestions using plain text strings.
+ *
+ * Note to use this method each default suggestion must be plain text.
+ *
+ * @param suggestionList the default list of suggestions
+ */
+ public final void setDefaultSuggestionsFromText(
+ Collection<String> suggestionList) {
+ Collection<Suggestion> accum = new ArrayList<Suggestion>();
+ for (String candidate : suggestionList) {
+ accum.add(createSuggestion(candidate, candidate));
+ }
+ setDefaultSuggestions(accum);
+ }
+
+ /**
+ * Creates the suggestion based on the given replacement and display strings.
+ *
+ * @param replacementString the string to enter into the SuggestBox's text box
+ * if the suggestion is chosen
+ * @param displayString the display string
+ *
+ * @return the suggestion created
+ */
+ protected MultiWordSuggestion createSuggestion(String replacementString,
+ String displayString) {
+ return new MultiWordSuggestion(replacementString, displayString);
+ }
+
String escapeText(String escapeMe) {
convertMe.setText(escapeMe);
String escaped = convertMe.getHTML();
@@ -284,8 +334,8 @@
// Finish creating the formatted string.
String end = escapeText(formattedSuggestion.substring(cursor));
accum.append(end);
- MultiWordSuggestion suggestion = new MultiWordSuggestion(
- formattedSuggestion, accum.toString());
+ MultiWordSuggestion suggestion = createSuggestion(formattedSuggestion,
+ accum.toString());
suggestions.add(suggestion);
}
return suggestions;
diff --git a/user/src/com/google/gwt/user/client/ui/PopupListener.java b/user/src/com/google/gwt/user/client/ui/PopupListener.java
index 98cef26..0a38b23 100644
--- a/user/src/com/google/gwt/user/client/ui/PopupListener.java
+++ b/user/src/com/google/gwt/user/client/ui/PopupListener.java
@@ -20,8 +20,8 @@
/**
* Event listener interface for popup events.
*
- * @deprecated use
- * {@link com.google.gwt.event.logical.shared.CloseHandler} instead
+ * @deprecated use {@link com.google.gwt.event.logical.shared.CloseHandler}
+ * instead
*/
@Deprecated
public interface PopupListener extends EventListener {
@@ -30,8 +30,8 @@
* Fired when the popup is closed.
*
* @param sender popup being closed.
- * @param autoClosed <code>true</code> if the popup was automatically
- * closed; <code>false</code> if it was closed programmatically.
+ * @param autoClosed <code>true</code> if the popup was automatically closed;
+ * <code>false</code> if it was closed programmatically.
*/
@Deprecated
void onPopupClosed(PopupPanel sender, boolean autoClosed);
diff --git a/user/src/com/google/gwt/user/client/ui/PopupListenerCollection.java b/user/src/com/google/gwt/user/client/ui/PopupListenerCollection.java
index 0c18403..b1c21b4 100644
--- a/user/src/com/google/gwt/user/client/ui/PopupListenerCollection.java
+++ b/user/src/com/google/gwt/user/client/ui/PopupListenerCollection.java
@@ -21,8 +21,9 @@
* A helper class for implementers of the SourcesPopupEvents interface. This
* subclass of {@link ArrayList} assumes that all objects added to it will be of
* type {@link com.google.gwt.user.client.ui.PopupListener}.
- * @deprecated use <code>addHandler(myHandler, CloseEvent.getType())</code>
- * to manage handlers within your widget instead
+ *
+ * @deprecated use <code>addHandler(myHandler, CloseEvent.getType())</code> to
+ * manage handlers within your widget instead
*/
@Deprecated
public class PopupListenerCollection extends ArrayList<PopupListener> {
@@ -31,8 +32,8 @@
* Fires a popup closed event to all listeners.
*
* @param sender the widget sending the event.
- * @param autoClosed <code>true</code> if the popup was automatically
- * closed; <code>false</code> if it was closed programmatically.
+ * @param autoClosed <code>true</code> if the popup was automatically closed;
+ * <code>false</code> if it was closed programmatically.
*/
@Deprecated
public void firePopupClosed(PopupPanel sender, boolean autoClosed) {
diff --git a/user/src/com/google/gwt/user/client/ui/PopupPanel.java b/user/src/com/google/gwt/user/client/ui/PopupPanel.java
index 105b3be..707fc0b 100644
--- a/user/src/com/google/gwt/user/client/ui/PopupPanel.java
+++ b/user/src/com/google/gwt/user/client/ui/PopupPanel.java
@@ -34,6 +34,9 @@
import com.google.gwt.user.client.Event.NativePreviewHandler;
import com.google.gwt.user.client.ui.impl.PopupImpl;
+import java.util.ArrayList;
+import java.util.List;
+
/**
* A panel that can "pop up" over other widgets. It overlays the browser's
* client area (and any previously-created popups).
@@ -97,7 +100,7 @@
* </ul>
*/
static enum AnimationType {
- CENTER, ONE_WAY_CORNER
+ CENTER, ONE_WAY_CORNER, ROLL_DOWN
}
/**
@@ -141,7 +144,7 @@
// Determine if we need to animate
boolean animate = curPanel.isAnimationEnabled;
- if (curPanel.animType == AnimationType.ONE_WAY_CORNER && !showing) {
+ if (curPanel.animType != AnimationType.CENTER && !showing) {
animate = false;
}
@@ -207,17 +210,25 @@
int bottom = 0;
int height = (int) (progress * offsetHeight);
int width = (int) (progress * offsetWidth);
- if (curPanel.animType == AnimationType.CENTER) {
- top = (offsetHeight - height) >> 1;
- left = (offsetWidth - width) >> 1;
- } else if (curPanel.animType == AnimationType.ONE_WAY_CORNER) {
- if (LocaleInfo.getCurrentLocale().isRTL()) {
- left = offsetWidth - width;
- }
+ switch (curPanel.animType) {
+ case ROLL_DOWN:
+ right = offsetWidth;
+ bottom = height;
+ break;
+ case CENTER:
+ top = (offsetHeight - height) >> 1;
+ left = (offsetWidth - width) >> 1;
+ right = left + width;
+ bottom = top + height;
+ break;
+ case ONE_WAY_CORNER:
+ if (LocaleInfo.getCurrentLocale().isRTL()) {
+ left = offsetWidth - width;
+ }
+ right = left + width;
+ bottom = top + height;
+ break;
}
- right = left + width;
- bottom = top + height;
-
// Set the rect clipping
impl.setClip(curPanel.getElement(), getRectString(top, right, bottom,
left));
@@ -280,7 +291,7 @@
private boolean isAnimationEnabled = false;
- private Element autoHidePartner;
+ private List<Element> autoHidePartners;
/**
* The {@link ResizeAnimation} used to open and close the {@link PopupPanel}s.
@@ -334,6 +345,20 @@
this.modal = modal;
}
+ /**
+ * Mouse events that occur within an autoHide partner will not hide a panel
+ * set to autoHide.
+ *
+ * @param partner the auto hide partner to add
+ */
+ public void addAutoHidePartner(Element partner) {
+ assert partner != null : "partner cannot be null";
+ if (autoHidePartners == null) {
+ autoHidePartners = new ArrayList<Element>();
+ }
+ autoHidePartners.add(partner);
+ }
+
public HandlerRegistration addCloseHandler(CloseHandler<PopupPanel> handler) {
return addHandler(handler, CloseEvent.getType());
}
@@ -422,14 +447,16 @@
}
/**
- * Hides the popup. This has no effect if it is not currently visible.
+ * Hides the popup and detaches it from the page. This has no effect if it is
+ * not currently showing.
*/
public void hide() {
hide(false);
}
/**
- * Hides the popup. This has no effect if it is not currently visible.
+ * Hides the popup and detaches it from the page. This has no effect if it is
+ * not currently showing.
*
* @param autoClosed the value that will be passed to
* {@link CloseHandler#onClose(CloseEvent)} when the popup is closed
@@ -484,6 +511,31 @@
}
/**
+ * Determines whether or not this popup is showing.
+ *
+ * @return <code>true</code> if the popup is showing
+ * @see #show()
+ * @see #hide()
+ */
+ public boolean isShowing() {
+ return showing;
+ }
+
+ /**
+ * Determines whether or not this popup is visible. Note that this just checks
+ * the <code>visibility</code> style attribute, which is set in the
+ * {@link #setVisible(boolean)} method. If you want to know if the popup is
+ * attached to the page, use {@link #isShowing()} instead.
+ *
+ * @return <code>true</code> if the object is visible
+ * @see #setVisible(boolean)
+ */
+ @Override
+ public boolean isVisible() {
+ return !"hidden".equals(getElement().getStyle().getProperty("visibility"));
+ }
+
+ /**
* @deprecated use {@link #onPreviewNativeEvent(NativePreviewEvent)} instead
*/
@Deprecated
@@ -536,6 +588,18 @@
return true;
}
+ /**
+ * Remove an autoHide partner.
+ *
+ * @param partner the auto hide partner to remove
+ */
+ public void removeAutoHidePartner(Element partner) {
+ assert partner != null : "partner cannot be null";
+ if (autoHidePartners != null) {
+ autoHidePartners.remove(partner);
+ }
+ }
+
@Deprecated
public void removePopupListener(PopupListener listener) {
ListenerWrapper.Popup.remove(this, listener);
@@ -556,16 +620,6 @@
}
/**
- * If the auto hide partner is non null, its mouse events will not hide a
- * panel set to autohide.
- *
- * @param element new auto hide partner
- */
- public void setAutoHidePartner(Element element) {
- this.autoHidePartner = element;
- }
-
- /**
* Sets the height of the panel's child widget. If the panel's child widget
* has not been set, the height passed in will be cached and used to set the
* height immediately after the child widget is set.
@@ -670,10 +724,14 @@
}
/**
- * Sets whether this object is visible.
+ * Sets whether this object is visible. This method just sets the
+ * <code>visibility</code> style attribute. You need to call {@link #show()}
+ * to actually attached/detach the {@link PopupPanel} to the page.
*
* @param visible <code>true</code> to show the object, <code>false</code> to
* hide it
+ * @see #show()
+ * @see #hide()
*/
@Override
public void setVisible(boolean visible) {
@@ -720,7 +778,8 @@
}
/**
- * Shows the popup. It must have a child widget before this method is called.
+ * Shows the popup and attach it to the page. It must have a child widget
+ * before this method is called.
*/
public void show() {
if (showing) {
@@ -834,14 +893,23 @@
}-*/;
/**
- * Does the event target the partner element?
+ * Does the event target one of the partner elements?
*
* @param event the native event
- * @return true if the event targets the partner
+ * @return true if the event targets a partner
*/
private boolean eventTargetsPartner(Event event) {
- return autoHidePartner != null
- && autoHidePartner.isOrHasChild(event.getTarget());
+ if (autoHidePartners == null) {
+ return false;
+ }
+
+ Element target = event.getTarget();
+ for (Element elem : autoHidePartners) {
+ if (elem.isOrHasChild(target)) {
+ return true;
+ }
+ }
+ return false;
}
/**
@@ -855,7 +923,7 @@
}
/**
- * Get the element that {@link PopupImpl} uses. PopupImpl creates an element
+ * Get the element that {@link PopupImpl} uses. PopupImpl creates an element
* that goes inside of the outer element, so all methods in PopupImpl are
* relative to the first child of the outer element, not the outer element
* itself.
@@ -867,7 +935,8 @@
}
/**
- * Positions the popup, called after the offset width and height of the popup are known.
+ * Positions the popup, called after the offset width and height of the popup
+ * are known.
*
* @param relativeObject the ui object to position relative to
* @param offsetWidth the drop down's offset width
diff --git a/user/src/com/google/gwt/user/client/ui/ScrollListener.java b/user/src/com/google/gwt/user/client/ui/ScrollListener.java
index 6b50121..c8f3a4d 100644
--- a/user/src/com/google/gwt/user/client/ui/ScrollListener.java
+++ b/user/src/com/google/gwt/user/client/ui/ScrollListener.java
@@ -20,8 +20,7 @@
/**
* Event listener interface for scroll events.
*
- * @deprecated use {@link com.google.gwt.event.dom.client.ScrollHandler}
- * instead
+ * @deprecated use {@link com.google.gwt.event.dom.client.ScrollHandler} instead
*/
@Deprecated
public interface ScrollListener extends EventListener {
diff --git a/user/src/com/google/gwt/user/client/ui/SourcesChangeEvents.java b/user/src/com/google/gwt/user/client/ui/SourcesChangeEvents.java
index 268f3ad..1987220 100644
--- a/user/src/com/google/gwt/user/client/ui/SourcesChangeEvents.java
+++ b/user/src/com/google/gwt/user/client/ui/SourcesChangeEvents.java
@@ -19,8 +19,13 @@
* A widget that implements this interface sources the events defined by the
* {@link com.google.gwt.user.client.ui.ChangeListener} interface.
*
- * @deprecated use {@link com.google.gwt.event.dom.client.HasChangeHandlers}
- * instead
+ * @deprecated we have now separated dom and logical change events. Use
+ * {@link com.google.gwt.event.dom.client.HasChangeHandlers} if the
+ * change listener was triggered by a dom change event or
+ * {@link com.google.gwt.event.logical.shared.HasValueChangeHandlers}
+ * if it was based on a logical event
+ *
+ *
*/
@Deprecated
public interface SourcesChangeEvents {
@@ -29,7 +34,8 @@
* Adds a listener interface to receive change events.
*
* @param listener the listener interface to add
- * @deprecated use <code>addChangeHandler</code> instead
+ * @deprecated use <code>addChangeHandler</code> or
+ * <code>addValueChangeHandler</code> instead
*/
@Deprecated
void addChangeListener(ChangeListener listener);
diff --git a/user/src/com/google/gwt/user/client/ui/SourcesTabEvents.java b/user/src/com/google/gwt/user/client/ui/SourcesTabEvents.java
index 709d98e..d017a68 100644
--- a/user/src/com/google/gwt/user/client/ui/SourcesTabEvents.java
+++ b/user/src/com/google/gwt/user/client/ui/SourcesTabEvents.java
@@ -15,7 +15,6 @@
*/
package com.google.gwt.user.client.ui;
-
/**
* A widget that implements this interface sources the events defined by the
* {@link com.google.gwt.user.client.ui.TabListener} interface.
diff --git a/user/src/com/google/gwt/user/client/ui/SourcesTreeEvents.java b/user/src/com/google/gwt/user/client/ui/SourcesTreeEvents.java
index e47c443..2a986df 100644
--- a/user/src/com/google/gwt/user/client/ui/SourcesTreeEvents.java
+++ b/user/src/com/google/gwt/user/client/ui/SourcesTreeEvents.java
@@ -22,8 +22,7 @@
* @deprecated use
* {@link com.google.gwt.event.logical.shared.HasBeforeSelectionHandlers}
* , {@link com.google.gwt.event.logical.shared.HasOpenHandlers},
- * {@link com.google.gwt.event.dom.client.HasClickHandlers}
- * instead
+ * {@link com.google.gwt.event.dom.client.HasClickHandlers} instead
*/
@Deprecated
public interface SourcesTreeEvents {
diff --git a/user/src/com/google/gwt/user/client/ui/SuggestBox.java b/user/src/com/google/gwt/user/client/ui/SuggestBox.java
index eacf785..02bede2 100644
--- a/user/src/com/google/gwt/user/client/ui/SuggestBox.java
+++ b/user/src/com/google/gwt/user/client/ui/SuggestBox.java
@@ -15,13 +15,10 @@
*/
package com.google.gwt.user.client.ui;
-import static com.google.gwt.event.dom.client.KeyCodes.KEY_DOWN;
-import static com.google.gwt.event.dom.client.KeyCodes.KEY_ENTER;
-import static com.google.gwt.event.dom.client.KeyCodes.KEY_TAB;
-import static com.google.gwt.event.dom.client.KeyCodes.KEY_UP;
-
+import com.google.gwt.event.dom.client.ChangeEvent;
import com.google.gwt.event.dom.client.HandlesAllKeyEvents;
import com.google.gwt.event.dom.client.HasAllKeyHandlers;
+import com.google.gwt.event.dom.client.KeyCodes;
import com.google.gwt.event.dom.client.KeyDownEvent;
import com.google.gwt.event.dom.client.KeyDownHandler;
import com.google.gwt.event.dom.client.KeyPressEvent;
@@ -34,10 +31,8 @@
import com.google.gwt.event.logical.shared.ValueChangeEvent;
import com.google.gwt.event.logical.shared.ValueChangeHandler;
import com.google.gwt.event.shared.HandlerRegistration;
-import com.google.gwt.i18n.client.LocaleInfo;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.DOM;
-import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.PopupPanel.AnimationType;
import com.google.gwt.user.client.ui.SuggestOracle.Callback;
import com.google.gwt.user.client.ui.SuggestOracle.Request;
@@ -46,6 +41,7 @@
import java.util.Collection;
import java.util.List;
+
/**
* A {@link SuggestBox} is a text box or text area which displays a
* pre-configured set of selections that match the user's input.
@@ -91,31 +87,53 @@
* <img class='gallery' src='SuggestBox.png'/>
* </p>
*
- * <h3>CSS Style Rules</h3>
- * <ul class='css'>
- * <li>.gwt-SuggestBox { the suggest
- * box itself }</li>
- * <li>.gwt-SuggestBoxPopup { the suggestion popup }</li>
- * <li>.gwt-SuggestBoxPopup .item { an unselected suggestion }</li>
- * <li>.gwt-SuggestBoxPopup .item-selected { a selected suggestion }</li>
- * <li>.gwt-SuggestBoxPopup .suggestPopupTopLeft { the top left cell }</li>
- * <li>.gwt-SuggestBoxPopup .suggestPopupTopLeftInner { the inner element of the cell }</li>
- * <li>.gwt-SuggestBoxPopup .suggestPopupTopCenter { the top center cell }</li>
- * <li>.gwt-SuggestBoxPopup .suggestPopupTopCenterInner { the inner element of the cell }</li>
- * <li>.gwt-SuggestBoxPopup .suggestPopupTopRight { the top right cell }</li>
- * <li>.gwt-SuggestBoxPopup .suggestPopupTopRightInner { the inner element of the cell }</li>
- * <li>.gwt-SuggestBoxPopup .suggestPopupMiddleLeft { the middle left cell }</li>
- * <li>.gwt-SuggestBoxPopup .suggestPopupMiddleLeftInner { the inner element of the cell }</li>
- * <li>.gwt-SuggestBoxPopup .suggestPopupMiddleCenter { the middle center cell }</li>
- * <li>.gwt-SuggestBoxPopup .suggestPopupMiddleCenterInner { the inner element of the cell }</li>
- * <li>.gwt-SuggestBoxPopup .suggestPopupMiddleRight { the middle right cell }</li>
- * <li>.gwt-SuggestBoxPopup .suggestPopupMiddleRightInner { the inner element of the cell }</li>
- * <li>.gwt-SuggestBoxPopup .suggestPopupBottomLeft { the bottom left cell }</li>
- * <li>.gwt-SuggestBoxPopup .suggestPopupBottomLeftInner { the inner element of the cell }</li>
- * <li>.gwt-SuggestBoxPopup .suggestPopupBottomCenter { the bottom center cell }</li>
- * <li>.gwt-SuggestBoxPopup .suggestPopupBottomCenterInner { the inner element of the cell }</li>
- * <li>.gwt-SuggestBoxPopup .suggestPopupBottomRight { the bottom right cell }</li>
- * <li>.gwt-SuggestBoxPopup .suggestPopupBottomRightInner { the inner element of the cell }</li> </ul>
+ * <h3>CSS Style Rules</h3>
+ * <dl>
+ * <dt>.gwt-SuggestBox</dt>
+ * <dd>the suggest box itself</dd>
+ * <dt>.gwt-SuggestBoxPopup</dt>
+ * <dd>the suggestion popup</dd>
+ * <dt>.gwt-SuggestBoxPopup .item</dt>
+ * <dd>an unselected suggestion</dd>
+ * <dt>.gwt-SuggestBoxPopup .item-selected</dt>
+ * <dd>a selected suggestion</dd>
+ * <dt>.gwt-SuggestBoxPopup .suggestPopupTopLeft</dt>
+ * <dd>the top left cell</dd>
+ * <dt>.gwt-SuggestBoxPopup .suggestPopupTopLeftInner</dt>
+ * <dd>the inner element of the cell</dd>
+ * <dt>.gwt-SuggestBoxPopup .suggestPopupTopCenter</dt>
+ * <dd>the top center cell</dd>
+ * <dt>.gwt-SuggestBoxPopup .suggestPopupTopCenterInner</dt>
+ * <dd>the inner element of the cell</dd>
+ * <dt>.gwt-SuggestBoxPopup .suggestPopupTopRight</dt>
+ * <dd>the top right cell</dd>
+ * <dt>.gwt-SuggestBoxPopup .suggestPopupTopRightInner</dt>
+ * <dd>the inner element of the cell</dd>
+ * <dt>.gwt-SuggestBoxPopup .suggestPopupMiddleLeft</dt>
+ * <dd>the middle left cell</dd>
+ * <dt>.gwt-SuggestBoxPopup .suggestPopupMiddleLeftInner</dt>
+ * <dd>the inner element of the cell</dd>
+ * <dt>.gwt-SuggestBoxPopup .suggestPopupMiddleCenter</dt>
+ * <dd>the middle center cell</dd>
+ * <dt>.gwt-SuggestBoxPopup .suggestPopupMiddleCenterInner</dt>
+ * <dd>the inner element of the cell</dd>
+ * <dt>.gwt-SuggestBoxPopup .suggestPopupMiddleRight</dt>
+ * <dd>the middle right cell</dd>
+ * <dt>.gwt-SuggestBoxPopup .suggestPopupMiddleRightInner</dt>
+ * <dd>the inner element of the cell</dd>
+ * <dt>.gwt-SuggestBoxPopup .suggestPopupBottomLeft</dt>
+ * <dd>the bottom left cell</dd>
+ * <dt>.gwt-SuggestBoxPopup .suggestPopupBottomLeftInner</dt>
+ * <dd>the inner element of the cell</dd>
+ * <dt>.gwt-SuggestBoxPopup .suggestPopupBottomCenter</dt>
+ * <dd>the bottom center cell</dd>
+ * <dt>.gwt-SuggestBoxPopup .suggestPopupBottomCenterInner</dt>
+ * <dd>the inner element of the cell</dd>
+ * <dt>.gwt-SuggestBoxPopup .suggestPopupBottomRight</dt>
+ * <dd>the bottom right cell</dd>
+ * <dt>.gwt-SuggestBoxPopup .suggestPopupBottomRightInner</dt>
+ * <dd>the inner element of the cell</dd>
+ * </dl>
*
* @see SuggestOracle
* @see MultiWordSuggestOracle
@@ -222,179 +240,16 @@
}
}
- /**
- * A PopupPanel with a SuggestionMenu as its widget. The SuggestionMenu is
- * placed in a PopupPanel so that it can be displayed at various positions
- * around the SuggestBox's text field. Moreover, the SuggestionMenu needs to
- * appear on top of any other widgets on the page, and the PopupPanel provides
- * this behavior.
- *
- * A non-static member class is used because the popup uses the SuggestBox's
- * SuggestionMenu as its widget, and the position of the SuggestBox's TextBox
- * is needed in order to correctly position the popup.
- */
- private class SuggestionPopup extends DecoratedPopupPanel {
- private static final String STYLENAME_DEFAULT = "gwt-SuggestBoxPopup";
-
- public SuggestionPopup() {
- super(true, false, "suggestPopup");
- setWidget(suggestionMenu);
- setStyleName(STYLENAME_DEFAULT);
- setPreviewingAllNativeEvents(true);
- }
-
- /**
- * The default position of the SuggestPopup is directly below the
- * SuggestBox's text box, with its left edge aligned with the left edge of
- * the text box. Depending on the width and height of the popup and the
- * distance from the text box to the bottom and right edges of the window,
- * the popup may be displayed directly above the text box, and/or its right
- * edge may be aligned with the right edge of the text box.
- */
- public void showAlignedPopup() {
-
- // Set the position of the popup right before it is shown.
- setPopupPositionAndShow(new PositionCallback() {
- public void setPosition(int offsetWidth, int offsetHeight) {
-
- // Calculate left position for the popup. The computation for
- // the left position is bidi-sensitive.
-
- int textBoxOffsetWidth = box.getOffsetWidth();
-
- // Compute the difference between the popup's width and the
- // textbox's width
- int offsetWidthDiff = offsetWidth - textBoxOffsetWidth;
-
- int left;
-
- if (LocaleInfo.getCurrentLocale().isRTL()) { // RTL case
-
- int textBoxAbsoluteLeft = box.getAbsoluteLeft();
-
- // Right-align the popup. Note that this computation is
- // valid in the case where offsetWidthDiff is negative.
- left = textBoxAbsoluteLeft - offsetWidthDiff;
-
- // If the suggestion popup is not as wide as the text box, always
- // align to the right edge of the text box. Otherwise, figure out
- // whether to right-align or left-align the popup.
- if (offsetWidthDiff > 0) {
-
- // Make sure scrolling is taken into account, since
- // box.getAbsoluteLeft() takes scrolling into account.
- int windowRight = Window.getClientWidth()
- + Window.getScrollLeft();
- int windowLeft = Window.getScrollLeft();
-
- // Compute the left value for the right edge of the textbox
- int textBoxLeftValForRightEdge = textBoxAbsoluteLeft
- + textBoxOffsetWidth;
-
- // Distance from the right edge of the text box to the right edge
- // of the window
- int distanceToWindowRight = windowRight
- - textBoxLeftValForRightEdge;
-
- // Distance from the right edge of the text box to the left edge
- // of the window
- int distanceFromWindowLeft = textBoxLeftValForRightEdge
- - windowLeft;
-
- // If there is not enough space for the overflow of the popup's
- // width to the right of the text box and there IS enough space
- // for the overflow to the right of the text box, then left-align
- // the popup. However, if there is not enough space on either
- // side, stick with right-alignment.
- if (distanceFromWindowLeft < offsetWidth
- && distanceToWindowRight >= offsetWidthDiff) {
- // Align with the left edge of the text box.
- left = textBoxAbsoluteLeft;
- }
- }
- } else { // LTR case
-
- // Left-align the popup.
- left = box.getAbsoluteLeft();
-
- // If the suggestion popup is not as wide as the text box, always
- // align to the left edge of the text box. Otherwise, figure out
- // whether to left-align or right-align the popup.
- if (offsetWidthDiff > 0) {
- // Make sure scrolling is taken into account, since
- // box.getAbsoluteLeft() takes scrolling into account.
- int windowRight = Window.getClientWidth()
- + Window.getScrollLeft();
- int windowLeft = Window.getScrollLeft();
-
- // Distance from the left edge of the text box to the right edge
- // of the window
- int distanceToWindowRight = windowRight - left;
-
- // Distance from the left edge of the text box to the left edge of
- // the window
- int distanceFromWindowLeft = left - windowLeft;
-
- // If there is not enough space for the overflow of the popup's
- // width to the right of hte text box, and there IS enough space
- // for the overflow to the left of the text box, then right-align
- // the popup. However, if there is not enough space on either
- // side, then stick with left-alignment.
- if (distanceToWindowRight < offsetWidth
- && distanceFromWindowLeft >= offsetWidthDiff) {
- // Align with the right edge of the text box.
- left -= offsetWidthDiff;
- }
- }
- }
-
- // Calculate top position for the popup
-
- int top = box.getAbsoluteTop();
-
- // Make sure scrolling is taken into account, since
- // box.getAbsoluteTop() takes scrolling into account.
- int windowTop = Window.getScrollTop();
- int windowBottom = Window.getScrollTop() + Window.getClientHeight();
-
- // Distance from the top edge of the window to the top edge of the
- // text box
- int distanceFromWindowTop = top - windowTop;
-
- // Distance from the bottom edge of the window to the bottom edge of
- // the text box
- int distanceToWindowBottom = windowBottom
- - (top + box.getOffsetHeight());
-
- // If there is not enough space for the popup's height below the text
- // box and there IS enough space for the popup's height above the text
- // box, then then position the popup above the text box. However, if
- // there is not enough space on either side, then stick with
- // displaying the popup below the text box.
- if (distanceToWindowBottom < offsetHeight
- && distanceFromWindowTop >= offsetHeight) {
- top -= offsetHeight;
- } else {
- // Position above the text box
- top += box.getOffsetHeight();
- }
-
- setPopupPosition(left, top);
- }
- });
- }
- }
-
private static final String STYLENAME_DEFAULT = "gwt-SuggestBox";
private int limit = 20;
- private boolean selectsFirstItem = false;
+ private boolean selectsFirstItem = true;
private SuggestOracle oracle;
private String currentText;
private final SuggestionMenu suggestionMenu;
- private final SuggestionPopup suggestionPopup;
+ private final PopupPanel suggestionPopup;
private final TextBoxBase box;
- private final Callback callBack = new Callback() {
+ private final Callback callback = new Callback() {
public void onSuggestionsReady(Request request, Response response) {
showSuggestions(response.getSuggestions());
}
@@ -434,8 +289,8 @@
// suggestionMenu must be created before suggestionPopup, because
// suggestionMenu is suggestionPopup's widget
suggestionMenu = new SuggestionMenu(true);
- suggestionPopup = new SuggestionPopup();
- suggestionPopup.setAnimationType(AnimationType.ONE_WAY_CORNER);
+ suggestionPopup = createPopup();
+ suggestionPopup.setAnimationType(AnimationType.ROLL_DOWN);
addEventsToTextBox();
@@ -455,7 +310,7 @@
public void addChangeListener(final ChangeListener listener) {
ListenerWrapper.Change legacy = new ListenerWrapper.Change(listener);
legacy.setSource(this);
- box.addChangeHandler(legacy);
+ box.addDomHandler(legacy, ChangeEvent.getType());
}
/**
@@ -533,9 +388,9 @@
}
/**
- * Returns whether or not the first suggestion will be automatically
- * selected. This behavior is off by default.
- *
+ * Returns whether or not the first suggestion will be automatically selected.
+ * This behavior is off by default.
+ *
* @return true if the first suggestion will be automatically selected
*/
public boolean getSelectsFirstItem() {
@@ -572,10 +427,24 @@
return box.getValue();
}
+ /**
+ * Hide current suggestions.
+ */
+ public void hideSuggestionList() {
+ this.suggestionPopup.hide();
+ }
+
public boolean isAnimationEnabled() {
return suggestionPopup.isAnimationEnabled();
}
+ /**
+ * @return true if the list of suggestions is currently showing, false if not
+ */
+ public boolean isSuggestionListShowing() {
+ return suggestionPopup.isShowing();
+ }
+
@Deprecated
public void removeChangeListener(ChangeListener listener) {
ListenerWrapper.Change.remove(box, listener);
@@ -636,7 +505,7 @@
/**
* Turns on or off the behavior that automatically selects the first suggested
* item. It defaults to off.
- *
+ *
* @param selectsFirstItem Whether or not to automatically select the first
* suggested
*/
@@ -661,6 +530,16 @@
}
/**
+ * Show the current list of suggestions.
+ */
+ public void showSuggestionList() {
+ if (isAttached()) {
+ currentText = null;
+ refreshSuggestions();
+ }
+ }
+
+ /**
* <b>Affected Elements:</b>
* <ul>
* <li>-popup = The popup that appears with suggestions.</li>
@@ -676,6 +555,41 @@
suggestionMenu.setMenuItemDebugIds(baseID);
}
+ /**
+ * Gets the specified suggestion from the suggestions currently showing.
+ *
+ * @param index the index at which the suggestion lives
+ *
+ * @throws IndexOutOfBoundsException if the index is greater then the number
+ * of suggestions currently showing
+ *
+ * @return the given suggestion
+ */
+ Suggestion getSuggestion(int index) {
+ if (!isSuggestionListShowing()) {
+ throw new IndexOutOfBoundsException(
+ "No suggestions showing, so cannot show " + index);
+ }
+ return ((SuggestionMenuItem) suggestionMenu.getItems().get(index)).suggestion;
+ }
+
+ /**
+ * Get the number of suggestions that are currently showing.
+ *
+ * @return the number of suggestions currently showing, 0 if there are none
+ */
+ int getSuggestionCount() {
+ return isSuggestionListShowing() ? suggestionMenu.getNumItems() : 0;
+ }
+
+ void showSuggestions(String query) {
+ if (query.length() == 0) {
+ oracle.requestDefaultSuggestions(new Request(null, limit), callback);
+ } else {
+ oracle.requestSuggestions(new Request(query, limit), callback);
+ }
+ }
+
private void addEventsToTextBox() {
class TextBoxEvents extends HandlesAllKeyEvents implements
ValueChangeHandler<String> {
@@ -685,14 +599,14 @@
// are only relevant when choosing a suggestion.
if (suggestionPopup.isAttached()) {
switch (event.getNativeKeyCode()) {
- case KEY_DOWN:
+ case KeyCodes.KEY_DOWN:
suggestionMenu.selectItem(suggestionMenu.getSelectedItemIndex() + 1);
break;
- case KEY_UP:
+ case KeyCodes.KEY_UP:
suggestionMenu.selectItem(suggestionMenu.getSelectedItemIndex() - 1);
break;
- case KEY_ENTER:
- case KEY_TAB:
+ case KeyCodes.KEY_ENTER:
+ case KeyCodes.KEY_TAB:
if (suggestionMenu.getSelectedItemIndex() < 0) {
suggestionPopup.hide();
} else {
@@ -701,40 +615,21 @@
break;
}
}
- fireEvent(event);
+ delegateEvent(SuggestBox.this, event);
}
public void onKeyPress(KeyPressEvent event) {
- fireEvent(event);
+ delegateEvent(SuggestBox.this, event);
}
public void onKeyUp(KeyUpEvent event) {
// After every user key input, refresh the popup's suggestions.
refreshSuggestions();
- fireEvent(event);
+ delegateEvent(SuggestBox.this, event);
}
public void onValueChange(ValueChangeEvent<String> event) {
- fireEvent(event);
- }
-
- private void refreshSuggestions() {
- // Get the raw text.
- String text = box.getText();
- if (text.equals(currentText)) {
- return;
- } else {
- currentText = text;
- }
-
- if (text.length() == 0) {
- // Optimization to avoid calling showSuggestions with an empty
- // string
- suggestionPopup.hide();
- suggestionMenu.clearItems();
- } else {
- showSuggestions(text);
- }
+ delegateEvent(SuggestBox.this, event);
}
}
@@ -743,10 +638,30 @@
box.addValueChangeHandler(events);
}
+ private PopupPanel createPopup() {
+ PopupPanel p = new DecoratedPopupPanel(true, false, "suggestPopup");
+ p.setWidget(suggestionMenu);
+ p.setStyleName("gwt-SuggestBoxPopup");
+ p.setPreviewingAllNativeEvents(true);
+ p.addAutoHidePartner(getTextBox().getElement());
+ return p;
+ }
+
private void fireSuggestionEvent(Suggestion selectedSuggestion) {
SelectionEvent.fire(this, selectedSuggestion);
}
+ private void refreshSuggestions() {
+ // Get the raw text.
+ String text = box.getText();
+ if (text.equals(currentText)) {
+ return;
+ } else {
+ currentText = text;
+ }
+ showSuggestions(text);
+ }
+
private void setNewSelection(SuggestionMenuItem menuItem) {
Suggestion curSuggestion = menuItem.getSuggestion();
currentText = curSuggestion.getReplacementString();
@@ -777,7 +692,6 @@
// and added to the menu.
boolean isAnimationEnabled = suggestionPopup.isAnimationEnabled();
if (suggestionPopup.isAttached()) {
- suggestionPopup.setAnimationEnabled(false);
suggestionPopup.hide();
}
@@ -800,14 +714,10 @@
suggestionMenu.selectItem(0);
}
- suggestionPopup.showAlignedPopup();
+ suggestionPopup.showRelativeTo(getTextBox());
suggestionPopup.setAnimationEnabled(isAnimationEnabled);
} else {
suggestionPopup.hide();
}
}
-
- private void showSuggestions(String query) {
- oracle.requestSuggestions(new Request(query, limit), callBack);
- }
}
diff --git a/user/src/com/google/gwt/user/client/ui/SuggestOracle.java b/user/src/com/google/gwt/user/client/ui/SuggestOracle.java
index 6a90447..5218ff3 100644
--- a/user/src/com/google/gwt/user/client/ui/SuggestOracle.java
+++ b/user/src/com/google/gwt/user/client/ui/SuggestOracle.java
@@ -17,6 +17,7 @@
import com.google.gwt.user.client.rpc.IsSerializable;
+import java.util.ArrayList;
import java.util.Collection;
/**
@@ -26,39 +27,12 @@
*
* @see SuggestBox
*/
-public abstract class SuggestOracle {
-
- /**
- * Constructor for {@link com.google.gwt.user.client.ui.SuggestOracle}.
- */
- public SuggestOracle() {
- }
-
- /**
- * Should {@link Suggestion} display strings be treated as HTML? If true, this
- * all suggestions' display strings will be interpreted as HTML, otherwise as
- * text.
- *
- * @return by default, returns false
- */
- public boolean isDisplayStringHTML() {
- return false;
- }
-
- /**
- * Generate a {@link Response} based on a specific {@link Request}. After the
- * {@link Response} is created, it is passed into
- * {@link Callback#onSuggestionsReady(com.google.gwt.user.client.ui.SuggestOracle.Request, com.google.gwt.user.client.ui.SuggestOracle.Response)}.
- *
- * @param request the request
- * @param callback the callback to use for the response
- */
- public abstract void requestSuggestions(Request request, Callback callback);
-
+public abstract class SuggestOracle {
+ private Response emptyResponse = new Response(new ArrayList<Suggestion>());
/**
* Callback for {@link com.google.gwt.user.client.ui.SuggestOracle}. Every
* {@link Request} should be associated with a callback that should be called
- * after a {@link Response} is generated.
+ * after a {@link Response} is generated.
*/
public interface Callback {
/**
@@ -257,4 +231,49 @@
*/
String getReplacementString();
}
+
+ /**
+ * Constructor for {@link com.google.gwt.user.client.ui.SuggestOracle}.
+ */
+ public SuggestOracle() {
+ }
+
+ /**
+ * Should {@link Suggestion} display strings be treated as HTML? If true, this
+ * all suggestions' display strings will be interpreted as HTML, otherwise as
+ * text.
+ *
+ * @return by default, returns false
+ */
+ public boolean isDisplayStringHTML() {
+ return false;
+ }
+
+ /**
+ * Generate a {@link Response} based on a default request. The request query
+ * must be null as it represents the results the oracle should return based on
+ * no query string.
+ * <p>
+ * After the {@link Response} is created, it is passed into
+ * {@link Callback#onSuggestionsReady(com.google.gwt.user.client.ui.SuggestOracle.Request, com.google.gwt.user.client.ui.SuggestOracle.Response)}
+ * .
+ * </p>
+ *
+ * @param request the request
+ * @param callback the callback to use for the response
+ */
+ public void requestDefaultSuggestions(Request request, Callback callback) {
+ assert (request.query == null);
+ callback.onSuggestionsReady(request, emptyResponse);
+ }
+
+ /**
+ * Generate a {@link Response} based on a specific {@link Request}. After the
+ * {@link Response} is created, it is passed into
+ * {@link Callback#onSuggestionsReady(com.google.gwt.user.client.ui.SuggestOracle.Request, com.google.gwt.user.client.ui.SuggestOracle.Response)}.
+ *
+ * @param request the request
+ * @param callback the callback to use for the response
+ */
+ public abstract void requestSuggestions(Request request, Callback callback);
}
diff --git a/user/src/com/google/gwt/user/client/ui/SuggestionEvent.java b/user/src/com/google/gwt/user/client/ui/SuggestionEvent.java
index 3ae2bc0..813666b 100644
--- a/user/src/com/google/gwt/user/client/ui/SuggestionEvent.java
+++ b/user/src/com/google/gwt/user/client/ui/SuggestionEvent.java
@@ -1,12 +1,12 @@
/*
* Copyright 2007 Google Inc.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -20,7 +20,7 @@
/**
* Event object containing information about the selection of a
* {@link SuggestOracle.Suggestion} displayed by a {@link SuggestBox}.
- *
+ *
* @see SuggestBox#addEventHandler(SuggestionHandler)
*/
public class SuggestionEvent extends EventObject {
@@ -28,7 +28,7 @@
private SuggestOracle.Suggestion selectedSuggestion;
public SuggestionEvent(SuggestBox sender,
- SuggestOracle.Suggestion selectedSuggestion) {
+ SuggestOracle.Suggestion selectedSuggestion) {
super(sender);
this.selectedSuggestion = selectedSuggestion;
}
@@ -36,7 +36,7 @@
/**
* Gets the <code>Suggestion</code> object for the suggestion chosen by the
* user.
- *
+ *
* @return the <code>Suggestion</code> object for the selected suggestion
*/
public SuggestOracle.Suggestion getSelectedSuggestion() {
@@ -48,13 +48,13 @@
* the string representation of the SuggestBox from which the event originated
* (the source), and the string representation of the Suggestion that was
* selected.
- *
+ *
* @return the string representation of this event object containing the
* source SuggestBox and the selected Suggestion
*/
@Override
public String toString() {
- return "[source=" + getSource() +
- ", selectedSuggestion=" + getSelectedSuggestion() + "]";
+ return "[source=" + getSource() + ", selectedSuggestion="
+ + getSelectedSuggestion() + "]";
}
}
diff --git a/user/src/com/google/gwt/user/client/ui/SuggestionHandler.java b/user/src/com/google/gwt/user/client/ui/SuggestionHandler.java
index 112e069..e11900b 100644
--- a/user/src/com/google/gwt/user/client/ui/SuggestionHandler.java
+++ b/user/src/com/google/gwt/user/client/ui/SuggestionHandler.java
@@ -1,12 +1,12 @@
/*
* Copyright 2008 Google Inc.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -19,19 +19,25 @@
/**
* Event handler interface for {@link SuggestionEvent}.
- *
+ *
* @see SuggestBox
+ *
+ * @deprecated use {@link com.google.gwt.event.logical.shared.SelectionHandler}
+ * instead
*/
@Deprecated
public interface SuggestionHandler extends EventListener {
/**
- * Fired when a suggestion is selected. Users can select a suggestion from
- * the SuggestBox by clicking on one of the suggestions, or by pressing
- * the ENTER key to select the suggestion that is currently highlighted.
- *
- * @param event the object containing information about this event
+ * Fired when a suggestion is selected. Users can select a suggestion from the
+ * SuggestBox by clicking on one of the suggestions, or by pressing the ENTER
+ * key to select the suggestion that is currently highlighted.
+ *
+ * @param event the object containing information about this event deprecated
+ * use
+ * {@link com.google.gwt.event.logical.shared.SelectionHandler#onSelection(com.google.gwt.event.logical.shared.SelectionEvent)}
+ * instead
*/
- @Deprecated
+
void onSuggestionSelected(SuggestionEvent event);
}
diff --git a/user/src/com/google/gwt/user/client/ui/TabListener.java b/user/src/com/google/gwt/user/client/ui/TabListener.java
index 478fac3..a6ebad7 100644
--- a/user/src/com/google/gwt/user/client/ui/TabListener.java
+++ b/user/src/com/google/gwt/user/client/ui/TabListener.java
@@ -21,6 +21,12 @@
* Event listener interface for tab events, used primarily by
* {@link com.google.gwt.user.client.ui.TabBar} and
* {@link com.google.gwt.user.client.ui.TabPanel}.
+ *
+ * @deprecated use
+ * {@link TabPanel#addBeforeSelectionHandler(com.google.gwt.event.logical.shared.BeforeSelectionHandler)}
+ * and/or
+ * {@link TabPanel#addSelectionHandler(com.google.gwt.event.logical.shared.SelectionHandler)}
+ * instead
*/
@Deprecated
public interface TabListener extends EventListener {
@@ -33,6 +39,9 @@
* @param tabIndex the index of the tab about to be selected
* @return <code>false</code> to disallow the selection. If any listener
* returns false, then the selection will be disallowed.
+ * @deprecated use
+ * {@link TabPanel#addBeforeSelectionHandler(com.google.gwt.event.logical.shared.BeforeSelectionHandler)}
+ * instead
*/
@Deprecated
boolean onBeforeTabSelected(SourcesTabEvents sender, int tabIndex);
@@ -42,6 +51,9 @@
*
* @param sender the {@link TabBar} or {@link TabPanel} whose tab was selected
* @param tabIndex the index of the tab that was selected
+ * @deprecated use
+ * {@link TabPanel#addSelectionHandler(com.google.gwt.event.logical.shared.SelectionHandler)}
+ * instead
*/
@Deprecated
void onTabSelected(SourcesTabEvents sender, int tabIndex);
diff --git a/user/src/com/google/gwt/user/client/ui/TabListenerCollection.java b/user/src/com/google/gwt/user/client/ui/TabListenerCollection.java
index 4693454..968fed3 100644
--- a/user/src/com/google/gwt/user/client/ui/TabListenerCollection.java
+++ b/user/src/com/google/gwt/user/client/ui/TabListenerCollection.java
@@ -35,7 +35,6 @@
* @param sender the widget sending the event
* @param tabIndex the index of the tab being selected
*/
- @Deprecated
public boolean fireBeforeTabSelected(SourcesTabEvents sender, int tabIndex) {
for (TabListener listener : this) {
if (!listener.onBeforeTabSelected(sender, tabIndex)) {
@@ -51,7 +50,6 @@
* @param sender the widget sending the event
* @param tabIndex the index of the tab being selected
*/
- @Deprecated
public void fireTabSelected(SourcesTabEvents sender, int tabIndex) {
for (TabListener listener : this) {
listener.onTabSelected(sender, tabIndex);
diff --git a/user/src/com/google/gwt/user/client/ui/TabPanel.java b/user/src/com/google/gwt/user/client/ui/TabPanel.java
index 2203703..2a3bf67 100644
--- a/user/src/com/google/gwt/user/client/ui/TabPanel.java
+++ b/user/src/com/google/gwt/user/client/ui/TabPanel.java
@@ -354,22 +354,12 @@
return deck.iterator();
}
- public void onBeforeSelection(BeforeSelectionEvent<Integer> event) {
- if (!onBeforeTabSelected(tabBar, event.getItem().intValue())) {
- event.cancel();
- }
- }
-
@Deprecated
public boolean onBeforeTabSelected(SourcesTabEvents sender, int tabIndex) {
BeforeSelectionEvent<Integer> event = BeforeSelectionEvent.fire(this, tabIndex);
return event == null || !event.isCanceled();
}
- public void onSelection(SelectionEvent<Integer> event) {
- onTabSelected(tabBar, event.getSelectedItem().intValue());
- }
-
@Deprecated
public void onTabSelected(SourcesTabEvents sender, int tabIndex) {
deck.showWidget(tabIndex);
diff --git a/user/src/com/google/gwt/user/client/ui/TableListener.java b/user/src/com/google/gwt/user/client/ui/TableListener.java
index eab2ec9..c714321 100644
--- a/user/src/com/google/gwt/user/client/ui/TableListener.java
+++ b/user/src/com/google/gwt/user/client/ui/TableListener.java
@@ -19,6 +19,10 @@
/**
* Event listener interface for table events.
+ *
+ * @deprecated use {@link com.google.gwt.event.dom.client.ClickHandler} and
+ * {@link HTMLTable#getCellForEvent(com.google.gwt.event.dom.client.ClickEvent)}
+ * instead
*/
@Deprecated
public interface TableListener extends EventListener {
@@ -29,6 +33,10 @@
* @param sender the widget sending the event
* @param row the row of the cell being clicked
* @param cell the index of the cell being clicked
+ *
+ * @deprecated use {@link com.google.gwt.event.dom.client.ClickHandler} and
+ * {@link HTMLTable#getCellForEvent(com.google.gwt.event.dom.client.ClickEvent)}
+ * instead
*/
@Deprecated
void onCellClicked(SourcesTableEvents sender, int row, int cell);
diff --git a/user/src/com/google/gwt/user/client/ui/TextBoxBase.java b/user/src/com/google/gwt/user/client/ui/TextBoxBase.java
index 62a6d9a..ca4d3ae 100644
--- a/user/src/com/google/gwt/user/client/ui/TextBoxBase.java
+++ b/user/src/com/google/gwt/user/client/ui/TextBoxBase.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2007 Google Inc.
+ * Copyright 2009 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
@@ -19,7 +19,6 @@
import com.google.gwt.dom.client.Element;
import com.google.gwt.event.dom.client.ChangeEvent;
import com.google.gwt.event.dom.client.ChangeHandler;
-import com.google.gwt.event.dom.client.HasChangeHandlers;
import com.google.gwt.event.logical.shared.ValueChangeEvent;
import com.google.gwt.event.logical.shared.ValueChangeHandler;
import com.google.gwt.event.shared.HandlerRegistration;
@@ -32,7 +31,7 @@
*/
@SuppressWarnings("deprecation")
public class TextBoxBase extends FocusWidget implements SourcesChangeEvents,
- HasChangeHandlers, HasText, HasName, HasValue<String> {
+ HasText, HasName, HasValue<String> {
/**
* Text alignment constant, used in
@@ -77,6 +76,7 @@
private static TextBoxImpl impl = GWT.create(TextBoxImpl.class);
private Event currentEvent;
+ private boolean valueChangeHandlerInitialized;
/**
* Creates a text box that wraps the given browser element handle. This is
@@ -88,24 +88,21 @@
super(elem);
}
- public HandlerRegistration addChangeHandler(ChangeHandler handler) {
- return addDomHandler(handler, ChangeEvent.getType());
- }
-
@Deprecated
public void addChangeListener(ChangeListener listener) {
- addChangeHandler(new ListenerWrapper.Change(listener));
+ addDomHandler(new ListenerWrapper.Change(listener), ChangeEvent.getType());
}
public HandlerRegistration addValueChangeHandler(
ValueChangeHandler<String> handler) {
// Initialization code
- if (!isEventHandled(ValueChangeEvent.getType())) {
- addChangeHandler(new ChangeHandler() {
+ if (!valueChangeHandlerInitialized) {
+ valueChangeHandlerInitialized = true;
+ addDomHandler(new ChangeHandler() {
public void onChange(ChangeEvent event) {
- setValue(getText());
+ ValueChangeEvent.fire(TextBoxBase.this, getText());
}
- });
+ }, ChangeEvent.getType());
}
return addHandler(handler, ValueChangeEvent.getType());
}
@@ -229,7 +226,10 @@
* listeners to easily filter keyboard input.
*
* @param key the new key value
+ * @deprecated this method only works in IE and should not have been added to
+ * the API
*/
+ @Deprecated
public void setKey(char key) {
if (currentEvent != null) {
DOM.eventSetKeyCode(currentEvent, key);
diff --git a/user/src/com/google/gwt/user/client/ui/Tree.java b/user/src/com/google/gwt/user/client/ui/Tree.java
index 3f794ba..f27b247 100644
--- a/user/src/com/google/gwt/user/client/ui/Tree.java
+++ b/user/src/com/google/gwt/user/client/ui/Tree.java
@@ -72,11 +72,14 @@
* <img class='gallery' src='Tree.png'/>
* </p>
* <h3>CSS Style Rules</h3>
- * <ul class='css'>
- * <li>.gwt-Tree { the tree itself }</li>
- * <li>.gwt-Tree .gwt-TreeItem { a tree item }</li>
- * <li>.gwt-Tree .gwt-TreeItem-selected { a selected tree item }</li>
- * </ul>
+ * <dl>
+ * <dt>.gwt-Tree</dt>
+ * <dd>the tree itself</dd>
+ * <dt>.gwt-Tree .gwt-TreeItem</dt>
+ * <dd>a tree item</dd>
+ * <dt>.gwt-Tree .gwt-TreeItem-selected</dt>
+ * <dd>a selected tree item</dd>
+ * </dl>
* <p>
* <h3>Example</h3>
* {@example com.google.gwt.examples.TreeExample}
@@ -353,7 +356,7 @@
}
public HandlerRegistration addMouseDownHandler(MouseDownHandler handler) {
- return addHandler(handler,MouseDownEvent.getType());
+ return addHandler(handler, MouseDownEvent.getType());
}
@Deprecated
@@ -362,23 +365,23 @@
}
public HandlerRegistration addMouseMoveHandler(MouseMoveHandler handler) {
- return addDomHandler(handler,MouseMoveEvent.getType());
+ return addDomHandler(handler, MouseMoveEvent.getType());
}
public HandlerRegistration addMouseOutHandler(MouseOutHandler handler) {
- return addDomHandler(handler,MouseOutEvent.getType());
+ return addDomHandler(handler, MouseOutEvent.getType());
}
public HandlerRegistration addMouseOverHandler(MouseOverHandler handler) {
- return addDomHandler(handler,MouseOverEvent.getType());
+ return addDomHandler(handler, MouseOverEvent.getType());
}
public HandlerRegistration addMouseUpHandler(MouseUpHandler handler) {
- return addDomHandler(handler,MouseUpEvent.getType());
+ return addDomHandler(handler, MouseUpEvent.getType());
}
public HandlerRegistration addMouseWheelHandler(MouseWheelHandler handler) {
- return addDomHandler(handler,MouseWheelEvent.getType());
+ return addDomHandler(handler, MouseWheelEvent.getType());
}
public final HandlerRegistration addOpenHandler(OpenHandler<TreeItem> handler) {
@@ -1039,7 +1042,7 @@
* Move the tree focus to the specified selected item.
*/
private void moveFocus() {
- HasFocus focusableWidget = curSelection.getFocusableWidget();
+ Focusable focusableWidget = curSelection.getFocusable();
if (focusableWidget != null) {
focusableWidget.setFocus(true);
DOM.scrollIntoView(((Widget) focusableWidget).getElement());
diff --git a/user/src/com/google/gwt/user/client/ui/TreeItem.java b/user/src/com/google/gwt/user/client/ui/TreeItem.java
index c3c808f..38c5756 100644
--- a/user/src/com/google/gwt/user/client/ui/TreeItem.java
+++ b/user/src/com/google/gwt/user/client/ui/TreeItem.java
@@ -619,11 +619,35 @@
}
/**
+ * Returns a suggested {@link Focusable} instance to use when this tree item
+ * is selected. The tree maintains focus if this method returns null. By
+ * default, if the tree item contains a focusable widget, that widget is
+ * returned.
+ *
+ * Note, the {@link Tree} will ignore this value if the user clicked on an
+ * input element such as a button or text area when selecting this item.
+ *
+ * @return the focusable item
+ */
+ protected Focusable getFocusable() {
+ Focusable focus = getFocusableWidget();
+ if (focus == null) {
+ Widget w = getWidget();
+ if (w instanceof Focusable) {
+ focus = (Focusable) w;
+ }
+ }
+ return focus;
+ }
+
+ /**
* Returns the widget, if any, that should be focused on if this TreeItem is
* selected.
*
+ * @deprecated use {@link #getFocusable()} instead
* @return widget to be focused.
*/
+ @Deprecated
protected HasFocus getFocusableWidget() {
Widget w = getWidget();
if (w instanceof HasFocus) {
diff --git a/user/src/com/google/gwt/user/client/ui/TreeListener.java b/user/src/com/google/gwt/user/client/ui/TreeListener.java
index e879df6..c251be0 100644
--- a/user/src/com/google/gwt/user/client/ui/TreeListener.java
+++ b/user/src/com/google/gwt/user/client/ui/TreeListener.java
@@ -19,6 +19,10 @@
/**
* Event listener interface for tree events.
+ *
+ * @deprecated use {@link com.google.gwt.event.logical.shared.SelectionHandler},
+ * {@link com.google.gwt.event.logical.shared.OpenHandler}, and/or
+ * {@link com.google.gwt.event.logical.shared.CloseHandler} instead
*/
@Deprecated
public interface TreeListener extends EventListener {
@@ -27,6 +31,9 @@
* Fired when a tree item is selected.
*
* @param item the item being selected.
+ * @deprecated use
+ * {@link com.google.gwt.event.logical.shared.SelectionHandler#onSelection(com.google.gwt.event.logical.shared.SelectionEvent)}
+ * instead
*/
@Deprecated
void onTreeItemSelected(TreeItem item);
@@ -35,6 +42,10 @@
* Fired when a tree item is opened or closed.
*
* @param item the item whose state is changing.
+ * @deprecated use
+ * {@link com.google.gwt.event.logical.shared.OpenHandler#onOpen(com.google.gwt.event.logical.shared.OpenEvent)}
+ * and/or
+ * {@link com.google.gwt.event.logical.shared.CloseHandler#onClose(com.google.gwt.event.logical.shared.CloseEvent)}
*/
@Deprecated
void onTreeItemStateChanged(TreeItem item);
diff --git a/user/src/com/google/gwt/user/client/ui/TreeListenerCollection.java b/user/src/com/google/gwt/user/client/ui/TreeListenerCollection.java
index 92bd35d..f1099f5 100644
--- a/user/src/com/google/gwt/user/client/ui/TreeListenerCollection.java
+++ b/user/src/com/google/gwt/user/client/ui/TreeListenerCollection.java
@@ -32,7 +32,6 @@
*
* @param item the tree item being selected.
*/
- @Deprecated
public void fireItemSelected(TreeItem item) {
for (TreeListener listener : this) {
listener.onTreeItemSelected(item);
@@ -44,7 +43,6 @@
*
* @param item the tree item whose state has changed.
*/
- @Deprecated
public void fireItemStateChanged(TreeItem item) {
for (TreeListener listener : this) {
listener.onTreeItemStateChanged(item);
diff --git a/user/src/com/google/gwt/user/client/ui/Widget.java b/user/src/com/google/gwt/user/client/ui/Widget.java
index 7f23170..e544e6a 100644
--- a/user/src/com/google/gwt/user/client/ui/Widget.java
+++ b/user/src/com/google/gwt/user/client/ui/Widget.java
@@ -41,7 +41,6 @@
*/
int eventsToSink;
private boolean attached;
-
private Object layoutData;
private Widget parent;
private HandlerManager handlerManager;
@@ -129,8 +128,8 @@
/**
* Overridden to defer the call to super.sinkEvents until the first time this
* widget is attached to the dom, as a performance enhancement. Subclasses
- * wishing to customize sinkEvents can preserve this deferred sink behavior
- * by putting their implementation behind a check of {@link #isOrWasAttached()}:
+ * wishing to customize sinkEvents can preserve this deferred sink behavior by
+ * putting their implementation behind a check of <code>isOrWasAttached()</code>:
*
* <pre>
* {@literal @}Override
@@ -183,6 +182,17 @@
}
/**
+ * Fires an event on a child widget. Used to delegate the handling of an event
+ * from one widget to another.
+ *
+ * @param event the event
+ * @param target fire the event on the given target
+ */
+ protected void delegateEvent(Widget target, GwtEvent<?> event) {
+ target.fireEvent(event);
+ }
+
+ /**
* If a widget contains one or more child widgets that are not in the logical
* widget hierarchy (the child is physically connected only on the DOM level),
* it must override this method and call {@link #onAttach()} for each of its
diff --git a/user/src/com/google/gwt/user/datepicker/client/DateBox.java b/user/src/com/google/gwt/user/datepicker/client/DateBox.java
index d9fc83d..1332561 100644
--- a/user/src/com/google/gwt/user/datepicker/client/DateBox.java
+++ b/user/src/com/google/gwt/user/datepicker/client/DateBox.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2008 Google Inc.
+ * Copyright 2009 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
@@ -70,9 +70,9 @@
* If that fails, we then try to parse again using the default browser date
* parsing.
* </p>
- * If that fails, the <code>dateBoxFormatError</code> css style is
- * applied to the {@link DateBox}. The style will be removed when either a
- * successful {@link #parse(DateBox,String, boolean)} is called or
+ * If that fails, the <code>dateBoxFormatError</code> css style is applied to
+ * the {@link DateBox}. The style will be removed when either a successful
+ * {@link #parse(DateBox,String, boolean)} is called or
* {@link #format(DateBox,Date)} is called.
* <p>
* Use a different {@link DateBox.Format} instance to change that behavior.
@@ -183,7 +183,7 @@
CloseHandler<PopupPanel> {
public void onBlur(BlurEvent event) {
- if (isDatePickerVisible() == false) {
+ if (isDatePickerShowing() == false) {
updateDateFromTextBox();
}
}
@@ -201,7 +201,7 @@
}
public void onFocus(FocusEvent event) {
- if (allowDPShow && isDatePickerVisible() == false) {
+ if (allowDPShow && isDatePickerShowing() == false) {
showDatePicker();
}
}
@@ -267,7 +267,7 @@
this.format = format;
popup.setAutoHideEnabled(true);
- popup.setAutoHidePartner(box.getElement());
+ popup.addAutoHidePartner(box.getElement());
popup.setWidget(picker);
popup.setStyleName("dateBoxPopup");
@@ -354,10 +354,10 @@
}
/**
- * @return true if date picker is currently visible, false if not
+ * @return true if date picker is currently showing, false if not
*/
- public boolean isDatePickerVisible() {
- return popup.isVisible();
+ public boolean isDatePickerShowing() {
+ return popup.isShowing();
}
/**
diff --git a/user/src/com/google/gwt/user/rebind/rpc/ProxyCreator.java b/user/src/com/google/gwt/user/rebind/rpc/ProxyCreator.java
index 77726a2..e237865 100644
--- a/user/src/com/google/gwt/user/rebind/rpc/ProxyCreator.java
+++ b/user/src/com/google/gwt/user/rebind/rpc/ProxyCreator.java
@@ -580,8 +580,8 @@
pw.print(", "
+ Boolean.toString(deserializationSto.maybeInstantiated(type)));
pw.print(", " + Boolean.toString(serializationSto.isSerializable(type)));
- pw.println(", "
- + Boolean.toString(serializationSto.maybeInstantiated(type)));
+ pw.print(", "
+ + Boolean.toString(serializationSto.maybeInstantiated(type)) + '\n');
}
// Closes the wrapped streams.
diff --git a/user/src/com/google/gwt/user/rebind/rpc/SerializableTypeOracleBuilder.java b/user/src/com/google/gwt/user/rebind/rpc/SerializableTypeOracleBuilder.java
index 73c4564..4c50a95 100644
--- a/user/src/com/google/gwt/user/rebind/rpc/SerializableTypeOracleBuilder.java
+++ b/user/src/com/google/gwt/user/rebind/rpc/SerializableTypeOracleBuilder.java
@@ -340,10 +340,6 @@
/**
* Returns <code>true</code> if this type is part of the standard java
* packages.
- *
- * NOTE: This code is copied from
- * {@link com.google.gwt.dev.shell.CompilingClassLoader CompilingClassLoader};
- * don't change one without changing the other.
*/
static boolean isInStandardJavaPackage(String className) {
if (className.startsWith("java.")) {
diff --git a/user/src/com/google/gwt/user/tools/.classpathsrc b/user/src/com/google/gwt/user/tools/.classpathsrc
index 19b3e77..d2b73b6 100644
--- a/user/src/com/google/gwt/user/tools/.classpathsrc
+++ b/user/src/com/google/gwt/user/tools/.classpathsrc
@@ -1,10 +1,8 @@
<?xml version="1.0" encoding="utf-8" ?>
<classpath>
<classpathentry kind="src" path="src"/>
- <classpathentry kind="src" path="test"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="@gwtUserPath"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/3"/>
<classpathentry kind="output" path="war/WEB-INF/classes"/>
-@eclipseClassPathEntries
</classpath>
diff --git a/user/src/com/google/gwt/user/tools/.projectsrc b/user/src/com/google/gwt/user/tools/.projectsrc
index 23afa59..2436f15 100644
--- a/user/src/com/google/gwt/user/tools/.projectsrc
+++ b/user/src/com/google/gwt/user/tools/.projectsrc
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8" ?>
<projectDescription>
- <name>@projectName</name>
- <comment>@projectName project</comment>
+ <name>@moduleShortName</name>
+ <comment>@moduleShortName project</comment>
<projects/>
<buildSpec>
<buildCommand>
diff --git a/user/src/com/google/gwt/user/tools/App.launchsrc b/user/src/com/google/gwt/user/tools/App.launchsrc
index 1f9e95c..428e717 100644
--- a/user/src/com/google/gwt/user/tools/App.launchsrc
+++ b/user/src/com/google/gwt/user/tools/App.launchsrc
@@ -3,15 +3,13 @@
<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="@shellClass"/>
<listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
-<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.launching.JRE_CONTAINER" javaProject="@projectName" path="1" type="4"/> "/>
-<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry internalArchive="/@projectName/src" path="3" type="2"/> "/>
-<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry id="org.eclipse.jdt.launching.classpathentry.defaultClasspath"> <memento project="@projectName"/> </runtimeClasspathEntry> "/>
-<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry externalArchive="@gwtDevPath" path="3" type="2"/> "/>
-@eclipseExtraLaunchPaths
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.launching.JRE_CONTAINER" javaProject="@moduleShortName" path="1" type="4"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry internalArchive="/@moduleShortName/src" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry id="org.eclipse.jdt.launching.classpathentry.defaultClasspath"> <memento project="@moduleShortName"/> </runtimeClasspathEntry> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry externalArchive="@gwtDevPath" path="3" type="2"/> "/>
</listAttribute>
-<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="@vmargs -Xmx256M"/>
-<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-out
- war -startupUrl @startupUrl @moduleName"/>
-<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="@projectName"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xmx256M@vmargs"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-startupUrl @startupUrl @moduleName"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="@moduleShortName"/>
<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
</launchConfiguration>
diff --git a/user/src/com/google/gwt/user/tools/AppClassTemplate.javasrc b/user/src/com/google/gwt/user/tools/AppClassTemplate.javasrc
index f2cd244..6a25968 100644
--- a/user/src/com/google/gwt/user/tools/AppClassTemplate.javasrc
+++ b/user/src/com/google/gwt/user/tools/AppClassTemplate.javasrc
@@ -2,21 +2,25 @@
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.google.gwt.user.client.rpc.ServiceDefTarget;
import com.google.gwt.user.client.ui.Button;
-import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.DialogBox;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.VerticalPanel;
-import com.google.gwt.user.client.ui.Widget;
/**
* Entry point classes define <code>onModuleLoad()</code>.
*/
-public class @className implements EntryPoint {
+public class @moduleShortName implements EntryPoint {
+
+ /**
+ * Create a remote service proxy to talk to the server-side Echo service.
+ */
+ private final EchoServiceAsync echoService = GWT.create(EchoService.class);
/**
* This is the entry point method.
@@ -24,12 +28,12 @@
public void onModuleLoad() {
Image img = new Image("http://code.google.com/webtoolkit/logo-185x175.png");
Button button = new Button("Click me");
-
+
// We can add style names
button.addStyleName("pc-template-btn");
// or we can set an id on a specific element for styling
img.getElement().setId("pc-template-img");
-
+
VerticalPanel vPanel = new VerticalPanel();
vPanel.setWidth("100%");
vPanel.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER);
@@ -48,28 +52,18 @@
dialogVPanel.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER);
dialogVPanel.add(closeButton);
- closeButton.addClickListener(new ClickListener() {
- public void onClick(Widget sender) {
+ closeButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent event) {
dialogBox.hide();
}
});
-
+
// Set the contents of the Widget
dialogBox.setWidget(dialogVPanel);
-
- final EchoServiceAsync echoService = GWT.create(EchoService.class);
- ServiceDefTarget target = (ServiceDefTarget) echoService;
- // Use a module-relative URLs to ensure that this client code can find
- // its way home, even when the URL changes (as might happen when you
- // deploy this as a webapp under an external servlet container).
- String moduleRelativeURL = GWT.getModuleBaseURL() + "echo";
- target.setServiceEntryPoint(moduleRelativeURL);
-
- final String textToServer = "Hello GWT World!";
-
- button.addClickListener(new ClickListener() {
- public void onClick(Widget sender) {
+ button.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent event) {
+ final String textToServer = "Hello GWT World!";
final String dialogBoxText = "Sending to the server: " + textToServer;
dialogBox.setText(dialogBoxText);
dialogBox.center();
diff --git a/user/src/com/google/gwt/user/tools/AppHtml.htmlsrc b/user/src/com/google/gwt/user/tools/AppHtml.htmlsrc
index 2090fe7..47a42e3 100644
--- a/user/src/com/google/gwt/user/tools/AppHtml.htmlsrc
+++ b/user/src/com/google/gwt/user/tools/AppHtml.htmlsrc
@@ -12,18 +12,18 @@
<!-- -->
<!-- Consider inlining CSS to reduce the number of requested files -->
<!-- -->
- <link type="text/css" rel="stylesheet" href="@className.css">
+ <link type="text/css" rel="stylesheet" href="@moduleShortName.css">
<!-- -->
<!-- Any title is fine -->
<!-- -->
- <title>@className</title>
+ <title>@moduleShortName</title>
<!-- -->
<!-- This script loads your compiled module. -->
<!-- If you add any GWT meta tags, they must -->
<!-- be added before this line. -->
<!-- -->
- <script type="text/javascript" language="javascript" src="@newModuleName/@newModuleName.nocache.js"></script>
+ <script type="text/javascript" language="javascript" src="@renameTo/@renameTo.nocache.js"></script>
</head>
<!-- -->
diff --git a/user/src/com/google/gwt/user/tools/ApplicationCreator.java b/user/src/com/google/gwt/user/tools/ApplicationCreator.java
index 8ea80bb..9097740 100644
--- a/user/src/com/google/gwt/user/tools/ApplicationCreator.java
+++ b/user/src/com/google/gwt/user/tools/ApplicationCreator.java
@@ -15,525 +15,15 @@
*/
package com.google.gwt.user.tools;
-import com.google.gwt.dev.cfg.ModuleDefLoader;
-import com.google.gwt.user.tools.util.ArgHandlerAddToClassPath;
-import com.google.gwt.user.tools.util.ArgHandlerEclipse;
-import com.google.gwt.user.tools.util.ArgHandlerIgnore;
-import com.google.gwt.user.tools.util.ArgHandlerOverwrite;
-import com.google.gwt.user.tools.util.CreatorUtilities;
-import com.google.gwt.util.tools.ArgHandlerExtra;
-import com.google.gwt.util.tools.ArgHandlerOutDir;
-import com.google.gwt.util.tools.ArgHandlerString;
-import com.google.gwt.util.tools.ToolBase;
-import com.google.gwt.util.tools.Utility;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.StringTokenizer;
-
/**
- * Creates a GWT application skeleton.
+ * Legacy ApplicationCreator that will let users know that they should run
+ * {@link WebAppCreator} instead.
*/
-public final class ApplicationCreator extends ToolBase {
-
- /*
- * Arguments for the application creator.
- */
-
- /**
- * Add an extra module injection into the top level module file.
- */
- protected class ArgHandlerAddModule extends ArgHandlerString {
- private List<String> extraModuleList = new ArrayList<String>();
-
- public List<String> getExtraModuleList() {
- return extraModuleList;
- }
-
- @Override
- public String getPurpose() {
- return "Adds extra GWT modules to be inherited.";
- }
-
- @Override
- public String getTag() {
- return "-addModule";
- }
-
- @Override
- public String[] getTagArgs() {
- return new String[] {"module"};
- }
-
- @Override
- public boolean setString(String str) {
- // Parse out a comma separated list
- StringTokenizer st = new StringTokenizer(str, ",");
- while (st.hasMoreTokens()) {
- String module = st.nextToken();
-
- // Check className to see that it is a period separated string of words.
- if (!module.matches("[\\w\\$]+(\\.[\\w\\$]+)+")) {
- System.err.println("'" + module
- + "' does not appear to be a valid fully-qualified module name");
- return false;
- }
- extraModuleList.add(module);
- }
-
- return true;
- }
- }
-
- /**
- * Specify the top level class name of the application to create.
- */
- protected class ArgHandlerAppClass extends ArgHandlerExtra {
-
- @Override
- public boolean addExtraArg(String arg) {
- if (fullClassName != null) {
- System.err.println("Too many arguments");
- return false;
- }
-
- // Check className for certain properties
- if (!arg.matches("[\\w\\$]+(\\.[\\w\\$]+)+")) {
- System.err.println("'" + arg
- + "' does not appear to be a valid fully-qualified Java class name");
- return false;
- }
-
- // Check out the class name.
- if (arg.indexOf('$') != -1) {
- System.err.println("'" + arg
- + "': This version of the tool does not support nested classes");
- return false;
- }
-
- String[] parts = arg.split("\\.");
- if (parts.length < 2 || !parts[parts.length - 2].equals("client")) {
- System.err.println("'"
- + arg
- + "': Please use 'client' as the final package, as in 'com.example.foo.client.MyApp'.\n"
- + "It isn't technically necessary, but this tool enforces the best practice.");
- return false;
- }
-
- fullClassName = arg;
- return true;
- }
-
- @Override
- public String getPurpose() {
- return "The fully-qualified name of the application class to create";
- }
-
- @Override
- public String[] getTagArgs() {
- return new String[] {"className"};
- }
-
- @Override
- public boolean isRequired() {
- return true;
- }
- }
-
- static class FileCreator {
- private final File dir;
- private final String sourceName;
- private final String className;
-
- FileCreator(File dir, String sourceName, String className) {
- this.dir = dir;
- this.sourceName = sourceName;
- this.className = className;
- }
- }
-
- private static final String PACKAGE_PATH;
-
- static {
- String path = ApplicationCreator.class.getName();
- path = path.substring(0, path.lastIndexOf('.') + 1);
- PACKAGE_PATH = path.replace('.', '/');
- }
+public final class ApplicationCreator {
public static void main(String[] args) {
- ApplicationCreator creator = new ApplicationCreator();
- if (creator.processArgs(args)) {
- if (creator.run()) {
- return;
- }
- }
+ System.err.println("This application no longer exists!");
+ System.err.println("Please see " + WebAppCreator.class.getName());
System.exit(1);
}
-
- /**
- * @param fullClassName Name of the fully-qualified Java class to create as an
- * Application.
- * @param outDir Where to put the output files
- * @param eclipse The name of a project to attach a .launch config to
- * @param overwrite Overwrite an existing files if they exist.
- * @param ignore Ignore existing files if they exist.
- * @throws IOException
- */
- static void createApplication(String fullClassName, File outDir,
- String eclipse, boolean overwrite, boolean ignore) throws IOException {
- createApplication(fullClassName, outDir, eclipse, overwrite, ignore, null,
- null);
- }
-
- /**
- * @param fullClassName Name of the fully-qualified Java class to create as an
- * Application.
- * @param outDir Where to put the output files
- * @param eclipse The name of a project to attach a .launch config to
- * @param overwrite Overwrite an existing files if they exist.
- * @param ignore Ignore existing files if they exist.
- * @param extraClassPaths A list of paths to append to the class path for
- * launch configs.
- * @param extraModules A list of GWT modules to add 'inherits' tags for.
- * @throws IOException
- */
- static void createApplication(String fullClassName, File outDir,
- String eclipse, boolean overwrite, boolean ignore,
- List<String> extraClassPaths, List<String> extraModules)
- throws IOException {
- createApplication(fullClassName, outDir, eclipse, overwrite, ignore,
- extraClassPaths, extraModules, null);
- }
-
- /**
- * @param fullClassName Name of the fully-qualified Java class to create as an
- * Application.
- * @param outDir Where to put the output files
- * @param eclipse The name of a project to attach a .launch config to
- * @param overwrite Overwrite an existing files if they exist.
- * @param ignore Ignore existing files if they exist.
- * @param extraClassPaths A list of paths to append to the class path for
- * launch configs.
- * @param extraModules A list of GWT modules to add 'inherits' tags for.
- * @param newModuleName The new module name
- * @throws IOException
- */
- static void createApplication(String fullClassName, File outDir,
- String eclipse, boolean overwrite, boolean ignore,
- List<String> extraClassPaths, List<String> extraModules,
- String newModuleName) throws IOException {
-
- // Figure out the installation directory
-
- String installPath = Utility.getInstallPath();
- String gwtUserPath = installPath + '/' + "gwt-user.jar";
- String gwtDevPath = installPath + '/' + Utility.getDevJarName();
- String gwtServletPath = installPath + '/' + "gwt-servlet.jar";
-
- // Validate the arguments for extra class path entries and modules.
- if (!CreatorUtilities.validatePathsAndModules(gwtUserPath, extraClassPaths,
- extraModules)) {
- return;
- }
- // Figure out what platform we're on
- //
- boolean isWindows = gwtDevPath.substring(gwtDevPath.lastIndexOf('/') + 1).indexOf(
- "windows") >= 0;
- boolean isMacOsX = gwtDevPath.substring(gwtDevPath.lastIndexOf('/') + 1).indexOf(
- "mac") >= 0;
-
- // If the path from here to the install directory is relative, we need to
- // set specific "base" directory tags; this is for sample generation during
- // the build.
- String basePathEnv;
- if (!new File(installPath).isAbsolute()) {
- if (isWindows) {
- basePathEnv = "%~dp0\\";
- } else {
- basePathEnv = "$APPDIR/";
- }
- } else {
- basePathEnv = "";
- }
-
- // Check out the class and package names.
- //
- int pos = fullClassName.lastIndexOf('.');
- String clientPackageName = fullClassName.substring(0, pos);
- String className = fullClassName.substring(pos + 1);
-
- // Compute module name and directories
- //
- pos = clientPackageName.lastIndexOf('.');
- File basePackageDir;
- String moduleName;
- String serverPackageName = null;
- File javaDir = Utility.getDirectory(outDir, "src", true);
- Utility.getDirectory(outDir, "test", true);
- File warDir = Utility.getDirectory(outDir, "war", true);
- File webInfDir = Utility.getDirectory(warDir, "WEB-INF", true);
- if (pos >= 0) {
- String basePackage = clientPackageName.substring(0, pos);
- moduleName = basePackage + "." + className;
- serverPackageName = basePackage + ".server";
- basePackage = basePackage.replace('.', '/');
- basePackageDir = Utility.getDirectory(javaDir, basePackage, true);
- } else {
- moduleName = className;
- basePackageDir = javaDir;
- serverPackageName = "server";
- }
- File clientDir = Utility.getDirectory(basePackageDir, "client", true);
- File serverDir = Utility.getDirectory(basePackageDir, "server", true);
- String startupUrl = className + ".html";
-
- // Create a map of replacements
- //
- Map<String, String> replacements = new HashMap<String, String>();
- replacements.put("@className", className);
- replacements.put("@moduleName", moduleName);
- replacements.put("@clientPackage", clientPackageName);
- replacements.put("@serverPackage", serverPackageName);
- replacements.put("@gwtUserPath", basePathEnv + gwtUserPath);
- replacements.put("@gwtDevPath", basePathEnv + gwtDevPath);
- replacements.put("@shellClass", "com.google.gwt.dev.GWTHosted");
- replacements.put("@compileClass", "com.google.gwt.dev.GWTCompiler");
- replacements.put("@startupUrl", startupUrl);
- replacements.put("@antVmargs", isMacOsX
- ? "<jvmarg value=\"-XstartOnFirstThread\"/>" : "");
- replacements.put("@vmargs", isMacOsX ? "-XstartOnFirstThread" : "");
- replacements.put("@eclipseExtraLaunchPaths",
- CreatorUtilities.createEclipseExtraLaunchPaths(extraClassPaths));
- replacements.put("@extraModuleInherits",
- createExtraModuleInherits(extraModules));
- replacements.put("@extraClassPathsColon", CreatorUtilities.appendPaths(":",
- extraClassPaths));
- replacements.put("@extraClassPathsSemicolon", CreatorUtilities.appendPaths(
- ";", extraClassPaths));
- replacements.put("@newModuleName", (newModuleName != null) ? newModuleName
- : moduleName);
-
- {
- // create the module xml file, skeleton html file, skeleton css file,
- // web.xml file
- FileCreator fileCreators[] = new FileCreator[] {
- new FileCreator(basePackageDir, "Module.gwt.xml", className
- + ModuleDefLoader.GWT_MODULE_XML_SUFFIX),
- new FileCreator(warDir, "AppHtml.html", className + ".html"),
- new FileCreator(warDir, "AppCss.css", className + ".css"),
- new FileCreator(webInfDir, "web.xml", "web.xml"),};
- for (FileCreator fileCreator : fileCreators) {
- File file = Utility.createNormalFile(fileCreator.dir,
- fileCreator.className, overwrite, ignore);
- if (file != null) {
- String out = Utility.getFileFromClassPath(PACKAGE_PATH
- + fileCreator.sourceName + "src");
- Utility.writeTemplateFile(file, out, replacements);
- }
- }
- }
-
- {
- /*
- * Create a skeleton Application: main client class, rpc stub for the
- * client, async counterpart of the rpc stub, rpc implementation on the
- * server.
- */
- FileCreator fileCreators[] = new FileCreator[] {
- new FileCreator(clientDir, "AppClass", className),
- new FileCreator(clientDir, "RpcClient", "EchoService"),
- new FileCreator(clientDir, "RpcAsyncClient", "EchoServiceAsync"),
- new FileCreator(serverDir, "RpcServer", "EchoServiceImpl"),};
- for (FileCreator fileCreator : fileCreators) {
- File javaClass = Utility.createNormalFile(fileCreator.dir,
- fileCreator.className + ".java", overwrite, ignore);
- if (javaClass != null) {
- String out = Utility.getFileFromClassPath(PACKAGE_PATH
- + fileCreator.sourceName + "Template.javasrc");
- Utility.writeTemplateFile(javaClass, out, replacements);
- }
- }
- }
-
- if (eclipse != null) {
- replacements.put("@projectName", eclipse);
- // Build the list of extra paths
- replacements.put("@gwtServletPath", basePathEnv + gwtServletPath);
- StringBuilder buf = new StringBuilder();
- if (extraClassPaths != null) {
- for (String path : extraClassPaths) {
- buf.append(" <pathelement path=\"" + path + "\"/>");
- }
- }
- replacements.put("@extraAntPathElements", buf.toString());
-
- StringBuilder classpathEntries = new StringBuilder();
- if (extraClassPaths != null) {
- for (String path : extraClassPaths) {
- File f = new File(path);
-
- if (!f.exists()) {
- throw new FileNotFoundException("extraClassPath: " + path
- + " must be present before .launch file can be created.");
- }
- // Handle both .jar files and paths
- String kindString;
- if (f.isDirectory()) {
- kindString = "output";
- } else if (path.endsWith(".jar")) {
- kindString = "lib";
- } else {
- throw new RuntimeException("Don't know how to handle path: " + path
- + ". It doesn't appear to be a directory or a .jar file");
- }
- classpathEntries.append(" <classpathentry kind=\"");
- classpathEntries.append(kindString);
- classpathEntries.append("\" path=\"");
- classpathEntries.append(path);
- classpathEntries.append("\"/>\n");
- }
- }
- replacements.put("@eclipseClassPathEntries", classpathEntries.toString());
-
- /*
- * create an ant file, an eclipse .project, an eclipse .classpath, and an
- * eclipse launch-config
- */
- FileCreator fileCreators[] = new FileCreator[] {
- new FileCreator(outDir, "project.ant.xml", "build.xml"),
- new FileCreator(outDir, ".project", ".project"),
- new FileCreator(outDir, ".classpath", ".classpath"),
- new FileCreator(outDir, "App.launch", className + ".launch"),};
- for (FileCreator fileCreator : fileCreators) {
- File file = Utility.createNormalFile(fileCreator.dir,
- fileCreator.className, overwrite, ignore);
- if (file != null) {
- String out = Utility.getFileFromClassPath(PACKAGE_PATH
- + fileCreator.sourceName + "src");
- Utility.writeTemplateFile(file, out, replacements);
- }
- }
- }
- }
-
- private static String createExtraModuleInherits(List<String> modules) {
- if (modules == null) {
- return "";
- }
- // Create an <inherits> tag in the gwt.xml file for each extra module
- StringBuilder buf = new StringBuilder();
- for (String module : modules) {
- buf.append(" <inherits name=\"");
- buf.append(module);
- buf.append("\" />\n");
- }
- return buf.toString();
- }
-
- private ArgHandlerAddToClassPath classPathHandler = new ArgHandlerAddToClassPath();
- private String eclipse = null;
- private String fullClassName = null;
- private boolean ignore = false;
- private ArgHandlerAddModule moduleHandler = new ArgHandlerAddModule();
- private File outDir;
- private boolean overwrite = false;
- private String newModuleName = null;
-
- protected ApplicationCreator() {
-
- registerHandler(new ArgHandlerEclipse() {
- @Override
- public String getPurpose() {
- return "Creates an ant file, an eclipse project, and a launch config";
- }
-
- @Override
- public boolean setString(String str) {
- eclipse = str;
- return true;
- }
- });
-
- registerHandler(new ArgHandlerOutDir() {
- @Override
- public void setDir(File dir) {
- outDir = dir;
- }
- });
-
- registerHandler(new ArgHandlerOverwrite() {
- @Override
- public boolean setFlag() {
- if (ignore) {
- System.err.println("-overwrite cannot be used with -ignore");
- return false;
- }
- overwrite = true;
- return true;
- }
- });
-
- registerHandler(new ArgHandlerIgnore() {
- @Override
- public boolean setFlag() {
- if (overwrite) {
- System.err.println("-ignore cannot be used with -overwrite");
- return false;
- }
- ignore = true;
- return true;
- }
- });
-
- // handler to process newModuleName argument
- registerHandler(new ArgHandlerString() {
- @Override
- public String[] getDefaultArgs() {
- return null; // later reset to moduleName
- }
-
- @Override
- public String getPurpose() {
- return "Specifies the new name of the module";
- }
-
- @Override
- public String getTag() {
- return "-moduleName";
- }
-
- @Override
- public String[] getTagArgs() {
- return new String[] {"moduleName"};
- }
-
- @Override
- public boolean setString(String str) {
- newModuleName = str;
- return true;
- }
- });
-
- registerHandler(new ArgHandlerAppClass());
- registerHandler(classPathHandler);
- registerHandler(moduleHandler);
- }
-
- protected boolean run() {
- try {
- createApplication(fullClassName, outDir, eclipse, overwrite, ignore,
- classPathHandler.getExtraClassPathList(),
- moduleHandler.getExtraModuleList(), newModuleName);
- return true;
- } catch (IOException e) {
- System.err.println(e.getClass().getName() + ": " + e.getMessage());
- return false;
- }
- }
-
}
diff --git a/user/src/com/google/gwt/user/tools/Module.gwt.xmlsrc b/user/src/com/google/gwt/user/tools/Module.gwt.xmlsrc
index 51c660a..03f9a70 100644
--- a/user/src/com/google/gwt/user/tools/Module.gwt.xmlsrc
+++ b/user/src/com/google/gwt/user/tools/Module.gwt.xmlsrc
@@ -1,18 +1,17 @@
-<module rename-to='@newModuleName'>
+<?xml version="1.0" encoding="UTF-8"?>@gwtModuleDtd
+<module rename-to='@renameTo'>
+ <!-- Inherit the core Web Toolkit stuff. -->
+ <inherits name='com.google.gwt.user.User'/>
- <!-- 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.standard.Standard'/>
- <!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
- <!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/> -->
+ <!-- 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.standard.Standard'/>
+ <!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
+ <!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/> -->
- <!-- Other module inherits -->
-@extraModuleInherits
+ <!-- Other module inherits -->
- <!-- Specify the app entry point class. -->
- <entry-point class='@clientPackage.@className'/>
+ <!-- Specify the app entry point class. -->
+ <entry-point class='@clientPackage.@moduleShortName'/>
</module>
diff --git a/user/src/com/google/gwt/user/tools/ProjectCreator.java b/user/src/com/google/gwt/user/tools/ProjectCreator.java
index 2b5f92e..09438ad 100644
--- a/user/src/com/google/gwt/user/tools/ProjectCreator.java
+++ b/user/src/com/google/gwt/user/tools/ProjectCreator.java
@@ -17,14 +17,13 @@
/**
* Legacy ProjectCreator that will let users know that they should run
- * ApplicationCreator instead.
+ * {@link WebAppCreator} instead.
*/
public final class ProjectCreator {
public static void main(String[] args) {
System.err.println("This application no longer exists!");
- System.err.println("It has been merged with com.google.gwt.user.tools.ApplicationCreator in gwt-user.jar");
+ System.err.println("Please see " + WebAppCreator.class.getName());
System.exit(1);
}
-
}
diff --git a/user/src/com/google/gwt/user/tools/RpcAsyncClientTemplate.javasrc b/user/src/com/google/gwt/user/tools/RpcAsyncClientTemplate.javasrc
index 52eef3e..c15d89b 100644
--- a/user/src/com/google/gwt/user/tools/RpcAsyncClientTemplate.javasrc
+++ b/user/src/com/google/gwt/user/tools/RpcAsyncClientTemplate.javasrc
@@ -6,5 +6,5 @@
* The async counterpart of <code>EchoService</code>.
*/
public interface EchoServiceAsync {
- void echo (String input, AsyncCallback<String> callback);
+ void echo(String input, AsyncCallback<String> callback);
}
diff --git a/user/src/com/google/gwt/user/tools/RpcClientTemplate.javasrc b/user/src/com/google/gwt/user/tools/RpcClientTemplate.javasrc
index 419660c..aeeeff7 100644
--- a/user/src/com/google/gwt/user/tools/RpcClientTemplate.javasrc
+++ b/user/src/com/google/gwt/user/tools/RpcClientTemplate.javasrc
@@ -1,10 +1,12 @@
package @clientPackage;
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("echo")
public interface EchoService extends RemoteService {
- String echo (String input);
+ String echo(String input);
}
diff --git a/user/src/com/google/gwt/user/tools/WebAppCreator.java b/user/src/com/google/gwt/user/tools/WebAppCreator.java
new file mode 100644
index 0000000..d324a83
--- /dev/null
+++ b/user/src/com/google/gwt/user/tools/WebAppCreator.java
@@ -0,0 +1,264 @@
+/*
+ * Copyright 2008 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.user.tools;
+
+import com.google.gwt.dev.About;
+import com.google.gwt.dev.ArgProcessorBase;
+import com.google.gwt.dev.Compiler;
+import com.google.gwt.dev.HostedMode;
+import com.google.gwt.dev.util.Util;
+import com.google.gwt.user.tools.util.ArgHandlerIgnore;
+import com.google.gwt.user.tools.util.ArgHandlerOverwrite;
+import com.google.gwt.user.tools.util.CreatorUtilities;
+import com.google.gwt.util.tools.ArgHandlerExtra;
+import com.google.gwt.util.tools.ArgHandlerOutDir;
+import com.google.gwt.util.tools.Utility;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Creates a GWT application skeleton.
+ */
+public final class WebAppCreator {
+
+ class ArgProcessor extends ArgProcessorBase {
+
+ private final class ArgHandlerOutDirExtension extends ArgHandlerOutDir {
+ @Override
+ public void setDir(File dir) {
+ outDir = dir;
+ }
+ }
+
+ public ArgProcessor() {
+ registerHandler(new ArgHandlerOverwriteExtension());
+ registerHandler(new ArgHandlerIgnoreExtension());
+ registerHandler(new ArgHandlerModuleName());
+ registerHandler(new ArgHandlerOutDirExtension());
+ }
+
+ @Override
+ protected String getName() {
+ return WebAppCreator.class.getName();
+ }
+ }
+
+ private final class ArgHandlerIgnoreExtension extends ArgHandlerIgnore {
+ @Override
+ public boolean setFlag() {
+ if (overwrite) {
+ System.err.println("-ignore cannot be used with -overwrite");
+ return false;
+ }
+ ignore = true;
+ return true;
+ }
+ }
+
+ /*
+ * Arguments for the application creator.
+ */
+
+ private final class ArgHandlerModuleName extends ArgHandlerExtra {
+ @Override
+ public boolean addExtraArg(String arg) {
+ if (moduleName != null) {
+ System.err.println("Too many arguments.");
+ return false;
+ }
+
+ if (!CreatorUtilities.isValidModuleName(arg)) {
+ System.err.println("'"
+ + arg
+ + "' does not appear to be a valid fully-qualified Java class name.");
+ return false;
+ }
+
+ moduleName = arg;
+ return true;
+ }
+
+ @Override
+ public String getPurpose() {
+ return "The name of the module to create (fully-qualified Java class name)";
+ }
+
+ @Override
+ public String[] getTagArgs() {
+ return new String[] {"moduleName"};
+ }
+
+ @Override
+ public boolean isRequired() {
+ return true;
+ }
+ }
+
+ private final class ArgHandlerOverwriteExtension extends ArgHandlerOverwrite {
+ @Override
+ public boolean setFlag() {
+ if (ignore) {
+ System.err.println("-overwrite cannot be used with -ignore");
+ return false;
+ }
+ overwrite = true;
+ return true;
+ }
+ }
+
+ private static final class FileCreator {
+ private final String destName;
+ private final File destDir;
+ private final String sourceName;
+
+ public FileCreator(File destDir, String destName, String sourceName) {
+ this.destDir = destDir;
+ this.sourceName = sourceName;
+ this.destName = destName;
+ }
+ }
+
+ public static void main(String[] args) {
+ WebAppCreator creator = new WebAppCreator();
+ ArgProcessor argProcessor = creator.new ArgProcessor();
+ if (argProcessor.processArgs(args)) {
+ if (creator.run()) {
+ return;
+ }
+ }
+ System.exit(1);
+ }
+
+ /**
+ * @param moduleName name of the fully-qualified GWT module to create as an
+ * Application.
+ * @param outDir Where to put the output files
+ * @param overwrite Overwrite an existing files if they exist.
+ * @param ignore Ignore existing files if they exist.
+ * @throws IOException
+ */
+ static void createApplication(String moduleName, File outDir,
+ boolean overwrite, boolean ignore) throws IOException {
+
+ // Figure out the installation directory
+ String installPath = Utility.getInstallPath();
+ String gwtUserPath = installPath + '/' + "gwt-user.jar";
+ String gwtDevPath = installPath + '/' + Utility.getDevJarName();
+ String gwtServletPath = installPath + '/' + "gwt-servlet.jar";
+
+ // Public builds generate a DTD reference.
+ String gwtModuleDtd = "";
+ if (!About.GWT_VERSION_NUM.endsWith(".999")
+ && !About.GWT_VERSION_NUM.startsWith("0.0")) {
+ gwtModuleDtd = "\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit "
+ + About.GWT_VERSION_NUM
+ + "//EN\" \"http://google-web-toolkit.googlecode.com/svn/tags/"
+ + About.GWT_VERSION_NUM + "/distro-source/core/src/gwt-module.dtd\">";
+ }
+
+ // Figure out what platform we're on
+ boolean isMacOsX = gwtDevPath.substring(gwtDevPath.lastIndexOf('/') + 1).indexOf(
+ "mac") >= 0;
+
+ // Compute module package and name.
+ int pos = moduleName.lastIndexOf('.');
+ String modulePackageName = moduleName.substring(0, pos);
+ String moduleShortName = moduleName.substring(pos + 1);
+
+ // Compute module name and directories
+ File srcDir = Utility.getDirectory(outDir, "src", true);
+ File warDir = Utility.getDirectory(outDir, "war", true);
+ File webInfDir = Utility.getDirectory(warDir, "WEB-INF", true);
+ File moduleDir = Utility.getDirectory(srcDir, modulePackageName.replace(
+ '.', '/'), true);
+ File clientDir = Utility.getDirectory(moduleDir, "client", true);
+ File serverDir = Utility.getDirectory(moduleDir, "server", true);
+
+ // Create a map of replacements
+ Map<String, String> replacements = new HashMap<String, String>();
+ replacements.put("@moduleShortName", moduleShortName);
+ replacements.put("@moduleName", moduleName);
+ replacements.put("@clientPackage", modulePackageName + ".client");
+ replacements.put("@serverPackage", modulePackageName + ".server");
+ replacements.put("@gwtUserPath", gwtUserPath);
+ replacements.put("@gwtDevPath", gwtDevPath);
+ replacements.put("@gwtServletPath", gwtServletPath);
+ replacements.put("@gwtVersion", About.GWT_VERSION_NUM);
+ replacements.put("@gwtModuleDtd", gwtModuleDtd);
+ replacements.put("@shellClass", HostedMode.class.getName());
+ replacements.put("@compileClass", Compiler.class.getName());
+ replacements.put("@startupUrl", moduleShortName + ".html");
+ replacements.put("@antVmargs", isMacOsX
+ ? "\n<jvmarg value=\"-XstartOnFirstThread\"/>" : "");
+ replacements.put("@vmargs", isMacOsX ? " -XstartOnFirstThread" : "");
+ replacements.put("@renameTo", moduleShortName.toLowerCase());
+
+ List<FileCreator> files = new ArrayList<FileCreator>();
+ files.add(new FileCreator(moduleDir, moduleShortName + ".gwt.xml",
+ "Module.gwt.xml"));
+ files.add(new FileCreator(warDir, moduleShortName + ".html", "AppHtml.html"));
+ files.add(new FileCreator(warDir, moduleShortName + ".css", "AppCss.css"));
+ files.add(new FileCreator(webInfDir, "web.xml", "web.xml"));
+ files.add(new FileCreator(clientDir, moduleShortName + ".java",
+ "AppClassTemplate.java"));
+ files.add(new FileCreator(clientDir, "EchoService" + ".java",
+ "RpcClientTemplate.java"));
+ files.add(new FileCreator(clientDir, "EchoServiceAsync" + ".java",
+ "RpcAsyncClientTemplate.java"));
+ files.add(new FileCreator(serverDir, "EchoServiceImpl" + ".java",
+ "RpcServerTemplate.java"));
+ files.add(new FileCreator(outDir, "build.xml", "project.ant.xml"));
+ files.add(new FileCreator(outDir, ".project", ".project"));
+ files.add(new FileCreator(outDir, ".classpath", ".classpath"));
+ files.add(new FileCreator(outDir, moduleShortName + ".launch", "App.launch"));
+
+ for (FileCreator fileCreator : files) {
+ File file = Utility.createNormalFile(fileCreator.destDir,
+ fileCreator.destName, overwrite, ignore);
+ if (file != null) {
+ URL url = WebAppCreator.class.getResource(fileCreator.sourceName
+ + "src");
+ if (url == null) {
+ throw new FileNotFoundException(fileCreator.sourceName + "src");
+ }
+ String data = Util.readURLAsString(url);
+ Utility.writeTemplateFile(file, data, replacements);
+ }
+ }
+ }
+
+ private boolean ignore = false;
+ private String moduleName;
+ private File outDir;
+ private boolean overwrite = false;
+
+ protected boolean run() {
+ try {
+ createApplication(moduleName, outDir, overwrite, ignore);
+ return true;
+ } catch (IOException e) {
+ System.err.println(e.getClass().getName() + ": " + e.getMessage());
+ return false;
+ }
+ }
+}
diff --git a/user/src/com/google/gwt/user/tools/project.ant.xmlsrc b/user/src/com/google/gwt/user/tools/project.ant.xmlsrc
index a9d8e3a..9b6e4a9 100644
--- a/user/src/com/google/gwt/user/tools/project.ant.xmlsrc
+++ b/user/src/com/google/gwt/user/tools/project.ant.xmlsrc
@@ -1,85 +1,65 @@
<?xml version="1.0" encoding="utf-8" ?>
-<project name="@projectName" default="build" basedir=".">
- <description>
- @projectName build file. This is used to package up your project as a jar,
- if you want to distribute it. This isn't needed for normal operation.
- </description>
- <property name="outdir" location="war" />
+<project name="@moduleShortName" default="build" basedir=".">
- <!-- set classpath -->
<path id="project.class.path">
- <pathelement path="${java.class.path}/"/>
- <pathelement path="@gwtUserPath"/>
-@extraAntPathElements
- <!-- Additional dependencies (such as junit) go here -->
+ <pathelement location="war/WEB-INF/classes"/>
+ <pathelement location="@gwtUserPath"/>
+ <!-- Add any additional non-server libs (such as JUnit) -->
+ <fileset dir="war/WEB-INF/lib">
+ <include name="**/*.jar"/>
+ </fileset>
</path>
- <!-- TODO:
- 1. revisit this once GWT supports shared dir as a first-clas citizen
- 2. For a 1.4 server, split this so that the server side code is compiled
- with a target=1.4 build rule -->
- <target name="javac" description="Compile project to WEB-INF/classes">
+ <target name="libs" description="Copy libs to WEB-INF/lib">
+ <mkdir dir="war/WEB-INF/lib" />
+ <copy todir="war/WEB-INF/lib" file="@gwtServletPath" />
+ <!-- Add any additional server libs that need to be copied -->
+ </target>
+
+ <target name="javac" depends="libs" description="Compile java source">
<mkdir dir="war/WEB-INF/classes"/>
- <javac srcdir="src:test"
- destdir="war/WEB-INF/classes"
- includes="**"
- debug="true"
- debuglevel="lines,vars,source"
- source="1.5"
- target="1.5"
- nowarn="true"
- encoding="utf-8">
+ <javac srcdir="src" includes="**" encoding="utf-8"
+ destdir="war/WEB-INF/classes"
+ source="1.5" target="1.5" nowarn="true"
+ debug="true" debuglevel="lines,vars,source">
<classpath refid="project.class.path"/>
</javac>
</target>
- <target name="deploy" depends="gwtc" description="Copy output to the war folder">
- <mkdir dir="war/WEB-INF/lib" />
- <copy todir="war/WEB-INF/lib" file="@gwtServletPath" />
- </target>
-
<!-- can add additional arguments like -logLevel INFO or -style PRETTY -->
- <target name="gwtc" depends="javac" description="Compile to JavaScript">
- <java failonerror="true" fork="true"
- classname="@compileClass">
+ <target name="gwtc" depends="javac" description="GWT compile to JavaScript">
+ <java failonerror="true" fork="true" classname="@compileClass">
<classpath>
<pathelement location="src"/>
- <pathelement location="war/WEB-INF/classes"/>
- <pathelement path="${project.class.path}/"/>
+ <path refid="project.class.path"/>
<pathelement location="@gwtDevPath"/>
</classpath>
- <!-- add jvmarg -Xss16M or similar if you see a StackOverflowError -->
- <jvmarg value="-Xmx256M"/>
- @antVmargs
+ <!-- add jvmarg -Xss16M or similar if you see a StackOverflowError -->
+ <jvmarg value="-Xmx256M"/>@antVmargs
<arg value="@moduleName"/>
</java>
</target>
- <!-- can add additional arguments like -logLevel INFO -->
- <target name="shell" depends="javac" description="Run the deployed app in GWT hosted mode">
- <java failonerror="true" fork="true"
- classname="@shellClass">
+ <target name="hosted" depends="javac" description="Run hosted mode">
+ <java failonerror="true" fork="true" classname="@shellClass">
<classpath>
<pathelement location="src"/>
+ <path refid="project.class.path"/>
<pathelement location="@gwtDevPath"/>
- <pathelement path="${java.class.path}/"/>
- <pathelement path="@gwtUserPath"/>
</classpath>
- <jvmarg value="-Xmx256M"/>
- @antVmargs
+ <jvmarg value="-Xmx256M"/>@antVmargs
<arg value="-startupUrl"/>
<arg value="@startupUrl"/>
<arg value="@moduleName"/>
+ <!-- Additional arguments like -style PRETTY or -logLevel DEBUG -->
</java>
</target>
- <target name="build" depends="javac, gwtc, deploy" description="Build this project" />
+ <target name="build" depends="gwtc" description="Build this project" />
- <target name="clean" description="Cleans this project's intermediate and
- output files">
- <!-- uncomment if the WEB-INF/classes dir only contains GWT output -->
- <!-- <delete dir="war/WEB-INF/classes" failonerror="false" /> -->
- <delete dir="war/@newModuleName" failonerror="false" />
+ <target name="clean" description="Cleans this project">
+ <delete dir="war/WEB-INF/classes" failonerror="false" />
+ <delete dir="war/@renameTo" failonerror="false" />
</target>
</project>
diff --git a/user/src/com/google/gwt/user/tools/util/CreatorUtilities.java b/user/src/com/google/gwt/user/tools/util/CreatorUtilities.java
index e21775b..2c9a802 100644
--- a/user/src/com/google/gwt/user/tools/util/CreatorUtilities.java
+++ b/user/src/com/google/gwt/user/tools/util/CreatorUtilities.java
@@ -76,7 +76,7 @@
}
String lcPath = path.toLowerCase();
-
+
if (f.isDirectory()) {
// For a directory, we assume it contains compiled class files
buf.append("<listEntry value=\"<?xml version="1.0" ");
@@ -103,6 +103,14 @@
}
/**
+ * Returns <code>true</code> if <code>moduleName</code> is a valid module
+ * name.
+ */
+ public static boolean isValidModuleName(String moduleName) {
+ return moduleName.matches("[\\w]+(\\.[\\w]+)+");
+ }
+
+ /**
* Check to see that the userJar and pathList files all exist, and that the
* moduleList entries can be found within the jars.
*
diff --git a/user/src/com/google/gwt/user/tools/web.xmlsrc b/user/src/com/google/gwt/user/tools/web.xmlsrc
index 60ade4d..62ca7c8 100644
--- a/user/src/com/google/gwt/user/tools/web.xmlsrc
+++ b/user/src/com/google/gwt/user/tools/web.xmlsrc
@@ -8,7 +8,7 @@
<servlet-mapping>
<servlet-name>echoServlet</servlet-name>
- <url-pattern>/@newModuleName/echo</url-pattern>
+ <url-pattern>/@renameTo/echo</url-pattern>
</servlet-mapping>
</web-app>
diff --git a/user/test/com/google/gwt/dev/shell/rewrite/EmmaClassLoadingTest.gwt.xml b/user/test/com/google/gwt/dev/shell/rewrite/EmmaClassLoadingTest.gwt.xml
new file mode 100644
index 0000000..f8cb006
--- /dev/null
+++ b/user/test/com/google/gwt/dev/shell/rewrite/EmmaClassLoadingTest.gwt.xml
@@ -0,0 +1,3 @@
+<module>
+ <inherits name="com.google.gwt.user.User"/>
+</module>
diff --git a/user/test/com/google/gwt/dev/shell/rewrite/client/EmmaClassLoadingTest.java b/user/test/com/google/gwt/dev/shell/rewrite/client/EmmaClassLoadingTest.java
new file mode 100644
index 0000000..35250a3
--- /dev/null
+++ b/user/test/com/google/gwt/dev/shell/rewrite/client/EmmaClassLoadingTest.java
@@ -0,0 +1,110 @@
+/*
+ * Copyright 2008 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.dev.shell.rewrite.client;
+
+import com.google.gwt.junit.client.GWTTestCase;
+
+/**
+ * Test-case to check if the jsni blocks are mapped correctly between the
+ * synthetic and anonymous classes generated by the javac and the jdt compiler.
+ * <p>
+ * This issue arises when emma.jar is in the classpath. Gwt then follows the
+ * emma strategy and loads (offline-instrumented) classes from the disk. These
+ * classes could have been generated by any java compiler -- the java compiler
+ * does not have to be jdt and frequently is javac. These class files may
+ * contain references to synthetic classes and anonymous classes that the jdt
+ * does not know about. This testcase checks that gwt handles these cases
+ * correctly.
+ */
+public class EmmaClassLoadingTest extends GWTTestCase {
+
+ enum EnumTest {
+ A, B, C,
+ }
+
+ interface TestInterface {
+ void foo();
+ }
+
+ private static String messages[] = {
+ "a foo", "b foo", "enum A", "d foo", "e foo"};
+
+ private static int logCount = 0;
+
+ private static void log(String msg) {
+ assertEquals(messages[logCount++], msg);
+ }
+
+ @Override
+ public String getModuleName() {
+ return "com.google.gwt.dev.shell.rewrite.EmmaClassLoadingTest";
+ }
+
+ public void test1() {
+ TestInterface a = new TestInterface() {
+ public void foo() {
+ log("a foo");
+ }
+ };
+ a.foo();
+
+ TestInterface b = new TestInterface() {
+ public native void foo() /*-{
+ @com.google.gwt.dev.shell.rewrite.client.EmmaClassLoadingTest::log(Ljava/lang/String;)("b foo");
+ }-*/;
+ };
+ b.foo();
+
+ if (false) {
+ TestInterface c = new TestInterface() {
+ public native void foo() /*-{
+ @com.google.gwt.dev.shell.rewrite.client.EmmaClassLoadingTest::log(Ljava/lang/String;)("ANY_FOO_1");
+ }-*/;
+ };
+ }
+ EnumTest et = EnumTest.A;
+ switch (et) {
+ case A:
+ log("enum A");
+ break;
+ case B:
+ log("ANY_FOO_2");
+ break;
+ case C:
+ log("ANY_FOO_3");
+ break;
+ }
+
+ TestInterface d = new TestInterface() {
+ public native void foo() /*-{
+ @com.google.gwt.dev.shell.rewrite.client.EmmaClassLoadingTest::log(Ljava/lang/String;)("d foo");
+ }-*/;
+ };
+ d.foo();
+
+ /*
+ * jdt generates $1 (a), $2 (b), $3 (d), $4 (e). javac generates $1 (a), $2
+ * (b), $3 (c), $4 (d), $5 (e), $6 (synthetic). Added e so that the test
+ * fails quickly. Otherwise, it had to wait for a time-out (in looking
+ * through jdt generated code for non-existent jsni methods of $4) to fail.
+ */
+ TestInterface e = new TestInterface() {
+ public native void foo() /*-{
+ @com.google.gwt.dev.shell.rewrite.client.EmmaClassLoadingTest::log(Ljava/lang/String;)("e foo");
+ }-*/;
+ };
+ }
+}
diff --git a/user/test/com/google/gwt/user/UISuite.java b/user/test/com/google/gwt/user/UISuite.java
index 515955b..c7483be 100644
--- a/user/test/com/google/gwt/user/UISuite.java
+++ b/user/test/com/google/gwt/user/UISuite.java
@@ -67,6 +67,7 @@
import com.google.gwt.user.client.ui.SimpleRadioButtonTest;
import com.google.gwt.user.client.ui.SplitPanelTest;
import com.google.gwt.user.client.ui.StackPanelTest;
+import com.google.gwt.user.client.ui.SuggestBoxTest;
import com.google.gwt.user.client.ui.TabBarTest;
import com.google.gwt.user.client.ui.TabPanelTest;
import com.google.gwt.user.client.ui.TextAreaTest;
@@ -144,6 +145,7 @@
suite.addTestSuite(SimpleRadioButtonTest.class);
suite.addTestSuite(SplitPanelTest.class);
suite.addTestSuite(StackPanelTest.class);
+ suite.addTestSuite(SuggestBoxTest.class);
suite.addTestSuite(TabBarTest.class);
suite.addTestSuite(TabPanelTest.class);
suite.addTestSuite(TextAreaTest.class);
diff --git a/user/test/com/google/gwt/user/client/ui/DateBoxTest.java b/user/test/com/google/gwt/user/client/ui/DateBoxTest.java
index 624359a..f8ee4a7 100644
--- a/user/test/com/google/gwt/user/client/ui/DateBoxTest.java
+++ b/user/test/com/google/gwt/user/client/ui/DateBoxTest.java
@@ -22,13 +22,23 @@
* Tests DateBox.
*/
public class DateBoxTest extends GWTTestCase {
+ @Override
public String getModuleName() {
return "com.google.gwt.user.User";
}
-
+
+ public void testAccessors() {
+ DateBox db = new DateBox();
+ assertFalse(db.isDatePickerShowing());
+ db.showDatePicker();
+ assertTrue(db.isDatePickerShowing());
+ db.hideDatePicker();
+ assertFalse(db.isDatePickerShowing());
+ }
+
public void testValueChangeEvent() {
DateBox db = new DateBox();
RootPanel.get().add(db);
- new DateValueChangeTester(db).run();
+ new DateValueChangeTester(db).run();
}
}
diff --git a/user/test/com/google/gwt/user/client/ui/ImageTest.java b/user/test/com/google/gwt/user/client/ui/ImageTest.java
index a59794d..2201dd2 100644
--- a/user/test/com/google/gwt/user/client/ui/ImageTest.java
+++ b/user/test/com/google/gwt/user/client/ui/ImageTest.java
@@ -421,4 +421,34 @@
assertEquals(16, image.getHeight());
assertEquals("clipped", getCurrentImageStateName(image));
}
+
+
+ private int firedLoad;
+ private int firedError;
+ @SuppressWarnings("deprecation")
+ public void testLoadListenerWiring() {
+ Image im = new Image();
+
+ im.addLoadListener(new LoadListener() {
+
+ public void onError(Widget sender) {
+ ++firedError;
+ }
+
+ public void onLoad(Widget sender) {
+ ++firedLoad;
+ }
+ });
+ im.fireEvent(new LoadEvent() {
+ // Replaced by Joel's event firing when possible.
+ });
+ assertEquals(1, firedLoad);
+ assertEquals(0, firedError);
+ im.fireEvent(new ErrorEvent() {
+ // Replaced by Joel's event firing when possible.
+ });
+ assertEquals(1, firedLoad);
+ assertEquals(1, firedError);
+ }
+
}
diff --git a/user/test/com/google/gwt/user/client/ui/PopupTest.java b/user/test/com/google/gwt/user/client/ui/PopupTest.java
index 8aa91e3..a8611bd 100644
--- a/user/test/com/google/gwt/user/client/ui/PopupTest.java
+++ b/user/test/com/google/gwt/user/client/ui/PopupTest.java
@@ -15,13 +15,15 @@
*/
package com.google.gwt.user.client.ui;
+import com.google.gwt.dom.client.DivElement;
+import com.google.gwt.dom.client.Document;
import com.google.gwt.junit.client.GWTTestCase;
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.Timer;
import com.google.gwt.user.client.Window;
/**
- * TODO: document me.
+ * Tests for {@link PopupPanel}.
*/
public class PopupTest extends GWTTestCase {
@@ -80,6 +82,32 @@
assertTrue(popup.isPreviewingAllNativeEvents());
popup.setPreviewingAllNativeEvents(false);
assertFalse(popup.isPreviewingAllNativeEvents());
+
+ // setVisible
+ assertTrue(popup.isVisible());
+ popup.setVisible(false);
+ assertFalse(popup.isVisible());
+ popup.setVisible(true);
+ assertTrue(popup.isVisible());
+
+ // isShowing
+ assertFalse(popup.isShowing());
+ popup.show();
+ assertTrue(popup.isShowing());
+ popup.hide();
+ assertFalse(popup.isShowing());
+ }
+
+ public void testAutoHidePartner() {
+ final PopupPanel popup = new PopupPanel();
+
+ // Add a partner
+ DivElement partner0 = Document.get().createDivElement();
+ popup.addAutoHidePartner(partner0);
+ popup.addAutoHidePartner(Document.get().createDivElement());
+
+ // Remove a partner
+ popup.removeAutoHidePartner(partner0);
}
/**
diff --git a/user/test/com/google/gwt/user/client/ui/SuggestBoxTest.java b/user/test/com/google/gwt/user/client/ui/SuggestBoxTest.java
new file mode 100644
index 0000000..82546d8
--- /dev/null
+++ b/user/test/com/google/gwt/user/client/ui/SuggestBoxTest.java
@@ -0,0 +1,123 @@
+/*
+ * Copyright 2009 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.user.client.ui;
+
+import com.google.gwt.junit.client.GWTTestCase;
+
+import java.util.Arrays;
+
+/**
+ * Tests for {@link SuggestBoxTest}.
+ */
+public class SuggestBoxTest extends GWTTestCase {
+
+ @Override
+ public String getModuleName() {
+ return "com.google.gwt.user.User";
+ }
+
+ /**
+ * Test the basic accessors.
+ */
+ public void testAccessors() {
+ SuggestBox box = createSuggestBox();
+
+ // setLimit
+ box.setLimit(5);
+ assertEquals(5, box.getLimit());
+
+ // setSelectsFirstItem
+ box.setSelectsFirstItem(true);
+ assertTrue(box.getSelectsFirstItem());
+ box.setSelectsFirstItem(false);
+ assertFalse(box.getSelectsFirstItem());
+
+ // isSuggestionListShowing
+ assertFalse(box.isSuggestionListShowing());
+ box.showSuggestions("test");
+ assertTrue(box.isSuggestionListShowing());
+ }
+
+ public void testShowAndHide() {
+ SuggestBox box = createSuggestBox();
+ assertFalse(box.isSuggestionListShowing());
+ // should do nothing, box is not attached.
+ box.showSuggestionList();
+ assertFalse(box.isSuggestionListShowing());
+
+ // Adds the suggest box to the root panel.
+ RootPanel.get().add(box);
+ assertFalse(box.isSuggestionListShowing());
+
+ // Hides the list of suggestions, should be a no-op.
+ box.hideSuggestionList();
+
+ // Should try to show, but still fail, as there are no default suggestions.
+ box.showSuggestionList();
+ assertFalse(box.isSuggestionListShowing());
+
+ // Now, finally, should be true
+ box.setText("t");
+ box.showSuggestionList();
+ assertTrue(box.isSuggestionListShowing());
+
+ // Hides it for real this time.
+ box.hideSuggestionList();
+ assertFalse(box.isSuggestionListShowing());
+ }
+
+ public void testDefaults() {
+ MultiWordSuggestOracle oracle = new MultiWordSuggestOracle();
+ oracle.setDefaultSuggestionsFromText(Arrays.asList("A", "B"));
+ SuggestBox box = new SuggestBox(oracle);
+ RootPanel.get().add(box);
+ box.showSuggestionList();
+ assertTrue(box.isSuggestionListShowing());
+ assertEquals(2, box.getSuggestionCount());
+ assertEquals("A", box.getSuggestion(0).getReplacementString());
+ assertEquals("B", box.getSuggestion(1).getReplacementString());
+ }
+
+ public void testShowFirst() {
+ SuggestBox box = createSuggestBox();
+ assertTrue(box.getSelectsFirstItem());
+ SuggestBox box2 = createSuggestBox();
+ assertTrue(box2.getSelectsFirstItem());
+ box.setSelectsFirstItem(false);
+ assertFalse(box.getSelectsFirstItem());
+ box.setText("t");
+ box.showSuggestionList();
+ // Todo(ecc) once event triggering is enabled, submit a return key to the
+ // text box and ensure that we see the correct behavior.
+ }
+
+ @Override
+ public void gwtTearDown() throws Exception {
+ super.gwtTearDown();
+ RootPanel.get().clear();
+ }
+
+ protected SuggestBox createSuggestBox() {
+ MultiWordSuggestOracle oracle = new MultiWordSuggestOracle();
+ oracle.add("test");
+ oracle.add("test1");
+ oracle.add("test2");
+ oracle.add("test3");
+ oracle.add("test4");
+ oracle.add("john");
+ return new SuggestBox(oracle);
+ }
+}