use of org.eclipse.nebula.widgets.nattable.util.IClientAreaProvider in project nebula.widgets.nattable by eclipse.
the class SearchGridCommandHandlerTest method setUp.
@Before
public void setUp() {
this.gridLayer = new GridLayerFixture();
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)));
this.configRegistry = new ConfigRegistry();
new DefaultNatTableStyleConfiguration().configureRegistry(this.configRegistry);
this.commandHandler = new SearchGridCellsCommandHandler(this.gridLayer.getBodyLayer().getSelectionLayer());
selectCell(3, 3);
}
use of org.eclipse.nebula.widgets.nattable.util.IClientAreaProvider in project nebula.widgets.nattable by eclipse.
the class MultiColumnReorderEventDiffTest method before.
@Before
public void before() {
this.dataLayer = new DataLayerFixture(20, 20, 100, 40);
this.viewportLayer = new ViewportLayer(this.dataLayer);
this.viewportLayer.setClientAreaProvider(new IClientAreaProvider() {
@Override
public Rectangle getClientArea() {
return new Rectangle(0, 0, 800, 400);
}
});
this.viewportLayer.setOriginX(this.viewportLayer.getStartXOfColumnPosition(2));
this.viewportLayer.setOriginY(this.viewportLayer.getStartYOfRowPosition(2));
}
use of org.eclipse.nebula.widgets.nattable.util.IClientAreaProvider in project nebula.widgets.nattable by eclipse.
the class SelectionSearchStrategyTest method setUp.
@Before
public void setUp() {
this.bodyDataProvider = new IDataProvider() {
@Override
public int getColumnCount() {
return GridLayerFixture.bodyDataProvider.getColumnCount();
}
@Override
public int getRowCount() {
return GridLayerFixture.bodyDataProvider.getRowCount();
}
@Override
public Object getDataValue(int columnIndex, int rowIndex) {
if (columnIndex == 0 || columnIndex == 9) {
return CELL_VALUE;
}
return GridLayerFixture.bodyDataProvider.getDataValue(columnIndex, rowIndex);
}
@Override
public void setDataValue(int columnIndex, int rowIndex, Object newValue) {
throw new UnsupportedOperationException();
}
};
this.gridLayer = new DefaultGridLayer(this.bodyDataProvider, GridLayerFixture.colHeaderDataProvider, GridLayerFixture.rowHeaderDataProvider, GridLayerFixture.cornerDataProvider);
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)));
this.selectionLayer = this.gridLayer.getBodyLayer().getSelectionLayer();
this.configRegistry = new ConfigRegistry();
new DefaultNatTableStyleConfiguration().configureRegistry(this.configRegistry);
}
use of org.eclipse.nebula.widgets.nattable.util.IClientAreaProvider in project nebula.widgets.nattable by eclipse.
the class ViewportLayerTest2 method setup.
@Before
public void setup() {
String columnInfo = "0:0;100 | 1:1;100 | 2:2;100 | 3:3;100";
String rowInfo = "0:0;40 | 1:1;40 | 2:2;40 | 3:3;40";
String cellInfo = "A0 | B0 | C0 | D0 \n" + "A1 | B1 | C1 | D1 \n" + "A2 | B2 | C2 | D2 \n" + "A3 | B3 | C3 | D3 \n";
this.dataLayer = new TestLayer(4, 4, columnInfo, rowInfo, cellInfo);
this.viewportLayer = new ViewportLayer(this.dataLayer);
this.viewportLayer.setClientAreaProvider(new IClientAreaProvider() {
@Override
public Rectangle getClientArea() {
return new Rectangle(0, 0, 200, 400);
}
});
}
use of org.eclipse.nebula.widgets.nattable.util.IClientAreaProvider in project nebula.widgets.nattable by eclipse.
the class NatTable method internalSetLayer.
private void internalSetLayer(ILayer layer) {
if (layer != null) {
this.underlyingLayer = layer;
this.underlyingLayer.setClientAreaProvider(new IClientAreaProvider() {
@Override
public Rectangle getClientArea() {
final Rectangle clientArea = new Rectangle(0, 0, 0, 0);
if (!isDisposed()) {
getDisplay().syncExec(new Runnable() {
@Override
public void run() {
Rectangle natClientArea = NatTable.this.getClientArea();
clientArea.x = natClientArea.x;
clientArea.y = natClientArea.y;
clientArea.width = natClientArea.width;
clientArea.height = natClientArea.height;
}
});
}
return clientArea;
}
});
this.underlyingLayer.addLayerListener(this);
// register the DPI scaling
this.underlyingLayer.doCommand(new ConfigureScalingCommand(new AbstractDpiConverter() {
@Override
protected void readDpiFromDisplay() {
Display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
dpi = Display.getDefault().getDPI().x;
}
});
}
}, new AbstractDpiConverter() {
@Override
protected void readDpiFromDisplay() {
Display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
dpi = Display.getDefault().getDPI().y;
}
});
}
}));
}
}
Aggregations