Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » Can't get TableCellPainter's dynamically calculated sub cell heights to work
Can't get TableCellPainter's dynamically calculated sub cell heights to work [message #1770856] Fri, 18 August 2017 01:35
Louis Detweiler is currently offline Louis DetweilerFriend
Messages: 57
Registered: August 2017
Member
Hey I'm implementing a NatTable where I need to have multiple separate entries in one row cell in some of the columns. I need all of the text in the cell to show, so naturally I would like to use the dynamically calculated sub cell heights feature of the TableCellPainter. However, with the input parameter set to -1, it doesn't do it.

I've included all of the code I feel is relevant for the topic here, and the attached image is the result of what I have. Note the sub cell heights do not show the entire contents. However, I did check that the wrap text was working by manually increasing the sub cell heights and the text does wrap, so I don't see why the dynamically calculated sub cell height doesn't work. All of the cells with excessive "a"s in them have text that isn't fully shown.

    final NatTable natTable = new NatTable(parent, gridLayer, false);
    natTable.addConfiguration(new RequirementsTableStyleConfiguration());
    natTable.addConfiguration(new PainterConfiguration());
    natTable.addConfiguration(new MyRowHeaderResizeBindings());

    natTable.configure();

    return natTable;
  }
  

  private static void registerColumnLabels(ColumnOverrideLabelAccumulator columnLabelAccumulator) {
    columnLabelAccumulator.registerColumnOverrides(0, COLUMN_WITH_SINGLE_ENTRY_LABEL);
    columnLabelAccumulator.registerColumnOverrides(1, COLUMN_WITH_MULTIPLE_ENTRIES_LABEL);
    columnLabelAccumulator.registerColumnOverrides(2, COLUMN_WITH_MULTIPLE_ENTRIES_LABEL);
    columnLabelAccumulator.registerColumnOverrides(3, COLUMN_WITH_MULTIPLE_ENTRIES_LABEL);
    columnLabelAccumulator.registerColumnOverrides(4, COLUMN_WITH_MULTIPLE_ENTRIES_LABEL);
    columnLabelAccumulator.registerColumnOverrides(5, COLUMN_WITH_MULTIPLE_ENTRIES_LABEL);
    columnLabelAccumulator.registerColumnOverrides(6, COLUMN_WITH_SINGLE_ENTRY_LABEL);
  }
  
  public static class PainterConfiguration extends AbstractRegistryConfiguration {

    @Override
    public void configureRegistry(IConfigRegistry configRegistry) {
      registerPainters(configRegistry);
    }

    private void registerPainters(IConfigRegistry configRegistry) {
      registerColumnWithMultipleEntriesTablePainter(configRegistry);
      registerColumnWithSingleEntryTablePainter(configRegistry);
    }

    private void registerColumnWithMultipleEntriesTablePainter(IConfigRegistry configRegistry) {
      //register the TableCellPainter for the source collection in the data model
      configRegistry.registerConfigAttribute(
            CellConfigAttributes.CELL_PAINTER, new TableCellPainter(new TextPainter(true,true),
                GUIHelper.COLOR_GRAY, GUIHelper.COLOR_WHITE, -1, true),
            DisplayMode.NORMAL, COLUMN_WITH_MULTIPLE_ENTRIES_LABEL);
    }
    
    private void registerColumnWithSingleEntryTablePainter(IConfigRegistry configRegistry) {
      //register the TableCellPainter for the source collection in the data model
      configRegistry.registerConfigAttribute(
            CellConfigAttributes.CELL_PAINTER, new TextPainter(true, true),
            DisplayMode.NORMAL, COLUMN_WITH_SINGLE_ENTRY_LABEL);
    }
    
    
  }


index.php/fa/30412/0/
Previous Topic:Register a normal click in a table with CellEditors
Next Topic:Import Excel to nabula nattable
Goto Forum:
  


Current Time: Fri Nov 16 10:23:45 GMT 2018

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

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

Back to the top