Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Forms with RAP/RWT 2.0
Forms with RAP/RWT 2.0 [message #1009617] Fri, 15 February 2013 11:43 Go to next message
Sebastian Bauer is currently offline Sebastian BauerFriend
Messages: 25
Registered: July 2009
Junior Member
I'm trying to develop an WebApp with RWT standalone. With RAP/RWT 1.5, I was able to add FormText support to an RWT application like this:
 application.addResource(new ToggleHyperlinkResource());

With RAP/RWT 2.0, addResource() seems to have changed. Unfortunately, there is no Javadoc for addResource() so I can only guess the semantic.

I've tried now:
 application.addResource("org/eclipse/ui/forms/widgets/FormText.js",ThemeManager.STAN
DARD_RESOURCE_LOADER);


This successfully copies the .js file somewhere to the web-app/rwt-resources directory. But any uses of FormText class still result in
 Error: Error: Operation "create" on target "w6" of type "null" failed:
 No Handler for type forms.widgets.FormText


I guess that the content of the .js was not read by the client. What is the best way to make this working again with RAP/RWT 2.0?

Thanks in advance!
Re: Forms with RAP/RWT 2.0 [message #1010135 is a reply to message #1009617] Sat, 16 February 2013 16:45 Go to previous messageGo to next message
Sebastian Bauer is currently offline Sebastian BauerFriend
Messages: 25
Registered: July 2009
Junior Member
Okay, I found out how it works. In addition to the addResource() call that can be seen in my initial question, it seems that one also need to call
RWT.getClient().getService(JavaScriptLoader.class).require(src)

in the UI context (e.g., early in createContents). The src is the path to the .js file (I had to prepend it by "rwt-resources/")
Re: Forms with RAP/RWT 2.0 [message #1011092 is a reply to message #1010135] Mon, 18 February 2013 20:52 Go to previous message
Ralf Sternberg is currently offline Ralf SternbergFriend
Messages: 1295
Registered: July 2009
Senior Member

Great that you managed to figure that out! You code worked in 1.5
because of a workaround in the ResourceManager that treated all *.js
resources as JavaScript and automatically loaded them on the client.

I've opened a bug [1] suggesting that we exploit the new
JavaScriptLoader in the Forms bundle to register and load the JavaScript
on demand. With this change, the forms bundles will work out of the box.

Regards, Ralf

[1] https://bugs.eclipse.org/bugs/show_bug.cgi?id=401126

--
Ralf Sternberg

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Previous Topic:Adding composite above menubar when using PlatformUI.createAndRunWorkbench(display, advisor)
Next Topic:RAP Table: Row sometimes empty
Goto Forum:
  


Current Time: Fri Dec 19 03:26:58 GMT 2014

Powered by FUDForum. Page generated in 0.10580 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software