| package org.eclipse.nebula.widgets.nattable.core.layer.impl |
| |
| import org.eclipse.nebula.widgets.nattable.core.geometry.PixelRectangle |
| import org.eclipse.nebula.widgets.nattable.core.graphics.GraphicsContext |
| import org.eclipse.nebula.widgets.nattable.core.layer.Layer |
| import org.eclipse.nebula.widgets.nattable.core.layer.LayerPainter |
| import org.eclipse.nebula.widgets.nattable.core.layer.cell.Cell |
| import org.eclipse.nebula.widgets.nattable.core.layer.cell.impl.DefaultCellPainter |
| |
| import static extension org.eclipse.nebula.widgets.nattable.core.layer.LayerInvariants.* |
| import static extension org.eclipse.nebula.widgets.nattable.core.layer.cell.CellInvariants.* |
| |
| class CellLayerPainter implements LayerPainter<Layer> { |
| |
| val cellPainter = new DefaultCellPainter |
| |
| // LayerPainter interface |
| |
| override paintLayer(Layer layer, PixelRectangle paintBounds, GraphicsContext gc) { |
| // gc.clearRect(0, 0, canvas.boundsInLocal.width, canvas.boundsInLocal.height) |
| |
| for (columnPosition : 0 ..< layer.getColumnCount) |
| for (rowPosition : 0 ..< layer.getRowCount) { |
| val cell = layer.getCell(columnPosition, rowPosition) |
| gc.pushState |
| gc.clipBounds = cell.paintRegion |
| cellPainter.paintCell(cell, cell.paintRegion, gc) |
| gc.popState |
| } |
| } |
| |
| // |
| |
| protected def getPaintRegion(Cell cell) { |
| cell.pixelBounds |
| } |
| |
| } |