donderdag 1 maart 2018

The new Bling. Part 1: Nebula and Opal

Recent studies [1] seem to suggest that companies are becoming tired of building web applications in favor of the rich client. Good news for the newly weds: Nebula and Opal!


You might know Nebula, which provides of a number of beautiful and functional widgets to spice up your RCP applications. You might not know Opal. Opal has been roaming freely on the internet and has been programmed largely by Laurent Caron.

I have been chasing Laurent to join the Nebula project since 2014 and after some hard work over the last couple of months we finally did it:



"two dozen new widgets have moved to Eclipse."

A great time to remove my blog from the mothballs (a Dutch saying, but you get the idea) and put some of Nebula's new widgets in the spotlight.

The new Bling. Part 1. The CheckboxGroup

Laurent, this is such a great idea! There are many times when you want to enable a group of  widgets based on an initial selection. The whole boilerplate code of such a pattern in standard SWT is ugly as mud. Check this code and tell me if you recognize it:

    proxyBox.addSelectionListener( event -> { 
       server.setEnabled(proxyBox.getSelection();
       port.setEnabled(proxyBox.getSelection());
       user.setEnabled(proxyBox.getSelection());
       password.setEnabled(proxyBox.getSelection());
    });
 

Enter the CheckboxGroup. On:


and off:


From Laurent's wiki documentation:

You can set/get the text and the font of the checkbox, and you get the value of the selection by calling isActivated(). In case you want to set the state of this checkbox programmatically (and thus enable or disable the content of the group) you use activate() and deactivate().

The content, which is a Composite, is accessible with the getter getContent().

Pretty slick! And this is only one of the 24 new widgets!  You can get the CheckboxGroup from the latest nighly builds.

Cheers,

Wim


[1] fake news