Skip to main content



      Home
Home » Eclipse Projects » Eclipse Scout » Is it possible to create CustomColumns for tables?
Is it possible to create CustomColumns for tables? [message #1403174] Tue, 22 July 2014 02:58 Go to next message
Eclipse UserFriend
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 06:02 Go to previous messageGo to next message
Eclipse UserFriend
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 06:42 Go to previous messageGo to next message
Eclipse UserFriend
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 10:52 Go to previous messageGo to next message
Eclipse UserFriend
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 07:20 Go to previous messageGo to next message
Eclipse UserFriend
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 07:22 Go to previous messageGo to next message
Eclipse UserFriend
No Message Body

[Updated on: Fri, 04 March 2016 01:59] by Moderator

Re: Is it possible to create CustomColumns for tables? [message #1725743 is a reply to message #1725422] Mon, 07 March 2016 06:57 Go to previous message
Eclipse UserFriend
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: Wed Jul 23 01:15:40 EDT 2025

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

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

Back to the top