public class IlvSwingTableDataSource extends IlvAbstractTableDataSource
TableModel
.Modifier and Type | Class and Description |
---|---|
static class |
IlvSwingTableDataSource.Mapping
Deprecated.
Please use the superclass instead.
|
Modifier and Type | Field and Description |
---|---|
static int |
COLUMN_SERIES
The type of the table model when series are ordered by column.
|
static int |
ROW_SERIES
The type of the table model when series are ordered by rows.
|
Constructor and Description |
---|
IlvSwingTableDataSource()
Creates a new
IlvSwingTableDataSource . |
IlvSwingTableDataSource(TableModel tableModel)
Creates a new
IlvSwingTableDataSource associated to
the given TableModel with the series ordered by column
and uses no specific serie for x values. |
IlvSwingTableDataSource(TableModel tableModel,
int type)
Creates a new
IlvSwingTableDataSource associated to
the given TableModel with the series ordered according to
the specified type and uses no specific serie for x values. |
IlvSwingTableDataSource(TableModel tableModel,
int type,
IlvAbstractTableDataSource.Mapping[] mapping)
Creates a new
IlvSwingTableDataSource associated with
the given TableModel with the series ordered according to
the specified type and initialized with the specified mapping. |
IlvSwingTableDataSource(TableModel tableModel,
int type,
int xSeries,
int dataLabels)
Creates a new
IlvSwingTableDataSource associated to
the given TableModel with the series ordered according to
the specified type and using the given series for x values. |
Modifier and Type | Method and Description |
---|---|
String |
formatDataLabel(String value)
Returns the data label to be used for a table cell value.
|
IlvDataConverter |
getDataConverter(Class<?> dataClass)
Returns the converter of the given data class.
|
IlvDataConverter |
getDataConverter(int column)
Returns the data converter for the given column.
|
int |
getDataLabelsIndex()
Returns the data labels index.
|
static IlvDataConverter |
getDefaultConverter(Class<?> dataClass)
Returns the default converter of the given data class.
|
Locale |
getLocale()
Returns the locale that is used by the converter for objects
of type
String . |
IlvAbstractTableDataSource.Mapping[] |
getMapping()
Returns the contents of this data source according to the specified
mapping.
|
int |
getSeriesType()
Returns the type of the series.
|
TableModel |
getTableModel()
Returns the table model associated to this data source.
|
com.ibm.icu.util.ULocale |
getULocale()
Returns the locale that is used by the converter for objects
of type
String . |
Double |
getUndefValue()
Returns the undefined value for the data sets of this
data source.
|
int |
getXSeriesIndex()
Returns the xseries index.
|
boolean |
isTimeSeries(int index)
Returns whether the specified column or row (depending on the type
of this data source) represents a time series.
|
void |
setDataConverter(int column,
IlvDataConverter conv)
Sets the data converter for the given column.
|
void |
setDataLabelsIndex(int index)
Sets the data labels index.
|
void |
setDataSets(IlvDataSet[] dataSets)
Initializes this data source with the specified data sets.
|
static void |
setDefaultConverter(Class<?> dataClass,
IlvDataConverter converter)
Sets the default converter of a data class.
|
void |
setLocale(Locale locale)
Sets the locale.
|
void |
setMapping(IlvAbstractTableDataSource.Mapping[] mapping)
Initializes the contents of this data source according to the specified
mapping.
|
void |
setSeriesType(int type)
Sets the type of the series.
|
void |
setTableModel(TableModel tableModel)
Sets the table model associated to this data source.
|
void |
setULocale(com.ibm.icu.util.ULocale locale)
Sets the locale.
|
void |
setUndefValue(Double undefValue)
Specifies the undefined value for the data sets of this
data source.
|
void |
setXSeriesIndex(int index)
Sets the xseries column index.
|
void |
tableChanged(TableModelEvent event)
Handles changes that occur on the table model.
|
addDataSet, addDataSet, addDataSourceListener, containsDataSet, endBatch, fireDataSourceEvent, getDataSet, getDataSetByName, getDataSetCount, getDataSetIndex, getDataSetIterator, getDataSetList, getDataSets, initDataSets, removeDataSourceListener, setDataSet, startBatch
public static final int COLUMN_SERIES
public static final int ROW_SERIES
public IlvSwingTableDataSource()
IlvSwingTableDataSource
.public IlvSwingTableDataSource(TableModel tableModel)
IlvSwingTableDataSource
associated to
the given TableModel
with the series ordered by column
and uses no specific serie for x values.tableModel
- The TableModel
to attach.public IlvSwingTableDataSource(TableModel tableModel, int type)
IlvSwingTableDataSource
associated to
the given TableModel
with the series ordered according to
the specified type and uses no specific serie for x values.tableModel
- The TableModel
to attach.type
- The type of the series.COLUMN_SERIES
,
ROW_SERIES
public IlvSwingTableDataSource(TableModel tableModel, int type, int xSeries, int dataLabels)
IlvSwingTableDataSource
associated to
the given TableModel
with the series ordered according to
the specified type and using the given series for x values.tableModel
- The TableModel
to attach.type
- The type of the series.xSeries
- The column index of the x series. A value of -1 means that no
specific x series is used.dataLabels
- The column index of the data labels. A value of -1 means
that no labels are available.COLUMN_SERIES
,
ROW_SERIES
public IlvSwingTableDataSource(TableModel tableModel, int type, IlvAbstractTableDataSource.Mapping[] mapping)
IlvSwingTableDataSource
associated with
the given TableModel
with the series ordered according to
the specified type and initialized with the specified mapping.public final int getXSeriesIndex()
setXSeriesIndex(int)
public void setXSeriesIndex(int index)
index
- The xseries column or row index depending on the series
type. A value equals to -1 means that no specific xseries should be used.public final int getDataLabelsIndex()
setDataLabelsIndex(int)
public void setDataLabelsIndex(int index)
index
- The data labels column or row index depending on the series
type. A value of -1 means that no data labels are available.public final int getSeriesType()
COLUMN_SERIES
,
ROW_SERIES
public void setSeriesType(int type)
COLUMN_SERIES
,
ROW_SERIES
public final TableModel getTableModel()
public void setTableModel(TableModel tableModel)
public void setMapping(IlvAbstractTableDataSource.Mapping[] mapping)
public IlvAbstractTableDataSource.Mapping[] getMapping()
null
if no mapping has been defined.public void tableChanged(TableModelEvent event)
public void setUndefValue(Double undefValue)
IlvDataSet.getUndefValue()
public final Double getUndefValue()
setUndefValue(java.lang.Double)
method.public static void setDefaultConverter(Class<?> dataClass, IlvDataConverter converter)
IlvSwingTableDataSource
makes use of data converter to
convert the objects contained in the TableModel
to their corresponding
double value. The data source, through its data set, asks the tableModel
for
the object type (using getColumnClass()
), and then tries to find a converter
able to handle the object.
By default, the IlvSwingTableDataSource
registers converters
for the following types: Date
, String
,
Short
, Integer
, Long
,
Float
and Double
.
Note that the converter for String
set through this method
has no effect: an IlvStringConverter
is used instead that
depends on the locale.
If you need to handle other kind of objects, you might write a specific
IlvDataConverter
and register it on the data source.public static IlvDataConverter getDefaultConverter(Class<?> dataClass)
AbstractTableModel.getColumnClass()
method returns Object
by default,
this method converts Object
data using the associated Double
converter.
Hence, if your data model only contains Double
object, overriding
getColumnClass()
is not mandatory.
The method first tries to find the exact mapping of the specified class.
If none is found, then it iterates all over the registered data converter
and returns the first data converter that can convert the given class,
if any.null
if none is found.setDefaultConverter(java.lang.Class<?>, ilog.views.chart.data.IlvDataConverter)
,
getDataConverter(java.lang.Class<?>)
public void setULocale(com.ibm.icu.util.ULocale locale)
String
.locale
- A locale, or null
to designate locale
independent conversion.getULocale()
public com.ibm.icu.util.ULocale getULocale()
String
.null
to designate locale
independent conversion.setULocale(com.ibm.icu.util.ULocale)
public void setLocale(Locale locale)
String
.locale
- A locale, or null
to designate locale
independent conversion.getLocale()
public Locale getLocale()
String
.null
to designate locale
independent conversion.setLocale(java.util.Locale)
public IlvDataConverter getDataConverter(Class<?> dataClass)
getDefaultConverter
, except for class String
.
For String
, an IlvStringConverter
depending
on this model locale is used.getLocale()
public boolean isTimeSeries(int index)
ROW_SERIES
and
COLUMN_SERIES
data source:
COLUMN_SERIES
, it returns true
if
the class returned by getTableModel().getColumnClass(idx)
is
an instance of java.util.Date
. It returns false
otherwise.ROW_SERIES
, it returns true
if
the class returned by getTableModel().getColumnClass(0)
is
an instance of java.util.Date
. It returns false
otherwise (that is, it tests only the type of the first column of the model.index
- The index of the column or rows.public IlvDataConverter getDataConverter(int column)
public void setDataConverter(int column, IlvDataConverter conv)
getDataConverter(java.lang.Class<?>)
public void setDataSets(IlvDataSet[] dataSets)
setDataSets
in interface IlvDataSource
setDataSets
in class IlvAbstractDataSource
dataSets
- The new data sets. If this parameter is null
,
all the data sets provided by this data source should be removed.© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.