use of org.eclipse.nebula.widgets.nattable.fillhandle.command.FillHandlePasteCommand in project nebula.widgets.nattable by eclipse.
the class FillHandlePasteTest method testMultiHorizontalCellDragRight.
@Test
public void testMultiHorizontalCellDragRight() {
this.dataProvider.setDataValue(3, 4, "Homer");
this.dataProvider.setDataValue(4, 4, "Simpson");
this.selectionLayer.selectCell(3, 4, false, true);
this.selectionLayer.selectCell(4, 4, false, true);
testCellStates(new Point(3, 4), 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(3, 4, 5, 1));
this.natTable.doCommand(new FillHandlePasteCommand(FillHandleOperation.COPY, MoveDirectionEnum.RIGHT, this.natTable.getConfigRegistry()));
assertEquals("Homer", this.selectionLayer.getDataValueByPosition(3, 4));
assertEquals("Simpson", this.selectionLayer.getDataValueByPosition(4, 4));
assertEquals("Homer", this.selectionLayer.getDataValueByPosition(5, 4));
assertEquals("Simpson", this.selectionLayer.getDataValueByPosition(6, 4));
assertEquals("Homer", this.selectionLayer.getDataValueByPosition(7, 4));
testCellStates(new Point(3, 4), new Point(4, 4), new Point(5, 4), new Point(6, 4), new Point(7, 4));
}
use of org.eclipse.nebula.widgets.nattable.fillhandle.command.FillHandlePasteCommand in project nebula.widgets.nattable by eclipse.
the class FillHandlePasteTest method testMultiCellDragOneUp.
@Test
public void testMultiCellDragOneUp() {
this.dataProvider.setDataValue(3, 4, "Homer");
this.dataProvider.setDataValue(4, 4, "Simpson");
this.dataProvider.setDataValue(3, 5, "Ned");
this.dataProvider.setDataValue(4, 5, "Flanders");
this.selectionLayer.selectCell(3, 4, false, true);
this.selectionLayer.selectCell(4, 4, false, true);
this.selectionLayer.selectCell(3, 5, false, true);
this.selectionLayer.selectCell(4, 5, false, true);
testCellStates(new Point(3, 4), new Point(4, 4), new Point(3, 5), 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(3, 3, 2, 3));
this.natTable.doCommand(new FillHandlePasteCommand(FillHandleOperation.COPY, MoveDirectionEnum.UP, this.natTable.getConfigRegistry()));
assertEquals("Ned", this.selectionLayer.getDataValueByPosition(3, 3));
assertEquals("Flanders", this.selectionLayer.getDataValueByPosition(4, 3));
assertEquals("Homer", this.selectionLayer.getDataValueByPosition(3, 4));
assertEquals("Simpson", this.selectionLayer.getDataValueByPosition(4, 4));
assertEquals("Ned", this.selectionLayer.getDataValueByPosition(3, 5));
assertEquals("Flanders", this.selectionLayer.getDataValueByPosition(4, 5));
testCellStates(new Point(3, 3), new Point(4, 3), new Point(3, 4), new Point(4, 4), new Point(3, 5), new Point(4, 5));
}
use of org.eclipse.nebula.widgets.nattable.fillhandle.command.FillHandlePasteCommand in project nebula.widgets.nattable by eclipse.
the class FillHandlePasteTest method testSingleCellDragMultiLeft.
@Test
public void testSingleCellDragMultiLeft() {
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(0, 4, 5, 1));
this.natTable.doCommand(new FillHandlePasteCommand(FillHandleOperation.COPY, MoveDirectionEnum.LEFT, this.natTable.getConfigRegistry()));
assertEquals("Simpson", this.selectionLayer.getDataValueByPosition(0, 4));
assertEquals("Simpson", this.selectionLayer.getDataValueByPosition(1, 4));
assertEquals("Simpson", this.selectionLayer.getDataValueByPosition(2, 4));
assertEquals("Simpson", this.selectionLayer.getDataValueByPosition(3, 4));
testCellStates(new Point(4, 4), new Point(0, 4), new Point(1, 4), new Point(2, 4), new Point(3, 4));
}
use of org.eclipse.nebula.widgets.nattable.fillhandle.command.FillHandlePasteCommand in project nebula.widgets.nattable by eclipse.
the class FillHandlePasteTest method testMultiVerticalCellDragDown.
@Test
public void testMultiVerticalCellDragDown() {
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(4, 4, 1, 5));
this.natTable.doCommand(new FillHandlePasteCommand(FillHandleOperation.COPY, MoveDirectionEnum.DOWN, this.natTable.getConfigRegistry()));
assertEquals("Simpson", this.selectionLayer.getDataValueByPosition(4, 4));
assertEquals("Flanders", this.selectionLayer.getDataValueByPosition(4, 5));
assertEquals("Simpson", this.selectionLayer.getDataValueByPosition(4, 6));
assertEquals("Flanders", this.selectionLayer.getDataValueByPosition(4, 7));
assertEquals("Simpson", this.selectionLayer.getDataValueByPosition(4, 8));
testCellStates(new Point(4, 4), new Point(4, 5), new Point(4, 6), new Point(4, 7), new Point(4, 8));
}
use of org.eclipse.nebula.widgets.nattable.fillhandle.command.FillHandlePasteCommand in project nebula.widgets.nattable by eclipse.
the class FillHandlePasteTest method testSingleCellDragDownLeft.
@Test
public void testSingleCellDragDownLeft() {
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(3, 4, 2, 2));
this.natTable.doCommand(new FillHandlePasteCommand(FillHandleOperation.COPY, MoveDirectionEnum.LEFT, this.natTable.getConfigRegistry()));
assertEquals("Simpson", this.selectionLayer.getDataValueByPosition(3, 4));
assertEquals("Simpson", this.selectionLayer.getDataValueByPosition(4, 4));
assertEquals("Simpson", this.selectionLayer.getDataValueByPosition(3, 5));
assertEquals("Simpson", this.selectionLayer.getDataValueByPosition(4, 5));
testCellStates(new Point(3, 4), new Point(4, 4), new Point(3, 5), new Point(4, 5));
}
Aggregations