0

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

4

1 回答 1

0

IIRC 您添加换行符以节省一些空间。出于任何语义原因不需要它们。如果没有足够的空间可用,我建议配置TextPainter使列标题单元格内容自动换行。例如,这可能如下所示:

configRegistry.registerConfigAttribute(
    CellConfigAttributes.CELL_PAINTER,
    new BeveledBorderDecorator(new TextPainter(true, false, false, true)),
    DisplayMode.NORMAL,
    GridRegion.COLUMN_HEADER);
于 2021-03-22T05:19:52.457 回答