It defi seems like a path issue. So basically when you use multiple modules and try to load dynamically css in the module which does not implement EntryPoint, the JSNI method does not seem to work.
Any pointers on a fix for the same? Thanks On Fri, Feb 19, 2010 at 4:11 PM, Ashish Khivesara < [email protected]> wrote: > I am trying to do the same thing. However it does not seem to work. > In my setup I have multiple modules. One module has an entry point and > other modules do not. I try to load css in the module that does not have an > entry point. The css is located in war/ directory. > > I get Warning 404 in the console. Not sure what's happening here. > > Thanks > > On Thu, Jul 23, 2009 at 9:23 PM, Rick <[email protected]> wrote: > >> >> Hi Adam >> >> Thanks a lot. Its working fine now. >> >> On Jul 24, 2:50 am, Adam T <[email protected]> wrote: >> > Hi Rick, >> > >> > The last line in your native method should read: >> > >> > $doc.getElementsByTagName("head")[0].appendChild(fileref); >> > >> > As GWT uses $doc to refer to the pages document. See: >> http://code.google.com/webtoolkit/doc/1.6/DevGuideCodingBasics.html#D... >> > >> > //Adam >> > >> > On 23 Juli, 15:03, Rick <[email protected]> wrote: >> > >> > > Hi All >> > >> > > I am building an application using GWT 1.6. In my application I need >> > > to load external stylesheet at runtime. But its not working. I am able >> > > to load stylesheet in an independent html file. But when I am using >> > > same with GWT, its not reflecting. Below is a sample code to produce >> > > this case. Any help/suggestion will be highly appriciated. >> > >> > > StyleSheetEntryPoint.java >> > >> > > package com.example.foo.client; >> > > import com.google.gwt.core.client.EntryPoint; >> > > import com.google.gwt.user.client.ui.HTML; >> > > import com.google.gwt.user.client.ui.RootPanel; >> > >> > > public class StyleSheetEntryPoint implements EntryPoint { >> > >> > > public void onModuleLoad() { >> > > loadStyleSheet(); >> > > HTML html = new HTML("Hello"); >> > > html.setStyleName("sendButton"); >> > > RootPanel.get().add(html); >> > > } >> > >> > > public static native void loadStyleSheet()/*-{ >> > > var fileref=document.createElement("link"); >> > > fileref.setAttribute("rel", "stylesheet"); >> > > fileref.setAttribute("type", "text/css"); >> > > fileref.setAttribute("href", "Component.css"); >> > > >> document.getElementsByTagName("head")[0].appendChild(fileref); >> > > }-*/; >> > >> > > } >> > >> > > Component.css >> > > .sendButton {font-weight:bold;font-size: 16pt;} >> > >> > > Following HTML is giving me expected behaviour. >> > > <html> >> > > <head> >> > > <script type="text/javascript"> >> > > function loadCSS(){ >> > > var fileref=document.createElement("link"); >> > > fileref.setAttribute("rel", "stylesheet"); >> > > fileref.setAttribute("type", "text/css"); >> > > fileref.setAttribute("href", "Component.css"); >> > > >> document.getElementsByTagName("head")[0].appendChild(fileref);} >> > >> > > </script> >> > > </head> >> > > <body onload="loadCSS()"> >> > > <DIV class="sendButton">Hello</DIV> >> > > </body> >> > > </html> >> > >> > > Thanks and regards >> > >> > > Rick >> --~--~---------~--~----~------------~-------~--~----~ >> 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]<google-web-toolkit%[email protected]> >> For more options, visit this group at >> http://groups.google.com/group/Google-Web-Toolkit?hl=en >> -~----------~----~----~----~------~----~------~--~--- >> >> > -- 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.
