All,
I'm getting an exception trying to use CssResources and ClientBundle.
Admittedly, I'm completely new to it and don't really quite know what
I'm doing.
So, can someone explain to me why this doesn't work, and what exactly
it is that I'm doing wrong?
In any case, here's my code. Both classes exist in the package
com.gwttests.client, and the Style1.css file exists in
com.gwttests.client.css:
class MyClientBundle:
--------
package com.gwttests.client;
import com.google.gwt.core.client.GWT;
import com.google.gwt.resources.client.ClientBundle;
import com.google.gwt.resources.client.CssResource;
public interface MyClientBundle extends ClientBundle {
public final static MyClientBundle INSTANCE =
GWT.create(MyClientBundle.class);
@Source("css/Style1.css")
MyCssResource css();
public static interface MyCssResource extends CssResource {
String superSize();
}
}
--------
class TestClientBundleAndCssResources:
--------
package com.gwttests.client;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.RootPanel;
public class TestClientBundleAndCssResources implements EntryPoint {
static {
MyClientBundle.INSTANCE.css().ensureInjected();
}
public void onModuleLoad() {
RootPanel rootPanel = RootPanel.get();
rootPanel.clear();
Button button1 = new Button("First Button");
rootPanel.add(button1);
}
}
--------
Style1.css
--------
.gwt-Button {
background: black;
color: cyan;
}
.superSize {
font-size: 500%;
}
--------
Everything compiles just fine.
When I run in development mode and launch the given URL, I get the
following exception:
--------
16:20:58.462 [ERROR] [testclientbundleandcssresources] Unable to load
module entry point class
com.gwttests.client.TestClientBundleAndCssResources (see associated
exception for details)
java.lang.RuntimeException: Deferred binding failed for
'com.gwttests.client.MyClientBundle' (did you forget to inherit a
required module?)
at
com.google.gwt.dev.shell.GWTBridgeImpl.create(GWTBridgeImpl.java:53)
at com.google.gwt.core.client.GWT.create(GWT.java:97)
at com.gwttests.client.MyClientBundle.<clinit>
(MyClientBundle.java:9)
at
com.gwttests.client.TestClientBundleAndCssResources.<clinit>
(TestClientBundleAndCssResources.java:10)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at
com.google.gwt.dev.shell.ModuleSpace.loadClassFromSourceName(ModuleSpace.java:
654)
at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:
363)
at
com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:
200)
at
com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:
525)
at
com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:
363)
at java.lang.Thread.run(Thread.java:662)
Caused by: com.google.gwt.core.ext.UnableToCompleteException: (see
previous log entries)
at com.google.gwt.dev.shell.ModuleSpace.rebind(ModuleSpace.java:
595)
at
com.google.gwt.dev.shell.ModuleSpace.rebindAndCreate(ModuleSpace.java:
455)
at
com.google.gwt.dev.shell.GWTBridgeImpl.create(GWTBridgeImpl.java:49)
at com.google.gwt.core.client.GWT.create(GWT.java:97)
at com.gwttests.client.MyClientBundle.<clinit>
(MyClientBundle.java:9)
at
com.gwttests.client.TestClientBundleAndCssResources.<clinit>
(TestClientBundleAndCssResources.java:10)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at
com.google.gwt.dev.shell.ModuleSpace.loadClassFromSourceName(ModuleSpace.java:
654)
at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:
363)
at
com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:
200)
at
com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:
525)
at
com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:
363)
at java.lang.Thread.run(Thread.java:662)
-------
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.