Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » RAP doesn't wrap "\n" in table cell
RAP doesn't wrap "\n" in table cell [message #660154] Thu, 17 March 2011 06:34 Go to next message
Sun  is currently offline Sun Friend
Messages: 20
Registered: July 2009
Junior Member
Hi,

RCP table cell content is wrapped when "\n" is used but RAP doesn't wrap the same. Multi-line rows in web based gui is very common.

Is there any work around for this?

I thought of having labels for those cells but as the table is supposed to have large amount of data, it may slow down performance.
Tried looking into setting css properties for table cell for RAP version of app but didnt find a way. Is it possible to set some css properties to get this done?

Any hint is highly appreciated. Thanks guys.

Regards
Sun
Re: RAP doesn't wrap "\n" in table cell [message #660161 is a reply to message #660154] Thu, 17 March 2011 07:39 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2426
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
Hi Sun,
are you talking about TabelItem#setText( "line 1 \n line 2" )? Multi
line text for table items is not possible in SWT either. Could you
provide a snippet that works in SWT, but not in RAP?
Best,
Ivan

On 3/17/2011 8:34 AM, Sun wrote:
> Hi,
>
> RCP table cell content is wrapped when "\n" is used but RAP doesn't
> wrap the same. Multi-line rows in web based gui is very common.
>
> Is there any work around for this?
>
> I thought of having labels for those cells but as the table is
> supposed to have large amount of data, it may slow down performance.
> Tried looking into setting css properties for table cell for RAP
> version of app but didnt find a way. Is it possible to set some css
> properties to get this done?
>
> Any hint is highly appreciated. Thanks guys.
>
> Regards
> Sun
Re: RAP doesn't wrap "\n" in table cell [message #660166 is a reply to message #660161] Thu, 17 March 2011 08:10 Go to previous messageGo to next message
Sun  is currently offline Sun Friend
Messages: 20
Registered: July 2009
Junior Member
I am using simple table viewer and setting the input which has multiline string as objects. Wrote a simple method for you to try out as I can not post original code,

private void createSimpleTable(Composite parent) {
TableViewer tv = new TableViewer(parent);
tv.setContentProvider(new IStructuredContentProvider() {
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
}
public void dispose() {
}
public Object[] getElements(Object inputElement) {
return (Object[]) inputElement;
}
});
tv.getTable().setLinesVisible(true);
tv.setInput(new String[]{"line 1\n line2", "line1 \n line2", "line 1\n line2", "line1 \n line2"});
}

This shows multi-line table in RCP app on Linux platform. Using the same code in RAP shows tripped off text in single line for each rows.
Re: RAP doesn't wrap "\n" in table cell [message #660175 is a reply to message #660166] Thu, 17 March 2011 08:51 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2426
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
Hi Sun,
just tried your snippet in RCP (Windows) and there is *no* multi-line
text in table cells ('\n' is ignored). As RAP, in most cases, tries to
behave the same like the corresponding RCP part on Windows platform,
this is an expected behavior. In RCP (Windows) it's possible to
workaround this limitation by drawing the text with GC (see this
snippet:
http://www.java2s.com/Tutorial/Java/0280__SWT/MultilineTable cell.htm ),
but drawing on Table is still *not* supported in RAP. If you think that
this is a useful feature, please file an enhancement request to consider
the Linux behavior.
Best,
Ivan

On 3/17/2011 10:11 AM, Sun wrote:
> I am using simple table viewer and setting the input which has
> multiline string as objects. Wrote a simple method for you to try out
> as I can not post original code,
>
> private void createSimpleTable(Composite parent) {
> TableViewer tv = new TableViewer(parent);
> tv.setContentProvider(new IStructuredContentProvider() {
> public void inputChanged(Viewer viewer, Object oldInput,
> Object newInput) {
> }
> public void dispose() {
> }
> public Object[] getElements(Object inputElement) {
> return (Object[]) inputElement;
> }
> });
> tv.getTable().setLinesVisible(true);
> tv.setInput(new String[]{"line 1\n line2", "line1 \n line2",
> "line 1\n line2", "line1 \n line2"});
> }
>
> This shows multi-line table in RCP app on Linux platform. Using the
> same code in RAP shows tripped off text in single line for each rows.
Re: RAP doesn't wrap "\n" in table cell [message #660184 is a reply to message #660175] Thu, 17 March 2011 09:31 Go to previous messageGo to next message
Sun  is currently offline Sun Friend
Messages: 20
Registered: July 2009
Junior Member
Thanks Ivan for trying this out and confirming current support.

I had explored about windows behaviour and was knowing Windows as a platform doesn't support it. Had also checked with drawing text with GC but as you said table doesn't support it and I found few of the SWT events itself are not available there in RAP.

I think it is a very useful feature. For web based application this is widely used. Just take an example of our RAP Community Forum web page " http://www.eclipse.org/forums/index.php?t=thread&frm_id= 34&S=93d9acc82566642c9de7f1a0b73ebc23", it also uses table with multi-line for main table. Smile

Sure, will file an enhancement request.
Is it possible to tweak css/theme support for rap to have fixed height/wrapping for table cells td in the html page rendered on browser?

Regards
Sun
Re: RAP doesn't wrap "\n" in table cell [message #660193 is a reply to message #660184] Thu, 17 March 2011 09:58 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2426
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
Hi Sun,
I don't quite understand your last question, but there are several ways
to interfere on the TableItem height:
1. image height set on the item
2. table cell padding set by theming - Table-Cell { padding: ... }
3. item text font
HTH,
Ivan

On 3/17/2011 11:31 AM, Sun wrote:
> Thanks Ivan for trying this out and confirming current support.
>
> I had explored about windows behaviour and was knowing Windows as a
> platform doesn't support it. Had also checked with drawing text with
> GC but as you said table doesn't support it and I found few of the SWT
> events itself are not available there in RAP.
>
> I think it is a very useful feature. For web based application this is
> widely used. Just take an example of our RAP Community Forum web page
> " http://www.eclipse.org/forums/index.php?t=thread&frm_id= 34&S=93d9acc82566642c9de7f1a0b73ebc23",
> it also uses table with multi-line for main table. :)
>
> Sure, will file an enhancement request.
> Is it possible to tweak css/theme support for rap to have fixed
> height/wrapping for table cells td in the html page rendered on browser?
>
> Regards
> Sun
Re: RAP doesn't wrap "\n" in table cell [message #660197 is a reply to message #660193] Thu, 17 March 2011 10:14 Go to previous messageGo to next message
Sun  is currently offline Sun Friend
Messages: 20
Registered: July 2009
Junior Member
Yeah right Ivan.

This will increase entire table item height through css. But it will not increase the actual height/space for text inside table item. Was trying to ask this but probably was not very clear.

Regards
Suraj
Re: RAP doesn't wrap "\n" in table cell [message #1632975 is a reply to message #660197] Tue, 24 February 2015 15:54 Go to previous messageGo to next message
UmaShankar Subramani is currently offline UmaShankar SubramaniFriend
Messages: 194
Registered: December 2011
Location: SWEDEN
Senior Member
Any update on this? I am using RAP 2.3 now. Is it possible to have multi-line cell now?
Re: RAP doesn't wrap "\n" in table cell [message #1634613 is a reply to message #1632975] Wed, 25 February 2015 11:01 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2426
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
Hi,
Nebula Grid widget, which is included in RAP 3.0 runtime, has autoWrap
and autoHeight features. For regular RWT Table/Tree you could enable
markup support:
table.setData( RWT.MARKUP_ENABLED, Boolean.TRUE );
together with custom item height:
table.setData( RWT.CUSTOM_ITEM_HEIGHT, new Integer( 45 ) );
and use <br/> instead of /n.
HTH,
Ivan

--
Ivan Furnadjiev

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: RAP doesn't wrap &quot;\n&quot; in table cell [message #1692296 is a reply to message #1634613] Tue, 14 April 2015 21:31 Go to previous messageGo to next message
Dmitry Dukhov is currently offline Dmitry DukhovFriend
Messages: 192
Registered: February 2013
Senior Member
Does Nebula use (or inherit) the model like TableViewer(JFace)?

Just TableViewer is very usable
Re: RAP doesn't wrap &amp;quot;\n&amp;quot; in table cell [message #1692324 is a reply to message #1692296] Wed, 15 April 2015 06:37 Go to previous message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2426
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
Hi,
together with "org.eclipse.rap.nebula.widgets.grid",
"org.eclipse.rap.nebula.jface.gridviewer" bundle is also available. It's
almost untouched version of the original Nebula Grid viewer bundle.
HTH,
Ivan

--
Ivan Furnadjiev

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Previous Topic:Google Visualisation
Next Topic:wrong MD5 with latest 1.4.0 runtime
Goto Forum:
  


Current Time: Tue Apr 16 09:11:46 GMT 2024

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

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

Back to the top