Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Table with multiline columns
Table with multiline columns [message #140164] Tue, 14 July 2009 06:49 Go to next message
Eclipse UserFriend
Originally posted by: markus.wolf.nmmn.com

Hi there,

is it possible in RWT to have a table with multiline columns?
I've seen tutorials for SWT where this is done using PaintListeners and
thats not possible with RWT currently.

Thanks for any input on this.

Markus Wolf
--
NMMN - New Media Markets & Networks GmbH
Langbehnstrasse 6, 22761 Hamburg
Geschäftsführung: Kfm. Michael Schütt
Finanzamt HH-Altona - UStID DE 812 699 852 - HRB 71102 Hamburg
HypoVereinsbank - BLZ 200 300 00 - Konto-Nr. 156 29 82

http://www.nmmn.com
Tel.: +49 40 284 118-0 - Fax: +49 40 284118-999
Softwareentwicklung LLynch: -720
Re: Table with multiline columns [message #140477 is a reply to message #140164] Thu, 16 July 2009 13:18 Go to previous messageGo to next message
Benjamin Muskalla is currently offline Benjamin MuskallaFriend
Messages: 338
Registered: July 2009
Senior Member
Hi Markus,

I'm sorry to say that it's not possible to have multiline columns. As
you already said, this is not even supported by SWT without painting the
text yourself.

Cheers
Ben

Markus Wolf wrote:
> Hi there,
>
> is it possible in RWT to have a table with multiline columns?
> I've seen tutorials for SWT where this is done using PaintListeners and
> thats not possible with RWT currently.
>
> Thanks for any input on this.
>
> Markus Wolf


--
Benjamin Muskalla | EclipseSource Karlsruhe
http://www.eclipsesource.com | http://twitter.com/eclipsesource
Re: Table with multiline columns [message #140772 is a reply to message #140477] Mon, 20 July 2009 22:09 Go to previous messageGo to next message
Austin Riddle is currently offline Austin RiddleFriend
Messages: 128
Registered: July 2009
Senior Member
Hello Markus,

There is a way to have some semblance of multi-line table rows in a
TableViewer if you don't mind a bit of hacking.

I have a small experimental implementation that will interpret '\n'
characters in the text that is returned from the LabelProvider. It is
limited in ability, and it is unconventional, but if you need the
multi-line tables that bad you may find it helpful.

Caveats:
1. You must manually set the row height on the TableViewer.
2. The row height will be consistent for all rows.
3. The text will be left justified.
4. Overflow is cut off.


If you are still interested I can post it.
Re: Table with multiline columns [message #140805 is a reply to message #140772] Tue, 21 July 2009 07:44 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: markus.wolf.nmmn.com

Hello Austin,

I helped myself with the problem by implementing a ContentProvider and
LabelProvider which splits up the long text into multiple table rows.
The input is wrapped by the ContentProvider and then send as model-
elements to the table viewer. This aproach works quite well but it is not
possible to have TableEditors with this. That the only drawback we have.

But thanks for your input. :)

Markus


> There is a way to have some semblance of multi-line table rows in a
> TableViewer if you don't mind a bit of hacking.
>
> I have a small experimental implementation that will interpret '\n'
> characters in the text that is returned from the LabelProvider. It is
> limited in ability, and it is unconventional, but if you need the
> multi-line tables that bad you may find it helpful.
>
> Caveats:
> 1. You must manually set the row height on the TableViewer. 2. The row
> height will be consistent for all rows. 3. The text will be left
> justified.
> 4. Overflow is cut off.
>
>
> If you are still interested I can post it.





--
NMMN - New Media Markets & Networks GmbH
Langbehnstrasse 6, 22761 Hamburg
Geschäftsführung: Kfm. Michael Schütt
Finanzamt HH-Altona - UStID DE 812 699 852 - HRB 71102 Hamburg
HypoVereinsbank - BLZ 200 300 00 - Konto-Nr. 156 29 82

http://www.nmmn.com
Tel.: +49 40 284 118-0 - Fax: +49 40 284118-999
Softwareentwicklung LLynch: -720
Re: Table with multiline columns [message #486299 is a reply to message #140805] Thu, 17 September 2009 08:16 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cheney_chen.i-len.com

Hi Austin and Markus,

I also need a table with multiline columns, but I can't implement it.Can
you give me some hints or some exactly simple code?

Thanks,
Cheney

On Tue, 21 Jul 2009 07:44:50 +0000, Markus Wolf wrote:

> Hello Austin,
>
> I helped myself with the problem by implementing a ContentProvider and
> LabelProvider which splits up the long text into multiple table rows.
> The input is wrapped by the ContentProvider and then send as model-
> elements to the table viewer. This aproach works quite well but it is
> not possible to have TableEditors with this. That the only drawback we
> have.
>
> But thanks for your input. :)
>
> Markus
>
>
>> There is a way to have some semblance of multi-line table rows in a
>> TableViewer if you don't mind a bit of hacking.
>>
>> I have a small experimental implementation that will interpret '\n'
>> characters in the text that is returned from the LabelProvider. It is
>> limited in ability, and it is unconventional, but if you need the
>> multi-line tables that bad you may find it helpful.
>>
>> Caveats:
>> 1. You must manually set the row height on the TableViewer. 2. The row
>> height will be consistent for all rows. 3. The text will be left
>> justified.
>> 4. Overflow is cut off.
>>
>>
>> If you are still interested I can post it.
Re: Table with multiline columns [message #486333 is a reply to message #486299] Thu, 17 September 2009 10:13 Go to previous message
Markus Wolf is currently offline Markus WolfFriend
Messages: 153
Registered: July 2009
Senior Member
Hi Cheney,

you could try a ContentProvider like this:

private static class MultilineContentProvider extends
ArrayContentProvider {
public Object[] getElements(final Object inputElement) {
if (inputElement instanceof List<?>) {
final List<Object> elements = new
LinkedList<Object>();
final List<Object> list = (List<Object>)
inputElement;
for (int i = 0; i < list.size(); i++) {
final Object pos = list.get(i);
final String[] lines = WordUtils.wrap
(pos.toString(),
100, "\n", true).split
("\n");
elements.add(lines[0]);
// Other lines
for (int j = 1; j < lines.length; j++) {
elements.add(lines[j]);
}
}
return elements.toArray();
}
return super.getElements(inputElement);
}
}


The code is not tested, since I removed the application specific party of
our application. So all places where Object is used was a business
specific class containing the data to present, but it should be quite
simple to adopt.
The WordUtils class is from commons-lang and wraps the content to display
at 100 characters.

HTH
Markus


Am Thu, 17 Sep 2009 08:16:08 +0000 schrieb Cheney Chen:

> Hi Austin and Markus,
>
> I also need a table with multiline columns, but I can't implement it.Can
> you give me some hints or some exactly simple code?
>
> Thanks,
> Cheney
>
> On Tue, 21 Jul 2009 07:44:50 +0000, Markus Wolf wrote:
>
>> Hello Austin,
>>
>> I helped myself with the problem by implementing a ContentProvider and
>> LabelProvider which splits up the long text into multiple table rows.
>> The input is wrapped by the ContentProvider and then send as model-
>> elements to the table viewer. This aproach works quite well but it is
>> not possible to have TableEditors with this. That the only drawback we
>> have.
>>
>> But thanks for your input. :)
>>
>> Markus
>>
>>
>>> There is a way to have some semblance of multi-line table rows in a
>>> TableViewer if you don't mind a bit of hacking.
>>>
>>> I have a small experimental implementation that will interpret '\n'
>>> characters in the text that is returned from the LabelProvider. It is
>>> limited in ability, and it is unconventional, but if you need the
>>> multi-line tables that bad you may find it helpful.
>>>
>>> Caveats:
>>> 1. You must manually set the row height on the TableViewer. 2. The row
>>> height will be consistent for all rows. 3. The text will be left
>>> justified.
>>> 4. Overflow is cut off.
>>>
>>>
>>> If you are still interested I can post it.





--
NMMN - New Media Markets & Networks GmbH
Langbehnstrasse 6, 22761 Hamburg
Geschäftsführung: Kfm. Michael Schütt
Finanzamt HH-Altona - UStID DE 812 699 852 - HRB 71102 Hamburg
HypoVereinsbank - BLZ 200 300 00 - Konto-Nr. 156 29 82

http://www.nmmn.com
Tel.: +49 40 284 118-0 - Fax: +49 40 284118-999
Softwareentwicklung LLynch: -720
Previous Topic:Adding RAP specific code at runtime (without affecting RCP code)
Next Topic:FilteredItemsSelectionDialog or UIJob
Goto Forum:
  


Current Time: Mon Dec 06 12:45:03 GMT 2021

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

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

Back to the top