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 05:59 Go to next message
Martin Tauber is currently offline Martin Tauber
Messages: 116
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 07:46 Go to previous messageGo to next message
Tim Buschtoens is currently offline Tim Buschtoens
Messages: 379
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 08:43 Go to previous messageGo to next message
Martin Tauber is currently offline Martin Tauber
Messages: 116
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 08:51 Go to previous messageGo to next message
Martin Tauber is currently offline Martin Tauber
Messages: 116
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 07:39 Go to previous messageGo to next message
Tim Buschtoens is currently offline Tim Buschtoens
Messages: 379
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 06:07 Go to previous message
Martin Tauber is currently offline Martin Tauber
Messages: 116
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:Submitting a form using POST
Next Topic:RAP - GEF integration
Goto Forum:
  


Current Time: Wed Jul 23 04:12:31 EDT 2014

Powered by FUDForum. Page generated in 0.03880 seconds