The css resource needs to be injected manually.
public class HelloWorld implements EntryPoint {
/* (non-Javadoc)
* @see com.google.gwt.core.client.EntryPoint#onModuleLoad()
*/
@Override
public void onModuleLoad() {
==> StyleInjector.injectStylesheet(HelloWorldResources.INSTANCE.css
().getText());
HTML html = new HTML("Hello World!");
html.setStyleName(HelloWorldResources.INSTANCE.css().message());
RootPanel.get().add(html);
}
On Jun 28, 2:03 am, uwfrog <[email protected]> wrote:
> I have been trying to get ClientBundle working over the weekend. I got
> the css selector obfuscation working, however, the browser somehow is
> not showing what is specified in the css file. Is there someone could
> help me out? Here is what i did. It is a minimum hello world setup
> with a css selector to style the "hello world" text to color blue. I
> managed to get the following in the browser.
>
> <html><head></head>
> <div id="_firebugConsole" style="display: none;"
> FirebugVersion="1.3.3"/>
> <body>
> <iframe id="helloworld" src="javascript:""" style="border: medium
> none ; position: absolute; width: 0pt; height: 0pt;"
> tabindex="-1">...</iframe>
> <div class="G1rue18xAC">Hello World!</div>
> </body>
> <script type="text/javascript">...</script>
> </html>
>
> As you could see, the "Hello World!" is of a class with obfuscated
> name which is the same i see from the debug console. However, browser
> is not showing the text in blue. Am i missing anything? (I am using
> ClientBundle code from trunk. Please see the source code attached.)
>
> com.aqy.lab.helloworld.gwt.xml
> =========================
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 1.6.4//
> EN" "http://google-web-toolkit.googlecode.com/svn/tags/1.6.4/distro-
> source/core/src/gwt-module.dtd">
> <module rename-to="helloworld">
> <inherits name="com.google.gwt.user.User" />
> <inherits name='com.google.gwt.user.theme.standard.Standard' />
> <inherits name="com.google.gwt.resources.Resources" />
> <entry-point class='com.aqy.lab.client.helloworld.HelloWorld' />
> </module>
>
> com.aqy.lab.helloworld.HelloWorld
> ===========================
> public class HelloWorld implements EntryPoint {
> @Override
> public void onModuleLoad() {
> HTML html = new HTML("Hello World!");
>
> html.setStyleName(HelloWorldResources.INSTANCE.css().message());
>
> RootPanel.get().add(html);
> }
>
> }
>
> com.aqy.lab.helloworld.HelloWorldCss
> ============================
> public interface HelloWorldCss extends CssResource {
> String message();
>
> }
>
> com.aqy.lab.helloworld.HelloWorldResources
> =================================
> public interface HelloWorldResources extends ClientBundle {
> static final HelloWorldResources INSTANCE = GWT.create
> (HelloWorldResources.class);
>
> @Source("com/aqy/lab/client/helloworld/helloworld.css")
> HelloWorldCss css();
>
> }
>
> com.aqy.lab.client.helloworld/helloworld.css
> ================================
> .message {
> color: blue;
>
> }
>
> helloworld.html
> ======================
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
> <html>
> <head>
> <meta http-equiv="content-type" content="text/html;
> charset=UTF-8">
> <title>Hello World</title>
> <script type="text/javascript" language="javascript"
> src="helloworld/helloworld.nocache.js"></script>
> </head>
> <body>
> </body>
> </html>
>
> Thanks in advance!
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---