row auto resizing [message #1386694] |
Thu, 19 June 2014 09:53  |
Eclipse User |
|
|
|
Hello,
I've been trying to auto resize rows using the solution in the FAQ section of the doc:
natTable.addConfiguration(new DefaultNatTableStyleConfiguration() {
{
cellPainter = new LineBorderDecorator(new CustomTextPainter(
true, true, 5, false, true));
}
}
This worked but...
Scenario:
When I applied a filter on column the first row got larger (as it should).
When I removed the filter the first row remained with the large unneccessary height.
I tried the other solutions:
natTable.addPaintListener(new PaintListener()
{
@Override
public void paintControl(PaintEvent e){
for (int i = 0; i < natTable.getRowCount(); i++)
{
InitializeAutoResizeRowsCommand rowCommand = new InitializeAutoResizeRowsCommand(natTable, i, natTable.getConfigRegistry(), new GCFactory(
natTable));
AutoResizeRowsCommand command = new AutoResizeRowsCommand(rowCommand);
natTable.doCommand(command);
}
}
This did nothing!! Whether I changed the last flag of the cellPainter or not.
I noticed in debug that the appropriate command handler was called.
I tried invoking both InitializeAutoResizeRowsCommand and AutoResizeRowsCommand, yet nothing changed!
Any ideas??
Maybe I am missing a layer?
Thanks!
|
|
|
|
|
|
|
|
|
Re: row auto resizing [message #1386880 is a reply to message #1386877] |
Sun, 22 June 2014 05:54  |
Eclipse User |
|
|
|
It works on layout resize because line wrapping behaviour is configured. The important thing is the automatic size configuration and the code that performs resize on shrinking.
Check the Javadoc and the implementation for further details.
|
|
|
Powered by
FUDForum. Page generated in 0.04179 seconds