Author: tchemit Date: 2012-08-14 00:19:52 +0200 (Tue, 14 Aug 2012) New Revision: 415 Url: http://forge.codelutin.com/repositories/revision/sammoa/415 Log: add missing license header, svn properties + move more classes to io package + remove obsolete packages Added: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/io/input/CsvImporter.java trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/io/input/UIImporter.java Removed: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/util/CsvImporter.java trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/util/UIImporter.java Modified: trunk/sammoa-application/src/main/java/fr/ulr/sammoa/application/io/CampaignStorage.java trunk/sammoa-application/src/main/java/fr/ulr/sammoa/application/io/CampaignStorages.java trunk/sammoa-application/src/main/java/fr/ulr/sammoa/application/io/FlightStorage.java trunk/sammoa-application/src/main/java/fr/ulr/sammoa/application/io/FlightStorages.java trunk/sammoa-application/src/main/java/fr/ulr/sammoa/application/io/input/csv/ImportCsvService.java trunk/sammoa-application/src/main/java/fr/ulr/sammoa/application/io/input/map/ImportMapService.java trunk/sammoa-application/src/main/java/fr/ulr/sammoa/application/io/input/map/ShpImporter.java trunk/sammoa-application/src/test/java/fr/ulr/sammoa/application/io/input/csv/ImportCsvServiceTest.java trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/campaign/CampaignUIHandler.java trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/io/output/sammoa/ExportApplicationUIModel.java trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/region/RegionUIHandler.java Modified: trunk/sammoa-application/src/main/java/fr/ulr/sammoa/application/io/CampaignStorage.java =================================================================== --- trunk/sammoa-application/src/main/java/fr/ulr/sammoa/application/io/CampaignStorage.java 2012-08-13 22:12:51 UTC (rev 414) +++ trunk/sammoa-application/src/main/java/fr/ulr/sammoa/application/io/CampaignStorage.java 2012-08-13 22:19:52 UTC (rev 415) @@ -1,4 +1,27 @@ package fr.ulr.sammoa.application.io; +/* + * #%L + * SAMMOA :: Application + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 UMS 3462, Code Lutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ import com.google.common.base.Charsets; import com.google.common.base.Function; Property changes on: trunk/sammoa-application/src/main/java/fr/ulr/sammoa/application/io/CampaignStorage.java ___________________________________________________________________ Modified: svn:keywords - Author Date Id Revision + Author Date Id Revision HeadURL Modified: trunk/sammoa-application/src/main/java/fr/ulr/sammoa/application/io/CampaignStorages.java =================================================================== --- trunk/sammoa-application/src/main/java/fr/ulr/sammoa/application/io/CampaignStorages.java 2012-08-13 22:12:51 UTC (rev 414) +++ trunk/sammoa-application/src/main/java/fr/ulr/sammoa/application/io/CampaignStorages.java 2012-08-13 22:19:52 UTC (rev 415) @@ -1,4 +1,27 @@ package fr.ulr.sammoa.application.io; +/* + * #%L + * SAMMOA :: Application + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 UMS 3462, Code Lutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ import fr.ulr.sammoa.application.SammoaConfig; import org.apache.commons.io.FileUtils; Property changes on: trunk/sammoa-application/src/main/java/fr/ulr/sammoa/application/io/CampaignStorages.java ___________________________________________________________________ Modified: svn:keywords - Author Date Id Revision + Author Date Id Revision HeadURL Modified: trunk/sammoa-application/src/main/java/fr/ulr/sammoa/application/io/FlightStorage.java =================================================================== --- trunk/sammoa-application/src/main/java/fr/ulr/sammoa/application/io/FlightStorage.java 2012-08-13 22:12:51 UTC (rev 414) +++ trunk/sammoa-application/src/main/java/fr/ulr/sammoa/application/io/FlightStorage.java 2012-08-13 22:19:52 UTC (rev 415) @@ -1,4 +1,27 @@ package fr.ulr.sammoa.application.io; +/* + * #%L + * SAMMOA :: Application + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 UMS 3462, Code Lutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ import com.google.common.base.Charsets; import com.google.common.io.Files; Property changes on: trunk/sammoa-application/src/main/java/fr/ulr/sammoa/application/io/FlightStorage.java ___________________________________________________________________ Modified: svn:keywords - Author Date Id Revision + Author Date Id Revision HeadURL Modified: trunk/sammoa-application/src/main/java/fr/ulr/sammoa/application/io/FlightStorages.java =================================================================== --- trunk/sammoa-application/src/main/java/fr/ulr/sammoa/application/io/FlightStorages.java 2012-08-13 22:12:51 UTC (rev 414) +++ trunk/sammoa-application/src/main/java/fr/ulr/sammoa/application/io/FlightStorages.java 2012-08-13 22:19:52 UTC (rev 415) @@ -1,4 +1,27 @@ package fr.ulr.sammoa.application.io; +/* + * #%L + * SAMMOA :: Application + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 UMS 3462, Code Lutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ import org.apache.commons.io.FileUtils; Property changes on: trunk/sammoa-application/src/main/java/fr/ulr/sammoa/application/io/FlightStorages.java ___________________________________________________________________ Modified: svn:keywords - Author Date Id Revision + Author Date Id Revision HeadURL Modified: trunk/sammoa-application/src/main/java/fr/ulr/sammoa/application/io/input/csv/ImportCsvService.java =================================================================== --- trunk/sammoa-application/src/main/java/fr/ulr/sammoa/application/io/input/csv/ImportCsvService.java 2012-08-13 22:12:51 UTC (rev 414) +++ trunk/sammoa-application/src/main/java/fr/ulr/sammoa/application/io/input/csv/ImportCsvService.java 2012-08-13 22:19:52 UTC (rev 415) @@ -1,4 +1,27 @@ package fr.ulr.sammoa.application.io.input.csv; +/* + * #%L + * SAMMOA :: Application + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 UMS 3462, Code Lutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ import com.google.common.base.Preconditions; import com.google.common.io.Files; Property changes on: trunk/sammoa-application/src/main/java/fr/ulr/sammoa/application/io/input/csv/ImportCsvService.java ___________________________________________________________________ Modified: svn:keywords - Author Date Id Revision + Author Date Id Revision HeadURL Modified: trunk/sammoa-application/src/main/java/fr/ulr/sammoa/application/io/input/map/ImportMapService.java =================================================================== --- trunk/sammoa-application/src/main/java/fr/ulr/sammoa/application/io/input/map/ImportMapService.java 2012-08-13 22:12:51 UTC (rev 414) +++ trunk/sammoa-application/src/main/java/fr/ulr/sammoa/application/io/input/map/ImportMapService.java 2012-08-13 22:19:52 UTC (rev 415) @@ -1,4 +1,27 @@ package fr.ulr.sammoa.application.io.input.map; +/* + * #%L + * SAMMOA :: Application + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 UMS 3462, Code Lutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ import com.google.common.base.Preconditions; import com.google.common.collect.Maps; Property changes on: trunk/sammoa-application/src/main/java/fr/ulr/sammoa/application/io/input/map/ImportMapService.java ___________________________________________________________________ Modified: svn:keywords - Author Date Id Revision + Author Date Id Revision HeadURL Modified: trunk/sammoa-application/src/main/java/fr/ulr/sammoa/application/io/input/map/ShpImporter.java =================================================================== --- trunk/sammoa-application/src/main/java/fr/ulr/sammoa/application/io/input/map/ShpImporter.java 2012-08-13 22:12:51 UTC (rev 414) +++ trunk/sammoa-application/src/main/java/fr/ulr/sammoa/application/io/input/map/ShpImporter.java 2012-08-13 22:19:52 UTC (rev 415) @@ -1,4 +1,27 @@ package fr.ulr.sammoa.application.io.input.map; +/* + * #%L + * SAMMOA :: Application + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 UMS 3462, Code Lutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ import com.google.common.io.Files; import fr.ulr.sammoa.application.io.CampaignStorage; Property changes on: trunk/sammoa-application/src/main/java/fr/ulr/sammoa/application/io/input/map/ShpImporter.java ___________________________________________________________________ Modified: svn:keywords - Author Date Id Revision + Author Date Id Revision HeadURL Modified: trunk/sammoa-application/src/test/java/fr/ulr/sammoa/application/io/input/csv/ImportCsvServiceTest.java =================================================================== --- trunk/sammoa-application/src/test/java/fr/ulr/sammoa/application/io/input/csv/ImportCsvServiceTest.java 2012-08-13 22:12:51 UTC (rev 414) +++ trunk/sammoa-application/src/test/java/fr/ulr/sammoa/application/io/input/csv/ImportCsvServiceTest.java 2012-08-13 22:19:52 UTC (rev 415) @@ -1,4 +1,27 @@ package fr.ulr.sammoa.application.io.input.csv; +/* + * #%L + * SAMMOA :: Application + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 UMS 3462, Code Lutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ import fr.ulr.sammoa.application.SammoaConfig; import fr.ulr.sammoa.application.SammoaContext; Property changes on: trunk/sammoa-application/src/test/java/fr/ulr/sammoa/application/io/input/csv/ImportCsvServiceTest.java ___________________________________________________________________ Modified: svn:keywords - Author Date Id Revision + Author Date Id Revision HeadURL Modified: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/campaign/CampaignUIHandler.java =================================================================== --- trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/campaign/CampaignUIHandler.java 2012-08-13 22:12:51 UTC (rev 414) +++ trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/campaign/CampaignUIHandler.java 2012-08-13 22:19:52 UTC (rev 415) @@ -40,9 +40,9 @@ import fr.ulr.sammoa.ui.swing.SammoaUIHandler; import fr.ulr.sammoa.ui.swing.region.RegionUI; import fr.ulr.sammoa.ui.swing.region.RegionUIModel; -import fr.ulr.sammoa.ui.swing.util.CsvImporter; +import fr.ulr.sammoa.ui.swing.io.input.CsvImporter; import fr.ulr.sammoa.ui.swing.util.SammoaUtil; -import fr.ulr.sammoa.ui.swing.util.UIImporter; +import fr.ulr.sammoa.ui.swing.io.input.UIImporter; import jaxx.runtime.swing.ErrorDialogUI; import jaxx.runtime.validator.swing.SwingValidatorMessageTableRenderer; import jaxx.runtime.validator.swing.SwingValidatorUtil; Copied: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/io/input/CsvImporter.java (from rev 414, trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/util/CsvImporter.java) =================================================================== --- trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/io/input/CsvImporter.java (rev 0) +++ trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/io/input/CsvImporter.java 2012-08-13 22:19:52 UTC (rev 415) @@ -0,0 +1,38 @@ +package fr.ulr.sammoa.ui.swing.io.input; +/* + * #%L + * SAMMOA :: UI Swing + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 UMS 3462, Code Lutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +import java.io.File; +import java.io.IOException; + +/** + * Created: 17/07/12 + * + * @author fdesbois <desbois@codelutin.com> + */ +public abstract class CsvImporter { + + public abstract String importCsvFile(File file) throws IOException; + +} Property changes on: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/io/input/CsvImporter.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Copied: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/io/input/UIImporter.java (from rev 414, trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/util/UIImporter.java) =================================================================== --- trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/io/input/UIImporter.java (rev 0) +++ trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/io/input/UIImporter.java 2012-08-13 22:19:52 UTC (rev 415) @@ -0,0 +1,115 @@ +package fr.ulr.sammoa.ui.swing.io.input; +/* + * #%L + * SAMMOA :: UI Swing + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 UMS 3462, Code Lutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +import fr.ulr.sammoa.application.io.CampaignStorage; +import fr.ulr.sammoa.application.io.input.map.ShpImporter; +import fr.ulr.sammoa.ui.swing.util.SammoaUtil; +import org.nuiton.util.csv.ImportRuntimeException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.swing.JOptionPane; +import javax.swing.UIManager; +import java.awt.Component; +import java.io.File; +import java.io.IOException; + +/** + * TODO + * + * @author tchemit <chemit@codelutin.com> + * @since 0.6 + */ +public class UIImporter { + + /** Logger. */ + private static final Logger logger = + LoggerFactory.getLogger(UIImporter.class); + + protected final Component ui; + + public UIImporter(Component ui) { + this.ui = ui; + } + + public boolean importShape(ShpImporter<?> importer, File file, CampaignStorage storage) { + boolean result = false; + + try { + + SammoaUtil.updateBusyState(ui, true); + + String successMessage = importer.importShape(file, storage); + + SammoaUtil.updateBusyState(ui, false); + + JOptionPane.showMessageDialog(ui, successMessage); + + result = true; + + } catch (ImportRuntimeException e) { + showError(file, e); + + } catch (IOException e) { + showError(file, e); + } + return result; + } + + public boolean importCvs(CsvImporter importer, File file) { + boolean result = false; + + try { + + SammoaUtil.updateBusyState(ui, true); + + String successMessage = importer.importCsvFile(file); + + SammoaUtil.updateBusyState(ui, false); + + JOptionPane.showMessageDialog(ui, successMessage); + + result = true; + + } catch (ImportRuntimeException e) { + showError(file, e); + + } catch (IOException e) { + showError(file, e); + } + return result; + } + + protected void showError(File file, Exception e) { + + if (logger.isInfoEnabled()) { + logger.info("Import error from file '" + file.getAbsolutePath() + "'", e); + } + JOptionPane.showMessageDialog( + ui, e.getMessage(), "Error", + JOptionPane.ERROR_MESSAGE, UIManager.getIcon("error")); + } + +} Property changes on: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/io/input/UIImporter.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Modified: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/io/output/sammoa/ExportApplicationUIModel.java =================================================================== --- trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/io/output/sammoa/ExportApplicationUIModel.java 2012-08-13 22:12:51 UTC (rev 414) +++ trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/io/output/sammoa/ExportApplicationUIModel.java 2012-08-13 22:19:52 UTC (rev 415) @@ -3,7 +3,7 @@ * #%L * SAMMOA :: UI Swing * $Id$ - * $HeadURL: http://svn.forge.codelutin.com/svn/sammoa/trunk/sammoa-ui-swing/src/main/jav... $ + * $HeadURL$ * %% * Copyright (C) 2012 UMS 3462, Code Lutin * %% Property changes on: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/io/output/sammoa/ExportApplicationUIModel.java ___________________________________________________________________ Modified: svn:keywords - Author Date Id Revision + Author Date Id Revision HeadURL Modified: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/region/RegionUIHandler.java =================================================================== --- trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/region/RegionUIHandler.java 2012-08-13 22:12:51 UTC (rev 414) +++ trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/region/RegionUIHandler.java 2012-08-13 22:19:52 UTC (rev 415) @@ -30,9 +30,9 @@ import fr.ulr.sammoa.ui.swing.SammoaDecoratorProvider; import fr.ulr.sammoa.ui.swing.SammoaUIContext; import fr.ulr.sammoa.ui.swing.SammoaUIHandler; -import fr.ulr.sammoa.ui.swing.util.CsvImporter; +import fr.ulr.sammoa.ui.swing.io.input.CsvImporter; import fr.ulr.sammoa.ui.swing.util.SammoaUtil; -import fr.ulr.sammoa.ui.swing.util.UIImporter; +import fr.ulr.sammoa.ui.swing.io.input.UIImporter; import jaxx.runtime.swing.ErrorDialogUI; import jaxx.runtime.validator.swing.SwingValidatorMessageTableRenderer; import jaxx.runtime.validator.swing.SwingValidatorUtil; Deleted: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/util/CsvImporter.java =================================================================== --- trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/util/CsvImporter.java 2012-08-13 22:12:51 UTC (rev 414) +++ trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/util/CsvImporter.java 2012-08-13 22:19:52 UTC (rev 415) @@ -1,38 +0,0 @@ -package fr.ulr.sammoa.ui.swing.util; -/* - * #%L - * SAMMOA :: UI Swing - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2012 UMS 3462, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import java.io.File; -import java.io.IOException; - -/** - * Created: 17/07/12 - * - * @author fdesbois <desbois@codelutin.com> - */ -public abstract class CsvImporter { - - public abstract String importCsvFile(File file) throws IOException; - -} Deleted: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/util/UIImporter.java =================================================================== --- trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/util/UIImporter.java 2012-08-13 22:12:51 UTC (rev 414) +++ trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/util/UIImporter.java 2012-08-13 22:19:52 UTC (rev 415) @@ -1,91 +0,0 @@ -package fr.ulr.sammoa.ui.swing.util; - -import fr.ulr.sammoa.application.io.CampaignStorage; -import fr.ulr.sammoa.application.io.input.map.ShpImporter; -import org.nuiton.util.csv.ImportRuntimeException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.swing.JOptionPane; -import javax.swing.UIManager; -import java.awt.Component; -import java.io.File; -import java.io.IOException; - -/** - * TODO - * - * @author tchemit <chemit@codelutin.com> - * @since 0.6 - */ -public class UIImporter { - - /** Logger. */ - private static final Logger logger = - LoggerFactory.getLogger(UIImporter.class); - - protected final Component ui; - - public UIImporter(Component ui) { - this.ui = ui; - } - - public boolean importShape(ShpImporter<?> importer, File file, CampaignStorage storage) { - boolean result = false; - - try { - - SammoaUtil.updateBusyState(ui, true); - - String successMessage = importer.importShape(file, storage); - - SammoaUtil.updateBusyState(ui, false); - - JOptionPane.showMessageDialog(ui, successMessage); - - result = true; - - } catch (ImportRuntimeException e) { - showError(file, e); - - } catch (IOException e) { - showError(file, e); - } - return result; - } - - public boolean importCvs(CsvImporter importer, File file) { - boolean result = false; - - try { - - SammoaUtil.updateBusyState(ui, true); - - String successMessage = importer.importCsvFile(file); - - SammoaUtil.updateBusyState(ui, false); - - JOptionPane.showMessageDialog(ui, successMessage); - - result = true; - - } catch (ImportRuntimeException e) { - showError(file, e); - - } catch (IOException e) { - showError(file, e); - } - return result; - } - - protected void showError(File file, Exception e) { - - if (logger.isInfoEnabled()) { - logger.info("Import error from file '" + file.getAbsolutePath() + "'", e); - } - JOptionPane.showMessageDialog( - ui, e.getMessage(), "Error", - JOptionPane.ERROR_MESSAGE, UIManager.getIcon("error")); - } - -}