I created a widget called "Heading" which wraps the text in the appropriate <h1></h1> HTML tag.
The contents of the JAR file look like this:
META-INF/
META-INF/MANIFEST.MF
org/
org/hanson/
org/hanson/gwt/
org/hanson/gwt/client/
org/hanson/gwt/client/Heading.class
org/hanson/gwt/client/Heading.java
org/hanson/gwt/Components.gwt.xml
The widget class AND source must be in the "client" package (you can change this in the
gwt.xml file if needed). The source must be present for the compiler to generate the JavaScript.
The structure of the JAR, in general, should be like this:
some.package.MyName.gwt.xml (project properties)
some.package.client.* (code to be compiled to JavaScript)
some.package.public.* (images or other files)
some.package.xyz.* (anything else)
==== The source for the Heading widget ====
package org.hanson.gwt.client;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.ui.Widget;
public class Heading extends Widget
{
public Heading ()
{
setElement(DOM.createElement("h1"));
setStyleName("rhw-heading");
}
public void setText (String s)
{
DOM.setInnerText(getElement(), s);
}
}
==== contents of Components.gwt.xml ====
<module>
<inherits name='com.google.gwt.user.User'/>
</module>
NOTE: If you have your client code somewhere other than the "client" Java package, you need to speficify that here. Same goes for the "public" package. (See
http://makeashorterlink.com/?G4332572D)
To use this JAR in your project you need to make a few changes:
1. Alter your *gwt.xml project file to reference the project file in the JAR.
Example:
<module>
<!-- Inherit the core Web Toolkit stuff -->
<inherits name='com.google.gwt.user.User'/>
<!-- ** ADD THIS ** Inherit the stuff from the jar ** ADD THIS ** -->
<inherits name='org.hanson.gwt.Components'/>
<!-- Specify the app entry point class. -->
<entry-point class='org.hanson.gwt.client.MyApplication/>
</module>
2. Edit the
MyApplication-shell.cmd and MyApplication-compile.cmd scripts, add the jar to the classpath.
That should be it.
You should take a look at the gwt-user jar. You will find several project files in there, including
com.google.gwt.user.User. You will see that this file references other projects, some of which use some currently undocumented tags. Note that for each project in the gwt-user.jar file there is a "client" package, and optionally a "local" package. You will see that the images for the Tree widget are in one of the "local" packages.
Anyway, let me know if that helps.