javaeclipse-rcpnattable

Change height of the Column Header, not resize, in Nattable


I want to increase the size of the column header cell so I have made a CustomCellPainter extending BeveledBorderDecorator class and I have assigned interiorBounds.height as 25 as shown below, but the content from the columnHeaderLayer was getting hidden behind the bodyLayer, just like image provided here changing the height of column header in Nattable.

public void paintCell(ILayerCell cell, GC gc, Rectangle adjustedCellBounds, IConfigRegistry configRegistry) {
            Rectangle interiorBounds = getWrappedPainterBounds(cell, gc,
                    adjustedCellBounds, configRegistry);
            
            interiorBounds.height = 25;
            
            super.paintCell(cell, gc, interiorBounds, configRegistry);

I want to change the height of column header cell and want it to reflect properly at the time of rendering. I would like to know what API to be used for this.


Solution

  • You should never touch a painter unless you know what you are doing.

    If you want to change the height of the ColumnHeaderLayer programmatically while setting up the structure, you simply need to configure the DataLayer accordingly.

    ILayer columnHeaderLayer = new ColumnHeaderLayer(
        new DataLayer(columnHeaderDataProvider, DataLayer.DEFAULT_COLUMN_WIDTH, 25),
        viewportLayer,
        selectionLayer);