use of org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell in project nebula.widgets.nattable by eclipse.
the class CopyDataCommandHandlerTest method checkColumnHeaderCells.
private void checkColumnHeaderCells(ILayerCell[] cells) {
// First cell should be blank, this is the corner
assertNull(cells[0]);
// Should only have Column headers
int[] selectedColumns = this.gridLayer.getBodyLayer().getSelectionLayer().getSelectedColumnPositions();
for (int columnPosition = 1; columnPosition < cells.length; columnPosition++) {
ILayerCell cell = cells[columnPosition];
// Remember to substract offset from columnPosition
assertEquals(this.columnHeaderLayer.getDataValueByPosition(selectedColumns[columnPosition - 1], 0), cell.getDataValue());
}
}
use of org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell in project nebula.widgets.nattable by eclipse.
the class RowSelectionEditUtilsTest method testGetLastSelectedCellWithSingleSelection.
@Test
public void testGetLastSelectedCellWithSingleSelection() {
this.selectionLayer.selectCell(1, 1, false, false);
ILayerCell cell = EditUtils.getLastSelectedCell(this.selectionLayer);
assertNotNull(cell);
assertEquals(1, cell.getColumnIndex());
assertEquals(1, cell.getRowIndex());
}
use of org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell in project nebula.widgets.nattable by eclipse.
the class ColumnGroupHeaderLayerTest method getCellForACellNotInAColumnGroup.
@Test
public void getCellForACellNotInAColumnGroup() {
ILayerCell cell = this.columnGroupLayer.getCellByPosition(5, 0);
assertEquals(500, cell.getBounds().x);
assertEquals(0, cell.getBounds().y);
assertEquals(200, cell.getBounds().width);
assertEquals(20, cell.getBounds().height);
}
use of org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell in project nebula.widgets.nattable by eclipse.
the class BoxingStyleTest method retrievedCellShouldHaveConfiguredForegroundColor.
// Foreground color
@Test
public void retrievedCellShouldHaveConfiguredForegroundColor() {
// Register foreground color for body cells in normal mode
final Color foregroundColor = Display.getDefault().getSystemColor(SWT.COLOR_BLACK);
this.cellStyle.setAttributeValue(CellStyleAttributes.FOREGROUND_COLOR, foregroundColor);
this.configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, this.cellStyle, DisplayMode.NORMAL, AlternatingRowConfigLabelAccumulator.ODD_ROW_CONFIG_TYPE);
// Check cell foreground color
ILayerCell cell = this.natTable.getCellByPosition(2, 2);
IStyle cellStyle = this.configRegistry.getConfigAttribute(CellConfigAttributes.CELL_STYLE, cell.getDisplayMode(), cell.getConfigLabels().getLabels());
Assert.assertEquals(foregroundColor, cellStyle.getAttributeValue(CellStyleAttributes.FOREGROUND_COLOR));
// set up painter
this.cellPainter.setupGCFromConfig(this.gc, cellStyle);
Assert.assertEquals(foregroundColor, this.gc.getForeground());
}
use of org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell in project nebula.widgets.nattable by eclipse.
the class BoxingStyleTest method retreivedCellShouldHaveRightAlignment.
// Horizontal alignment
@Test
public void retreivedCellShouldHaveRightAlignment() {
// Register horizontal alignment
final HorizontalAlignmentEnum hAlignment = HorizontalAlignmentEnum.RIGHT;
this.cellStyle.setAttributeValue(CellStyleAttributes.HORIZONTAL_ALIGNMENT, hAlignment);
this.configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, this.cellStyle, DisplayMode.NORMAL, AlternatingRowConfigLabelAccumulator.ODD_ROW_CONFIG_TYPE);
// Check cell horizontal alignment
ILayerCell cell = this.natTable.getCellByPosition(2, 2);
Assert.assertEquals(hAlignment.name(), this.configRegistry.getConfigAttribute(CellConfigAttributes.CELL_STYLE, cell.getDisplayMode(), cell.getConfigLabels().getLabels()).getAttributeValue(CellStyleAttributes.HORIZONTAL_ALIGNMENT).name());
}
Aggregations