| <div> |
| |
| <h3>Updating from RAP 1.5 (Eclipse Juno)?</h3> |
| <p> |
| You may also check the |
| <a href="../2.0/">New and Noteworthy for RAP 2.0</a> and the |
| <a href="../2.0/migration-guide/">RAP 2.0 migration guide</a>. |
| </p> |
| |
| <h2>Widget Set</h2> |
| |
| <h3>Accelerator support for MenuItem</h3> |
| |
| <p> |
| The SWT method <code>MenuItem.setAccelerator( int )</code> 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+1 is pressed. |
| </p> |
| <pre class="lang-java"> |
| MenuItem menuItem = new MenuItem( parent, SWT.PUSH ); |
| menuItem.setAccelerator( SWT.CTRL | SWT.SHIFT | '1' ); |
| </pre> |
| <p> |
| Please note that the browser already defines a number of key bindings. |
| Some browsers do not allow to override all of these bindings. |
| </p> |
| |
| <p> |
| All text after a tab character will now be aligned to the right of the item. |
| This feature, called <em>accelerator text</em> is typically used to display the accelerator |
| shortcut. Example: |
| </p> |
| <pre class="lang-java"> |
| menuItem.setText( "Push One<strong>\tCtrl+Shift+1</strong>" ); |
| </pre> |
| <p> |
| <img class="framed" title="Accelerator text on MenuItems" src="images/accelerator-text.png" /> |
| </p> |
| |
| <h3>Mnemonic support</h3> |
| |
| <p> |
| Mnemonics are a simple method to select widgets using the keyboard. |
| Support for mnemonics has been implemented for the following widgets: |
| <code>MenuItem</code>, <code>ToolItem</code>, <code>TabItem</code>, <code>CTabItem</code>, |
| <code>Button</code>, <code>Label</code>, <code>CLabel</code>, and <code>Group</code>. |
| </p> |
| <p> |
| <img class="framed" title="Mnemonics on TabItems and Buttons" src="images/mnemonics.png" /> |
| </p> |
| <p> |
| 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 (<code>&</code>) |
| before it. |
| However, only <code>a-z</code>, <code>A-Z</code> and <code>0-9</code> will be recognized when |
| the matching key is pressed. |
| </p> |
| <p> |
| Mnemonics must be enabled for the UISession by setting the modifier key or key-combination that |
| makes the mnemonics visible: |
| </p> |
| <pre class="lang-java"> |
| display.setData( RWT.MNEMONIC_ACTIVATOR, "CTRL+ALT" ); |
| </pre> |
| <p> |
| 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. |
| </p> |
| |
| <h3>Support for Display Resize Listeners</h3> |
| |
| <p> |
| It's now possible to listen to changes of the display size. |
| The display size changes whenever the browser is resized or when a mobile device is rotated. |
| To do so, attach an untyped <code>SWT.Resize</code> listener to the <code>Display</code> |
| as shown in the example below. |
| Please note that this feature is not yet supported in SWT (<?=bug(402514)?>). |
| </p> |
| <pre class="lang-java"> |
| display.addListener( SWT.Resize, new Listener() { |
| public void handleEvent( Event event ) { |
| System.out.println( "Display size: " + event.width + "x" + event.height ); |
| } |
| } ); |
| </pre> |
| |
| <h3>Listener Support on Markup Hyperlinks</h3> |
| |
| <p> |
| Markup support for Tree and Table has been added in RAP 1.5. By using <code><a></code> |
| 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. |
| </p> |
| <p> |
| To do so, you have to set the <em>target</em> attribute to “_rwt”. |
| Clicking on the link will trigger an <em>SWT.Selection</em> event with the <em>details</em> |
| field set to the constant <em>RWT.HYPERLINK</em>. |
| </p> |
| |
| <pre class="lang-java"> |
| 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 == <strong>RWT.HYPERLINK</strong> ) { |
| // event.text contains the value of hyperlink href attribute |
| } |
| } |
| } ); |
| TableItem item = new TableItem( table, SWT.NONE ); |
| item.setText( "<a href=\"edit-item\" <strong>target=\"_rwt\"</strong>>edit\"</a>" ); |
| </pre> |
| |
| <h3>Drawing Paths with GC</h3> |
| |
| <p> |
| The methods <code>GC.drawPath( Path )</code> and <code>GC.fillPath( Path )</code> have been |
| implemented. |
| Now it's possible to draw complex shapes using the <code>Path</code> API. |
| </p> |
| <p> |
| <img class="framed" title="Complex shapes" src="images/gc-path.png" /> |
| </p> |
| <h2>Theming</h2> |
| |
| <h3>Background position and repeat</h3> |
| |
| <p> |
| Support for the CSS properties <code>background-position</code> and <code>background-repeat</code> |
| has been added to the following widgets: <code>Button</code>, <code>FileUpload</code>, |
| <code>Composite</code>, <code>Label</code>, <code>CLabel</code>, <code>Text</code> and <code>Link</code>. |
| See <?=bug(361799)?> for more details. |
| </p> |
| <pre class="lang-css"> |
| Composite { |
| background-repeat: no-repeat; |
| background-position: right bottom; |
| ... |
| } |
| </pre> |
| |
| <h2>Applications</h2> |
| |
| |
| <h3>Built-in Support for Multiple Browser Tabs</h3> |
| |
| <p> |
| Until now, you had to turn off session cookies in the servlet container in order |
| to support access to a RAP application from multiple browser tabs. |
| This is not needed anymore. |
| The framework can now handle multiple connections from within the same HTTP session. |
| For every connection, a new UISession will be created. |
| </p> |
| |
| <h3>Terminate UISession when Leaving Browser Page</h3> |
| |
| <p> |
| 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. |
| </p> |
| <p> |
| Now the WebClient sends a notification to the server just before the page is left. |
| The server will then terminate and cleanup the UISession. |
| For applications with a long session timeout, this feature will significantly reduce the memory |
| consumed by active UISessions. |
| </p> |
| |
| <h3>Access ApplicationContext from a UISession</h3> |
| |
| <p> |
| A UISession now provides a reference to the ApplicationContext it belongs to. |
| This allows to access application-scoped instances such as the resource manager |
| from a non-UI thread without having to wrap the code in a UISession runnable. |
| For example, the following code: |
| </p> |
| <pre class="lang-java"> |
| uiSession.exec( new Runnable() { |
| public void run() { |
| RWT.getApplicationContext().getAttribute( "foo" ); |
| } |
| } ); |
| </pre> |
| <p> |
| can now be replaced with this one-liner: |
| </p> |
| <pre class="lang-java"> |
| uiSession.getApplicationContext().getAttribute( "foo" ); |
| </pre> |
| |
| <h3>Custom Exception Handlers</h3> |
| |
| <p> |
| 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. |
| </p> |
| <p> |
| 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. |
| </p> |
| |
| <pre class="lang-java"> |
| application.setExceptionHandler( new ExceptionHandler() { |
| @Override |
| public void handleException( Throwable exception ) { |
| // display error dialog, redirect to error page, |
| // write exception to log, ... |
| } |
| }); |
| </pre> |
| |
| <h2>Network</h2> |
| |
| <h3>Handling of duplicate requests</h3> |
| |
| <p> |
| The RAP server now accepts re-sent requests. |
| In case of a connection problem, a client can decide to retry and send the same request again. |
| If the server had already received and processed the request, it will send the same response again. |
| For details, see <?=bug(383397)?>. |
| </p> |
| |
| <h2>Web Client</h2> |
| |
| <h3>Improved Internet Explorer 10 Support</h3> |
| |
| <p> |
| RAP now uses CSS3 to render rounded borders and gradients in Internet Explorer 10. |
| Previously SVG or VML were used (and still are, in older browsers) to achieve these effects. |
| With this update there are considerably less DOM elements created than before. |
| </p> |
| |
| <h3>Improved Error Messages</h3> |
| |
| <p> |
| <img class="framed" title="Session timeout message" src="images/SessionTimeoutMessage.png" /> |
| </p> |
| |
| <p> |
| The error message box that is displayed in case of network problems, session timeout etc. |
| got a slightly new look. |
| All error messages can now be internationalized. |
| For details, see <?=bug(365436)?>. |
| </p> |
| |
| <h2>Custom Widgets</h2> |
| |
| <h3>New JSON API, RemoteObject API Change</h3> |
| |
| <p> |
| In RAP 2.0, we introduced the <em>RemoteObject</em> API that allows custom components |
| to synchronize with their client part over the JSON protocol. |
| This API was still marked as provisional and is now complemented with a new JSON API |
| for marshalling and unmarshalling arbitrary data structures. |
| </p> |
| <p> |
| Consequently, the untyped Objects and Maps in the method signatures of <em>RemoteObject</em> and |
| <em>OperationHandler</em> have been replaced with the new JSON types. |
| Custom component developers should have a look at the classes <em>JsonValue</em>, |
| <em>JsonArray</em>, and <em>JsonObject</em> and adjust their custom components. |
| </p> |
| <p> |
| For example, to pass a structured value to the client as a JSON array, you have to create |
| a JsonArray instead of Object[]: |
| </p> |
| <pre class="lang-java"> |
| // set property size to 200x300 using a JSON array [200, 300] |
| remote.set( "size", new JsonArray().add( 200 ).add( 300 ) ); |
| </pre> |
| <p> |
| For example, to pass a structured value to the client as a JSON array, you have to create |
| a JsonArray instead of Object[]: |
| </p> |
| <pre class="lang-java"> |
| remoteObject.setHandler( new AbstractOperationHandler() { |
| |
| @Override |
| public void handleNotify( String event, JsonObject properties ) { |
| int index = properties.get( "index" ).asInt(); |
| // process event ... |
| } |
| } ); |
| </pre> |
| |
| <h2>Tools</h2> |
| |
| <h3>Simplified Target Installer</h3> |
| <p> |
| The target installer is meant to get beginners started quickly, so it should be as simple as |
| possible. |
| We've removed the choice between “latest stable version” and “latest release version” |
| and let the installer always get the latest target that <em>matches the tools version</em>. |
| This change will prevent incompatibilities between target and tools, which unfortunately |
| lead to some trouble in the past. |
| </p> |
| <p> |
| <img class="framed" title="Target installer" src="images/target-installer.png" /> |
| </p> |
| |
| </div> |