public class SummaryRowLayer extends AbstractLayerTransform implements IUniqueIndexLayer
ISummaryProvider
to calculate the summaries for all columns.
This layer also adds the following labels:
DEFAULT_SUMMARY_COLUMN_CONFIG_LABEL_PREFIX
+ column indexDEFAULT_SUMMARY_ROW_CONFIG_LABEL
to all cells in the rowISummaryProvider
can be hooked up to these labels.DefaultSummaryRowConfiguration
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_SUMMARY_COLUMN_CONFIG_LABEL_PREFIX |
static String |
DEFAULT_SUMMARY_ROW_CONFIG_LABEL |
protected Map<Integer,Object> |
summaryCache
Cache the calculated summary value, since its CPU intensive
|
protected Map<Integer,Object> |
summaryCacheIncludingStaleValues
Use a cache-copy which does not get cleared, as using an Entry type object with stale flag per instance
would require traversal of full set of entries in
clearSummaryCache() |
underlyingLayer
layerPainter
DOT, VALUE_SEPARATOR
Constructor and Description |
---|
SummaryRowLayer(IUniqueIndexLayer underlyingDataLayer,
IConfigRegistry configRegistry) |
SummaryRowLayer(IUniqueIndexLayer underlyingDataLayer,
IConfigRegistry configRegistry,
boolean autoConfigure) |
Modifier and Type | Method and Description |
---|---|
protected boolean |
addToCache(Integer columnIndex,
Object summaryValue) |
protected void |
clearSummaryCache() |
boolean |
doCommand(ILayerCommand command)
Opportunity to respond to a command as it flows down the stack.
|
ILayerCell |
getCellByPosition(int columnPosition,
int rowPosition) |
int |
getColumnPositionByIndex(int columnIndex) |
LabelStack |
getConfigLabelsByPosition(int columnPosition,
int rowPosition) |
Object |
getDataValueByPosition(int columnPosition,
int rowPosition)
Calculates the summary for the column using the
ISummaryProvider from the IConfigRegistry . |
int |
getHeight()
Returns the total height in pixels of this layer.
|
Object |
getPotentiallyStaleSummaryFromCache(Integer columnIndex) |
int |
getPreferredHeight() |
int |
getPreferredRowCount() |
int |
getRowCount() |
int |
getRowHeightByPosition(int rowPosition)
Returns the height in pixels of the given row.
|
int |
getRowIndexByPosition(int rowPosition)
Gets the underlying non-transformed row index for the given row position.
|
int |
getRowPositionByIndex(int rowIndex) |
int |
getRowPositionByY(int y)
Returns the row position that contains the given y coordinate.
|
Object |
getSummaryFromCache(Integer columnIndex) |
void |
handleLayerEvent(ILayerEvent event)
Handle layer event notification.
|
boolean |
hasNonStaleSummaryFor(Integer columnIndex) |
configure, dispose, getCellPainter, getColumnCount, getColumnIndexByPosition, getColumnPositionByX, getColumnWidthByPosition, getDisplayModeByPosition, getLayerPainter, getPreferredColumnCount, getPreferredWidth, getRegionLabelsByXY, getStartXOfColumnPosition, getStartYOfRowPosition, getUnderlyingLayer, getUnderlyingLayerByPosition, getUnderlyingLayersByColumnPosition, getUnderlyingLayersByRowPosition, getWidth, isColumnPositionResizable, isRowPositionResizable, loadState, localToUnderlyingColumnPosition, localToUnderlyingRowPosition, saveState, setClientAreaProvider, setUnderlyingLayer, underlyingToLocalColumnPosition, underlyingToLocalColumnPositions, underlyingToLocalRowPosition, underlyingToLocalRowPositions
addConfiguration, addLayerListener, clearConfiguration, fireLayerEvent, getBoundsByPosition, getClientAreaProvider, getConfigLabelAccumulator, getRegionName, hasLayerListener, registerCommandHandler, registerCommandHandlers, registerEventHandler, registerPersistable, removeLayerListener, setConfigLabelAccumulator, setLayerPainter, setRegionName, toString, unregisterCommandHandler, unregisterPersistable
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addLayerListener, configure, dispose, fireLayerEvent, getBoundsByPosition, getCellPainter, getClientAreaProvider, getColumnCount, getColumnIndexByPosition, getColumnPositionByX, getColumnWidthByPosition, getDisplayModeByPosition, getLayerPainter, getPreferredColumnCount, getPreferredWidth, getRegionLabelsByXY, getStartXOfColumnPosition, getStartYOfRowPosition, getUnderlyingLayerByPosition, getUnderlyingLayersByColumnPosition, getUnderlyingLayersByRowPosition, getWidth, hasLayerListener, isColumnPositionResizable, isRowPositionResizable, localToUnderlyingColumnPosition, localToUnderlyingRowPosition, registerCommandHandler, registerPersistable, removeLayerListener, setClientAreaProvider, underlyingToLocalColumnPosition, underlyingToLocalColumnPositions, underlyingToLocalRowPosition, underlyingToLocalRowPositions, unregisterCommandHandler, unregisterPersistable
loadState, saveState
public static final String DEFAULT_SUMMARY_ROW_CONFIG_LABEL
public static final String DEFAULT_SUMMARY_COLUMN_CONFIG_LABEL_PREFIX
protected Map<Integer,Object> summaryCache
public SummaryRowLayer(IUniqueIndexLayer underlyingDataLayer, IConfigRegistry configRegistry)
public SummaryRowLayer(IUniqueIndexLayer underlyingDataLayer, IConfigRegistry configRegistry, boolean autoConfigure)
public Object getDataValueByPosition(int columnPosition, int rowPosition)
ISummaryProvider
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 ILayer
getDataValueByPosition
in class AbstractLayerTransform
public Object getPotentiallyStaleSummaryFromCache(Integer columnIndex)
public boolean hasNonStaleSummaryFor(Integer columnIndex)
protected void clearSummaryCache()
public boolean doCommand(ILayerCommand command)
ILayer
ILayerCommand.convertToTargetLayer(ILayer)
doCommand
in interface ILayer
doCommand
in class AbstractLayerTransform
command
- the command to performpublic void handleLayerEvent(ILayerEvent event)
AbstractLayer
super.fireLayerEvent(event)
- unless you plan to eat the event yourself.handleLayerEvent
in interface ILayerListener
handleLayerEvent
in class AbstractLayer
event
- the eventpublic LabelStack getConfigLabelsByPosition(int columnPosition, int rowPosition)
getConfigLabelsByPosition
in interface ILayer
getConfigLabelsByPosition
in class AbstractLayerTransform
public ILayerCell getCellByPosition(int columnPosition, int rowPosition)
getCellByPosition
in interface ILayer
getCellByPosition
in class AbstractLayerTransform
public int getHeight()
ILayer
getHeight
in interface ILayer
getHeight
in class AbstractLayerTransform
public int getPreferredHeight()
getPreferredHeight
in interface ILayer
getPreferredHeight
in class AbstractLayerTransform
public int getRowCount()
getRowCount
in interface ILayer
getRowCount
in class AbstractLayerTransform
public int getPreferredRowCount()
getPreferredRowCount
in interface ILayer
getPreferredRowCount
in class AbstractLayerTransform
public int getRowIndexByPosition(int rowPosition)
ILayer
getRowIndexByPosition
in interface ILayer
getRowIndexByPosition
in class AbstractLayerTransform
rowPosition
- a row position relative to this coordinate modelpublic int getRowPositionByY(int y)
ILayer
getRowPositionByY
in interface ILayer
getRowPositionByY
in class AbstractLayerTransform
y
- a vertical pixel location relative to the pixel boundary of this layerpublic int getRowHeightByPosition(int rowPosition)
ILayer
getRowHeightByPosition
in interface ILayer
getRowHeightByPosition
in class AbstractLayerTransform
rowPosition
- the row position in this layerpublic int getRowPositionByIndex(int rowIndex)
getRowPositionByIndex
in interface IUniqueIndexLayer
public int getColumnPositionByIndex(int columnIndex)
getColumnPositionByIndex
in interface IUniqueIndexLayer
Copyright © 2013. All Rights Reserved.