| package org.eclipse.nebula.widgets.nattable.renderer.swt.layer.impl |
| |
| import org.eclipse.nebula.widgets.nattable.core.layer.Layer |
| import org.eclipse.nebula.widgets.nattable.core.layer.cell.Cell |
| import org.eclipse.nebula.widgets.nattable.renderer.swt.layer.LayerRenderer |
| import org.eclipse.nebula.widgets.nattable.renderer.swt.layer.cell.impl.DefaultCellRenderer |
| import org.eclipse.swt.graphics.GC |
| |
| import static extension org.eclipse.nebula.widgets.nattable.core.layer.LayerInvariants.* |
| import static extension org.eclipse.nebula.widgets.nattable.core.layer.cell.CellInvariants.* |
| |
| class CellLayerRenderer implements LayerRenderer { |
| |
| val cellRenderer = new DefaultCellRenderer |
| |
| override renderLayer(Layer layer, GC gc) { |
| // gc.clearRect(0, 0, canvas.boundsInLocal.width, canvas.boundsInLocal.height) |
| |
| for (columnPosition : 0 ..< layer.columnCount) |
| for (rowPosition : 0 ..< layer.rowCount) { |
| val cell = layer.getCell(columnPosition, rowPosition) |
| |
| cellRenderer.renderCell(cell, gc, cell.getPaintRegion) |
| } |
| } |
| |
| protected def getPaintRegion(Cell cell) { |
| cell.pixelBounds |
| } |
| |
| } |