use of org.eclipse.nebula.widgets.nattable.copy.command.CopyDataToClipboardCommand in project nebula.widgets.nattable by eclipse.
the class FillHandleSeriesTest method testIntegerNullCellValueDragDown.
@Test
public void testIntegerNullCellValueDragDown() {
this.dataProvider.setDataValue(4, 4, Integer.valueOf("1"));
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(Integer.valueOf("1"), this.selectionLayer.getDataValueByPosition(4, 4));
assertNull(this.selectionLayer.getDataValueByPosition(4, 5));
assertEquals(Integer.valueOf("1"), this.selectionLayer.getDataValueByPosition(4, 6));
assertNull(this.selectionLayer.getDataValueByPosition(4, 7));
assertEquals(Integer.valueOf("1"), this.selectionLayer.getDataValueByPosition(4, 8));
assertNull(this.selectionLayer.getDataValueByPosition(4, 9));
}
use of org.eclipse.nebula.widgets.nattable.copy.command.CopyDataToClipboardCommand in project nebula.widgets.nattable by eclipse.
the class FillHandleSeriesTest method testMultiCellSameDiffDateYearValueDragDown.
@SuppressWarnings("deprecation")
@Test
public void testMultiCellSameDiffDateYearValueDragDown() {
this.dataProvider.setDataValue(4, 4, new Date(2002, 9, 2));
this.dataProvider.setDataValue(4, 5, new Date(2004, 9, 5));
this.dataProvider.setDataValue(4, 6, new Date(2006, 9, 8));
this.selectionLayer.selectCell(4, 4, false, true);
this.selectionLayer.selectCell(4, 5, false, true);
this.selectionLayer.selectCell(4, 6, false, true);
this.natTable.getConfigRegistry().registerConfigAttribute(FillHandleConfigAttributes.INCREMENT_DATE_FIELD, Calendar.YEAR);
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(2002, 9, 2), this.selectionLayer.getDataValueByPosition(4, 4));
assertEquals(new Date(2004, 9, 5), this.selectionLayer.getDataValueByPosition(4, 5));
assertEquals(new Date(2006, 9, 8), this.selectionLayer.getDataValueByPosition(4, 6));
assertEquals(new Date(2008, 9, 2), this.selectionLayer.getDataValueByPosition(4, 7));
assertEquals(new Date(2010, 9, 5), this.selectionLayer.getDataValueByPosition(4, 8));
assertEquals(new Date(2012, 9, 8), this.selectionLayer.getDataValueByPosition(4, 9));
}
use of org.eclipse.nebula.widgets.nattable.copy.command.CopyDataToClipboardCommand in project nebula.widgets.nattable by eclipse.
the class FillHandleSeriesTest method testMultiCellSameDiffDoubleValueDragRight.
@Test
public void testMultiCellSameDiffDoubleValueDragRight() {
this.dataProvider.setDataValue(4, 4, Double.valueOf("1.3"));
this.dataProvider.setDataValue(5, 4, Double.valueOf("2.6"));
this.dataProvider.setDataValue(6, 4, Double.valueOf("3.9"));
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(Double.valueOf("1.3"), this.selectionLayer.getDataValueByPosition(4, 4));
assertEquals(Double.valueOf("2.6"), this.selectionLayer.getDataValueByPosition(5, 4));
assertEquals(Double.valueOf("3.9"), this.selectionLayer.getDataValueByPosition(6, 4));
assertEquals(Double.valueOf("5.2"), this.selectionLayer.getDataValueByPosition(7, 4));
assertEquals(Double.valueOf("6.5"), this.selectionLayer.getDataValueByPosition(8, 4));
assertEquals(Double.valueOf("7.8"), 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 testSingleCellByteValueDragDown.
@Test
public void testSingleCellByteValueDragDown() {
this.dataProvider.setDataValue(4, 4, Byte.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(4, 4, 1, 4));
this.natTable.doCommand(new FillHandlePasteCommand(FillHandleOperation.SERIES, MoveDirectionEnum.DOWN, this.natTable.getConfigRegistry()));
assertEquals(Byte.valueOf("1"), this.selectionLayer.getDataValueByPosition(4, 4));
assertEquals(Byte.valueOf("2"), this.selectionLayer.getDataValueByPosition(4, 5));
assertEquals(Byte.valueOf("3"), this.selectionLayer.getDataValueByPosition(4, 6));
assertEquals(Byte.valueOf("4"), 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 testSingleCellIntegerValueDragRight.
@Test
public void testSingleCellIntegerValueDragRight() {
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(4, 4, 4, 1));
this.natTable.doCommand(new FillHandlePasteCommand(FillHandleOperation.SERIES, MoveDirectionEnum.RIGHT, this.natTable.getConfigRegistry()));
assertEquals(Integer.valueOf("1"), this.selectionLayer.getDataValueByPosition(4, 4));
assertEquals(Integer.valueOf("2"), this.selectionLayer.getDataValueByPosition(5, 4));
assertEquals(Integer.valueOf("3"), this.selectionLayer.getDataValueByPosition(6, 4));
assertEquals(Integer.valueOf("4"), this.selectionLayer.getDataValueByPosition(7, 4));
}
Aggregations