Search in sources :

Example 11 with CopyDataToClipboardCommand

use of org.eclipse.nebula.widgets.nattable.copy.command.CopyDataToClipboardCommand in project nebula.widgets.nattable by eclipse.

the class FillHandlePasteTest method testMultiCellDragThreeLeft.

@Test
public void testMultiCellDragThreeLeft() {
    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(0, 4, 5, 2));
    this.natTable.doCommand(new FillHandlePasteCommand(FillHandleOperation.COPY, MoveDirectionEnum.LEFT, this.natTable.getConfigRegistry()));
    assertEquals("Simpson", this.selectionLayer.getDataValueByPosition(0, 4));
    assertEquals("Homer", this.selectionLayer.getDataValueByPosition(1, 4));
    assertEquals("Simpson", this.selectionLayer.getDataValueByPosition(2, 4));
    assertEquals("Homer", this.selectionLayer.getDataValueByPosition(3, 4));
    assertEquals("Simpson", this.selectionLayer.getDataValueByPosition(4, 4));
    assertEquals("Flanders", this.selectionLayer.getDataValueByPosition(0, 5));
    assertEquals("Ned", this.selectionLayer.getDataValueByPosition(1, 5));
    assertEquals("Flanders", this.selectionLayer.getDataValueByPosition(2, 5));
    assertEquals("Ned", this.selectionLayer.getDataValueByPosition(3, 5));
    assertEquals("Flanders", this.selectionLayer.getDataValueByPosition(4, 5));
    testCellStates(new Point(0, 4), new Point(1, 4), new Point(2, 4), new Point(3, 4), new Point(4, 4), new Point(0, 5), new Point(1, 5), new Point(2, 5), new Point(3, 5), new Point(4, 5));
}
Also used : FillHandlePasteCommand(org.eclipse.nebula.widgets.nattable.fillhandle.command.FillHandlePasteCommand) CopyDataToClipboardCommand(org.eclipse.nebula.widgets.nattable.copy.command.CopyDataToClipboardCommand) Rectangle(org.eclipse.swt.graphics.Rectangle) Point(org.eclipse.swt.graphics.Point) Test(org.junit.Test)

Example 12 with CopyDataToClipboardCommand

use of org.eclipse.nebula.widgets.nattable.copy.command.CopyDataToClipboardCommand in project nebula.widgets.nattable by eclipse.

the class FillHandlePasteTest method testMultiHorizontalCellDragUp.

@Test
public void testMultiHorizontalCellDragUp() {
    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, 2, 2, 3));
    this.natTable.doCommand(new FillHandlePasteCommand(FillHandleOperation.COPY, MoveDirectionEnum.UP, this.natTable.getConfigRegistry()));
    assertEquals("Homer", this.selectionLayer.getDataValueByPosition(3, 2));
    assertEquals("Simpson", this.selectionLayer.getDataValueByPosition(4, 2));
    assertEquals("Homer", this.selectionLayer.getDataValueByPosition(3, 3));
    assertEquals("Simpson", this.selectionLayer.getDataValueByPosition(4, 3));
    assertEquals("Homer", this.selectionLayer.getDataValueByPosition(3, 4));
    assertEquals("Simpson", this.selectionLayer.getDataValueByPosition(4, 4));
    testCellStates(new Point(3, 2), new Point(4, 2), new Point(3, 3), new Point(4, 3), new Point(3, 4), new Point(4, 4));
}
Also used : FillHandlePasteCommand(org.eclipse.nebula.widgets.nattable.fillhandle.command.FillHandlePasteCommand) CopyDataToClipboardCommand(org.eclipse.nebula.widgets.nattable.copy.command.CopyDataToClipboardCommand) Rectangle(org.eclipse.swt.graphics.Rectangle) Point(org.eclipse.swt.graphics.Point) Test(org.junit.Test)

Example 13 with CopyDataToClipboardCommand

use of org.eclipse.nebula.widgets.nattable.copy.command.CopyDataToClipboardCommand in project nebula.widgets.nattable by eclipse.

the class FillHandlePasteTest method testMultiHorizontalCellDragLeft.

@Test
public void testMultiHorizontalCellDragLeft() {
    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(0, 4, 5, 1));
    this.natTable.doCommand(new FillHandlePasteCommand(FillHandleOperation.COPY, MoveDirectionEnum.LEFT, this.natTable.getConfigRegistry()));
    assertEquals("Simpson", this.selectionLayer.getDataValueByPosition(0, 4));
    assertEquals("Homer", this.selectionLayer.getDataValueByPosition(1, 4));
    assertEquals("Simpson", this.selectionLayer.getDataValueByPosition(2, 4));
    assertEquals("Homer", this.selectionLayer.getDataValueByPosition(3, 4));
    assertEquals("Simpson", this.selectionLayer.getDataValueByPosition(4, 4));
    testCellStates(new Point(0, 4), new Point(1, 4), new Point(2, 4), new Point(3, 4), new Point(4, 4));
}
Also used : FillHandlePasteCommand(org.eclipse.nebula.widgets.nattable.fillhandle.command.FillHandlePasteCommand) CopyDataToClipboardCommand(org.eclipse.nebula.widgets.nattable.copy.command.CopyDataToClipboardCommand) Rectangle(org.eclipse.swt.graphics.Rectangle) Point(org.eclipse.swt.graphics.Point) Test(org.junit.Test)

Example 14 with CopyDataToClipboardCommand

use of org.eclipse.nebula.widgets.nattable.copy.command.CopyDataToClipboardCommand in project nebula.widgets.nattable by eclipse.

the class FillHandlePasteTest method testSingleCellDragOneLeft.

@Test
public void testSingleCellDragOneLeft() {
    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, 1));
    this.natTable.doCommand(new FillHandlePasteCommand(FillHandleOperation.COPY, MoveDirectionEnum.LEFT, this.natTable.getConfigRegistry()));
    assertEquals("Simpson", this.selectionLayer.getDataValueByPosition(3, 4));
    testCellStates(new Point(4, 4), new Point(3, 4));
}
Also used : FillHandlePasteCommand(org.eclipse.nebula.widgets.nattable.fillhandle.command.FillHandlePasteCommand) CopyDataToClipboardCommand(org.eclipse.nebula.widgets.nattable.copy.command.CopyDataToClipboardCommand) Rectangle(org.eclipse.swt.graphics.Rectangle) Point(org.eclipse.swt.graphics.Point) Test(org.junit.Test)

Example 15 with CopyDataToClipboardCommand

use of org.eclipse.nebula.widgets.nattable.copy.command.CopyDataToClipboardCommand in project nebula.widgets.nattable by eclipse.

the class FillHandlePasteTest method testMultiCellDragThreeUp.

@Test
public void testMultiCellDragThreeUp() {
    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, 1, 2, 5));
    this.natTable.doCommand(new FillHandlePasteCommand(FillHandleOperation.COPY, MoveDirectionEnum.UP, this.natTable.getConfigRegistry()));
    assertEquals("Ned", this.selectionLayer.getDataValueByPosition(3, 1));
    assertEquals("Flanders", this.selectionLayer.getDataValueByPosition(4, 1));
    assertEquals("Homer", this.selectionLayer.getDataValueByPosition(3, 2));
    assertEquals("Simpson", this.selectionLayer.getDataValueByPosition(4, 2));
    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, 1), new Point(4, 1), new Point(3, 2), new Point(4, 2), new Point(3, 3), new Point(4, 3), new Point(3, 4), new Point(4, 4), new Point(3, 5), new Point(4, 5));
}
Also used : FillHandlePasteCommand(org.eclipse.nebula.widgets.nattable.fillhandle.command.FillHandlePasteCommand) CopyDataToClipboardCommand(org.eclipse.nebula.widgets.nattable.copy.command.CopyDataToClipboardCommand) Rectangle(org.eclipse.swt.graphics.Rectangle) Point(org.eclipse.swt.graphics.Point) Test(org.junit.Test)

Aggregations

CopyDataToClipboardCommand (org.eclipse.nebula.widgets.nattable.copy.command.CopyDataToClipboardCommand)84 FillHandlePasteCommand (org.eclipse.nebula.widgets.nattable.fillhandle.command.FillHandlePasteCommand)83 Rectangle (org.eclipse.swt.graphics.Rectangle)82 Test (org.junit.Test)82 Point (org.eclipse.swt.graphics.Point)34 Date (java.util.Date)6 BigDecimal (java.math.BigDecimal)2 HashMap (java.util.HashMap)1 NatTable (org.eclipse.nebula.widgets.nattable.NatTable)1 CopyDataCommandHandler (org.eclipse.nebula.widgets.nattable.copy.command.CopyDataCommandHandler)1 IDataProvider (org.eclipse.nebula.widgets.nattable.data.IDataProvider)1 DefaultBodyDataProvider (org.eclipse.nebula.widgets.nattable.grid.data.DefaultBodyDataProvider)1 DefaultColumnHeaderDataProvider (org.eclipse.nebula.widgets.nattable.grid.data.DefaultColumnHeaderDataProvider)1 DefaultCornerDataProvider (org.eclipse.nebula.widgets.nattable.grid.data.DefaultCornerDataProvider)1 DefaultRowHeaderDataProvider (org.eclipse.nebula.widgets.nattable.grid.data.DefaultRowHeaderDataProvider)1 ColumnHeaderLayer (org.eclipse.nebula.widgets.nattable.grid.layer.ColumnHeaderLayer)1 CornerLayer (org.eclipse.nebula.widgets.nattable.grid.layer.CornerLayer)1 DefaultColumnHeaderDataLayer (org.eclipse.nebula.widgets.nattable.grid.layer.DefaultColumnHeaderDataLayer)1 DefaultRowHeaderDataLayer (org.eclipse.nebula.widgets.nattable.grid.layer.DefaultRowHeaderDataLayer)1 GridLayer (org.eclipse.nebula.widgets.nattable.grid.layer.GridLayer)1