use of org.eclipse.nebula.widgets.nattable.util.IClientAreaProvider in project nebula.widgets.nattable by eclipse.
the class ColumnGroupsCommandHandlerTest method setUp.
@Before
public void setUp() {
this.gridLayer = new GridLayerFixture();
this.selectionLayer = (SelectionLayer) this.gridLayer.getBodyLayer().getViewportLayer().getScrollableLayer();
this.model = new ColumnGroupModel();
this.handler = new ColumnGroupsCommandHandler(this.model, this.selectionLayer, new ColumnGroupHeaderLayer(this.gridLayer.getColumnHeaderLayer(), this.gridLayer.getBodyLayer().getSelectionLayer(), new ColumnGroupModel()));
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 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.util.IClientAreaProvider 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.util.IClientAreaProvider 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)));
}
use of org.eclipse.nebula.widgets.nattable.util.IClientAreaProvider in project nebula.widgets.nattable by eclipse.
the class NatExporter method exportLayer.
/**
* Exports the given {@link ILayer} to the given {@link OutputStream} using
* the provided {@link ITableExporter}.
*
* @param exporter
* The {@link ITableExporter} that should be used for exporting.
* @param outputStream
* The {@link OutputStream} that should be used to write the
* export to.
* @param layer
* The {@link ILayer} that should be exported.
* @param configRegistry
* The {@link IConfigRegistry} needed to retrieve the export
* configurations.
*
* @since 1.5
*/
protected void exportLayer(final ITableExporter exporter, final OutputStream outputStream, final ILayer layer, final IConfigRegistry configRegistry) {
if (this.preRender) {
AutoResizeHelper.autoResize(layer, configRegistry);
}
IClientAreaProvider originalClientAreaProvider = layer.getClientAreaProvider();
// This needs to be done so that the layer can return all the cells
// not just the ones visible in the viewport
layer.doCommand(new TurnViewportOffCommand());
setClientAreaToMaximum(layer);
// if a SummaryRowLayer is in the layer stack, we need to ensure that
// the values are calculated
layer.doCommand(new CalculateSummaryRowValuesCommand());
// if a FormulaDataProvider is involved, we need to ensure that the
// formula evaluation is disabled so the formula itself is exported
// instead of the calculated value
layer.doCommand(new DisableFormulaEvaluationCommand());
ProgressBar progressBar = null;
if (this.shell != null) {
Shell childShell = new Shell(this.shell.getDisplay(), SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
// $NON-NLS-1$
childShell.setText(Messages.getString("NatExporter.exporting"));
int endRow = layer.getRowCount() - 1;
progressBar = new ProgressBar(childShell, SWT.SMOOTH);
progressBar.setMinimum(0);
progressBar.setMaximum(endRow);
progressBar.setBounds(0, 0, 400, 25);
progressBar.setFocus();
childShell.pack();
childShell.open();
}
try {
exporter.exportTable(this.shell, progressBar, outputStream, layer, configRegistry);
} catch (Exception e) {
throw new RuntimeException(e);
} finally {
// These must be fired at the end of the thread execution
layer.setClientAreaProvider(originalClientAreaProvider);
layer.doCommand(new TurnViewportOnCommand());
layer.doCommand(new EnableFormulaEvaluationCommand());
if (progressBar != null) {
Shell childShell = progressBar.getShell();
progressBar.dispose();
childShell.dispose();
}
}
}
Aggregations