Differences between RWT and SWT
Introduction to the RAP Widget Toolkit
At the core of RAP operates the RAP Widget Toolkit (RWT), which largely implements the same
API as the Standard Widget Toolkit (SWT). That is why many projects that build upon SWT
can run on RWT with little or no modifications. It can
also be used with or without the Eclipse 3.x
RWT refers only to this widget toolkit, while
RAP refers to the
project in its entirety, including its ports of JFace, Workbench and Forms, OSGI
integration, add-ons, Branding and Interaction Design API, tooling, demos and custom themes.
RWT implements most (40+)
SWT Widgets, including their events and layout manager. It also supports SWT-like
key and mouse event handling, drag and drop and painting (on Canvas).
If you are not already familiar with SWT, we recommend to first learn the SWT basics
(almost all valid for RWT) by reading the official documentation
and snippets provided by the
SWT project homepage.
A full reference specific to RWT can be found
Compatibility to SWT
RAP generally follows the rule
If it compiles, it works. That means that all SWT API
implemented in RWT is working within the requirements set by SWT.
If an SWT feature is not implemented, the corresponding API is also missing.
If this is the case, it is likely because it's hard or impossible to implement in RWT.
In some cases, SWT classes and methods are implemented as empty stubs to enable single-sourcing,
but only where this is a valid according of the SWT documentation of the API.
Examples are the accessibility API and some SWT constants that are marked as HINT.
SWT was developed for desktop applications, but RWT is used to build web applications.
For this reason, there are some features that SWT supports that RWT does not,
while RWT adds some features that are tailored to the specific requirements of web
However, RWT does not add any new API to the classes adopted from SWT.
All RWT-specific features are accessible by API in the namespace
Many are activated using a
method with a constant from the
class as the
table.setData( RWT.MARKUP_ENABLED, Boolean.TRUE )
Other additional features may be accessed via client services.
Notable Additional Features
Client Class and Client Services
All features specific to the RAP client (which is exchangeable)
are handled by the client class and the client services.
time zone offset.
Client interface and client services are documented in more detail
HTTP File Upload
Unlike SWT, RWT can not simply access the user's file system and read data from it.
Therefore RAP provides several ways to upload files within the RAP application. Read more
about it here.
Markup in Widgets
Several widgets in RWT support a subset of HTML in their text property.
Detailed information can be found here.
Tree and Table Enhancements
The RWT Tree and Table widgets provide a number of features not found in SWT.
This includes the possibility to exclude some columns from scrolling,
pre-caching of items, as well as support for templates, markup and advanced theming.
Find out more about it here.
widget enables simple and efficient input assist for text fields.
It is basically a pop-up list that can be attached to any Text widget.
It behaves very similar to Combo, but does not automatically change the content of
the widget it is attached to.
Instead it fires selection events that may be used to modify the value of the Text widget
A ready-to-use, enhanced auto-complete solution for text fields can be found in the
The component is called
and uses the DropDown widget internally.
In SWT, the default visual representation of an widget is determined by the operating
system. In RAP this is done by the
which can be adjusted by the developer using CSS.
RAP operates in a multi-user environment and provides some additional API that helps
dealing with the consequences.
An detailed introduction can be found here.
instead of Java. This may be used to implement features that require instantaneous user
feedback or rely heavily on key events. Read more about it in the
While the API for touch event handling and accessibility configuration is present in RWT,
it does not natively support either. This is a valid implementation according to the SWT
documentation. Accessibility in RAP may be achieved by
adding ARIA attributes though.
StyledText, Tracker, TaskBar, Tray
These widgets are currently not available in RWT. If you require a rich text editor in RAP,
take a look in the RAP Incubator and Wiki.
SWT can paint on any widget or image using a
while RAP only allows painting on the
In some cases the
methods may disregard the drawing order and overlap elements that are drawn later.
Some methods are unimplemented, including copyArea,
setClipping, setTransform, setInterpolation,
setLineDash and setXORMode.
Performance and results of a drawing operations can differ depending on the browser.
It is possible to use the native HTML5 Canvas directly instead of the SWT GC using RWT
Self-Drawing custom widgets.
Limitations in Dialogs:
When using the
JEE compatibility mode,
opening a dialog does not block program execution.
To obtain their return value, a callback must be registered using the RWT-specific class
Limitations of the Browser widget
widget is based on the HTML iframe element, there are some restrictions.
Detailed information can be found here.
Limitations in Mouse and Key Events
Mouse and Key Event Handling in RAP.
Limitations in Verify and Modify Events:
events are not fired instantaneously, but with a small delay, possibly
combining a number of changes into one event. Also, the values of the
currently always report the entire text to have changed.
these limitations do not exist.
Limitations in Drag and Drop
have no effect.
may be omitted while the mouse cursor is still in motion. When dragging files from the
clients OS (to drop on a drop target with ClientFileTransfer), feedback effects
are not renderd, operation types (move/copy/link) are ignored, and no DragEnter /
DragOver / DragLeave events are fired.
Limitations when using background threads
See articles Session access from a background thread
and Server Push.