NatTable has native understanding of four grid regions (corner, column header, row header, and body) which makes it easy to associate configuration and behavior with these regions. Each region has its own cell renderer which renders cells in the relative coordinate system of its associated region.
Columns can be reordered simply dragging them to a new location. NatTable maintains the reordered position information itself internally, so even though you see your columns out of order, your code doesn't need to be aware of the reordering.
Columns can be sorted by clicking on their column header. Multiple columns can be sorted by holding down ALT and clicking on subsequent column headers.
NatTable has support for freezing rows/columns as in the Excel 'freeze panes' feature.
NatTable is designed to handle very large data sets. It tries hard to render only what it needs to and to do so as efficiently as possible.
NatTable provides an effective way to control grid repaint in the screen. No matter how many add/update/remove events are fired to NatTable, it will consolidate them into one single repaint within a predefined period. As a result, you don't need to care more about the upstream volume, the screen will still be stable and responsive.
The core NatTable model interfaces are very general and allow for a wide range of implementations. For example, any data source can be used to supply data to NatTable provided it can be accessed through the following very simple interface:
public interface IDataProvider {
public Object getValue(int row, int col);
public int getColumnCount();
public int getRowCount();
}
This allows for features like storage allocation strategies, paging, etc. to be provided by implementations and integrated seamlessly with NatTable. Various implementations of these interfaces are provided to help get things running quickly for common cases, but the general interfaces are also always available to be implemented for situations where the stock implementations will not suffice.
In the NatTable extensions are classes which allow you to easily integrate GlazedLists as the backing model for NatTable as well as link it to UI column sort actions and data update events.
NatTable includes a powerful mechanism for allowing cell configuration information to be registered by 'configuration type'. Configuration types are simply names to which you can associate various attributes such as style information, comparators, etc. Types can also have supertypes from which they inherit. Once the various types have been created and registered, an IConfigTypeResolver is used to determine what configuration type should be used for a given cell or a given row. This is a potent combination that makes it easy to define configuration information and allows for great flexibility in how these configurations are applied to various portions of the grid.
To illustrate this, let's take a look at style configuration information in detail and how it is defined and used by a special implementation of INatCellRenderer called the ConfigDrivenCellRenderer. First, we need to define our style information and associate it with various config types. We do this by creating IStyleConfig objects and registering them in the ConfigRegistry under some config type names. Rendering styles also need to indicate what display mode they are associated with. The grid has several display modes: NORMAL, SELECT, EDIT which indicate whether the grid is rendering cells normally, rendering cells as selected, or rendering cells in edit mode. Depending on what mode the grid is in, appropriate style configurations will be retrieved for that mode.
We can then create an IConfigTypeResolver that understands our data model and associates config types based on particular object attribute values.
Many NatTable features can also be configured declaratively through XML.
Recent comments
33 weeks 2 days ago
47 weeks 1 day ago