Twitter Logo Follow us on Twitter
Project Information About this project

RAP 2.1 M1 - New and Noteworthy

Here's a list of the most noteworthy things in the RAP 2.1 M1 milestone build which is available for download since March 22, 2013.

Widget Set

Listener Support on Markup Hyperlinks

Markup support for Tree and Table has been added in RAP 1.5. By using <a> tags you can add hyperlinks to your item text. In addition to “real” hyperlinks, that open a page in the browser, it is now also possible to let those hyperlinks trigger a selection event.

To do so, you have to set the target attribute to “_rwt”. Clicking on the link will trigger an SWT.Selection event with the details field set to the constant RWT.HYPERLINK.

Table table = new Table( parent, SWT.BORDER );
table.setData( RWT.MARKUP_ENABLED, Boolean.TRUE );
table.addSelectionListener( new SelectionAdapter() {
  public void widgetSelected( SelectionEvent event ) {
    if( event.detail == RWT.HYPERLINK ) {
      // event.text contains the value of hyperlink href attribute
    }
  }
} );
TableItem item = new TableItem( table, SWT.NONE );
item.setText( "<a href=\"edit-item\" target=\"_rwt\">edit\"</a>" );

Accelerator support for MenuItem

The SWT method MenuItem.setAccelerator( int ) has been implemented. This method can be used to bind key shortcuts to menu items easily. For example, the following statement will lead to a selection event being fired on the menu item when Ctrl+Shift+A is pressed.

menuItem.setAccelerator( SWT.CTRL | SWT.SHIFT | 'A' );

Please note that the browser already defines a number of key bindings. Some browsers do not allow to override all of these bindings.

Mnemonic support

Mnemonics are a simple method to select widgets using the keyboard. Support for mnemonics has been implemented for the following widgets: MenuItem, ToolItem, TabItem, CTabItem, Button, Label, CLabel, and Group.

The mnemonic key is indicated by an underlined character in the widget's text. Any character can be made a mnemonic by inserting an ampersand character (&) before it. However, only a-z, A-Z and 0-9 will be recognized when the matching key is pressed.

Mnemonics must be enabled for the UISession by setting the modifier key or key-combination that makes the mnemonics visible:

display.setData( RWT.MNEMONIC_ACTIVATOR, "CTRL+ALT" );

Any combination of CTRL, SHIFT and ALT is valid. You should not use ALT by itself, because the OS may already be using that. Unlike in Windows, the mnemonics disappear again when the modifier is released. Mnemonics have a higher priority than key bindings, accelerators or key events.

Applications

Custom Exception Handlers

When registering an application using an ApplicationConfiguration, you can now add a custom exception hander to catch and process exceptions that happen in your event handling code.

This handler can be used to display a custom error page instead of the default HTTP 500 containing the stacktrace. If you find that the exception is not critical, you can also decide to write the exception to an error log and let the application continue.

application.setExceptionHandler( new ExceptionHandler() {
  @Override
  public void handleException( Throwable exception ) {
    // display error dialog, redirect to error page,
    // write exception to log, ...
  }
});

Terminate UISession when Leaving Browser Page

An improvement that has often been requested (bug 284273) is to terminate a UISession as soon as the user navigates away from the browser page.

Now the WebClient sends a notification to the server just before the page is left. The server will then terminate the UISession. For applications with a long session timeout, this feature will significantly reduce the memory consumed by active UISessions.

Bugfixes

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

Previous Builds

The above features are just the ones that are new since the last milestone build. Summaries for earlier builds:

RAP 2.0 Migration Guide

After 6+ years of development in the 1.x stream, we're cleaned up some API in RAP 2.0. To assist you with the migration from 1.x to 2.0, we maintain a migration guide.