Author: echatellier Date: 2012-04-25 13:39:33 +0200 (Wed, 25 Apr 2012) New Revision: 3395 Url: http://chorem.org/repositories/revision/lima/3395 Log: Update init database wizard Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExportWaitView.jaxx trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateAccountsPanel.jaxx trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateEntryBookPanel.jaxx trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/OpeningView.jaxx trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/OpeningViewHandler.java trunk/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties trunk/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java 2012-04-25 10:18:26 UTC (rev 3394) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java 2012-04-25 11:39:33 UTC (rev 3395) @@ -54,20 +54,27 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.lima.business.LimaException; +import org.chorem.lima.business.LimaRuntimeException; import org.chorem.lima.business.api.ExportService; import org.chorem.lima.business.api.ImportService; import org.chorem.lima.business.utils.ImportExportEntityEnum; import org.chorem.lima.enums.EncodingEnum; import org.chorem.lima.enums.ImportExportEnum; import org.chorem.lima.service.LimaServiceFactory; -import org.chorem.lima.ui.account.AccountViewHandler; -import org.chorem.lima.util.DialogHelper; import org.jdesktop.swingx.painter.BusyPainter; +/** + * Import export helper. + * Calling service with specified file to import and displaying wait view to user. + * + * @author echatellier + * Date : 24 avr. 2012 + */ public class ImportExport { - private static final Log log = LogFactory.getLog(AccountViewHandler.class); + private static final Log log = LogFactory.getLog(ImportExport.class); + /** Parent view. */ protected Component viewComponent; protected EncodingEnum encodingEnum; @@ -95,13 +102,13 @@ } /** - * Call the appropriate methode in business service. + * Call the appropriate method in business service. * * @param importExportMethode * @param file * @param verbose */ - public void importExport(ImportExportEnum importExportMethode, String file, Boolean verbose) { + public void importExport(ImportExportEnum importExportMethode, String file, boolean verbose) { final ImportExportEnum importExportMethodeF = importExportMethode; encodingEnum = EncodingEnum.UTF8; if (file.equals("")) { @@ -199,28 +206,30 @@ if (verboseMode) { String result = get(); if (!result.equals("")) { - DialogHelper.showReportDialog(result, _("lima.importexport.import"), viewComponent); + JOptionPane.showMessageDialog(viewComponent, _("lima.ui.importexport.importerror"), + _("lima.ui.importexport.importtitle"), JOptionPane.ERROR_MESSAGE); + } else { if (importMode) { //special message when importing a VAT PDF if (importExportMethodeF.equals(ImportExportEnum.PDF_VAT_IMPORT)) { JOptionPane.showMessageDialog( waitView, - _("lima.importexport.import.vatpdfimport"), - _("lima.importexport.import"), + _("lima.ui.importexport.import.vatpdfimport"), + _("lima.ui.importexport.import"), JOptionPane.INFORMATION_MESSAGE); } else { JOptionPane.showMessageDialog( waitView, - _("lima.importexport.import.terminated"), - _("lima.importexport.import"), + _("lima.ui.importexport.import.terminated"), + _("lima.ui.importexport.import"), JOptionPane.INFORMATION_MESSAGE); } } else { JOptionPane.showMessageDialog( waitView, - _("lima.importexport.export.terminated"), - _("lima.importexport.export"), + _("lima.ui.importexport.export.terminated"), + _("lima.ui.importexport.export"), JOptionPane.INFORMATION_MESSAGE); } } @@ -229,11 +238,8 @@ if (log.isErrorEnabled()) { log.error("Can't get result message", eee); } - } catch (ExecutionException eee) { - DialogHelper.showErrorMessageDialog(viewComponent, eee.getCause()); - if (log.isErrorEnabled()) { - log.error("Error on import", eee); - } + } catch (ExecutionException ex) { + throw new LimaRuntimeException("Error during import", ex); } } }.execute(); @@ -281,32 +287,38 @@ } - /** Get csv datas in string and write file + /** + * Get csv datas in string and write file. + * * @param filePath * @param charset - * @param datas*/ + * @param datas + */ public void createFile(String filePath, String charset, String datas) { File file = new File(filePath); + BufferedWriter out = null; try { - BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), charset)); - try { - out.write(datas); - out.flush(); - out.close(); - } finally { - out.close(); - } + out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), charset)); + out.write(datas); + out.flush(); + out.close(); } catch (IOException eee) { if (log.isErrorEnabled()) { log.error("Can't write file " + filePath, eee); } + } finally { + IOUtils.closeQuietly(out); } + } - /** Open csv file and get his datas on a string. + /** + * Open csv file and get his datas on a string. + * * @param filePath * @param charset - * @return*/ + * @return + */ public String extractFile(String filePath, String charset) { StringWriter sw = new StringWriter(); BufferedReader in = null; @@ -322,11 +334,7 @@ } in = new BufferedReader(new InputStreamReader(is, charset)); - try { - IOUtils.copy(in, sw); - } finally { - in.close(); - } + IOUtils.copy(in, sw); in.close(); } catch (IOException eee) { if (log.isErrorEnabled()) { Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExportWaitView.jaxx =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExportWaitView.jaxx 2012-04-25 10:18:26 UTC (rev 3394) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExportWaitView.jaxx 2012-04-25 11:39:33 UTC (rev 3395) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2008 - 2010 CodeLutin + Copyright (C) 2008 - 2012 CodeLutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -23,22 +23,15 @@ #L% --> -<JDialog modal="true" id="waitDialog"> - - <script> - <![CDATA[ - - ]]> - </script> - +<JDialog modal="true" id="waitDialog" title="lima.ui.importexport.waittitle"> <Table> <row> <cell> <org.jdesktop.swingx.JXBusyLabel id='busylabel' busy='true'/> </cell> <cell> - <JLabel text='lima.importexport.wait'/> + <JLabel text='lima.ui.importexport.wait'/> </cell> </row> </Table> -</JDialog> \ No newline at end of file +</JDialog> Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateAccountsPanel.jaxx =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateAccountsPanel.jaxx 2012-04-25 10:18:26 UTC (rev 3394) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateAccountsPanel.jaxx 2012-04-25 11:39:33 UTC (rev 3395) @@ -32,7 +32,7 @@ <Table> <row> <cell> - <JLabel text='lima.opening.accounts'/> + <JLabel text='lima.ui.opening.accounts'/> </cell> </row> <row> Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateEntryBookPanel.jaxx =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateEntryBookPanel.jaxx 2012-04-25 10:18:26 UTC (rev 3394) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateEntryBookPanel.jaxx 2012-04-25 11:39:33 UTC (rev 3395) @@ -26,13 +26,13 @@ <Table> <row> <cell> - <JLabel text='lima.opening.entrybook'/> + <JLabel text='lima.ui.opening.entrybook'/> </cell> </row> <row> <cell> <JCheckBox id='importEntryBook' - text='lima.importexport.defaultentrybooks' selected='true'/> + text='lima.ui.importexport.defaultentrybooks' selected='true'/> </cell> </row> </Table> Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/OpeningView.jaxx =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/OpeningView.jaxx 2012-04-25 10:18:26 UTC (rev 3394) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/OpeningView.jaxx 2012-04-25 11:39:33 UTC (rev 3395) @@ -22,9 +22,8 @@ <http://www.gnu.org/licenses/gpl-3.0.html>. #L% --> +<JDialog modal="true" title="lima.ui.opening.title"> -<JDialog modal="true"> - <import> javax.swing.BorderFactory javax.swing.ImageIcon @@ -56,8 +55,8 @@ </cell> <cell weightx="0.9" rows="4" fill="both"> <JPanel id='panel'> - <JLabel text='lima.opening.welcome'/> - <JButton text='lima.opening.import' + <JLabel text='lima.ui.opening.welcome'/> + <JButton text='lima.ui.opening.import' onActionPerformed="handler.importSave()"/> </JPanel> </cell> @@ -85,10 +84,10 @@ <JLabel text=''/> </cell> <cell weightx="0.1" fill="none"> - <JButton text="lima.common.close" onActionPerformed="performCancel()"/> + <JButton text="lima.ui.opening.close" onActionPerformed="performCancel()"/> </cell> <cell weightx="0.1" fill="none"> - <JButton id="ok" text="lima.common.next" + <JButton id="ok" text="lima.ui.opening.next" onActionPerformed="handler.next()"/> </cell> </row> Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/OpeningViewHandler.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/OpeningViewHandler.java 2012-04-25 10:18:26 UTC (rev 3394) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/OpeningViewHandler.java 2012-04-25 11:39:33 UTC (rev 3395) @@ -182,7 +182,7 @@ view.getFiscalperiodsIcon().setBorder(BorderFactory.createLineBorder(green, 2)); panel.add(fsPanel); panel.validate(); - view.getOk().setText(_("lima.common.fin")); + view.getOk().setText(_("lima.ui.opening.end")); view.repaint(); step++; break; Modified: trunk/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties =================================================================== --- trunk/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties 2012-04-25 10:18:26 UTC (rev 3394) +++ trunk/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties 2012-04-25 11:39:33 UTC (rev 3395) @@ -183,24 +183,8 @@ lima.identity.phoneNumber=Phone number lima.identity.vatNumber=VAT number lima.identity.zipCode=Zip code -lima.importexport.accountcharts=Accounts chart -lima.importexport.all=All -lima.importexport.choiceencoding=Choice encoding -lima.importexport.csv=Import/Export CSV -lima.importexport.defaultentrybooks=Defaults entrybooks -lima.importexport.ebp=Import/Export EBP -lima.importexport.entries=Entries -lima.importexport.export=Export -lima.importexport.export.terminated=Export terminated -lima.importexport.financialstatements=FinancialStatements chart -lima.importexport.import=Import -lima.importexport.import.terminated=Import terminated -lima.importexport.import.vatpdfimport=The PDF has been imported. It can be found inside the Lima resources directory -lima.importexport.importcsv=Import CSV -lima.importexport.importebp=Import EBP -lima.importexport.usevatpdf=Would you like to use this PDF when editing the VAT document ? -lima.importexport.vatstatements=VAT chart -lima.importexport.wait=Job in progress… +lima.importexport.importcsv= +lima.importexport.importebp= lima.init.closed=Lima closed at %1$s lima.init.errorclosing=Error during Lima close lima.ledger.documentcreationerror=Enable to create document @@ -216,10 +200,6 @@ lima.message.help.usage=Options (set with --option <key> <value>\: lima.misc.supportemail.description=Support email lima.openejb.remotemode.description= -lima.opening.accounts=<html><center>Select a default, <br/>import your personnal<br/> or cancel to create your own account chart.</center></html> -lima.opening.entrybook=<html>Tick box to import default accounts chart\:<br/> Achats, Ventes, Trésorerie, Opération diverses</html> -lima.opening.import=Import a CSV Save -lima.opening.welcome=<html><center>Welcome to Lima<br/>this assistant help you to start your business accounting in the blink of an eye<br/>OR import instantanly your already existing save in CSV format<br/><br/><br/><br/></center></html> lima.preferences=Preferences lima.refresh=↻ lima.reports=Reports @@ -354,9 +334,32 @@ lima.ui.home.transaction.modifiy.unbalanced= lima.ui.home.transaction.nothing= lima.ui.home.transaction.unbalanced= +lima.ui.importexport.accountcharts=Accounts chart +lima.ui.importexport.all=All +lima.ui.importexport.choiceencoding=Choice encoding +lima.ui.importexport.csv=Import/Export CSV +lima.ui.importexport.defaultentrybooks=Defaults entrybooks +lima.ui.importexport.ebp=Import/Export EBP +lima.ui.importexport.entries=Entries +lima.ui.importexport.export=Export +lima.ui.importexport.export.terminated=Export terminated +lima.ui.importexport.financialstatements=FinancialStatements chart lima.ui.importexport.import= +lima.ui.importexport.import.terminated=Import terminated +lima.ui.importexport.import.vatpdfimport=The PDF has been imported. It can be found inside the Lima resources directory lima.ui.importexport.importcsv= lima.ui.importexport.importebp= +lima.ui.importexport.usevatpdf=Would you like to use this PDF when editing the VAT document ? +lima.ui.importexport.vatstatements=VAT chart +lima.ui.importexport.wait=Job in progress… +lima.ui.importexport.waittitle= +lima.ui.opening.accounts=<html><center>Select a default, <br/>import your personnal<br/> or cancel to create your own account chart.</center></html> +lima.ui.opening.close= +lima.ui.opening.entrybook=<html>Tick box to import default accounts chart\:<br/> Achats, Ventes, Trésorerie, Opération diverses</html> +lima.ui.opening.import=Import a CSV Save +lima.ui.opening.next= +lima.ui.opening.title= +lima.ui.opening.welcome=<html><center>Welcome to Lima<br/>this assistant help you to start your business accounting in the blink of an eye<br/>OR import instantanly your already existing save in CSV format<br/><br/><br/><br/></center></html> lima.vatreport.listerror=Can't get entries list lima.vatstatement.accounts=List of accounts lima.vatstatement.boxname=PDF BoxName @@ -366,4 +369,3 @@ lima.vatstatement.movement.add=Add movement lima.warning.nimbus.landf=Could not find Numbus Look&Feel limma.config.thousandseparator.description= -nuitonutil.error.applicationconfig.save= Modified: trunk/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties =================================================================== --- trunk/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties 2012-04-25 10:18:26 UTC (rev 3394) +++ trunk/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties 2012-04-25 11:39:33 UTC (rev 3395) @@ -163,24 +163,8 @@ lima.identity.phoneNumber=n° Tel lima.identity.vatNumber=n° TVA lima.identity.zipCode=Code Postal -lima.importexport.accountcharts=Plan des comptes -lima.importexport.all=Tout -lima.importexport.choiceencoding=Choisir encodage \: -lima.importexport.csv=Import/Export CSV -lima.importexport.defaultentrybooks=Journaux par défaut -lima.importexport.ebp=Import/Export EBP -lima.importexport.entries=Écritures -lima.importexport.export=Export -lima.importexport.export.terminated=Export terminé -lima.importexport.financialstatements=Plan BCR -lima.importexport.import=Import -lima.importexport.import.terminated=Import terminé -lima.importexport.import.vatpdfimport=Le PDF a bien été importé dans le répertoire des ressources de Lima -lima.importexport.importcsv=Import CSV -lima.importexport.importebp=Import EBP -lima.importexport.usevatpdf=Voulez-vous utilser ce PDF pour la déclaration de TVA ? -lima.importexport.vatstatements=Plan TVA -lima.importexport.wait=Traitement en cours … +lima.importexport.importcsv= +lima.importexport.importebp= lima.init.closed=Lima fermé à %1$s lima.init.errorclosing=Erreur lors de la fermeture lima.ledger.documentcreationerror=Erreur lors de la création du document @@ -196,10 +180,6 @@ lima.message.help.usage=Options (set with --option <key> <value>\: lima.misc.supportemail.description=Adresse email de support lima.openejb.remotemode.description= -lima.opening.accounts=<html><center>Veuillez sélectionner un plan par défault, <br/>importer un plan personnalisé<br/> ou annuler pour créer votre propre plan.</center></html> -lima.opening.entrybook=<html>Cochez la case pour importer les journaux par défaut \:<br/> Achats, Ventes, Trésorerie, Opération diverses</html> -lima.opening.import=Importer une sauvegarde CSV -lima.opening.welcome=<html><center>Bienvenue dans Lima<br/>Laissez vous guider par cet assistant pour démarrer votre comptabilité en quelques instants <br/>Ou bien importer directement une ancienne sauvegarde de LIMA au format CSV<br/><br/><br/><br/></center></html> lima.preferences=Préférences lima.refresh=↻ lima.reports=Rapports @@ -333,9 +313,32 @@ lima.ui.home.transaction.modifiy.unbalanced=Modifier les écritures incorrectes lima.ui.home.transaction.nothing=Aucune écriture lima.ui.home.transaction.unbalanced=transactions ne sont pas équilibrées \! +lima.ui.importexport.accountcharts=Plan des comptes +lima.ui.importexport.all=Tout +lima.ui.importexport.choiceencoding=Choisir encodage \: +lima.ui.importexport.csv=Import/Export CSV +lima.ui.importexport.defaultentrybooks=Journaux par défaut +lima.ui.importexport.ebp=Import/Export EBP +lima.ui.importexport.entries=Écritures +lima.ui.importexport.export=Export +lima.ui.importexport.export.terminated=Export terminé +lima.ui.importexport.financialstatements=Plan BCR lima.ui.importexport.import=Importer +lima.ui.importexport.import.terminated=Import terminé +lima.ui.importexport.import.vatpdfimport=Le PDF a bien été importé dans le répertoire des ressources de Lima lima.ui.importexport.importcsv=Import/Export CSV lima.ui.importexport.importebp=Import/Export EBP +lima.ui.importexport.usevatpdf=Voulez-vous utilser ce PDF pour la déclaration de TVA ? +lima.ui.importexport.vatstatements=Plan TVA +lima.ui.importexport.wait=Traitement en cours… +lima.ui.importexport.waittitle=Traitement en cours +lima.ui.opening.accounts=<html><center>Veuillez sélectionner un plan par défault, <br/>importer un plan personnalisé<br/> ou annuler pour créer votre propre plan.</center></html> +lima.ui.opening.close=Fermer +lima.ui.opening.entrybook=<html>Cochez la case pour importer les journaux par défaut \:<br/> Achats, Ventes, Trésorerie, Opération diverses</html> +lima.ui.opening.import=Importer une sauvegarde CSV +lima.ui.opening.next=Suivant +lima.ui.opening.title=Initialisation +lima.ui.opening.welcome=<html><center>Bienvenue dans Lima<br/>Laissez vous guider par cet assistant pour démarrer votre comptabilité en quelques instants <br/>Ou bien importer directement une ancienne sauvegarde de LIMA au format CSV<br/><br/><br/><br/></center></html> lima.vatreport.listerror=Erreur lors de la récupération des données de la liste lima.vatstatement.accounts=Liste des comptes lima.vatstatement.boxname=PDF BoxName @@ -345,4 +348,3 @@ lima.vatstatement.movement.add=Ajouter un regrouprement lima.warning.nimbus.landf=Le look and feel nymbus n'a pas été trouvé limma.config.thousandseparator.description= -nuitonutil.error.applicationconfig.save=
participants (1)
-
echatellier@users.chorem.org