How to get row/column index based on position at CompositeLayer [message #1186039] |
Thu, 14 November 2013 07:39  |
Eclipse User |
|
|
|
I have a NatTable as a layer. Its underlying layer is a CompositeLayer with a column header layer and a body layer (ViewportLayer -> SelectionLayer -> ColumnHideShowLayer -> DataLayer).
Is it possible to get body layer row index from row position defined on the whole NatTable?
|
|
|
|
|
Re: How to get row/column index based on position at CompositeLayer [message #1186173 is a reply to message #1186068] |
Thu, 14 November 2013 09:27   |
Eclipse User |
|
|
|
Well, it's not working as I would expect.
Let's say the column header has 2 rows. Then, when I call
LayerUtil.convertRowPosition(compositeLayer, 0, bodyDataLayer);
LayerUtil.convertRowPosition(compositeLayer, 1, bodyDataLayer);
LayerUtil.convertRowPosition(compositeLayer, 2, bodyDataLayer);
LayerUtil.convertRowPosition(compositeLayer, 3, bodyDataLayer);
it returns 0, 0, 0, 1. That's confusing since I can't determine when the row position is really part of the bodyDataLayer.
I would expect -1, -1, 0, 1. Or am I missing the point here?
|
|
|
|
|
|
Re: How to get row/column index based on position at CompositeLayer [message #1186243 is a reply to message #1186201] |
Thu, 14 November 2013 10:24   |
Eclipse User |
|
|
|
Commands convert their position within AbstractPositionCommand#convertToTargetLayer(ILayer targetLayer) using the LayerCommandUtil class.
If I understand the code correctly, The LayerCommandUtil goes recursively through the layer stack to find the appropriate target position.
So when I use this code
LayerCommandUtil.convertRowPositionToTargetContext(new RowPositionCoordinate(compositeLayer, 0), bodyDataLayer);
LayerCommandUtil.convertRowPositionToTargetContext(new RowPositionCoordinate(compositeLayer, 1), bodyDataLayer);
LayerCommandUtil.convertRowPositionToTargetContext(new RowPositionCoordinate(compositeLayer, 2), bodyDataLayer);
LayerCommandUtil.convertRowPositionToTargetContext(new RowPositionCoordinate(compositeLayer, 3), bodyDataLayer);
it returns null, null, 0, 1. That's what I would expect. IMHO, this could be moved to the LayerUtil class.
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.08685 seconds