|
Re: Tree full CSS styling of tree status column [message #1739368 is a reply to message #1739297] |
Sat, 30 July 2016 21:29 |
Dirk Fauth Messages: 2903 Registered: July 2012 |
Senior Member |
|
|
There are several things to notice. In short, it is not possible to configure this via CSS, nor are some of the requested features possible.
But one by one:
1. padding
This actually works. And this is shown in the examples. As it is not working in your case, I assume you specified the tree-structure-painter for a label (e.g. TREE_COLUMN_CELL). But that is not working. The tree-structure-painter CSS property is only available on table level. This is also documented in the N&N of 1.4.
2. alignment
This also works. But maybe not as you expect. The tree state icons are always rendered left aligned. But the content can be aligned differently. I assume the issue is the same as above.
3. decoration icon left to the tree status
First, your assumption is wrong that the supported values for tree-structure-painter are only background, padding and tree. In theory you can add also other available painters like decorator. That would be the solution, but currently the TreeLayer doesn't respect a CellPainterDecorator while searching for the IndentedTreeImagePainter. For that I created a ticket and proposed a fix, so it is possible to create such a painter programmatically. But it won't work on CSS level as the tree-structure-painter needs to be specified on table level, the decorator value expects the decoration property, otherwise it fails to create it, and you definitely don't want the decoration on all columns.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=498920
|
|
|
Re: Tree full CSS styling of tree status column [message #1739442 is a reply to message #1739368] |
Mon, 01 August 2016 14:51 |
Lothar L. Messages: 27 Registered: July 2016 |
Junior Member |
|
|
Hello Dirk,
thank you very much for taking the time to reply.
Dirk Fauth wrote on Sat, 30 July 2016 21:29There are several things to notice. In short, it is not possible to configure this via CSS, nor are some of the requested features possible.
But one by one:
1. padding
This actually works. And this is shown in the examples. As it is not working in your case, I assume you specified the tree-structure-painter for a label (e.g. TREE_COLUMN_CELL). But that is not working. The tree-structure-painter CSS property is only available on table level. This is also documented in the N&N of 1.4.
Ah, I guess I am using the CSS wrong or at least was testing with values which are to big. If I use too big values for the padding the cells width and height seems to be using default values and no information is displayed (or so it appears). If the values are small the values are applied, i.e. cells are expanded, and information is placed correctly.
Yes, as by the TreeExample which uses the ".modern" CSS class I used the "tree-structure-painter: background padding tree;" configuration with the results described above.
public class TreeExample extends AbstractE4NatExamplePart {
@PostConstruct
public void postConstruct(Composite parent) {
natTable.setData("org.eclipse.e4.ui.css.CssClassName", "modern");
/* MODERN CONFIGURATION */
.modern {
tree-structure-painter: background padding tree;
table-border-color: auto;
cell-background-color: white;
text-align: left;
padding: 0 5;
}
Because of your reply I checked again and when I use the following values the padding seems to be ignored:
.modern {
tree-structure-painter: background padding tree;
table-border-color: auto;
cell-background-color: white;
text-align: left;
row-height: auto; /* I added this line */
padding: 10 10 10 10; /* I increased the values */
}
Please note that the cells width/height is not adjusted at all and thus any information is actually hidden. In the example given when I manually increase the row height by maybe 2 pixels with the mouse the rows autoexpand(!) and all the information is there with the correct padding. Can you reproduce this behaviour? Is it me abusing CSS or is this a bug? If smaller values are used everything is working as expected. For example:
row-height: auto;
padding: 5 10 10 10;
works for me.
If "row-height: auto" is not given the information may be cut but is still visible to some extend, i.e. the information is being moved out of the visible part of the cell.
Quote:
The tree-structure-painter CSS property is only available on table level. This is also documented in the N&N of 1.4.
Mh...I am not sure what you mean by table level or rather what the consequences are. You mean that the styling is applied to late? Well, I will read the N&N again.
Quote:
2. alignment
This also works. But maybe not as you expect. The tree state icons are always rendered left aligned. But the content can be aligned differently. I assume the issue is the same as above.
Quote:
3. decoration icon left to the tree status
First, your assumption is wrong that the supported values for tree-structure-painter are only background, padding and tree. In theory you can add also other available painters like decorator. That would be the solution, but currently the TreeLayer doesn't respect a CellPainterDecorator while searching for the IndentedTreeImagePainter. For that I created a ticket and proposed a fix, so it is possible to create such a painter programmatically. But it won't work on CSS level as the tree-structure-painter needs to be specified on table level, the decorator value expects the decoration property, otherwise it fails to create it, and you definitely don't want the decoration on all columns.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=498920
Thank you very much.
|
|
|
|
Re: Tree full CSS styling of tree status column [message #1739500 is a reply to message #1739368] |
Tue, 02 August 2016 13:05 |
Lothar L. Messages: 27 Registered: July 2016 |
Junior Member |
|
|
Dirk Fauth wrote on Sat, 30 July 2016 21:29There are several things to notice. In short, it is not possible to configure this via CSS, nor are some of the requested features possible.
But one by one:
1. padding
This actually works. And this is shown in the examples. As it is not working in your case, I assume you specified the tree-structure-painter for a label (e.g. TREE_COLUMN_CELL). But that is not working. The tree-structure-painter CSS property is only available on table level. This is also documented in the N&N of 1.4.
2. alignment
This also works. But maybe not as you expect. The tree state icons are always rendered left aligned. But the content can be aligned differently. I assume the issue is the same as above.
3. decoration icon left to the tree status
First, your assumption is wrong that the supported values for tree-structure-painter are only background, padding and tree. In theory you can add also other available painters like decorator. That would be the solution, but currently the TreeLayer doesn't respect a CellPainterDecorator while searching for the IndentedTreeImagePainter. For that I created a ticket and proposed a fix, so it is possible to create such a painter programmatically. But it won't work on CSS level as the tree-structure-painter needs to be specified on table level, the decorator value expects the decoration property, otherwise it fails to create it, and you definitely don't want the decoration on all columns.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=498920
Regarding your second answer, mh...I think I might have stumbled on a bug in the example:
org.eclipse.nebula.widgets.nattable.examples.e4.part.TreeExample.postConstruct(Composite)
// turn the auto configuration off as we want to add our header menu
// configuration
final NatTable natTable = new NatTable(container, gridLayer);
I get the behaviour you desribe if I change the code to:
org.eclipse.nebula.widgets.nattable.examples.e4.part.TreeExample.postConstruct(Composite)
// turn the auto configuration off as we want to add our header menu
// configuration
final NatTable natTable = new NatTable(container, gridLayer, false);
....
....
natTable.addConfiguration(new DefaultNatTableStyleConfiguration());
natTable.configure();
Can you confirm this? Would it be ok if I provide a patch via Gerrit.
[Updated on: Tue, 02 August 2016 13:16] Report message to a moderator
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05393 seconds