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  | 
layerPainterDOT, 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, unregisterPersistableclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaddLayerListener, configure, dispose, fireLayerEvent, getBoundsByPosition, getCellByPosition, getCellPainter, getClientAreaProvider, getConfigLabelsByPosition, getDisplayModeByPosition, getLayerPainter, getRegionLabelsByXY, hasLayerListener, registerCommandHandler, registerPersistable, removeLayerListener, setClientAreaProvider, unregisterCommandHandler, unregisterPersistablehandleLayerEventpublic 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)
IPersistablesaveState in interface IPersistablesaveState in class AbstractLayerprefix - 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)
IPersistableloadState in interface IPersistableloadState in class AbstractLayerprefix - 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()
AbstractLayerregisterCommandHandlers in class AbstractLayerpublic IDataProvider getDataProvider()
protected void setDataProvider(IDataProvider dataProvider)
public int getColumnCount()
getColumnCount in interface ILayerpublic int getPreferredColumnCount()
getPreferredColumnCount in interface ILayerpublic int getColumnIndexByPosition(int columnPosition)
getColumnIndexByPosition in interface ILayercolumnPosition - a column position relative to this coordinate modelpublic int getColumnPositionByIndex(int columnIndex)
getColumnPositionByIndex in interface IUniqueIndexLayerpublic int localToUnderlyingColumnPosition(int localColumnPosition)
ILayerlocalToUnderlyingColumnPosition in interface ILayerlocalColumnPosition - column position in local (the layer's own) coordinatespublic int underlyingToLocalColumnPosition(ILayer sourceUnderlyingLayer, int underlyingColumnPosition)
underlyingToLocalColumnPosition in interface ILayerpublic Collection<Range> underlyingToLocalColumnPositions(ILayer sourceUnderlyingLayer, Collection<Range> underlyingColumnPositionRanges)
underlyingToLocalColumnPositions in interface ILayerpublic int getWidth()
ILayerpublic int getPreferredWidth()
getPreferredWidth in interface ILayerpublic int getColumnWidthByPosition(int columnPosition)
ILayergetColumnWidthByPosition in interface ILayercolumnPosition - 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 ILayerpublic void setColumnPositionResizable(int columnPosition,
                              boolean resizable)
public void setColumnsResizableByDefault(boolean resizableByDefault)
public Collection<ILayer> getUnderlyingLayersByColumnPosition(int columnPosition)
getUnderlyingLayersByColumnPosition in interface ILayerpublic int getRowCount()
getRowCount in interface ILayerpublic int getPreferredRowCount()
getPreferredRowCount in interface ILayerpublic int getRowIndexByPosition(int rowPosition)
getRowIndexByPosition in interface ILayerrowPosition - a row position relative to this coordinate modelpublic int getRowPositionByIndex(int rowIndex)
getRowPositionByIndex in interface IUniqueIndexLayerpublic int localToUnderlyingRowPosition(int localRowPosition)
localToUnderlyingRowPosition in interface ILayerpublic int underlyingToLocalRowPosition(ILayer sourceUnderlyingLayer, int underlyingRowPosition)
underlyingToLocalRowPosition in interface ILayerpublic Collection<Range> underlyingToLocalRowPositions(ILayer sourceUnderlyingLayer, Collection<Range> underlyingRowPositionRanges)
underlyingToLocalRowPositions in interface ILayerpublic int getHeight()
ILayerpublic int getPreferredHeight()
getPreferredHeight in interface ILayerpublic int getRowHeightByPosition(int rowPosition)
ILayergetRowHeightByPosition in interface ILayerrowPosition - 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 ILayerpublic void setRowPositionResizable(int rowPosition,
                           boolean resizable)
public void setRowsResizableByDefault(boolean resizableByDefault)
public Collection<ILayer> getUnderlyingLayersByRowPosition(int rowPosition)
getUnderlyingLayersByRowPosition in interface ILayerpublic Object getDataValueByPosition(int columnPosition, int rowPosition)
getDataValueByPosition in interface ILayerpublic int getColumnPositionByX(int x)
ILayergetColumnPositionByX in interface ILayerx - a horizontal pixel location relative to the pixel boundary of this layerpublic int getRowPositionByY(int y)
ILayergetRowPositionByY in interface ILayery - a vertical pixel location relative to the pixel boundary of this layerpublic int getStartXOfColumnPosition(int columnPosition)
ILayergetStartXOfColumnPosition in interface ILayercolumnPosition - the column position in this layerpublic int getStartYOfRowPosition(int rowPosition)
ILayergetStartYOfRowPosition in interface ILayerrowPosition - the row position in this layerpublic ILayer getUnderlyingLayerByPosition(int columnPosition, int rowPosition)
getUnderlyingLayerByPosition in interface ILayerpublic boolean doCommand(ILayerCommand command)
ILayerILayerCommand.convertToTargetLayer(ILayer)doCommand in interface ILayerdoCommand in class AbstractLayercommand - 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.