Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Scout » Creating a RAP renderer for a custom GUI element
Creating a RAP renderer for a custom GUI element [message #1061819] Tue, 04 June 2013 08:52 Go to next message
Urs Beeli is currently offline Urs BeeliFriend
Messages: 573
Registered: October 2012
Location: Bern, Switzerland
Senior Member
The Howto on adding a custom GUI component described how to render that component using Swing. A while back I had managed to add a renderer for SWT (I added that to the howto).

For I while I have wanted to try adding this component to RAP clients, as well, and today I have finally found time to look into this.

To my surprise it was fairly easy to adapt my SWT renderer to RAP. However, one thing has me stumped:

In my SWT class I have the following code in initializeSwt():
  protected void initializeSwt(Composite parent) {
    m_mouseListener = new P_MouseListener();

    Composite container = getEnvironment().getFormToolkit().createComposite(parent);
    StatusLabelEx label = getEnvironment().getFormToolkit().createStatusLabel(container, getEnvironment(), getScoutObject());
    Canvas canvas = getEnvironment().getFormToolkit().createCanvas(container);

    canvas.addPaintListener(new P_PaintListener());
    canvas.addMouseMoveListener(m_mouseListener);
    canvas.addMouseListener(m_mouseListener);


However, doing the same for my RAP class in initializeUi:
  protected void initializeUi(Composite parent) {
    m_mouseListener = new P_MouseListener();

    Composite container = getUiEnvironment().getFormToolkit().createComposite(parent);
    StatusLabelEx label = getUiEnvironment().getFormToolkit().createStatusLabel(container, getScoutObject());
    Canvas canvas = getUiEnvironment().getFormToolkit().createCanvas(container);

    canvas.addPaintListener(new P_PaintListener());
    canvas.addMouseMoveListener(m_mouseListener);
    canvas.addMouseListener(m_mouseListener);

I get an error, telling me:
Quote:
The method addMouseTrackListener(RwtScoutDrawLineField.P_MouseListener) is undefined for the type Canvas


Yet, both classes use the same import:
import org.eclipse.swt.widgets.Canvas;


It seems that Canvas (through Composite and Scrollable) extends Control which defines these addXxx() methods.

After much serarching I discovered that the difference seems to be that in SWT both the Canvas and the Control classes are taken from org.eclipse.swt.win32.win32.x86.<version>.jar whereas for RAP they are taken from org.eclipse.rap.rwt.<version>.jar.

Is it usual that two libraries would implement classes with the same name and package but differing signatures?

I guess what it comes down to is that RAP does not support mouse-movement tracking because the browser does not report this back, is that correct?
Re: Creating a RAP renderer for a custom GUI element [message #1061824 is a reply to message #1061819] Tue, 04 June 2013 09:19 Go to previous messageGo to next message
Jeremie Bresson is currently offline Jeremie BressonFriend
Messages: 1252
Registered: October 2011
Senior Member
I think that is the initial idea from RAP and their RWT approach. The idea is that you exchange your SWT dependency for a RWT dependency and you get a web application.

In practice you need to handle all the small differences between SWT and RWT.

From what I understood, this vision is going to evolve:

* Since RAP 1.5 they introduced the RAP Protocol (see Remote The New "R" in RAP)

* They have started to experiment RAP Application without RWT: rap-lite

I hope this give you a better understanding.
Re: Creating a RAP renderer for a custom GUI element [message #1061825 is a reply to message #1061824] Tue, 04 June 2013 09:23 Go to previous message
Urs Beeli is currently offline Urs BeeliFriend
Messages: 573
Registered: October 2012
Location: Bern, Switzerland
Senior Member
Thanks for those links, they provide for interesting reading.

I have - in the meantime - updated the 3.8 howto with the RAP renderer (I didn't bother with the 3.7 howto, or should I have)?

[Updated on: Tue, 04 June 2013 09:24]

Report message to a moderator

Previous Topic:Scout And Hibernate
Next Topic:[Swing] SmartFields broken under certain conditions
Goto Forum:
  


Current Time: Fri Mar 29 12:38:16 GMT 2024

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

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

Back to the top