use of org.eclipse.nebula.widgets.nattable.copy.command.CopyDataToClipboardCommand in project nebula.widgets.nattable by eclipse.
the class FillHandleSeriesTest method testSingleCellDateValueDragDown.
@SuppressWarnings("deprecation")
@Test
public void testSingleCellDateValueDragDown() {
this.dataProvider.setDataValue(4, 4, new Date(2015, 9, 29));
this.selectionLayer.setSelectedCell(4, 4);
this.natTable.doCommand(new CopyDataToClipboardCommand(// $NON-NLS-1$
"\t", // $NON-NLS-1$
System.getProperty("line.separator"), this.natTable.getConfigRegistry()));
this.selectionLayer.setFillHandleRegion(new Rectangle(4, 4, 1, 4));
this.natTable.doCommand(new FillHandlePasteCommand(FillHandleOperation.SERIES, MoveDirectionEnum.DOWN, this.natTable.getConfigRegistry()));
assertEquals(new Date(2015, 9, 29), this.selectionLayer.getDataValueByPosition(4, 4));
assertEquals(new Date(2015, 9, 30), this.selectionLayer.getDataValueByPosition(4, 5));
assertEquals(new Date(2015, 9, 31), this.selectionLayer.getDataValueByPosition(4, 6));
assertEquals(new Date(2015, 10, 1), this.selectionLayer.getDataValueByPosition(4, 7));
}
use of org.eclipse.nebula.widgets.nattable.copy.command.CopyDataToClipboardCommand in project nebula.widgets.nattable by eclipse.
the class FillHandleSeriesTest method testMultiCellSameDiffBigDecimalValueDragRight.
@Test
public void testMultiCellSameDiffBigDecimalValueDragRight() {
this.dataProvider.setDataValue(4, 4, BigDecimal.valueOf(1.2d));
this.dataProvider.setDataValue(5, 4, BigDecimal.valueOf(2.4d));
this.dataProvider.setDataValue(6, 4, BigDecimal.valueOf(3.6d));
this.selectionLayer.selectCell(4, 4, false, true);
this.selectionLayer.selectCell(5, 4, false, true);
this.selectionLayer.selectCell(6, 4, false, true);
this.natTable.doCommand(new CopyDataToClipboardCommand(// $NON-NLS-1$
"\t", // $NON-NLS-1$
System.getProperty("line.separator"), this.natTable.getConfigRegistry()));
this.selectionLayer.setFillHandleRegion(new Rectangle(4, 4, 6, 1));
this.natTable.doCommand(new FillHandlePasteCommand(FillHandleOperation.SERIES, MoveDirectionEnum.RIGHT, this.natTable.getConfigRegistry()));
assertEquals(BigDecimal.valueOf(1.2d), this.selectionLayer.getDataValueByPosition(4, 4));
assertEquals(BigDecimal.valueOf(2.4d), this.selectionLayer.getDataValueByPosition(5, 4));
assertEquals(BigDecimal.valueOf(3.6d), this.selectionLayer.getDataValueByPosition(6, 4));
assertEquals(BigDecimal.valueOf(4.8d), this.selectionLayer.getDataValueByPosition(7, 4));
assertEquals(BigDecimal.valueOf(6d), this.selectionLayer.getDataValueByPosition(8, 4));
assertEquals(BigDecimal.valueOf(7.2d), this.selectionLayer.getDataValueByPosition(9, 4));
}
use of org.eclipse.nebula.widgets.nattable.copy.command.CopyDataToClipboardCommand in project nebula.widgets.nattable by eclipse.
the class FillHandleSeriesTest method testSingleCellIntegerValueDragLeft.
@Test
public void testSingleCellIntegerValueDragLeft() {
this.dataProvider.setDataValue(4, 4, Integer.valueOf("1"));
this.selectionLayer.setSelectedCell(4, 4);
this.natTable.doCommand(new CopyDataToClipboardCommand(// $NON-NLS-1$
"\t", // $NON-NLS-1$
System.getProperty("line.separator"), this.natTable.getConfigRegistry()));
this.selectionLayer.setFillHandleRegion(new Rectangle(1, 4, 4, 1));
this.natTable.doCommand(new FillHandlePasteCommand(FillHandleOperation.SERIES, MoveDirectionEnum.LEFT, this.natTable.getConfigRegistry()));
assertEquals(Integer.valueOf("-2"), this.selectionLayer.getDataValueByPosition(1, 4));
assertEquals(Integer.valueOf("-1"), this.selectionLayer.getDataValueByPosition(2, 4));
assertEquals(Integer.valueOf("0"), this.selectionLayer.getDataValueByPosition(3, 4));
assertEquals(Integer.valueOf("1"), this.selectionLayer.getDataValueByPosition(4, 4));
}
use of org.eclipse.nebula.widgets.nattable.copy.command.CopyDataToClipboardCommand in project nebula.widgets.nattable by eclipse.
the class FillHandleSeriesTest method testMultiCellSameDiffDateValueDragRight.
@SuppressWarnings("deprecation")
@Test
public void testMultiCellSameDiffDateValueDragRight() {
this.dataProvider.setDataValue(4, 4, new Date(2002, 9, 2));
this.dataProvider.setDataValue(5, 4, new Date(2002, 9, 5));
this.dataProvider.setDataValue(6, 4, new Date(2002, 9, 8));
this.selectionLayer.selectCell(4, 4, false, true);
this.selectionLayer.selectCell(5, 4, false, true);
this.selectionLayer.selectCell(6, 4, false, true);
this.natTable.doCommand(new CopyDataToClipboardCommand(// $NON-NLS-1$
"\t", // $NON-NLS-1$
System.getProperty("line.separator"), this.natTable.getConfigRegistry()));
this.selectionLayer.setFillHandleRegion(new Rectangle(4, 4, 6, 1));
this.natTable.doCommand(new FillHandlePasteCommand(FillHandleOperation.SERIES, MoveDirectionEnum.RIGHT, this.natTable.getConfigRegistry()));
assertEquals(new Date(2002, 9, 2), this.selectionLayer.getDataValueByPosition(4, 4));
assertEquals(new Date(2002, 9, 5), this.selectionLayer.getDataValueByPosition(5, 4));
assertEquals(new Date(2002, 9, 8), this.selectionLayer.getDataValueByPosition(6, 4));
assertEquals(new Date(2002, 9, 11), this.selectionLayer.getDataValueByPosition(7, 4));
assertEquals(new Date(2002, 9, 14), this.selectionLayer.getDataValueByPosition(8, 4));
assertEquals(new Date(2002, 9, 17), this.selectionLayer.getDataValueByPosition(9, 4));
}
use of org.eclipse.nebula.widgets.nattable.copy.command.CopyDataToClipboardCommand in project nebula.widgets.nattable by eclipse.
the class FillHandleSeriesTest method testMultiCellSameDiffShortValueDragRight.
@Test
public void testMultiCellSameDiffShortValueDragRight() {
this.dataProvider.setDataValue(4, 4, Short.valueOf("1"));
this.dataProvider.setDataValue(5, 4, Short.valueOf("3"));
this.dataProvider.setDataValue(6, 4, Short.valueOf("5"));
this.selectionLayer.selectCell(4, 4, false, true);
this.selectionLayer.selectCell(5, 4, false, true);
this.selectionLayer.selectCell(6, 4, false, true);
this.natTable.doCommand(new CopyDataToClipboardCommand(// $NON-NLS-1$
"\t", // $NON-NLS-1$
System.getProperty("line.separator"), this.natTable.getConfigRegistry()));
this.selectionLayer.setFillHandleRegion(new Rectangle(4, 4, 6, 1));
this.natTable.doCommand(new FillHandlePasteCommand(FillHandleOperation.SERIES, MoveDirectionEnum.RIGHT, this.natTable.getConfigRegistry()));
assertEquals(Short.valueOf("1"), this.selectionLayer.getDataValueByPosition(4, 4));
assertEquals(Short.valueOf("3"), this.selectionLayer.getDataValueByPosition(5, 4));
assertEquals(Short.valueOf("5"), this.selectionLayer.getDataValueByPosition(6, 4));
assertEquals(Short.valueOf("7"), this.selectionLayer.getDataValueByPosition(7, 4));
assertEquals(Short.valueOf("9"), this.selectionLayer.getDataValueByPosition(8, 4));
assertEquals(Short.valueOf("11"), this.selectionLayer.getDataValueByPosition(9, 4));
}
Aggregations