Behold! 😉 After moving ClientScripting from Incubator to RAP proper in M1 and revising ToolTips in M2, we finally introduce an all new key feature in 2.2M3 called
Template template = new Template(); ImageCell imageCell = new ImageCell( template ); imageCell.setBindingIndex( 0 ); // bind to image from column 0 imageCell.setTop( 4 ).setLeft( 4 ).setWidth( 48 ).setHeight( 48 ); TextCell nameCell = new TextCell( template ); nameCell.setBindingindex( 1 ); // display text from column 1 nameCell.setLeft( 60 ).setWidth( 180 ).setTop( 30 ).setBottom( 8 ); nameCell.setHorizontalAlignment( SWT.LEFT ); // left-align the text in this cell nameCell.setFont( font ); ...
It’s also possible to make specific cells clickable, in which case an selection event is fired that gives you the name of the clicked cell, but the item itself is not marked as selected. Items can still be selected, though the selection is only visible if the SWT.FULL_SELECTION style flag is set.
More technical details on how to use this new feature can be found in the M3 New & Noteworthy article.
While it was already possible to create similar UIs using (or abusing) either Tables with markup (HTML) or ScrolledComposites with a RowLayout, this feature definitely has it’s merits:
- No HTML, CSS knowledge required, no cross-browser issues for you to solve
- True virtual rendering
- Less data to transfer to the client
- Also works on Tabris (Android/iOS)
- Table/Tree still usable without template in SWT, just not as pretty
We plan to gradually extend the capabilities of templates in future releases, perhaps allowing even more flexible layouts, hover effects, custom cell types, etc. The templating system is also built in a way that will make it easy for us to support it on other widgets, or apply it to single item columns instead of entire rows.
In other news, milestone 3 also adds more features to ToolTips, which now support markup and horizontal alignment. Some minor revisions may still be done on ToolTips before the release. Also, virtual Trees and and Tables can now pre-load any number of items. Again, all details can be found on the New & Noteworthy page.
Remember, RAP 2.2. is going to be released on December 20th, 2013, so this is the final milestone. Trying it out now and giving feedback might help us ironing out any potential issues before then. Bug reports regarding row templates should be prefixed with [Template]. Some minor issues like markup and linesVisible support have already been fixed, but didn’t make it into the M3 build.
RAP 2.2M3 can be downloaded as of November 15, 2013 here.