Twitter Logo Follow us on Twitter
Project Information About this project

RAP 2.2 - New and Noteworthy

Here's a list of the most noteworthy things in the RAP 2.2 release which is available for download since December 20, 2013.

Updating from RAP 1.5 (Eclipse Juno)?

You may also check the New and Noteworthy for RAP 2.0 and the RAP 2.0 migration guide.

Widget Set

Row Templates

We introduced row templates, a new feature that allows you replace the column layout model of a table ore tree with a custom presentation. Templates consist of cells that can be freely arranged. A cell can display a text or an image from the table item, but also static content.

A table with row template

To apply a row template on a Table or a Tree, use the setData() method with the new constant RWT.ROW_TEMPLATE as key:

Table table = new Table( parent, SWT.FULL_SELECTION );
// Add as many columns as a single table item will have texts/images:
new TableColumn();
Template template = new Template();
// ... create template cells here, the set the template:
table.setData( RWT.ROW_TEMPLATE, template );

To position a cell, you have to set exactly two horizontal and two vertical dimensions (two out of left, right, and width and two out of top, bottom, and height). Cells can also be selectable. When a selectable cell is clicked it does not mark the the item itself as selected. Item selection is still possible (clicking anywhere but on a selectable cell), but only visualized if the SWT.FULL_SELECTION flag is set.

Row templates are currently supported by Tree and Table, but we plan to apply this concept on other widgets in the future. All details are covered in the Developer's Guide article on Tree and Table Enhancements.

FileUpload supports Multiple File Selection

The FileUpload widget now allows selecting and uploading multiple files at once in HTML5 enabled browsers. To enable this feature, create the widget with the SWT.MULTI style flag like this:

  FileUpload fileUpload = new FileUpload( parent, SWT.MULTI );

To obtain the filenames from the widget, the method getFileNames has been introduced. The method getFileName still exists and will return the first selected file.

In browsers that do not support this feature (such as Internet Explorer 8) the MULTI flag will simply be ignored.

The RAP Incubator file upload component and the FileDialog implementation have been updated to make use of this new feature.

Modernized ToolTips

The look and feel of tooltips has been improved and fine-tuned:

  • ToolTips for buttons, items and fields will now be placed above/below (in some cases besides) the widget and they have a little pointer pointing to the widget. See also “Revised and Extended ToolTip Theming”.
  • ToolTips generated by the setToolTipText method appear faster than before. The exact delay is adjusted to the widget type.
  • ToolTips will no longer disappear automatically after a short timeout. The exact conditions for them to disappear depend on the widget, but they will always disappear when the mouse is moved away from the widget or when a key is pressed.
  • Appear and disappear animations are skipped when they are not needed.

Markup Support for ToolTips

The ToolTipText property and the ToolTip widget now support markup, including hyperlinks. To enable tooltip markup for on any widget with a setToolTipText method, use the RWT.TOOLTIP_MARKUP_ENABLED constant like this:

widget.setData( RWT.TOOLTIP_MARKUP_ENABLED, Boolean.TRUE );
widget.setToolTipText( "This is a tooltip<br/><i>with</i> <b>some</b> <big>markup</big>" );

For the ToolTip widget, the API is the same as it is for other widget:

toolTip.setData( RWT.MARKUP_ENABLED, Boolean.TRUE );

Pre-load items in virtual Tree and Table

To improve the responsiveness of a virtual Tree or Table, we added the possibility to specify a number of items to be pre-loaded by the client. When scrolling the table in small steps, pre-loaded items will appear immediately. Example:

Table table = new Table( parent, SWT.VIRTUAL );
table.setData( RWT.PRELOADED_ITEMS, new Integer( 10 ) );

With this snippet, in addition to visible items in the Tree/Table client area, another 10 items (above and below) will be resolved and sent to the client.

RWT Scripting

Migrated ClientScripting to RAP Core

The ClientScripting project has been graduated from the incubator and is now included in the RAP core as “RWT Scripting”. Using the new ClientListener class, it is possible to handle some events directly on the client without the usual latency caused by HTTP requests.

The following widgets support ClientListener:

  • Button
  • Canvas
  • Combo
  • Composite
  • Label
  • ProgressBar
  • Scale
  • Spinner
  • Text

Supported events are:

  • SWT.Verify
  • SWT.Modify
  • SWT.KeyDown
  • SWT.KeyUp
  • SWT.FocusIn
  • SWT.FocusOut
  • SWT.Hide
  • SWT.Show
  • SWT.MouseDown
  • SWT.MouseUp
  • SWT.MouseMove
  • SWT.MouseEnter
  • SWT.MouseExit
  • SWT.MouseWheel
  • SWT.MouseDoubleClick
  • SWT.Paint

Consult the new Developers Guide Scripting article for information on ClientListener, and the WebClient API reference to find out what widget methods are available in RWT Scripting.

Note: The ClientScripting incubator project is no longer compatible with RAP 2.2 and must be used only with older RAP versions. If you port code based on the incubator ClientScripting to RAP 2.2 Scripting, please note that the namespace for ClientListener has been changed to org.eclipse.rap.rwt.scripting. Also, the number of supported widgets and methods has been reduced, but in return the properties are now always synchronized back to the server.

Synchronize user data with the client

Data attached to an SWT widget can now be transferred to the client to access it in scripting. To do so, the key for that data has to be registered with WidgetUtil.registerDataKeys. Example:

WidgetUtil.registerDataKeys( "foo" );
widget.setData( "foo", "bar" );

A ClientListener can use the data like this:

function handleEvent( event ) {
  var data = event.widget.getData( "foo" );
}

This feature can also be used to access other scriptable widgets within a ClientListener.

Application Context

Application Context Listener

Instances of ApplicationContextListener can be attached to an application context to receive a notification before the application context is destroyed.

Client Services

Improved JavaScriptLoader

The JavaScriptLoader implementation has been improved in the following aspects:

  • Files can be loaded from any URL: Previously the JavaScriptLoader could only load scripts served by the RAP application, e.g. by registering them with the resource manager. Now any URL that is accessible by the client can be used.
  • Browser no longer blocked during loading: The JavaScriptLoader now uses asynchronous HTTP request to load the JavaScript file, which means the browser no longer becomes unresponsive while waiting for the request to finish.
  • Scripts appear in Browser Developer Tools: Previously the loaded scripts did not appear in the "sources" or "scripts" tabs of the browser debugger (e.g. Firebug).

Theming

Revised and Extended ToolTip Theming

We've polished the look and feel of tooltips in the default theme (see above). To do so, a new theming element has been introduced: Widget-ToolTip-Pointer. This element has a single property background-image and four states, up, down, left, and right. This property allows to attach a pointer image to one edge of the ToolTip. The state indicates the direction that the ToolTip points to. The image should match the background and/or border color of the ToolTip theming. A full set of four images would be defined like this:

Widget-ToolTip-Pointer {
  background-image: none;
}

Widget-ToolTip-Pointer:up {
  background-image : url( tooltip-up.png );
}

Widget-ToolTip-Pointer:down {
  background-image : url( tooltip-down.png );
}

Widget-ToolTip-Pointer:left {
  background-image : url( tooltip-left.png );
}

Widget-ToolTip-Pointer:right {
  background-image : url( tooltip-right.png );
}

It is now also possible to set the horizontal alignment for texts in tooltips.

Widget-ToolTip {
  text-align: left;
}

Since tooltips are only as wide as their content, this only has a visible effect if the tooltip has a newline in it, e.g.:

widget.setToolTipText( "This has a \n new line" );

The default value is center.

Other Theme Extensions

The theming was extended in several other places:

  • ProgressBar has a new themeable property width.
  • box-shadow property has been added to Button.
  • The theming for Table and Tree has a new state rowtemplate to allow to make adjustments specific to row templates. The default theme uses this state to set vertical instead of horizontal grid lines when row templates are used.

Deployment

WAR Undeployment issues resolved

There has long been an issue with RAP applications deployed as .war files that could not be properly stopped or undeployed and even prevented the servlet container from shutting down. These problems have been fixed. Stopping and undeploying RAP applications works as expected now.

Bugfixes

This list shows all bugs that have been fixed for this release.