|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.eclipse.nebula.widgets.nattable.layer.AbstractLayer
org.eclipse.nebula.widgets.nattable.layer.AbstractLayerTransform
org.eclipse.nebula.widgets.nattable.summaryrow.SummaryRowLayer
org.eclipse.nebula.widgets.nattable.summaryrow.FixedSummaryRowLayer
public class FixedSummaryRowLayer
This layer is a specialization of the SummaryRowLayer and is intended
to be used in a composition below a GridLayer or a vertical
composition like one with a column header and a body. It is horizontal
dependent to the layer above and configured as a standalone summary row,
which means that only the summary row is rendered.
A typical composition to use this layer could look like this:
+---------------+---------------+
| CompositeLayer |
|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+
| +---------------------------+ |
| | GridLayer | |
| +~~~~~~~~~~~~~~~~~~~~~~~~~~~+ |
| | Corner | ColHeader | |
| +-----------+---------------+ |
| | RowHeader | Body | |
| +-----------+---------------+ |
+-------------------------------+
| FixedSummaryRowLayer |
+-------------------------------+
It would be created by the following code:
GridLayer gridLayer = new GridLayer(...);
FixedSummaryRowLayer summaryRowLayer =
new FixedSummaryRowLayer(bodyDataLayer, gridLayer, configRegistry);
CompositeLayer composite = new CompositeLayer(1, 2);
composite.setChildLayer("GRID", gridLayer, 0, 0);
composite.setChildLayer(SUMMARY_REGION, summaryRowLayer, 0, 1);
NatTable natTable = new NatTable(panel, composite);
Note that the bodyDataLayer needs to be accessible somehow and the
creation of the GridLayer is not specified in detail in the above
example.
Using this layer in a composition as shown above will result in a fixed
summary row that doesn't scroll if the viewport is scrolled. This is
different to the typical approach of adding the SummaryRowLayer on
top of the body DataLayer where the summary row will scroll as part
of the body region.
| Field Summary | |
|---|---|
static String |
DEFAULT_SUMMARY_ROW_LABEL
|
protected ILayer |
horizontalLayerDependency
The layer to which fixed summary row should be horizontally dependent. |
protected String |
summaryRowLabel
|
| Fields inherited from class org.eclipse.nebula.widgets.nattable.summaryrow.SummaryRowLayer |
|---|
DEFAULT_SUMMARY_COLUMN_CONFIG_LABEL_PREFIX, DEFAULT_SUMMARY_ROW_CONFIG_LABEL |
| Fields inherited from class org.eclipse.nebula.widgets.nattable.layer.AbstractLayerTransform |
|---|
underlyingLayer |
| Fields inherited from class org.eclipse.nebula.widgets.nattable.layer.AbstractLayer |
|---|
commandHandlers, eventHandlers, layerPainter |
| Fields inherited from interface org.eclipse.nebula.widgets.nattable.persistence.IPersistable |
|---|
DOT, VALUE_SEPARATOR |
| Constructor Summary | |
|---|---|
FixedSummaryRowLayer(IUniqueIndexLayer bodyDataLayer,
ILayer horizontalLayerDependency,
IConfigRegistry configRegistry)
Creates a standalone FixedSummaryRowLayer that is horizontal
dependent to the given layer and calculates the summary values from the
given bodyDataLayer. |
|
FixedSummaryRowLayer(IUniqueIndexLayer bodyDataLayer,
ILayer horizontalLayerDependency,
IConfigRegistry configRegistry,
boolean autoConfigure)
Creates a standalone FixedSummaryRowLayer that is horizontal
dependent to the given layer and calculates the summary values from the
given bodyDataLayer. |
|
FixedSummaryRowLayer(IUniqueIndexLayer bodyDataLayer,
ILayer horizontalLayerDependency,
IConfigRegistry configRegistry,
boolean smoothUpdates,
boolean autoConfigure)
Creates a standalone FixedSummaryRowLayer that is horizontal
dependent to the given layer and calculates the summary values from the
given bodyDataLayer. |
|
| Method Summary | |
|---|---|
int |
getColumnCount()
|
int |
getColumnIndexByPosition(int columnPosition)
Gets the underlying non-transformed column index for the given column position. |
int |
getColumnPositionByX(int x)
Returns the column position that contains the given x coordinate. |
int |
getColumnWidthByPosition(int columnPosition)
Returns the width in pixels of the given column. |
LabelStack |
getConfigLabelsByPosition(int columnPosition,
int rowPosition)
|
protected LabelStack |
getConfigLabelsByPositionWithoutTransformation(int columnPosition,
int rowPosition)
This implementation directly calls the super implementation. |
Object |
getDataValueByPosition(int columnPosition,
int rowPosition)
Calculates the summary for the column using the ISummaryProvider
from the IConfigRegistry. |
int |
getPreferredColumnCount()
|
int |
getPreferredWidth()
|
int |
getStartXOfColumnPosition(int columnPosition)
Returns the x offset in pixels of the given column. |
String |
getSummaryRowLabel()
|
int |
getWidth()
Returns the total width in pixels of this layer. |
boolean |
hasHorizontalCompositeDependency()
|
protected boolean |
isBodyColumn(int columnPosition)
|
boolean |
isColumnPositionResizable(int columnPosition)
|
int |
localToUnderlyingColumnPosition(int localColumnPosition)
Convert a column position to the coordinates of the underlying layer. |
void |
setHorizontalCompositeDependency(boolean compositeDependency)
Specify if the horizontal dependency is a CompositeLayer that
adds additional columns. |
void |
setSummaryRowLabel(String summaryRowLabel)
|
int |
underlyingToLocalColumnPosition(ILayer sourceUnderlyingLayer,
int underlyingColumnPosition)
|
Collection<Range> |
underlyingToLocalColumnPositions(ILayer sourceUnderlyingLayer,
Collection<Range> underlyingColumnPositionRanges)
|
| Methods inherited from class org.eclipse.nebula.widgets.nattable.summaryrow.SummaryRowLayer |
|---|
clearCache, doCommand, getCellByPosition, getColumnPositionByIndex, getHeight, getPreferredHeight, getPreferredRowCount, getRowCount, getRowHeightByPosition, getRowIndexByPosition, getRowPositionByIndex, getRowPositionByY, handleLayerEvent, isStandalone, killCache, setStandalone |
| Methods inherited from class org.eclipse.nebula.widgets.nattable.layer.AbstractLayerTransform |
|---|
configure, dispose, getCellPainter, getDisplayModeByPosition, getLayerPainter, getRegionLabelsByXY, getStartYOfRowPosition, getUnderlyingLayer, getUnderlyingLayerByPosition, getUnderlyingLayersByColumnPosition, getUnderlyingLayersByRowPosition, isRowPositionResizable, loadState, localToUnderlyingRowPosition, saveState, setClientAreaProvider, setUnderlyingLayer, underlyingToLocalRowPosition, underlyingToLocalRowPositions |
| Methods inherited from class org.eclipse.nebula.widgets.nattable.layer.AbstractLayer |
|---|
addConfiguration, addLayerListener, clearConfiguration, fireLayerEvent, getBoundsByPosition, getClientAreaProvider, getConfigLabelAccumulator, getRegionName, hasLayerListener, registerCommandHandler, registerCommandHandlers, registerEventHandler, registerPersistable, removeLayerListener, setConfigLabelAccumulator, setLayerPainter, setRegionName, toString, unregisterCommandHandler, unregisterEventHandler, unregisterPersistable |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.eclipse.nebula.widgets.nattable.persistence.IPersistable |
|---|
loadState, saveState |
| Field Detail |
|---|
public static final String DEFAULT_SUMMARY_ROW_LABEL
protected String summaryRowLabel
protected ILayer horizontalLayerDependency
GridLayer or the body layer stack in case of a simple
vertical composition.
| Constructor Detail |
|---|
public FixedSummaryRowLayer(IUniqueIndexLayer bodyDataLayer,
ILayer horizontalLayerDependency,
IConfigRegistry configRegistry)
FixedSummaryRowLayer that is horizontal
dependent to the given layer and calculates the summary values from the
given bodyDataLayer. It will register the default configurations and
perform smooth value updates.
Note:
The FixedSummaryRowLayer constructor is setting a
GridLineCellLayerPainter that is configured for clipTop to the
given bodyDataLayer. This is necessary as otherwise the body region would
paint over the summary row. In case you want to use a different
ILayerPainter ensure to set it AFTER creating the
FixedSummaryRowLayer.
bodyDataLayer - The underlying layer on which this layer should be build.
Typically the DataLayer of the body region.horizontalLayerDependency - The layer that is above this layer in the surrounding
composition. Typically a GridLayer.configRegistry - The ConfigRegistry for retrieving the ISummaryProvider per
column.
public FixedSummaryRowLayer(IUniqueIndexLayer bodyDataLayer,
ILayer horizontalLayerDependency,
IConfigRegistry configRegistry,
boolean autoConfigure)
FixedSummaryRowLayer that is horizontal
dependent to the given layer and calculates the summary values from the
given bodyDataLayer. It will perform smooth value updates.
Note:
The FixedSummaryRowLayer constructor is setting a
GridLineCellLayerPainter that is configured for clipTop to the
given bodyDataLayer. This is necessary as otherwise the body region would
paint over the summary row. In case you want to use a different
ILayerPainter ensure to set it AFTER creating the
FixedSummaryRowLayer.
bodyDataLayer - The underlying layer on which this layer should be build.
Typically the DataLayer of the body region.horizontalLayerDependency - The layer that is above this layer in the surrounding
composition. Typically a GridLayer.configRegistry - The ConfigRegistry for retrieving the ISummaryProvider per
column.autoConfigure - true to use the DefaultSummaryRowConfiguration,
false if a custom configuration will be set after
the creation.
public FixedSummaryRowLayer(IUniqueIndexLayer bodyDataLayer,
ILayer horizontalLayerDependency,
IConfigRegistry configRegistry,
boolean smoothUpdates,
boolean autoConfigure)
FixedSummaryRowLayer that is horizontal
dependent to the given layer and calculates the summary values from the
given bodyDataLayer.
Note:
The FixedSummaryRowLayer constructor is setting a
GridLineCellLayerPainter that is configured for clipTop to the
given bodyDataLayer. This is necessary as otherwise the body region would
paint over the summary row. In case you want to use a different
ILayerPainter ensure to set it AFTER creating the
FixedSummaryRowLayer.
bodyDataLayer - The underlying layer on which this layer should be build.
Typically the DataLayer of the body region.
Note: When using a different layer than the DataLayer, e.g. the GlazedListsEventLayer to receive automatic updates, you need to ensure that the GridLineCellLayerPainter configured for clipping on top is set to the DataLayer for correct rendering of the fixed summary row.
horizontalLayerDependency - The layer that is above this layer in the surrounding
composition. Typically a GridLayer.configRegistry - The ConfigRegistry for retrieving the ISummaryProvider per
column.smoothUpdates - true if the summary value updates should be
performed smoothly, false if on re-calculation
the value should be immediately shown as not calculated.autoConfigure - true to use the DefaultSummaryRowConfiguration,
false if a custom configuration will be set after
the creation.| Method Detail |
|---|
public Object getDataValueByPosition(int columnPosition,
int rowPosition)
SummaryRowLayerISummaryProvider
from the IConfigRegistry. In order to prevent the table from
freezing (for large data sets), the summary is calculated in a separate
Thread. While summary is being calculated
ISummaryProvider.DEFAULT_SUMMARY_VALUE is returned.
NOTE: Since this is a IUniqueIndexLayer sitting close to the
DataLayer, columnPosition == columnIndex
getDataValueByPosition in interface ILayergetDataValueByPosition in class SummaryRowLayerprotected boolean isBodyColumn(int columnPosition)
columnPosition - The column position that should be checked.
true if the column at the given position is a column
of the body, false if it is a column of another
region, e.g. the row header in a grid.public boolean hasHorizontalCompositeDependency()
true if the horizontal dependency is itself a
composite that has an additional column, e.g. a GridLayer
with a row header. false if the horizontal
dependency is not a composite, e.g. the body layer stack.public void setHorizontalCompositeDependency(boolean compositeDependency)
CompositeLayer that
adds additional columns.
compositeDependency - true to specify that the horizontal dependency is
itself a composite that has an additional column, e.g. a
GridLayer with a row header. false if the
horizontal dependency is not a composite, e.g. the body layer
stack.public String getSummaryRowLabel()
public void setSummaryRowLabel(String summaryRowLabel)
summaryRowLabel - The label that should be used as data value for the horizontal
dependent cell to the row header column.
protected LabelStack getConfigLabelsByPositionWithoutTransformation(int columnPosition,
int rowPosition)
getConfigLabelsByPositionWithoutTransformation in class SummaryRowLayercolumnPosition - The column position of the cell for which the config labels
are requested. If transformations are necessary, this value
should be already transformed.rowPosition - The row position of the cell for which the config labels are
requested. If transformations are necessary, this value should
be already transformed.
LabelStack for the cell at the given coordinates.
public LabelStack getConfigLabelsByPosition(int columnPosition,
int rowPosition)
getConfigLabelsByPosition in interface ILayergetConfigLabelsByPosition in class SummaryRowLayerpublic int getColumnCount()
getColumnCount in interface ILayergetColumnCount in class AbstractLayerTransformpublic int getPreferredColumnCount()
getPreferredColumnCount in interface ILayergetPreferredColumnCount in class AbstractLayerTransformpublic int getColumnIndexByPosition(int columnPosition)
ILayer
getColumnIndexByPosition in interface ILayergetColumnIndexByPosition in class AbstractLayerTransformcolumnPosition - a column position relative to this coordinate model
public int localToUnderlyingColumnPosition(int localColumnPosition)
ILayer
localToUnderlyingColumnPosition in interface ILayerlocalToUnderlyingColumnPosition in class AbstractLayerTransformlocalColumnPosition - column position in local (the layer's own) coordinates
public int underlyingToLocalColumnPosition(ILayer sourceUnderlyingLayer,
int underlyingColumnPosition)
underlyingToLocalColumnPosition in interface ILayerunderlyingToLocalColumnPosition in class AbstractLayerTransform
public Collection<Range> underlyingToLocalColumnPositions(ILayer sourceUnderlyingLayer,
Collection<Range> underlyingColumnPositionRanges)
underlyingToLocalColumnPositions in interface ILayerunderlyingToLocalColumnPositions in class AbstractLayerTransformpublic int getWidth()
ILayer
getWidth in interface ILayergetWidth in class AbstractLayerTransformpublic int getPreferredWidth()
getPreferredWidth in interface ILayergetPreferredWidth in class AbstractLayerTransformpublic int getColumnWidthByPosition(int columnPosition)
ILayer
getColumnWidthByPosition in interface ILayergetColumnWidthByPosition in class AbstractLayerTransformcolumnPosition - the column position in this layer
public boolean isColumnPositionResizable(int columnPosition)
isColumnPositionResizable in interface ILayerisColumnPositionResizable in class AbstractLayerTransformpublic int getColumnPositionByX(int x)
ILayer
getColumnPositionByX in interface ILayergetColumnPositionByX in class AbstractLayerTransformx - a horizontal pixel location relative to the pixel boundary of
this layer
public int getStartXOfColumnPosition(int columnPosition)
ILayer
getStartXOfColumnPosition in interface ILayergetStartXOfColumnPosition in class AbstractLayerTransformcolumnPosition - the column position in this layer
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||