| <div> |
| |
| <h2>Widget Set</h2> |
| |
| <h3>Accelerator Text for MenuItem</h3> |
| |
| <p> |
| On MenuItems, 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 an accelerator |
| shortcut. Example: |
| </p> |
| <pre class="lang-java"> |
| MenuItem item = new MenuItem( parent, SWT.PUSH ); |
| item.setText( "Push One<strong>\tCtrl+Shift+1</strong>" ); |
| item.setAccelerator( SWT.CTRL | SWT.SHIFT | '1' ); |
| </pre> |
| <p> |
| <img class="framed" title="Accelerator text on MenuItems" src="images/accelerator-text.png" /> |
| </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>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> |
| |
| <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, on older browser) to achieve these effects. |
| With this update there are considerably less DOM elements created than before. |
| </p> |
| |
| <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>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> |
| |
| <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> |
| |
| </div> |