return new LayerCell(this,
getStartPositionOfGroup(columnPosition), rowPosition,
columnPosition, rowPosition,
getColumnSpan(columnPosition), 1);
} else {
ILayerCell underlyingCell = columnGroupHeaderLayer
.getCellByPosition(columnPosition, rowPosition);
return new LayerCell(this,
underlyingCell.getOriginColumnPosition(),
underlyingCell.getOriginRowPosition(), columnPosition,
rowPosition, underlyingCell.getColumnSpan(),
underlyingCell.getRowSpan() + 1);
}
} else if (rowPosition == 1) {
ILayerCell underlyingCell = columnGroupHeaderLayer
.getCellByPosition(columnPosition, rowPosition - 1);
boolean partOfAGroup = model.isPartOfAGroup(bodyColumnIndex);
return new LayerCell(this,
underlyingCell.getOriginColumnPosition(),
underlyingCell.getOriginRowPosition()
+ (partOfAGroup ? 1 : 0), columnPosition,
rowPosition, underlyingCell.getColumnSpan(),
underlyingCell.getRowSpan() + (partOfAGroup ? 0 : 1));
} else if (rowPosition == 2) {
ILayerCell underlyingCell = columnGroupHeaderLayer
.getCellByPosition(columnPosition, rowPosition - 1);
boolean partOfAGroup = model.isPartOfAGroup(bodyColumnIndex)
|| columnGroupHeaderLayer.isColumnInGroup(bodyColumnIndex);
return new LayerCell(this,
underlyingCell.getOriginColumnPosition(),
underlyingCell.getOriginRowPosition()
+ (partOfAGroup ? 1 : 0), columnPosition,
rowPosition, underlyingCell.getColumnSpan(),
underlyingCell.getRowSpan() + (partOfAGroup ? 0 : 1));
}
return null;
}