Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Communication from RAP to JavaScript
Communication from RAP to JavaScript [message #528924] Thu, 22 April 2010 12:17 Go to next message
Maziar Khodaei is currently offline Maziar KhodaeiFriend
Messages: 25
Registered: July 2009
Junior Member
HI,

I have the following problem. In my RAP-Project I embedded a HTML-site, which included several js-Files.
I can send messages from JS to RAP. Actually I want open a dialog from JS in RAP and return the selected result from RAP to JS.
Is it possible and when yes, how can I do it?!

thx

Maziar
Re: Communication from RAP to JavaScript [message #528971 is a reply to message #528924] Thu, 22 April 2010 14:03 Go to previous messageGo to next message
Benjamin Muskalla is currently offline Benjamin MuskallaFriend
Messages: 338
Registered: July 2009
Senior Member
Hi Maziar,

did you take a look at the BrowserFunction API of the SWT Browser
widget? Maybe that could help you in that case.

Regards,
Ben

Maziar Khodaei wrote:
> HI,
>
> I have the following problem. In my RAP-Project I embedded a HTML-site,
> which included several js-Files.
> I can send messages from JS to RAP. Actually I want open a dialog from
> JS in RAP and return the selected result from RAP to JS.
> Is it possible and when yes, how can I do it?!
>
> thx
>
> Maziar


--
Benjamin Muskalla | EclipseSource Karlsruhe
http://www.eclipsesource.com | http://twitter.com/eclipsesource
Re: Communication from RAP to JavaScript [message #528991 is a reply to message #528924] Thu, 22 April 2010 14:46 Go to previous messageGo to next message
Maziar Khodaei is currently offline Maziar KhodaeiFriend
Messages: 25
Registered: July 2009
Junior Member
Hi Ben,

yes, I read the API of browser widget but unfortunately I couldn´t find any solution for this problem.

Regards,

Maziar
Re: Communication from RAP to JavaScript [message #529175 is a reply to message #528924] Fri, 23 April 2010 09:17 Go to previous messageGo to next message
Ralf Sternberg is currently offline Ralf SternbergFriend
Messages: 1313
Registered: July 2009
Senior Member

Hi Maziar,

you can use a PhaseListener to handle your custom requests on the
server. Some examples for the use of PhaseListeners can be found in the
RAP FAQ [1]. If this all becomes too messy, you could also consider
writing a custom widget. See the custom widget tutorial in the RAP
developer guide in your IDE or online [2].

Hope this helps,
Ralf

[1] http://wiki.eclipse.org/RAP/FAQ
[2]
http://help.eclipse.org/galileo/topic/org.eclipse.rap.help/h elp/html/advanced/custom-widget.html

Maziar Khodaei wrote:
> HI,
>
> I have the following problem. In my RAP-Project I embedded a HTML-site,
> which included several js-Files.
> I can send messages from JS to RAP. Actually I want open a dialog from
> JS in RAP and return the selected result from RAP to JS.
> Is it possible and when yes, how can I do it?!
>
> thx
>
> Maziar
Re: Communication from RAP to JavaScript [message #529511 is a reply to message #528991] Mon, 26 April 2010 08:52 Go to previous messageGo to next message
Erdal Karaca is currently offline Erdal KaracaFriend
Messages: 853
Registered: July 2009
Senior Member
If you would use an embedded Browser widget, you could point it to your custom HTML page by setting its url. Then, providing a browser function, you could use it to show that dialog and process its return value in your JS code:

--- js ---

<script .../>
<script .../>
<script>
  // execute Java by calling the browser function
  var returnValue = openComplexDialog();
  // process return value obtained by Java code
  alert(returnValue);
</script>


--- java ...
Browser b = ...
new MyBrowserFunction(b, "openComplexDialog")

class MyBrowserFunction:

Object function(Object[] args) {
  ComplexDialog d = new ComplexDialog(...);
  // calculate return value...
  return returnValue;
}

Re: Communication from RAP to JavaScript [message #529553 is a reply to message #528924] Mon, 26 April 2010 11:04 Go to previous message
Maziar Khodaei is currently offline Maziar KhodaeiFriend
Messages: 25
Registered: July 2009
Junior Member
Hi,

thank you Ralf and thank you Erdal for your tips. It´s work fine.
Thanks a lot Smile
Previous Topic:[Text widget][Context menu]
Next Topic:Not all requests from the client are send to the server through req.addParameter(...)?
Goto Forum:
  


Current Time: Tue Nov 30 02:34:44 GMT 2021

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

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

Back to the top