Skip to main content



      Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Invoke rap application from another IFrame.
Invoke rap application from another IFrame. [message #780534] Wed, 18 January 2012 08:47 Go to next message
Eclipse UserFriend
Hi,
I have a requirement to invoke certain operations on my RAP application from another application.
Say I have 2 applications App1 and App2 of which App2 is my RAP application. I'm making the 2 communicate using javascript. On click of a button in App1, App2 is loaded in a separate IFrame(Have achieved this). On click of another button in App1 some other operation needs to be performed in App2.
Here I want to create a rap request for that operation. This operation in my RAP application is performed by a button click, so I thought of simulating the button mouse event which would eventually create a request (Request.js does it).

Problems :
1. There are javascript functions to simulate events, but I dont have the ID for the button in RAP as its getting a new ID each time. How to work around this problem?
2. I want some parameters to be a part of the request that would be created as a result of this mouse event. Is there a way I can pass this?

Or is there another approach I should be looking at to achieve the above?

Javascript ref to create event :
var fireOnThis = document.getElementById('someID');
var evObj = document.createEvent('MouseEvents');
evObj.initMouseEvent( 'click', true, true, window, 1, 12, 345, 7, 220, false, false, true, false, 0, null );
fireOnThis.dispatchEvent(evObj);



Re: Invoke rap application from another IFrame. [message #780771 is a reply to message #780534] Thu, 19 January 2012 05:34 Go to previous messageGo to next message
Eclipse UserFriend
Hi!

Am 18.01.2012 14:47, schrieb Amandeep Chahal:
> which App2 is my RAP application. I'm making the 2 communicate using
> javascript. On click of a button in App1, App2 is loaded in a separate

Have you considered doing the communication indirectly via server? That
would be the straight-forward way to do this.

> 1. There are javascript functions to simulate events, but I dont have
> the ID for the button in RAP as its getting a new ID each time. How to
> work around this problem?

In RAP itself there are no functions to do this, and you should know
that browser-native functions are not guaranteed to work (the same) on
all browser. In any case, you might want to look at:

WidgetUtil.CUSTOM_WIDGET_ID
and
WidgetUtil.ENABLE_UI_TESTS

2. I want some parameters to be a part of the
> request that would be created as a result of this mouse event. Is there
> a way I can pass this?

You should not add anything to the request yourself, it would result for
client and server to be out-of-sync.

Greetings,
Tim
Re: Invoke rap application from another IFrame. [message #780836 is a reply to message #780771] Thu, 19 January 2012 09:56 Go to previous messageGo to next message
Eclipse UserFriend
We need to add an unique ID for each of the UI components for our automation tests. You need a couple things:

1. Add "-Dorg.eclipse.rwt.enableUITests=true" in the VM argument for your run configuration.
2. Add code to attach an ID for the UI component. For example:

                Button button = new Button(group, SWT.PUSH | SWT.WRAP);
		button.setData(WidgetUtil.CUSTOM_WIDGET_ID, this.getClass().getName()
				+ "." + "pushbutton"); //$NON-NLS-1$ //$NON-NLS-2$
		button.setText("Push Button");
Re: Invoke rap application from another IFrame. [message #780952 is a reply to message #780836] Fri, 20 January 2012 02:21 Go to previous messageGo to next message
Eclipse UserFriend
Thanks for your replies Tim,Ronald.

Tim, You mentioned about communicating via the server. Can you elaborate a li'l more on this or provide pointers.
Regarding the javascript, I know I'll have to consider browser dependency. But I wonder what's the alternative..
Re: Invoke rap application from another IFrame. [message #781069 is a reply to message #780952] Fri, 20 January 2012 05:25 Go to previous messageGo to next message
Eclipse UserFriend
Hi.

I think the best way to achieve this is to send AJAX request from App1 to your special custom service handler on the server of App2. The service handler will call the function that you need to perform by clicking Button, etc. I guess Tim mentioned this approach.

Yury.
Re: Invoke rap application from another IFrame. [message #787138 is a reply to message #781069] Tue, 31 January 2012 02:51 Go to previous message
Eclipse UserFriend
Thanks for the responses. The approach using a custom service handler worked.
Re: Invoke rap application from another IFrame. [message #787141 is a reply to message #781069] Tue, 31 January 2012 02:51 Go to previous message
Eclipse UserFriend
Thanks for the responses. The approach using a custom service handler worked.
Previous Topic:Bug 346768 - [Table] Support markup for rich text in table items
Next Topic:RAP target installation failed to download the target.
Goto Forum:
  


Current Time: Fri May 16 12:10:52 EDT 2025

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

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

Back to the top