use of org.eclipse.nebula.widgets.nattable.fillhandle.command.FillHandlePasteCommand in project nebula.widgets.nattable by eclipse.
the class FillHandleSeriesTest method testMultiCellSameDiffBigDecimalValueDragDown.
@Test
public void testMultiCellSameDiffBigDecimalValueDragDown() {
this.dataProvider.setDataValue(4, 4, BigDecimal.valueOf(1.2d));
this.dataProvider.setDataValue(4, 5, BigDecimal.valueOf(2.4d));
this.dataProvider.setDataValue(4, 6, BigDecimal.valueOf(3.6d));
this.selectionLayer.selectCell(4, 4, false, true);
this.selectionLayer.selectCell(4, 5, false, true);
this.selectionLayer.selectCell(4, 6, 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, 1, 6));
this.natTable.doCommand(new FillHandlePasteCommand(FillHandleOperation.SERIES, MoveDirectionEnum.DOWN, this.natTable.getConfigRegistry()));
assertEquals(BigDecimal.valueOf(1.2d), this.selectionLayer.getDataValueByPosition(4, 4));
assertEquals(BigDecimal.valueOf(2.4d), this.selectionLayer.getDataValueByPosition(4, 5));
assertEquals(BigDecimal.valueOf(3.6d), this.selectionLayer.getDataValueByPosition(4, 6));
assertEquals(BigDecimal.valueOf(4.8d), this.selectionLayer.getDataValueByPosition(4, 7));
assertEquals(BigDecimal.valueOf(6d), this.selectionLayer.getDataValueByPosition(4, 8));
assertEquals(BigDecimal.valueOf(7.2d), this.selectionLayer.getDataValueByPosition(4, 9));
}
use of org.eclipse.nebula.widgets.nattable.fillhandle.command.FillHandlePasteCommand in project nebula.widgets.nattable by eclipse.
the class FillHandleSeriesTest method testDateNullCellValueDragDown.
@SuppressWarnings("deprecation")
@Test
public void testDateNullCellValueDragDown() {
this.dataProvider.setDataValue(4, 4, new Date(2015, 9, 13));
this.selectionLayer.selectCell(4, 4, false, true);
this.selectionLayer.selectCell(4, 5, 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, 1, 6));
this.natTable.doCommand(new FillHandlePasteCommand(FillHandleOperation.SERIES, MoveDirectionEnum.DOWN, this.natTable.getConfigRegistry()));
assertEquals(new Date(2015, 9, 13), this.selectionLayer.getDataValueByPosition(4, 4));
assertNull(this.selectionLayer.getDataValueByPosition(4, 5));
assertEquals(new Date(2015, 9, 13), this.selectionLayer.getDataValueByPosition(4, 6));
assertNull(this.selectionLayer.getDataValueByPosition(4, 7));
assertEquals(new Date(2015, 9, 13), this.selectionLayer.getDataValueByPosition(4, 8));
assertNull(this.selectionLayer.getDataValueByPosition(4, 9));
}
use of org.eclipse.nebula.widgets.nattable.fillhandle.command.FillHandlePasteCommand in project nebula.widgets.nattable by eclipse.
the class FillHandleSeriesTest method testMultiCellDifferentTypesDragRight.
@Test
public void testMultiCellDifferentTypesDragRight() {
this.dataProvider.setDataValue(4, 4, Integer.valueOf("1"));
this.dataProvider.setDataValue(5, 4, Float.valueOf("3.5"));
this.selectionLayer.selectCell(4, 4, false, true);
this.selectionLayer.selectCell(5, 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, 4, 1));
this.natTable.doCommand(new FillHandlePasteCommand(FillHandleOperation.SERIES, MoveDirectionEnum.RIGHT, this.natTable.getConfigRegistry()));
// result should be a copy because of different data types
assertEquals(Integer.valueOf("1"), this.selectionLayer.getDataValueByPosition(4, 4));
assertEquals(Float.valueOf("3.5"), this.selectionLayer.getDataValueByPosition(5, 4));
assertEquals(Integer.valueOf("1"), this.selectionLayer.getDataValueByPosition(6, 4));
assertEquals(Float.valueOf("3.5"), this.selectionLayer.getDataValueByPosition(7, 4));
}
use of org.eclipse.nebula.widgets.nattable.fillhandle.command.FillHandlePasteCommand in project nebula.widgets.nattable by eclipse.
the class FormulaFillHandlePasteTest method testSingleNumberCellDragDown.
@Test
public void testSingleNumberCellDragDown() {
this.dataProvider.setDataValue(4, 4, "1");
this.selectionLayer.setSelectedCell(4, 4);
testCellStates(new Point(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("1", this.selectionLayer.getDataValueByPosition(4, 4));
assertEquals("2", this.selectionLayer.getDataValueByPosition(4, 5));
assertEquals("3", this.selectionLayer.getDataValueByPosition(4, 6));
assertEquals("4", this.selectionLayer.getDataValueByPosition(4, 7));
testCellStates(new Point(4, 4), new Point(4, 5), new Point(4, 6), new Point(4, 7));
}
use of org.eclipse.nebula.widgets.nattable.fillhandle.command.FillHandlePasteCommand in project nebula.widgets.nattable by eclipse.
the class FormulaFillHandlePasteTest method testSingleCellSeriesStringDragOneDown.
@Test
public void testSingleCellSeriesStringDragOneDown() {
this.dataProvider.setDataValue(4, 4, "Simpson");
this.selectionLayer.setSelectedCell(4, 4);
testCellStates(new Point(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, 2));
this.natTable.doCommand(new FillHandlePasteCommand(FillHandleOperation.SERIES, MoveDirectionEnum.DOWN, this.natTable.getConfigRegistry()));
assertEquals("Simpson", this.selectionLayer.getDataValueByPosition(4, 5));
testCellStates(new Point(4, 4), new Point(4, 5));
}
Aggregations