public class DataLayer extends AbstractLayer implements IUniqueIndexLayer
IDataProvider
, and serves as the data source for all
other layers. Also, tracks the size of the columns and the rows using
SizeConfig
objects. Since this layer sits directly on top of the
data source, at this layer index == position.Modifier and Type | Field and Description |
---|---|
protected IDataProvider |
dataProvider |
static int |
DEFAULT_COLUMN_WIDTH |
static int |
DEFAULT_ROW_HEIGHT |
static String |
PERSISTENCE_KEY_COLUMN_WIDTH |
static String |
PERSISTENCE_KEY_ROW_HEIGHT |
layerPainter
DOT, VALUE_SEPARATOR
Modifier | Constructor and Description |
---|---|
protected |
DataLayer() |
|
DataLayer(IDataProvider dataProvider) |
|
DataLayer(IDataProvider dataProvider,
int defaultColumnWidth,
int defaultRowHeight) |
protected |
DataLayer(int defaultColumnWidth,
int defaultRowHeight) |
Modifier and Type | Method and Description |
---|---|
boolean |
doCommand(ILayerCommand command)
Opportunity to respond to a command as it flows down the stack.
|
int |
getColumnCount() |
int |
getColumnIndexByPosition(int columnPosition)
This is the root coordinate system, so the column index is always equal to the column position.
|
int |
getColumnPositionByIndex(int columnIndex)
This is the root coordinate system, so the column position is always equal to the column index.
|
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.
|
IDataProvider |
getDataProvider() |
Object |
getDataValueByPosition(int columnPosition,
int rowPosition) |
int |
getHeight()
Returns the total height in pixels of this layer.
|
int |
getPreferredColumnCount() |
int |
getPreferredHeight() |
int |
getPreferredRowCount() |
int |
getPreferredWidth() |
int |
getRowCount() |
int |
getRowHeightByPosition(int rowPosition)
Returns the height in pixels of the given row.
|
int |
getRowIndexByPosition(int rowPosition)
This is the root coordinate system, so the row index is always equal to the row position.
|
int |
getRowPositionByIndex(int rowIndex)
This is the root coordinate system, so the row position is always equal to the row index.
|
int |
getRowPositionByY(int y)
Returns the row position that contains the given y coordinate.
|
int |
getStartXOfColumnPosition(int columnPosition)
Returns the x offset in pixels of the given column.
|
int |
getStartYOfRowPosition(int rowPosition)
Returns the y offset in pixels of the given row.
|
ILayer |
getUnderlyingLayerByPosition(int columnPosition,
int rowPosition) |
Collection<ILayer> |
getUnderlyingLayersByColumnPosition(int columnPosition) |
Collection<ILayer> |
getUnderlyingLayersByRowPosition(int rowPosition) |
int |
getWidth()
Returns the total width in pixels of this layer.
|
boolean |
isColumnPercentageSizing() |
boolean |
isColumnPositionResizable(int columnPosition) |
boolean |
isRowPercentageSizing() |
boolean |
isRowPositionResizable(int rowPosition) |
void |
loadState(String prefix,
Properties properties)
Restore the state out of the given Properties identified by the specified prefix.
|
int |
localToUnderlyingColumnPosition(int localColumnPosition)
Convert a column position to the coordinates of the underlying layer.
|
int |
localToUnderlyingRowPosition(int localRowPosition) |
protected void |
registerCommandHandlers()
Layers should use this method to register their command handlers
and call it from their constructor.
|
void |
saveState(String prefix,
Properties properties)
Saves the state to the given Properties using the specified prefix.
|
void |
setColumnPercentageSizing(boolean percentageSizing)
Configures how the column sizing of this
DataLayer is handled. |
void |
setColumnPositionResizable(int columnPosition,
boolean resizable) |
void |
setColumnsResizableByDefault(boolean resizableByDefault) |
void |
setColumnWidthByPosition(int columnPosition,
int width) |
void |
setColumnWidthPercentageByPosition(int columnPosition,
int width) |
protected void |
setDataProvider(IDataProvider dataProvider) |
void |
setDefaultColumnWidth(int width) |
void |
setDefaultColumnWidthByPosition(int columnPosition,
int width) |
void |
setDefaultRowHeight(int height) |
void |
setDefaultRowHeightByPosition(int rowPosition,
int height) |
void |
setRowHeightByPosition(int rowPosition,
int height) |
void |
setRowHeightPercentageByPosition(int rowPosition,
int height) |
void |
setRowPercentageSizing(boolean percentageSizing)
Configures how the row sizing of this
DataLayer is handled. |
void |
setRowPositionResizable(int rowPosition,
boolean resizable) |
void |
setRowsResizableByDefault(boolean resizableByDefault) |
int |
underlyingToLocalColumnPosition(ILayer sourceUnderlyingLayer,
int underlyingColumnPosition) |
Collection<Range> |
underlyingToLocalColumnPositions(ILayer sourceUnderlyingLayer,
Collection<Range> underlyingColumnPositionRanges) |
int |
underlyingToLocalRowPosition(ILayer sourceUnderlyingLayer,
int underlyingRowPosition) |
Collection<Range> |
underlyingToLocalRowPositions(ILayer sourceUnderlyingLayer,
Collection<Range> underlyingRowPositionRanges) |
addConfiguration, addLayerListener, clearConfiguration, configure, dispose, fireLayerEvent, getBoundsByPosition, getCellByPosition, getCellPainter, getClientAreaProvider, getConfigLabelAccumulator, getConfigLabelsByPosition, getDisplayModeByPosition, getLayerPainter, getRegionLabelsByXY, getRegionName, handleLayerEvent, hasLayerListener, registerCommandHandler, registerEventHandler, registerPersistable, removeLayerListener, setClientAreaProvider, setConfigLabelAccumulator, setLayerPainter, setRegionName, toString, unregisterCommandHandler, unregisterPersistable
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addLayerListener, configure, dispose, fireLayerEvent, getBoundsByPosition, getCellByPosition, getCellPainter, getClientAreaProvider, getConfigLabelsByPosition, getDisplayModeByPosition, getLayerPainter, getRegionLabelsByXY, hasLayerListener, registerCommandHandler, registerPersistable, removeLayerListener, setClientAreaProvider, unregisterCommandHandler, unregisterPersistable
handleLayerEvent
public static final String PERSISTENCE_KEY_ROW_HEIGHT
public static final String PERSISTENCE_KEY_COLUMN_WIDTH
public static final int DEFAULT_COLUMN_WIDTH
public static final int DEFAULT_ROW_HEIGHT
protected IDataProvider dataProvider
public DataLayer(IDataProvider dataProvider)
public DataLayer(IDataProvider dataProvider, int defaultColumnWidth, int defaultRowHeight)
protected DataLayer()
protected DataLayer(int defaultColumnWidth, int defaultRowHeight)
public void saveState(String prefix, Properties properties)
IPersistable
saveState
in interface IPersistable
saveState
in class AbstractLayer
prefix
- The prefix to use for the state keys. Is also used as the state
configuration name.properties
- The Properties instance to save the state to.public void loadState(String prefix, Properties properties)
IPersistable
loadState
in interface IPersistable
loadState
in class AbstractLayer
prefix
- The prefix to use for the state keys. Is also used as the state
configuration name.properties
- The Properties instance to load the state from.protected void registerCommandHandlers()
AbstractLayer
registerCommandHandlers
in class AbstractLayer
public IDataProvider getDataProvider()
protected void setDataProvider(IDataProvider dataProvider)
public int getColumnCount()
getColumnCount
in interface ILayer
public int getPreferredColumnCount()
getPreferredColumnCount
in interface ILayer
public int getColumnIndexByPosition(int columnPosition)
getColumnIndexByPosition
in interface ILayer
columnPosition
- a column position relative to this coordinate modelpublic int getColumnPositionByIndex(int columnIndex)
getColumnPositionByIndex
in interface IUniqueIndexLayer
public int localToUnderlyingColumnPosition(int localColumnPosition)
ILayer
localToUnderlyingColumnPosition
in interface ILayer
localColumnPosition
- column position in local (the layer's own) coordinatespublic int underlyingToLocalColumnPosition(ILayer sourceUnderlyingLayer, int underlyingColumnPosition)
underlyingToLocalColumnPosition
in interface ILayer
public Collection<Range> underlyingToLocalColumnPositions(ILayer sourceUnderlyingLayer, Collection<Range> underlyingColumnPositionRanges)
underlyingToLocalColumnPositions
in interface ILayer
public int getWidth()
ILayer
public int getPreferredWidth()
getPreferredWidth
in interface ILayer
public int getColumnWidthByPosition(int columnPosition)
ILayer
getColumnWidthByPosition
in interface ILayer
columnPosition
- the column position in this layerpublic void setColumnWidthByPosition(int columnPosition, int width)
public void setColumnWidthPercentageByPosition(int columnPosition, int width)
public void setDefaultColumnWidth(int width)
public void setDefaultColumnWidthByPosition(int columnPosition, int width)
public boolean isColumnPositionResizable(int columnPosition)
isColumnPositionResizable
in interface ILayer
public void setColumnPositionResizable(int columnPosition, boolean resizable)
public void setColumnsResizableByDefault(boolean resizableByDefault)
public Collection<ILayer> getUnderlyingLayersByColumnPosition(int columnPosition)
getUnderlyingLayersByColumnPosition
in interface ILayer
public int getRowCount()
getRowCount
in interface ILayer
public int getPreferredRowCount()
getPreferredRowCount
in interface ILayer
public int getRowIndexByPosition(int rowPosition)
getRowIndexByPosition
in interface ILayer
rowPosition
- a row position relative to this coordinate modelpublic int getRowPositionByIndex(int rowIndex)
getRowPositionByIndex
in interface IUniqueIndexLayer
public int localToUnderlyingRowPosition(int localRowPosition)
localToUnderlyingRowPosition
in interface ILayer
public int underlyingToLocalRowPosition(ILayer sourceUnderlyingLayer, int underlyingRowPosition)
underlyingToLocalRowPosition
in interface ILayer
public Collection<Range> underlyingToLocalRowPositions(ILayer sourceUnderlyingLayer, Collection<Range> underlyingRowPositionRanges)
underlyingToLocalRowPositions
in interface ILayer
public int getHeight()
ILayer
public int getPreferredHeight()
getPreferredHeight
in interface ILayer
public int getRowHeightByPosition(int rowPosition)
ILayer
getRowHeightByPosition
in interface ILayer
rowPosition
- the row position in this layerpublic void setRowHeightByPosition(int rowPosition, int height)
public void setRowHeightPercentageByPosition(int rowPosition, int height)
public void setDefaultRowHeight(int height)
public void setDefaultRowHeightByPosition(int rowPosition, int height)
public boolean isRowPositionResizable(int rowPosition)
isRowPositionResizable
in interface ILayer
public void setRowPositionResizable(int rowPosition, boolean resizable)
public void setRowsResizableByDefault(boolean resizableByDefault)
public Collection<ILayer> getUnderlyingLayersByRowPosition(int rowPosition)
getUnderlyingLayersByRowPosition
in interface ILayer
public Object getDataValueByPosition(int columnPosition, int rowPosition)
getDataValueByPosition
in interface ILayer
public int getColumnPositionByX(int x)
ILayer
getColumnPositionByX
in interface ILayer
x
- a horizontal pixel location relative to the pixel boundary of this layerpublic int getRowPositionByY(int y)
ILayer
getRowPositionByY
in interface ILayer
y
- a vertical pixel location relative to the pixel boundary of this layerpublic int getStartXOfColumnPosition(int columnPosition)
ILayer
getStartXOfColumnPosition
in interface ILayer
columnPosition
- the column position in this layerpublic int getStartYOfRowPosition(int rowPosition)
ILayer
getStartYOfRowPosition
in interface ILayer
rowPosition
- the row position in this layerpublic ILayer getUnderlyingLayerByPosition(int columnPosition, int rowPosition)
getUnderlyingLayerByPosition
in interface ILayer
public boolean doCommand(ILayerCommand command)
ILayer
ILayerCommand.convertToTargetLayer(ILayer)
doCommand
in interface ILayer
doCommand
in class AbstractLayer
command
- the command to performpublic boolean isColumnPercentageSizing()
true
if the column sizing is done percentaged,
false
if the column sizing is done by pixel (default)public void setColumnPercentageSizing(boolean percentageSizing)
DataLayer
is handled.
Default is pixel sizing.
If percentage sizing should be used you have to ensure that the size value for every
column is set explicitly and that the sum of the column sizes doesn't exceed 100.percentageSizing
- true
if the column sizing should be done percentaged,
false
if the column sizing should be done by pixel (default)public boolean isRowPercentageSizing()
true
if the row sizing is done percentaged,
false
if the row sizing is done by pixel (default)public void setRowPercentageSizing(boolean percentageSizing)
DataLayer
is handled.
Default is pixel sizing.
If percentage sizing should be used you have to ensure that the size value for every
row is set explicitly and that the sum of the row sizes doesn't exceed 100.percentageSizing
- true
if the row sizing should be done percentaged,
false
if the row sizing should be done by pixel (default)Copyright © 2013. All Rights Reserved.