Creating a RAP renderer for a custom GUI element [message #1061819] |
Tue, 04 June 2013 08:52 |
Urs Beeli 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?
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03146 seconds