IColumnPropertyAccessor<Person> accessor = new ReflectiveColumnPropertyAccessor<Person>(
propertyNames);
IDataProvider bodyDataProvider = new ListDataProvider<Person>(
sortedList, accessor);
DataLayer bodyDataLayer = new DataLayer(bodyDataProvider);
GlazedListsEventLayer<Person> eventLayer = new GlazedListsEventLayer<Person>(
bodyDataLayer, sortedList);
ColumnReorderLayer columnReorderLayer = new ColumnReorderLayer(
eventLayer);
ColumnGroupReorderLayer columnGroupReorderLayer = new ColumnGroupReorderLayer(
columnReorderLayer, columnGroupModel);
ColumnHideShowLayer columnHideShowLayer = new ColumnHideShowLayer(
columnGroupReorderLayer);
ColumnGroupExpandCollapseLayer columnGroupExpandCollapseLayer = new ColumnGroupExpandCollapseLayer(
columnHideShowLayer, columnGroupModel);
SelectionLayer selectionLayer = new SelectionLayer(
columnGroupExpandCollapseLayer);
ViewportLayer viewportLayer = new ViewportLayer(selectionLayer);
// 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,