Moving ImageBundle into the ui subpackage.
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@1137 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/samples/kitchensink/src/com/google/gwt/sample/kitchensink/client/RichTextToolbar.java b/samples/kitchensink/src/com/google/gwt/sample/kitchensink/client/RichTextToolbar.java
index 4fd3d5a..5a93207 100644
--- a/samples/kitchensink/src/com/google/gwt/sample/kitchensink/client/RichTextToolbar.java
+++ b/samples/kitchensink/src/com/google/gwt/sample/kitchensink/client/RichTextToolbar.java
@@ -17,13 +17,13 @@
import com.google.gwt.core.client.GWT;
import com.google.gwt.i18n.client.Constants;
-import com.google.gwt.user.client.ImageBundle;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.AbstractImagePrototype;
import com.google.gwt.user.client.ui.ChangeListener;
import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HorizontalPanel;
+import com.google.gwt.user.client.ui.ImageBundle;
import com.google.gwt.user.client.ui.KeyboardListener;
import com.google.gwt.user.client.ui.ListBox;
import com.google.gwt.user.client.ui.PushButton;
diff --git a/samples/mail/src/com/google/gwt/sample/mail/client/Contacts.java b/samples/mail/src/com/google/gwt/sample/mail/client/Contacts.java
index dd7ab31..5e7314f 100644
--- a/samples/mail/src/com/google/gwt/sample/mail/client/Contacts.java
+++ b/samples/mail/src/com/google/gwt/sample/mail/client/Contacts.java
@@ -15,12 +15,12 @@
*/
package com.google.gwt.sample.mail.client;
-import com.google.gwt.user.client.ImageBundle;
import com.google.gwt.user.client.ui.AbstractImagePrototype;
import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HorizontalPanel;
+import com.google.gwt.user.client.ui.ImageBundle;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.PopupPanel;
import com.google.gwt.user.client.ui.SimplePanel;
diff --git a/samples/mail/src/com/google/gwt/sample/mail/client/Mailboxes.java b/samples/mail/src/com/google/gwt/sample/mail/client/Mailboxes.java
index d6e6279..0703379 100644
--- a/samples/mail/src/com/google/gwt/sample/mail/client/Mailboxes.java
+++ b/samples/mail/src/com/google/gwt/sample/mail/client/Mailboxes.java
@@ -15,9 +15,9 @@
*/
package com.google.gwt.sample.mail.client;
-import com.google.gwt.user.client.ImageBundle;
import com.google.gwt.user.client.ui.AbstractImagePrototype;
import com.google.gwt.user.client.ui.Composite;
+import com.google.gwt.user.client.ui.ImageBundle;
import com.google.gwt.user.client.ui.Tree;
import com.google.gwt.user.client.ui.TreeImages;
import com.google.gwt.user.client.ui.TreeItem;
diff --git a/samples/mail/src/com/google/gwt/sample/mail/client/TopPanel.java b/samples/mail/src/com/google/gwt/sample/mail/client/TopPanel.java
index 569d34d..7618146 100644
--- a/samples/mail/src/com/google/gwt/sample/mail/client/TopPanel.java
+++ b/samples/mail/src/com/google/gwt/sample/mail/client/TopPanel.java
@@ -15,7 +15,6 @@
*/
package com.google.gwt.sample.mail.client;
-import com.google.gwt.user.client.ImageBundle;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.AbstractImagePrototype;
import com.google.gwt.user.client.ui.ClickListener;
@@ -23,6 +22,7 @@
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Image;
+import com.google.gwt.user.client.ui.ImageBundle;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
diff --git a/user/src/com/google/gwt/user/ImageBundle.gwt.xml b/user/src/com/google/gwt/user/ImageBundle.gwt.xml
index 6ea0988..d50e04e 100644
--- a/user/src/com/google/gwt/user/ImageBundle.gwt.xml
+++ b/user/src/com/google/gwt/user/ImageBundle.gwt.xml
@@ -19,7 +19,7 @@
<!-- ClippedImagePrototype, which depends on ClippedImage -->
<inherits name="com.google.gwt.user.ClippedImage" />
- <generate-with class="com.google.gwt.user.rebind.ImageBundleGenerator">
- <when-type-assignable class="com.google.gwt.user.client.ImageBundle" />
+ <generate-with class="com.google.gwt.user.rebind.ui.ImageBundleGenerator">
+ <when-type-assignable class="com.google.gwt.user.client.ui.ImageBundle" />
</generate-with>
</module>
diff --git a/user/src/com/google/gwt/user/client/ui/DisclosurePanelImages.java b/user/src/com/google/gwt/user/client/ui/DisclosurePanelImages.java
index f957188..248c105 100644
--- a/user/src/com/google/gwt/user/client/ui/DisclosurePanelImages.java
+++ b/user/src/com/google/gwt/user/client/ui/DisclosurePanelImages.java
@@ -15,8 +15,6 @@
*/
package com.google.gwt.user.client.ui;
-import com.google.gwt.user.client.ImageBundle;
-
/**
* An {@link ImageBundle} that provides images for {@link DisclosurePanel}.
*/
@@ -25,14 +23,14 @@
/**
* An image indicating an open disclosure panel.
*
- * @return a prototye of this image
+ * @return a prototype of this image
*/
AbstractImagePrototype disclosurePanelOpen();
/**
* An image indicating a closed disclosure panel.
*
- * @return a prototye of this image
+ * @return a prototype of this image
*/
AbstractImagePrototype disclosurePanelClosed();
}
diff --git a/user/src/com/google/gwt/user/client/ImageBundle.java b/user/src/com/google/gwt/user/client/ui/ImageBundle.java
similarity index 99%
rename from user/src/com/google/gwt/user/client/ImageBundle.java
rename to user/src/com/google/gwt/user/client/ui/ImageBundle.java
index 3d3501a..b7877ca 100644
--- a/user/src/com/google/gwt/user/client/ImageBundle.java
+++ b/user/src/com/google/gwt/user/client/ui/ImageBundle.java
@@ -13,7 +13,7 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
-package com.google.gwt.user.client;
+package com.google.gwt.user.client.ui;
/**
* A tag interface that is used in the generation of image bundles. An image
diff --git a/user/src/com/google/gwt/user/client/ui/TreeImages.java b/user/src/com/google/gwt/user/client/ui/TreeImages.java
index d34f0fd..731295c 100644
--- a/user/src/com/google/gwt/user/client/ui/TreeImages.java
+++ b/user/src/com/google/gwt/user/client/ui/TreeImages.java
@@ -15,8 +15,6 @@
*/
package com.google.gwt.user.client.ui;
-import com.google.gwt.user.client.ImageBundle;
-
/**
* An {@link ImageBundle} that provides images for
* {@link com.google.gwt.user.client.ui.Tree}.
@@ -30,7 +28,7 @@
/**
* An image indicating an open branch.
*
- * @return a prototye of this image
+ * @return a prototype of this image
*/
AbstractImagePrototype treeOpen();
diff --git a/user/src/com/google/gwt/user/rebind/ImageBundleBuilder.java b/user/src/com/google/gwt/user/rebind/ui/ImageBundleBuilder.java
similarity index 99%
rename from user/src/com/google/gwt/user/rebind/ImageBundleBuilder.java
rename to user/src/com/google/gwt/user/rebind/ui/ImageBundleBuilder.java
index bbc65b3..0125995 100644
--- a/user/src/com/google/gwt/user/rebind/ImageBundleBuilder.java
+++ b/user/src/com/google/gwt/user/rebind/ui/ImageBundleBuilder.java
@@ -13,7 +13,7 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
-package com.google.gwt.user.rebind;
+package com.google.gwt.user.rebind.ui;
import com.google.gwt.core.ext.GeneratorContext;
import com.google.gwt.core.ext.TreeLogger;
diff --git a/user/src/com/google/gwt/user/rebind/ImageBundleGenerator.java b/user/src/com/google/gwt/user/rebind/ui/ImageBundleGenerator.java
similarity index 83%
rename from user/src/com/google/gwt/user/rebind/ImageBundleGenerator.java
rename to user/src/com/google/gwt/user/rebind/ui/ImageBundleGenerator.java
index 01761e9..46cb225 100644
--- a/user/src/com/google/gwt/user/rebind/ImageBundleGenerator.java
+++ b/user/src/com/google/gwt/user/rebind/ui/ImageBundleGenerator.java
@@ -13,7 +13,7 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
-package com.google.gwt.user.rebind;
+package com.google.gwt.user.rebind.ui;
import com.google.gwt.core.ext.Generator;
import com.google.gwt.core.ext.GeneratorContext;
@@ -23,42 +23,41 @@
import com.google.gwt.core.ext.typeinfo.JMethod;
import com.google.gwt.core.ext.typeinfo.NotFoundException;
import com.google.gwt.core.ext.typeinfo.TypeOracle;
+import com.google.gwt.user.rebind.ClassSourceFileComposerFactory;
+import com.google.gwt.user.rebind.SourceWriter;
import java.io.PrintWriter;
+import java.net.URL;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
-import java.net.URL;
/**
* Generates an implementation of a user-defined interface <code>T</code> that
- * extends {@link com.google.gwt.user.client.ImageBundle}.
+ * extends {@link com.google.gwt.user.client.ui.ImageBundle}.
*
* Each method in <code>T</code> must be declared to return
- * {@link com.google.gwt.user.client.ui.AbstractImagePrototype},
- * take no parameters, and optionally specify the metadata tag
- * <code>gwt.resource</code> as the name of an image that can be found in the
- * classpath. In the absence of the metatadata tag, the method name with an
- * extension of <code>.png, .jpg, or .gif</code> defines the name of the image,
- * and the image file must be located in the same package as <code>T</code>.
+ * {@link com.google.gwt.user.client.ui.AbstractImagePrototype}, take no
+ * parameters, and optionally specify the metadata tag <code>gwt.resource</code>
+ * as the name of an image that can be found in the classpath. In the absence of
+ * the metatadata tag, the method name with an extension of
+ * <code>.png, .jpg, or .gif</code> defines the name of the image, and the
+ * image file must be located in the same package as <code>T</code>.
*/
public class ImageBundleGenerator extends Generator {
- private static final String ABSTRACTIMAGEPROTOTYPE_QNAME =
- "com.google.gwt.user.client.ui.AbstractImagePrototype";
+ private static final String ABSTRACTIMAGEPROTOTYPE_QNAME = "com.google.gwt.user.client.ui.AbstractImagePrototype";
- private static final String CLIPPEDIMAGEPROTOTYPE_QNAME =
- "com.google.gwt.user.client.ui.impl.ClippedImagePrototype";
+ private static final String CLIPPEDIMAGEPROTOTYPE_QNAME = "com.google.gwt.user.client.ui.impl.ClippedImagePrototype";
- private static final String GWT_QNAME =
- "com.google.gwt.core.client.GWT";
+ private static final String GWT_QNAME = "com.google.gwt.core.client.GWT";
- private static final String IMAGEBUNDLE_QNAME = "com.google.gwt.user.client.ImageBundle";
+ private static final String[] IMAGE_FILE_EXTENSIONS = {"png", "gif", "jpg"};
+
+ private static final String IMAGEBUNDLE_QNAME = "com.google.gwt.user.client.ui.ImageBundle";
private static final String METADATA_TAG = "gwt.resource";
- private static final String [] IMAGE_FILE_EXTENSIONS = {"png", "gif", "jpg"};
-
public ImageBundleGenerator() {
}
@@ -86,8 +85,7 @@
}
private void generateImageMethod(TreeLogger logger,
- ImageBundleBuilder compositeImage,
- SourceWriter sw, JMethod method)
+ ImageBundleBuilder compositeImage, SourceWriter sw, JMethod method)
throws UnableToCompleteException {
String imageName = getImageUrlFromMetaDataOrMethodName(logger, method);
@@ -111,8 +109,8 @@
sw.print(Integer.toString(imageRect.width));
sw.print(", ");
sw.print(Integer.toString(imageRect.height));
- sw.println(");");
-
+ sw.println(");");
+
sw.print(decl);
sw.println(" {");
@@ -120,7 +118,7 @@
sw.indent();
sw.print("return ");
sw.print(singletonName);
- sw.println(";");
+ sw.println(";");
sw.outdent();
}
@@ -183,8 +181,7 @@
// Assume this is only called for valid methods.
private String getImageUrlFromMetaDataOrMethodName(TreeLogger logger,
- JMethod method)
- throws UnableToCompleteException {
+ JMethod method) throws UnableToCompleteException {
String[][] md = method.getMetaData(METADATA_TAG);
@@ -198,18 +195,21 @@
if (imageNameFromMetaData.indexOf("/") == -1) {
String pkgName = method.getEnclosingType().getPackage().getName();
// This construction handles the default package correctly, too.
- imageNameFromMetaData = pkgName.replace('.', '/') + "/" + imageNameFromMetaData;
+ imageNameFromMetaData = pkgName.replace('.', '/') + "/"
+ + imageNameFromMetaData;
}
// Make sure that the resource exists on the classpath. In the future,
// this code will have to be changed if images are loaded from the
// source path or public path.
- URL imageResourceURL = getClass().getClassLoader().getResource(imageNameFromMetaData);
+ URL imageResourceURL = getClass().getClassLoader().getResource(
+ imageNameFromMetaData);
if (imageResourceURL == null) {
logger.log(
TreeLogger.ERROR,
- "Resource " + imageNameFromMetaData +
- " not found on classpath (is the name specified as Class.getResource() would expect?)",
+ "Resource "
+ + imageNameFromMetaData
+ + " not found on classpath (is the name specified as Class.getResource() would expect?)",
null);
throw new UnableToCompleteException();
}
@@ -218,17 +218,19 @@
}
String imageNameFromMethod = null;
- String packageAndMethodName =
- method.getEnclosingType().getPackage().getName().replace('.', '/') +
- '/' + method.getName();
+ String packageAndMethodName = method.getEnclosingType().getPackage().getName().replace(
+ '.', '/')
+ + '/' + method.getName();
// There is no metadata available, so the image url will be generated from
// the method name with an image file extension.
for (int i = 0; i < IMAGE_FILE_EXTENSIONS.length; i++) {
- String possibleImageName = packageAndMethodName + '.' + IMAGE_FILE_EXTENSIONS[i];
+ String possibleImageName = packageAndMethodName + '.'
+ + IMAGE_FILE_EXTENSIONS[i];
// Check to see if the resource exists on the classpath for each possible
// image file extension. This code will have to be changed if images are
// loaded from the source path or the public path.
- URL imageResourceURL = getClass().getClassLoader().getResource(possibleImageName);
+ URL imageResourceURL = getClass().getClassLoader().getResource(
+ possibleImageName);
if (imageResourceURL != null) {
imageNameFromMethod = possibleImageName;
break;
@@ -249,8 +251,11 @@
logger.log(
TreeLogger.ERROR,
- "Resource " + packageAndMethodName + ".(" + errorStringBuf.toString() +
- ") not found on classpath (is the name specified as Class.getResource() would expect?)",
+ "Resource "
+ + packageAndMethodName
+ + ".("
+ + errorStringBuf.toString()
+ + ") not found on classpath (is the name specified as Class.getResource() would expect?)",
null);
throw new UnableToCompleteException();
}
@@ -290,8 +295,9 @@
}
String[][] md = method.getMetaData(METADATA_TAG);
- if ( (md.length > 1) || (md.length == 1 && md[0].length != 1)) {
- rejectedMethodsAndWhy.put(method,
+ if ((md.length > 1) || (md.length == 1 && md[0].length != 1)) {
+ rejectedMethodsAndWhy.put(
+ method,
"Expecting either no metadata tags, or one metadata tag of the form '@gwt.resource <resource-name>'");
}
}