HTML Code Generation

45 views
Skip to first unread message

HK

unread,
Mar 17, 2012, 12:52:43 PM3/17/12
to Google Web Toolkit
Hello!
I have created some Widgets with GWT Designer in Eclipse. Now I would
like to get to the HTML code, GWT produces, programmatically (not the
events, just the code of the static pages). You can get this code by
calling UIObject.toString() but this works only running the compiled
code in a web browser. But I was not able to get this code calling
compiled JAVA Code (getting the error: "GWT.create() is only usable in
client code!"). Is there any way to get around this or any other way
producing the static html code of a widget with a JAVA program?
Thanks in advance

Joseph Lust

unread,
Mar 18, 2012, 2:11:54 PM3/18/12
to google-we...@googlegroups.com
HK,

Have you tried calling that function from inside a GWTTestCase? You could use that to pull out the HTML without a browser.

Sincerely,
Joseph

HK

unread,
Mar 19, 2012, 9:35:18 AM3/19/12
to Google Web Toolkit
Thank you for your response!
I tried this and now I can call toString(). But how can I call basic
JAVA Methods? For example how can I write the generated HTML Code to a
File? Using java.io.File I get an error when executing the GWT JUnit
Test:
[ERROR] Line 41: No source code is available for type java.io.File;
did you forget to inherit a required module?
This error appears for every JRE class I try to use.

JoseM

unread,
Mar 19, 2012, 11:06:23 AM3/19/12
to google-we...@googlegroups.com
Those tests run as if they were really running on a web browser (because they are). You would need to send it back to the "server" using RPC or RF or whatever else you want.

HK

unread,
Mar 19, 2012, 3:17:51 PM3/19/12
to Google Web Toolkit
Thank you! That brings me a step forward.
Now I have a RPC service that loops over class names and returns some
annotated classes that extend UIObject:
public ArrayList<Class<? extends UIObject>> getClassNames();
But neither can I return a List of Classes
(com.google.gwt.user.client.rpc.SerializationException: Type
'java.lang.Class' was not included in the set of types which can be
serialized by this SerializationPolicy or its Class object could not
be loaded. For security purposes, this type will not be serialized.)
nor can I instantiate a class by name in my GWTTestCase extending
class.
Reply all
Reply to author
Forward
0 new messages