Author: jpepin Date: 2010-07-28 20:53:39 +0200 (Wed, 28 Jul 2010) New Revision: 2988 Url: http://chorem.org/repositories/revision/lima/2988 Log: Ajout d'un assistant au d?\195?\169marrage pour la premi?\195?\168re ouverture de LIMA : cr?\195?\169ation fiche d'identit?\195?\169, comptes, journaux, exercice. Added: trunk/lima-swing/src/main/java/org/chorem/lima/enums/ trunk/lima-swing/src/main/java/org/chorem/lima/enums/AccountsChartEnum.java trunk/lima-swing/src/main/java/org/chorem/lima/enums/EntryBooksChartEnum.java trunk/lima-swing/src/main/java/org/chorem/lima/enums/FinancialStatementsChartEnum.java trunk/lima-swing/src/main/java/org/chorem/lima/enums/ImportExportEnum.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountImportForm.jaxx trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookImportForm.jaxx trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementImportForm.jaxx trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/ 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/CreateFiscalPeriodPanel.jaxx trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateIdentityPanel.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/images/identity.png trunk/lima-swing/src/main/resources/import/eb_default.csv Removed: trunk/lima-swing/src/main/java/org/chorem/lima/enumeration/ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/DefaultAccountsChartEnum.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/DefaultAccountsChartForm.jaxx trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/DefaultEntryBooksEnum.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/DefaultEntryBooksForm.jaxx trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/DefaultFinancialStatementChartForm.jaxx trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/DefaultFinancialStatementsEnum.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExportEnum.java Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainView.jaxx trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountView.jaxx trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookView.jaxx trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookViewHandler.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartView.jaxx trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartViewHandler.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/AddPeriod.jaxx trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodViewHandler.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/identity/IdentityHandler.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.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-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java 2010-07-28 09:02:22 UTC (rev 2987) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java 2010-07-28 18:53:39 UTC (rev 2988) @@ -20,9 +20,12 @@ package org.chorem.lima.business.ejb; import static org.nuiton.i18n.I18n._; +import java.util.Calendar; +import java.util.Date; import java.util.List; import javax.ejb.EJB; import javax.ejb.Stateless; +import org.apache.commons.lang.time.DateUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.lima.business.AccountingRules; @@ -79,6 +82,16 @@ public void createFiscalPeriodWithTransaction(FiscalPeriod fiscalPeriod, TopiaContext topiaContext) throws LimaException { try { + Date beginDate = fiscalPeriod.getBeginDate(); + beginDate = DateUtils.truncate(beginDate, Calendar.DATE); + Date endDate = fiscalPeriod.getEndDate(); + endDate = DateUtils.addDays(endDate, 1); + endDate = DateUtils.truncate(endDate, Calendar.DATE); + endDate = DateUtils.addMilliseconds(endDate,-1); + + fiscalPeriod.setBeginDate(beginDate); + fiscalPeriod.setEndDate(endDate); + //check rules before create the account List<FinancialPeriod> financialPeriods = accountingRules.createFiscalPeriodRules(fiscalPeriod, topiaContext); Modified: trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java 2010-07-28 09:02:22 UTC (rev 2987) +++ trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java 2010-07-28 18:53:39 UTC (rev 2988) @@ -36,6 +36,8 @@ import org.chorem.lima.service.LimaServiceFactory; import org.chorem.lima.ui.MainView; import org.chorem.lima.ui.MainViewHandler; +import org.chorem.lima.ui.opening.OpeningView; +import org.chorem.lima.ui.opening.OpeningViewHandler; import org.chorem.lima.util.ErrorHelper; import org.nuiton.i18n.I18n; import org.nuiton.util.StringUtil; @@ -137,7 +139,7 @@ } } - // init date converter + /* init date converter Converter converter = ConverterUtil.getConverter(java.util.Date.class); if (converter != null) { ConvertUtils.deregister(java.util.Date.class); @@ -148,7 +150,7 @@ if (log.isDebugEnabled()) { log.debug("Context init done in " + (StringUtil.convertTime(t0, System.nanoTime()))); - } + }*/ return context; } @@ -167,37 +169,25 @@ // defaut display home view (not closeable, but might be !) uiHandler.showHomeView(context); - // put services into context (or not...) - //context.setContextValue(LimaServiceFactory.getInstance().getAccountService()); - //context.setContextValue(LimaServiceFactory.getInstance().getAccountService()); - - // TODO EC-20100409 load accounts and test if there is an account plan defined + // load accounts and test if there is an account plan defined // if not, call #loadDefaultAccount() splash.updateProgression(0.5, _("Loading accounting...")); - //AccountService accountService = LimaServiceFactory.getInstance().getAccountService(); AccountService accountService = LimaServiceFactory.getInstance().getService( AccountServiceMonitorable.class); - List<Account> account = accountService.getChildrenAccounts(null); - if (CollectionUtils.isEmpty(account)) { + + List<Account> accounts = accountService.getChildrenAccounts(null); + if (accounts.isEmpty()) { if (log.isInfoEnabled()) { - log.info("TODO : Propose for defaut account loading"); + log.info("Propose for defaut account loading"); } + OpeningView openingView = new OpeningView(); + openingView.setSize(800, 400); + openingView.setLocationRelativeTo(null); + openingView.setVisible(true); } - - /*try { - if (log.isInfoEnabled()) { - log.info("Loading lima data..."); - } - loadData(context); - } - catch (Exception eee) { - if (log.isErrorEnabled()) { - log.error("Error durring data loading", eee); - } - }*/ - + // show ui SwingUtilities.invokeLater(new Runnable() { @Override @@ -205,6 +195,7 @@ ui.setVisible(true); } }); + } public static class ShutdownHook extends Thread { @@ -234,41 +225,4 @@ } } } - - /** - * This method ask for user to load a default account plan. - * - * @param accountRoot database accounts - */ - public static void loadDefaultAccount(Account accountRoot) { - if (log.isDebugEnabled()) { - log.debug("Account root : " + accountRoot); - } - if (accountRoot.getSubAccounts().isEmpty()) { - if (log.isDebugEnabled()) { - log.debug("No existing accounts"); - } - - String[] response = {_("lima.response.yes"), _("lima.response.no")}; - int n = JOptionPane.showOptionDialog(null, - _("lima.question.load.accounts"), - _("lima.question"), - JOptionPane.YES_NO_OPTION, - JOptionPane.QUESTION_MESSAGE, - null, //do not use a custom Icon - response, //the titles of buttons - response[1]); //default button title - if (n == JOptionPane.YES_OPTION) { - /*XMLImport imports = new XMLImport(); - URL urlFile = LimaMain.class.getResource("/import/default_pcg.xml"); - try { - imports.importAccount(urlFile.openStream()); - } catch (IOException eee) { - log.error("Erreur chargement du fichier 'default_pcg.xml'", eee); - }*/ - } else { - //LimaContext.getContext().getDataManager().resetAccountModel(); - } - } - } } Copied: trunk/lima-swing/src/main/java/org/chorem/lima/enums/AccountsChartEnum.java (from rev 2986, trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/DefaultAccountsChartEnum.java) =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/enums/AccountsChartEnum.java (rev 0) +++ trunk/lima-swing/src/main/java/org/chorem/lima/enums/AccountsChartEnum.java 2010-07-28 18:53:39 UTC (rev 2988) @@ -0,0 +1,20 @@ +package org.chorem.lima.enums; + +public enum AccountsChartEnum { + + IMPORT(""), IMPORTEBP(""), SHORTENED("pcg_shortened.csv"), BASE("pcg_base.csv"), DEVELOPED("pcg_developed.csv"); + + private final String filePath; + + private AccountsChartEnum(String filePath) { + this.filePath = filePath; + } + + public String getFilePath() { + String result = ""; + if (!this.filePath.equals("")){ + result=getClass().getResource("/import/"+this.filePath).getPath(); + } + return result; + } +} Copied: trunk/lima-swing/src/main/java/org/chorem/lima/enums/EntryBooksChartEnum.java (from rev 2986, trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/DefaultEntryBooksEnum.java) =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/enums/EntryBooksChartEnum.java (rev 0) +++ trunk/lima-swing/src/main/java/org/chorem/lima/enums/EntryBooksChartEnum.java 2010-07-28 18:53:39 UTC (rev 2988) @@ -0,0 +1,19 @@ +package org.chorem.lima.enums; + +public enum EntryBooksChartEnum { + + IMPORT(""), DEFAULT("eb_default.csv"); + + private final String filePath; + + private EntryBooksChartEnum(String filePath) { + this.filePath = filePath; + } + + public String getFilePath() { + String result = ""; + if (!this.filePath.equals("")){ + result=getClass().getResource("/import/"+this.filePath).getPath(); + } + return result; } +} Copied: trunk/lima-swing/src/main/java/org/chorem/lima/enums/FinancialStatementsChartEnum.java (from rev 2986, trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/DefaultFinancialStatementsEnum.java) =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/enums/FinancialStatementsChartEnum.java (rev 0) +++ trunk/lima-swing/src/main/java/org/chorem/lima/enums/FinancialStatementsChartEnum.java 2010-07-28 18:53:39 UTC (rev 2988) @@ -0,0 +1,21 @@ +package org.chorem.lima.enums; + +public enum FinancialStatementsChartEnum { + + IMPORT(""), SHORTENED(""), BASE(""), DEVELOPED(""); + + private final String filePath; + + private FinancialStatementsChartEnum(String filePath) { + this.filePath = filePath; + + } + + public String getFilePath() { + String result = ""; + if (!this.filePath.equals("")){ + result=getClass().getResource("/import/"+this.filePath).getPath(); + } + return result; + } +} Copied: trunk/lima-swing/src/main/java/org/chorem/lima/enums/ImportExportEnum.java (from rev 2986, trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExportEnum.java) =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/enums/ImportExportEnum.java (rev 0) +++ trunk/lima-swing/src/main/java/org/chorem/lima/enums/ImportExportEnum.java 2010-07-28 18:53:39 UTC (rev 2988) @@ -0,0 +1,24 @@ +package org.chorem.lima.enums; + + +/** + * Boolean importMode define if it's a import (true) or an export (false) + * + */ +public enum ImportExportEnum { + LIMA_ALL_EXPORT(false), LIMA_ALL_IMPORT(true), + LIMA_ACCOUNTCHARTS_EXPORT(false), LIMA_ENTRYBOOKS_EXPORT(false), LIMA_FINANCIALSTATEMENTS_EXPORT(false), + LIMA_ACCOUNTCHARTS_IMPORT(true), LIMA_ENTRYBOOKS_IMPORT(true), LIMA_FINANCIALSTATEMENTS_IMPORT(true), + EBP_ACCOUNTCHARTS_EXPORT(false), EBP_ENTRIES_EXPORT(false), + EBP_ACCOUNTCHARTS_IMPORT(true), EBP_ENTRIES_IMPORT(true); + + private final Boolean importMode; + + private ImportExportEnum(Boolean importMode) { + this.importMode = importMode; + } + + public Boolean getImportMode() { + return this.importMode; + } +} Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainView.jaxx =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainView.jaxx 2010-07-28 09:02:22 UTC (rev 2987) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainView.jaxx 2010-07-28 18:53:39 UTC (rev 2988) @@ -20,11 +20,13 @@ undecorated='{getConfig().isFullScreen()}' resizable="true" width="800" height="600" extendedState='{this.MAXIMIZED_BOTH}'> + + <script><![CDATA[ import java.util.Locale; import org.chorem.lima.LimaConfig; -import org.chorem.lima.ui.importexport.ImportExportEnum; +import org.chorem.lima.enums.ImportExportEnum; public LimaConfig getConfig() { return getContextValue(LimaConfig.class); Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java 2010-07-28 09:02:22 UTC (rev 2987) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java 2010-07-28 18:53:39 UTC (rev 2988) @@ -31,7 +31,7 @@ import org.apache.commons.logging.LogFactory; import org.chorem.lima.LimaConfig; import org.chorem.lima.LimaContext; -import org.chorem.lima.entity.Identity; +import org.chorem.lima.enums.ImportExportEnum; import org.chorem.lima.ui.account.AccountView; import org.chorem.lima.ui.accountsreports.AccountsReportsView; import org.chorem.lima.ui.balance.BalanceView; @@ -47,7 +47,6 @@ import org.chorem.lima.ui.home.HomeView; import org.chorem.lima.ui.identity.IdentityForm; import org.chorem.lima.ui.importexport.ImportExport; -import org.chorem.lima.ui.importexport.ImportExportEnum; import org.chorem.lima.ui.ledger.LedgerView; import org.chorem.lima.util.ErrorHelper; @@ -299,7 +298,6 @@ MainView mainView = getUI(rootContext); AccountView accountView = new AccountView(mainView); mainView.showTab(_("lima.charts.account"), accountView); - accountView.getHandler().defaultAccountsChart(mainView); } /** * Show account tree table view to create or modify accounts @@ -312,7 +310,6 @@ MainView mainView = getUI(rootContext); EntryBookView entryBookView= new EntryBookView(mainView); mainView.showTab(_("lima.charts.entrybook"), entryBookView); - entryBookView.getHandler().defaultEntryBooks(mainView); } /** @@ -345,7 +342,6 @@ FinancialStatementChartView financialStatementView = new FinancialStatementChartView(mainView); mainView.showTab(_("lima.charts.financialstatement"), financialStatementView); - financialStatementView.getHandler().defaultFinancialStatementChart(mainView); } /** @@ -407,7 +403,7 @@ public void showImportExportView(JAXXContext rootContext, ImportExportEnum type) { MainView mainView = getUI(rootContext); ImportExport importExport = ImportExport.getInstance(mainView); - importExport.importExport(type, ""); + importExport.importExport(type, "", true); } public void showExportView(String type) { Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountImportForm.jaxx =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountImportForm.jaxx (rev 0) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountImportForm.jaxx 2010-07-28 18:53:39 UTC (rev 2988) @@ -0,0 +1,82 @@ +<!-- ##% Lima Swing + Copyright (C) 2008 - 2010 CodeLutin + 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 2 + 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, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + ##% --> + +<JDialog modal="true"> + + <jaxx.runtime.swing.JAXXButtonGroup id="radioButtons" javaBean='new JAXXButtonGroup()'/> + <Boolean id="addState" javaBean='true'/> + + <script> + <![CDATA[ + import org.chorem.lima.enums.AccountsChartEnum; + protected void performCancel() { + getRadioButtons().setSelectedValue(null); + dispose(); + } + ]]> + </script> + + <Table> + <row> + <cell><JLabel text='lima.opening.accounts' /></cell> + </row> + <row> + <cell> + <JRadioButton text='lima.charts.account.shortened' value='{AccountsChartEnum.SHORTENED}' buttonGroup="{getRadioButtons()}" + selected='true'/> + </cell> + </row> + <row> + <cell> + <JRadioButton text='lima.charts.account.base' value='{AccountsChartEnum.BASE}' buttonGroup="{getRadioButtons()}" + selected='true'/> + </cell> + </row> + <row> + <cell> + <JRadioButton text='lima.charts.account.developed' value='{AccountsChartEnum.DEVELOPED}' buttonGroup="{getRadioButtons()}" + selected='true'/> + </cell> + </row> + <row> + <cell> + <JRadioButton text='lima.importexport.importcsv' value='{AccountsChartEnum.IMPORT}' buttonGroup="{getRadioButtons()}" + selected='true'/> + </cell> + </row> + <row> + <cell> + <JRadioButton text='lima.importexport.importebp' value='{AccountsChartEnum.IMPORTEBP}' buttonGroup="{getRadioButtons()}" + selected='true'/> + </cell> + </row> + <row> + <cell> + <Table> + <row> + <cell fill="none"> + <JButton text="lima.common.cancel" onActionPerformed="performCancel()"/> + </cell> + <cell fill="none"> + <JButton text="lima.common.ok" onActionPerformed="dispose()"/> + </cell> + </row> + </Table> + </cell> + </row> + </Table> +</JDialog> \ No newline at end of file Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountImportForm.jaxx ___________________________________________________________________ Added: svn:executable + * Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountView.jaxx =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountView.jaxx 2010-07-28 09:02:22 UTC (rev 2987) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountView.jaxx 2010-07-28 18:53:39 UTC (rev 2988) @@ -64,4 +64,10 @@ enabled="{isSelectedRow()}"/> </cell> </row> + <row> + <cell fill="horizontal"> + <JButton id="importButton" text="lima.importexport.import" + onActionPerformed="getHandler().importAccountsChart()"/> + </cell> + </row> </Table> \ No newline at end of file Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java 2010-07-28 09:02:22 UTC (rev 2987) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java 2010-07-28 18:53:39 UTC (rev 2988) @@ -23,20 +23,19 @@ import javax.swing.tree.TreePath; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.chorem.lima.business.AccountServiceMonitorable; import org.chorem.lima.business.ImportServiceMonitorable; import org.chorem.lima.business.LimaBusinessException; import org.chorem.lima.business.LimaException; import org.chorem.lima.business.ServiceListener; import org.chorem.lima.entity.Account; import org.chorem.lima.entity.AccountImpl; +import org.chorem.lima.enums.AccountsChartEnum; +import org.chorem.lima.enums.ImportExportEnum; import org.chorem.lima.service.LimaServiceFactory; -import org.chorem.lima.ui.MainView; import org.chorem.lima.ui.account.AccountForm; import org.chorem.lima.ui.account.AccountView; import org.chorem.lima.ui.account.SubLedgerForm; import org.chorem.lima.ui.importexport.ImportExport; -import org.chorem.lima.ui.importexport.ImportExportEnum; import org.chorem.lima.util.DialogHelper; import org.chorem.lima.util.ErrorHelper; import org.jdesktop.swingx.JXTreeTable; @@ -57,14 +56,11 @@ protected AccountView view; - protected AccountServiceMonitorable accountService; + //protected AccountServiceMonitorable accountService; protected AccountViewHandler(AccountView view) { this.view = view; // Gets factory service - accountService = - LimaServiceFactory.getInstance().getService( - AccountServiceMonitorable.class); LimaServiceFactory.getInstance().getService( ImportServiceMonitorable.class).addListener(this); } @@ -267,31 +263,23 @@ view.repaint(); } - public void defaultAccountsChart(MainView mainView){ + public void importAccountsChart(){ - try { - if (accountService.getAllAccounts().size() == 0){ - DefaultAccountsChartForm form = new DefaultAccountsChartForm(); + AccountImportForm form = new AccountImportForm(); // - form.setLocationRelativeTo(mainView); + form.setLocationRelativeTo(view); form.setVisible(true); Object value = form.getRadioButtons().getSelectedValue(); // if action confirmed if (value != null){ - DefaultAccountsChartEnum defaultAccountsChartEnum = - (DefaultAccountsChartEnum) value; + AccountsChartEnum defaultAccountsChartEnum = + (AccountsChartEnum) value; ImportExport importExport = ImportExport.getInstance(view); importExport.importExport(ImportExportEnum.LIMA_ACCOUNTCHARTS_IMPORT, - defaultAccountsChartEnum.getFilePath()); - } - } - } catch (LimaException eee) { - if (log.isErrorEnabled()) { - log.error("Can't get default accounts chart", eee); - } - } + defaultAccountsChartEnum.getFilePath(), true); + } } @Override Deleted: trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/DefaultAccountsChartEnum.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/DefaultAccountsChartEnum.java 2010-07-28 09:02:22 UTC (rev 2987) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/DefaultAccountsChartEnum.java 2010-07-28 18:53:39 UTC (rev 2988) @@ -1,20 +0,0 @@ -package org.chorem.lima.ui.account; - -public enum DefaultAccountsChartEnum { - - IMPORT(""), SHORTENED("pcg_shortened.csv"), BASE("pcg_base.csv"), DEVELOPED("pcg_developed.csv"); - - private final String filePath; - - private DefaultAccountsChartEnum(String filePath) { - this.filePath = filePath; - } - - public String getFilePath() { - String result = ""; - if (!this.filePath.equals("")){ - result=getClass().getResource("/import/"+this.filePath).getPath(); - } - return result; - } -} Deleted: trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/DefaultAccountsChartForm.jaxx =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/DefaultAccountsChartForm.jaxx 2010-07-28 09:02:22 UTC (rev 2987) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/DefaultAccountsChartForm.jaxx 2010-07-28 18:53:39 UTC (rev 2988) @@ -1,72 +0,0 @@ -<!-- ##% Lima Swing - Copyright (C) 2008 - 2010 CodeLutin - 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 2 - 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, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - ##% --> - -<JDialog modal="true"> - - <jaxx.runtime.swing.JAXXButtonGroup id="radioButtons" javaBean='new JAXXButtonGroup()'/> - <Boolean id="addState" javaBean='true'/> - - <script> - <![CDATA[ - import org.chorem.lima.ui.account.DefaultAccountsChartEnum; - protected void performCancel() { - getRadioButtons().setSelectedValue(null); - dispose(); - } - ]]> - </script> - - <Table> - <row> - <cell><JLabel text='lima.charts.account.nothing' /></cell> - </row> - <row> - <cell> - <JRadioButton text='lima.charts.account.shortened' value='{DefaultAccountsChartEnum.SHORTENED}' buttonGroup="{getRadioButtons()}" - selected='true'/> - </cell> - </row> - <row> - <cell> - <JRadioButton text='lima.charts.account.base' value='{DefaultAccountsChartEnum.BASE}' buttonGroup="{getRadioButtons()}" - selected='true'/> - </cell> - </row> - <row> - <cell> - <JRadioButton text='lima.charts.account.developed' value='{DefaultAccountsChartEnum.DEVELOPED}' buttonGroup="{getRadioButtons()}" - selected='true'/> - </cell> - </row> - <row> - <cell> - <JRadioButton text='lima.importexport.import' value='{DefaultAccountsChartEnum.IMPORT}' buttonGroup="{getRadioButtons()}" - selected='true'/> - </cell> - </row> - <row> - <cell fill="none"> - <JButton text="lima.common.ok" onActionPerformed="dispose()"/> - </cell> - </row> - <row> - <cell fill="none"> - <JButton text="lima.common.cancel" onActionPerformed="performCancel()"/> - </cell> - </row> - </Table> -</JDialog> \ No newline at end of file Deleted: trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/DefaultEntryBooksEnum.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/DefaultEntryBooksEnum.java 2010-07-28 09:02:22 UTC (rev 2987) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/DefaultEntryBooksEnum.java 2010-07-28 18:53:39 UTC (rev 2988) @@ -1,19 +0,0 @@ -package org.chorem.lima.ui.entrybook; - -public enum DefaultEntryBooksEnum { - - IMPORT(""), DEFAULT(""); - - private final String filePath; - - private DefaultEntryBooksEnum(String filePath) { - this.filePath = filePath; - } - - public String getFilePath() { - String result = ""; - if (!this.filePath.equals("")){ - result=getClass().getResource("/import/"+this.filePath).getPath(); - } - return result; } -} Deleted: trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/DefaultEntryBooksForm.jaxx =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/DefaultEntryBooksForm.jaxx 2010-07-28 09:02:22 UTC (rev 2987) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/DefaultEntryBooksForm.jaxx 2010-07-28 18:53:39 UTC (rev 2988) @@ -1,51 +0,0 @@ -<!-- ##% Lima Swing - Copyright (C) 2008 - 2010 CodeLutin - 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 2 - 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, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - ##% --> - -<JDialog modal="true"> - - <jaxx.runtime.swing.JAXXButtonGroup id="radioButtons" javaBean='new JAXXButtonGroup()'/> - <Boolean id="addState" javaBean='true'/> - - <script> - <![CDATA[ - import org.chorem.lima.ui.entrybook.DefaultEntryBooksEnum; - protected void performCancel() { - getRadioButtons().setSelectedValue(null); - dispose(); - } - ]]> - </script> - - <Table> - <row> - <cell> - <JRadioButton text='lima.charts.entrybook.default' value='{DefaultEntryBooksEnum.DEFAULT}' buttonGroup="{getRadioButtons()}" - selected='true'/> - </cell> - <cell> - <JRadioButton text='lima.charts.entrybook.import' value='{DefaultEntryBooksEnum.IMPORT}' buttonGroup="{getRadioButtons()}" - selected='true'/> - </cell> - <cell fill="none"> - <JButton text="lima.common.ok" onActionPerformed="dispose()"/> - </cell> - <cell fill="none"> - <JButton text="lima.common.cancel" onActionPerformed="performCancel()"/> - </cell> - </row> - </Table> -</JDialog> \ No newline at end of file Copied: trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookImportForm.jaxx (from rev 2986, trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/DefaultEntryBooksForm.jaxx) =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookImportForm.jaxx (rev 0) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookImportForm.jaxx 2010-07-28 18:53:39 UTC (rev 2988) @@ -0,0 +1,59 @@ +<!-- ##% Lima Swing + Copyright (C) 2008 - 2010 CodeLutin + 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 2 + 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, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + ##% --> + +<JDialog modal="true"> + + <jaxx.runtime.swing.JAXXButtonGroup id="radioButtons" javaBean='new JAXXButtonGroup()'/> + <Boolean id="addState" javaBean='true'/> + + <script> + <![CDATA[ + import org.chorem.lima.enums.EntryBooksChartEnum; + protected void performCancel() { + getRadioButtons().setSelectedValue(null); + dispose(); + } + ]]> + </script> + + <Table> + <row> + <cell> + <JRadioButton text='lima.charts.entrybook.default' value='{EntryBooksChartEnum.DEFAULT}' buttonGroup="{getRadioButtons()}" + selected='true'/> + </cell> + <cell> + <JRadioButton text='lima.charts.entrybook.import' value='{EntryBooksChartEnum.IMPORT}' buttonGroup="{getRadioButtons()}" + selected='true'/> + </cell> + </row> + <row> + <cell> + <Table> + <row> + <cell fill="none"> + <JButton text="lima.common.cancel" onActionPerformed="performCancel()"/> + </cell> + <cell fill="none"> + <JButton text="lima.common.ok" onActionPerformed="dispose()"/> + </cell> + </row> + </Table> + </cell> + </row> + </Table> +</JDialog> \ No newline at end of file Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookView.jaxx =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookView.jaxx 2010-07-28 09:02:22 UTC (rev 2987) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookView.jaxx 2010-07-28 18:53:39 UTC (rev 2988) @@ -58,4 +58,10 @@ onActionPerformed="getHandler().deleteEntryBook()"/> </cell> </row> + <row> + <cell fill="horizontal"> + <JButton id="importButton" text="lima.importexport.import" + onActionPerformed="getHandler().importEntryBooks()"/> + </cell> + </row> </Table> \ No newline at end of file Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookViewHandler.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookViewHandler.java 2010-07-28 09:02:22 UTC (rev 2987) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookViewHandler.java 2010-07-28 18:53:39 UTC (rev 2988) @@ -27,10 +27,11 @@ import org.chorem.lima.business.ejbinterface.EntryBookService; import org.chorem.lima.entity.EntryBook; import org.chorem.lima.entity.EntryBookImpl; +import org.chorem.lima.enums.EntryBooksChartEnum; +import org.chorem.lima.enums.ImportExportEnum; import org.chorem.lima.service.LimaServiceFactory; import org.chorem.lima.ui.MainView; import org.chorem.lima.ui.importexport.ImportExport; -import org.chorem.lima.ui.importexport.ImportExportEnum; import org.chorem.lima.util.DialogHelper; import org.jdesktop.swingx.JXTable; @@ -147,24 +148,24 @@ } - public void defaultEntryBooks(MainView mainView){ + public void importEntryBooks(){ try { if (entryBookService.getAllEntryBooks().size() == 0){ - DefaultEntryBooksForm form = - new DefaultEntryBooksForm(); - form.setLocationRelativeTo(mainView); + EntryBookImportForm form = + new EntryBookImportForm(); + form.setLocationRelativeTo(view); form.setVisible(true); Object value = form.getRadioButtons().getSelectedValue(); // if action confirmed if (value != null){ - DefaultEntryBooksEnum defaultEntryBooksEnum = - (DefaultEntryBooksEnum) value; + EntryBooksChartEnum defaultEntryBooksEnum = + (EntryBooksChartEnum) value; ImportExport importExport = ImportExport.getInstance(view); importExport.importExport(ImportExportEnum.LIMA_ENTRYBOOKS_IMPORT, - defaultEntryBooksEnum.getFilePath()); + defaultEntryBooksEnum.getFilePath(), true); } } } catch (LimaException eee) { Deleted: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/DefaultFinancialStatementChartForm.jaxx =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/DefaultFinancialStatementChartForm.jaxx 2010-07-28 09:02:22 UTC (rev 2987) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/DefaultFinancialStatementChartForm.jaxx 2010-07-28 18:53:39 UTC (rev 2988) @@ -1,72 +0,0 @@ -<!-- ##% Lima Swing - Copyright (C) 2008 - 2010 CodeLutin - 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 2 - 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, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - ##% --> - -<JDialog modal="true"> - - <jaxx.runtime.swing.JAXXButtonGroup id="radioButtons" javaBean='new JAXXButtonGroup()'/> - <Boolean id="addState" javaBean='true'/> - - <script> - <![CDATA[ - import org.chorem.lima.ui.financialstatementchart.DefaultFinancialStatementsEnum; - protected void performCancel() { - getRadioButtons().setSelectedValue(null); - dispose(); - } - ]]> - </script> - - <Table> - <row> - <cell><JLabel text='lima.charts.financialstatement.nothing' /></cell> - </row> - <row> - <cell> - <JRadioButton text='lima.charts.financialstatement.shortened' value='{DefaultFinancialStatementsEnum.SHORTENED}' buttonGroup="{getRadioButtons()}" - selected='true'/> - </cell> - </row> - <row> - <cell> - <JRadioButton text='lima.charts.financialstatement.base' value='{DefaultFinancialStatementsEnum.BASE}' buttonGroup="{getRadioButtons()}" - selected='true'/> - </cell> - </row> - <row> - <cell> - <JRadioButton text='lima.charts.financialstatement.developed' value='{DefaultFinancialStatementsEnum.DEVELOPED}' buttonGroup="{getRadioButtons()}" - selected='true'/> - </cell> - </row> - <row> - <cell> - <JRadioButton text='lima.importexport.import' value='{DefaultFinancialStatementsEnum.IMPORT}' buttonGroup="{getRadioButtons()}" - selected='true'/> - </cell> - </row> - <row> - <cell fill="none"> - <JButton text="lima.common.ok" onActionPerformed="dispose()"/> - </cell> - </row> - <row> - <cell fill="none"> - <JButton text="lima.common.cancel" onActionPerformed="performCancel()"/> - </cell> - </row> - </Table> -</JDialog> \ No newline at end of file Deleted: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/DefaultFinancialStatementsEnum.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/DefaultFinancialStatementsEnum.java 2010-07-28 09:02:22 UTC (rev 2987) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/DefaultFinancialStatementsEnum.java 2010-07-28 18:53:39 UTC (rev 2988) @@ -1,21 +0,0 @@ -package org.chorem.lima.ui.financialstatementchart; - -public enum DefaultFinancialStatementsEnum { - - IMPORT(""), SHORTENED(""), BASE(""), DEVELOPED(""); - - private final String filePath; - - private DefaultFinancialStatementsEnum(String filePath) { - this.filePath = filePath; - - } - - public String getFilePath() { - String result = ""; - if (!this.filePath.equals("")){ - result=getClass().getResource("/import/"+this.filePath).getPath(); - } - return result; - } -} Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartView.jaxx =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartView.jaxx 2010-07-28 09:02:22 UTC (rev 2987) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartView.jaxx 2010-07-28 18:53:39 UTC (rev 2988) @@ -64,4 +64,10 @@ enabled="{isSelectedRow()}"/> </cell> </row> + <row> + <cell fill="horizontal"> + <JButton id="importButton" text="lima.importexport.import" + onActionPerformed="getHandler().importFinancialStatementChart()"/> + </cell> + </row> </Table> \ No newline at end of file Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartViewHandler.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartViewHandler.java 2010-07-28 09:02:22 UTC (rev 2987) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartViewHandler.java 2010-07-28 18:53:39 UTC (rev 2988) @@ -23,6 +23,7 @@ import javax.swing.tree.TreePath; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.chorem.lima.beans.FinancialStatementImport; import org.chorem.lima.business.FinancialStatementServiceMonitorable; import org.chorem.lima.business.ImportServiceMonitorable; import org.chorem.lima.business.LimaBusinessException; @@ -30,12 +31,13 @@ import org.chorem.lima.business.ServiceListener; import org.chorem.lima.entity.FinancialStatement; import org.chorem.lima.entity.FinancialStatementImpl; +import org.chorem.lima.enums.FinancialStatementsChartEnum; +import org.chorem.lima.enums.ImportExportEnum; import org.chorem.lima.service.LimaServiceFactory; import org.chorem.lima.ui.MainView; import org.chorem.lima.ui.financialstatementchart.FinancialStatementHeaderForm; import org.chorem.lima.ui.financialstatementchart.FinancialStatementMovementForm; import org.chorem.lima.ui.importexport.ImportExport; -import org.chorem.lima.ui.importexport.ImportExportEnum; import org.chorem.lima.util.DialogHelper; import org.chorem.lima.util.ErrorHelper; import org.jdesktop.swingx.JXTreeTable; @@ -274,22 +276,22 @@ view.repaint(); } - public void defaultFinancialStatementChart(MainView mainView){ + public void importFinancialStatementChart(){ try { if (financialStatementService.getAllFinancialStatements().size() == 0){ - DefaultFinancialStatementChartForm form = - new DefaultFinancialStatementChartForm(); - form.setLocationRelativeTo(mainView); + FinancialStatementImportForm form = + new FinancialStatementImportForm(); + form.setLocationRelativeTo(view); form.setVisible(true); Object value = form.getRadioButtons().getSelectedValue(); // if action confirmed if (value != null){ - DefaultFinancialStatementsEnum defaultFinancialStatementsEnum = - (DefaultFinancialStatementsEnum) value; + FinancialStatementsChartEnum defaultFinancialStatementsEnum = + (FinancialStatementsChartEnum) value; ImportExport importExport = ImportExport.getInstance(view); importExport.importExport(ImportExportEnum.LIMA_FINANCIALSTATEMENTS_IMPORT, - defaultFinancialStatementsEnum.getFilePath()); + defaultFinancialStatementsEnum.getFilePath(), true); } } } catch (LimaException eee) { Copied: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementImportForm.jaxx (from rev 2986, trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/DefaultFinancialStatementChartForm.jaxx) =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementImportForm.jaxx (rev 0) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementImportForm.jaxx 2010-07-28 18:53:39 UTC (rev 2988) @@ -0,0 +1,76 @@ +<!-- ##% Lima Swing + Copyright (C) 2008 - 2010 CodeLutin + 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 2 + 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, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + ##% --> + +<JDialog modal="true"> + + <jaxx.runtime.swing.JAXXButtonGroup id="radioButtons" javaBean='new JAXXButtonGroup()'/> + <Boolean id="addState" javaBean='true'/> + + <script> + <![CDATA[ + import org.chorem.lima.enums.FinancialStatementsChartEnum; + protected void performCancel() { + getRadioButtons().setSelectedValue(null); + dispose(); + } + ]]> + </script> + + <Table> + <row> + <cell><JLabel text='lima.charts.financialstatement.nothing' /></cell> + </row> + <row> + <cell> + <JRadioButton text='lima.charts.financialstatement.shortened' value='{FinancialStatementsChartEnum.SHORTENED}' buttonGroup="{getRadioButtons()}" + selected='true'/> + </cell> + </row> + <row> + <cell> + <JRadioButton text='lima.charts.financialstatement.base' value='{FinancialStatementsChartEnum.BASE}' buttonGroup="{getRadioButtons()}" + selected='true'/> + </cell> + </row> + <row> + <cell> + <JRadioButton text='lima.charts.financialstatement.developed' value='{FinancialStatementsChartEnum.DEVELOPED}' buttonGroup="{getRadioButtons()}" + selected='true'/> + </cell> + </row> + <row> + <cell> + <JRadioButton text='lima.importexport.import' value='{FinancialStatementsChartEnum.IMPORT}' buttonGroup="{getRadioButtons()}" + selected='true'/> + </cell> + </row> + <row> + <cell> + <Table> + <row> + <cell fill="none"> + <JButton text="lima.common.cancel" onActionPerformed="performCancel()"/> + </cell> + <cell fill="none"> + <JButton text="lima.common.ok" onActionPerformed="dispose()"/> + </cell> + </row> + </Table> + </cell> + </row> + </Table> +</JDialog> \ No newline at end of file Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/AddPeriod.jaxx =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/AddPeriod.jaxx 2010-07-28 09:02:22 UTC (rev 2987) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/AddPeriod.jaxx 2010-07-28 18:53:39 UTC (rev 2988) @@ -55,27 +55,14 @@ endDate = DateUtils.addDays(endDate, -1); getEndDatePicker().setDate(endDate); + protected void performOk() { if (period == null) { // FIXME never ever use IMPL !!! setPeriod(new FiscalPeriodImpl()); } - - // get begin date - beginDate = beginDatePicker.getDate(); - // set begindate to 0:00.000 - beginDate = DateUtils.truncate(beginDate, Calendar.DATE); - - // get end date - endDate = endDatePicker.getDate(); - //set time to max 23:59.999 - endDate = DateUtils.addDays(endDate, 1); - endDate = DateUtils.truncate(endDate, Calendar.DATE); - endDate = DateUtils.addMilliseconds(endDate,-1); - - getPeriod().setBeginDate(beginDate); - getPeriod().setEndDate(endDate); - + getPeriod().setBeginDate(beginDatePicker.getDate()); + getPeriod().setEndDate(endDatePicker.getDate()); dispose(); } Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodViewHandler.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodViewHandler.java 2010-07-28 09:02:22 UTC (rev 2987) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodViewHandler.java 2010-07-28 18:53:39 UTC (rev 2988) @@ -60,7 +60,6 @@ addPeriodDialog.setVisible(true); FiscalPeriod fiscalPeriod = addPeriodDialog.getPeriod(); - log.debug(fiscalPeriod); // null = cancel if (fiscalPeriod!= null) { //check if fiscalperiod have 12 months, ask a confirmation Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/identity/IdentityHandler.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/identity/IdentityHandler.java 2010-07-28 09:02:22 UTC (rev 2987) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/identity/IdentityHandler.java 2010-07-28 18:53:39 UTC (rev 2988) @@ -30,7 +30,7 @@ public class IdentityHandler { protected IdentityService identityService; - + private static final Log log = LogFactory.getLog(IdentityHandler.class); @@ -65,5 +65,4 @@ } } } - } 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 2010-07-28 09:02:22 UTC (rev 2987) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java 2010-07-28 18:53:39 UTC (rev 2988) @@ -33,11 +33,14 @@ import java.util.concurrent.ExecutionException; import javax.swing.JFileChooser; import javax.swing.SwingWorker; +import javax.swing.text.StyledEditorKit.BoldAction; + import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.lima.business.ExportServiceMonitorable; import org.chorem.lima.business.ImportServiceMonitorable; import org.chorem.lima.business.LimaException; +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; @@ -82,12 +85,13 @@ * Call the appropriate methode in business service * @param importExportMethode */ - public void importExport(ImportExportEnum importExportMethode, String file){ + public void importExport(ImportExportEnum importExportMethode, String file, Boolean verbose){ final ImportExportEnum importExportMethodeF = importExportMethode; if (file.equals("")){ file = chooseFile(importExportMethode.getImportMode()); } final String filePath = file; + final Boolean verboseMode = verbose; new SwingWorker<String,Void>() { @Override protected String doInBackground() throws LimaException { String charset = "UTF-8"; @@ -158,13 +162,15 @@ //hidde wait dialog panel waitView.setVisible(false); // display result dialog - String result = get(); - if (!result.equals("")){ - DialogHelper.showReportDialog(result, _("lima.importexport.import"), viewComponent); - } - else { - DialogHelper.showMessageDialog(_("lima.importexport.import.terminated")); - } + if (verboseMode){ + String result = get(); + if (!result.equals("")){ + DialogHelper.showReportDialog(result, _("lima.importexport.import"), viewComponent); + } + else { + DialogHelper.showMessageDialog(_("lima.importexport.import.terminated")); + } + } } catch (InterruptedException eeeIE) { if (log.isDebugEnabled()){ log.debug("Can't get result message", eeeIE); Deleted: trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExportEnum.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExportEnum.java 2010-07-28 09:02:22 UTC (rev 2987) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExportEnum.java 2010-07-28 18:53:39 UTC (rev 2988) @@ -1,24 +0,0 @@ -package org.chorem.lima.ui.importexport; - - -/** - * Boolean importMode define if it's a import (true) or an export (false) - * - */ -public enum ImportExportEnum { - LIMA_ALL_EXPORT(false), LIMA_ALL_IMPORT(true), - LIMA_ACCOUNTCHARTS_EXPORT(false), LIMA_ENTRYBOOKS_EXPORT(false), LIMA_FINANCIALSTATEMENTS_EXPORT(false), - LIMA_ACCOUNTCHARTS_IMPORT(true), LIMA_ENTRYBOOKS_IMPORT(true), LIMA_FINANCIALSTATEMENTS_IMPORT(true), - EBP_ACCOUNTCHARTS_EXPORT(false), EBP_ENTRIES_EXPORT(false), - EBP_ACCOUNTCHARTS_IMPORT(true), EBP_ENTRIES_IMPORT(true); - - private final Boolean importMode; - - private ImportExportEnum(Boolean importMode) { - this.importMode = importMode; - } - - public Boolean getImportMode() { - return this.importMode; - } -} Added: 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 (rev 0) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateAccountsPanel.jaxx 2010-07-28 18:53:39 UTC (rev 2988) @@ -0,0 +1,62 @@ +<!-- ##% Lima Swing + Copyright (C) 2008 - 2010 CodeLutin + 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 2 + 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, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + ##% --> + +<JPanel> + <jaxx.runtime.swing.JAXXButtonGroup id="radioButtons" javaBean='new JAXXButtonGroup()'/> + + + <script> + <![CDATA[ + import org.chorem.lima.enums.AccountsChartEnum; + ]]> + </script> + <Table> + <row> + <cell><JLabel text='lima.opening.accounts' /></cell> + </row> + <row> + <cell> + <JRadioButton text='lima.charts.account.shortened' value='{AccountsChartEnum.SHORTENED}' buttonGroup="{getRadioButtons()}" + selected='true'/> + </cell> + </row> + <row> + <cell> + <JRadioButton text='lima.charts.account.base' value='{AccountsChartEnum.BASE}' buttonGroup="{getRadioButtons()}" + selected='true'/> + </cell> + </row> + <row> + <cell> + <JRadioButton text='lima.charts.account.developed' value='{AccountsChartEnum.DEVELOPED}' buttonGroup="{getRadioButtons()}" + selected='true'/> + </cell> + </row> + <row> + <cell> + <JRadioButton text='lima.importexport.importcsv' value='{AccountsChartEnum.IMPORT}' buttonGroup="{getRadioButtons()}" + selected='true'/> + </cell> + </row> + <row> + <cell> + <JRadioButton text='lima.importexport.importebp' value='{AccountsChartEnum.IMPORTEBP}' buttonGroup="{getRadioButtons()}" + selected='true'/> + </cell> + </row> + </Table> +</JPanel> \ No newline at end of file Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateAccountsPanel.jaxx ___________________________________________________________________ Added: svn:executable + * Added: 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 (rev 0) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateEntryBookPanel.jaxx 2010-07-28 18:53:39 UTC (rev 2988) @@ -0,0 +1,33 @@ +<!-- ##% Lima Swing + Copyright (C) 2008 - 2010 CodeLutin + 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 2 + 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, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + ##% --> + +<JPanel> + <script> + <![CDATA[ + ]]> + </script> + <Table> + <row> + <cell><JLabel text='lima.opening.entrybook' /></cell> + </row> + <row> + <cell> + <JCheckBox id='importEntryBook' text='lima.import.journal' selected='false'/> + </cell> + </row> + </Table> +</JPanel> \ No newline at end of file Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateEntryBookPanel.jaxx ___________________________________________________________________ Added: svn:executable + * Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateFiscalPeriodPanel.jaxx =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateFiscalPeriodPanel.jaxx (rev 0) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateFiscalPeriodPanel.jaxx 2010-07-28 18:53:39 UTC (rev 2988) @@ -0,0 +1,80 @@ +<!-- ##% Lima Swing + Copyright (C) 2008 - 2010 CodeLutin + 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 2 + 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, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + ##% --> +<JPanel> + <script> + <![CDATA[ + import org.chorem.lima.entity.FiscalPeriod; + import org.chorem.lima.business.FiscalPeriodServiceMonitorable; + import org.chorem.lima.service.LimaServiceFactory; + import org.chorem.lima.business.LimaException; + import org.apache.commons.lang.time.DateUtils; + + protected FiscalPeriodServiceMonitorable fiscalPeriodService = + LimaServiceFactory.getInstance().getService( + FiscalPeriodServiceMonitorable.class); + + // set begin date picker + Date endDate = null; + Calendar calendarBegin = Calendar.getInstance(); + // set begindate to JAN 1 - 0:00.000 of this years + Date beginDate = calendarBegin.getTime(); + beginDate = DateUtils.truncate(beginDate, Calendar.DATE); + try { + FiscalPeriod result = fiscalPeriodService.getLastFiscalPeriod(); + if (result != null){ + beginDate = result.getEndDate(); + } + } + catch (LimaException eee){ + if(log.isDebugEnabled()){ + log.debug("Can't get last fiscal period", eee); + } + } + beginDate = DateUtils.addDays(beginDate, 1); + getBeginDatePicker().setDate(beginDate); + + // get end date + Calendar calendarEnd = Calendar.getInstance(); + endDate = DateUtils.addYears(beginDate, 1); + endDate = DateUtils.addDays(endDate, -1); + getEndDatePicker().setDate(endDate); + + ]]> + </script> + + <Table fill="both"> + <row> + <cell columns ="3"> + <JLabel text="lima.period.create"/> + </cell> + </row> + <row> + <cell> + <JLabel text="lima.period.begindate"/> + </cell> + <cell> + <org.jdesktop.swingx.JXDatePicker id="beginDatePicker"/> + </cell> + <cell> + <JLabel text="lima.period.enddate"/> + </cell> + <cell> + <org.jdesktop.swingx.JXDatePicker id="endDatePicker"/> + </cell> + </row> + </Table> +</JPanel> \ No newline at end of file Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateFiscalPeriodPanel.jaxx ___________________________________________________________________ Added: svn:executable + * Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateIdentityPanel.jaxx =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateIdentityPanel.jaxx (rev 0) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateIdentityPanel.jaxx 2010-07-28 18:53:39 UTC (rev 2988) @@ -0,0 +1,139 @@ +<!-- ##% Lima Swing + Copyright (C) 2008 - 2010 CodeLutin + 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 2 + 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, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + ##% --> + +<JPanel> + <org.chorem.lima.ui.identity.IdentityHandler id="handler" javaBean="new org.chorem.lima.ui.identity.IdentityHandler()" /> + <org.chorem.lima.entity.Identity id="identity" javaBean='handler.getIdentity()'/> + + <script> + <![CDATA[ + ]]> + </script> +<Table> + <row> + <cell fill="horizontal"> + <JLabel text="lima.identity.name"/> + </cell> + <cell fill="horizontal"> + <JTextField id="nameTextField" text="{getIdentity().getName()}"/> + <javax.swing.text.Document javaBean="getNameTextField().getDocument()" + onInsertUpdate='getIdentity().setName(getNameTextField().getText())' + onRemoveUpdate='getIdentity().setName(getNameTextField().getText())' /> + </cell> + <cell fill="horizontal"> + <JLabel text="lima.identity.description"/> + </cell> + <cell fill="horizontal"> + <JTextField id="descriptionTextField" text="{getIdentity().getDescription()}"/> + <javax.swing.text.Document javaBean="getDescriptionTextField().getDocument()" + onInsertUpdate='getIdentity().setDescription(getDescriptionTextField().getText())' + onRemoveUpdate='getIdentity().setDescription(getDescriptionTextField().getText())' /> + </cell> + </row> + <row> + <cell fill="horizontal"> + <JLabel text="lima.identity.address"/> + </cell> + <cell fill="horizontal"> + <JTextField id="addressTextField" text="{getIdentity().getAddress()}"/> + <javax.swing.text.Document javaBean="getAddressTextField().getDocument()" + onInsertUpdate='getIdentity().setAddress(getAddressTextField().getText())' + onRemoveUpdate='getIdentity().setAddress(getAddressTextField().getText())' /> + </cell> + <cell fill="horizontal"> + <JLabel text="lima.identity.address2"/> + </cell> + <cell fill="horizontal"> + <JTextField id="address2TextField" text="{getIdentity().getAddress2()}"/> + <javax.swing.text.Document javaBean="getAddress2TextField().getDocument()" + onInsertUpdate='getIdentity().setAddress2(getAddress2TextField().getText())' + onRemoveUpdate='getIdentity().setAddress2(getAddress2TextField().getText())' /> + </cell> + </row> + <row> + <cell fill="horizontal"> + <JLabel text="lima.identity.zipCode"/> + </cell> + <cell fill="horizontal"> + <JTextField id="zipCodeTextField" text="{getIdentity().getZipCode()}"/> + <javax.swing.text.Document javaBean="getZipCodeTextField().getDocument()" + onInsertUpdate='getIdentity().setZipCode(getZipCodeTextField().getText())' + onRemoveUpdate='getIdentity().setZipCode(getZipCodeTextField().getText())' /> + </cell> + <cell fill="horizontal"> + <JLabel text="lima.identity.city"/> + </cell> + <cell fill="horizontal"> + <JTextField id="cityTextField" text="{getIdentity().getCity()}"/> + <javax.swing.text.Document javaBean="getCityTextField().getDocument()" + onInsertUpdate='getIdentity().setCity(getCityTextField().getText())' + onRemoveUpdate='getIdentity().setCity(getCityTextField().getText())' /> + </cell> + </row> + <row> + <cell fill="horizontal"> + <JLabel text="lima.identity.businessNumber"/> + </cell> + <cell fill="horizontal"> + <JTextField id="businessNumberTextField" text="{getIdentity().getBusinessNumber()}"/> + <javax.swing.text.Document javaBean="getBusinessNumberTextField().getDocument()" + onInsertUpdate='getIdentity().setBusinessNumber(getBusinessNumberTextField().getText())' + onRemoveUpdate='getIdentity().setBusinessNumber(getBusinessNumberTextField().getText())' /> + </cell> + <cell fill="horizontal"> + <JLabel text="lima.identity.vatNumber"/> + </cell> + <cell fill="horizontal"> + <JTextField id="vatNumberTextField" text="{getIdentity().getVatNumber()}"/> + <javax.swing.text.Document javaBean="getVatNumberTextField().getDocument()" + onInsertUpdate='getIdentity().setVatNumber(getVatNumberTextField().getText())' + onRemoveUpdate='getIdentity().setVatNumber(getVatNumberTextField().getText())' /> + </cell> + </row> + <row> + <cell fill="horizontal"> + <JLabel text="lima.identity.classificationCode"/> + </cell> + <cell fill="horizontal"> + <JTextField id="classificationCodeTextField" text="{getIdentity().getClassificationCode()}"/> + <javax.swing.text.Document javaBean="getClassificationCodeTextField().getDocument()" + onInsertUpdate='getIdentity().setClassificationCode(getClassificationCodeTextField().getText())' + onRemoveUpdate='getIdentity().setClassificationCode(getClassificationCodeTextField().getText())' /> + </cell> + </row> + <row> + <cell fill="horizontal"> + <JLabel text="lima.identity.phoneNumber"/> + </cell> + <cell fill="horizontal"> + <JTextField id="phoneNumberTextField" text="{getIdentity().getPhoneNumber()}"/> + <javax.swing.text.Document javaBean="getPhoneNumberTextField().getDocument()" + onInsertUpdate='getIdentity().setPhoneNumber(getPhoneNumberTextField().getText())' + onRemoveUpdate='getIdentity().setPhoneNumber(getPhoneNumberTextField().getText())' /> + </cell> + <cell fill="horizontal"> + <JLabel text="lima.identity.email"/> + </cell> + <cell fill="horizontal"> + <JTextField id="emailTextField" text="{getIdentity().getEmail()}"/> + <javax.swing.text.Document javaBean="getEmailTextField().getDocument()" + onInsertUpdate='getIdentity().setEmail(getEmailTextField().getText())' + onRemoveUpdate='getIdentity().setEmail(getEmailTextField().getText())' /> + </cell> + </row> + </Table> +</JPanel> \ No newline at end of file Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateIdentityPanel.jaxx ___________________________________________________________________ Added: svn:executable + * Added: 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 (rev 0) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/OpeningView.jaxx 2010-07-28 18:53:39 UTC (rev 2988) @@ -0,0 +1,73 @@ +<!-- ##% Lima Swing + Copyright (C) 2008 - 2010 CodeLutin + 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 2 + 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, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + ##% --> + +<JDialog modal="true"> + <OpeningViewHandler id="handler" javaBean="new OpeningViewHandler(this)" /> + + <script> + <![CDATA[ + import javax.swing.BorderFactory; + getRootPane().setDefaultButton(ok); + protected void performNext() { + dispose(); + } + protected void performCancel() { + dispose(); + } + ]]> + </script> + + <Table> + <row weighty="0.9"> + <cell columns="3" fill="both"> + <Table> + <row> + <cell weightx="0.1"><JLabel id='identityIcon' + icon='{new ImageIcon(getClass().getResource("/images/identity.png"))}'/></cell> + <cell weightx="0.9" rows="4" fill="both"> + <JPanel id='panel'> + <JLabel text='lima.opening.welcome' /> + </JPanel> + </cell> + </row> + <row> + <cell><JLabel id='accountsIcon' + icon='{new ImageIcon(getClass().getResource("/images/accounts.png"))}'/></cell> + </row> + <row> + <cell><JLabel id='entrybooksIcon' + icon='{new ImageIcon(getClass().getResource("/images/entrybooks.png"))}'/></cell> + </row> + <row> + <cell><JLabel id='fiscalperiodsIcon' + icon='{new ImageIcon(getClass().getResource("/images/fiscalperiods.png"))}'/></cell> + </row> + </Table> + </cell> + </row> + <row weighty="0.1"> + <cell weightx="0.8"><JLabel text=''/> + </cell> + <cell weightx="0.1" fill="none"> + <JButton text="lima.common.cancel" onActionPerformed="performCancel()"/> + </cell> + <cell weightx="0.1" fill="none"> + <JButton id="ok" text="lima.common.next" onActionPerformed="handler.next()"/> + </cell> + </row> + </Table> +</JDialog> \ No newline at end of file Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/OpeningView.jaxx ___________________________________________________________________ Added: svn:executable + * Added: 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 (rev 0) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/OpeningViewHandler.java 2010-07-28 18:53:39 UTC (rev 2988) @@ -0,0 +1,168 @@ +package org.chorem.lima.ui.opening; +/* *##% Lima Swing + * Copyright (C) 2008 - 2010 CodeLutin + * + * 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 2 + * 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * ##%*/ + +import static org.nuiton.i18n.I18n._; + +import java.awt.Color; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import javax.swing.border.Border; +import javax.swing.border.EmptyBorder; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.chorem.lima.business.FiscalPeriodServiceMonitorable; +import org.chorem.lima.business.LimaException; +import org.chorem.lima.entity.FiscalPeriod; +import org.chorem.lima.entity.FiscalPeriodImpl; +import org.chorem.lima.enums.AccountsChartEnum; +import org.chorem.lima.enums.EntryBooksChartEnum; +import org.chorem.lima.enums.FinancialStatementsChartEnum; +import org.chorem.lima.enums.ImportExportEnum; +import org.chorem.lima.service.LimaServiceFactory; +import org.chorem.lima.ui.identity.IdentityHandler; +import org.chorem.lima.ui.importexport.ImportExport; + +public class OpeningViewHandler { + + private static final Log log = LogFactory.getLog(OpeningViewHandler.class); + + private static Border noBorder = new EmptyBorder(0,0,0,0); + private static Color green = new Color(0x66, 0xcc, 0x00); + + protected int step; + protected OpeningView view; + + //Panels + private CreateAccountsPanel caPanel; + private CreateIdentityPanel idPanel; + private CreateEntryBookPanel ebPanel; + private CreateFiscalPeriodPanel fsPanel; + + public OpeningViewHandler(OpeningView view) { + this.view = view; + caPanel = new CreateAccountsPanel(); + idPanel = new CreateIdentityPanel(); + ebPanel = new CreateEntryBookPanel(); + fsPanel = new CreateFiscalPeriodPanel(); + step = 0; + } + + public void next(){ + ImportExport importExport = ImportExport.getInstance(view); + JPanel panel = view.getPanel(); + panel.removeAll(); + switch (step) { + case 0: + //refresh UI + view.getIdentityIcon().setBorder(BorderFactory.createLineBorder(green, 2)); + panel.add(idPanel); + panel.validate(); + view.repaint(); + step++; + break; + case 1: + IdentityHandler identityHandler = new IdentityHandler(); + identityHandler.updateIdentity(idPanel.getIdentity()); + //refresh UI + view.getIdentityIcon().setBorder(noBorder); + view.getAccountsIcon().setBorder(BorderFactory.createLineBorder(green, 2)); + panel.add(caPanel); + panel.validate(); + view.repaint(); + step++; + break; + + case 2 : + Object value = caPanel.getRadioButtons().getSelectedValue(); + // if action confirmed + if (value != null){ + AccountsChartEnum defaultAccountsChartEnum = + (AccountsChartEnum) value; + //Import accounts chart + switch (defaultAccountsChartEnum) { + case IMPORTEBP: + importExport.importExport(ImportExportEnum.EBP_ACCOUNTCHARTS_IMPORT, + defaultAccountsChartEnum.getFilePath(), false); + break; + + default: + importExport.importExport(ImportExportEnum.LIMA_ACCOUNTCHARTS_IMPORT, + defaultAccountsChartEnum.getFilePath(), false); + break; + } + //Import financialstatement + switch (defaultAccountsChartEnum) { + case SHORTENED: + importExport.importExport(ImportExportEnum.LIMA_FINANCIALSTATEMENTS_IMPORT, + FinancialStatementsChartEnum.SHORTENED.getFilePath(), false); + break; + case DEVELOPED: + importExport.importExport(ImportExportEnum.LIMA_FINANCIALSTATEMENTS_IMPORT, + FinancialStatementsChartEnum.DEVELOPED.getFilePath(), false); + break; + default: + importExport.importExport(ImportExportEnum.LIMA_FINANCIALSTATEMENTS_IMPORT, + FinancialStatementsChartEnum.BASE.getFilePath(), false); + break; + } + } + view.getAccountsIcon().setBorder(noBorder); + view.getEntrybooksIcon().setBorder(BorderFactory.createLineBorder(green, 2)); + panel.add(ebPanel); + panel.validate(); + view.repaint(); + step++; + break; + + case 3 : + if (ebPanel.getImportEntryBook().isSelected()){ + importExport.importExport(ImportExportEnum.LIMA_ENTRYBOOKS_IMPORT, + EntryBooksChartEnum.DEFAULT.getFilePath(), false); + } + view.getEntrybooksIcon().setBorder(noBorder); + view.getFiscalperiodsIcon().setBorder(BorderFactory.createLineBorder(green, 2)); + panel.add(fsPanel); + panel.validate(); + view.getOk().setText(_("lima.common.fin")); + view.repaint(); + step++; + break; + case 4 : + try { + FiscalPeriod fiscalPeriod = new FiscalPeriodImpl(); + fiscalPeriod.setBeginDate(fsPanel.getBeginDatePicker().getDate()); + fiscalPeriod.setEndDate(fsPanel.getEndDatePicker().getDate()); + + LimaServiceFactory.getInstance().getService( + FiscalPeriodServiceMonitorable.class). + createFiscalPeriod(fiscalPeriod); + + } catch (LimaException e) { + if (log.isDebugEnabled()){ + log.debug("Can't create fiscal period"); + } + } + view.dispose(); + } + } + + +} 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 2010-07-28 09:02:22 UTC (rev 2987) +++ trunk/lima-swing/src/main/resources/i18n/lima-swing-en_GB.properties 2010-07-28 18:53:39 UTC (rev 2988) @@ -4,6 +4,7 @@ Global\ lima\ exception= LIMA= Loading\ accounting...= +blabla= export= hello\ world= import= @@ -43,7 +44,10 @@ lima.common.add= lima.common.addSubLedger= lima.common.cancel= +lima.common.fin= +lima.common.import= lima.common.importexport=Import/Export +lima.common.next= lima.common.ok= lima.common.print= lima.common.quit= @@ -126,6 +130,8 @@ lima.importexport.financialstatements= lima.importexport.import=Import lima.importexport.import.terminated= +lima.importexport.importcsv= +lima.importexport.importebp= lima.importexport.lima= lima.importexport.wait= lima.init.closed=Lima closed at %1$s @@ -151,7 +157,11 @@ lima.misc.supportemail.description= lima.open=Open lima.openejb.remotemode.description= +lima.opening.accounts= +lima.opening.entrybook= +lima.opening.welcome= lima.period.begindate= +lima.period.create= lima.period.enddate= lima.preferences=Preferences lima.question=Question @@ -209,6 +219,7 @@ lima.transaction.period=Period lima.voucher=Voucher lima.warning.nimbus.landf=Could not find Numbus Look&Feel +lima.welcome= limahome.chartaccounts.create= limahome.chartaccounts.modify= limahome.chartaccounts.nothing= 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 2010-07-28 09:02:22 UTC (rev 2987) +++ trunk/lima-swing/src/main/resources/i18n/lima-swing-fr_FR.properties 2010-07-28 18:53:39 UTC (rev 2988) @@ -4,9 +4,9 @@ Global\ lima\ exception= LIMA= Loading\ accounting...= +blabla= export= hello\ world= -import= lima.about.message=\u00C0 propos de Lima lima.account=Compte lima.account.label= @@ -27,7 +27,6 @@ lima.charts.account=Plan comptable lima.charts.account.base=Plan comptable de base lima.charts.account.developed=Plan comptable d\u00E9velopp\u00E9 -lima.charts.account.nothing=<html><center>Aucun plan comptable charg\u00E9<br/>Veuillez s\u00E9lectionner un plan par d\u00E9fault, <br/>importer un plan personnalis\u00E9<br/> ou annuler pour cr\u00E9er votre propre plan.</center></html> lima.charts.account.shortened=Plan comptable abr\u00E9g\u00E9 lima.charts.entrybook=Journaux lima.charts.entrybook.default=Journaux par d\u00E9fault @@ -43,7 +42,9 @@ lima.common.add=Ajout Compte G\u00E9n\u00E9ral lima.common.addSubLedger=Ajouter Compte Tiers lima.common.cancel=Annuler +lima.common.fin=Termin\u00E9 lima.common.importexport=Importer/Exporter +lima.common.next=Suivant lima.common.ok=OK lima.common.print= lima.common.quit=Quitter @@ -111,12 +112,7 @@ lima.identity.phoneNumber=n\u00B0 Tel lima.identity.vatNumber=n\u00B0 TVA lima.identity.zipCode=Code Postal -lima.import=Import -lima.import.account=Importer le PCG -lima.import.all=Importer une nouvelle base (XML) -lima.import.all.csv=Importer une nouvelle base (CSV) -lima.import.all.csv.ebp=Importer des donn\u00E9es de EBP -lima.import.journal=Importer le journal +lima.import.journal= lima.importexport.accountcharts=Plan des comptes lima.importexport.all=Tout lima.importexport.ebp=Import/Export EBP @@ -126,6 +122,8 @@ lima.importexport.financialstatements=Plan BCR lima.importexport.import=Import lima.importexport.import.terminated=Import termin\u00E9 +lima.importexport.importcsv= +lima.importexport.importebp= lima.importexport.lima=Import/Export Lima lima.importexport.wait=Traitement en cours \u2026 lima.init.closed=Lima ferm\u00E9 \u00E0 %1$s @@ -151,7 +149,11 @@ lima.misc.supportemail.description= lima.open=Ouvert lima.openejb.remotemode.description= +lima.opening.accounts=<html><center>Aucun plan comptable charg\u00E9<br/>Veuillez s\u00E9lectionner un plan par d\u00E9fault, <br/>importer un plan personnalis\u00E9<br/> ou annuler pour cr\u00E9er votre propre plan.</center></html> +lima.opening.entrybook=<html>Cochez la case pour importer les journaux par d\u00E9faut \:<br/> Achats, Ventes, Tr\u00E9sorerie, Op\u00E9ration diverses</html> +lima.opening.welcome=<html><center>Bienvenue dans Lima<br/>Laissez vous guider par cet assistant pour d\u00E9marrer votre comptabilit\u00E9 en quelques instants\u0085</center></html> lima.period.begindate=D\u00E9but +lima.period.create=Choisissez la date de d\u00E9but et de fin du nouvel exercice lima.period.enddate=Fin lima.preferences=Pr\u00E9f\u00E9rences lima.question=Question Added: trunk/lima-swing/src/main/resources/images/identity.png =================================================================== (Binary files differ) Property changes on: trunk/lima-swing/src/main/resources/images/identity.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/lima-swing/src/main/resources/import/eb_default.csv =================================================================== --- trunk/lima-swing/src/main/resources/import/eb_default.csv (rev 0) +++ trunk/lima-swing/src/main/resources/import/eb_default.csv 2010-07-28 18:53:39 UTC (rev 2988) @@ -0,0 +1,4 @@ +"ENBK";"ACH";"Journal des achats";"Achats" +"ENBK";"VTE";"Journal des ventes";"Ventes" +"ENBK";"ODT";"Journal des opérations diverses";"Général" +"ENBK";"BQE";"Journal de trésorerie";"Trésorerie"