getCellByPosition() returning a null datavalue [message #1426267] |
Thu, 18 September 2014 13:45 |
|
Hi !
I am currently trying to get the cells from the getCellByPosition(int, int) method. If it does indeed return a TranslatedLayerCell, most of its fields are null (such as bounds, configLabels, datavalue...) and what really has me puzzled is that i can get them using the other accessors such as getDataValueByPosition() and getConfigLabelsByPosition().
I feel like I am missing something concerning the different layers but I reallly cant find out what...
these are the two snippets I have tested so far :
BodyLayerStack bs = (BodyLayerStack) cell.getLayer().getUnderlyingLayerByPosition(cell.getColumnIndex(), cell.getRowIndex());
List<Object> rowSpan = ArrayUtil.asList(bs.getSelectionLayer().getSelectedRowPositions().toArray());
List<Integer> columnSpan = ArrayUtil.asIntegerList(bs.getSelectionLayer().getSelectedColumnPositions());
List<Integer> rowSpanRange = ArrayUtil.asList(((Range) rowSpan.get(0)).getMembers().toArray(new Integer[0]));
List<ILayerCell> mergedCells = new ArrayList<ILayerCell>();
for (Integer indexY : rowSpanRange) {
for (Integer indexX : columnSpan) {
mergedCells.add(bs.getCellByPosition(indexX, indexY)); // yielding a list of cells with mostly null values
}
}
and,
((NatTable) parent).getLayer().getCellByPosition(2, 2); // yielding cells but with mostly null values
((NatTable) parent).getLayer().getDataValueByPosition(2, 2); // yielding the correct value
((NatTable) parent).getLayer().getConfigLabelsByPosition(2, 2); // yielding the correct value
Thank you for any enlightenment that you could bestow upon me
|
|
|
|
Re: getCellByPosition() returning a null datavalue [message #1426290 is a reply to message #1426285] |
Thu, 18 September 2014 14:20 |
|
I am trying to edit merged cells using a method extracted from EditController: editCells and giving the layer.doCommand(new UpdateDataCommand(layer, selectedCell.getColumnPosition(), selectedCell.getRowPosition(), editorValue)) all the selected merged cells.
oh and also an edition through: cellEditor.activateCell(parent, initialCanonicalValue, EditModeEnum.INLINE, editHandler, cell, configRegistry);
for the first one, I may already have all I need, but for the second I think I need the cells for it to work; which I can't seem to get...
ps: the "cell" and "selectedCell" used are both obtained through mouse selection in the table
[Updated on: Thu, 18 September 2014 14:53] Report message to a moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.11751 seconds