|
From: <de...@us...> - 2016-10-13 08:37:01
|
Revision: 9435
http://sourceforge.net/p/fudaa/svn/9435
Author: deniger
Date: 2016-10-13 08:36:59 +0000 (Thu, 13 Oct 2016)
Log Message:
-----------
CRUE-667: Import de conditions aux limites
Modified Paths:
--------------
trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluFileChooserCsvExcel.java
trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluTableSimpleExporter.java
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCsvFileImporter.java
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableGraphePanel.java
Modified: trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluFileChooserCsvExcel.java
===================================================================
--- trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluFileChooserCsvExcel.java 2016-10-13 08:36:32 UTC (rev 9434)
+++ trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluFileChooserCsvExcel.java 2016-10-13 08:36:59 UTC (rev 9435)
@@ -35,23 +35,43 @@
final BuFileFilter ftXslx_;
final Component parentComponent;
- public CtuluFileChooserCsvExcel(CtuluUI _ui) {
- this(_ui == null ? null : _ui.getParentComponent());
+ public static CtuluFileChooserCsvExcel createSaveFileChooser() {
+ CtuluFileChooserCsvExcel fileChooser = new CtuluFileChooserCsvExcel((CtuluUI) null);
+ fileChooser.setDialogType(JFileChooser.SAVE_DIALOG);
+ return fileChooser;
}
- public BuFileFilter getFtCsv() {
- return ftCsv_;
+ public static CtuluFileChooserCsvExcel createSaveFileChooser(CtuluUI ui) {
+ CtuluFileChooserCsvExcel fileChooser = new CtuluFileChooserCsvExcel(ui);
+ fileChooser.setDialogType(JFileChooser.SAVE_DIALOG);
+ return fileChooser;
}
- public BuFileFilter getFtXsl() {
- return ftXsl_;
+ public static CtuluFileChooserCsvExcel createOpenFileChooser() {
+ CtuluFileChooserCsvExcel fileChooser = new CtuluFileChooserCsvExcel((CtuluUI) null);
+ fileChooser.setDialogType(JFileChooser.OPEN_DIALOG);
+ fileChooser.setTester(null);
+ return fileChooser;
}
- public BuFileFilter getFtXslx() {
- return ftXslx_;
+ public static CtuluFileChooserCsvExcel createOpenFileChooser(Component parentComponent) {
+ CtuluFileChooserCsvExcel fileChooser = new CtuluFileChooserCsvExcel(parentComponent);
+ fileChooser.setDialogType(JFileChooser.OPEN_DIALOG);
+ fileChooser.setTester(null);
+ return fileChooser;
}
+ public CtuluFileChooserCsvExcel() {
+ this((Component) null);
+
+ }
+
+ public CtuluFileChooserCsvExcel(CtuluUI _ui) {
+ this(_ui == null ? null : _ui.getParentComponent());
+ }
+
public CtuluFileChooserCsvExcel(Component parentComponent) {
+ super(true);
this.parentComponent = parentComponent;
ftCsv_ = new BuFileFilter(new String[]{"csv", "txt"}, CtuluResource.CTULU.getString("Texte CSV"));
ftCsv_.setExtensionListInDescription(true);
@@ -74,6 +94,18 @@
setTester(tester);
}
+ public BuFileFilter getFtCsv() {
+ return ftCsv_;
+ }
+
+ public BuFileFilter getFtXsl() {
+ return ftXsl_;
+ }
+
+ public BuFileFilter getFtXslx() {
+ return ftXslx_;
+ }
+
/**
* @return true si le format excel est choisi
*/
Modified: trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluTableSimpleExporter.java
===================================================================
--- trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluTableSimpleExporter.java 2016-10-13 08:36:32 UTC (rev 9434)
+++ trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluTableSimpleExporter.java 2016-10-13 08:36:59 UTC (rev 9435)
@@ -53,7 +53,7 @@
}
public static void doExport(final char separator, final CtuluTableModelInterface _t, final CtuluUI _ui, final Window _f) {
- final CtuluFileChooserCsvExcel choose = new CtuluFileChooserCsvExcel(_ui);
+ final CtuluFileChooserCsvExcel choose = CtuluFileChooserCsvExcel.createSaveFileChooser(_ui);
final File f = choose.getDestFile();
if (f == null) {
return;
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCsvFileImporter.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCsvFileImporter.java 2016-10-13 08:36:32 UTC (rev 9434)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCsvFileImporter.java 2016-10-13 08:36:59 UTC (rev 9435)
@@ -7,6 +7,7 @@
import java.util.ArrayList;
import java.util.Arrays;
import javax.swing.JFileChooser;
+import org.fudaa.ctulu.CtuluLibArray;
import org.fudaa.ctulu.CtuluLibString;
import org.fudaa.ctulu.gui.CtuluFileChooserCsvExcel;
import org.fudaa.ctulu.table.CtuluExcelCsvFileReader;
@@ -23,23 +24,29 @@
this.panel = aThis;
}
- void importCsv() {
- final CtuluFileChooserCsvExcel choose = new CtuluFileChooserCsvExcel(panel);
+ void importTablerFile() {
+ final CtuluFileChooserCsvExcel choose = CtuluFileChooserCsvExcel.createOpenFileChooser(panel);
choose.setDialogType(JFileChooser.OPEN_DIALOG);
choose.setTester(null);
final File f = choose.getDestFile();
if (f == null) {
return;
}
- final String[][] values = new CtuluExcelCsvFileReader(f).readFile();
+ final CtuluExcelCsvFileReader ctuluExcelCsvFileReader = new CtuluExcelCsvFileReader(f);
+ final String[][] values = ctuluExcelCsvFileReader.readFile();
if (values == null) {
return;
}
+ boolean isCsv = !ctuluExcelCsvFileReader.isExcel();
panel.t_.deleteAllValues();
panel.t_.clearSelection();
ArrayList tab = new ArrayList(values.length);
for (int i = 0; i < values.length; i++) {
String[] value = values[i];
+ //ignore les commentaire
+ if (isCsv && CtuluLibArray.isNotEmpty(value) && value[0] != null && value[0].startsWith("#")) {
+ continue;
+ }
//la premier ligne peut \xEAtre les entetes
if (i == 0) {
if (!CtuluLibString.isNumeric(value[0])) {
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableGraphePanel.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableGraphePanel.java 2016-10-13 08:36:32 UTC (rev 9434)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableGraphePanel.java 2016-10-13 08:36:59 UTC (rev 9435)
@@ -725,8 +725,8 @@
t_.paste();
}
- protected void tableImport() {
- new EGCsvFileImporter(this).importCsv();
+ public void tableImport() {
+ new EGCsvFileImporter(this).importTablerFile();
}
EbliActionSimple actionDelete;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|