Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » Freeze a tree column
Freeze a tree column [message #1007583] Wed, 06 February 2013 15:09 Go to next message
Istvan Meszaros is currently offline Istvan Meszaros
Messages: 44
Registered: October 2009
Member
I'm trying to create a table with a freezed first column which is also a tree column. I came up with the following code based upon the NatTable examples.

My table is showing with the freezed column but the tree functionality is not visible/available.

I could use both of the features separately with no issues but no luck in combining them.

I'd appreciate any suggestions.

ConfigRegistry configRegistry = new ConfigRegistry();
configRegistry.registerConfigAttribute(SortConfigAttributes.SORT_COMPARATOR, new DefaultComparator());

EventList<MProjectPortfolio> eventList = GlazedLists.eventList(portfolio);
SortedList<MProjectPortfolio> sortedList = new SortedList<MProjectPortfolio>(eventList, null);

String[] propertyNames = new String[] { ... };
IColumnPropertyAccessor<MProjectPortfolio> columnPropertyAccessor = new ReflectiveColumnPropertyAccessor<MProjectPortfolio>(propertyNames);
IDataProvider columnHeaderDataProvider = new DefaultColumnHeaderDataProvider(propertyNames);
DataLayer columnHeaderDataLayer = new DefaultColumnHeaderDataLayer(columnHeaderDataProvider);

ISortModel sortModel = new GlazedListsSortModel<MProjectPortfolio>(sortedList, columnPropertyAccessor, configRegistry, columnHeaderDataLayer);
final TreeList<MProjectPortfolio> treeList = new TreeList<MProjectPortfolio>(sortedList, new MProjectPortfolioTreeFormat(sortModel), new MProjectPortfolioExpansionModel());
GlazedListTreeData<MProjectPortfolio> treeData = new MProjectPortfolioTreeData(treeList);
GlazedListsDataProvider<MProjectPortfolio> bodyDataProvider = new GlazedListsDataProvider<MProjectPortfolio>(treeList, columnPropertyAccessor);
DataLayer bodyDataLayer = new DataLayer(bodyDataProvider);

ColumnReorderLayer columnReorderLayer = new ColumnReorderLayer(bodyDataLayer);
ColumnHideShowLayer columnHideShowLayer = new ColumnHideShowLayer(columnReorderLayer);
SelectionLayer selectionLayer = new SelectionLayer(columnHideShowLayer);

TreeLayer treeLayer = new TreeLayer(selectionLayer, new GlazedListTreeRowModel<MProjectPortfolio>(treeData), false);

FreezeLayer freezeLayer = new FreezeLayer(treeLayer);

ViewportLayer viewportLayer = new ViewportLayer(selectionLayer);
CompositeFreezeLayer compositeFreezeLayer = new CompositeFreezeLayer(freezeLayer, viewportLayer, selectionLayer);

ColumnHeaderLayer columnHeaderLayer = new ColumnHeaderLayer(columnHeaderDataLayer, compositeFreezeLayer, selectionLayer);

ColumnOverrideLabelAccumulator labelAccumulator = new ColumnOverrideLabelAccumulator(columnHeaderDataLayer);
columnHeaderDataLayer.setConfigLabelAccumulator(labelAccumulator);

SortHeaderLayer<MProjectPortfolio> sortHeaderLayer = new SortHeaderLayer<MProjectPortfolio>(columnHeaderLayer, sortModel, false);

DefaultRowHeaderDataProvider rowHeaderDataProvider = new DefaultRowHeaderDataProvider(bodyDataProvider);
DefaultRowHeaderDataLayer rowHeaderDataLayer = new DefaultRowHeaderDataLayer(rowHeaderDataProvider);
RowHeaderLayer rowHeaderLayer = new RowHeaderLayer(rowHeaderDataLayer, compositeFreezeLayer, selectionLayer);

DefaultCornerDataProvider cornerDataProvider = new DefaultCornerDataProvider(columnHeaderDataProvider, rowHeaderDataProvider);
DataLayer cornerDataLayer = new DataLayer(cornerDataProvider);
CornerLayer cornerLayer = new CornerLayer(cornerDataLayer, rowHeaderLayer, sortHeaderLayer);

GridLayer gridLayer = new GridLayer(compositeFreezeLayer, sortHeaderLayer, rowHeaderLayer, cornerLayer);

NatTable natTable = new NatTable(container, gridLayer, false);
natTable.setConfigRegistry(configRegistry);
natTable.addConfiguration(new DefaultNatTableStyleConfiguration());
natTable.addConfiguration(new HeaderMenuConfiguration(natTable));
natTable.addConfiguration(new DefaultTreeLayerConfiguration(treeLayer));
natTable.addConfiguration(new SingleClickSortConfiguration());

natTable.configure();

selectionLayer.setSelectedCell(1, 0);
natTable.doCommand(new FreezeSelectionCommand());
selectionLayer.clear();

Re: Freeze a tree column [message #1007922 is a reply to message #1007583] Fri, 08 February 2013 08:28 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk Fauth
Messages: 1339
Registered: July 2012
Senior Member
Hi,

sorry for the late reply. I currently do not see why it shouldn't work and need to do some more research. Maybe it is only related to the layer composition. I'll check that and get back to you after I've found something.

Greez,
Dirk
Re: Freeze a tree column [message #1007923 is a reply to message #1007922] Fri, 08 February 2013 08:30 Go to previous messageGo to next message
Istvan Meszaros is currently offline Istvan Meszaros
Messages: 44
Registered: October 2009
Member
Thank you in advance!
Re: Freeze a tree column [message #1008009 is a reply to message #1007583] Fri, 08 February 2013 08:28 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk Fauth
Messages: 1339
Registered: July 2012
Senior Member
Hi,

sorry for the late reply. I currently do not see why it shouldn't work and need to do some more research. Maybe it is only related to the layer composition. I'll check that and get back to you after I've found something.

Greez,
Dirk
Re: Freeze a tree column [message #1008016 is a reply to message #1007583] Fri, 08 February 2013 08:28 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk Fauth
Messages: 1339
Registered: July 2012
Senior Member
Hi,

sorry for the late reply. I currently do not see why it shouldn't work and need to do some more research. Maybe it is only related to the layer composition. I'll check that and get back to you after I've found something.

Greez,
Dirk
Re: Freeze a tree column [message #1008023 is a reply to message #1007583] Fri, 08 February 2013 08:28 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk Fauth
Messages: 1339
Registered: July 2012
Senior Member
Hi,

sorry for the late reply. I currently do not see why it shouldn't work and need to do some more research. Maybe it is only related to the layer composition. I'll check that and get back to you after I've found something.

Greez,
Dirk
Re: Freeze a tree column [message #1008049 is a reply to message #1007923] Fri, 08 February 2013 16:16 Go to previous message
Dirk Fauth is currently offline Dirk Fauth
Messages: 1339
Registered: July 2012
Senior Member
Hi,

the issue you reported is in fact a bug. To be more precise, two bugs as we found out after fixing the first one.

https://bugs.eclipse.org/bugs/show_bug.cgi?id=400325
https://bugs.eclipse.org/bugs/show_bug.cgi?id=400330

Edwin was able to fix those bugs and pushed them in the current master of NatTable. If you need this feature now, you should consider using the current development state (which is quite stable).

Greez,
Dirk
Previous Topic:CellEditor on DoubleCLick?
Next Topic:Using GroupByHeaderLayer
Goto Forum:
  


Current Time: Sat Oct 25 12:59:25 GMT 2014

Powered by FUDForum. Page generated in 0.01689 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software