Revision: 6040
Author: fredsa
Date: Sun Aug 30 17:49:50 2009
Log: Edited wiki page through web user interface.
http://code.google.com/p/google-web-toolkit/source/detail?r=6040
Modified:
/wiki/ImageBundleDesign.wiki
=======================================
--- /wiki/ImageBundleDesign.wiki Wed Mar 5 15:43:00 2008
+++ /wiki/ImageBundleDesign.wiki Sun Aug 30 17:49:50 2009
@@ -43,13 +43,18 @@
== ImageBundleGenerator and ImageBundle ==
The two key types are {{{ImageBundleGenerator}}} and {{{ImageBundle}}}.
+=== Additional Documentation ===
+The GWT 1.6 javadoc contains additional {{{ImageBundle}}} documentation:
+
+[http://google-web-toolkit.googlecode.com/svn/javadoc/1.6/com/google/gwt/user/client/ui/ImageBundle.html]
+
=== Defining an Image Bundle ===
This is a similar design to the
[http://code.google.com/webtoolkit/documentation/com.google.gwt.i18n.client.Constants.html
Constants] interface. {{{ImageBundle}}} is an empty tag interface that can
be extended to create custom image bundles.
Derived interfaces contain zero or more methods, each of which must have
* A return type of {{{AbstractImagePrototype}}}
* No parameters
- * An optional meta-data comment that specifies {[email protected]}}} that
names an image file in the module's classpath ^(should this be the public
path instead?)^. If {[email protected]}}} is not specified, then a file whose
base filename matches the method name itself is sought (the file extension
can be gif, png, or jpg, but if multiple such files are present, which file
is chosen is unspecified in the current implementation).
+ * An optional annotation that specifies {...@resource}}} that names an
image file in the module's classpath ^(should this be the public path
instead?)^. If {...@resource}}} is not specified, then a file whose base
filename matches the method name itself is sought (the file extension can
be gif, png, or jpg, but if multiple such files are present, which file is
chosen is unspecified in the current implementation).
For example, to create an image bundle for a word processor toolbar, you
could define an image bundle as follows:
{{{
@@ -62,14 +67,14 @@
/**
* Would bundle the file 'open-file-icon.gif' residing in the same
package as this type.
- * @gwt.resource open-file-icon.gif
*/
+ @Resource("open-file-icon.gif")
AbstractImagePrototype openFileIcon();
/**
* Would bundle the file 'savefile.gif' residing in the
package 'org.example.icons'.
- * @gwt.resource org/example/icons/savefile.gif
*/
+ @Resource("org/example/icons/savefile.gif")
AbstractImagePrototype saveFileIcon();
}
}}}
@@ -92,10 +97,11 @@
For the {{{ImageBundle}}}-compatible type {{{T}}} specified in
{{{GWT.create(T.class)}}},
the following must be true:
* {{{T}}} must be an interface, not a class.
- * All of the methods on {{{T}}} must conform to the required signature
(see above) and must specify {[email protected]}}} in a metadata comment.
+ * All of the methods on {{{T}}} must conform to the required signature
(see above)
+ * An optional {...@resource}}} annotation may be used to override the
default image filename.
The generated image bundle output file will
- * have same type "png"; files referenced via {[email protected]}}} will be
converted
+ * have same type "png"; files referenced via {...@resource}}} will be
converted
* be named {{{md5.cache.ext}}}, where {{{md5}}} is a hash of the bytes
in all the consistuent images and {{{ext}}} is the image file type
* be written into the output directory for the module (that is, the same
location into which compiled JS is written
@@ -138,15 +144,15 @@
public interface MyImageBundle extends ImageBundle {
/**
* The default icon if no locale-specific image is specified.
- * @gwt.resource help_icon.gif
*/
+ @Resource("help_icon.gif")
AbstractImagePrototype helpIcon();
/**
* The default icon if no locale-specific image is specified.
- * @gwt.resource compose_new_message_icon.gif
*/
+ @Resource("compose_new_message_icon.gif")
AbstractImagePrototype composeNewMessageIcon();
}
}}}
@@ -159,22 +165,22 @@
/**
* The English version of this icon.
- * @gwt.resource compose_new_message_icon_en.gif
*/
+ @Resource("compose_new_message_icon_en.gif")
AbstractImagePrototype composeNewMessageIcon();
}
public interface MyImageBundle_fr extends MyImageBundle {
/**
* The French version of this icon.
- * @gwt.resource help_icon_fr.gif
*/
+ @Resource("help_icon_fr.gif")
AbstractImagePrototype helpIcon();
/**
* The French version of this icon.
- * @gwt.resource compose_new_message_icon_fr.gif
*/
+ @Resource("compose_new_message_icon_fr.gif")
AbstractImagePrototype composeNewMessageIcon();
}
}}}
--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/Google-Web-Toolkit-Contributors
-~----------~----~----~----~------~----~------~--~---