Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

NatTable 2.3.0 final release

Edwin Park
2011-09-26
2013-05-08
  • Edwin Park
    Edwin Park
    2011-09-26

    Hello all,

    I'm very pleased to announce that NatTable 2.3.0 final has been released! In addition to numerous bug fixes and feature enhancements, this release also contains some modifications to existing API in order to provide additional functionality and better consistency. In particular, APIs for the following have been changed:

    IDisplayConverter
    IDataValidator
    IEditableRule
    SelectionLayer
    ISelectionModel
    IBlinkingCellResolver
    RowGroupModel

    I will be following this post with details on affected API and notes on how you can migrate existing code to the new API.

    Many thanks to everyone who contributed to this release! And thanks also to our users for the great feedback on the forums!

    Cheers,
    Edwin

     
  • Edwin Park
    Edwin Park
    2011-09-26

    Most of the changes to the API in 2.3.0 involved providing additional context for cell callbacks. Now these callbacks have optional access to the LayerCell and IConfigRegistry, from which they can access config labels or lookup arbitrary configuration items.

    Some cleanup of the selection and row group APIs has also been included in this release.

    Here are details on the API changes in 2.3.0 (collated from https://sourceforge.net/projects/nattable/forums/forum/744994/topic/4637969):

    IDisplayConverter has a few new methods that have LayerCell and IConfigRegistry parameters to provide more complete cell context information:

    public Object canonicalToDisplayValue(LayerCell cell, IConfigRegistry configRegistry, Object canonicalValue);
    public Object displayToCanonicalValue(LayerCell cell, IConfigRegistry configRegistry, Object canonicalValue);
    

    If you do not require this additional context information, you can use the abstract DisplayConverter class which only requires you to implement the simpler preexisting methods without the cell or configRegistry parameters (its implementations of the newer methods just delegate to the simpler methods).

    As a result of the above changes the IDisplayConverter2 interface is no longer needed and has been removed.

    Migration notes:
    * If you were previously implementing IDisplayConverter, extend DisplayConverter instead.
    * If you were previously using IDisplayConverter2, use the new methods in IDisplayConverter instead and get the col/row indexes from the LayerCell parameter.

    IDataValidator has a new method that have LayerCell and IConfigRegistry parameters to provide more complete cell context information:

    public boolean validate(LayerCell cell, IConfigRegistry configRegistry, Object newValue);
    

    If you do not require this additional context information, you can use the abstract DataValidator class which only requires you to implement the simpler preexisting methods without the cell or configRegistry parameters (its implementations of the newer methods just delegate to the simpler methods).

    Migration notes:
    * If you were previously implementing IDataValidator, extend DataValidator instead.

    IEditableRule has a new method that have LayerCell and IConfigRegistry parameters to provide more complete cell context information:

    public boolean isEditable(LayerCell cell, IConfigRegistry configRegistry);
    

    If you do not require this additional context information, you can use the abstract EditableRule class which only requires you to implement the simpler preexisting methods without the cell or configRegistry parameters (its implementations of the newer methods just delegate to the simpler methods).

    Migration notes:
    * If you were previously implementing IEditableRule, extend EditableRule instead.

    IBlinkingCellResolver has a new method that has LayerCell and IConfigRegistry parameters to provide more complete cell context information:

    public String[] resolve(LayerCell cell, IConfigRegistry configRegistry, Object oldValue, Object newValue);
    

    If you do not require this additional context information, you can use the abstract BlinkingCellResolver class which only requires you to implement the simpler preexisting methods without the cell or configRegistry parameters (its implementations of the newer methods just delegate to the simpler methods).

    As a result of the above changes the IBlinkingCellResolver2 interface is no longer needed and has been removed.

    Migration notes:
    * If you were previously implementing IBlinkingCellResolver, extend BlinkingCellResolver instead.
    * If you were previously using IBlinkingCellResolver2, use the new methods in IBlinkingCellResolver instead and get the col/row indexes from the LayerCell parameter.

    SelectionLayer, ISelectionModel

    The method names for SelectionLayer and ISelectionModel have been slightly changed to be more consistent and descriptive.  'Position' has been added to method names in order to clearly indicate that position values are being returned.

    Migration notes:
    * Add 'Position' to method names that no longer compile (e.g. getSelectedColumns -> getSelectedColumnPositions, etc.)
    * removeSelection has also been renamed to clearSelection for consistency.

    RowGroupModel

    The RowGroupModel has been moved behind a couple of interfaces - IRowGroupModel and IRowGroup which are now both templated on the backing row object. You can now use the RowGroupModel provided or implement your own.

    An example of building a model using the provided implementation: -

    RowGroupModel<RowGroupDataFixture> rowGroupModel = new RowGroupModel<RowGroupDataFixture>();
    // Add three row objects from our data provider into the model at row positions 0, 1 and 2.
    // The last row is a static row which is always shown, even if the group is collapsed.
    RowGroup<RowGroupDataFixture> rowGroup = new RowGroup<RowGroupDataFixture>(rowGroupModel, "Group 1", true);
    rowGroup.addMemberRow(0, bodyDataProvider.getRowObject(1));
    rowGroup.addMemberRow(1, bodyDataProvider.getRowObject(2));
    rowGroup.addStaticMemberRow(2, bodyDataProvider.getRowObject(3));
    rowGroupModel.addRowGroup(rowGroup);
    

    Migration Notes:
    * If you were previously using addRowsIndexesToGroup on the RowGroupHeaderLayer to add rows into a group you should now call addMemberRow directly on an IRowGroup.