GridDataFactory.fillDefaults().grab(true, true).applyTo(mix);
// example for percentage calculation with default sizing in a grid
// all columns will be same size while the NatTable itself will have
// 100%
DummyGridLayerStack gridLayer = new DummyGridLayerStack(dataProvider);
final DataLayer n4DataLayer = (DataLayer) gridLayer.getBodyDataLayer();
n4DataLayer.setColumnPercentageSizing(true);
n4DataLayer.setRowPercentageSizing(true);
final NatTable n4 = new NatTable(gridPanel, gridLayer, false);
n4.addConfiguration(new DefaultNatTableStyleConfiguration());
n4.addConfiguration(new HeaderMenuConfiguration(n4));
n4.configure();
GridDataFactory.fillDefaults().grab(true, true).applyTo(n4);
// example for fixed percentage sizing in a grid
// ensure that the sum of column sizes is not greater than 100
gridLayer = new DummyGridLayerStack(dataProvider);
final DataLayer n5DataLayer = (DataLayer) gridLayer.getBodyDataLayer();
n5DataLayer.setColumnWidthByPosition(0, 25);
n5DataLayer.setColumnWidthByPosition(1, 25);
n5DataLayer.setColumnWidthByPosition(2, 50);
n5DataLayer.setColumnPercentageSizing(true);
final NatTable n5 = new NatTable(gridPanel, gridLayer, false);
n5.addConfiguration(new DefaultNatTableStyleConfiguration());
n5.addConfiguration(new HeaderMenuConfiguration(n5));
n5.configure();
GridDataFactory.fillDefaults().grab(true, true).applyTo(n5);
// example for mixed percentage sizing in a grid
// configure not every column with the exact percentage value, this way
// the columns for which
// no exact values are set will use the remaining space
gridLayer = new DummyGridLayerStack(dataProvider);
final DataLayer n6DataLayer = (DataLayer) gridLayer.getBodyDataLayer();
n6DataLayer.setColumnWidthByPosition(0, 20);
n6DataLayer.setColumnWidthByPosition(2, 20);
n6DataLayer.setColumnPercentageSizing(true);
final NatTable n6 = new NatTable(gridPanel, gridLayer, false);
n6.addConfiguration(new DefaultNatTableStyleConfiguration());
n6.addConfiguration(new HeaderMenuConfiguration(n6));
n6.configure();
GridDataFactory.fillDefaults().grab(true, true).applyTo(n6);
// example for mixed fixed/percentage sizing in a grid
// configure not every column with the exact percentage value, this way
// the columns for which
// no exact values are set will use the remaining space
gridLayer = new DummyGridLayerStack(dataProvider);
final DataLayer mixGridDataLayer = (DataLayer) gridLayer
.getBodyDataLayer();
mixGridDataLayer.setColumnPercentageSizing(true);
mixGridDataLayer.setColumnPercentageSizing(0, false);
mixGridDataLayer.setColumnPercentageSizing(1, false);
mixGridDataLayer.setColumnWidthByPosition(0, 100);