Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » RAP Protocol question
RAP Protocol question [message #1229393] Thu, 09 January 2014 10:59 Go to next message
Martin Tauber is currently offline Martin TauberFriend
Messages: 122
Registered: July 2009
Senior Member
Mayby someone could shed some light on this. I'm trying to embedd dhtmlx
charts as RAP Widgets. It does not seam to work for the folllowing reason:

1.) I've created the factory method to create the a "<div
id="whatever"/> html node which is added to the Rap parent element
passed to the constructor.

2.) Doing so seams not to add the created div object into the body of
the document. when I call a method to find the "whatever" id object in
the DOM it returns null. And this needs to be done to initialize the chart.

So I guess my question basically is: When is the DOM build? Can I force
it to be build?

I tryed to work around the problem by building my own init function
which is called from java after the creation of the object. But this did
not help. Debugging the javascript showed that the DOM is again not
build (including the created div in the body).

My next question would be. It seams that the rap protocol piggy bags
calls - or am I totally confused now - What is the trigger to for rap to
communicate with the client?

Any help appreciated!

Regards
Martin
Re: RAP Protocol question [message #1229436 is a reply to message #1229393] Thu, 09 January 2014 12:46 Go to previous messageGo to next message
Tim Buschtoens is currently offline Tim BuschtoensFriend
Messages: 396
Registered: July 2009
Senior Member
Hi.

> So I guess my question basically is: When is the DOM build? Can I force
> it to be build?

It's true that the HTML element may not be added to the parent DOM
element immediately, but it is after the protocol message has been
completely processed. Forcing that is not easily done.

It's hard to say what your problem is without any code. Could you post
your java and javascript constructors?

> My next question would be. It seams that the rap protocol piggy bags
> calls - or am I totally confused now - What is the trigger to for rap to
> communicate with the client?

The client calls the server whenever there is a relevant event like
selecting something that has a SelectionListener attached.

Greetings,
Tim

--
Tim Buschtöns

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

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: RAP Protocol question [message #1229460 is a reply to message #1229436] Thu, 09 January 2014 13:43 Go to previous messageGo to next message
Martin Tauber is currently offline Martin TauberFriend
Messages: 122
Registered: July 2009
Senior Member
HI here is the code


function Chart(properties) {
// create the html element
var parent = rap.getObject( properties.parent );
this.element = document.createElement( "div" );
this.element.setAttribute("style","width: 400px; height:400px;");
parent.append(this.element);

this.chart = new dhtmlXChart({
view: "pie",
container: this.element,
value: "#sales#",
label: "#year#"
});
}

so not much of a deal - but the new dhtmlXChart function uses
offsetwidth and offsethight to calculate the size of the canvas to draw
the chart on. These value are 0 when the div is still on it's own and
not appended to the document. This prevents the chart from being rendered.

Now I was thinking on working around the problem by moving the new
dhtmlXChart constructor into it's own method and calling it when I'm
sure the div (this.element) has been added to the body to ensure that
the offsetwidth and offsethight are correct. But I can't find were to
put it, since it get's piggy bagged when I call it directly after the
factory method (from java this codes looks something like this:

chart = new Chart(parent, SWT.NONE);
chart.init();

Any ideas?
Re: RAP Protocol question [message #1229466 is a reply to message #1229436] Thu, 09 January 2014 13:51 Go to previous messageGo to next message
Martin Tauber is currently offline Martin TauberFriend
Messages: 122
Registered: July 2009
Senior Member
I was just wondering if the render event could help me out here. But I
don't find any detailed information on this one.
Re: RAP Protocol question [message #1230248 is a reply to message #1229466] Sat, 11 January 2014 12:39 Go to previous messageGo to next message
Tim Buschtoens is currently offline Tim BuschtoensFriend
Messages: 396
Registered: July 2009
Senior Member
> I was just wondering if the render event could help me out here. But I
> don't find any detailed information on this one.

I added an FAQ entry for this issue:
https://wiki.eclipse.org/RAP/Custom_Widgets_FAQ#After_calling_Composite.append_my_Element_it_is_not_in_the_DOM

Greetings,
Tim

--
Tim Buschtöns

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

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: RAP Protocol question [message #1232173 is a reply to message #1230248] Thu, 16 January 2014 11:07 Go to previous message
Martin Tauber is currently offline Martin TauberFriend
Messages: 122
Registered: July 2009
Senior Member
Am 11.01.2014 13:39, schrieb Tim Buschtöns:
>> I was just wondering if the render event could help me out here. But I
>> don't find any detailed information on this one.
>
> I added an FAQ entry for this issue:
> https://wiki.eclipse.org/RAP/Custom_Widgets_FAQ#After_calling_Composite.append_my_Element_it_is_not_in_the_DOM
>
>
> Greetings,
> Tim
>
Thanks that helped :)
Previous Topic:Page is scrolled to the iframe with RAP application
Next Topic:Customization of Tab with the active view name
Goto Forum:
  


Current Time: Fri Mar 29 09:05:34 GMT 2024

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

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

Back to the top