cmu.survey.editor.manipulators
Class ImportExportTable

java.lang.Object
  extended by cmu.survey.editor.manipulators.ImportExportTable

public class ImportExportTable
extends java.lang.Object


Nested Class Summary
static class ImportExportTable.ImportError
           
 
Constructor Summary
ImportExportTable()
           
 
Method Summary
 boolean canExport(javax.swing.table.TableModel tableModel)
           
 java.lang.String exportToCSV(javax.swing.table.TableModel tableModel)
           
 boolean exportToCSV(javax.swing.table.TableModel tableModel, java.io.PrintStream outputStream, ProgressDialog progressDialog)
           
 java.lang.String exportToTabSeparatedValues(javax.swing.table.TableModel tableModel)
           
 boolean exportToTabSeparatedValues(javax.swing.table.TableModel tableModel, java.io.PrintStream outputStream, ProgressDialog progressDialog)
           
 boolean exportToXLS(javax.swing.table.TableModel tableModel, java.io.OutputStream outputStream)
           
 boolean exportToXLS(javax.swing.table.TableModel tableModel, java.io.OutputStream outputStream, ProgressDialog progress)
           
 java.lang.String exportWithSeparators(javax.swing.table.TableModel tableModel, char separator)
           
 boolean exportWithSeparators(javax.swing.table.TableModel tableModel, char separator, java.io.PrintStream outputStream)
           
 boolean exportWithSeparators(javax.swing.table.TableModel tableModel, char separator, java.io.PrintStream outputStream, ProgressDialog progress)
           
static javax.swing.JTable getJTableFor(javax.swing.table.TableModel tableModel)
           
 java.lang.String getSubstituteForLineBreakInExport()
           
 javax.swing.table.TableModel importFromCSV(java.io.File file)
           
 TripleTableModel importFromCSVFileToTriple(java.io.File file)
           
 TripleTableModel importFromFile(java.io.File file, char primarySeparator)
           
 TripleTableModel importFromFileToTriple(java.io.File file, char primarySeparator)
           
 TripleTableModel importFromTabFileToTriple(java.io.File file)
           
 TripleTableModel importFromTabSeparatedValues(java.io.File file)
           
 TripleTableModel importFromXLSSheetToTriple(org.apache.poi.hssf.usermodel.HSSFSheet sheet)
           
 TripleTableModel importFromXLSToTriple(java.io.File file)
           
static void main(java.lang.String[] args)
           
 java.lang.String prepStringForExport(java.lang.Object string, char charToEscape, boolean alwaysEscapeNonNumerics)
           
 java.lang.String prepStringForExport(java.lang.String string, char charToEscape)
           
 java.lang.String prepStringForExport(java.lang.String string, char charToEscape, boolean alwaysEscape)
           
 void setSubstituteForLineBreakInExport(java.lang.String substituteForLineBreakInExport)
          Set the character to replace line breaks with in exported tables.
static javax.swing.JTable showTable(javax.swing.table.TableModel tableModel, boolean quitWhenDone)
           
static void showTableThenQuit(DataTableModel tableModel)
           
static javax.swing.JTable showTableThenQuit(TripleTableModel table)
           
static javax.swing.JTable showTableThenQuit(java.util.Vector<java.lang.String> columnNames, java.util.Vector<java.lang.Class> columnTypes, java.util.Vector<java.util.Vector<java.lang.Object>> rowData)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImportExportTable

public ImportExportTable()
Method Detail

getSubstituteForLineBreakInExport

public java.lang.String getSubstituteForLineBreakInExport()
Returns:
Returns the substituteForLineBreakInExport.

setSubstituteForLineBreakInExport

public void setSubstituteForLineBreakInExport(java.lang.String substituteForLineBreakInExport)
Set the character to replace line breaks with in exported tables. Set this to null to not replace line breaks -- but be warned that if you do not replace line breaks in exports, most tools will not be able to import the file -- they'll usually break (including this one).

Parameters:
substituteForLineBreakInExport - The substituteForLineBreakInExport to set.

prepStringForExport

public java.lang.String prepStringForExport(java.lang.String string,
                                            char charToEscape,
                                            boolean alwaysEscape)

prepStringForExport

public java.lang.String prepStringForExport(java.lang.String string,
                                            char charToEscape)

prepStringForExport

public java.lang.String prepStringForExport(java.lang.Object string,
                                            char charToEscape,
                                            boolean alwaysEscapeNonNumerics)

exportToCSV

public java.lang.String exportToCSV(javax.swing.table.TableModel tableModel)

canExport

public boolean canExport(javax.swing.table.TableModel tableModel)

exportToTabSeparatedValues

public java.lang.String exportToTabSeparatedValues(javax.swing.table.TableModel tableModel)

exportToTabSeparatedValues

public boolean exportToTabSeparatedValues(javax.swing.table.TableModel tableModel,
                                          java.io.PrintStream outputStream,
                                          ProgressDialog progressDialog)

exportToCSV

public boolean exportToCSV(javax.swing.table.TableModel tableModel,
                           java.io.PrintStream outputStream,
                           ProgressDialog progressDialog)

exportWithSeparators

public java.lang.String exportWithSeparators(javax.swing.table.TableModel tableModel,
                                             char separator)

exportWithSeparators

public boolean exportWithSeparators(javax.swing.table.TableModel tableModel,
                                    char separator,
                                    java.io.PrintStream outputStream)

exportWithSeparators

public boolean exportWithSeparators(javax.swing.table.TableModel tableModel,
                                    char separator,
                                    java.io.PrintStream outputStream,
                                    ProgressDialog progress)

exportToXLS

public boolean exportToXLS(javax.swing.table.TableModel tableModel,
                           java.io.OutputStream outputStream)

exportToXLS

public boolean exportToXLS(javax.swing.table.TableModel tableModel,
                           java.io.OutputStream outputStream,
                           ProgressDialog progress)

importFromXLSSheetToTriple

public TripleTableModel importFromXLSSheetToTriple(org.apache.poi.hssf.usermodel.HSSFSheet sheet)
                                            throws ImportExportTable.ImportError
Throws:
ImportExportTable.ImportError

importFromXLSToTriple

public TripleTableModel importFromXLSToTriple(java.io.File file)
                                       throws ImportExportTable.ImportError
Throws:
ImportExportTable.ImportError

importFromCSV

public javax.swing.table.TableModel importFromCSV(java.io.File file)
                                           throws ImportExportTable.ImportError
Throws:
ImportExportTable.ImportError

importFromTabSeparatedValues

public TripleTableModel importFromTabSeparatedValues(java.io.File file)
                                              throws ImportExportTable.ImportError
Throws:
ImportExportTable.ImportError

importFromFile

public TripleTableModel importFromFile(java.io.File file,
                                       char primarySeparator)
                                throws ImportExportTable.ImportError
Throws:
ImportExportTable.ImportError

importFromCSVFileToTriple

public TripleTableModel importFromCSVFileToTriple(java.io.File file)
                                           throws ImportExportTable.ImportError
Parameters:
fileName -
Returns:
a Triple where columnNames=(Vector)triple.item1 (a Vector of String), columnTypes=(Vector)triple.item2 (a Vector of Class), rows=(Vector)triple.item3 (a Vector of Vectors -- each Vector included is a row)
Throws:
ImportExportTable.ImportError

importFromTabFileToTriple

public TripleTableModel importFromTabFileToTriple(java.io.File file)
                                           throws ImportExportTable.ImportError
Throws:
ImportExportTable.ImportError

importFromFileToTriple

public TripleTableModel importFromFileToTriple(java.io.File file,
                                               char primarySeparator)
                                        throws ImportExportTable.ImportError
Parameters:
fileName -
primarySeparator -
Returns:
a Triple where columnNames=(Vector)triple.item1 (a Vector of String), columnTypes=(Vector)triple.item2 (a Vector of Class), rows=(Vector)triple.item3 (a Vector of Vectors -- each Vector included is a row)
Throws:
ImportExportTable.ImportError

showTableThenQuit

public static javax.swing.JTable showTableThenQuit(java.util.Vector<java.lang.String> columnNames,
                                                   java.util.Vector<java.lang.Class> columnTypes,
                                                   java.util.Vector<java.util.Vector<java.lang.Object>> rowData)

showTableThenQuit

public static javax.swing.JTable showTableThenQuit(TripleTableModel table)

showTableThenQuit

public static void showTableThenQuit(DataTableModel tableModel)

getJTableFor

public static javax.swing.JTable getJTableFor(javax.swing.table.TableModel tableModel)

showTable

public static javax.swing.JTable showTable(javax.swing.table.TableModel tableModel,
                                           boolean quitWhenDone)

main

public static final void main(java.lang.String[] args)