| package org.eclipse.nebula.widgets.nattable.core.layer.cell |
| |
| import org.eclipse.nebula.widgets.nattable.core.geometry.PixelRectangle |
| |
| import static extension org.eclipse.nebula.widgets.nattable.core.layer.LayerInvariants.* |
| |
| /** |
| * A set of useful utility functions that calculate invariants that must hold for any Cell. |
| */ |
| class CellInvariants { |
| |
| /** |
| * @return The pixel bounds of the cell relative to its owning layer. |
| */ |
| static def getPixelBounds(Cell cell) { |
| val layer = cell.layer |
| val positionBounds = cell.positionBounds |
| |
| val startX = layer.getStartXPixelOfColumnPosition(positionBounds.columnPosition) |
| val startY = layer.getStartYPixelOfRowPosition(positionBounds.rowPosition) |
| val endX = layer.getStartXPixelOfColumnPosition(positionBounds.columnPosition + positionBounds.width) |
| val endY = layer.getStartYPixelOfRowPosition(positionBounds.rowPosition + positionBounds.height) |
| |
| new PixelRectangle(startX, startY, endX - startX, endY - startY) |
| } |
| |
| } |