Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » scout » Is it possible to create CustomColumns for tables?
Is it possible to create CustomColumns for tables? [message #1403174] Tue, 22 July 2014 06:58 Go to next message
Urs Beeli is currently offline Urs BeeliFriend
Messages: 493
Registered: October 2012
Location: Bern, Switzerland
Senior Member
We've created a number of custom fields for our application by defining the abstract model class and the corresponding SWT rendering class.

Is it also possible to define custom columns for tables? If so, what steps would I need to take?
Re: Is it possible to create CustomColumns for tables? [message #1403195 is a reply to message #1403174] Tue, 22 July 2014 10:02 Go to previous messageGo to next message
Jeremie Bresson is currently offline Jeremie BressonFriend
Messages: 1200
Registered: October 2011
Senior Member
I think there is no API to plug an additional renderer implementation for custom-columns as you can do for custom-fields.

You can work at Table level (having your own table implementation extending the default one). Have a look at this blog article:
Scout tables with fixed columns. It is for RAP but I think it works the same way for SWT.

What is your use case? Have you other value Types? Using AbstractColumn<YourType> is not sufficient?

Re: Is it possible to create CustomColumns for tables? [message #1403204 is a reply to message #1403195] Tue, 22 July 2014 10:42 Go to previous messageGo to next message
Dennis Geesen is currently offline Dennis GeesenFriend
Messages: 46
Registered: June 2014
Member
I stuck into the same problem, since my idea was to provide a "ButtonColumn" for displaying some buttons (or icons with an action). The buttons should offer a more direct menu for different actions (e.g. "edit", "print" and so on). So, if you (will) have further experience, please let me know!
Re: Is it possible to create CustomColumns for tables? [message #1403234 is a reply to message #1403204] Tue, 22 July 2014 14:52 Go to previous messageGo to next message
Jeremie Bresson is currently offline Jeremie BressonFriend
Messages: 1200
Registered: October 2011
Senior Member
I often see requirements to have an "action" column with links or buttons:

index.php/fa/18611/0/

In scout the way to add "actions" on a row is with a menu (type TableMenuType.SingleSelection):

index.php/fa/18612/0/

I know it is not the same requirement... But it is all you get in scout (out-of-the-box) for the moment.
Re: Is it possible to create CustomColumns for tables? [message #1725421 is a reply to message #1403234] Thu, 03 March 2016 12:20 Go to previous messageGo to next message
Roman Prediger is currently offline Roman PredigerFriend
Messages: 2
Registered: March 2016
Junior Member
Did you already found the solution for this problem?
Re: Is it possible to create CustomColumns for tables? [message #1725422 is a reply to message #1403234] Thu, 03 March 2016 12:22 Go to previous messageGo to next message
Roman Prediger is currently offline Roman PredigerFriend
Messages: 2
Registered: March 2016
Junior Member
No Message Body

[Updated on: Fri, 04 March 2016 06:59]

Report message to a moderator

Re: Is it possible to create CustomColumns for tables? [message #1725743 is a reply to message #1725422] Mon, 07 March 2016 11:57 Go to previous message
Claudio Guglielmo is currently offline Claudio GuglielmoFriend
Messages: 153
Registered: March 2010
Senior Member
The easiest approach would be to use html and appLinks.

To do this, you need to allow html for your string column by setting htmlEnabled to true.
@Override
protected boolean getConfiguredHtmlEnabled() {
  return true;
}

Then you create your html and set the cell value as you would do with ordinary text.
String cellValue = HTML.appLink("editRef", TEXTS.get("Edit")).toHtml();

If the link gets clicked the callback exeAppLinkAction is executed.
@Override
protected void execAppLinkAction(String ref) {
  MessageBoxes.createOk().withBody(ref + " has been clicked.").show();
}

The html builder and the property htmlEnabled is new with neon. With an older version you have to build the html string by your own and make sure that the content is encoded, if necessary. Instead of the setting the property just ensure that the html string starts with <html>. Furthermore execAppLinkAction was called execHyperlinkAction. This worked for swing and rap ui, not swt.

With neon, you have even more possibilities: You could use custom css classes if you just need a different look, use a bean column with java beans as value and custom JavaScript code or even create a custom column as it is possible for fields.

We will provide further documentation about these features in the near future.
Previous Topic:[neon] AbstractFileChooserField.getValueAsFile()
Next Topic:[neon] using AbstractFileChooserField to choose a folder
Goto Forum:
  


Current Time: Sun Dec 04 08:38:28 GMT 2016

Powered by FUDForum. Page generated in 0.10260 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software