blob: 7bf2b561ac86917cc785c2dffa91ab24e0ddeb78 [file] [log] [blame]
<div>
<h2>Widget Set</h2>
<h3>Listener Support on Markup Hyperlinks</h3>
<p>
Markup support for Tree and Table has been added in RAP 1.5. By using <code>&lt;a&gt;</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( "&lt;a href=\"edit-item\" <strong>target=\"_rwt\"</strong>&gt;edit\"&lt;/a&gt;" );
</pre>
<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+A is pressed.
</p>
<pre class="lang-java">
menuItem.setAccelerator( SWT.CTRL | SWT.SHIFT | 'A' );
</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>
<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>&amp;</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>
<h2>Applications</h2>
<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>
<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 the UISession.
For applications with a long session timeout, this feature will significantly reduce the memory
consumed by active UISessions.
</p>
</div>