Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » How to align text in a TreeViewer cell(Can one do this at all)
How to align text in a TreeViewer cell [message #1754710] Tue, 21 February 2017 17:28 Go to next message
Frank Gruendel is currently offline Frank GruendelFriend
Messages: 22
Registered: January 2014
Junior Member
Hi experts,

by now I have spent the better part of two hours in the world wide WEB in vain. All I want to do is to change the vertical alignment of the text in a Treeviewer. As you can see in the image, the text is top-aligned whereas it should be center-aligned.

I am using Eclipse Mars.1 Release (4.5.1) with RAP 3.0.2 as the target platform.

As can be seen in the image, I have tinkered with the CSS properties of TreeItem, but this doesn't seem the proper strategy since the alignment seems to not be part of what can be controlled via CSS.

My TreeViewer is created like this:



private Control getTabControl_Tab1(final CTabFolder tabFolder)
{
final Composite composite = new Composite(tabFolder, SWT.NONE);
composite.setLayout(new FillLayout());

m_treeViewer_Plain = new TreeViewer(composite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
m_treeViewer_Plain.getTree().setBackground(PMCColors.DEFAULT_BACKGROUND);
m_treeViewer_Plain.setContentProvider(new MyViewContentProvider(false));
m_treeViewer_Plain.setLabelProvider(new MyViewLabelProvider());
m_treeViewer_Plain.setUseHashlookup(true);
m_treeViewer_Plain.setSorter(new ViewerSorter());
m_treeViewer_Plain.setInput(getController());
composite.pack();
return composite;
}

The LabelProvider, in case this is of any importance, extends LabelProvider.

I appear to be unable to find the place where this text is actually painted. If anybody could shed some light on this problem, I will be thankful forever
Smile


Re: How to align text in a TreeViewer cell [message #1754740 is a reply to message #1754710] Tue, 21 February 2017 21:21 Go to previous messageGo to next message
Chris Fairhall is currently offline Chris FairhallFriend
Messages: 197
Registered: February 2011
Senior Member
If I had to take a wild guess, it would be the padding property of the Tree-Cell theme
The default theme has it set to 6px. You should be able to set each left, right, top and bottom padding value.

My theme has the following:
Tree-Cell {
spacing: 2px;
padding: 1px 0px 1px 0px;
}

The default theme is:
Tree-Cell {
spacing: 0;
padding: 6px;
}
Re: How to align text in a TreeViewer cell [message #1755855 is a reply to message #1754740] Wed, 08 March 2017 16:26 Go to previous messageGo to next message
Frank Gruendel is currently offline Frank GruendelFriend
Messages: 22
Registered: January 2014
Junior Member
Chris, thanks for answering, and sorry for replying that late. I have tried your theme setting, but in did not change a bit.
Re: How to align text in a TreeViewer cell [message #1757810 is a reply to message #1755855] Mon, 20 March 2017 08:37 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2277
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
Hi Frank,
there are some limitations about vertical text alignment. See this bug and the discussion there:
361796: [Table][Tree] Setting vertical alignment
https://bugs.eclipse.org/bugs/show_bug.cgi?id=361796
As our client-side implementation for SWT Tree/Table and Nebula Grid is the same we have to make some compromises or expose more configuration options. For now, this is still an open issue.
Regards,
Ivan
Re: How to align text in a TreeViewer cell [message #1758300 is a reply to message #1757810] Mon, 27 March 2017 11:31 Go to previous message
Frank Gruendel is currently offline Frank GruendelFriend
Messages: 22
Registered: January 2014
Junior Member
Thanks, Ivan! Knowing that something can not be fixed at the moment is almost as helpful as being told a fix, because one doesn"t have to spend any more time on figuring out how to do it Smile
Previous Topic:Use web.xml with the RAP launcher
Next Topic:theming opacity button checkbox
Goto Forum:
  


Current Time: Fri May 25 23:01:35 GMT 2018

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

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

Back to the top