Monday, January 12, 2015

Re: JSNI - how to reference a CSS client bundle?


var lib = @com.ruchi.bundle.client.Resource::INSTANCE;
 var style = lib.@com.ruchi.bundle.client.Resource::button()();
 var css = style.@com.ruchi.bundle.client.Button::gwtbutton()();
 
i tried this but i got class cast exception.

Why do you write: style.@com.ruchi.bundle.client.Button::gwtbutton()()  ?? 

Your style variable is not of type Button, its a MyCssResource instance. Also the gwtbutton() method is probably not defined on your Button class and I think Eclipse should have marked that red (if you use the Google Eclipse Plugin).

 
hey i want to ask you one thing more while calling we have to write button()() or button() ?

You always have to use ()(). The first parenthesis contain the parameter signature while the second parenthesis contain the actual parameters. So if you have a method that takes a String parameter it would look like myMethod(Ljava/lang/String;)(myStringInstance). Read: http://www.gwtproject.org/doc/latest/DevGuideCodingBasicsJSNI.html 


Please write steps of code to explain exactly what should i do ?

No. If you fix the Button thing I mentioned above you are already done.


-- J.
 

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment