Search in sources :

Example 31 with FillHandlePasteCommand

use of org.eclipse.nebula.widgets.nattable.fillhandle.command.FillHandlePasteCommand in project nebula.widgets.nattable by eclipse.

the class FillHandleSeriesTest method testBigIntegerNullCellValueDragDown.

@Test
public void testBigIntegerNullCellValueDragDown() {
    this.dataProvider.setDataValue(4, 4, BigInteger.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(BigInteger.valueOf(1), this.selectionLayer.getDataValueByPosition(4, 4));
    assertNull(this.selectionLayer.getDataValueByPosition(4, 5));
    assertEquals(BigInteger.valueOf(1), this.selectionLayer.getDataValueByPosition(4, 6));
    assertNull(this.selectionLayer.getDataValueByPosition(4, 7));
    assertEquals(BigInteger.valueOf(1), this.selectionLayer.getDataValueByPosition(4, 8));
    assertNull(this.selectionLayer.getDataValueByPosition(4, 9));
}
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) Test(org.junit.Test)

Example 32 with FillHandlePasteCommand

use of org.eclipse.nebula.widgets.nattable.fillhandle.command.FillHandlePasteCommand in project nebula.widgets.nattable by eclipse.

the class FillHandleSeriesTest method testByteNullCellValueDragDown.

@Test
public void testByteNullCellValueDragDown() {
    this.dataProvider.setDataValue(4, 4, Byte.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(Byte.valueOf("1"), this.selectionLayer.getDataValueByPosition(4, 4));
    assertNull(this.selectionLayer.getDataValueByPosition(4, 5));
    assertEquals(Byte.valueOf("1"), this.selectionLayer.getDataValueByPosition(4, 6));
    assertNull(this.selectionLayer.getDataValueByPosition(4, 7));
    assertEquals(Byte.valueOf("1"), this.selectionLayer.getDataValueByPosition(4, 8));
    assertNull(this.selectionLayer.getDataValueByPosition(4, 9));
}
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) Test(org.junit.Test)

Example 33 with FillHandlePasteCommand

use of org.eclipse.nebula.widgets.nattable.fillhandle.command.FillHandlePasteCommand in project nebula.widgets.nattable by eclipse.

the class FillHandleSeriesTest method testMultiCellSameDiffIntegerValueDragRight.

@Test
public void testMultiCellSameDiffIntegerValueDragRight() {
    this.dataProvider.setDataValue(4, 4, Integer.valueOf("1"));
    this.dataProvider.setDataValue(5, 4, Integer.valueOf("3"));
    this.dataProvider.setDataValue(6, 4, Integer.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(Integer.valueOf("1"), this.selectionLayer.getDataValueByPosition(4, 4));
    assertEquals(Integer.valueOf("3"), this.selectionLayer.getDataValueByPosition(5, 4));
    assertEquals(Integer.valueOf("5"), this.selectionLayer.getDataValueByPosition(6, 4));
    assertEquals(Integer.valueOf("7"), this.selectionLayer.getDataValueByPosition(7, 4));
    assertEquals(Integer.valueOf("9"), this.selectionLayer.getDataValueByPosition(8, 4));
    assertEquals(Integer.valueOf("11"), this.selectionLayer.getDataValueByPosition(9, 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) Test(org.junit.Test)

Example 34 with FillHandlePasteCommand

use of org.eclipse.nebula.widgets.nattable.fillhandle.command.FillHandlePasteCommand in project nebula.widgets.nattable by eclipse.

the class FillHandleSeriesTest method testMultiCellSameDiffIntegerValueDragLeft.

@Test
public void testMultiCellSameDiffIntegerValueDragLeft() {
    this.dataProvider.setDataValue(4, 4, Integer.valueOf("1"));
    this.dataProvider.setDataValue(5, 4, Integer.valueOf("3"));
    this.dataProvider.setDataValue(6, 4, Integer.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(1, 4, 6, 1));
    this.natTable.doCommand(new FillHandlePasteCommand(FillHandleOperation.SERIES, MoveDirectionEnum.LEFT, this.natTable.getConfigRegistry()));
    assertEquals(Integer.valueOf("-5"), this.selectionLayer.getDataValueByPosition(1, 4));
    assertEquals(Integer.valueOf("-3"), this.selectionLayer.getDataValueByPosition(2, 4));
    assertEquals(Integer.valueOf("-1"), this.selectionLayer.getDataValueByPosition(3, 4));
    assertEquals(Integer.valueOf("1"), this.selectionLayer.getDataValueByPosition(4, 4));
    assertEquals(Integer.valueOf("3"), this.selectionLayer.getDataValueByPosition(5, 4));
    assertEquals(Integer.valueOf("5"), this.selectionLayer.getDataValueByPosition(6, 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) Test(org.junit.Test)

Example 35 with FillHandlePasteCommand

use of org.eclipse.nebula.widgets.nattable.fillhandle.command.FillHandlePasteCommand in project nebula.widgets.nattable by eclipse.

the class FillHandleSeriesTest method testFloatNullCellValueDragDown.

@Test
public void testFloatNullCellValueDragDown() {
    this.dataProvider.setDataValue(4, 4, Float.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(Float.valueOf("1"), this.selectionLayer.getDataValueByPosition(4, 4));
    assertNull(this.selectionLayer.getDataValueByPosition(4, 5));
    assertEquals(Float.valueOf("1"), this.selectionLayer.getDataValueByPosition(4, 6));
    assertNull(this.selectionLayer.getDataValueByPosition(4, 7));
    assertEquals(Float.valueOf("1"), this.selectionLayer.getDataValueByPosition(4, 8));
    assertNull(this.selectionLayer.getDataValueByPosition(4, 9));
}
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) Test(org.junit.Test)

Aggregations

FillHandlePasteCommand (org.eclipse.nebula.widgets.nattable.fillhandle.command.FillHandlePasteCommand)84 CopyDataToClipboardCommand (org.eclipse.nebula.widgets.nattable.copy.command.CopyDataToClipboardCommand)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 DisposeEvent (org.eclipse.swt.events.DisposeEvent)1 DisposeListener (org.eclipse.swt.events.DisposeListener)1 MenuAdapter (org.eclipse.swt.events.MenuAdapter)1 MenuEvent (org.eclipse.swt.events.MenuEvent)1 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 Menu (org.eclipse.swt.widgets.Menu)1 MenuItem (org.eclipse.swt.widgets.MenuItem)1