public final class TableTools extends Object
| Constructor and Description |
|---|
TableTools() |
| Modifier and Type | Method and Description |
|---|---|
static String |
convertToCSV(JTable table)
This method converts a JTable to the csv format
|
static String |
convertToCSV(TableModel tableModel)
This method converts a
TableModel to the csv format. |
static String |
convertToTabDelimited(JTable table)
This method converts a JTable to the tab delimited format.
|
static String |
convertToTabDelimited(TableModel tableModel)
This method converts a
TableModel to the tab delimited format. |
static TableModel |
convertToTableModel(String csvString)
This method converts a
TableModel to the tab delimited format. |
static TableModel |
convertToTableModel(TableModel tm)
This method converts a
TableModel to the
internal TableModel. |
static void |
displayTable(TableModel tableModel)
This method displays a table model in a separate
JFrame. |
static TableModel |
mergeBoxes(List<IqmDataBox> boxList)
This method merges several table models from
IqmDataBoxes to a
single model, if the identifier and number of columns match. |
static TableModel |
mergeTableModels(List<TableModel> modelList)
This method merges several table models to a single model, if the
identifier and number of columns match.
|
static TableModel |
removeAllRows(TableModel model)
Removes all rows of the table model.
|
static javax.media.jai.PlanarImage |
toPlanarImage(JTable table)
Creates an image out of a given
JTable. |
static javax.media.jai.PlanarImage |
toPlanarImage(TableModel model)
Creates an image out of a given
TableModel. |
public static javax.media.jai.PlanarImage toPlanarImage(JTable table)
JTable.table - the table to be renderedPlanarImage of type BufferedImage.TYPE_INT_RGB.CommonTools.createSnapshot(java.awt.Component)public static javax.media.jai.PlanarImage toPlanarImage(TableModel model)
TableModel.
The method temporarily wraps the TableModel into a JTable and returns the image of the table
model - the table model to be renderedPlanarImage of type BufferedImage.TYPE_INT_RGB.toPlanarImage(JTable)public static String convertToCSV(JTable table)
table - JTablepublic static String convertToCSV(TableModel tableModel)
TableModel to the csv format. The columns
in the exported data string are appended as they appear in the model.
If you wish to export a custom order, construct a JTable, order
the columns and use convertToCSV(JTable).
tableModel - the modelpublic static String convertToTabDelimited(JTable table)
table - JTablepublic static String convertToTabDelimited(TableModel tableModel)
TableModel to the tab delimited format.tableModel - the table model instance to be convertedpublic static TableModel convertToTableModel(String csvString) throws EmptyFileException
TableModel to the tab delimited format.csvString - the table model instance to be convertedTableModelEmptyFileExceptionpublic static void displayTable(TableModel tableModel)
JFrame.tableModel - public static TableModel convertToTableModel(TableModel tm)
TableModel to the
internal TableModel.tm - the JTables TableModelTableModelpublic static TableModel mergeBoxes(List<IqmDataBox> boxList)
IqmDataBoxes to a
single model, if the identifier and number of columns match.boxList - the list of data boxes containing the table modelsIllegalArgumentException - if the boxList is null or emptypublic static TableModel mergeTableModels(List<TableModel> modelList)
modelList - the list of data boxes containing the table modelsnull, if creating the new model
failsIllegalArgumentException - if the modelList is null or emptypublic static TableModel removeAllRows(TableModel model)
model - the TableModelTableModelCopyright © 2009–2017 Helmut Ahammer, Philipp Kainz. All rights reserved.