Search in sources :

Example 1 with FreezeSelectionCommand

use of org.eclipse.nebula.widgets.nattable.freeze.command.FreezeSelectionCommand in project nebula.widgets.nattable by eclipse.

the class CompositeFreezeLayerTest method testFreezeSelectionAtBeginning.

// Freeze selection
@Test
public void testFreezeSelectionAtBeginning() {
    this.selectionLayer.setSelectedCell(2, 2);
    this.compositeFreezeLayer.doCommand(new FreezeSelectionCommand());
    TestLayer expectedLayer = new TestLayer(4, 4, "0:0;100 | 1:1;100 | 2:0;100 | 3:1;100", "0:0;40  | 1:1;40  | 2:0;40  | 3:1;40", "A0~:FROZEN_REGION        | B0~:FROZEN_REGION        | C0~:FROZEN_ROW_REGION                      | D0~:FROZEN_ROW_REGION \n" + "A1~:FROZEN_REGION        | B1~:FROZEN_REGION        | C1~:FROZEN_ROW_REGION                      | D1~:FROZEN_ROW_REGION \n" + "A2~:FROZEN_COLUMN_REGION | B2~:FROZEN_COLUMN_REGION | C2~SELECT:selectionAnchor,NONFROZEN_REGION | D2~:NONFROZEN_REGION \n" + "A3~:FROZEN_COLUMN_REGION | B3~:FROZEN_COLUMN_REGION | C3~:NONFROZEN_REGION                       | D3~:NONFROZEN_REGION \n");
    LayerAssert.assertLayerEquals(expectedLayer, this.compositeFreezeLayer);
}
Also used : TestLayer(org.eclipse.nebula.widgets.nattable.test.fixture.TestLayer) FreezeSelectionCommand(org.eclipse.nebula.widgets.nattable.freeze.command.FreezeSelectionCommand) Test(org.junit.Test)

Example 2 with FreezeSelectionCommand

use of org.eclipse.nebula.widgets.nattable.freeze.command.FreezeSelectionCommand in project nebula.widgets.nattable by eclipse.

the class CompositeFreezeLayerTest method testFreezeSelectionInMiddle.

@Test
public void testFreezeSelectionInMiddle() {
    this.compositeFreezeLayer.setClientAreaProvider(new IClientAreaProvider() {

        @Override
        public Rectangle getClientArea() {
            return new Rectangle(0, 0, 300, 120);
        }
    });
    this.selectionLayer.setSelectedCell(2, 2);
    this.viewportLayer.setOriginX(this.viewportLayer.getStartXOfColumnPosition(1));
    this.viewportLayer.setOriginY(this.viewportLayer.getStartYOfRowPosition(1));
    this.compositeFreezeLayer.doCommand(new FreezeSelectionCommand());
    TestLayer expectedLayer = new TestLayer(3, 3, "1:0;100 | 2:0;100 | 3:1;100", "1:0;40  | 2:0;40  | 3:1;40", "B1~:FROZEN_REGION        | C1~:FROZEN_ROW_REGION                      | D1~:FROZEN_ROW_REGION \n" + "B2~:FROZEN_COLUMN_REGION | C2~SELECT:selectionAnchor,NONFROZEN_REGION | D2~:NONFROZEN_REGION \n" + "B3~:FROZEN_COLUMN_REGION | C3~:NONFROZEN_REGION                       | D3~:NONFROZEN_REGION \n");
    LayerAssert.assertLayerEquals(expectedLayer, this.compositeFreezeLayer);
}
Also used : IClientAreaProvider(org.eclipse.nebula.widgets.nattable.util.IClientAreaProvider) Rectangle(org.eclipse.swt.graphics.Rectangle) TestLayer(org.eclipse.nebula.widgets.nattable.test.fixture.TestLayer) FreezeSelectionCommand(org.eclipse.nebula.widgets.nattable.freeze.command.FreezeSelectionCommand) Test(org.junit.Test)

Aggregations

FreezeSelectionCommand (org.eclipse.nebula.widgets.nattable.freeze.command.FreezeSelectionCommand)2 TestLayer (org.eclipse.nebula.widgets.nattable.test.fixture.TestLayer)2 Test (org.junit.Test)2 IClientAreaProvider (org.eclipse.nebula.widgets.nattable.util.IClientAreaProvider)1 Rectangle (org.eclipse.swt.graphics.Rectangle)1