jeudi 27 avril 2017

NatTable - CheckBoxCellEditor & CheckBoxPainter displaying the text on single click

I am using CheckBoxCellEditor and CheckBoxPainter to display Boolean attribute inside the NatTable as shown below

enter image description here

Problem : On single click of cell using mouse, it displays boolean value as text as shown below, instead of resetting the state to false.

enter image description here

Below is my code snippet,

//register the column
ColumnOverrideLabelAccumulator columnLabelAccumulator = new ColumnOverrideLabelAccumulator(
                bodyLayer.getBodyDataLayer());
        bodyLayer.getBodyDataLayer().setConfigLabelAccumulator(columnLabelAccumulator);
        columnLabelAccumulator.registerColumnOverrides(0, COLUMN_BOOKMARK_LABEL);

//added the CheckBoxCellEditor and CheckBoxCellPainter to configuration.
     natTable.addConfiguration(new AbstractRegistryConfiguration() {
                    @Override
                    public void configureRegistry(IConfigRegistry configRegistry) {
                        configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITOR, new CheckBoxCellEditor(), DisplayMode.NORMAL,
                                COLUMN_BOOKMARK_LABEL);

                        configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, new CheckBoxPainter(ImageUtil.getImage("Images.BookmarkChecked"),
                                ImageUtil.getImage("Images.BookmarkUnchecked")),
                                DisplayMode.NORMAL, COLUMN_BOOKMARK_LABEL);

                        configRegistry.registerConfigAttribute(CellConfigAttributes.DISPLAY_CONVERTER,
                                new DefaultBooleanDisplayConverter(), DisplayMode.NORMAL, COLUMN_BOOKMARK_LABEL);
                    }
                });

I also, have rowselectionProvider to set the default selection to first row and also to refresh the properties UI based on the row selection.

Any pointers on what is the missing link.TIA




Aucun commentaire:

Enregistrer un commentaire