use of org.eclipse.nebula.widgets.nattable.grid.command.ClientAreaResizeCommand in project nebula.widgets.nattable by eclipse.
the class AutoResizeColumnsTest method setClientAreaProvider.
private void setClientAreaProvider(ILayer layer) {
layer.setClientAreaProvider(new IClientAreaProvider() {
@Override
public Rectangle getClientArea() {
return new Rectangle(0, 0, 1050, 250);
}
});
layer.doCommand(new ClientAreaResizeCommand(new Shell(Display.getDefault(), SWT.V_SCROLL | SWT.H_SCROLL)));
}
use of org.eclipse.nebula.widgets.nattable.grid.command.ClientAreaResizeCommand in project nebula.widgets.nattable by eclipse.
the class ColumnSizeConfigurationCommandTest method testSetPercentageValue.
@Test
public void testSetPercentageValue() {
assertEquals(100, this.dataLayer.getColumnWidthByPosition(0));
assertEquals(100, this.dataLayer.getColumnWidthByPosition(1));
assertEquals(100, this.dataLayer.getColumnWidthByPosition(2));
assertEquals(100, this.dataLayer.getColumnWidthByPosition(3));
this.dataLayer.doCommand(new ColumnSizeConfigurationCommand("COLUMN_0", 20, true));
this.dataLayer.doCommand(new ColumnSizeConfigurationCommand("COLUMN_1", 20, true));
this.dataLayer.doCommand(new ColumnSizeConfigurationCommand("COLUMN_2", 30, true));
this.dataLayer.doCommand(new ColumnSizeConfigurationCommand("COLUMN_3", 30, true));
// recalculate percentages
ClientAreaResizeCommand resizeCommand = new ClientAreaResizeCommand(null);
resizeCommand.setCalcArea(new Rectangle(0, 0, 1000, 1000));
this.dataLayer.doCommand(resizeCommand);
assertEquals(200, this.dataLayer.getColumnWidthByPosition(0));
assertEquals(200, this.dataLayer.getColumnWidthByPosition(1));
assertEquals(300, this.dataLayer.getColumnWidthByPosition(2));
assertEquals(300, this.dataLayer.getColumnWidthByPosition(3));
}
use of org.eclipse.nebula.widgets.nattable.grid.command.ClientAreaResizeCommand in project nebula.widgets.nattable by eclipse.
the class ColumnSizeConfigurationCommandTest method testPercentageSizing.
@Test
public void testPercentageSizing() {
assertEquals(100, this.dataLayer.getColumnWidthByPosition(0));
assertEquals(100, this.dataLayer.getColumnWidthByPosition(1));
assertEquals(100, this.dataLayer.getColumnWidthByPosition(2));
assertEquals(100, this.dataLayer.getColumnWidthByPosition(3));
ColumnSizeConfigurationCommand command = new ColumnSizeConfigurationCommand(null, null, true);
this.dataLayer.doCommand(command);
// recalculate percentages
ClientAreaResizeCommand resizeCommand = new ClientAreaResizeCommand(null);
resizeCommand.setCalcArea(new Rectangle(0, 0, 500, 500));
this.dataLayer.doCommand(resizeCommand);
assertEquals(125, this.dataLayer.getColumnWidthByPosition(0));
assertEquals(125, this.dataLayer.getColumnWidthByPosition(1));
assertEquals(125, this.dataLayer.getColumnWidthByPosition(2));
assertEquals(125, this.dataLayer.getColumnWidthByPosition(3));
}
use of org.eclipse.nebula.widgets.nattable.grid.command.ClientAreaResizeCommand in project nebula.widgets.nattable by eclipse.
the class MultiColumnResizeCommandTest method setClientAreaProvider.
private void setClientAreaProvider(ILayer layer) {
layer.setClientAreaProvider(new IClientAreaProvider() {
@Override
public Rectangle getClientArea() {
return new Rectangle(0, 0, 1050, 250);
}
});
layer.doCommand(new ClientAreaResizeCommand(new Shell(Display.getDefault(), SWT.V_SCROLL | SWT.H_SCROLL)));
}
use of org.eclipse.nebula.widgets.nattable.grid.command.ClientAreaResizeCommand in project nebula.widgets.nattable by eclipse.
the class DefaultBodyLayerStackTest method setup.
@Before
public void setup() {
this.layerStack = new DefaultBodyLayerStack(new DataLayerFixture(10, 5, 100, 20));
this.layerStack.setClientAreaProvider(new IClientAreaProvider() {
@Override
public Rectangle getClientArea() {
return new Rectangle(0, 0, 2000, 250);
}
});
this.layerStack.doCommand(new ClientAreaResizeCommand(new Shell(Display.getDefault(), SWT.V_SCROLL | SWT.H_SCROLL)));
}
Aggregations