// build the column header layer
IDataProvider columnHeaderDataProvider = new DefaultColumnHeaderDataProvider(
propertyNames, propertyToLabelMap);
DataLayer columnHeaderDataLayer = new DefaultColumnHeaderDataLayer(
columnHeaderDataProvider);
ILayer columnHeaderLayer = new ColumnHeaderLayer(columnHeaderDataLayer,
viewportLayer, selectionLayer);
ConfigRegistry configRegistry = new ConfigRegistry();
SortHeaderLayer<Person> sortHeaderLayer = new SortHeaderLayer<Person>(
columnHeaderLayer, new GlazedListsSortModel<Person>(sortedList,
accessor, configRegistry, columnHeaderDataLayer));
ColumnGroupHeaderLayer columnGroupHeaderLayer = new ColumnGroupHeaderLayer(
sortHeaderLayer, selectionLayer, columnGroupModel);
// configure the column groups
columnGroupHeaderLayer.addColumnsIndexesToGroup("Name", 0, 1);
columnGroupHeaderLayer.addColumnsIndexesToGroup("Details", 2, 3, 4);
columnGroupHeaderLayer.setGroupUnbreakable(1);
// build the row header layer
IDataProvider rowHeaderDataProvider = new DefaultRowHeaderDataProvider(
bodyDataProvider);
DataLayer rowHeaderDataLayer = new DefaultRowHeaderDataLayer(
rowHeaderDataProvider);
ILayer rowHeaderLayer = new RowHeaderLayer(rowHeaderDataLayer,
viewportLayer, selectionLayer);
// build the corner layer
IDataProvider cornerDataProvider = new DefaultCornerDataProvider(
columnHeaderDataProvider, rowHeaderDataProvider);
DataLayer cornerDataLayer = new DataLayer(cornerDataProvider);
ILayer cornerLayer = new CornerLayer(cornerDataLayer, rowHeaderLayer,
columnGroupHeaderLayer);
// build the grid layer
GridLayer gridLayer = new GridLayer(viewportLayer,
columnGroupHeaderLayer, rowHeaderLayer, cornerLayer);