use of org.eclipse.nebula.widgets.nattable.layer.cell.TranslatedLayerCell in project nebula.widgets.nattable by eclipse.
the class HierarchicalTreeLayer method getCellByPosition.
@Override
public ILayerCell getCellByPosition(int columnPosition, int rowPosition) {
if (isLevelHeaderColumn(columnPosition)) {
ILayerCell right = getCellByPosition(columnPosition + 1, rowPosition);
if (right != null) {
return new LayerCell(this, columnPosition, right.getOriginRowPosition(), columnPosition, rowPosition, 1, right.getRowSpan());
}
return null;
}
int underlyingColumnPosition = localToUnderlyingColumnPosition(columnPosition);
int underlyingRowPosition = localToUnderlyingRowPosition(rowPosition);
ILayerCell cell = this.underlyingLayer.getCellByPosition(underlyingColumnPosition, underlyingRowPosition);
if (cell != null) {
ILayerCell localCell = new TranslatedLayerCell(cell, this, underlyingToLocalColumnPosition(this.underlyingLayer, cell.getOriginColumnPosition()), underlyingToLocalRowPosition(this.underlyingLayer, cell.getOriginRowPosition()), underlyingToLocalColumnPosition(this.underlyingLayer, cell.getColumnPosition()), underlyingToLocalRowPosition(this.underlyingLayer, cell.getRowPosition()));
if (cell.isSpannedCell()) {
// in case a deeper level is collapsed, rows are hidden via row
// hide/show mechanism
// therefore the spanning needs to be updated to reflect the
// hiding accordingly
int rowSpan = cell.getRowSpan();
for (int row = 0; row < cell.getRowSpan(); row++) {
int rowIndex = this.underlyingLayer.getRowIndexByPosition(cell.getOriginRowPosition() + row);
if (isRowIndexHidden(rowIndex)) {
rowSpan--;
}
}
cell = new SpanningLayerCell(localCell, localCell.getColumnSpan(), rowSpan);
} else {
cell = localCell;
}
}
return cell;
}
use of org.eclipse.nebula.widgets.nattable.layer.cell.TranslatedLayerCell in project nebula.widgets.nattable by eclipse.
the class AbstractLayerTransform method getCellByPosition.
// Cell features
@Override
public ILayerCell getCellByPosition(int columnPosition, int rowPosition) {
int underlyingColumnPosition = localToUnderlyingColumnPosition(columnPosition);
int underlyingRowPosition = localToUnderlyingRowPosition(rowPosition);
ILayerCell cell = this.underlyingLayer.getCellByPosition(underlyingColumnPosition, underlyingRowPosition);
if (cell != null) {
cell = new TranslatedLayerCell(cell, this, underlyingToLocalColumnPosition(this.underlyingLayer, cell.getOriginColumnPosition()), underlyingToLocalRowPosition(this.underlyingLayer, cell.getOriginRowPosition()), underlyingToLocalColumnPosition(this.underlyingLayer, cell.getColumnPosition()), underlyingToLocalRowPosition(this.underlyingLayer, cell.getRowPosition()));
}
return cell;
}
use of org.eclipse.nebula.widgets.nattable.layer.cell.TranslatedLayerCell in project nebula.widgets.nattable by eclipse.
the class CompositeLayer method getCellByPosition.
// Cell features
@Override
public ILayerCell getCellByPosition(int compositeColumnPosition, int compositeRowPosition) {
Point layoutCoordinate = getLayoutXYByPosition(compositeColumnPosition, compositeRowPosition);
if (layoutCoordinate == null) {
return null;
}
ILayer childLayer = this.childLayerLayout[layoutCoordinate.x][layoutCoordinate.y];
int childColumnPosition = compositeColumnPosition - getColumnPositionOffset(layoutCoordinate.x);
int childRowPosition = compositeRowPosition - getRowPositionOffset(layoutCoordinate.y);
ILayerCell cell = childLayer.getCellByPosition(childColumnPosition, childRowPosition);
if (cell != null) {
cell = new TranslatedLayerCell(cell, this, underlyingToLocalColumnPosition(childLayer, cell.getOriginColumnPosition()), underlyingToLocalRowPosition(childLayer, cell.getOriginRowPosition()), underlyingToLocalColumnPosition(childLayer, cell.getColumnPosition()), underlyingToLocalRowPosition(childLayer, cell.getRowPosition()));
}
return cell;
}
Aggregations