blob: f8b29dedd54aa833fd8d4e0f2539730e51993be5 [file] [log] [blame]
<div>
<h2>New service interface ClientFileLoader</h2>
</p>
Custom widgets often require their own CSS file to be loaded on the client.
We already supported loading Javascript files using the <code>JavaScriptLoader</code> service,
but we had no service to load CSS files.
</p>
<p>
So we've introduced a new service interface named <code>ClientFileLoader</code> that can load
both, JS and CSS files.
The service provides two methods, <code>requireJs</code> and <code>requireCss</code>, that both
accept a URL to load.
The ClientFileLoader ensures that every file is loaded only once per session, so you can safely
use it in the constructor of a custom widget.
</p>
<pre lang="java">
ClientFileLoader loader = RWT.getClient().getService( ClientFileLoader.class );
loader.requireJs( JS_URL );
loader.requireCss( CSS_URL );
</pre>
<p>
This new service replaces the existing <code>JavaScriptLoader</code> service, which has been
deprecated.
</p>
<h2>Badge support for CTabItem</h2>
<p>
The CTabItem widget now supports badges:
</p>
<img class="framed" alt="Badges on CTabItems" src="./images/ctabitem-badges.png"/>
<p>
Those badges can be set using a data key:
</p>
<pre lang="java">ctabItem.setData( RWT.BADGE, "7" );</pre>
<p>
The given string is displayed at the top-right of the item. To adjust the look of badges, the
<em>Widget-Badge</em> element can be used. It currently supports the properties <em>font</em>,
<em>color</em>, <em>background-color</em>, <em>border</em> and <em>border-radius</em>.
</p>
<h2>Partial redraw</h2>
<p>
The implementation of method <code>Control#redraw(int, int, int, int, boolean)</code> has been
improved. Now, only the provided rectangle is redrawn on the client without clearing rest of the
drawing area.
</p>
<h2>Use API extensions to replace RWT utility classes</h2>
<p>
In those rare cases where RAP requires a slightly different API than SWT, we've used to
provide additional methods in utility classes like <code>BrowserUtil</code> and <code>DialogUtil</code>.
These utilities contain non-blocking version of the SWT methods <code>Browser.evaluate()</code>
and <code>Dialog.open()</code>, that are needed for the JEE compatible mode.
We avoided making extensions to classes and interfaces from SWT.
</p>
<p>
Reconsidering this approach, we think that it makes the developer's life harder, as these
methods cannot be found directly, and the separation does not bring a real advantage.
So we decided to take the freedom to add those few extensions directly to the SWT classes.
For example, instead of:
</p>
<pre lang="java">
DialogUtil.open( dialog, returnCode -> {
if( returnCode == SWT.OK ) {
// do something
}
});
</pre>
<p>
you can now write:
</p>
<pre lang="java">
dialog.open( returnCode -> {
if( returnCode == SWT.OK ) {
// do something
}
});
</pre>
<p>
The non-blocking methods are now available on <code>Dialog</code> and <code>Browser</code>,
respectively.
<code>DialogUtil</code> and <code>BrowserUtil</code> have been deprecated.
</p>
<h2>New Chart component in Incubator</h2>
<img class="framed" alt="Charts" src="./images/chart.png"/>
<p>
A new component for creating charts has been added to the RAP Incubator.
It provides an extensible class <code>Chart</code> that is based on the famous
<a href="http://d3js.org/">D3.js</a> library.
Moreover, it contains some basic chart widgets that use
<a href="http://nvd3.org/">NVD3</a>, a chart library that builds on top of d3.
Currently, there is a PieChart, a BarChart, and a LineChart widget with a basic set of properties,
that is going to be extended.
</p>
<p>
See <a href="http://eclipsesource.com/blogs/2016/02/04/new-in-the-rap-incubator-charts-with-d3-and-nvd3/">the blog post</a> for details.
</p>
</div>