[Schmitzm-commits] r1973 - in trunk/schmitzm-excelcsv/src/main: java/de/schmitzm/csv java/de/schmitzm/csv/gui resources/de/schmitzm/csv/resource/locales

scm-commit at wald.intevation.org scm-commit at wald.intevation.org
Thu Apr 26 18:43:59 CEST 2012


Author: mojays
Date: 2012-04-26 18:43:59 +0200 (Thu, 26 Apr 2012)
New Revision: 1973

Modified:
   trunk/schmitzm-excelcsv/src/main/java/de/schmitzm/csv/CsvUtil.java
   trunk/schmitzm-excelcsv/src/main/java/de/schmitzm/csv/gui/CSVPreviewTable.java
   trunk/schmitzm-excelcsv/src/main/resources/de/schmitzm/csv/resource/locales/CsvResourceBundle.properties
   trunk/schmitzm-excelcsv/src/main/resources/de/schmitzm/csv/resource/locales/CsvResourceBundle_de.properties
Log:
CsvUtil: Tries to provide space as CSV delimiter (deactivated because handling of back-to-back delimiters as one sign not yet supported by SuperCSV)

Modified: trunk/schmitzm-excelcsv/src/main/java/de/schmitzm/csv/CsvUtil.java
===================================================================
--- trunk/schmitzm-excelcsv/src/main/java/de/schmitzm/csv/CsvUtil.java	2012-04-26 15:25:09 UTC (rev 1972)
+++ trunk/schmitzm-excelcsv/src/main/java/de/schmitzm/csv/CsvUtil.java	2012-04-26 16:43:59 UTC (rev 1973)
@@ -276,11 +276,12 @@
     SelectionInputOption.Combo<String> delimInputOption = new SelectionInputOption.Combo<String>(
                labels ? R("CSVDialogOptions.delim.label") : null,
                true,
-               new String[] { "\t", ";", "|", "," },
+               new String[] { "\t", ";", "|", "," /*, " "*/ },
                new String[] { R("CSVDialogOptions.delim.tab.desc"),
                               R("CSVDialogOptions.delim.semicolon.desc"),
                               R("CSVDialogOptions.delim.pipe.desc"),
-                              R("CSVDialogOptions.delim.comma.desc") });
+                              R("CSVDialogOptions.delim.comma.desc") /*,
+                              R("CSVDialogOptions.delim.space.desc")*/ });
     // Text-Quotation character
     SelectionInputOption.Combo<String> quoteInputOption = new SelectionInputOption.Combo<String>(
         labels ? R("CSVDialogOptions.quote.label") : null,
@@ -293,6 +294,7 @@
         true,
         new String[] { ",", "." },
         new String[] { ",", "." });
+    
     // Charset
     Charset[] charsets = new Charset[] {Charset.forName("cp850"),
                                         Charset.forName("cp1252"),

Modified: trunk/schmitzm-excelcsv/src/main/java/de/schmitzm/csv/gui/CSVPreviewTable.java
===================================================================
--- trunk/schmitzm-excelcsv/src/main/java/de/schmitzm/csv/gui/CSVPreviewTable.java	2012-04-26 15:25:09 UTC (rev 1972)
+++ trunk/schmitzm-excelcsv/src/main/java/de/schmitzm/csv/gui/CSVPreviewTable.java	2012-04-26 16:43:59 UTC (rev 1973)
@@ -33,10 +33,13 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.nio.charset.Charset;
+import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 import java.util.Vector;
 
+import org.apache.commons.lang.StringUtils;
 import org.supercsv.cellprocessor.ift.CellProcessor;
 import org.supercsv.io.ICsvMapReader;
 
@@ -625,6 +628,16 @@
         try {
           inFile = CsvUtil.createCsvMapReader(input, getCsvDelimiter(), getCsvQuoteSign(), getCsvCharset());
           previewCsvHeader = inFile.getCSVHeader(true);
+          ////// TEST TO ELIMINATE EMPTY HEADER FIELDS (MULTIPLE SPACE DELIMITERS //////
+//          List<String> h = new ArrayList<String>(); 
+//          for (String col : previewCsvHeader)
+//            if ( !StringUtils.isBlank(col) )
+//              h.add(col);
+//          previewCsvHeader = h.toArray(new String[0]);
+          //////////////////////////////////////////////////////////////////////////////
+          
+          
+          
           CellProcessor[] cps = CsvUtil.createNullConverterCellProcessors(previewCsvHeader,getNoDataValue());
           // Import lines
           int recordNo;

Modified: trunk/schmitzm-excelcsv/src/main/resources/de/schmitzm/csv/resource/locales/CsvResourceBundle.properties
===================================================================
--- trunk/schmitzm-excelcsv/src/main/resources/de/schmitzm/csv/resource/locales/CsvResourceBundle.properties	2012-04-26 15:25:09 UTC (rev 1972)
+++ trunk/schmitzm-excelcsv/src/main/resources/de/schmitzm/csv/resource/locales/CsvResourceBundle.properties	2012-04-26 16:43:59 UTC (rev 1973)
@@ -39,6 +39,7 @@
 CSVDialogOptions.delim.semicolon.desc=Semicolon (;)
 CSVDialogOptions.delim.pipe.desc=Pipe (|)
 CSVDialogOptions.delim.comma.desc=Comma (,)
+CSVDialogOptions.delim.space.desc=Space (' ')
 CSVDialogOptions.quote.label=CSV text quote character
 CSVDialogOptions.decimal.label=CSV decimal sign
 CSVDialogOptions.charset.label=Character set of file

Modified: trunk/schmitzm-excelcsv/src/main/resources/de/schmitzm/csv/resource/locales/CsvResourceBundle_de.properties
===================================================================
--- trunk/schmitzm-excelcsv/src/main/resources/de/schmitzm/csv/resource/locales/CsvResourceBundle_de.properties	2012-04-26 15:25:09 UTC (rev 1972)
+++ trunk/schmitzm-excelcsv/src/main/resources/de/schmitzm/csv/resource/locales/CsvResourceBundle_de.properties	2012-04-26 16:43:59 UTC (rev 1973)
@@ -39,6 +39,7 @@
 CSVDialogOptions.delim.semicolon.desc=Semikolon (;)
 CSVDialogOptions.delim.pipe.desc=Pipe (|)
 CSVDialogOptions.delim.comma.desc=Komma (,)
+CSVDialogOptions.delim.space.desc=Leerzeichen (' ')
 CSVDialogOptions.quote.label=CSV Text-Maskierungs-Zeichen
 CSVDialogOptions.decimal.label=CSV Dezimal-Trennzeichen
 CSVDialogOptions.charset.label=Zeichensatz der Datei



More information about the Schmitzm-commits mailing list