javanattablenebula

How to hide the border line of cells in NatTable


I wanto hide the boder line of cells in NatTable (Nebula). I tried with Style (set thickness = 0) but not yet successful :

Style textCellStyle = new Style();
textCellStyle.setAttributeValue(
                        CellStyleAttributes.BORDER_STYLE,
                        new BorderStyle(0, GUIHelper.COLOR_BLUE, LineStyleEnum.DASHED));

Can you give me some guide? Thank you very much!

Update: the code that I used:

NatTable natTable = new NatTable(parent, false);
ConfigRegistry configRegistry = new ConfigRegistry();
natTable.setConfigRegistry(configRegistry);
natTable.addConfiguration(new DefaultNatTableStyleConfiguration());
configRegistry.registerConfigAttribute(
                CellConfigAttributes.RENDER_GRID_LINES, 
                Boolean.FALSE);
///...
CompositeLayer composeLayer = new CompositeLayer(2, 2);
        composeLayer.setChildLayer(GridRegion.CORNER, cornerLayer, 0, 0);
        composeLayer.setChildLayer(GridRegion.COLUMN_HEADER, columnHeaderLayer, 1, 0);
        composeLayer.setChildLayer(GridRegion.ROW_HEADER, rowHeaderLayer, 0, 1);
        composeLayer.setChildLayer(GridRegion.BODY, viewportLayer, 1, 1);
natTable.setLayer(composeLayer);
natTable.refresh();

How can we apply the solution's Dirk in the BODY only?


Solution

  • I suppose you are talking about the grid lines and not border lines.

    You can disable grid line rendering via

    configRegistry.registerConfigAttribute(
                CellConfigAttributes.RENDER_GRID_LINES, 
                Boolean.FALSE);
    

    The following code just registers the setting for the body region:

    configRegistry.registerConfigAttribute(
                CellConfigAttributes.RENDER_GRID_LINES, 
                Boolean.FALSE,
                DisplayMode.NORMAL,
                GridRegion.BODY);