Lima-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
April 2012
- 2 participants
- 49 discussions
Author: echatellier
Date: 2012-04-18 10:42:09 +0200 (Wed, 18 Apr 2012)
New Revision: 3377
Url: http://chorem.org/repositories/revision/lima/3377
Log:
Remove Monitorable interfaces
Removed:
trunk/lima-business/src/main/java/org/chorem/lima/business/monitorable/
Modified:
trunk/lima-business/src/test/java/org/chorem/lima/business/AbstractLimaTest.java
trunk/lima-swing/src/main/java/org/chorem/lima/LimaConfig.java
trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/AccountComboBoxModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/EntryBookComboBoxModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FinancialPeriodComboBoxModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FiscalPeriodComboBoxModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/LeafAccountComboBoxModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartTreeTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/AccountsPane.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/EntryBooksPane.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/FinancialTransactionsPane.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/FiscalPeriodsPane.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/java/org/chorem/lima/ui/ledger/LedgerViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateFiscalPeriodPanel.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/OpeningViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartTreeTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportViewHandler.java
Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/AbstractLimaTest.java
===================================================================
--- trunk/lima-business/src/test/java/org/chorem/lima/business/AbstractLimaTest.java 2012-04-18 08:14:53 UTC (rev 3376)
+++ trunk/lima-business/src/test/java/org/chorem/lima/business/AbstractLimaTest.java 2012-04-18 08:42:09 UTC (rev 3377)
@@ -23,6 +23,15 @@
package org.chorem.lima.business;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.math.BigDecimal;
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.util.Locale;
+import java.util.Properties;
+
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.logging.Log;
@@ -37,14 +46,6 @@
import org.chorem.lima.business.api.ImportService;
import org.chorem.lima.business.api.ReportService;
import org.chorem.lima.business.ejb.ClearService;
-import org.chorem.lima.business.ejb.ClearServiceMonitorable;
-import org.chorem.lima.business.monitorable.AccountServiceMonitorable;
-import org.chorem.lima.business.monitorable.EntryBookServiceMonitorable;
-import org.chorem.lima.business.monitorable.FinancialPeriodServiceMonitorable;
-import org.chorem.lima.business.monitorable.FinancialTransactionServiceMonitorable;
-import org.chorem.lima.business.monitorable.FiscalPeriodServiceMonitorable;
-import org.chorem.lima.business.monitorable.ImportServiceMonitorable;
-import org.chorem.lima.business.monitorable.ReportServiceMonitorable;
import org.chorem.lima.entity.Account;
import org.chorem.lima.entity.AccountImpl;
import org.chorem.lima.entity.Entry;
@@ -67,15 +68,6 @@
import org.nuiton.topia.TopiaNotFoundException;
import org.nuiton.topia.TopiaRuntimeException;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.math.BigDecimal;
-import java.text.DateFormat;
-import java.text.ParseException;
-import java.util.Locale;
-import java.util.Properties;
-
/**
* Common initialization code for all lima tests.
*
@@ -123,14 +115,14 @@
* @throws IOException
*/
protected static void initServices() throws IOException {
- clearService = LimaServiceFactory.getService(ClearServiceMonitorable.class);
- accountService = LimaServiceFactory.getService(AccountServiceMonitorable.class);
- entryBookService = LimaServiceFactory.getService(EntryBookServiceMonitorable.class);
- financialPeriodService = LimaServiceFactory.getService(FinancialPeriodServiceMonitorable.class);
- financialTransactionService = LimaServiceFactory.getService(FinancialTransactionServiceMonitorable.class);
- fiscalPeriodService = LimaServiceFactory.getService(FiscalPeriodServiceMonitorable.class);
- reportService = LimaServiceFactory.getService(ReportServiceMonitorable.class);
- importService = LimaServiceFactory.getService(ImportServiceMonitorable.class);
+ clearService = LimaServiceFactory.getService(ClearService.class);
+ accountService = LimaServiceFactory.getService(AccountService.class);
+ entryBookService = LimaServiceFactory.getService(EntryBookService.class);
+ financialPeriodService = LimaServiceFactory.getService(FinancialPeriodService.class);
+ financialTransactionService = LimaServiceFactory.getService(FinancialTransactionService.class);
+ fiscalPeriodService = LimaServiceFactory.getService(FiscalPeriodService.class);
+ reportService = LimaServiceFactory.getService(ReportService.class);
+ importService = LimaServiceFactory.getService(ImportService.class);
}
/**
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/LimaConfig.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/LimaConfig.java 2012-04-18 08:14:53 UTC (rev 3376)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/LimaConfig.java 2012-04-18 08:42:09 UTC (rev 3377)
@@ -39,7 +39,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.actions.MiscAction;
-import org.chorem.lima.business.monitorable.OptionsServiceMonitorable;
+import org.chorem.lima.business.api.OptionsService;
import org.chorem.lima.entity.LimaCallaoDAOHelper;
import org.chorem.lima.service.LimaServiceFactory;
import org.nuiton.topia.TopiaContextFactory;
@@ -67,7 +67,7 @@
private static final String configFile = "lima-config.properties";
- protected OptionsServiceMonitorable optionsService;
+ protected OptionsService optionsService;
/** La version du logiciel. */
protected Version version;
@@ -504,7 +504,7 @@
super.save(file, forceAll, excludeKeys);
// propagate scale option to serveur option
- optionsService = LimaServiceFactory.getService(OptionsServiceMonitorable.class);
+ optionsService = LimaServiceFactory.getService(OptionsService.class);
// scale server option
String scaleOption = getOption("scale");
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java 2012-04-18 08:14:53 UTC (rev 3376)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java 2012-04-18 08:42:09 UTC (rev 3377)
@@ -25,26 +25,27 @@
package org.chorem.lima;
+import static org.nuiton.i18n.I18n._;
+
+import java.util.Arrays;
+import java.util.Date;
+
+import javax.swing.JOptionPane;
+import javax.swing.SwingUtilities;
+
import jaxx.runtime.SwingUtil;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.LimaBusinessException;
import org.chorem.lima.business.api.AccountService;
-import org.chorem.lima.business.monitorable.AccountServiceMonitorable;
-import org.chorem.lima.business.monitorable.HttpServerServiceMonitorable;
+import org.chorem.lima.business.api.HttpServerService;
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.util.ErrorHelper;
-import javax.swing.JOptionPane;
-import javax.swing.SwingUtilities;
-import java.util.Arrays;
-import java.util.Date;
-
-import static org.nuiton.i18n.I18n._;
-
/**
* Lima GUI main class.
*
@@ -169,10 +170,9 @@
splash.updateProgression(0.7, _("lima.splash.2"));
//start http server
- LimaServiceFactory.getService(HttpServerServiceMonitorable.class).start();
+ LimaServiceFactory.getService(HttpServerService.class).start();
- AccountService accountService =
- LimaServiceFactory.getService(AccountServiceMonitorable.class);
+ AccountService accountService = LimaServiceFactory.getService(AccountService.class);
long accountCount = accountService.getAccountCount();
if (accountCount == 0) {
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 2012-04-18 08:14:53 UTC (rev 3376)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java 2012-04-18 08:42:09 UTC (rev 3377)
@@ -25,16 +25,28 @@
package org.chorem.lima.ui;
+import static org.nuiton.i18n.I18n._;
+
+import java.awt.Component;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.net.URL;
+import java.util.Locale;
+
+import javax.swing.JButton;
+import javax.swing.JTabbedPane;
+
import jaxx.runtime.JAXXContext;
import jaxx.runtime.SwingUtil;
import jaxx.runtime.swing.AboutPanel;
import jaxx.runtime.swing.editor.config.ConfigUIHelper;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.LimaConfig;
import org.chorem.lima.LimaContext;
import org.chorem.lima.business.LimaRuntimeException;
-import org.chorem.lima.business.monitorable.HttpServerServiceMonitorable;
+import org.chorem.lima.business.api.HttpServerService;
import org.chorem.lima.enums.ImportExportEnum;
import org.chorem.lima.service.LimaServiceFactory;
import org.chorem.lima.ui.account.AccountView;
@@ -56,19 +68,8 @@
import org.chorem.lima.ui.lettering.LetteringView;
import org.chorem.lima.ui.vatchart.VatChartView;
import org.chorem.lima.ui.vatreports.VatReportView;
-import org.chorem.lima.util.ErrorHelper;
import org.nuiton.util.DesktopUtil;
-import javax.swing.JButton;
-import javax.swing.JTabbedPane;
-import java.awt.Component;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.net.URL;
-import java.util.Locale;
-
-import static org.nuiton.i18n.I18n._;
-
/**
* Handler for main view.
* <p/>
@@ -445,7 +446,7 @@
public void loadURI(MainView ui) {
int port = LimaServiceFactory.getService(
- HttpServerServiceMonitorable.class).getHttpPort();
+ HttpServerService.class).getHttpPort();
String address = LimaConfig.getInstance().getHostAdress();
String url = "http://" + address + ":" + port + "/";
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsViewHandler.java 2012-04-18 08:14:53 UTC (rev 3376)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsViewHandler.java 2012-04-18 08:42:09 UTC (rev 3377)
@@ -25,26 +25,25 @@
package org.chorem.lima.ui.accountsreports;
+import static org.nuiton.i18n.I18n._;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.beans.ReportsDatas;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.business.LimaRuntimeException;
import org.chorem.lima.business.ServiceListener;
-import org.chorem.lima.business.monitorable.FinancialTransactionServiceMonitorable;
-import org.chorem.lima.business.monitorable.ImportServiceMonitorable;
-import org.chorem.lima.business.monitorable.ReportServiceMonitorable;
+import org.chorem.lima.business.api.FinancialTransactionService;
+import org.chorem.lima.business.api.ImportService;
+import org.chorem.lima.business.api.ReportService;
import org.chorem.lima.entity.Account;
import org.chorem.lima.service.LimaServiceFactory;
import org.chorem.lima.ui.combobox.AccountComboBoxModel;
-import org.chorem.lima.util.ErrorHelper;
-import java.math.BigDecimal;
-import java.util.Date;
-import static org.nuiton.i18n.I18n._;
-
-
/**
* Handler associated with accounts reports view.
* By : $Author$
@@ -72,17 +71,14 @@
protected Date selectedEndDate;
/** Services. */
- protected ReportServiceMonitorable reportService;
+ protected ReportService reportService;
protected AccountsReportsViewHandler(AccountsReportsView view) {
this.view = view;
- reportService =
- LimaServiceFactory.getService(ReportServiceMonitorable.class);
- LimaServiceFactory.addServiceListener(
- ImportServiceMonitorable.class, this);
- LimaServiceFactory.addServiceListener(
- FinancialTransactionServiceMonitorable.class, this);
+ reportService = LimaServiceFactory.getService(ReportService.class);
+ LimaServiceFactory.addServiceListener(ImportService.class, this);
+ LimaServiceFactory.addServiceListener(FinancialTransactionService.class, this);
}
public void setBeginDate(Date date) {
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceViewHandler.java 2012-04-18 08:14:53 UTC (rev 3376)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceViewHandler.java 2012-04-18 08:42:09 UTC (rev 3377)
@@ -25,25 +25,8 @@
package org.chorem.lima.ui.balance;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.chorem.lima.LimaConfig;
-import org.chorem.lima.beans.BalanceTrial;
-import org.chorem.lima.business.LimaException;
-import org.chorem.lima.business.LimaRuntimeException;
-import org.chorem.lima.business.ServiceListener;
-import org.chorem.lima.business.monitorable.FinancialTransactionServiceMonitorable;
-import org.chorem.lima.business.monitorable.FiscalPeriodServiceMonitorable;
-import org.chorem.lima.business.monitorable.HttpServerServiceMonitorable;
-import org.chorem.lima.business.monitorable.ImportServiceMonitorable;
-import org.chorem.lima.business.monitorable.ReportServiceMonitorable;
-import org.chorem.lima.business.utils.DocumentsEnum;
-import org.chorem.lima.business.utils.FormatsEnum;
-import org.chorem.lima.entity.FiscalPeriod;
-import org.chorem.lima.service.LimaServiceFactory;
-import org.chorem.lima.util.ErrorHelper;
+import static org.nuiton.i18n.I18n._;
-import javax.swing.JOptionPane;
import java.awt.Desktop;
import java.io.IOException;
import java.math.BigDecimal;
@@ -54,9 +37,26 @@
import java.util.Date;
import java.util.List;
-import static org.nuiton.i18n.I18n._;
+import javax.swing.JOptionPane;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.chorem.lima.LimaConfig;
+import org.chorem.lima.beans.BalanceTrial;
+import org.chorem.lima.business.LimaException;
+import org.chorem.lima.business.LimaRuntimeException;
+import org.chorem.lima.business.ServiceListener;
+import org.chorem.lima.business.api.FinancialTransactionService;
+import org.chorem.lima.business.api.FiscalPeriodService;
+import org.chorem.lima.business.api.HttpServerService;
+import org.chorem.lima.business.api.ImportService;
+import org.chorem.lima.business.api.ReportService;
+import org.chorem.lima.business.utils.DocumentsEnum;
+import org.chorem.lima.business.utils.FormatsEnum;
+import org.chorem.lima.entity.FiscalPeriod;
+import org.chorem.lima.service.LimaServiceFactory;
+
/**
* Handler associated with accounts reports view.
* By : $Author$
@@ -69,11 +69,11 @@
private static final Log log = LogFactory.getLog(BalanceViewHandler.class);
/** Services. */
- protected ReportServiceMonitorable reportService;
+ protected ReportService reportService;
- protected HttpServerServiceMonitorable httpServerServiceMonitorable;
+ protected HttpServerService httpServerServiceMonitorable;
- protected FiscalPeriodServiceMonitorable fiscalPeriodService;
+ protected FiscalPeriodService fiscalPeriodService;
/** DatePicker Begin Date. */
protected Date selectedBeginDate;
@@ -96,15 +96,12 @@
protected BalanceViewHandler(BalanceView view) {
this.view = view;
- reportService =
- LimaServiceFactory.getService(ReportServiceMonitorable.class);
- port = LimaServiceFactory.getService(
- HttpServerServiceMonitorable.class).getHttpPort();
+ reportService = LimaServiceFactory.getService(ReportService.class);
+ port = LimaServiceFactory.getService(HttpServerService.class).getHttpPort();
fiscalPeriodService =
- LimaServiceFactory.getService(
- FiscalPeriodServiceMonitorable.class);
- LimaServiceFactory.addServiceListener(ImportServiceMonitorable.class, this);
- LimaServiceFactory.addServiceListener(FinancialTransactionServiceMonitorable.class, this);
+ LimaServiceFactory.getService(FiscalPeriodService.class);
+ LimaServiceFactory.addServiceListener(ImportService.class, this);
+ LimaServiceFactory.addServiceListener(FinancialTransactionService.class, this);
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/AccountComboBoxModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/AccountComboBoxModel.java 2012-04-18 08:14:53 UTC (rev 3376)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/AccountComboBoxModel.java 2012-04-18 08:42:09 UTC (rev 3377)
@@ -25,20 +25,20 @@
package org.chorem.lima.ui.combobox;
+import java.util.List;
+
+import javax.swing.AbstractListModel;
+import javax.swing.ComboBoxModel;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.business.ServiceListener;
import org.chorem.lima.business.api.AccountService;
-import org.chorem.lima.business.monitorable.AccountServiceMonitorable;
-import org.chorem.lima.business.monitorable.ImportServiceMonitorable;
+import org.chorem.lima.business.api.ImportService;
import org.chorem.lima.entity.Account;
import org.chorem.lima.service.LimaServiceFactory;
-import javax.swing.AbstractListModel;
-import javax.swing.ComboBoxModel;
-import java.util.List;
-
/** Account combo box model. */
public class AccountComboBoxModel extends AbstractListModel implements ComboBoxModel, ServiceListener {
@@ -57,9 +57,9 @@
public AccountComboBoxModel() {
accountService =
LimaServiceFactory.getService(
- AccountServiceMonitorable.class);
- LimaServiceFactory.addServiceListener(accountService, this);
- LimaServiceFactory.addServiceListener(ImportServiceMonitorable.class, this);
+ AccountService.class);
+ LimaServiceFactory.addServiceListener(AccountService.class, this);
+ LimaServiceFactory.addServiceListener(ImportService.class, this);
datasCache = getDataList();
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/EntryBookComboBoxModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/EntryBookComboBoxModel.java 2012-04-18 08:14:53 UTC (rev 3376)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/EntryBookComboBoxModel.java 2012-04-18 08:42:09 UTC (rev 3377)
@@ -25,20 +25,20 @@
package org.chorem.lima.ui.combobox;
+import java.util.List;
+
+import javax.swing.AbstractListModel;
+import javax.swing.ComboBoxModel;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.business.ServiceListener;
import org.chorem.lima.business.api.EntryBookService;
-import org.chorem.lima.business.monitorable.EntryBookServiceMonitorable;
-import org.chorem.lima.business.monitorable.ImportServiceMonitorable;
+import org.chorem.lima.business.api.ImportService;
import org.chorem.lima.entity.EntryBook;
import org.chorem.lima.service.LimaServiceFactory;
-import javax.swing.AbstractListModel;
-import javax.swing.ComboBoxModel;
-import java.util.List;
-
/**
* Opened financial period combo box model.
*
@@ -63,9 +63,9 @@
public EntryBookComboBoxModel() {
entryBookService =
- LimaServiceFactory.getService(EntryBookServiceMonitorable.class);
- LimaServiceFactory.addServiceListener(EntryBookServiceMonitorable.class, this);
- LimaServiceFactory.addServiceListener(ImportServiceMonitorable.class, this);
+ LimaServiceFactory.getService(EntryBookService.class);
+ LimaServiceFactory.addServiceListener(EntryBookService.class, this);
+ LimaServiceFactory.addServiceListener(ImportService.class, this);
cacheDatas = getDataList();
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FinancialPeriodComboBoxModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FinancialPeriodComboBoxModel.java 2012-04-18 08:14:53 UTC (rev 3376)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FinancialPeriodComboBoxModel.java 2012-04-18 08:42:09 UTC (rev 3377)
@@ -25,22 +25,22 @@
package org.chorem.lima.ui.combobox;
+import java.util.List;
+
+import javax.swing.AbstractListModel;
+import javax.swing.ComboBoxModel;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.business.ServiceListener;
import org.chorem.lima.business.api.FinancialPeriodService;
-import org.chorem.lima.business.monitorable.FinancialPeriodServiceMonitorable;
-import org.chorem.lima.business.monitorable.FiscalPeriodServiceMonitorable;
-import org.chorem.lima.business.monitorable.ImportServiceMonitorable;
+import org.chorem.lima.business.api.FiscalPeriodService;
+import org.chorem.lima.business.api.ImportService;
import org.chorem.lima.entity.FinancialPeriod;
import org.chorem.lima.entity.FiscalPeriod;
import org.chorem.lima.service.LimaServiceFactory;
-import javax.swing.AbstractListModel;
-import javax.swing.ComboBoxModel;
-import java.util.List;
-
/**
* Opened financial period combo box model.
*
@@ -84,10 +84,10 @@
financialPeriodService =
LimaServiceFactory.getService(
- FinancialPeriodServiceMonitorable.class);
- LimaServiceFactory.addServiceListener(financialPeriodService, this);
- LimaServiceFactory.addServiceListener(FiscalPeriodServiceMonitorable.class, this);
- LimaServiceFactory.addServiceListener(ImportServiceMonitorable.class, this);
+ FinancialPeriodService.class);
+ LimaServiceFactory.addServiceListener(FinancialPeriodService.class, this);
+ LimaServiceFactory.addServiceListener(FiscalPeriodService.class, this);
+ LimaServiceFactory.addServiceListener(ImportService.class, this);
if (displayAllPeriods) {
datasCache = getAllDataList();
} else {
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FiscalPeriodComboBoxModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FiscalPeriodComboBoxModel.java 2012-04-18 08:14:53 UTC (rev 3376)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FiscalPeriodComboBoxModel.java 2012-04-18 08:42:09 UTC (rev 3377)
@@ -25,21 +25,21 @@
package org.chorem.lima.ui.combobox;
+import java.util.List;
+
+import javax.swing.AbstractListModel;
+import javax.swing.ComboBoxModel;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.business.ServiceListener;
import org.chorem.lima.business.api.FiscalPeriodService;
-import org.chorem.lima.business.monitorable.FiscalPeriodServiceMonitorable;
-import org.chorem.lima.business.monitorable.ImportServiceMonitorable;
+import org.chorem.lima.business.api.ImportService;
import org.chorem.lima.entity.FiscalPeriod;
import org.chorem.lima.service.LimaServiceFactory;
import org.chorem.lima.ui.financialperiod.FinancialPeriodTableModel;
-import javax.swing.AbstractListModel;
-import javax.swing.ComboBoxModel;
-import java.util.List;
-
public class FiscalPeriodComboBoxModel extends AbstractListModel implements ComboBoxModel, ServiceListener {
private static final long serialVersionUID = 1L;
@@ -56,9 +56,9 @@
public FiscalPeriodComboBoxModel() {
fiscalPeriodService =
LimaServiceFactory.getService(
- FiscalPeriodServiceMonitorable.class);
- LimaServiceFactory.addServiceListener(fiscalPeriodService, this);
- LimaServiceFactory.addServiceListener(ImportServiceMonitorable.class, this);
+ FiscalPeriodService.class);
+ LimaServiceFactory.addServiceListener(FiscalPeriodService.class, this);
+ LimaServiceFactory.addServiceListener(ImportService.class, this);
datasCache = getDataList();
}
@@ -66,9 +66,9 @@
public FiscalPeriodComboBoxModel(boolean all) {
fiscalPeriodService =
LimaServiceFactory.getService(
- FiscalPeriodServiceMonitorable.class);
- LimaServiceFactory.addServiceListener(fiscalPeriodService, this);
- LimaServiceFactory.addServiceListener(ImportServiceMonitorable.class, this);
+ FiscalPeriodService.class);
+ LimaServiceFactory.addServiceListener(FiscalPeriodService.class, this);
+ LimaServiceFactory.addServiceListener(ImportService.class, this);
datasCache = getAllDataList();
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/LeafAccountComboBoxModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/LeafAccountComboBoxModel.java 2012-04-18 08:14:53 UTC (rev 3376)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/LeafAccountComboBoxModel.java 2012-04-18 08:42:09 UTC (rev 3377)
@@ -25,21 +25,21 @@
package org.chorem.lima.ui.combobox;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.swing.AbstractListModel;
+import javax.swing.ComboBoxModel;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.business.ServiceListener;
import org.chorem.lima.business.api.AccountService;
-import org.chorem.lima.business.monitorable.AccountServiceMonitorable;
-import org.chorem.lima.business.monitorable.ImportServiceMonitorable;
+import org.chorem.lima.business.api.ImportService;
import org.chorem.lima.entity.Account;
import org.chorem.lima.service.LimaServiceFactory;
-import javax.swing.AbstractListModel;
-import javax.swing.ComboBoxModel;
-import java.util.ArrayList;
-import java.util.List;
-
/**
* Account combo box model containing only leaf account (without sub accounts).
*/
@@ -57,9 +57,9 @@
public LeafAccountComboBoxModel() {
accountService =
- LimaServiceFactory.getService(AccountServiceMonitorable.class);
- LimaServiceFactory.addServiceListener(accountService, this);
- LimaServiceFactory.addServiceListener(ImportServiceMonitorable.class, this);
+ LimaServiceFactory.getService(AccountService.class);
+ LimaServiceFactory.addServiceListener(AccountService.class, this);
+ LimaServiceFactory.addServiceListener(ImportService.class, this);
datasCache = getDataList();
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsViewHandler.java 2012-04-18 08:14:53 UTC (rev 3376)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsViewHandler.java 2012-04-18 08:42:09 UTC (rev 3377)
@@ -46,18 +46,17 @@
import org.chorem.lima.business.LimaException;
import org.chorem.lima.business.LimaRuntimeException;
import org.chorem.lima.business.ServiceListener;
-import org.chorem.lima.business.monitorable.DocumentServiceMonitorable;
-import org.chorem.lima.business.monitorable.FinancialTransactionServiceMonitorable;
-import org.chorem.lima.business.monitorable.FiscalPeriodServiceMonitorable;
-import org.chorem.lima.business.monitorable.HttpServerServiceMonitorable;
-import org.chorem.lima.business.monitorable.ImportServiceMonitorable;
-import org.chorem.lima.business.monitorable.ReportServiceMonitorable;
+import org.chorem.lima.business.api.DocumentService;
+import org.chorem.lima.business.api.FinancialTransactionService;
+import org.chorem.lima.business.api.FiscalPeriodService;
+import org.chorem.lima.business.api.HttpServerService;
+import org.chorem.lima.business.api.ImportService;
+import org.chorem.lima.business.api.ReportService;
import org.chorem.lima.business.utils.DocumentsEnum;
import org.chorem.lima.business.utils.FormatsEnum;
import org.chorem.lima.entity.EntryBook;
import org.chorem.lima.entity.FiscalPeriod;
import org.chorem.lima.service.LimaServiceFactory;
-import org.chorem.lima.util.ErrorHelper;
/**
@@ -76,11 +75,11 @@
private static final Log log = LogFactory.getLog(EntryBooksReportsViewHandler.class);
/** Services. */
- protected ReportServiceMonitorable reportService;
+ protected ReportService reportService;
- protected DocumentServiceMonitorable documentService;
+ protected DocumentService documentService;
- protected FiscalPeriodServiceMonitorable fiscalPeriodService;
+ protected FiscalPeriodService fiscalPeriodService;
/** Account. */
protected EntryBook selectedEntryBook;
@@ -99,19 +98,12 @@
protected EntryBooksReportsViewHandler(EntryBooksReportsView view) {
this.view = view;
- reportService =
- LimaServiceFactory.getService(
- ReportServiceMonitorable.class);
- port = LimaServiceFactory.getService(
- HttpServerServiceMonitorable.class).getHttpPort();
- documentService =
- LimaServiceFactory.getService(
- DocumentServiceMonitorable.class);
- fiscalPeriodService =
- LimaServiceFactory.getService(
- FiscalPeriodServiceMonitorable.class);
- LimaServiceFactory.addServiceListener(ImportServiceMonitorable.class, this);
- LimaServiceFactory.addServiceListener(FinancialTransactionServiceMonitorable.class, this);
+ reportService = LimaServiceFactory.getService(ReportService.class);
+ port = LimaServiceFactory.getService(HttpServerService.class).getHttpPort();
+ documentService = LimaServiceFactory.getService(DocumentService.class);
+ fiscalPeriodService = LimaServiceFactory.getService(FiscalPeriodService.class);
+ LimaServiceFactory.addServiceListener(ImportService.class, this);
+ LimaServiceFactory.addServiceListener(FinancialTransactionService.class, this);
}
public void setBeginDate(Date date) {
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartTreeTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartTreeTableModel.java 2012-04-18 08:14:53 UTC (rev 3376)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartTreeTableModel.java 2012-04-18 08:42:09 UTC (rev 3377)
@@ -25,20 +25,21 @@
package org.chorem.lima.ui.financialstatementchart;
+import static org.nuiton.i18n.I18n._;
+
+import java.util.List;
+
+import javax.swing.tree.TreePath;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.LimaException;
-import org.chorem.lima.business.monitorable.FinancialStatementServiceMonitorable;
+import org.chorem.lima.business.api.FinancialStatementService;
import org.chorem.lima.entity.FinancialStatement;
import org.chorem.lima.entity.FinancialStatementImpl;
import org.chorem.lima.service.LimaServiceFactory;
import org.jdesktop.swingx.treetable.AbstractTreeTableModel;
-import javax.swing.tree.TreePath;
-import java.util.List;
-
-import static org.nuiton.i18n.I18n._;
-
/**
* Tree table model for account edition.
*
@@ -55,7 +56,7 @@
private static final Log log = LogFactory.getLog(FinancialStatementChartViewHandler.class);
/** Services. */
- protected final FinancialStatementServiceMonitorable financialStatementService;
+ protected final FinancialStatementService financialStatementService;
/** Model constructor. Init account service used here. */
public FinancialStatementChartTreeTableModel() {
@@ -63,8 +64,7 @@
super(new FinancialStatementImpl());
// Gets factory service
financialStatementService =
- LimaServiceFactory.getService(
- FinancialStatementServiceMonitorable.class);
+ LimaServiceFactory.getService(FinancialStatementService.class);
}
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 2012-04-18 08:14:53 UTC (rev 3376)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartViewHandler.java 2012-04-18 08:42:09 UTC (rev 3377)
@@ -25,14 +25,19 @@
package org.chorem.lima.ui.financialstatementchart;
+import static org.nuiton.i18n.I18n._;
+
+import javax.swing.JOptionPane;
+import javax.swing.tree.TreePath;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.LimaBusinessException;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.business.LimaRuntimeException;
import org.chorem.lima.business.ServiceListener;
-import org.chorem.lima.business.monitorable.FinancialStatementServiceMonitorable;
-import org.chorem.lima.business.monitorable.ImportServiceMonitorable;
+import org.chorem.lima.business.api.FinancialStatementService;
+import org.chorem.lima.business.api.ImportService;
import org.chorem.lima.entity.FinancialStatement;
import org.chorem.lima.entity.FinancialStatementImpl;
import org.chorem.lima.enums.FinancialStatementsChartEnum;
@@ -40,14 +45,8 @@
import org.chorem.lima.service.LimaServiceFactory;
import org.chorem.lima.ui.importexport.ImportExport;
import org.chorem.lima.util.DialogHelper;
-import org.chorem.lima.util.ErrorHelper;
import org.jdesktop.swingx.JXTreeTable;
-import javax.swing.JOptionPane;
-import javax.swing.tree.TreePath;
-
-import static org.nuiton.i18n.I18n._;
-
/**
* Handler associated with account view.
*
@@ -62,7 +61,7 @@
/** log. */
private static final Log log = LogFactory.getLog(FinancialStatementChartViewHandler.class);
- protected FinancialStatementServiceMonitorable financialStatementService;
+ protected FinancialStatementService financialStatementService;
protected FinancialStatementChartView view;
@@ -71,8 +70,8 @@
financialStatementService =
LimaServiceFactory.getService(
- FinancialStatementServiceMonitorable.class);
- LimaServiceFactory.addServiceListener(ImportServiceMonitorable.class, this);
+ FinancialStatementService.class);
+ LimaServiceFactory.addServiceListener(ImportService.class, this);
}
/** Add new account with account form. */
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableModel.java 2012-04-18 08:14:53 UTC (rev 3376)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableModel.java 2012-04-18 08:42:09 UTC (rev 3377)
@@ -25,6 +25,19 @@
package org.chorem.lima.ui.financialstatementreport;
+import static org.nuiton.i18n.I18n._;
+
+import java.awt.Desktop;
+import java.io.IOException;
+import java.math.BigDecimal;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
+
+import javax.swing.table.AbstractTableModel;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.LimaConfig;
@@ -34,28 +47,13 @@
import org.chorem.lima.business.ServiceListener;
import org.chorem.lima.business.api.DocumentService;
import org.chorem.lima.business.api.FinancialStatementService;
-import org.chorem.lima.business.monitorable.DocumentServiceMonitorable;
-import org.chorem.lima.business.monitorable.FinancialStatementServiceMonitorable;
-import org.chorem.lima.business.monitorable.FinancialTransactionServiceMonitorable;
-import org.chorem.lima.business.monitorable.HttpServerServiceMonitorable;
-import org.chorem.lima.business.monitorable.ImportServiceMonitorable;
+import org.chorem.lima.business.api.FinancialTransactionService;
+import org.chorem.lima.business.api.HttpServerService;
+import org.chorem.lima.business.api.ImportService;
import org.chorem.lima.business.utils.DocumentsEnum;
import org.chorem.lima.business.utils.FormatsEnum;
import org.chorem.lima.service.LimaServiceFactory;
-import org.chorem.lima.util.ErrorHelper;
-import javax.swing.table.AbstractTableModel;
-import java.awt.Desktop;
-import java.io.IOException;
-import java.math.BigDecimal;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.List;
-
-import static org.nuiton.i18n.I18n._;
-
/**
* Entry book table model.
*
@@ -97,14 +95,14 @@
public FinancialStatementReportTableModel() {
financialStatementService =
LimaServiceFactory.getService(
- FinancialStatementServiceMonitorable.class);
+ FinancialStatementService.class);
- LimaServiceFactory.addServiceListener(financialStatementService, this);
+ LimaServiceFactory.addServiceListener(FinancialStatementService.class, this);
port = LimaServiceFactory.getService(
- HttpServerServiceMonitorable.class).getHttpPort();
- LimaServiceFactory.addServiceListener(ImportServiceMonitorable.class, this);
- LimaServiceFactory.addServiceListener(FinancialTransactionServiceMonitorable.class, this);
- documentService = LimaServiceFactory.getService(DocumentServiceMonitorable.class);
+ HttpServerService.class).getHttpPort();
+ LimaServiceFactory.addServiceListener(ImportService.class, this);
+ LimaServiceFactory.addServiceListener(FinancialTransactionService.class, this);
+ documentService = LimaServiceFactory.getService(DocumentService.class);
}
@Override
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportViewHandler.java 2012-04-18 08:14:53 UTC (rev 3376)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportViewHandler.java 2012-04-18 08:42:09 UTC (rev 3377)
@@ -25,23 +25,23 @@
package org.chorem.lima.ui.financialstatementreport;
+import static org.nuiton.i18n.I18n._;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import javax.swing.JOptionPane;
+
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.monitorable.FiscalPeriodServiceMonitorable;
+import org.chorem.lima.business.api.FiscalPeriodService;
import org.chorem.lima.business.utils.FormatsEnum;
import org.chorem.lima.entity.FiscalPeriod;
import org.chorem.lima.service.LimaServiceFactory;
-import org.chorem.lima.util.ErrorHelper;
-import javax.swing.JOptionPane;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-
-import static org.nuiton.i18n.I18n._;
-
/**
* Handler associated with accounts reports view.
*
@@ -60,13 +60,13 @@
protected FinancialStatementReportTableModel model;
- protected FiscalPeriodServiceMonitorable fiscalPeriodService;
+ protected FiscalPeriodService fiscalPeriodService;
protected FinancialStatementReportViewHandler(FinancialStatementReportView view) {
this.view = view;
fiscalPeriodService =
LimaServiceFactory.getService(
- FiscalPeriodServiceMonitorable.class);
+ FiscalPeriodService.class);
}
public void refresh() {
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchTableModel.java 2012-04-18 08:14:53 UTC (rev 3376)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchTableModel.java 2012-04-18 08:42:09 UTC (rev 3377)
@@ -25,6 +25,15 @@
package org.chorem.lima.ui.financialtransactionsearch;
+import static org.nuiton.i18n.I18n._;
+
+import java.math.BigDecimal;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+
+import javax.swing.table.AbstractTableModel;
+
import org.apache.commons.lang3.time.DateUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -35,8 +44,6 @@
import org.chorem.lima.business.ServiceListener;
import org.chorem.lima.business.api.FinancialPeriodService;
import org.chorem.lima.business.api.FinancialTransactionService;
-import org.chorem.lima.business.monitorable.FinancialPeriodServiceMonitorable;
-import org.chorem.lima.business.monitorable.FinancialTransactionServiceMonitorable;
import org.chorem.lima.entity.Account;
import org.chorem.lima.entity.Entry;
import org.chorem.lima.entity.EntryBook;
@@ -47,16 +54,7 @@
import org.chorem.lima.entity.FiscalPeriod;
import org.chorem.lima.service.LimaServiceFactory;
import org.chorem.lima.util.DialogHelper;
-import org.chorem.lima.util.ErrorHelper;
-import javax.swing.table.AbstractTableModel;
-import java.math.BigDecimal;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.List;
-
-import static org.nuiton.i18n.I18n._;
-
/**
* Basic transaction table model.
* <p/>
@@ -102,11 +100,11 @@
/* Services */
financialTransactionService =
LimaServiceFactory.getService(
- FinancialTransactionServiceMonitorable.class);
- LimaServiceFactory.addServiceListener(financialTransactionService, this);
+ FinancialTransactionService.class);
+ LimaServiceFactory.addServiceListener(FinancialTransactionService.class, this);
financialPeriodService =
LimaServiceFactory.getService(
- FinancialPeriodServiceMonitorable.class);
+ FinancialPeriodService.class);
}
/**
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchViewHandler.java 2012-04-18 08:14:53 UTC (rev 3376)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchViewHandler.java 2012-04-18 08:42:09 UTC (rev 3377)
@@ -25,6 +25,13 @@
package org.chorem.lima.ui.financialtransactionsearch;
+import static org.nuiton.i18n.I18n._;
+
+import java.util.Date;
+
+import javax.swing.JOptionPane;
+import javax.swing.ListSelectionModel;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.FinancialStatementWayEnum;
@@ -32,7 +39,6 @@
import org.chorem.lima.beans.FinancialTransactionSearchImpl;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.business.api.FinancialTransactionService;
-import org.chorem.lima.business.monitorable.FinancialTransactionServiceMonitorable;
import org.chorem.lima.entity.Account;
import org.chorem.lima.entity.Entry;
import org.chorem.lima.entity.EntryBook;
@@ -41,12 +47,6 @@
import org.chorem.lima.ui.combobox.FiscalPeriodComboBoxModel;
import org.chorem.lima.util.DialogHelper;
-import javax.swing.JOptionPane;
-import javax.swing.ListSelectionModel;
-import java.util.Date;
-
-import static org.nuiton.i18n.I18n._;
-
/**
* Handler associated with financial transaction view.
*
@@ -84,7 +84,7 @@
/* Services */
financialTransactionService =
LimaServiceFactory.getService(
- FinancialTransactionServiceMonitorable.class);
+ FinancialTransactionService.class);
financialTransactionSearch = new FinancialTransactionSearchImpl();
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTableModel.java 2012-04-18 08:14:53 UTC (rev 3376)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTableModel.java 2012-04-18 08:42:09 UTC (rev 3377)
@@ -25,13 +25,22 @@
package org.chorem.lima.ui.financialtransactionunbalanced;
+import static org.nuiton.i18n.I18n._;
+
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
+
+import javax.swing.table.AbstractTableModel;
+
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.ServiceListener;
import org.chorem.lima.business.api.FinancialTransactionService;
-import org.chorem.lima.business.monitorable.FinancialTransactionServiceMonitorable;
import org.chorem.lima.business.utils.EntryComparator;
import org.chorem.lima.entity.Account;
import org.chorem.lima.entity.Entry;
@@ -41,17 +50,7 @@
import org.chorem.lima.entity.FiscalPeriod;
import org.chorem.lima.service.LimaServiceFactory;
import org.chorem.lima.util.DialogHelper;
-import org.chorem.lima.util.ErrorHelper;
-import javax.swing.table.AbstractTableModel;
-import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Date;
-import java.util.List;
-
-import static org.nuiton.i18n.I18n._;
-
/**
* Basic transaction table model.
* <p/>
@@ -95,7 +94,7 @@
/* Services */
financialTransactionService =
LimaServiceFactory.getService(
- FinancialTransactionServiceMonitorable.class);
+ FinancialTransactionService.class);
LimaServiceFactory.addServiceListener(financialTransactionService, this);
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/AccountsPane.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/AccountsPane.java 2012-04-18 08:14:53 UTC (rev 3376)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/AccountsPane.java 2012-04-18 08:42:09 UTC (rev 3377)
@@ -34,8 +34,8 @@
import org.chorem.lima.LimaContext;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.business.ServiceListener;
-import org.chorem.lima.business.monitorable.AccountServiceMonitorable;
-import org.chorem.lima.business.monitorable.ImportServiceMonitorable;
+import org.chorem.lima.business.api.AccountService;
+import org.chorem.lima.business.api.ImportService;
import org.chorem.lima.service.LimaServiceFactory;
import org.chorem.lima.ui.MainView;
@@ -54,14 +54,14 @@
private static final Log log = LogFactory.getLog(AccountsPane.class);
- protected AccountServiceMonitorable accountService;
+ protected AccountService accountService;
public AccountsPane(HomeView view) {
super(view);
- accountService = LimaServiceFactory.getService(AccountServiceMonitorable.class);
- LimaServiceFactory.addServiceListener(AccountServiceMonitorable.class, this);
- LimaServiceFactory.addServiceListener(ImportServiceMonitorable.class, this);
+ accountService = LimaServiceFactory.getService(AccountService.class);
+ LimaServiceFactory.addServiceListener(AccountService.class, this);
+ LimaServiceFactory.addServiceListener(ImportService.class, this);
refresh();
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/EntryBooksPane.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/EntryBooksPane.java 2012-04-18 08:14:53 UTC (rev 3376)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/EntryBooksPane.java 2012-04-18 08:42:09 UTC (rev 3377)
@@ -37,8 +37,7 @@
import org.chorem.lima.business.LimaException;
import org.chorem.lima.business.ServiceListener;
import org.chorem.lima.business.api.EntryBookService;
-import org.chorem.lima.business.monitorable.EntryBookServiceMonitorable;
-import org.chorem.lima.business.monitorable.ImportServiceMonitorable;
+import org.chorem.lima.business.api.ImportService;
import org.chorem.lima.entity.EntryBook;
import org.chorem.lima.service.LimaServiceFactory;
import org.chorem.lima.ui.MainView;
@@ -63,9 +62,9 @@
public EntryBooksPane(HomeView view) {
super(view);
- entryBookService = LimaServiceFactory.getService(EntryBookServiceMonitorable.class);
- LimaServiceFactory.addServiceListener(EntryBookServiceMonitorable.class, this);
- LimaServiceFactory.addServiceListener(ImportServiceMonitorable.class, this);
+ entryBookService = LimaServiceFactory.getService(EntryBookService.class);
+ LimaServiceFactory.addServiceListener(EntryBookService.class, this);
+ LimaServiceFactory.addServiceListener(ImportService.class, this);
refresh();
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/FinancialTransactionsPane.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/FinancialTransactionsPane.java 2012-04-18 08:14:53 UTC (rev 3376)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/FinancialTransactionsPane.java 2012-04-18 08:42:09 UTC (rev 3377)
@@ -38,9 +38,7 @@
import org.chorem.lima.business.ServiceListener;
import org.chorem.lima.business.api.FinancialTransactionService;
import org.chorem.lima.business.api.FiscalPeriodService;
-import org.chorem.lima.business.monitorable.FinancialTransactionServiceMonitorable;
-import org.chorem.lima.business.monitorable.FiscalPeriodServiceMonitorable;
-import org.chorem.lima.business.monitorable.ImportServiceMonitorable;
+import org.chorem.lima.business.api.ImportService;
import org.chorem.lima.entity.FinancialTransaction;
import org.chorem.lima.entity.FiscalPeriod;
import org.chorem.lima.service.LimaServiceFactory;
@@ -68,11 +66,11 @@
public FinancialTransactionsPane(HomeView view) {
super(view);
- financialTransactionService = LimaServiceFactory.getService(FinancialTransactionServiceMonitorable.class);
- fiscalPeriodService = LimaServiceFactory.getService(FiscalPeriodServiceMonitorable.class);
- LimaServiceFactory.addServiceListener(FinancialTransactionServiceMonitorable.class, this);
- LimaServiceFactory.addServiceListener(FiscalPeriodServiceMonitorable.class, this);
- LimaServiceFactory.addServiceListener(ImportServiceMonitorable.class, this);
+ financialTransactionService = LimaServiceFactory.getService(FinancialTransactionService.class);
+ fiscalPeriodService = LimaServiceFactory.getService(FiscalPeriodService.class);
+ LimaServiceFactory.addServiceListener(FinancialTransactionService.class, this);
+ LimaServiceFactory.addServiceListener(FiscalPeriodService.class, this);
+ LimaServiceFactory.addServiceListener(ImportService.class, this);
refresh();
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/FiscalPeriodsPane.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/FiscalPeriodsPane.java 2012-04-18 08:14:53 UTC (rev 3376)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/FiscalPeriodsPane.java 2012-04-18 08:42:09 UTC (rev 3377)
@@ -37,8 +37,7 @@
import org.chorem.lima.business.LimaException;
import org.chorem.lima.business.ServiceListener;
import org.chorem.lima.business.api.FiscalPeriodService;
-import org.chorem.lima.business.monitorable.FiscalPeriodServiceMonitorable;
-import org.chorem.lima.business.monitorable.ImportServiceMonitorable;
+import org.chorem.lima.business.api.ImportService;
import org.chorem.lima.entity.FiscalPeriod;
import org.chorem.lima.service.LimaServiceFactory;
import org.chorem.lima.ui.MainView;
@@ -69,9 +68,9 @@
public FiscalPeriodsPane(HomeView view) {
super(view);
- fiscalPeriodService = LimaServiceFactory.getService(FiscalPeriodServiceMonitorable.class);
- LimaServiceFactory.addServiceListener(FiscalPeriodServiceMonitorable.class, this);
- LimaServiceFactory.addServiceListener(ImportServiceMonitorable.class, this);
+ fiscalPeriodService = LimaServiceFactory.getService(FiscalPeriodService.class);
+ LimaServiceFactory.addServiceListener(FiscalPeriodService.class, this);
+ LimaServiceFactory.addServiceListener(ImportService.class, this);
refresh();
}
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 2012-04-18 08:14:53 UTC (rev 3376)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/identity/IdentityHandler.java 2012-04-18 08:42:09 UTC (rev 3377)
@@ -29,7 +29,6 @@
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.business.api.IdentityService;
-import org.chorem.lima.business.monitorable.IdentityServiceMonitorable;
import org.chorem.lima.entity.Identity;
import org.chorem.lima.entity.IdentityImpl;
import org.chorem.lima.service.LimaServiceFactory;
@@ -44,7 +43,7 @@
public IdentityHandler() {
identityService =
LimaServiceFactory.getService(
- IdentityServiceMonitorable.class);
+ IdentityService.class);
}
public Identity getIdentity() {
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-18 08:14:53 UTC (rev 3376)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java 2012-04-18 08:42:09 UTC (rev 3377)
@@ -25,26 +25,8 @@
package org.chorem.lima.ui.importexport;
-import org.apache.commons.io.IOUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.chorem.lima.business.LimaException;
-import org.chorem.lima.business.monitorable.ExportServiceMonitorable;
-import org.chorem.lima.business.monitorable.ImportServiceMonitorable;
-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 static org.nuiton.i18n.I18n._;
-import javax.swing.JComboBox;
-import javax.swing.JFileChooser;
-import javax.swing.JLabel;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.SwingWorker;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
@@ -61,8 +43,27 @@
import java.io.StringWriter;
import java.util.concurrent.ExecutionException;
-import static org.nuiton.i18n.I18n._;
+import javax.swing.JComboBox;
+import javax.swing.JFileChooser;
+import javax.swing.JLabel;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.SwingWorker;
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.chorem.lima.business.LimaException;
+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;
+
public class ImportExport {
private static final Log log = LogFactory.getLog(AccountViewHandler.class);
@@ -71,9 +72,9 @@
protected EncodingEnum encodingEnum;
- protected ImportServiceMonitorable importService;
+ protected ImportService importService;
- protected ExportServiceMonitorable exportService;
+ protected ExportService exportService;
private ImportExportWaitView waitView;
@@ -81,12 +82,8 @@
viewComponent = view;
//services
- importService =
- LimaServiceFactory.getService(
- ImportServiceMonitorable.class);
- exportService =
- LimaServiceFactory.getService(
- ExportServiceMonitorable.class);
+ importService = LimaServiceFactory.getService(ImportService.class);
+ exportService = LimaServiceFactory.getService(ExportService.class);
//create the wait dialog panel
waitView = new ImportExportWaitView();
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerViewHandler.java 2012-04-18 08:14:53 UTC (rev 3376)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerViewHandler.java 2012-04-18 08:42:09 UTC (rev 3377)
@@ -25,6 +25,21 @@
package org.chorem.lima.ui.ledger;
+import static org.nuiton.i18n.I18n._;
+
+import java.awt.Desktop;
+import java.io.IOException;
+import java.math.BigDecimal;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
+
+import javax.swing.JOptionPane;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.LimaConfig;
@@ -33,36 +48,19 @@
import org.chorem.lima.business.LimaException;
import org.chorem.lima.business.LimaRuntimeException;
import org.chorem.lima.business.ServiceListener;
+import org.chorem.lima.business.api.FinancialTransactionService;
import org.chorem.lima.business.api.FiscalPeriodService;
+import org.chorem.lima.business.api.HttpServerService;
+import org.chorem.lima.business.api.ImportService;
import org.chorem.lima.business.api.ReportService;
-import org.chorem.lima.business.monitorable.FinancialTransactionServiceMonitorable;
-import org.chorem.lima.business.monitorable.FiscalPeriodServiceMonitorable;
-import org.chorem.lima.business.monitorable.HttpServerServiceMonitorable;
-import org.chorem.lima.business.monitorable.ImportServiceMonitorable;
-import org.chorem.lima.business.monitorable.ReportServiceMonitorable;
import org.chorem.lima.business.utils.DocumentsEnum;
import org.chorem.lima.business.utils.EntryComparator;
import org.chorem.lima.business.utils.FormatsEnum;
import org.chorem.lima.entity.Entry;
import org.chorem.lima.entity.FiscalPeriod;
import org.chorem.lima.service.LimaServiceFactory;
-import org.chorem.lima.util.ErrorHelper;
-import javax.swing.JOptionPane;
-import java.awt.Desktop;
-import java.io.IOException;
-import java.math.BigDecimal;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Date;
-import java.util.List;
-import static org.nuiton.i18n.I18n._;
-
-
/**
* Handler associated with accounts reports view.
* By : $Author$
@@ -105,16 +103,12 @@
this.view = view;
reportService =
- LimaServiceFactory.getService(ReportServiceMonitorable.class);
- LimaServiceFactory.addServiceListener(reportService, this);
- port = LimaServiceFactory.getService(
- HttpServerServiceMonitorable.class).getHttpPort();
-// documentService =
-// LimaServiceFactory.getService(DocumentServiceMonitorable.class);
- fiscalPeriodService =
- LimaServiceFactory.getService(FiscalPeriodServiceMonitorable.class);
- LimaServiceFactory.addServiceListener(ImportServiceMonitorable.class, this);
- LimaServiceFactory.addServiceListener(FinancialTransactionServiceMonitorable.class, this);
+ LimaServiceFactory.getService(ReportService.class);
+ LimaServiceFactory.addServiceListener(ReportService.class, this);
+ port = LimaServiceFactory.getService(HttpServerService.class).getHttpPort();
+ fiscalPeriodService = LimaServiceFactory.getService(FiscalPeriodService.class);
+ LimaServiceFactory.addServiceListener(ImportService.class, this);
+ LimaServiceFactory.addServiceListener(FinancialTransactionService.class, this);
}
public void setBeginDate(Date date) {
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTableModel.java 2012-04-18 08:14:53 UTC (rev 3376)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTableModel.java 2012-04-18 08:42:09 UTC (rev 3377)
@@ -25,14 +25,23 @@
package org.chorem.lima.ui.lettering;
+import static org.nuiton.i18n.I18n._;
+
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
+
+import javax.swing.table.AbstractTableModel;
+
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.ServiceListener;
import org.chorem.lima.business.api.FinancialTransactionService;
-import org.chorem.lima.business.monitorable.FinancialTransactionServiceMonitorable;
-import org.chorem.lima.business.monitorable.ImportServiceMonitorable;
+import org.chorem.lima.business.api.ImportService;
import org.chorem.lima.business.utils.EntryComparator;
import org.chorem.lima.entity.Account;
import org.chorem.lima.entity.Entry;
@@ -40,20 +49,7 @@
import org.chorem.lima.entity.FinancialTransaction;
import org.chorem.lima.service.LimaServiceFactory;
import org.chorem.lima.util.DialogHelper;
-import org.chorem.lima.util.ErrorHelper;
-import org.nuiton.util.Resource;
-import javax.swing.JFrame;
-import javax.swing.JOptionPane;
-import javax.swing.table.AbstractTableModel;
-import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Date;
-import java.util.List;
-
-import static org.nuiton.i18n.I18n._;
-
/**
* Basic transaction table model.
* <p/>
@@ -101,9 +97,9 @@
/* Services */
financialTransactionService =
LimaServiceFactory.getService(
- FinancialTransactionServiceMonitorable.class);
- LimaServiceFactory.addServiceListener(financialTransactionService,this);
- LimaServiceFactory.addServiceListener(ImportServiceMonitorable.class, this);
+ FinancialTransactionService.class);
+ LimaServiceFactory.addServiceListener(FinancialTransactionService.class,this);
+ LimaServiceFactory.addServiceListener(ImportService.class, this);
}
public void setSelectedBeginDate(Date date) {
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java 2012-04-18 08:14:53 UTC (rev 3376)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java 2012-04-18 08:42:09 UTC (rev 3377)
@@ -25,22 +25,16 @@
package org.chorem.lima.ui.lettering;
+import java.util.Date;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.chorem.lima.business.LimaException;
-import org.chorem.lima.business.monitorable.FinancialTransactionServiceMonitorable;
+import org.chorem.lima.business.api.FinancialTransactionService;
import org.chorem.lima.service.LimaServiceFactory;
import org.chorem.lima.ui.combobox.FinancialPeriodComboBoxModel;
import org.chorem.lima.ui.combobox.FiscalPeriodComboBoxModel;
-import org.chorem.lima.util.DialogHelper;
-import javax.swing.JComboBox;
-import javax.swing.JTextField;
-import java.util.Date;
-import static org.nuiton.i18n.I18n._;
-
-
/**
* Handler associated with financial transaction view.
*
@@ -67,7 +61,7 @@
protected FinancialPeriodComboBoxModel financialPeriodComboBoxModel;
/** Transaction service. */
- protected final FinancialTransactionServiceMonitorable financialTransactionService;
+ protected final FinancialTransactionService financialTransactionService;
protected Object clipBoard;
@@ -75,9 +69,7 @@
this.view = view;
/* Services */
- financialTransactionService =
- LimaServiceFactory.getService(
- FinancialTransactionServiceMonitorable.class);
+ financialTransactionService = LimaServiceFactory.getService(FinancialTransactionService.class);
}
public void setBeginDate(Date date) {
Modified: 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 2012-04-18 08:14:53 UTC (rev 3376)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateFiscalPeriodPanel.jaxx 2012-04-18 08:42:09 UTC (rev 3377)
@@ -29,16 +29,16 @@
org.apache.commons.lang3.time.DateUtils
org.jdesktop.swingx.JXDatePicker
org.chorem.lima.entity.FiscalPeriod
- org.chorem.lima.business.monitorable.FiscalPeriodServiceMonitorable
+ org.chorem.lima.business.api.FiscalPeriodService
org.chorem.lima.business.LimaException
org.chorem.lima.service.LimaServiceFactory
</import>
<script>
<![CDATA[
- protected FiscalPeriodServiceMonitorable fiscalPeriodService =
+ protected FiscalPeriodService fiscalPeriodService =
LimaServiceFactory.getService(
- FiscalPeriodServiceMonitorable.class);
+ FiscalPeriodService.class);
// set begin date picker
Date endDate = null;
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-18 08:14:53 UTC (rev 3376)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/OpeningViewHandler.java 2012-04-18 08:42:09 UTC (rev 3377)
@@ -25,10 +25,19 @@
package org.chorem.lima.ui.opening;
+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.LimaException;
-import org.chorem.lima.business.monitorable.FiscalPeriodServiceMonitorable;
+import org.chorem.lima.business.api.FiscalPeriodService;
import org.chorem.lima.entity.FiscalPeriod;
import org.chorem.lima.entity.FiscalPeriodImpl;
import org.chorem.lima.enums.AccountsChartEnum;
@@ -40,14 +49,6 @@
import org.chorem.lima.ui.identity.IdentityHandler;
import org.chorem.lima.ui.importexport.ImportExport;
-import javax.swing.BorderFactory;
-import javax.swing.JPanel;
-import javax.swing.border.Border;
-import javax.swing.border.EmptyBorder;
-import java.awt.Color;
-
-import static org.nuiton.i18n.I18n._;
-
public class OpeningViewHandler {
private static final Log log = LogFactory.getLog(OpeningViewHandler.class);
@@ -192,7 +193,7 @@
fiscalPeriod.setEndDate(fsPanel.getEndDatePicker().getDate());
LimaServiceFactory.getService(
- FiscalPeriodServiceMonitorable.class).
+ FiscalPeriodService.class).
createFiscalPeriod(fiscalPeriod);
} catch (LimaException ex) {
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartTreeTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartTreeTableModel.java 2012-04-18 08:14:53 UTC (rev 3376)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartTreeTableModel.java 2012-04-18 08:42:09 UTC (rev 3377)
@@ -24,27 +24,28 @@
*/
package org.chorem.lima.ui.vatchart;
+import static org.nuiton.i18n.I18n._;
+
+import java.util.List;
+
+import javax.swing.tree.TreePath;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.LimaException;
-import org.chorem.lima.business.monitorable.VatStatementServiceMonitorable;
+import org.chorem.lima.business.api.VatStatementService;
import org.chorem.lima.entity.VatStatement;
import org.chorem.lima.entity.VatStatementImpl;
import org.chorem.lima.service.LimaServiceFactory;
import org.jdesktop.swingx.treetable.AbstractTreeTableModel;
-import javax.swing.tree.TreePath;
-import java.util.List;
-
-import static org.nuiton.i18n.I18n._;
-
public class VatChartTreeTableModel extends AbstractTreeTableModel {
/** log. */
private static final Log log = LogFactory.getLog(VatChartViewHandler.class);
/** Services. */
- protected final VatStatementServiceMonitorable vatStatementService;
+ protected final VatStatementService vatStatementService;
/** Model constructor. Initiate account service used here. */
public VatChartTreeTableModel() {
@@ -53,7 +54,7 @@
// Gets factory service
vatStatementService =
LimaServiceFactory.getService(
- VatStatementServiceMonitorable.class);
+ VatStatementService.class);
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartViewHandler.java 2012-04-18 08:14:53 UTC (rev 3376)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartViewHandler.java 2012-04-18 08:42:09 UTC (rev 3377)
@@ -24,13 +24,18 @@
*/
package org.chorem.lima.ui.vatchart;
+import static org.nuiton.i18n.I18n._;
+
+import javax.swing.JOptionPane;
+import javax.swing.tree.TreePath;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.LimaBusinessException;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.business.ServiceListener;
-import org.chorem.lima.business.monitorable.ImportServiceMonitorable;
-import org.chorem.lima.business.monitorable.VatStatementServiceMonitorable;
+import org.chorem.lima.business.api.ImportService;
+import org.chorem.lima.business.api.VatStatementService;
import org.chorem.lima.entity.VatStatement;
import org.chorem.lima.entity.VatStatementImpl;
import org.chorem.lima.enums.ImportExportEnum;
@@ -39,18 +44,12 @@
import org.chorem.lima.ui.importexport.ImportExport;
import org.jdesktop.swingx.JXTreeTable;
-import javax.swing.JOptionPane;
-import javax.swing.tree.TreePath;
-import java.math.BigDecimal;
-
-import static org.nuiton.i18n.I18n._;
-
public class VatChartViewHandler implements ServiceListener {
/** log. */
private static final Log log = LogFactory.getLog(VatChartViewHandler.class);
- protected VatStatementServiceMonitorable vatStatementService;
+ protected VatStatementService vatStatementService;
protected VatChartView view;
@@ -59,8 +58,8 @@
vatStatementService =
LimaServiceFactory.getService(
- VatStatementServiceMonitorable.class);
- LimaServiceFactory.addServiceListener(ImportServiceMonitorable.class, this);
+ VatStatementService.class);
+ LimaServiceFactory.addServiceListener(ImportService.class, this);
}
public void addVatStatementMovement() {
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportTableModel.java 2012-04-18 08:14:53 UTC (rev 3376)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportTableModel.java 2012-04-18 08:42:09 UTC (rev 3377)
@@ -24,27 +24,26 @@
*/
package org.chorem.lima.ui.vatreports;
+import static org.nuiton.i18n.I18n._;
+
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.List;
+
+import javax.swing.table.AbstractTableModel;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.beans.VatStatementAmounts;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.business.LimaRuntimeException;
import org.chorem.lima.business.ServiceListener;
+import org.chorem.lima.business.api.FinancialTransactionService;
+import org.chorem.lima.business.api.ImportService;
import org.chorem.lima.business.api.VatStatementService;
-import org.chorem.lima.business.monitorable.FinancialTransactionServiceMonitorable;
-import org.chorem.lima.business.monitorable.ImportServiceMonitorable;
-import org.chorem.lima.business.monitorable.VatStatementServiceMonitorable;
import org.chorem.lima.service.LimaServiceFactory;
-import org.chorem.lima.util.ErrorHelper;
import org.nuiton.topia.TopiaException;
-import javax.swing.table.AbstractTableModel;
-import java.math.BigDecimal;
-import java.util.Date;
-import java.util.List;
-
-import static org.nuiton.i18n.I18n._;
-
public class VatReportTableModel extends AbstractTableModel implements ServiceListener {
/** serialVersionUID. */
@@ -80,22 +79,13 @@
public VatReportTableModel() {
-// reportService =
-// LimaServiceFactory.getService(
-// ReportServiceMonitorable.class);
- //add listeners
vatStatementService =
LimaServiceFactory.getService(
- VatStatementServiceMonitorable.class);
- LimaServiceFactory.addServiceListener(vatStatementService, this);
- LimaServiceFactory.addServiceListener(
- FinancialTransactionServiceMonitorable.class, this);
- LimaServiceFactory.addServiceListener(
- ImportServiceMonitorable.class, this);
-
-// //sets autocomplete mode to true on start
-// autocomplete = "true";
+ VatStatementService.class);
+ LimaServiceFactory.addServiceListener(VatStatementService.class, this);
+ LimaServiceFactory.addServiceListener(FinancialTransactionService.class, this);
+ LimaServiceFactory.addServiceListener(ImportService.class, this);
}
protected List<VatStatementAmounts> getDataList() throws TopiaException {
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportViewHandler.java 2012-04-18 08:14:53 UTC (rev 3376)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportViewHandler.java 2012-04-18 08:42:09 UTC (rev 3377)
@@ -24,23 +24,23 @@
*/
package org.chorem.lima.ui.vatreports;
+import java.awt.Desktop;
+import java.io.IOException;
+import java.math.BigDecimal;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.text.SimpleDateFormat;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.LimaConfig;
-import org.chorem.lima.business.monitorable.DocumentServiceMonitorable;
-import org.chorem.lima.business.monitorable.HttpServerServiceMonitorable;
+import org.chorem.lima.business.api.DocumentService;
+import org.chorem.lima.business.api.HttpServerService;
import org.chorem.lima.business.utils.DocumentsEnum;
import org.chorem.lima.service.LimaServiceFactory;
import org.chorem.lima.ui.celleditor.BigDecimalTableCellEditor;
import org.chorem.lima.ui.celleditor.BigDecimalTableCellRenderer;
-import java.awt.Desktop;
-import java.io.IOException;
-import java.math.BigDecimal;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.text.SimpleDateFormat;
-
public class VatReportViewHandler {
/** log. */
private static final Log log =
@@ -48,7 +48,7 @@
protected VatReportView view;
- protected DocumentServiceMonitorable documentService;
+ protected DocumentService documentService;
private static SimpleDateFormat dateFormat =
new SimpleDateFormat("yyyy-MM-dd");
@@ -58,12 +58,9 @@
protected VatReportViewHandler(VatReportView view) {
this.view = view;
- port = LimaServiceFactory.getService(
- HttpServerServiceMonitorable.class).getHttpPort();
+ port = LimaServiceFactory.getService(HttpServerService.class).getHttpPort();
- documentService =
- LimaServiceFactory.getService(
- DocumentServiceMonitorable.class);
+ documentService = LimaServiceFactory.getService(DocumentService.class);
}
public void init() {
1
0
r3376 - trunk/lima-business/src/main/java/org/chorem/lima/service
by echatellier@users.chorem.org 18 Apr '12
by echatellier@users.chorem.org 18 Apr '12
18 Apr '12
Author: echatellier
Date: 2012-04-18 10:14:53 +0200 (Wed, 18 Apr 2012)
New Revision: 3376
Url: http://chorem.org/repositories/revision/lima/3376
Log:
Disable openejb banner (sysout)
Modified:
trunk/lima-business/src/main/java/org/chorem/lima/service/LimaServiceFactory.java
Modified: trunk/lima-business/src/main/java/org/chorem/lima/service/LimaServiceFactory.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/service/LimaServiceFactory.java 2012-04-18 08:14:34 UTC (rev 3375)
+++ trunk/lima-business/src/main/java/org/chorem/lima/service/LimaServiceFactory.java 2012-04-18 08:14:53 UTC (rev 3376)
@@ -89,6 +89,7 @@
// see http://openejb.apache.org/embedded-configuration.html
// http://openejb.apache.org/properties-listing.html
// for embedded configuration
+ props.setProperty("openejb.nobanner", "false");
container = EJBContainer.createEJBContainer(props);
}
1
0
r3375 - in trunk/lima-swing/src/main: java/org/chorem/lima resources/i18n
by echatellier@users.chorem.org 18 Apr '12
by echatellier@users.chorem.org 18 Apr '12
18 Apr '12
Author: echatellier
Date: 2012-04-18 10:14:34 +0200 (Wed, 18 Apr 2012)
New Revision: 3375
Url: http://chorem.org/repositories/revision/lima/3375
Log:
Manage business exception in different way
Modified:
trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.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/LimaMain.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java 2012-04-17 16:03:01 UTC (rev 3374)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java 2012-04-18 08:14:34 UTC (rev 3375)
@@ -96,7 +96,11 @@
log.error("Global application exception", ex);
}
- Throwable cause = ex.getCause();
+ Throwable cause = ex;
+ while (ex != null && !(cause instanceof LimaBusinessException)) {
+ cause = cause.getCause();
+ }
+
if (cause instanceof LimaBusinessException) {
JOptionPane.showMessageDialog(null, cause.getMessage(),
_("lima.ui.common.error"), JOptionPane.ERROR_MESSAGE);
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-17 16:03:01 UTC (rev 3374)
+++ trunk/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties 2012-04-18 08:14:34 UTC (rev 3375)
@@ -278,6 +278,7 @@
lima.ui.account.shortened=
lima.ui.account.updateaccounttitle=
lima.ui.common.cancel=
+lima.ui.common.error=
lima.ui.common.ok=
lima.ui.common.remove=
lima.ui.common.update=
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-17 16:03:01 UTC (rev 3374)
+++ trunk/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties 2012-04-18 08:14:34 UTC (rev 3375)
@@ -257,6 +257,7 @@
lima.ui.account.shortened=Plan comptable abrégé
lima.ui.account.updateaccounttitle=Modification d'un compte
lima.ui.common.cancel=Annuler
+lima.ui.common.error=Erreur
lima.ui.common.ok=Ok
lima.ui.common.remove=Supprimer
lima.ui.common.update=Modifier
1
0
r3374 - trunk/lima-swing/src/main/java/org/chorem/lima/util
by echatellier@users.chorem.org 17 Apr '12
by echatellier@users.chorem.org 17 Apr '12
17 Apr '12
Author: echatellier
Date: 2012-04-17 18:03:01 +0200 (Tue, 17 Apr 2012)
New Revision: 3374
Url: http://chorem.org/repositories/revision/lima/3374
Log:
Deprecate another helper
Modified:
trunk/lima-swing/src/main/java/org/chorem/lima/util/DialogHelper.java
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/util/DialogHelper.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/util/DialogHelper.java 2012-04-17 16:00:24 UTC (rev 3373)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/util/DialogHelper.java 2012-04-17 16:03:01 UTC (rev 3374)
@@ -37,21 +37,11 @@
/**
* @author ore
* @author Rémi Chapelet
+ * @deprecated with no replacement, use JOptionPane directly
*/
+@Deprecated
public class DialogHelper {
- public static int showConfirmDialog(String message) {
- String[] response = {_("lima.response.yes"), _("lima.response.no")};
- return JOptionPane.showOptionDialog(null,
- message,
- _("lima.common.question"),
- JOptionPane.YES_NO_OPTION,
- JOptionPane.QUESTION_MESSAGE,
- null, //do not use a custom Icon
- response, //the titles of buttons
- response[0]); //default button title
- }
-
/**
* Use instead: JOptionPane.showMessageDialog (String message,String titre,int type)
* <p/>
@@ -86,24 +76,6 @@
}
/**
- * Permet d'afficher une boite de dialogue.
- *
- * @param message
- * @param titre
- * @param type
- */
- public static void showMessageDialog(String message, String titre, int type) {
- JFrame f = new JFrame();
- f.setIconImage(Resource.getIcon("icons/lima.png").getImage());
- JOptionPane.showMessageDialog(
- f,
- message,
- titre,
- type);
- f.dispose();
- }
-
- /**
* Permet d'afficher une boite de dialogue avec rapport
*
* @param message
1
0
r3373 - in trunk/lima-swing/src/main/java/org/chorem/lima: . ui ui/accountsreports ui/balance ui/entrybooksreports ui/financialstatementchart ui/financialstatementreport ui/financialtransactionsearch ui/financialtransactionunbalanced ui/ledger ui/lettering ui/vatreports util
by echatellier@users.chorem.org 17 Apr '12
by echatellier@users.chorem.org 17 Apr '12
17 Apr '12
Author: echatellier
Date: 2012-04-17 18:00:24 +0200 (Tue, 17 Apr 2012)
New Revision: 3373
Url: http://chorem.org/repositories/revision/lima/3373
Log:
Refactor ErrorHelper use
Modified:
trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/util/ErrorHelper.java
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java 2012-04-17 15:39:47 UTC (rev 3372)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java 2012-04-17 16:00:24 UTC (rev 3373)
@@ -28,6 +28,7 @@
import jaxx.runtime.SwingUtil;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.chorem.lima.business.LimaBusinessException;
import org.chorem.lima.business.api.AccountService;
import org.chorem.lima.business.monitorable.AccountServiceMonitorable;
import org.chorem.lima.business.monitorable.HttpServerServiceMonitorable;
@@ -37,6 +38,7 @@
import org.chorem.lima.ui.opening.OpeningView;
import org.chorem.lima.util.ErrorHelper;
+import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
import java.util.Arrays;
import java.util.Date;
@@ -49,7 +51,7 @@
* @author ore
* @version $Revision$
*/
-public class LimaMain {
+public class LimaMain implements Thread.UncaughtExceptionHandler {
/** Log. */
private static final Log log = LogFactory.getLog(LimaMain.class);
@@ -64,36 +66,46 @@
* Lima main method.
*
* @param args program args
+ * @throws Exception
*/
- public static void main(String[] args) {
+ public static void main(String[] args) throws Exception {
if (log.isInfoEnabled()) {
log.info("Lima starts at " + new Date());
log.info("Args: " + Arrays.toString(args));
}
- try {
+ // init root context
+ LimaContext context = init(args);
- // init root context
- LimaContext context = init(args);
+ // do actions
+ config = context.getConfig();
+ config.doAction(LimaConfig.Action.AFTER_INIT_STEP);
- // do actions
- config = context.getConfig();
- config.doAction(LimaConfig.Action.AFTER_INIT_STEP);
+ // display main ui
+ if (config.isLaunchui()) {
+ // override default exception management (after config init)
+ Thread.setDefaultUncaughtExceptionHandler(new LimaMain());
- // display main ui
- if (config.isLaunchui()) {
- launch(context);
- }
- } catch (Exception ex) {
- if (log.isErrorEnabled()) {
- log.error(_("lima.common.globalexception"), ex);
- }
- ErrorHelper.showErrorDialog(_("lima.common.globalexception"), ex);
- System.exit(1);
+ launch(context);
}
}
+ public void uncaughtException(Thread t, Throwable ex) {
+ if (log.isErrorEnabled()) {
+ log.error("Global application exception", ex);
+ }
+
+ Throwable cause = ex.getCause();
+ if (cause instanceof LimaBusinessException) {
+ JOptionPane.showMessageDialog(null, cause.getMessage(),
+ _("lima.ui.common.error"), JOptionPane.ERROR_MESSAGE);
+ } else {
+ ErrorHelper errorHelper = new ErrorHelper(config);
+ errorHelper.showErrorDialog(null, ex.getMessage(), ex);
+ }
+ }
+
/**
* initialisation de l'application :
* <p/>
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 2012-04-17 15:39:47 UTC (rev 3372)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java 2012-04-17 16:00:24 UTC (rev 3373)
@@ -33,6 +33,7 @@
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.LimaConfig;
import org.chorem.lima.LimaContext;
+import org.chorem.lima.business.LimaRuntimeException;
import org.chorem.lima.business.monitorable.HttpServerServiceMonitorable;
import org.chorem.lima.enums.ImportExportEnum;
import org.chorem.lima.service.LimaServiceFactory;
@@ -194,7 +195,7 @@
try {
DesktopUtil.browse(siteURL.toURI());
} catch (Exception e) {
- ErrorHelper.showErrorDialog("Can't open lima website at " + siteURL, e);
+ throw new LimaRuntimeException("Can't open lima website at " + siteURL, e);
}
}
@@ -451,7 +452,7 @@
try {
SwingUtil.openLink(url);
} catch (Exception e) {
- ErrorHelper.showErrorDialog("Can't open lima website at " + url, e);
+ throw new LimaRuntimeException("Can't open lima website at " + url, e);
}
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsViewHandler.java 2012-04-17 15:39:47 UTC (rev 3372)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsViewHandler.java 2012-04-17 16:00:24 UTC (rev 3373)
@@ -29,6 +29,7 @@
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.beans.ReportsDatas;
import org.chorem.lima.business.LimaException;
+import org.chorem.lima.business.LimaRuntimeException;
import org.chorem.lima.business.ServiceListener;
import org.chorem.lima.business.monitorable.FinancialTransactionServiceMonitorable;
import org.chorem.lima.business.monitorable.ImportServiceMonitorable;
@@ -108,10 +109,7 @@
results = reportService.generateAccountsReports(selectedAccount, true,
selectedBeginDate, selectedEndDate);
} catch (LimaException eee) {
- if (log.isErrorEnabled()) {
- log.error("Can't update model", eee);
- }
- ErrorHelper.showErrorDialog(_("lima.accountsreports.listerror"), eee);
+ throw new LimaRuntimeException(_("lima.accountsreports.listerror"), eee);
}
}
return results;
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceViewHandler.java 2012-04-17 15:39:47 UTC (rev 3372)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceViewHandler.java 2012-04-17 16:00:24 UTC (rev 3373)
@@ -30,6 +30,7 @@
import org.chorem.lima.LimaConfig;
import org.chorem.lima.beans.BalanceTrial;
import org.chorem.lima.business.LimaException;
+import org.chorem.lima.business.LimaRuntimeException;
import org.chorem.lima.business.ServiceListener;
import org.chorem.lima.business.monitorable.FinancialTransactionServiceMonitorable;
import org.chorem.lima.business.monitorable.FiscalPeriodServiceMonitorable;
@@ -133,10 +134,7 @@
try {
results = reportService.generateBalanceTrial(selectedBeginDate, selectedEndDate, selectedAccounts, false, view.getMovmentedFilter().isSelected());
} catch (LimaException eee) {
- if (log.isErrorEnabled()) {
- log.error("Can't update model", eee);
- }
- ErrorHelper.showErrorDialog(_("lima.balance.listerror"), eee);
+ throw new LimaRuntimeException(_("lima.balance.listerror"), eee);
}
return results;
}
@@ -187,10 +185,7 @@
try {
blockedFiscalPeriods = fiscalPeriodService.getAllBlockedFiscalPeriods();
} catch (LimaException eee) {
- if (log.isErrorEnabled()) {
- log.error("Enable to create document ", eee);
- }
- ErrorHelper.showErrorDialog(_("lima.balance.documentcreationerror"), eee);
+ throw new LimaRuntimeException(_("lima.balance.documentcreationerror"), eee);
}
//tells if the fiscaPeriod as been found and is blocked
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsViewHandler.java 2012-04-17 15:39:47 UTC (rev 3372)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsViewHandler.java 2012-04-17 16:00:24 UTC (rev 3373)
@@ -25,11 +25,26 @@
package org.chorem.lima.ui.entrybooksreports;
+import static org.nuiton.i18n.I18n._;
+
+import java.awt.Desktop;
+import java.io.IOException;
+import java.math.BigDecimal;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import javax.swing.JOptionPane;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.LimaConfig;
import org.chorem.lima.beans.ReportsDatas;
import org.chorem.lima.business.LimaException;
+import org.chorem.lima.business.LimaRuntimeException;
import org.chorem.lima.business.ServiceListener;
import org.chorem.lima.business.monitorable.DocumentServiceMonitorable;
import org.chorem.lima.business.monitorable.FinancialTransactionServiceMonitorable;
@@ -44,20 +59,7 @@
import org.chorem.lima.service.LimaServiceFactory;
import org.chorem.lima.util.ErrorHelper;
-import javax.swing.JOptionPane;
-import java.awt.Desktop;
-import java.io.IOException;
-import java.math.BigDecimal;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import static org.nuiton.i18n.I18n._;
-
-
/**
* Handler associated with accounts reports view.
* By : $Author$
@@ -136,10 +138,7 @@
reportService.generateEntryBooksReports(
selectedEntryBook, selectedBeginDate, selectedEndDate);
} catch (LimaException eee) {
- if (log.isErrorEnabled()) {
- log.error("Can't update model", eee);
- }
- ErrorHelper.showErrorDialog(_("lima.entrybooksreports.listerror"), eee);
+ throw new LimaRuntimeException(_("lima.entrybooksreports.listerror"), eee);
}
}
return results;
@@ -191,10 +190,7 @@
try {
blockedFiscalPeriods = fiscalPeriodService.getAllBlockedFiscalPeriods();
} catch (LimaException eee) {
- if (log.isErrorEnabled()) {
- log.error("Enable to create document ", eee);
- }
- ErrorHelper.showErrorDialog(_("lima.entrybooksreports.documentcreationerror"), eee);
+ throw new LimaRuntimeException(_("lima.entrybooksreports.documentcreationerror"), eee);
}
//tells if the fiscaPeriod as been found and is blocked
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 2012-04-17 15:39:47 UTC (rev 3372)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartViewHandler.java 2012-04-17 16:00:24 UTC (rev 3373)
@@ -29,6 +29,7 @@
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.LimaBusinessException;
import org.chorem.lima.business.LimaException;
+import org.chorem.lima.business.LimaRuntimeException;
import org.chorem.lima.business.ServiceListener;
import org.chorem.lima.business.monitorable.FinancialStatementServiceMonitorable;
import org.chorem.lima.business.monitorable.ImportServiceMonitorable;
@@ -113,10 +114,7 @@
DialogHelper.showErrorMessageDialog(view, eee);
} catch (LimaException ex) {
- if (log.isErrorEnabled()) {
- log.error("Can't add financialStatementHeader", ex);
- }
- ErrorHelper.showErrorDialog(_("lima.financialstatement.addfinancialStatementHeadererror"), ex);
+ throw new LimaRuntimeException(_("lima.financialstatement.addfinancialStatementHeadererror"), ex);
}
}
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableModel.java 2012-04-17 15:39:47 UTC (rev 3372)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableModel.java 2012-04-17 16:00:24 UTC (rev 3373)
@@ -30,6 +30,7 @@
import org.chorem.lima.LimaConfig;
import org.chorem.lima.beans.FinancialStatementAmounts;
import org.chorem.lima.business.LimaException;
+import org.chorem.lima.business.LimaRuntimeException;
import org.chorem.lima.business.ServiceListener;
import org.chorem.lima.business.api.DocumentService;
import org.chorem.lima.business.api.FinancialStatementService;
@@ -257,10 +258,7 @@
try {
results = financialStatementService.financialStatementReport(selectedBeginDate, selectedEndDate);
} catch (LimaException eee) {
- if (log.isErrorEnabled()) {
- log.error("Can't update model", eee);
- }
- ErrorHelper.showErrorDialog(_("lima.financialstatementreport.listerror"), eee);
+ throw new LimaRuntimeException(_("lima.financialstatementreport.listerror"), eee);
}
}
return results;
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportViewHandler.java 2012-04-17 15:39:47 UTC (rev 3372)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportViewHandler.java 2012-04-17 16:00:24 UTC (rev 3373)
@@ -28,6 +28,7 @@
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.monitorable.FiscalPeriodServiceMonitorable;
import org.chorem.lima.business.utils.FormatsEnum;
import org.chorem.lima.entity.FiscalPeriod;
@@ -89,10 +90,7 @@
try {
blockedFiscalPeriods = fiscalPeriodService.getAllBlockedFiscalPeriods();
} catch (LimaException eee) {
- if (log.isErrorEnabled()) {
- log.error("Enable to create document ", eee);
- }
- ErrorHelper.showErrorDialog("Enable to create document ", eee);
+ throw new LimaRuntimeException("Enable to create document ", eee);
}
//tells if the fiscaPeriod as been found and is blocked
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchTableModel.java 2012-04-17 15:39:47 UTC (rev 3372)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchTableModel.java 2012-04-17 16:00:24 UTC (rev 3373)
@@ -31,6 +31,7 @@
import org.chorem.lima.beans.FinancialTransactionSearch;
import org.chorem.lima.business.LimaBusinessException;
import org.chorem.lima.business.LimaException;
+import org.chorem.lima.business.LimaRuntimeException;
import org.chorem.lima.business.ServiceListener;
import org.chorem.lima.business.api.FinancialPeriodService;
import org.chorem.lima.business.api.FinancialTransactionService;
@@ -124,11 +125,7 @@
try {
results = financialTransactionService.searchFinancialTransaction(financialTransactionSearch);
} catch (LimaException eee) {
- if (log.isErrorEnabled()) {
- log.error("Can't update model", eee);
- }
-
- ErrorHelper.showErrorDialog("Can't get transaction list", eee);
+ throw new LimaRuntimeException("Can't get transaction list", eee);
}
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTableModel.java 2012-04-17 15:39:47 UTC (rev 3372)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTableModel.java 2012-04-17 16:00:24 UTC (rev 3373)
@@ -28,6 +28,7 @@
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.ServiceListener;
import org.chorem.lima.business.api.FinancialTransactionService;
import org.chorem.lima.business.monitorable.FinancialTransactionServiceMonitorable;
@@ -116,11 +117,7 @@
results.addAll(entries);
}
} catch (LimaException eee) {
- if (log.isErrorEnabled()) {
- log.error("Can't update model", eee);
- }
-
- ErrorHelper.showErrorDialog("Can't get transaction list", eee);
+ throw new LimaRuntimeException("Can't get transaction list", eee);
}
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerViewHandler.java 2012-04-17 15:39:47 UTC (rev 3372)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerViewHandler.java 2012-04-17 16:00:24 UTC (rev 3373)
@@ -31,6 +31,7 @@
import org.chorem.lima.beans.BalanceTrial;
import org.chorem.lima.beans.ReportsDatas;
import org.chorem.lima.business.LimaException;
+import org.chorem.lima.business.LimaRuntimeException;
import org.chorem.lima.business.ServiceListener;
import org.chorem.lima.business.api.FiscalPeriodService;
import org.chorem.lima.business.api.ReportService;
@@ -151,10 +152,7 @@
}
}
} catch (LimaException eee) {
- if (log.isErrorEnabled()) {
- log.error("Can't update model", eee);
- }
- ErrorHelper.showErrorDialog("Can't get entries list", eee);
+ throw new LimaRuntimeException("Can't get entries list", eee);
}
return results;
}
@@ -202,10 +200,7 @@
try {
blockedFiscalPeriods = fiscalPeriodService.getAllBlockedFiscalPeriods();
} catch (LimaException eee) {
- if (log.isErrorEnabled()) {
- log.error("Enable to create document ", eee);
- }
- ErrorHelper.showErrorDialog(_("lima.ledger.documentcreationerror"), eee);
+ throw new LimaRuntimeException(_("lima.ledger.documentcreationerror"), eee);
}
//tells if the fiscaPeriod as been found and is blocked
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTableModel.java 2012-04-17 15:39:47 UTC (rev 3372)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTableModel.java 2012-04-17 16:00:24 UTC (rev 3373)
@@ -28,6 +28,7 @@
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.ServiceListener;
import org.chorem.lima.business.api.FinancialTransactionService;
import org.chorem.lima.business.monitorable.FinancialTransactionServiceMonitorable;
@@ -132,10 +133,7 @@
results.addAll(entries);
}
} catch (LimaException eee) {
- if (log.isErrorEnabled()) {
- log.error("Can't update model", eee);
- }
- ErrorHelper.showErrorDialog(_("lima.lettering.listerror"), eee);
+ throw new LimaRuntimeException(_("lima.lettering.listerror"), eee);
}
}
return results;
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportTableModel.java 2012-04-17 15:39:47 UTC (rev 3372)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportTableModel.java 2012-04-17 16:00:24 UTC (rev 3373)
@@ -28,6 +28,7 @@
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.beans.VatStatementAmounts;
import org.chorem.lima.business.LimaException;
+import org.chorem.lima.business.LimaRuntimeException;
import org.chorem.lima.business.ServiceListener;
import org.chorem.lima.business.api.VatStatementService;
import org.chorem.lima.business.monitorable.FinancialTransactionServiceMonitorable;
@@ -107,10 +108,7 @@
getBeginDate(),
getEndDate());
} catch (LimaException eee) {
- if (log.isErrorEnabled()) {
- log.error("Can't update model", eee);
- }
- ErrorHelper.showErrorDialog(_("lima.vatreport.listerror"), eee);
+ throw new LimaRuntimeException(_("lima.vatreport.listerror"), eee);
}
}
return list;
@@ -120,10 +118,7 @@
try {
cacheDataList = getDataList();
} catch (TopiaException eee) {
- if (log.isErrorEnabled()) {
- log.error("Can't update model", eee);
- }
- ErrorHelper.showErrorDialog("Can't get VAT list", eee);
+ throw new LimaRuntimeException("Can't get VAT list", eee);
}
fireTableDataChanged();
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/util/ErrorHelper.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/util/ErrorHelper.java 2012-04-17 15:39:47 UTC (rev 3372)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/util/ErrorHelper.java 2012-04-17 16:00:24 UTC (rev 3373)
@@ -25,17 +25,8 @@
package org.chorem.lima.util;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.commons.mail.EmailException;
-import org.apache.commons.mail.MultiPartEmail;
-import org.chorem.lima.LimaMain;
-import org.jdesktop.swingx.JXErrorPane;
-import org.jdesktop.swingx.error.ErrorInfo;
-import org.jdesktop.swingx.error.ErrorReporter;
+import static org.nuiton.i18n.I18n._;
-import javax.swing.JOptionPane;
import java.awt.Component;
import java.io.PrintWriter;
import java.io.StringWriter;
@@ -44,8 +35,18 @@
import java.util.Date;
import java.util.List;
-import static org.nuiton.i18n.I18n._;
+import javax.swing.JOptionPane;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.commons.mail.EmailException;
+import org.apache.commons.mail.MultiPartEmail;
+import org.chorem.lima.LimaConfig;
+import org.jdesktop.swingx.JXErrorPane;
+import org.jdesktop.swingx.error.ErrorInfo;
+import org.jdesktop.swingx.error.ErrorReporter;
+
/**
* Error helper.
* <p/>
@@ -62,6 +63,12 @@
/** Log. */
private static final Log log = LogFactory.getLog(ErrorHelper.class);
+ protected LimaConfig config;
+
+ public ErrorHelper(LimaConfig config) {
+ this.config = config;
+ }
+
/**
* Display a user friendly error frame.
*
@@ -69,14 +76,14 @@
* @param message message for user
* @param cause exception cause
*/
- public static void showErrorDialog(Component parent, String message,
+ public void showErrorDialog(Component parent, String message,
Throwable cause) {
JXErrorPane pane = new JXErrorPane();
ErrorInfo info = new ErrorInfo(_("lima.common.error"),
_("lima.error.errorpane.htmlmessage", message), null, null,
cause, null, null);
pane.setErrorInfo(info);
- pane.setErrorReporter(new ErrorHelper());
+ pane.setErrorReporter(this);
JXErrorPane.showDialog(parent, pane);
}
@@ -85,7 +92,7 @@
*
* @param message message for user
*/
- public static void showErrorDialog(String message) {
+ public void showErrorDialog(String message) {
showErrorDialog(message, null);
}
@@ -95,7 +102,7 @@
* @param message message for user
* @param cause exception cause
*/
- public static void showErrorDialog(String message, Throwable cause) {
+ public void showErrorDialog(String message, Throwable cause) {
showErrorDialog(null, message, cause);
}
@@ -106,7 +113,7 @@
public void reportError(ErrorInfo errorInfo) throws NullPointerException {
try {
- String emailTo = LimaMain.config.getSupportEmail();
+ String emailTo = config.getSupportEmail();
MultiPartEmail email = new MultiPartEmail();
// smtp
@@ -120,19 +127,19 @@
// message description
StringBuffer message = new StringBuffer();
- message.append(formatMessage("Project", "Lima " + LimaMain.config.getVersion()));
+ message.append(formatMessage("Project", "Lima " + config.getVersion()));
message.append(formatMessage("Date", new Date().toString()));
message.append(formatMessage("Title", errorInfo.getTitle()));
message.append(formatMessage("Description", errorInfo.getBasicErrorMessage().replaceAll("<[^>]+>", "")));
// message configuration
message.append(formatMessage("Configuration", null));
- List<String> propertiesNames = new ArrayList<String>(LimaMain.config.getOptions().stringPropertyNames());
+ List<String> propertiesNames = new ArrayList<String>(config.getOptions().stringPropertyNames());
Collections.sort(propertiesNames);
for (String propertyName : propertiesNames) {
// security, don't send string containing password :
if (!propertyName.contains("pass")) {
- message.append("\t" + propertyName + " : " + LimaMain.config.getOptions().getProperty(propertyName) + "\n");
+ message.append("\t" + propertyName + " : " + config.getOptions().getProperty(propertyName) + "\n");
}
}
@@ -142,9 +149,6 @@
errorInfo.getErrorException().printStackTrace(writer);
message.append(formatMessage("Exception", out.toString()));
- // TODO EC-20100409 i18n files are iso encoded ?
- email.setContent(message.toString(), "text/plain; charset=ISO-8859-9");
-
// send mail
email.send();
1
0
r3372 - trunk/lima-business/src/main/java/org/chorem/lima
by echatellier@users.chorem.org 17 Apr '12
by echatellier@users.chorem.org 17 Apr '12
17 Apr '12
Author: echatellier
Date: 2012-04-17 17:39:47 +0200 (Tue, 17 Apr 2012)
New Revision: 3372
Url: http://chorem.org/repositories/revision/lima/3372
Log:
Remove unused class
Removed:
trunk/lima-business/src/main/java/org/chorem/lima/LimaThread.java
Deleted: trunk/lima-business/src/main/java/org/chorem/lima/LimaThread.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/LimaThread.java 2012-04-17 15:37:23 UTC (rev 3371)
+++ trunk/lima-business/src/main/java/org/chorem/lima/LimaThread.java 2012-04-17 15:39:47 UTC (rev 3372)
@@ -1,42 +0,0 @@
-/*
- * #%L
- *
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Codelutin, Chatellier Eric
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/lgpl-3.0.html>.
- * #L%
- */
-
-package org.chorem.lima;
-
-import org.nuiton.topia.TopiaContext;
-
-/**
- * TODO add comment here.
- *
- * @author chatellier
- * @version $Revision$
- *
- * Last update : $Date$
- * By : $Author$
- */
-public class LimaThread {
-
- public static ThreadLocal<TopiaContext> threadLocal = new ThreadLocal<TopiaContext>();
-}
1
0
r3371 - in trunk: lima-business/src/main/java/org/chorem/lima lima-business/src/main/java/org/chorem/lima/business lima-business/src/main/java/org/chorem/lima/business/accountingrules lima-business/src/main/java/org/chorem/lima/business/ejb lima-business/src/main/resources/META-INF lima-business-api/src/main/java/org/chorem/lima/business/api
by echatellier@users.chorem.org 17 Apr '12
by echatellier@users.chorem.org 17 Apr '12
17 Apr '12
Author: echatellier
Date: 2012-04-17 17:37:23 +0200 (Tue, 17 Apr 2012)
New Revision: 3371
Url: http://chorem.org/repositories/revision/lima/3371
Log:
Add transaction support by container.
Added:
trunk/lima-business/src/main/java/org/chorem/lima/LimaThread.java
trunk/lima-business/src/main/java/org/chorem/lima/LimaXAResource.java
trunk/lima-business/src/main/java/org/chorem/lima/business/LimaDaoHelper.java
trunk/lima-business/src/main/java/org/chorem/lima/business/LimaInterceptor.java
Removed:
trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/AccountServiceLocal.java
Modified:
trunk/lima-business/src/main/java/org/chorem/lima/business/AccountingRules.java
trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/DefaultAccountingRules.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ReportServiceImpl.java
trunk/lima-business/src/main/resources/META-INF/ejb-jar.xml
Added: trunk/lima-business/src/main/java/org/chorem/lima/LimaThread.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/LimaThread.java (rev 0)
+++ trunk/lima-business/src/main/java/org/chorem/lima/LimaThread.java 2012-04-17 15:37:23 UTC (rev 3371)
@@ -0,0 +1,42 @@
+/*
+ * #%L
+ *
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Codelutin, Chatellier Eric
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+package org.chorem.lima;
+
+import org.nuiton.topia.TopiaContext;
+
+/**
+ * TODO add comment here.
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * By : $Author$
+ */
+public class LimaThread {
+
+ public static ThreadLocal<TopiaContext> threadLocal = new ThreadLocal<TopiaContext>();
+}
Property changes on: trunk/lima-business/src/main/java/org/chorem/lima/LimaThread.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/lima-business/src/main/java/org/chorem/lima/LimaXAResource.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/LimaXAResource.java (rev 0)
+++ trunk/lima-business/src/main/java/org/chorem/lima/LimaXAResource.java 2012-04-17 15:37:23 UTC (rev 3371)
@@ -0,0 +1,153 @@
+/*
+ * #%L
+ *
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Codelutin, Chatellier Eric
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+package org.chorem.lima;
+
+import javax.transaction.xa.XAException;
+import javax.transaction.xa.XAResource;
+import javax.transaction.xa.Xid;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuiton.topia.TopiaContext;
+import org.nuiton.topia.TopiaException;
+
+/**
+ * Topia XA ressource containing TopiaContext to commit or rollback.
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * By : $Author$
+ */
+public class LimaXAResource implements XAResource {
+
+ private static Log log = LogFactory.getLog(LimaXAResource.class);
+
+ protected TopiaContext context;
+
+ protected int timeout;
+
+ public LimaXAResource(TopiaContext context) {
+ this.context = context;
+ }
+
+ /*
+ * @see javax.transaction.xa.XAResource#commit(javax.transaction.xa.Xid, boolean)
+ */
+ @Override
+ public void commit(Xid arg0, boolean arg1) throws XAException {
+ try {
+ context.commitTransaction();
+ } catch (TopiaException ex) {
+ if (log.isErrorEnabled()) {
+ log.error("Error", ex);
+ }
+ throw new XAException(XAException.XA_HEURCOM);
+ }
+ }
+
+ /*
+ * @see javax.transaction.xa.XAResource#end(javax.transaction.xa.Xid, int)
+ */
+ @Override
+ public void end(Xid arg0, int arg1) throws XAException {
+ /*try {
+ context.closeContext();
+ } catch (TopiaException ex) {
+ throw new XAException(XAException.XA_HEURCOM);
+ }*/
+ }
+
+ /*
+ * @see javax.transaction.xa.XAResource#forget(javax.transaction.xa.Xid)
+ */
+ @Override
+ public void forget(Xid xid) throws XAException {
+
+ }
+
+ /*
+ * @see javax.transaction.xa.XAResource#getTransactionTimeout()
+ */
+ @Override
+ public int getTransactionTimeout() throws XAException {
+ return timeout;
+ }
+
+ /*
+ * @see javax.transaction.xa.XAResource#isSameRM(javax.transaction.xa.XAResource)
+ */
+ @Override
+ public boolean isSameRM(XAResource xar) throws XAException {
+ return false;
+ }
+
+ /*
+ * @see javax.transaction.xa.XAResource#prepare(javax.transaction.xa.Xid)
+ */
+ @Override
+ public int prepare(Xid xid) throws XAException {
+ return XAResource.XA_OK;
+ }
+
+ /*
+ * @see javax.transaction.xa.XAResource#recover(int)
+ */
+ @Override
+ public Xid[] recover(int arg0) throws XAException {
+ return null;
+ }
+
+ /*
+ * @see javax.transaction.xa.XAResource#rollback(javax.transaction.xa.Xid)
+ */
+ @Override
+ public void rollback(Xid arg0) throws XAException {
+ try {
+ context.rollbackTransaction();
+ } catch (TopiaException ex) {
+ throw new XAException(XAException.XA_HEURCOM);
+ }
+ }
+
+ /*
+ * @see javax.transaction.xa.XAResource#setTransactionTimeout(int)
+ */
+ @Override
+ public boolean setTransactionTimeout(int timeout) throws XAException {
+ this.timeout = timeout;
+ return true;
+ }
+
+ /*
+ * @see javax.transaction.xa.XAResource#start(javax.transaction.xa.Xid, int)
+ */
+ @Override
+ public void start(Xid arg0, int arg1) throws XAException {
+
+ }
+}
Property changes on: trunk/lima-business/src/main/java/org/chorem/lima/LimaXAResource.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/AccountingRules.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/AccountingRules.java 2012-04-13 16:06:28 UTC (rev 3370)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/AccountingRules.java 2012-04-17 15:37:23 UTC (rev 3371)
@@ -53,7 +53,7 @@
void updateAccountRules(Account account) throws LimaException;
- void removeAccountRules(Account account, TopiaContext transaction) throws LimaException;
+ void removeAccountRules(Account account) throws LimaException;
/**
* Entrybook rules.
Added: trunk/lima-business/src/main/java/org/chorem/lima/business/LimaDaoHelper.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/LimaDaoHelper.java (rev 0)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/LimaDaoHelper.java 2012-04-17 15:37:23 UTC (rev 3371)
@@ -0,0 +1,62 @@
+/*
+ * #%L
+ *
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Codelutin, Chatellier Eric
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+package org.chorem.lima.business;
+
+import org.chorem.lima.entity.AccountDAO;
+import org.chorem.lima.entity.EntryDAO;
+import org.chorem.lima.entity.LimaCallaoDAOHelper;
+import org.nuiton.topia.TopiaContext;
+import org.nuiton.topia.TopiaException;
+
+/**
+ * DOA helper based on EJB because of context using.
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * By : $Author$
+ */
+public class LimaDaoHelper {
+
+ protected static TopiaContext getContextTransaction() {
+ TopiaContext result = (TopiaContext)LimaInterceptor.TOPIA_CONTEXT.get();
+
+ if (result == null) {
+ throw new IllegalStateException("No opened transaction found. Put @TransactionAttribute on method or class");
+ }
+
+ return result;
+ }
+
+ public static AccountDAO getAccountDAO() throws TopiaException {
+ return LimaCallaoDAOHelper.getAccountDAO(getContextTransaction());
+ }
+
+ public static EntryDAO getEntryDAO() throws TopiaException {
+ return LimaCallaoDAOHelper.getEntryDAO(getContextTransaction());
+ }
+}
Property changes on: trunk/lima-business/src/main/java/org/chorem/lima/business/LimaDaoHelper.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/lima-business/src/main/java/org/chorem/lima/business/LimaInterceptor.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/LimaInterceptor.java (rev 0)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/LimaInterceptor.java 2012-04-17 15:37:23 UTC (rev 3371)
@@ -0,0 +1,122 @@
+/*
+ * #%L
+ *
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Codelutin, Chatellier Eric
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+package org.chorem.lima.business;
+
+import javax.annotation.Resource;
+import javax.ejb.Stateless;
+import javax.ejb.TransactionAttribute;
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.InvocationContext;
+import javax.transaction.Transaction;
+import javax.transaction.TransactionManager;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.chorem.lima.LimaXAResource;
+import org.nuiton.topia.TopiaContext;
+import org.nuiton.topia.TopiaContextFactory;
+import org.nuiton.topia.TopiaNotFoundException;
+
+/**
+ * Interceptor for topia context transaction.
+ *
+ * http://stackoverflow.com/questions/8608349
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * By : $Author$
+ */
+@Stateless
+public class LimaInterceptor {
+
+ private final Log log = LogFactory.getLog(LimaInterceptor.class);
+
+ public static final ThreadLocal<TopiaContext> TOPIA_CONTEXT = new ThreadLocal<TopiaContext>();
+
+ @Resource
+ private TransactionManager transactionManager;
+
+ protected TopiaContext rootContext;
+
+ public LimaInterceptor() {
+ if (log.isInfoEnabled()) {
+ log.info("Init root context");
+ }
+
+ LimaConfig config = LimaConfig.getInstance();
+ try {
+ rootContext = TopiaContextFactory.getContext(config.getFlatOptions());
+ } catch (TopiaNotFoundException ex) {
+ if (log.isErrorEnabled()) {
+ log.error("Can't init root context", ex);
+ }
+ }
+ }
+
+ @AroundInvoke
+ public Object invoke(InvocationContext context) throws Exception {
+
+ Object result;
+
+ // only open transaction when incoming call just
+ // enter in service layer
+ // interceptor will be called before each internal
+ // ejb call, but opening a new transaction in not required
+ if (TOPIA_CONTEXT.get() == null) {
+
+ // maybe take care of TransactionAttributeTypes ?
+ if (context.getTarget().getClass().getAnnotation(TransactionAttribute.class) != null ||
+ context.getMethod().getAnnotation(TransactionAttribute.class) != null) {
+ if (log.isDebugEnabled()) {
+ log.debug("Init new topia transaction for method : " +
+ context.getTarget().getClass() + "#" + context.getMethod().getName());
+ }
+
+ TopiaContext tx = rootContext.beginTransaction();
+
+ TOPIA_CONTEXT.set(tx);
+
+ Transaction tr = transactionManager.getTransaction();
+
+ // enlist topia xaresource, will will commited or rollback
+ // by container
+ tr.enlistResource(new LimaXAResource(tx));
+
+ result = context.proceed();
+ TOPIA_CONTEXT.remove();
+ } else {
+ result = context.proceed();
+ }
+
+ } else {
+ result = context.proceed();
+ }
+
+ return result;
+ }
+}
Property changes on: trunk/lima-business/src/main/java/org/chorem/lima/business/LimaInterceptor.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/DefaultAccountingRules.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/DefaultAccountingRules.java 2012-04-13 16:06:28 UTC (rev 3370)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/DefaultAccountingRules.java 2012-04-17 15:37:23 UTC (rev 3371)
@@ -25,11 +25,18 @@
package org.chorem.lima.business.accountingrules;
+import static org.nuiton.i18n.I18n._;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.AccountingRules;
import org.chorem.lima.business.LimaBusinessException;
+import org.chorem.lima.business.LimaDaoHelper;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.entity.Account;
import org.chorem.lima.entity.ClosedPeriodicEntryBook;
@@ -48,12 +55,6 @@
import org.nuiton.topia.TopiaException;
import org.nuiton.topia.framework.TopiaQuery;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-
-import static org.nuiton.i18n.I18n._;
-
/**
* Defaults rules, if no localized rules classes is instantiated
* this default class contain the strict minimum rules to check the data integrity.
@@ -67,6 +68,9 @@
protected static final Log log =
LogFactory.getLog(DefaultAccountingRules.class);
+ /** DAO helper not injected by EJB. */
+ protected LimaDaoHelper daoHelper = new LimaDaoHelper();
+
/**
* Rules to check before create accounts.
*/
@@ -111,16 +115,16 @@
* Recursive function
*/
@Override
- public void removeAccountRules(Account account, TopiaContext transaction) throws LimaException {
+ public void removeAccountRules(Account account) throws LimaException {
try {
- EntryDAO entryDAO = LimaCallaoDAOHelper.getEntryDAO(transaction);
+ EntryDAO entryDAO = daoHelper.getEntryDAO();
// Check if account have entries
int nbentries = entryDAO.findAllByAccount(account).size();
if (nbentries != 0) {
throw new LimaBusinessException(_("lima-business.defaultaccountingrules.deleteaccounterror"));
}
} catch (TopiaException ex) {
- doCatch(transaction, ex, log);
+ throw new LimaException("Can't remvoe account", ex);
}
}
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java 2012-04-13 16:06:28 UTC (rev 3370)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java 2012-04-17 15:37:23 UTC (rev 3371)
@@ -25,28 +25,26 @@
package org.chorem.lima.business.ejb;
+import static org.nuiton.i18n.I18n._;
+
+import java.util.Collections;
+import java.util.List;
+
+import javax.ejb.Remote;
+import javax.ejb.Stateless;
+import javax.ejb.TransactionAttribute;
+
import org.chorem.lima.business.AccountingRules;
import org.chorem.lima.business.LimaBusinessException;
import org.chorem.lima.business.LimaConfig;
+import org.chorem.lima.business.LimaDaoHelper;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.business.api.AccountService;
-import org.chorem.lima.business.api.AccountServiceLocal;
import org.chorem.lima.business.utils.AccountComparator;
import org.chorem.lima.entity.Account;
import org.chorem.lima.entity.AccountDAO;
-import org.chorem.lima.entity.LimaCallaoDAOHelper;
-import org.nuiton.topia.TopiaContext;
import org.nuiton.topia.TopiaException;
-import javax.ejb.Local;
-import javax.ejb.Remote;
-import javax.ejb.Stateless;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import static org.nuiton.i18n.I18n._;
-
/**
* Permet d'implémenter le Plan Comptable Général.
* Un compte ne peut être supprimé si il contient des écritures comptables.
@@ -57,40 +55,35 @@
*/
@Stateless
@Remote(AccountService.class)
-(a)Local(AccountServiceLocal.class)
-public class AccountServiceImpl extends AbstractLimaService implements AccountService, AccountServiceLocal {
+@TransactionAttribute
+public class AccountServiceImpl extends AbstractLimaService implements AccountService {
- private TopiaContext rootContext;
-
- public AccountServiceImpl() {
- rootContext = acquireRootContext();
- }
-
@Override
public long getAccountCount() throws LimaException {
long result = 0;
- TopiaContext transaction = beginTransaction(rootContext);
- try {
- // check if the accountnumber already exist
- AccountDAO accountDAO = LimaCallaoDAOHelper.getAccountDAO(transaction);
-
+ try {
+ AccountDAO accountDAO = LimaDaoHelper.getAccountDAO();
result = accountDAO.count();
- } catch (Exception ex) {
- doCatch(transaction, ex);
- } finally {
- doFinally(transaction);
+ } catch (TopiaException ex) {
+ throw new LimaException("Can't count", ex);
}
return result;
}
/**
- * Create new account with existing transaction.
+ * Permet de créer un nouveau compte dans le PCG de l'application.
+ *
+ * @param account account to create
+ * @throws LimaException
*/
@Override
- public Account createAccountWithTransaction(Account account,
- TopiaContext topiaContext) throws LimaException {
+ public Account createAccount(Account account) throws LimaException {
+ // check rules before create the account
+ AccountingRules accountingRules = LimaConfig.getInstance().getAccountingRules();
+ accountingRules.createAccountRules(account);
+
Account result = null;
try {
@@ -98,8 +91,7 @@
account.setAccountNumber(account.getAccountNumber().toUpperCase());
// check if account number already exist
- AccountDAO accountDAO =
- LimaCallaoDAOHelper.getAccountDAO(topiaContext);
+ AccountDAO accountDAO = LimaDaoHelper.getAccountDAO();
Account existAccount =
accountDAO.findByAccountNumber(account.getAccountNumber());
@@ -111,63 +103,19 @@
//create it
result = accountDAO.create(account);
-
- commitTransaction(topiaContext);
} catch (TopiaException ex) {
- doCatch(topiaContext, ex);
+ throw new LimaException("Can't create account", ex);
}
return result;
}
-
- /**
- * Permet de créer un nouveau compte dans le PCG de l'application.
- * ATTENTION : le compte masterAccount, c'est à dire le compte père, doit
- * exister, sinon le compte n'est pas créé. Si le compte n'a pas de père, alors
- * mettre masterAccount à null.
- *
- * @param account account to create
- * @throws LimaException
- */
@Override
- public Account createAccount(Account account) throws LimaException {
-
- // check rules before create the account
- AccountingRules accountingRules = LimaConfig.getInstance().getAccountingRules();
- accountingRules.createAccountRules(account);
-
- Account result = null;
- TopiaContext transaction = beginTransaction(rootContext);
- try {
-
- // check if the accountnumber already exist
- AccountDAO accountDAO = LimaCallaoDAOHelper.getAccountDAO(transaction);
- Account existAccount =
- accountDAO.findByAccountNumber(account.getAccountNumber());
- if (existAccount != null) {
- throw new LimaBusinessException(_(
- "lima-business.account.accountalreardyexist",
- account.getAccountNumber()));
- }
-
- result = createAccountWithTransaction(account, transaction);
- } catch (Exception ex) {
- doCatch(transaction, ex);
- } finally {
- doFinally(transaction);
- }
- return result;
- }
-
- @Override
public Account getMasterAccount(String accountNumber) throws LimaException {
Account account = null;
- TopiaContext transaction = beginTransaction(rootContext);
try {
- AccountDAO accountDAO =
- LimaCallaoDAOHelper.getAccountDAO(transaction);
+ AccountDAO accountDAO = LimaDaoHelper.getAccountDAO();
while (account == null && accountNumber.length() > 1) {
@@ -175,10 +123,8 @@
account = accountDAO.findByAccountNumber(accountNumber);
}
- } catch (Exception ex) {
- doCatch(transaction, ex);
- } finally {
- doFinally(transaction);
+ } catch (TopiaException ex) {
+ throw new LimaException("Can't get master account", ex);
}
return account;
}
@@ -188,16 +134,11 @@
public Account getAccountByNumber(String number) throws LimaException {
Account account = null;
- TopiaContext transaction = beginTransaction(rootContext);
try {
-
- AccountDAO accountDAO =
- LimaCallaoDAOHelper.getAccountDAO(transaction);
+ AccountDAO accountDAO = LimaDaoHelper.getAccountDAO();
account = accountDAO.findByAccountNumber(number);
} catch (Exception ex) {
- doCatch(transaction, ex);
- } finally {
- doFinally(transaction);
+ throw new LimaException("Can't get master account", ex);
}
return account;
@@ -208,18 +149,15 @@
@Override
public List<Account> getAllAccounts() throws LimaException {
- List<Account> accountsList = new ArrayList<Account>();
+ List<Account> accountsList;
- TopiaContext transaction = beginTransaction(rootContext);
try {
- AccountDAO accountDAO = LimaCallaoDAOHelper.getAccountDAO(transaction);
+ AccountDAO accountDAO = LimaDaoHelper.getAccountDAO();
accountsList = accountDAO.findAll();
Collections.sort(accountsList, new AccountComparator());
} catch (Exception ex) {
- doCatch(transaction, ex);
- } finally {
- doFinally(transaction);
+ throw new LimaException("Can't get all accounts", ex);
}
return accountsList;
@@ -232,15 +170,11 @@
List<Account> accountsList = null;
- TopiaContext transaction = beginTransaction(rootContext);
try {
- AccountDAO accountDAO =
- LimaCallaoDAOHelper.getAccountDAO(transaction);
+ AccountDAO accountDAO = LimaDaoHelper.getAccountDAO();
accountsList = accountDAO.findAllLeafAccounts();
} catch (Exception ex) {
- doCatch(transaction, ex);
- } finally {
- doFinally(transaction);
+ throw new LimaException("Can't get all leaf accounts", ex);
}
return accountsList;
@@ -258,10 +192,8 @@
List<Account> accountsList = null;
- TopiaContext transaction = beginTransaction(rootContext);
try {
- AccountDAO accountDAO =
- LimaCallaoDAOHelper.getAccountDAO(transaction);
+ AccountDAO accountDAO = LimaDaoHelper.getAccountDAO();
//TopiaQuery query = accountDAO.createQuery();
//tchemit 2011-09-21 Only consider account childs from the master account
@@ -294,9 +226,7 @@
accountsList = accountDAO.getSubAccounts(masterAccount);
} catch (Exception ex) {
- doCatch(transaction, ex);
- } finally {
- doFinally(transaction);
+ throw new LimaException("Can't get children accounts", ex);
}
return accountsList;
@@ -320,24 +250,21 @@
*/
@Override
public void removeAccount(Account account) throws LimaException {
- TopiaContext transaction = beginTransaction(rootContext);
+
AccountingRules accountingRules = LimaConfig.getInstance().getAccountingRules();
try {
// Check rules for account if have entries
- accountingRules.removeAccountRules(account, transaction);
+ accountingRules.removeAccountRules(account);
// remove account
- AccountDAO accountDAO = LimaCallaoDAOHelper.getAccountDAO(transaction);
+ AccountDAO accountDAO = LimaDaoHelper.getAccountDAO();
Account accountToDelete = accountDAO.findByTopiaId(account.getTopiaId());
accountDAO.delete(accountToDelete);
- commitTransaction(transaction);
- } catch (Exception ex) {
- doCatch(transaction, ex);
- } finally {
- doFinally(transaction);
+ } catch (TopiaException ex) {
+ throw new LimaException("Can't remove account", ex);
}
}
@@ -349,7 +276,6 @@
}
}
-
/**
* Permet de modifier un compte sur son label.
* <p/>
@@ -362,23 +288,19 @@
@Override
public Account updateAccount(Account account) throws LimaException {
- TopiaContext transaction = beginTransaction(rootContext);
AccountingRules accountingRules = LimaConfig.getInstance().getAccountingRules();
Account result = null;
try {
// DAO
- AccountDAO accountDAO =
- LimaCallaoDAOHelper.getAccountDAO(transaction);
+ AccountDAO accountDAO = LimaDaoHelper.getAccountDAO();
accountingRules.updateAccountRules(account);
result = accountDAO.update(account);
- commitTransaction(transaction);
+
} catch (Exception ex) {
- doCatch(transaction, ex);
- } finally {
- doFinally(transaction);
+ throw new LimaException("Can't update account", ex);
}
-
+
return result;
}
}
\ No newline at end of file
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 2012-04-13 16:06:28 UTC (rev 3370)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java 2012-04-17 15:37:23 UTC (rev 3371)
@@ -25,6 +25,22 @@
package org.chorem.lima.business.ejb;
+import static org.nuiton.i18n.I18n._;
+
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.ejb.EJB;
+import javax.ejb.Local;
+import javax.ejb.Remote;
+import javax.ejb.Stateless;
+
import org.apache.commons.lang3.time.DateUtils;
import org.chorem.lima.beans.BalanceTrial;
import org.chorem.lima.beans.ReportsDatas;
@@ -32,7 +48,7 @@
import org.chorem.lima.business.LimaBusinessException;
import org.chorem.lima.business.LimaConfig;
import org.chorem.lima.business.LimaException;
-import org.chorem.lima.business.api.AccountServiceLocal;
+import org.chorem.lima.business.api.AccountService;
import org.chorem.lima.business.api.EntryBookServiceLocal;
import org.chorem.lima.business.api.FinancialPeriodServiceLocal;
import org.chorem.lima.business.api.FinancialTransactionServiceLocal;
@@ -56,21 +72,6 @@
import org.nuiton.topia.TopiaException;
import org.nuiton.topia.framework.TopiaQuery;
-import javax.ejb.EJB;
-import javax.ejb.Local;
-import javax.ejb.Remote;
-import javax.ejb.Stateless;
-import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Date;
-import java.util.Iterator;
-import java.util.List;
-
-import static org.nuiton.i18n.I18n._;
-
/**
* Gestion des exercices.
* Un exercice ne peut être supprimée et débloquée après cloture.
@@ -85,7 +86,7 @@
private TopiaContext rootContext;
@EJB
- protected AccountServiceLocal accountService;
+ protected AccountService accountService;
@EJB
protected FinancialPeriodServiceLocal financialPeriodService;
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java 2012-04-13 16:06:28 UTC (rev 3370)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java 2012-04-17 15:37:23 UTC (rev 3371)
@@ -25,9 +25,32 @@
package org.chorem.lima.business.ejb;
-import au.com.bytecode.opencsv.CSVReader;
-import au.com.bytecode.opencsv.bean.ColumnPositionMappingStrategy;
-import au.com.bytecode.opencsv.bean.CsvToBean;
+import static org.nuiton.i18n.I18n._;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.StringReader;
+import java.math.BigDecimal;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
+
+import javax.ejb.EJB;
+import javax.ejb.Local;
+import javax.ejb.Remote;
+import javax.ejb.Stateless;
+
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -54,7 +77,7 @@
import org.chorem.lima.business.LimaBusinessException;
import org.chorem.lima.business.LimaConfig;
import org.chorem.lima.business.LimaException;
-import org.chorem.lima.business.api.AccountServiceLocal;
+import org.chorem.lima.business.api.AccountService;
import org.chorem.lima.business.api.EntryBookServiceLocal;
import org.chorem.lima.business.api.FinancialPeriodServiceLocal;
import org.chorem.lima.business.api.FinancialStatementServiceLocal;
@@ -100,31 +123,10 @@
import org.nuiton.topia.TopiaContext;
import org.nuiton.topia.TopiaException;
-import javax.ejb.EJB;
-import javax.ejb.Local;
-import javax.ejb.Remote;
-import javax.ejb.Stateless;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.StringReader;
-import java.math.BigDecimal;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.TreeMap;
+import au.com.bytecode.opencsv.CSVReader;
+import au.com.bytecode.opencsv.bean.ColumnPositionMappingStrategy;
+import au.com.bytecode.opencsv.bean.CsvToBean;
-import static org.nuiton.i18n.I18n._;
-
/**
* Import export service.
* Currently import and export as CSV and EBP.
@@ -139,7 +141,7 @@
private TopiaContext rootContext;
@EJB
- private AccountServiceLocal accountService;
+ private AccountService accountService;
@EJB
private FiscalPeriodServiceLocal fiscalPeriodService;
@@ -365,7 +367,7 @@
.findByAccountNumber(masterAccountNumber);
i++;
}
- accountService.createAccountWithTransaction(account, topiaContext);
+ accountService.createAccount(account);
result.append(_("lima-business.import.accountadded", accountNumber, label));
}
// else if account and exclude account start with 0 (fix from error on EBP)
@@ -373,7 +375,7 @@
// if account is class account : 1, 2, 3, 4, 5, 6, 7,…
int nbCharAccountNumber = accountNumber.length();
if (nbCharAccountNumber == 1) {
- accountService.createAccountWithTransaction(account, topiaContext);
+ accountService.createAccount(account);
result.append(_("lima-business.import.accountadded", accountNumber, label));
} else {
Account masterAccount = null;
@@ -385,7 +387,7 @@
.findByAccountNumber(masterAccountNumber);
i++;
}
- accountService.createAccountWithTransaction(account, topiaContext);
+ accountService.createAccount(account);
result.append(_("lima-business.import.accountadded", accountNumber, label));
}
}
@@ -1174,7 +1176,7 @@
account.setLabel(accountImport.getLabel());
account.setThirdParty(accountImport.getThirdParty());
- accountService.createAccountWithTransaction(account, topiaContext);
+ accountService.createAccount(account);
result.append(_("lima-business.import.accountadded",
accountImport.getAccountNumber(),
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ReportServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ReportServiceImpl.java 2012-04-13 16:06:28 UTC (rev 3370)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ReportServiceImpl.java 2012-04-17 15:37:23 UTC (rev 3371)
@@ -25,13 +25,23 @@
package org.chorem.lima.business.ejb;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import javax.ejb.EJB;
+import javax.ejb.Local;
+import javax.ejb.Remote;
+import javax.ejb.Stateless;
+
import org.apache.commons.lang3.StringUtils;
import org.chorem.lima.beans.BalanceTrial;
import org.chorem.lima.beans.BalanceTrialImpl;
import org.chorem.lima.beans.ReportsDatas;
import org.chorem.lima.beans.ReportsDatasImpl;
import org.chorem.lima.business.LimaException;
-import org.chorem.lima.business.api.AccountServiceLocal;
+import org.chorem.lima.business.api.AccountService;
import org.chorem.lima.business.api.FinancialPeriodServiceLocal;
import org.chorem.lima.business.api.ReportService;
import org.chorem.lima.business.api.ReportServiceLocal;
@@ -48,15 +58,6 @@
import org.nuiton.topia.TopiaException;
import org.nuiton.topia.framework.TopiaQuery;
-import javax.ejb.EJB;
-import javax.ejb.Local;
-import javax.ejb.Remote;
-import javax.ejb.Stateless;
-import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-
@Stateless
@Remote(ReportService.class)
@Local(ReportServiceLocal.class)
@@ -68,7 +69,7 @@
protected FinancialPeriodServiceLocal financialPeriodService;
@EJB
- protected AccountServiceLocal accountService;
+ protected AccountService accountService;
public ReportServiceImpl() {
rootContext = acquireRootContext();
Modified: trunk/lima-business/src/main/resources/META-INF/ejb-jar.xml
===================================================================
--- trunk/lima-business/src/main/resources/META-INF/ejb-jar.xml 2012-04-13 16:06:28 UTC (rev 3370)
+++ trunk/lima-business/src/main/resources/META-INF/ejb-jar.xml 2012-04-17 15:37:23 UTC (rev 3371)
@@ -25,5 +25,14 @@
<!--
Empty configuration file based on
http://openejb.apache.org/application-discovery-via-the-classpath.html
+
+ Interceptor based on : http://openejb.apache.org/examples-trunk/alternate-descriptors/
-->
-<ejb-jar/>
+<ejb-jar>
+ <assembly-descriptor>
+ <interceptor-binding>
+ <ejb-name>*</ejb-name>
+ <interceptor-class>org.chorem.lima.business.LimaInterceptor</interceptor-class>
+ </interceptor-binding>
+ </assembly-descriptor>
+</ejb-jar>
Deleted: trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/AccountServiceLocal.java
===================================================================
--- trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/AccountServiceLocal.java 2012-04-13 16:06:28 UTC (rev 3370)
+++ trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/AccountServiceLocal.java 2012-04-17 15:37:23 UTC (rev 3371)
@@ -1,45 +0,0 @@
-/*
- * #%L
- * Lima business
- *
- * $Id$
- * $HeadURL$
- * %%
- * 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
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-package org.chorem.lima.business.api;
-
-import org.chorem.lima.business.LimaException;
-import org.chorem.lima.entity.Account;
-import org.nuiton.topia.TopiaContext;
-
-/**
- * Account service.
- *
- * @author chatellier
- * @version $Revision$
- * <p/>
- * Last update : $Date$
- * By : $Author$
- */
-public interface AccountServiceLocal extends AccountService {
-
- Account createAccountWithTransaction(Account account, TopiaContext topiaContext) throws LimaException;
-
-}
\ No newline at end of file
1
0
13 Apr '12
Author: echatellier
Date: 2012-04-13 18:06:28 +0200 (Fri, 13 Apr 2012)
New Revision: 3370
Url: http://chorem.org/repositories/revision/lima/3370
Log:
Fix leaf account display
Added:
trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/LeafAccountComboBoxModel.java
Removed:
trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/
trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/SubAccountComboBoxModel.java
Modified:
trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/AccountService.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java
trunk/lima-callao/src/main/java/org/chorem/lima/entity/AccountDAO.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/AccountTableCellEditor.java
trunk/lima-swing/src/main/java/org/chorem/lima/widgets/JWideComboBox.java
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java 2012-04-13 15:26:32 UTC (rev 3369)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java 2012-04-13 16:06:28 UTC (rev 3370)
@@ -160,28 +160,7 @@
return result;
}
- /** Permer d'obtenir la liste des comptes à partir d'une de ses propriétés */
@Override
- public List<Account> getAllAccountByProperty(String propertyName,
- String value) throws LimaException {
- List<Account> account = null;
-
- TopiaContext transaction = beginTransaction(rootContext);
- try {
-
- AccountDAO accountDAO =
- LimaCallaoDAOHelper.getAccountDAO(transaction);
- account = accountDAO.findAllByProperty(propertyName, value);
- } catch (Exception ex) {
- doCatch(transaction, ex);
- } finally {
- doFinally(transaction);
- }
-
- return account;
- }
-
- @Override
public Account getMasterAccount(String accountNumber) throws LimaException {
Account account = null;
TopiaContext transaction = beginTransaction(rootContext);
@@ -208,13 +187,19 @@
@Override
public Account getAccountByNumber(String number) throws LimaException {
- List<Account> accountsList = getAllAccountByProperty(
- Account.PROPERTY_ACCOUNT_NUMBER, number);
-
Account account = null;
- if (accountsList.size() > 0) {
- account = accountsList.get(0);
+ TopiaContext transaction = beginTransaction(rootContext);
+ try {
+
+ AccountDAO accountDAO =
+ LimaCallaoDAOHelper.getAccountDAO(transaction);
+ account = accountDAO.findByAccountNumber(number);
+ } catch (Exception ex) {
+ doCatch(transaction, ex);
+ } finally {
+ doFinally(transaction);
}
+
return account;
}
Modified: trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/AccountService.java
===================================================================
--- trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/AccountService.java 2012-04-13 15:26:32 UTC (rev 3369)
+++ trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/AccountService.java 2012-04-13 16:06:28 UTC (rev 3370)
@@ -35,9 +35,9 @@
*
* @author chatellier
* @version $Revision$
- * <p/>
- * Last update : $Date$
- * By : $Author$
+ *
+ * Last update : $Date$
+ * By : $Author$
*/
public interface AccountService {
@@ -49,9 +49,6 @@
*/
long getAccountCount() throws LimaException;
- List<Account> getAllAccountByProperty(String propertyName,
- String value) throws LimaException;
-
/**
* Obtain the master account for the given account number.
* <p/>
Modified: trunk/lima-callao/src/main/java/org/chorem/lima/entity/AccountDAO.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/entity/AccountDAO.java 2012-04-13 15:26:32 UTC (rev 3369)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/entity/AccountDAO.java 2012-04-13 16:06:28 UTC (rev 3370)
@@ -27,11 +27,11 @@
import java.util.ArrayList;
import java.util.HashSet;
+import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.StringTokenizer;
-
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -44,11 +44,29 @@
/**
* Retourne tous les comptes qui n'ont pas eux meme de sous compte.
*/
- public List<Account> findAllLeafAccounts() throws TopiaException {
- String query = "FROM " + Account.class.getName() + " a WHERE a NOT IN (" +
+ public List<Account> findAllLeafAccounts() throws TopiaException {
+ // FIXME echatellier 20120413 la requete ne fonctionne pas
+ // et retourne vide
+ /*String query = "FROM " + Account.class.getName() + " a WHERE a NOT IN (" +
"FROM " + Account.class.getName() + " b where b.accountNumber like concat(a.accountNumber,'%'))";
- List<Account> accounts = context.find(query);
- return accounts;
+ List<Account> accounts = context.find(query);*/
+
+ // code temporaire non performant en attandant:
+ List<Account> allAccounts = findAll();
+ Iterator<Account> itAccount = allAccounts.iterator();
+ while (itAccount.hasNext()) {
+ Account acc = itAccount.next();
+ Iterator<Account> itAccount2 = allAccounts.iterator();
+ while (itAccount2.hasNext()) {
+ Account acc2 = itAccount2.next();
+ if (!acc2.getAccountNumber().equals(acc.getAccountNumber()) &&
+ acc2.getAccountNumber().startsWith(acc.getAccountNumber())) {
+ itAccount.remove();
+ break;
+ }
+ }
+ }
+ return allAccounts;
}
/**
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/AccountTableCellEditor.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/AccountTableCellEditor.java 2012-04-13 15:26:32 UTC (rev 3369)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/AccountTableCellEditor.java 2012-04-13 16:06:28 UTC (rev 3370)
@@ -5,7 +5,7 @@
* $Id$
* $HeadURL$
* %%
- * Copyright (C) 2008 - 2010 CodeLutin
+ * Copyright (C) 2008 - 2012 CodeLutin
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
@@ -29,7 +29,7 @@
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.entity.Account;
import org.chorem.lima.ui.combobox.AccountRenderer;
-import org.chorem.lima.ui.combobox.SubAccountComboBoxModel;
+import org.chorem.lima.ui.combobox.LeafAccountComboBoxModel;
import org.chorem.lima.util.AccountToString;
import org.chorem.lima.widgets.JWideComboBox;
import org.jdesktop.swingx.autocomplete.AutoCompleteDecorator;
@@ -45,21 +45,30 @@
import java.awt.event.MouseEvent;
import java.util.EventObject;
+/**
+ * Editor des cellules de tableau de type "Account".
+ * Affiche une wide combo box pour selectionner un compte.
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * By : $Author$
+ */
public class AccountTableCellEditor extends AbstractCellEditor implements TableCellEditor, KeyListener {
- protected static final Log log = LogFactory.getLog(EntryBookTableCellEditor.class);
+ protected static final Log log = LogFactory.getLog(AccountTableCellEditor.class);
private final JWideComboBox comboBox;
private static final long serialVersionUID = 1L;
-// private static AccountTableCellEditor editor;
private static boolean keyPressed;
/** constructor */
public AccountTableCellEditor() {
comboBox = new JWideComboBox();
- SubAccountComboBoxModel accountComboBoxModel = new SubAccountComboBoxModel();
+ LeafAccountComboBoxModel accountComboBoxModel = new LeafAccountComboBoxModel();
comboBox.setModel(accountComboBoxModel);
AccountRenderer accountRenderer = new AccountRenderer();
comboBox.setRenderer(accountRenderer);
@@ -140,11 +149,4 @@
}
-// public static AccountTableCellEditor getInstance() {
-// if (editor == null) {
-// editor = new AccountTableCellEditor();
-// }
-// return editor;
-// }
-
}
Copied: trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/LeafAccountComboBoxModel.java (from rev 3366, trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/SubAccountComboBoxModel.java)
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/LeafAccountComboBoxModel.java (rev 0)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/LeafAccountComboBoxModel.java 2012-04-13 16:06:28 UTC (rev 3370)
@@ -0,0 +1,113 @@
+/*
+ * #%L
+ * Lima Swing
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * 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
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+package org.chorem.lima.ui.combobox;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.chorem.lima.business.LimaException;
+import org.chorem.lima.business.ServiceListener;
+import org.chorem.lima.business.api.AccountService;
+import org.chorem.lima.business.monitorable.AccountServiceMonitorable;
+import org.chorem.lima.business.monitorable.ImportServiceMonitorable;
+import org.chorem.lima.entity.Account;
+import org.chorem.lima.service.LimaServiceFactory;
+
+import javax.swing.AbstractListModel;
+import javax.swing.ComboBoxModel;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Account combo box model containing only leaf account (without sub accounts).
+ */
+public class LeafAccountComboBoxModel extends AbstractListModel implements ComboBoxModel, ServiceListener {
+
+ private static final long serialVersionUID = 1L;
+
+ private static final Log log = LogFactory.getLog(LeafAccountComboBoxModel.class);
+
+ protected Object selectedAccount;
+
+ protected List<Account> datasCache;
+
+ protected AccountService accountService;
+
+ public LeafAccountComboBoxModel() {
+ accountService =
+ LimaServiceFactory.getService(AccountServiceMonitorable.class);
+ LimaServiceFactory.addServiceListener(accountService, this);
+ LimaServiceFactory.addServiceListener(ImportServiceMonitorable.class, this);
+ datasCache = getDataList();
+ }
+
+ @Override
+ public Object getSelectedItem() {
+ return selectedAccount;
+ }
+
+ @Override
+ public void setSelectedItem(Object anItem) {
+ selectedAccount = anItem;
+ fireContentsChanged(this, -1, -1);
+ }
+
+ @Override
+ public Object getElementAt(int index) {
+ return datasCache.get(index);
+ }
+
+ @Override
+ public int getSize() {
+ return datasCache.size();
+ }
+
+ public List<Account> getDataList() {
+ List<Account> result = new ArrayList<Account>();
+ try {
+ result = accountService.getAllLeafAccounts();
+ } catch (LimaException eee) {
+ if (log.isDebugEnabled()) {
+ log.debug("Can't get list subaccounts", eee);
+ }
+ }
+ return result;
+
+ }
+
+ public void refresh() {
+ datasCache = getDataList();
+ fireContentsChanged(this, 0, datasCache.size());
+ }
+
+ @Override
+ public void notifyMethod(String serviceName, String methodName) {
+ if (serviceName.contains("Account") ||
+ methodName.contains("importAll")) {
+ refresh();
+ }
+ }
+
+}
Deleted: trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/SubAccountComboBoxModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/SubAccountComboBoxModel.java 2012-04-13 15:26:32 UTC (rev 3369)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/SubAccountComboBoxModel.java 2012-04-13 16:06:28 UTC (rev 3370)
@@ -1,114 +0,0 @@
-/*
- * #%L
- * Lima Swing
- *
- * $Id$
- * $HeadURL$
- * %%
- * 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
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-package org.chorem.lima.ui.combobox;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.chorem.lima.business.LimaException;
-import org.chorem.lima.business.ServiceListener;
-import org.chorem.lima.business.api.AccountService;
-import org.chorem.lima.business.monitorable.AccountServiceMonitorable;
-import org.chorem.lima.business.monitorable.ImportServiceMonitorable;
-import org.chorem.lima.entity.Account;
-import org.chorem.lima.service.LimaServiceFactory;
-
-import javax.swing.AbstractListModel;
-import javax.swing.ComboBoxModel;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Account combo box model.
- */
-public class SubAccountComboBoxModel extends AbstractListModel implements ComboBoxModel, ServiceListener {
-
- private static final long serialVersionUID = 1L;
-
- private static final Log log = LogFactory.getLog(SubAccountComboBoxModel.class);
-
- protected Object selectedAccount;
-
- protected List<Account> datasCache;
-
- protected AccountService accountService;
-
- public SubAccountComboBoxModel() {
- accountService =
- LimaServiceFactory.getService(AccountServiceMonitorable.class);
- LimaServiceFactory.addServiceListener(accountService, this);
- LimaServiceFactory.addServiceListener(ImportServiceMonitorable.class, this);
- datasCache = getDataList();
- }
-
- @Override
- public Object getSelectedItem() {
- return selectedAccount;
- }
-
- @Override
- public void setSelectedItem(Object anItem) {
- selectedAccount = anItem;
- fireContentsChanged(this, -1, -1);
- }
-
- @Override
- public Object getElementAt(int index) {
- return datasCache.get(index);
- }
-
- @Override
- public int getSize() {
- return datasCache.size();
- }
-
- public List<Account> getDataList() {
- List<Account> result = new ArrayList<Account>();
- try {
- result = accountService.getAllLeafAccounts();
- } catch (LimaException eee) {
- if (log.isDebugEnabled()) {
- log.debug("Can't get list subaccounts", eee);
- }
- }
- return result;
-
- }
-
- public void refresh() {
- datasCache = getDataList();
- fireContentsChanged(this, 0, datasCache.size());
- }
-
- @Override
- public void notifyMethod(String serviceName, String methodeName) {
- if (serviceName.contains("Account") ||
- methodeName.contains("importAll")) {
- refresh();
- }
- }
-
-
-}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/widgets/JWideComboBox.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/widgets/JWideComboBox.java 2012-04-13 15:26:32 UTC (rev 3369)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/widgets/JWideComboBox.java 2012-04-13 16:06:28 UTC (rev 3370)
@@ -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
1
0
r3369 - trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor
by echatellier@users.chorem.org 13 Apr '12
by echatellier@users.chorem.org 13 Apr '12
13 Apr '12
Author: echatellier
Date: 2012-04-13 17:26:32 +0200 (Fri, 13 Apr 2012)
New Revision: 3369
Url: http://chorem.org/repositories/revision/lima/3369
Log:
Add documentation.
Modified:
trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/EmptyCellRenderer.java
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/EmptyCellRenderer.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/EmptyCellRenderer.java 2012-04-13 14:56:37 UTC (rev 3368)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/EmptyCellRenderer.java 2012-04-13 15:26:32 UTC (rev 3369)
@@ -5,7 +5,7 @@
* $Id$
* $HeadURL$
* %%
- * Copyright (C) 2008 - 2011 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
@@ -24,23 +24,43 @@
*/
package org.chorem.lima.ui.celleditor;
-import sun.swing.DefaultLookup;
+import java.awt.Color;
+import java.awt.Component;
import javax.swing.JLabel;
import javax.swing.JTable;
+import javax.swing.UIManager;
import javax.swing.border.Border;
import javax.swing.border.EmptyBorder;
import javax.swing.table.DefaultTableCellRenderer;
-import java.awt.Color;
-import java.awt.Component;
-@SuppressWarnings("restriction")
+/**
+ * Renderer qui affiche la valeur de la cellule (toString()) en permettant de
+ * conserver les cases rouges (entre invalides) meme lors de la selection
+ * de la ligne.
+ *
+ * TODO echatellier 20120412 reprise de code herité du jdk, pas très propre
+ * mais en essayant de l'enlevr, on perd le coloration des lignes non
+ * selectionnées.
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * By : $Author$
+ */
public class EmptyCellRenderer extends DefaultTableCellRenderer {
+ /** serialVersionUID. */
private static final long serialVersionUID = -7834417406160620726L;
+ public EmptyCellRenderer() {
+
+ }
+
public Component getTableCellRendererComponent(JTable table, Object value,
boolean isSelected, boolean hasFocus, int row, int column) {
+
//Create a new JLabel to avoid colouring only when row is selected
JLabel mycell = new JLabel();
mycell.setOpaque(true);
@@ -57,10 +77,10 @@
if (hasFocus) {
Border border = null;
if (isSelected) {
- border = DefaultLookup.getBorder(this, ui, "Table.focusSelectedCellHighlightBorder");
+ border = UIManager.getBorder("Table.focusSelectedCellHighlightBorder");
}
if (border == null) {
- border = DefaultLookup.getBorder(this, ui, "Table.focusCellHighlightBorder");
+ border = UIManager.getBorder("Table.focusCellHighlightBorder");
}
mycell.setBorder(border);
}
@@ -70,7 +90,7 @@
// if empty or null, colour background in red
// else setText
if (value instanceof String) {
- if (String.valueOf(value).isEmpty() || String.valueOf(value) == null) {
+ if (String.valueOf(value) == null || String.valueOf(value).isEmpty()) {
mycell.setBackground(new Color(255, 198, 209));
} else {
mycell.setText(value.toString());
1
0
r3368 - in trunk/lima-swing/src/main: java/org/chorem/lima/ui/account resources/i18n
by echatellier@users.chorem.org 13 Apr '12
by echatellier@users.chorem.org 13 Apr '12
13 Apr '12
Author: echatellier
Date: 2012-04-13 16:56:37 +0200 (Fri, 13 Apr 2012)
New Revision: 3368
Url: http://chorem.org/repositories/revision/lima/3368
Log:
Fix translation
Modified:
trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountView.jaxx
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/account/AccountView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountView.jaxx 2012-04-13 14:44:59 UTC (rev 3367)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountView.jaxx 2012-04-13 14:56:37 UTC (rev 3368)
@@ -37,7 +37,7 @@
<script><![CDATA[
void $afterCompleteSetup() {
handler.init();
- }
+ }
]]></script>
<row>
@@ -72,7 +72,7 @@
</row>
<row>
<cell fill="horizontal" anchor="north" weighty="1">
- <JButton id="importButton" text="lima.iu.importexport.import"
+ <JButton id="importButton" text="lima.ui.importexport.import"
onActionPerformed="handler.importAccountsChart()"/>
</cell>
</row>
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-13 14:44:59 UTC (rev 3367)
+++ trunk/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties 2012-04-13 14:56:37 UTC (rev 3368)
@@ -203,7 +203,6 @@
lima.importexport.wait=Job in progress…
lima.init.closed=Lima closed at %1$s
lima.init.errorclosing=Error during Lima close
-lima.iu.importexport.import=
lima.ledger.documentcreationerror=Enable to create document
lima.lettering.listerror=Can't get entries list
lima.menu.file=File
@@ -354,6 +353,7 @@
lima.ui.home.transaction.modifiy.unbalanced=
lima.ui.home.transaction.nothing=
lima.ui.home.transaction.unbalanced=
+lima.ui.importexport.import=
lima.ui.importexport.importcsv=
lima.ui.importexport.importebp=
lima.vatreport.listerror=Can't get entries list
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-13 14:44:59 UTC (rev 3367)
+++ trunk/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties 2012-04-13 14:56:37 UTC (rev 3368)
@@ -183,7 +183,6 @@
lima.importexport.wait=Traitement en cours …
lima.init.closed=Lima fermé à %1$s
lima.init.errorclosing=Erreur lors de la fermeture
-lima.iu.importexport.import=
lima.ledger.documentcreationerror=Erreur lors de la création du document
lima.lettering.listerror=Erreur lors de la récupération des données de la liste
lima.menu.file=Fichier
@@ -333,6 +332,7 @@
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.import=Importer
lima.ui.importexport.importcsv=Import/Export CSV
lima.ui.importexport.importebp=Import/Export EBP
lima.vatreport.listerror=Erreur lors de la récupération des données de la liste
1
0