use of org.eclipse.nebula.widgets.nattable.copy.command.CopyDataToClipboardCommand in project nebula.widgets.nattable by eclipse.
the class FillHandlePasteTest method testMultiVerticalCellDragLeft.
@Test
public void testMultiVerticalCellDragLeft() {
this.dataProvider.setDataValue(4, 4, "Simpson");
this.dataProvider.setDataValue(4, 5, "Flanders");
this.selectionLayer.selectCell(4, 4, false, true);
this.selectionLayer.selectCell(4, 5, false, true);
testCellStates(new Point(4, 4), new Point(4, 5));
this.natTable.doCommand(new CopyDataToClipboardCommand(// $NON-NLS-1$
"\t", // $NON-NLS-1$
System.getProperty("line.separator"), this.natTable.getConfigRegistry()));
this.selectionLayer.setFillHandleRegion(new Rectangle(2, 4, 3, 2));
this.natTable.doCommand(new FillHandlePasteCommand(FillHandleOperation.COPY, MoveDirectionEnum.LEFT, this.natTable.getConfigRegistry()));
assertEquals("Simpson", this.selectionLayer.getDataValueByPosition(2, 4));
assertEquals("Flanders", this.selectionLayer.getDataValueByPosition(2, 5));
assertEquals("Simpson", this.selectionLayer.getDataValueByPosition(3, 4));
assertEquals("Flanders", this.selectionLayer.getDataValueByPosition(3, 5));
assertEquals("Simpson", this.selectionLayer.getDataValueByPosition(4, 4));
assertEquals("Flanders", this.selectionLayer.getDataValueByPosition(4, 5));
testCellStates(new Point(2, 4), new Point(2, 5), new Point(3, 4), new Point(3, 5), new Point(4, 4), new Point(4, 5));
}
use of org.eclipse.nebula.widgets.nattable.copy.command.CopyDataToClipboardCommand in project nebula.widgets.nattable by eclipse.
the class FillHandlePasteTest method testSingleCellDragOneDown.
@Test
public void testSingleCellDragOneDown() {
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.COPY, MoveDirectionEnum.DOWN, this.natTable.getConfigRegistry()));
assertEquals("Simpson", this.selectionLayer.getDataValueByPosition(4, 5));
testCellStates(new Point(4, 4), new Point(4, 5));
}
use of org.eclipse.nebula.widgets.nattable.copy.command.CopyDataToClipboardCommand in project nebula.widgets.nattable by eclipse.
the class FillHandleSeriesTest method testMultiCellSameDiffLongValueDragRight.
@Test
public void testMultiCellSameDiffLongValueDragRight() {
this.dataProvider.setDataValue(4, 4, Long.valueOf("1"));
this.dataProvider.setDataValue(5, 4, Long.valueOf("3"));
this.dataProvider.setDataValue(6, 4, Long.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(Long.valueOf("1"), this.selectionLayer.getDataValueByPosition(4, 4));
assertEquals(Long.valueOf("3"), this.selectionLayer.getDataValueByPosition(5, 4));
assertEquals(Long.valueOf("5"), this.selectionLayer.getDataValueByPosition(6, 4));
assertEquals(Long.valueOf("7"), this.selectionLayer.getDataValueByPosition(7, 4));
assertEquals(Long.valueOf("9"), this.selectionLayer.getDataValueByPosition(8, 4));
assertEquals(Long.valueOf("11"), 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 testMultiCellSameDiffIntegerValueDragUp.
@Test
public void testMultiCellSameDiffIntegerValueDragUp() {
this.dataProvider.setDataValue(4, 4, Integer.valueOf("1"));
this.dataProvider.setDataValue(4, 5, Integer.valueOf("3"));
this.dataProvider.setDataValue(4, 6, Integer.valueOf("5"));
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, 1, 1, 6));
this.natTable.doCommand(new FillHandlePasteCommand(FillHandleOperation.SERIES, MoveDirectionEnum.UP, this.natTable.getConfigRegistry()));
assertEquals(Integer.valueOf("-5"), this.selectionLayer.getDataValueByPosition(4, 1));
assertEquals(Integer.valueOf("-3"), this.selectionLayer.getDataValueByPosition(4, 2));
assertEquals(Integer.valueOf("-1"), this.selectionLayer.getDataValueByPosition(4, 3));
assertEquals(Integer.valueOf("1"), this.selectionLayer.getDataValueByPosition(4, 4));
assertEquals(Integer.valueOf("3"), this.selectionLayer.getDataValueByPosition(4, 5));
assertEquals(Integer.valueOf("5"), this.selectionLayer.getDataValueByPosition(4, 6));
}
use of org.eclipse.nebula.widgets.nattable.copy.command.CopyDataToClipboardCommand in project nebula.widgets.nattable by eclipse.
the class FillHandleSeriesTest method testMultiCellSameDiffBigIntegerValueDragRight.
@Test
public void testMultiCellSameDiffBigIntegerValueDragRight() {
this.dataProvider.setDataValue(4, 4, BigInteger.valueOf(1));
this.dataProvider.setDataValue(5, 4, BigInteger.valueOf(3));
this.dataProvider.setDataValue(6, 4, BigInteger.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(BigInteger.valueOf(1), this.selectionLayer.getDataValueByPosition(4, 4));
assertEquals(BigInteger.valueOf(3), this.selectionLayer.getDataValueByPosition(5, 4));
assertEquals(BigInteger.valueOf(5), this.selectionLayer.getDataValueByPosition(6, 4));
assertEquals(BigInteger.valueOf(7), this.selectionLayer.getDataValueByPosition(7, 4));
assertEquals(BigInteger.valueOf(9), this.selectionLayer.getDataValueByPosition(8, 4));
assertEquals(BigInteger.valueOf(11), this.selectionLayer.getDataValueByPosition(9, 4));
}
Aggregations