public class AutoResizeHelper extends Object
ILayer in-memory to trigger auto-resizing
of rows and columns in case content painters are configured to calculate the
necessary dimensions.
Note that this operation is expensive in terms of memory consumption and processing time. Be careful when using this helper for huge tables.
| Modifier and Type | Field and Description |
|---|---|
protected IClientAreaProvider |
clientAreaProvider
The
IClientAreaProvider that is used for rendering the whole
layer in-memory. |
protected IConfigRegistry |
configRegistry
The
IConfigRegistry needed for rendering. |
protected ILayer |
layer
The
ILayer that should be used for in-memory rendering to trigger
auto-resizing. |
protected IClientAreaProvider |
originalClientAreaProvider
The original
IClientAreaProvider needed to restore the original
state after processing. |
protected org.eclipse.swt.graphics.Rectangle |
prevArea
The total area of the previous in-memory rendering.
|
protected boolean |
resizedOnPrinting
Flag to indicate that an automatic resize was triggered on rendering.
|
protected ILayerListener |
resizeListener
ILayerListener that is added to the ILayer to get
informed about RowResizeEvent and ColumnResizeEvent to
know if an automatic resize was triggered on rendering. |
protected org.eclipse.swt.graphics.Rectangle |
totalArea
The total area needed to render the whole layer at once.
|
| Modifier and Type | Method and Description |
|---|---|
static void |
autoResize(ILayer layer,
IConfigRegistry configRegistry)
Executes in-memory rendering of the given
ILayer to trigger
content based auto-resizing. |
static void |
autoResizeRows(NatTable natTable,
ILayer rowLayer,
ILayer bodyDataLayer)
Trigger auto-resizing of rows based on the content of the whole row.
|
protected void |
calculateTotalArea()
Calculate the total area needed to render the whole layer.
|
protected void |
init()
Prepare the layer for complete in-memory rendering.
|
protected void |
paintInMemory()
Paints the layer on a temporary image GC.
|
protected void |
paintLayer(org.eclipse.swt.graphics.GC gc,
org.eclipse.swt.graphics.Rectangle printBounds)
Print the part of the layer that matches the given print bounds.
|
protected void |
restore()
Restore the original state of the layer before in-memory rendering
preparations.
|
protected final ILayer layer
ILayer that should be used for in-memory rendering to trigger
auto-resizing.protected final IConfigRegistry configRegistry
IConfigRegistry needed for rendering.protected org.eclipse.swt.graphics.Rectangle totalArea
protected org.eclipse.swt.graphics.Rectangle prevArea
protected IClientAreaProvider originalClientAreaProvider
IClientAreaProvider needed to restore the original
state after processing.protected volatile boolean resizedOnPrinting
protected ILayerListener resizeListener
ILayerListener that is added to the ILayer to get
informed about RowResizeEvent and ColumnResizeEvent to
know if an automatic resize was triggered on rendering.protected IClientAreaProvider clientAreaProvider
IClientAreaProvider that is used for rendering the whole
layer in-memory.public static void autoResize(ILayer layer, IConfigRegistry configRegistry)
ILayer to trigger
content based auto-resizing.layer - The ILayer that should be used for in-memory rendering
to trigger auto-resizing.configRegistry - The IConfigRegistry needed for rendering.protected void paintInMemory()
protected void paintLayer(org.eclipse.swt.graphics.GC gc,
org.eclipse.swt.graphics.Rectangle printBounds)
gc - The print GC to render the layer to.printBounds - The bounds of the print page.protected void calculateTotalArea()
protected void init()
protected void restore()
public static void autoResizeRows(NatTable natTable, ILayer rowLayer, ILayer bodyDataLayer)
natTable - The NatTable on which the auto row resize should be performed.
Needed to create a temporary GC and retrieve the
IConfigRegistry.rowLayer - The ILayer that should be used to determine the rows
to auto-resize. Can be the ViewportLayer to ensure
that the auto row resize is only triggered for visible rows or
the DataLayer of the body region to auto-resize all
rows.bodyDataLayer - The DataLayer of the body region to inspect all
columns in a row, even if not visible in the viewport. Can
also be a higher level layer if it adds rows, e.g. the
SummaryRowLayer.Copyright © 2019. All rights reserved.