I've header menu configuration added in my nat table as follows,where I've included "Select Columns" menu as well:

// Popup menu

this.natTable.addConfiguration(new HeaderMenuConfiguration(this.natTable) {

@Override

protected PopupMenuBuilder createColumnHeaderMenu(NatTable natTable) {

  return super.createColumnHeaderMenu(natTable) .withColumnChooserMenuItem(); }

});

// Column chooser

DisplayColumnChooserCommandHandler columnChooserCommandHandler = new DisplayColumnChooserCommandHandler( bodyLayer.getSelectionLayer(), bodyLayer.getColumnHideShowLayer(), columnHeaderLayer.getColumnHeaderLayer(), columnHeaderLayer.getColumnHeaderDataLayer(), columnHeaderLayer.getColumnGroupHeaderLayer(), columnGroupModel);

//If header name consists of multiple words then I've used ("\n") as a separator between words in //the header column name ,so that some space could be saved

// In that case on opening "Select Columns" context menu dialog only first word of column is visible

Can it be fixed by replacing all "\n" and white space character by single white space(" ") character in In org.eclipse.nebula.widgets.nattable.columnChooser.gui.ColumnChooserDialog //code to replace extra white spaces or new line character from column label with single space so that //header name is completely visible in populate tree method treeItem.setText(columnEntry.getLabel()); In that case can fix be provided to replace extra space with single space in column header name or is there any other alternative to fix it? Image with header names having multiple words For eg:"Issue Date",if header name is dispalyed as "Issue\nDate",only Issue is visible in "Select Columns" context menu dialog

1

There are 1 best solutions below

5
Dirk Fauth On

IIRC you add the line breaks to save some space. They are not needed for any semantical reason. I would suggest to configure the TextPainter that renders the column header cell content to wrap automatically if not enough space is available. This could look like this for example:

configRegistry.registerConfigAttribute(
    CellConfigAttributes.CELL_PAINTER,
    new BeveledBorderDecorator(new TextPainter(true, false, false, true)),
    DisplayMode.NORMAL,
    GridRegion.COLUMN_HEADER);