public class CsvDataController
extends java.util.Observable
| Modifier and Type | Field and Description |
|---|---|
static int |
EVENT_TABLE_MODEL_REPLACED
Event code to inform observers that the table model was replaced
|
| Constructor and Description |
|---|
CsvDataController()
Instantiates a new CSV data controller.
|
CsvDataController(java.io.File file,
java.lang.String separator,
boolean headline)
Instantiates a new CSV data controller for the import.
|
CsvDataController(java.io.File file,
java.lang.String separator,
boolean headline,
javax.swing.table.DefaultTableModel dataModel)
Instantiates a new CSV data controller for the import OR the export.
|
| Modifier and Type | Method and Description |
|---|---|
void |
doExport()
This method exports data to a CSV file
|
void |
doImport()
This method imports data from a CSV file
|
void |
doImport(java.io.BufferedReader br)
This method imports data from a CSV file.
|
javax.swing.table.DefaultTableModel |
getDataModel()
Gets the data model.
|
java.io.File |
getFile()
Gets the file object of the CSV file.
|
java.lang.String |
getSeparator()
Gets the separator.
|
boolean |
hasHeadlines()
Checks for a headline.
|
void |
setFile(java.io.File file)
Sets the file.
|
void |
setHeadline(boolean hasHeadline)
Sets if there is headline or not.
|
void |
setSeparator(java.lang.String separator)
Sets the separator.
|
void |
setTableModel(javax.swing.table.DefaultTableModel dataModel)
Sets the data model.
|
public static final int EVENT_TABLE_MODEL_REPLACED
public CsvDataController()
public CsvDataController(java.io.File file,
java.lang.String separator,
boolean headline)
file - the file to import or to exportseparator - the separator within the CSV fileheadline - Indicate if there is a headline or notpublic CsvDataController(java.io.File file,
java.lang.String separator,
boolean headline,
javax.swing.table.DefaultTableModel dataModel)
file - the file to import or to exportseparator - the separator within the CSV fileheadline - Indicate if there is a headline or notdataModel - the data modelpublic java.io.File getFile()
public void setFile(java.io.File file)
file - the new filepublic java.lang.String getSeparator()
public void setSeparator(java.lang.String separator)
separator - the new separatorpublic boolean hasHeadlines()
public void setHeadline(boolean hasHeadline)
hasHeadline - the new headlinepublic javax.swing.table.DefaultTableModel getDataModel()
public void setTableModel(javax.swing.table.DefaultTableModel dataModel)
dataModel - the new data modelpublic void doImport()
public void doImport(java.io.BufferedReader br)
br - the BufferedReader to use for the read operationpublic void doExport()