use of org.eclipse.nebula.widgets.nattable.util.IClientAreaProvider in project nebula.widgets.nattable by eclipse.
the class FreezeHandlerTest method testFreezeReorderToAllColumns.
@Test
public void testFreezeReorderToAllColumns() {
this.compositeFreezeLayer.setClientAreaProvider(new IClientAreaProvider() {
@Override
public Rectangle getClientArea() {
return new Rectangle(0, 0, 1500, 400);
}
});
// Fire this command so that the viewport can be initialized
this.compositeFreezeLayer.doCommand(new ClientAreaResizeCommand(new Shell(Display.getDefault(), SWT.H_SCROLL | SWT.V_SCROLL)));
// freeze all-1 columns
this.compositeFreezeLayer.doCommand(new FreezeColumnCommand(this.compositeFreezeLayer, 8));
assertEquals(9, this.freezeLayer.getColumnCount());
assertEquals(1, this.viewportLayer.getColumnCount());
assertEquals(900, this.viewportLayer.getOrigin().getX());
this.compositeFreezeLayer.doCommand(new ColumnReorderCommand(this.compositeFreezeLayer, 9, 7));
assertEquals(10, this.freezeLayer.getColumnCount());
assertEquals(0, this.viewportLayer.getColumnCount());
assertEquals(1000, this.viewportLayer.getOrigin().getX());
}
use of org.eclipse.nebula.widgets.nattable.util.IClientAreaProvider in project nebula.widgets.nattable by eclipse.
the class FreezeHandlerTest method testFreezeAllRowsResize.
@Test
public void testFreezeAllRowsResize() {
this.compositeFreezeLayer.setClientAreaProvider(new IClientAreaProvider() {
@Override
public Rectangle getClientArea() {
return new Rectangle(0, 0, 1500, 400);
}
});
// Shoot this command so that the viewport can be initialized
this.compositeFreezeLayer.doCommand(new ClientAreaResizeCommand(new Shell(Display.getDefault(), SWT.H_SCROLL | SWT.V_SCROLL)));
this.compositeFreezeLayer.doCommand(new FreezeRowCommand(this.compositeFreezeLayer, 9));
assertEquals(10, this.freezeLayer.getRowCount());
assertEquals(0, this.viewportLayer.getRowCount());
assertEquals(200, this.viewportLayer.getOrigin().getY());
this.compositeFreezeLayer.doCommand(new RowResizeCommand(this.freezeLayer, 2, 120));
assertEquals(10, this.freezeLayer.getRowCount());
assertEquals(0, this.viewportLayer.getRowCount());
assertEquals(300, this.viewportLayer.getOrigin().getY());
}
use of org.eclipse.nebula.widgets.nattable.util.IClientAreaProvider in project nebula.widgets.nattable by eclipse.
the class ColumnGroupHeaderLayerSelectionTest method setup.
@Before
public void setup() {
this.dataProvider = new ListDataProvider<>(getNumberValues(), new ReflectiveColumnPropertyAccessor<>("columnOneNumber", "columnTwoNumber", "columnThreeNumber", "columnFourNumber", "columnFiveNumber", "columnSixNumber", "columnSevenNumber", "columnEightNumber", "columnNineNumber", "columnTenNumber"));
this.gridLayer = new GridLayerFixture(this.dataProvider);
this.model = new ColumnGroupModel();
// 10 columns in header
this.columnGroupLayer = new ColumnGroupHeaderLayer(this.gridLayer.getColumnHeaderLayer(), this.gridLayer.getBodyLayer().getSelectionLayer(), this.model, false);
this.columnGroupLayer.addConfiguration(new DefaultColumnGroupHeaderLayerConfiguration(this.model, true));
this.gridLayer.getBodyLayer().getViewportLayer().registerCommandHandler(new ViewportSelectColumnGroupCommandHandler(this.gridLayer.getBodyLayer().getViewportLayer(), this.columnGroupLayer));
this.columnGroupLayer.addColumnsIndexesToGroup(TEST_GROUP_NAME_1, 0, 1, 2);
this.columnGroupLayer.addColumnsIndexesToGroup(TEST_GROUP_NAME_2, 5, 6);
this.columnGroupLayer.addColumnsIndexesToGroup(TEST_GROUP_NAME_3, 8, 9);
this.gridLayer.setClientAreaProvider(new IClientAreaProvider() {
@Override
public Rectangle getClientArea() {
return new Rectangle(0, 0, 1050, 200);
}
});
this.gridLayer.doCommand(new ClientAreaResizeCommand(new Shell(Display.getDefault(), SWT.V_SCROLL | SWT.H_SCROLL)));
this.layerListener = new LayerListenerFixture();
this.gridLayer.getBodyLayer().addLayerListener(this.layerListener);
}
use of org.eclipse.nebula.widgets.nattable.util.IClientAreaProvider in project nebula.widgets.nattable by eclipse.
the class ColumnGroupHeaderLayerTest method setup.
@Before
public void setup() {
this.gridLayer = new GridLayerFixture();
this.model = new ColumnGroupModel();
// 10 columns in header
this.columnGroupLayer = new ColumnGroupHeaderLayer(this.gridLayer.getColumnHeaderLayer(), this.gridLayer.getBodyLayer().getSelectionLayer(), this.model);
this.columnGroupLayer.addColumnsIndexesToGroup(TEST_GROUP_NAME_1, 0, 1);
this.columnGroupLayer.addColumnsIndexesToGroup(TEST_GROUP_NAME_2, 5, 6);
this.columnGroupLayer.addColumnsIndexesToGroup(TEST_GROUP_NAME_3, 8, 9);
this.gridLayer.setClientAreaProvider(new IClientAreaProvider() {
@Override
public Rectangle getClientArea() {
return new Rectangle(0, 0, 1050, 250);
}
});
this.gridLayer.doCommand(new ClientAreaResizeCommand(new Shell(Display.getDefault(), SWT.V_SCROLL | SWT.H_SCROLL)));
}
use of org.eclipse.nebula.widgets.nattable.util.IClientAreaProvider in project nebula.widgets.nattable by eclipse.
the class ResizeEventDiffTest method before.
@Before
public void before() {
DataLayerFixture dataLayer = new DataLayerFixture(20, 20, 100, 40);
this.viewportLayer = new ViewportLayer(dataLayer);
this.viewportLayer.setClientAreaProvider(new IClientAreaProvider() {
@Override
public Rectangle getClientArea() {
return new Rectangle(0, 0, 400, 400);
}
});
this.viewportLayer.setOriginX(this.viewportLayer.getStartXOfColumnPosition(2));
this.viewportLayer.setOriginY(this.viewportLayer.getStartYOfRowPosition(2));
this.event = new ColumnResizeEvent(dataLayer, 2);
}
Aggregations