Author: jpepin Date: 2010-07-20 19:14:24 +0200 (Tue, 20 Jul 2010) New Revision: 2977 Url: http://chorem.org/repositories/revision/lima/2977 Log: Ajout d'un service listener. Added: trunk/lima-business/src/main/java/org/chorem/lima/business/AccountServiceMonitorable.java trunk/lima-business/src/main/java/org/chorem/lima/business/EntryBookServiceMonitorable.java trunk/lima-business/src/main/java/org/chorem/lima/business/ExportServiceMonitorable.java trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialPeriodServiceMonitorable.java trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialStatementServiceMonitorable.java trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialTransactionServiceMonitorable.java trunk/lima-business/src/main/java/org/chorem/lima/business/FiscalPeriodServiceMonitorable.java trunk/lima-business/src/main/java/org/chorem/lima/business/ImportServiceMonitorable.java trunk/lima-business/src/main/java/org/chorem/lima/business/ReportServiceMonitorable.java trunk/lima-business/src/main/java/org/chorem/lima/business/ServiceListener.java trunk/lima-business/src/main/java/org/chorem/lima/business/ServiceMonitorable.java trunk/lima-swing/src/main/java/org/chorem/lima/service/ServiceMonitorableHandler.java Modified: trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java trunk/lima-swing/src/main/java/org/chorem/lima/service/LimaServiceFactory.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountTreeTableModel.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsTableModel.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceTableModel.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/SubAccountComboBoxModel.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookTableModel.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookViewHandler.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsTableModel.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodTable.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodTableModel.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/FinancialStatementDocument.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTable.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/financialtransaction/FinancialTransactionTableModel.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTableModel.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/AddPeriod.jaxx trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodTable.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodTableModel.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/HomeViewHandler.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/LedgerTableModel.java trunk/pom.xml Added: trunk/lima-business/src/main/java/org/chorem/lima/business/AccountServiceMonitorable.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/AccountServiceMonitorable.java (rev 0) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/AccountServiceMonitorable.java 2010-07-20 17:14:24 UTC (rev 2977) @@ -0,0 +1,5 @@ +package org.chorem.lima.business; + +public interface AccountServiceMonitorable extends AccountService, ServiceMonitorable { + +} Added: trunk/lima-business/src/main/java/org/chorem/lima/business/EntryBookServiceMonitorable.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/EntryBookServiceMonitorable.java (rev 0) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/EntryBookServiceMonitorable.java 2010-07-20 17:14:24 UTC (rev 2977) @@ -0,0 +1,5 @@ +package org.chorem.lima.business; + +public interface EntryBookServiceMonitorable extends EntryBookService, ServiceMonitorable { + +} Added: trunk/lima-business/src/main/java/org/chorem/lima/business/ExportServiceMonitorable.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ExportServiceMonitorable.java (rev 0) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ExportServiceMonitorable.java 2010-07-20 17:14:24 UTC (rev 2977) @@ -0,0 +1,5 @@ +package org.chorem.lima.business; + +public interface ExportServiceMonitorable extends ExportService, ServiceMonitorable { + +} Added: trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialPeriodServiceMonitorable.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialPeriodServiceMonitorable.java (rev 0) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialPeriodServiceMonitorable.java 2010-07-20 17:14:24 UTC (rev 2977) @@ -0,0 +1,5 @@ +package org.chorem.lima.business; + +public interface FinancialPeriodServiceMonitorable extends FinancialPeriodService, ServiceMonitorable { + +} Added: trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialStatementServiceMonitorable.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialStatementServiceMonitorable.java (rev 0) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialStatementServiceMonitorable.java 2010-07-20 17:14:24 UTC (rev 2977) @@ -0,0 +1,5 @@ +package org.chorem.lima.business; + +public interface FinancialStatementServiceMonitorable extends FinancialStatementService, ServiceMonitorable { + +} Added: trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialTransactionServiceMonitorable.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialTransactionServiceMonitorable.java (rev 0) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialTransactionServiceMonitorable.java 2010-07-20 17:14:24 UTC (rev 2977) @@ -0,0 +1,5 @@ +package org.chorem.lima.business; + +public interface FinancialTransactionServiceMonitorable extends FinancialTransactionService, ServiceMonitorable { + +} Added: trunk/lima-business/src/main/java/org/chorem/lima/business/FiscalPeriodServiceMonitorable.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/FiscalPeriodServiceMonitorable.java (rev 0) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/FiscalPeriodServiceMonitorable.java 2010-07-20 17:14:24 UTC (rev 2977) @@ -0,0 +1,5 @@ +package org.chorem.lima.business; + +public interface FiscalPeriodServiceMonitorable extends FiscalPeriodService, ServiceMonitorable { + +} Added: trunk/lima-business/src/main/java/org/chorem/lima/business/ImportServiceMonitorable.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ImportServiceMonitorable.java (rev 0) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ImportServiceMonitorable.java 2010-07-20 17:14:24 UTC (rev 2977) @@ -0,0 +1,5 @@ +package org.chorem.lima.business; + +public interface ImportServiceMonitorable extends ImportService, ServiceMonitorable { + +} Added: trunk/lima-business/src/main/java/org/chorem/lima/business/ReportServiceMonitorable.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ReportServiceMonitorable.java (rev 0) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ReportServiceMonitorable.java 2010-07-20 17:14:24 UTC (rev 2977) @@ -0,0 +1,5 @@ +package org.chorem.lima.business; + +public interface ReportServiceMonitorable extends ReportService, ServiceMonitorable { + +} Added: trunk/lima-business/src/main/java/org/chorem/lima/business/ServiceListener.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ServiceListener.java (rev 0) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ServiceListener.java 2010-07-20 17:14:24 UTC (rev 2977) @@ -0,0 +1,7 @@ +package org.chorem.lima.business; + +public interface ServiceListener { + + void notifyMethod(String serviceName, String methodeName); + +} Added: trunk/lima-business/src/main/java/org/chorem/lima/business/ServiceMonitorable.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ServiceMonitorable.java (rev 0) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ServiceMonitorable.java 2010-07-20 17:14:24 UTC (rev 2977) @@ -0,0 +1,6 @@ +package org.chorem.lima.business; + +public interface ServiceMonitorable { + public void addListener(ServiceListener l); + public void removeListener(ServiceListener l); +} Modified: trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java 2010-07-20 10:29:28 UTC (rev 2976) +++ trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java 2010-07-20 17:14:24 UTC (rev 2977) @@ -31,6 +31,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.lima.business.AccountService; +import org.chorem.lima.business.AccountServiceMonitorable; import org.chorem.lima.entity.Account; import org.chorem.lima.service.LimaServiceFactory; import org.chorem.lima.ui.MainView; @@ -174,7 +175,10 @@ // if not, call #loadDefaultAccount() splash.updateProgression(0.5, _("Loading accounting...")); - AccountService accountService = LimaServiceFactory.getInstance().getAccountService(); + //AccountService accountService = LimaServiceFactory.getInstance().getAccountService(); + AccountService accountService = + LimaServiceFactory.getInstance().getService( + AccountServiceMonitorable.class); List<Account> account = accountService.getChildrenAccounts(null); if (CollectionUtils.isEmpty(account)) { if (log.isInfoEnabled()) { Modified: trunk/lima-swing/src/main/java/org/chorem/lima/service/LimaServiceFactory.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/service/LimaServiceFactory.java 2010-07-20 10:29:28 UTC (rev 2976) +++ trunk/lima-swing/src/main/java/org/chorem/lima/service/LimaServiceFactory.java 2010-07-20 17:14:24 UTC (rev 2977) @@ -18,12 +18,12 @@ package org.chorem.lima.service; +import java.lang.reflect.InvocationHandler; +import java.lang.reflect.Proxy; import java.util.Properties; - import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NamingException; - import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.openejb.OpenEJB; @@ -31,55 +31,9 @@ import org.apache.openejb.assembler.classic.Assembler; import org.apache.openejb.loader.SystemInstance; import org.chorem.lima.LimaMain; -import org.chorem.lima.business.AccountService; -import org.chorem.lima.business.EntryBookService; -import org.chorem.lima.business.ExportService; -import org.chorem.lima.business.FinancialPeriodService; -import org.chorem.lima.business.FinancialStatementService; -import org.chorem.lima.business.FiscalPeriodService; -import org.chorem.lima.business.ImportService; -import org.chorem.lima.business.RecordService; -import org.chorem.lima.business.FinancialTransactionService; -import org.chorem.lima.business.ReportService; /** - * Is class is a service factory based on embedded openejb container. - * - * More information: - * <ul> - * <li>http://openejb.apache.org/embedding-openejb.html</li> - * </ul> - * - * Elle est pour l'instant statique en attendant mieux. - * - * Toutes les méthodes utilisent, <ServiceName>ImplLocal comme nom local - * (convention openejb) c'est donc plus factorisable que le code actuel. - * Mais il vaudrait mieux essayer en distant pour verifier si - * la factorisation est similaire. - * - * Attention, en mode distant, les jar "javaee-api" et "openejbclient" - * doivent etre les mêmes (avec une snapshot ca fesait une NPE) - * - * - * <h3>Lookup EJB methods</h3> - * - * <ul> - * <li>first way is : - * <pre>FooHome ejbHome = (FooHome)new InitialContext().lookup("java:openejb/ejb/my/bean/Foo");</pre></li> - * <li>second way is (spec compliant) - * <pre>Object obj = ctx.lookup("my/bean/Foo"); - * FooHome ejbHome = (FooHome) - * PortableRemoteObject.narrow(obj, FooHome.class);</pre><li> - * - * <h3>TODO</h3> - * - * <p>All services are hardcoded in local mode for now</p> - * - * @author chatellier - * @version $Revision$ - * - * Last update : $Date$ - * By : $Author$ + * This class is a service factory based on embedded openejb container. */ public class LimaServiceFactory { @@ -130,13 +84,31 @@ } return instance; } - + + public <M> M getService(Class<M> serviceMonitorableClass){ + Object ejbHome = null; + String serviceName = serviceMonitorableClass.getSimpleName().replace("Monitorable", "ImplRemote"); + try { + ejbHome = ctx.lookup(serviceName); + } catch (NamingException eee) { + if (log.isErrorEnabled()) { + log.error("Can't lookup for service : " + serviceName, eee); + } + } + InvocationHandler handler = new ServiceMonitorableHandler(ejbHome); + M result = (M) Proxy.newProxyInstance( + serviceMonitorableClass.getClassLoader(), + new Class[]{serviceMonitorableClass}, handler); + return result; + } + + /** * Get Account service. * * @return account service proxy */ - public AccountService getAccountService() { + /*public AccountServiceMonitorable getAccountService() { // TODO EC-20100410 put lookup name in configuration // name should be fully configurable due to custom implementation used @@ -149,14 +121,18 @@ log.error("Can't lookup for service : " + lookupName, eee); } } - return ejbHome; - } + InvocationHandler handler = new ServiceMonitorableHandler(ejbHome); + AccountServiceMonitorable result = (AccountServiceMonitorable)Proxy.newProxyInstance( + AccountServiceMonitorable.class.getClassLoader(), + new Class[]{AccountServiceMonitorable.class}, handler); + return result; + } /** * Get FiscalPeriod service. * * @return fiscalPeriod service proxy - */ + * public FiscalPeriodService getFiscalPeriodService() { // TODO EC-20100410 put lookup name in configuration @@ -177,7 +153,7 @@ * Get FinancialPeriod service. * * @return Financial Period service proxy - */ + * public FinancialPeriodService getFinancialPeriodService() { // TODO EC-20100410 put lookup name in configuration @@ -198,7 +174,7 @@ * Get transaction service. * * @return transaction service proxy - */ + * public FinancialTransactionService getTransactionService() { // TODO EC-20100410 put lookup name in configuration @@ -219,7 +195,7 @@ * Get entrybook service. * * @return entrybook service proxy - */ + * public EntryBookService getEntryBookService() { // TODO EC-20100410 put lookup name in configuration @@ -240,7 +216,7 @@ /** * Get report service. * - */ + * public ReportService getReportService() { // TODO EC-20100410 put lookup name in configuration @@ -260,7 +236,7 @@ /** * Get financial statement service. * - */ + * public FinancialStatementService getFinancialStatementService() { String lookupName = "FinancialStatementServiceImplRemote"; @@ -278,7 +254,7 @@ /** * Get import service. * - */ + * public ImportService getImportService() { String lookupName = "ImportServiceImplRemote"; @@ -297,7 +273,7 @@ /** * Get export service. * - */ + * public ExportService getExportService() { String lookupName = "ExportServiceImplRemote"; @@ -316,7 +292,7 @@ * Get record service. * * @return record service proxy - */ + * public RecordService getRecordService() { // TODO EC-20100410 put lookup name in configuration @@ -331,7 +307,7 @@ } } return ejbHome; - } + }*/ /** * Destroy openejb jndi context. Added: trunk/lima-swing/src/main/java/org/chorem/lima/service/ServiceMonitorableHandler.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/service/ServiceMonitorableHandler.java (rev 0) +++ trunk/lima-swing/src/main/java/org/chorem/lima/service/ServiceMonitorableHandler.java 2010-07-20 17:14:24 UTC (rev 2977) @@ -0,0 +1,71 @@ +/* *##% Lima Swing + * Copyright (C) 2008 - 2010 CodeLutin + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * ##%*/ + +package org.chorem.lima.service; + +import java.lang.reflect.InvocationHandler; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.List; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.chorem.lima.business.ServiceListener; + +public class ServiceMonitorableHandler implements InvocationHandler { + + private static final Log log = LogFactory.getLog(ServiceMonitorableHandler.class); + + private Object service; + private List<ServiceListener> listeners; + + public ServiceMonitorableHandler(Object service){ + this.service = service; + listeners = new ArrayList<ServiceListener>(); + } + + public void addServiceListener(ServiceListener serviceListener){ + listeners.add(serviceListener); + } + + public void removeServiceListener(ServiceListener serviceListener){ + listeners.remove(serviceListener); + } + + @Override + public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { + Object result = null; + if (method.getName().equals("addListener")){ + addServiceListener((ServiceListener) args[0]); + } + else if (method.getName().equals("removeListener")){ + removeServiceListener((ServiceListener) args[0]); + } + else { + result = method.invoke(service, args); + if (!method.getName().startsWith("get")){ + log.debug("nb listeners : " + listeners.size()); + // previent listeners + for (ServiceListener serviceListener : listeners) { + serviceListener.notifyMethod(service.getClass().getSimpleName(), method.getName()); + } + } + } + return result; + } + +} Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountTreeTableModel.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountTreeTableModel.java 2010-07-20 10:29:28 UTC (rev 2976) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountTreeTableModel.java 2010-07-20 17:14:24 UTC (rev 2977) @@ -23,9 +23,10 @@ import javax.swing.tree.TreePath; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.chorem.lima.business.AccountService; +import org.chorem.lima.business.AccountServiceMonitorable; import org.chorem.lima.business.LimaBusinessException; import org.chorem.lima.business.LimaException; +import org.chorem.lima.business.ServiceListener; import org.chorem.lima.entity.Account; import org.chorem.lima.entity.AccountImpl; import org.chorem.lima.service.LimaServiceFactory; @@ -41,13 +42,13 @@ * Last update : $Date$ * By : $Author$ */ -public class AccountTreeTableModel extends AbstractTreeTableModel { +public class AccountTreeTableModel extends AbstractTreeTableModel implements ServiceListener { /** log. */ private static final Log log = LogFactory.getLog(AccountViewHandler.class); /** Account service. */ - protected final AccountService accountService; + protected final AccountServiceMonitorable accountService; /** * Model constructor. Init account service used here. @@ -56,8 +57,10 @@ // root super(new AccountImpl()); // Gets factory service - accountService = LimaServiceFactory.getInstance().getAccountService(); - } + accountService = + LimaServiceFactory.getInstance().getService( + AccountServiceMonitorable.class); + } @Override @@ -259,5 +262,13 @@ accountService.removeAccount(account); modelSupport.fireChildRemoved(path.getParentPath(), index, account); } + + + @Override + public void notifyMethod(String serviceName, String methodName) { + log.debug("ssalut !"); + // TODO Auto-generated method stub + + } } Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java 2010-07-20 10:29:28 UTC (rev 2976) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java 2010-07-20 17:14:24 UTC (rev 2977) @@ -24,6 +24,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.lima.business.AccountService; +import org.chorem.lima.business.AccountServiceMonitorable; import org.chorem.lima.business.LimaBusinessException; import org.chorem.lima.business.LimaException; import org.chorem.lima.entity.Account; @@ -60,7 +61,9 @@ protected AccountViewHandler(AccountView view) { this.view = view; // Gets factory service - accountService = LimaServiceFactory.getInstance().getAccountService(); + accountService = + LimaServiceFactory.getInstance().getService( + AccountServiceMonitorable.class); } /** Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsTableModel.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsTableModel.java 2010-07-20 10:29:28 UTC (rev 2976) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsTableModel.java 2010-07-20 17:14:24 UTC (rev 2977) @@ -28,6 +28,7 @@ import org.chorem.lima.beans.ReportsDatas; import org.chorem.lima.business.LimaException; import org.chorem.lima.business.ReportService; +import org.chorem.lima.business.ReportServiceMonitorable; import org.chorem.lima.entity.Account; import org.chorem.lima.entity.Entry; import org.chorem.lima.service.LimaServiceFactory; @@ -71,7 +72,9 @@ */ public AccountsReportsTableModel() { - reportService = LimaServiceFactory.getInstance().getReportService(); + reportService = + LimaServiceFactory.getInstance().getService( + ReportServiceMonitorable.class); } @Override Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceTableModel.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceTableModel.java 2010-07-20 10:29:28 UTC (rev 2976) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceTableModel.java 2010-07-20 17:14:24 UTC (rev 2977) @@ -29,6 +29,7 @@ import org.chorem.lima.beans.ReportsDatas; import org.chorem.lima.business.LimaException; import org.chorem.lima.business.ReportService; +import org.chorem.lima.business.ReportServiceMonitorable; import org.chorem.lima.service.LimaServiceFactory; import org.chorem.lima.util.ErrorHelper; @@ -69,8 +70,10 @@ * Constructor. */ public BalanceTableModel() { - reportService = LimaServiceFactory.getInstance().getReportService(); - } + reportService = + LimaServiceFactory.getInstance().getService( + ReportServiceMonitorable.class); + } @Override public int getRowCount() { 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 2010-07-20 10:29:28 UTC (rev 2976) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceViewHandler.java 2010-07-20 17:14:24 UTC (rev 2977) @@ -21,6 +21,7 @@ import static org.nuiton.i18n.I18n._; import org.chorem.lima.beans.BalanceTrial; import org.chorem.lima.business.FinancialTransactionService; +import org.chorem.lima.business.FinancialTransactionServiceMonitorable; import org.chorem.lima.service.LimaServiceFactory; @@ -45,7 +46,8 @@ protected BalanceViewHandler(BalanceView view) { this.view = view; financialTransactionService = - LimaServiceFactory.getInstance().getTransactionService(); + LimaServiceFactory.getInstance().getService( + FinancialTransactionServiceMonitorable.class); } public void refresh(){ 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 2010-07-20 10:29:28 UTC (rev 2976) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/AccountComboBoxModel.java 2010-07-20 17:14:24 UTC (rev 2977) @@ -24,6 +24,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.lima.business.AccountService; +import org.chorem.lima.business.AccountServiceMonitorable; import org.chorem.lima.business.LimaException; import org.chorem.lima.entity.Account; import org.chorem.lima.service.LimaServiceFactory; @@ -47,7 +48,9 @@ protected AccountService accountService; public AccountComboBoxModel() { - accountService = LimaServiceFactory.getInstance().getAccountService(); + accountService = + LimaServiceFactory.getInstance().getService( + AccountServiceMonitorable.class); 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 2010-07-20 10:29:28 UTC (rev 2976) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/EntryBookComboBoxModel.java 2010-07-20 17:14:24 UTC (rev 2977) @@ -23,6 +23,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.lima.business.EntryBookService; +import org.chorem.lima.business.EntryBookServiceMonitorable; import org.chorem.lima.business.LimaException; import org.chorem.lima.entity.EntryBook; import org.chorem.lima.service.LimaServiceFactory; @@ -52,7 +53,8 @@ public EntryBookComboBoxModel() { entryBookService = - LimaServiceFactory.getInstance().getEntryBookService(); + LimaServiceFactory.getInstance().getService( + EntryBookServiceMonitorable.class); 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 2010-07-20 10:29:28 UTC (rev 2976) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FinancialPeriodComboBoxModel.java 2010-07-20 17:14:24 UTC (rev 2977) @@ -24,6 +24,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.lima.business.FinancialPeriodService; +import org.chorem.lima.business.FinancialPeriodServiceMonitorable; import org.chorem.lima.business.LimaException; import org.chorem.lima.entity.FinancialPeriod; import org.chorem.lima.entity.FiscalPeriod; @@ -56,7 +57,8 @@ public FinancialPeriodComboBoxModel() { financialPeriodService = - LimaServiceFactory.getInstance().getFinancialPeriodService(); + LimaServiceFactory.getInstance().getService( + FinancialPeriodServiceMonitorable.class); datasCache=getDataList(); } 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 2010-07-20 10:29:28 UTC (rev 2976) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FiscalPeriodComboBoxModel.java 2010-07-20 17:14:24 UTC (rev 2977) @@ -25,6 +25,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.lima.business.FiscalPeriodService; +import org.chorem.lima.business.FiscalPeriodServiceMonitorable; import org.chorem.lima.business.LimaException; import org.chorem.lima.entity.FiscalPeriod; import org.chorem.lima.service.LimaServiceFactory; @@ -44,8 +45,10 @@ public FiscalPeriodComboBoxModel(){ - fiscalPeriodService = LimaServiceFactory.getInstance().getFiscalPeriodService(); - datasCache = getDataList(); + fiscalPeriodService = + LimaServiceFactory.getInstance().getService( + FiscalPeriodServiceMonitorable.class); + datasCache = getDataList(); } @Override Modified: 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 2010-07-20 10:29:28 UTC (rev 2976) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/SubAccountComboBoxModel.java 2010-07-20 17:14:24 UTC (rev 2977) @@ -25,6 +25,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.lima.business.AccountService; +import org.chorem.lima.business.AccountServiceMonitorable; import org.chorem.lima.business.LimaException; import org.chorem.lima.entity.Account; import org.chorem.lima.service.LimaServiceFactory; @@ -45,7 +46,9 @@ protected AccountService accountService; public SubAccountComboBoxModel() { - accountService = LimaServiceFactory.getInstance().getAccountService(); + accountService = + LimaServiceFactory.getInstance().getService( + AccountServiceMonitorable.class); datasCache = getDataList(); } Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookTableModel.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookTableModel.java 2010-07-20 10:29:28 UTC (rev 2976) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookTableModel.java 2010-07-20 17:14:24 UTC (rev 2977) @@ -24,6 +24,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.lima.business.EntryBookService; +import org.chorem.lima.business.EntryBookServiceMonitorable; import org.chorem.lima.business.LimaException; import org.chorem.lima.entity.EntryBook; import org.chorem.lima.service.LimaServiceFactory; @@ -53,8 +54,10 @@ * Constructor. */ public EntryBookTableModel() { - entryBookService = LimaServiceFactory.getInstance().getEntryBookService(); - } + entryBookService = + LimaServiceFactory.getInstance().getService( + EntryBookServiceMonitorable.class); + } @Override public int getRowCount() { Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookViewHandler.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookViewHandler.java 2010-07-20 10:29:28 UTC (rev 2976) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookViewHandler.java 2010-07-20 17:14:24 UTC (rev 2977) @@ -23,6 +23,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.lima.business.EntryBookService; +import org.chorem.lima.business.EntryBookServiceMonitorable; import org.chorem.lima.business.LimaException; import org.chorem.lima.entity.EntryBook; import org.chorem.lima.entity.EntryBookImpl; @@ -52,8 +53,10 @@ public EntryBookViewHandler(EntryBookView view) { this.view = view; - entryBookService = LimaServiceFactory.getInstance().getEntryBookService(); - } + entryBookService = + LimaServiceFactory.getInstance().getService( + EntryBookServiceMonitorable.class); + } public void addEntryBook() { Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsTableModel.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsTableModel.java 2010-07-20 10:29:28 UTC (rev 2976) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsTableModel.java 2010-07-20 17:14:24 UTC (rev 2977) @@ -29,6 +29,7 @@ import org.chorem.lima.beans.ReportsDatasImpl; import org.chorem.lima.business.LimaException; import org.chorem.lima.business.ReportService; +import org.chorem.lima.business.ReportServiceMonitorable; import org.chorem.lima.entity.Entry; import org.chorem.lima.entity.EntryBook; import org.chorem.lima.service.LimaServiceFactory; @@ -72,7 +73,8 @@ */ public EntryBooksReportsTableModel() { reportService = - LimaServiceFactory.getInstance().getReportService(); + LimaServiceFactory.getInstance().getService( + ReportServiceMonitorable.class); } @Override Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodTable.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodTable.java 2010-07-20 10:29:28 UTC (rev 2976) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodTable.java 2010-07-20 17:14:24 UTC (rev 2977) @@ -25,6 +25,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.lima.business.FinancialPeriodService; +import org.chorem.lima.business.FinancialPeriodServiceMonitorable; import org.chorem.lima.business.LimaException; import org.chorem.lima.entity.ClosedPeriodicEntryBook; import org.chorem.lima.entity.ClosedPeriodicEntryBookImpl; @@ -58,7 +59,8 @@ this.handler = handler; model = this.handler.getView().modelFinancialPeriodTable; financialPeriodService = - LimaServiceFactory.getInstance().getFinancialPeriodService(); + LimaServiceFactory.getInstance().getService( + FinancialPeriodServiceMonitorable.class); //highlight financial financial transactions addMonthColor(); Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodTableModel.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodTableModel.java 2010-07-20 10:29:28 UTC (rev 2976) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodTableModel.java 2010-07-20 17:14:24 UTC (rev 2977) @@ -27,6 +27,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.lima.business.FinancialPeriodService; +import org.chorem.lima.business.FinancialPeriodServiceMonitorable; import org.chorem.lima.business.LimaException; import org.chorem.lima.entity.ClosedPeriodicEntryBook; import org.chorem.lima.entity.EntryBook; @@ -58,7 +59,8 @@ public FinancialPeriodTableModel() { financialPeriodService = - LimaServiceFactory.getInstance().getFinancialPeriodService(); + LimaServiceFactory.getInstance().getService( + FinancialPeriodServiceMonitorable.class); } 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 2010-07-20 10:29:28 UTC (rev 2976) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartTreeTableModel.java 2010-07-20 17:14:24 UTC (rev 2977) @@ -24,7 +24,9 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.lima.business.FinancialStatementService; +import org.chorem.lima.business.FinancialStatementServiceMonitorable; import org.chorem.lima.business.LimaException; +import org.chorem.lima.business.ServiceListener; import org.chorem.lima.entity.FinancialStatement; import org.chorem.lima.entity.FinancialStatementImpl; import org.chorem.lima.service.LimaServiceFactory; @@ -40,13 +42,13 @@ * Last update : $Date: 2010-06-08 11:55:04 +0200 (mar., 08 juin 2010) $ * By : $Author: jpepin $ */ -public class FinancialStatementChartTreeTableModel extends AbstractTreeTableModel { +public class FinancialStatementChartTreeTableModel extends AbstractTreeTableModel implements ServiceListener { /** log. */ private static final Log log = LogFactory.getLog(FinancialStatementChartViewHandler.class); /** Account service. */ - protected final FinancialStatementService financialStatementService; + protected final FinancialStatementServiceMonitorable financialStatementService; /** * Model constructor. Init account service used here. @@ -55,8 +57,11 @@ //create root for the tree super(new FinancialStatementImpl()); // Gets factory service - financialStatementService = LimaServiceFactory.getInstance().getFinancialStatementService(); - } + financialStatementService = + LimaServiceFactory.getInstance().getService( + FinancialStatementServiceMonitorable.class); + financialStatementService.addListener(this); + } @Override @@ -234,5 +239,20 @@ financialStatementService.removeFinancialStatement(financialStatement); modelSupport.fireChildRemoved(path.getParentPath(), index, financialStatement); } + + + @Override + public void notifyMethod(String serviceName, String methodName) { + + + try { + refreshTree(); + log.debug(serviceName + " " + methodName); + } catch (LimaException eee) { + if (log.isDebugEnabled()){ + log.debug("Can't refresh model", eee); + } + } + } } Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartViewHandler.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartViewHandler.java 2010-07-20 10:29:28 UTC (rev 2976) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartViewHandler.java 2010-07-20 17:14:24 UTC (rev 2977) @@ -24,6 +24,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.lima.business.FinancialStatementService; +import org.chorem.lima.business.FinancialStatementServiceMonitorable; import org.chorem.lima.business.LimaBusinessException; import org.chorem.lima.business.LimaException; import org.chorem.lima.entity.FinancialStatement; @@ -58,7 +59,10 @@ protected FinancialStatementChartViewHandler(FinancialStatementChartView view) { this.view = view; - financialStatementService = LimaServiceFactory.getInstance().getFinancialStatementService(); + + financialStatementService = + LimaServiceFactory.getInstance().getService( + FinancialStatementServiceMonitorable.class); } /** Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementDocument.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementDocument.java 2010-07-20 10:29:28 UTC (rev 2976) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementDocument.java 2010-07-20 17:14:24 UTC (rev 2977) @@ -73,12 +73,12 @@ first=false; } else{ - listList.add(financialStatementAmounts.subList(min, i-1)); + listList.add(financialStatementAmounts.subList(min+1, i-1)); } min=i; } } - listList.add(financialStatementAmounts.subList(min, size)); + listList.add(financialStatementAmounts.subList(min+1, size)); //create pages for (List<FinancialStatementAmounts> list : listList) { @@ -230,14 +230,20 @@ else { //cell1 String tab = ""; - for (int i = 0; i <= level; i++) { + for (int i = 0; i < level; i++) { tab += "\t"; } - Phrase phrase = new Phrase(tab+label, tabFont); + Phrase phrase = null; + if (financialStatementAmount.getHeader()){ + phrase = new Phrase(tab+label, headerFont); + } + else { + phrase = new Phrase(tab+label, tabFont); + } t.addCell(phrase); //cell2 if (grossAmount != 0.0){ - phrase = new Phrase(String.valueOf(grossAmount), tabFont); + phrase = new Phrase(String.valueOf(grossAmount), tabFont); } else { phrase = new Phrase(""); Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTable.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTable.java 2010-07-20 10:29:28 UTC (rev 2976) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTable.java 2010-07-20 17:14:24 UTC (rev 2977) @@ -21,8 +21,6 @@ import java.awt.Color; import java.awt.Component; import org.chorem.lima.beans.FinancialStatementAmounts; -import org.chorem.lima.business.FinancialPeriodService; -import org.chorem.lima.service.LimaServiceFactory; import org.jdesktop.swingx.JXTable; import org.jdesktop.swingx.decorator.ColorHighlighter; import org.jdesktop.swingx.decorator.ComponentAdapter; @@ -37,9 +35,7 @@ protected FinancialStatementReportViewHandler handler; protected FinancialStatementReportTableModel model; - - protected FinancialPeriodService financialPeriodService; - + private Highlighter colorTransaction; /* @@ -49,8 +45,6 @@ super(handler.getView().modelTable); this.handler = handler; model = this.handler.getView().modelTable; - financialPeriodService = - LimaServiceFactory.getInstance().getFinancialPeriodService(); //highlight financial financial transactions colorTitle1(); 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 2010-07-20 10:29:28 UTC (rev 2976) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableModel.java 2010-07-20 17:14:24 UTC (rev 2977) @@ -27,6 +27,7 @@ import org.apache.commons.logging.LogFactory; import org.chorem.lima.beans.FinancialStatementAmounts; import org.chorem.lima.business.FinancialStatementService; +import org.chorem.lima.business.FinancialStatementServiceMonitorable; import org.chorem.lima.business.LimaException; import org.chorem.lima.service.LimaServiceFactory; import org.chorem.lima.util.ErrorHelper; @@ -65,7 +66,9 @@ * Constructor. */ public FinancialStatementReportTableModel() { - financialStatementService = LimaServiceFactory.getInstance().getFinancialStatementService(); + financialStatementService = + LimaServiceFactory.getInstance().getService( + FinancialStatementServiceMonitorable.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 2010-07-20 10:29:28 UTC (rev 2976) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportViewHandler.java 2010-07-20 17:14:24 UTC (rev 2977) @@ -18,8 +18,6 @@ package org.chorem.lima.ui.financialstatementreport; -import org.chorem.lima.business.FinancialTransactionService; -import org.chorem.lima.service.LimaServiceFactory; /** @@ -35,15 +33,10 @@ protected FinancialStatementReportView view; - /** service **/ - protected FinancialTransactionService financialTransactionService; - protected FinancialStatementReportTableModel model; protected FinancialStatementReportViewHandler(FinancialStatementReportView view) { this.view = view; - financialTransactionService = - LimaServiceFactory.getInstance().getTransactionService(); } public void refresh(){ Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTableModel.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTableModel.java 2010-07-20 10:29:28 UTC (rev 2976) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTableModel.java 2010-07-20 17:14:24 UTC (rev 2977) @@ -30,7 +30,10 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.lima.business.EntryBookService; +import org.chorem.lima.business.EntryBookServiceMonitorable; import org.chorem.lima.business.FinancialPeriodService; +import org.chorem.lima.business.FinancialPeriodServiceMonitorable; +import org.chorem.lima.business.FinancialTransactionServiceMonitorable; import org.chorem.lima.business.LimaBusinessException; import org.chorem.lima.business.LimaException; import org.chorem.lima.business.FinancialTransactionService; @@ -94,12 +97,15 @@ */ public FinancialTransactionTableModel() { /* Services */ - financialTransactionService = LimaServiceFactory.getInstance() - .getTransactionService(); - entryBookService = LimaServiceFactory.getInstance(). - getEntryBookService(); - financialPeriodService = LimaServiceFactory.getInstance(). - getFinancialPeriodService(); + financialTransactionService = + LimaServiceFactory.getInstance().getService( + FinancialTransactionServiceMonitorable.class); + entryBookService = + LimaServiceFactory.getInstance().getService( + EntryBookServiceMonitorable.class); + financialPeriodService = + LimaServiceFactory.getInstance().getService( + FinancialPeriodServiceMonitorable.class); } /** 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 2010-07-20 10:29:28 UTC (rev 2976) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTableModel.java 2010-07-20 17:14:24 UTC (rev 2977) @@ -26,6 +26,7 @@ import javax.swing.table.AbstractTableModel; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.chorem.lima.business.FinancialTransactionServiceMonitorable; import org.chorem.lima.business.LimaException; import org.chorem.lima.business.FinancialTransactionService; import org.chorem.lima.business.utils.EntryComparator; @@ -80,7 +81,9 @@ */ public FinancialTransactionUnbalancedTableModel() { /* Services */ - financialTransactionService = LimaServiceFactory.getInstance().getTransactionService(); + financialTransactionService = + LimaServiceFactory.getInstance().getService( + FinancialTransactionServiceMonitorable.class); } /** Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/AddPeriod.jaxx =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/AddPeriod.jaxx 2010-07-20 10:29:28 UTC (rev 2976) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/AddPeriod.jaxx 2010-07-20 17:14:24 UTC (rev 2977) @@ -20,13 +20,16 @@ <![CDATA[ import org.chorem.lima.entity.FiscalPeriod; import org.chorem.lima.business.FiscalPeriodService; + import org.chorem.lima.business.FiscalPeriodServiceMonitorable; import org.chorem.lima.service.LimaServiceFactory; import org.chorem.lima.business.LimaException; import org.apache.commons.lang.time.DateUtils; import org.chorem.lima.entity.FiscalPeriodImpl; - protected FiscalPeriodService fiscalPeriodService = LimaServiceFactory.getInstance().getFiscalPeriodService(); - + protected FiscalPeriodService fiscalPeriodService = + LimaServiceFactory.getInstance().getService( + FiscalPeriodServiceMonitorable.class); + // set begin date picker Date endDate = null; Calendar calendarBegin = Calendar.getInstance(); Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodTable.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodTable.java 2010-07-20 10:29:28 UTC (rev 2976) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodTable.java 2010-07-20 17:14:24 UTC (rev 2977) @@ -20,15 +20,12 @@ import java.awt.Color; import java.awt.Component; -import org.chorem.lima.business.FiscalPeriodService; import org.chorem.lima.entity.FiscalPeriod; -import org.chorem.lima.service.LimaServiceFactory; import org.jdesktop.swingx.JXTable; import org.jdesktop.swingx.decorator.ColorHighlighter; import org.jdesktop.swingx.decorator.ComponentAdapter; import org.jdesktop.swingx.decorator.HighlightPredicate; import org.jdesktop.swingx.decorator.Highlighter; -import org.jdesktop.swingx.decorator.HighlighterFactory; public class FiscalPeriodTable extends JXTable { @@ -37,17 +34,14 @@ protected FiscalPeriodViewHandler handler; protected FiscalPeriodTableModel model; - - protected FiscalPeriodService financialPeriodService; - + private Highlighter colorTransaction; public FiscalPeriodTable(FiscalPeriodViewHandler handler) { this.handler = handler; model = this.handler.getView().getModelFiscalPeriodTable(); - financialPeriodService = LimaServiceFactory.getInstance().getFiscalPeriodService(); - addHighlighter(HighlighterFactory.createSimpleStriping(new java.awt.Color(222,222,222))); + //highlight financial financial transactions addBlockColor(); } Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodTableModel.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodTableModel.java 2010-07-20 10:29:28 UTC (rev 2976) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodTableModel.java 2010-07-20 17:14:24 UTC (rev 2977) @@ -26,6 +26,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.lima.business.FiscalPeriodService; +import org.chorem.lima.business.FiscalPeriodServiceMonitorable; import org.chorem.lima.business.LimaException; import org.chorem.lima.entity.FiscalPeriod; import org.chorem.lima.service.LimaServiceFactory; @@ -49,8 +50,10 @@ protected FiscalPeriodService fiscalPeriodService; public FiscalPeriodTableModel() { - fiscalPeriodService = LimaServiceFactory.getInstance().getFiscalPeriodService(); - } + fiscalPeriodService = + LimaServiceFactory.getInstance().getService( + FiscalPeriodServiceMonitorable.class); + } @Override public int getRowCount() { Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/HomeViewHandler.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/HomeViewHandler.java 2010-07-20 10:29:28 UTC (rev 2976) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/HomeViewHandler.java 2010-07-20 17:14:24 UTC (rev 2977) @@ -6,15 +6,15 @@ import javax.swing.JEditorPane; import javax.swing.event.HyperlinkEvent; import javax.swing.event.HyperlinkListener; - import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.lima.LimaContext; -import org.chorem.lima.business.AccountService; -import org.chorem.lima.business.EntryBookService; -import org.chorem.lima.business.FinancialTransactionService; -import org.chorem.lima.business.FiscalPeriodService; +import org.chorem.lima.business.AccountServiceMonitorable; +import org.chorem.lima.business.EntryBookServiceMonitorable; +import org.chorem.lima.business.FinancialTransactionServiceMonitorable; +import org.chorem.lima.business.FiscalPeriodServiceMonitorable; import org.chorem.lima.business.LimaException; +import org.chorem.lima.business.ServiceListener; import org.chorem.lima.entity.Account; import org.chorem.lima.entity.EntryBook; import org.chorem.lima.entity.FinancialTransaction; @@ -23,17 +23,17 @@ import org.chorem.lima.ui.MainView; -public class HomeViewHandler implements HyperlinkListener { +public class HomeViewHandler implements HyperlinkListener, ServiceListener { private static final Log log = LogFactory.getLog(HomeViewHandler.class); protected HomeView view; /* Services */ - protected AccountService accountService; - protected EntryBookService entryBookService; - protected FinancialTransactionService financialTransactionService; - protected FiscalPeriodService fiscalPeriodService; + protected AccountServiceMonitorable accountService; + protected EntryBookServiceMonitorable entryBookService; + protected FinancialTransactionServiceMonitorable financialTransactionService; + protected FiscalPeriodServiceMonitorable fiscalPeriodService; /* Editorpane*/ protected JEditorPane accountPane; @@ -47,13 +47,13 @@ this.view=view; accountService = - LimaServiceFactory.getInstance().getAccountService(); + LimaServiceFactory.getInstance().getService(AccountServiceMonitorable.class); entryBookService = - LimaServiceFactory.getInstance().getEntryBookService(); + LimaServiceFactory.getInstance().getService(EntryBookServiceMonitorable.class); financialTransactionService = - LimaServiceFactory.getInstance().getTransactionService(); + LimaServiceFactory.getInstance().getService(FinancialTransactionServiceMonitorable.class); fiscalPeriodService = - LimaServiceFactory.getInstance().getFiscalPeriodService(); + LimaServiceFactory.getInstance().getService(FiscalPeriodServiceMonitorable.class); } @@ -224,5 +224,10 @@ log.debug("Can't get datas home", eee); } } + + @Override + public void notifyMethod(String serviceName, String methodName) { + log.debug("salut"); + } } Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java 2010-07-20 10:29:28 UTC (rev 2976) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java 2010-07-20 17:14:24 UTC (rev 2977) @@ -35,16 +35,17 @@ import javax.swing.SwingWorker; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.chorem.lima.business.ExportService; -import org.chorem.lima.business.ImportService; +import org.chorem.lima.business.ExportServiceMonitorable; +import org.chorem.lima.business.ImportServiceMonitorable; import org.chorem.lima.business.LimaException; +import org.chorem.lima.business.ServiceListener; import org.chorem.lima.service.LimaServiceFactory; import org.chorem.lima.ui.account.AccountViewHandler; import org.chorem.lima.util.DialogHelper; import org.chorem.lima.util.FileChooseView; import org.jdesktop.swingx.painter.BusyPainter; -public class ImportExport { +public class ImportExport implements ServiceListener { private static ImportExport exchanger; @@ -52,16 +53,23 @@ protected static Component viewComponent; - protected ImportService importService; + protected ImportServiceMonitorable importService; - protected ExportService exportService; + protected ExportServiceMonitorable exportService; private ImportExportWaitView waitView; public ImportExport(Component view) { viewComponent=view; - importService = LimaServiceFactory.getInstance().getImportService(); - exportService = LimaServiceFactory.getInstance().getExportService(); + + //services + importService = + LimaServiceFactory.getInstance().getService( + ImportServiceMonitorable.class); + exportService = + LimaServiceFactory.getInstance().getService( + ExportServiceMonitorable.class); + //create the wait dialog panel waitView = new ImportExportWaitView(); waitView.waitDialog.setSize(400, 200); @@ -240,6 +248,12 @@ return new String(datas); } + @Override + public void notifyMethod(String serviceName, String methodName) { + log.debug("listener : "+serviceName+" "+methodName); + // TODO Auto-generated method stub + + } public static ImportExport getInstance(Component view) { if (exchanger == null) { Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerTableModel.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerTableModel.java 2010-07-20 10:29:28 UTC (rev 2976) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerTableModel.java 2010-07-20 17:14:24 UTC (rev 2977) @@ -32,6 +32,7 @@ import org.chorem.lima.beans.ReportsDatas; import org.chorem.lima.business.LimaException; import org.chorem.lima.business.ReportService; +import org.chorem.lima.business.ReportServiceMonitorable; import org.chorem.lima.business.utils.EntryComparator; import org.chorem.lima.entity.Entry; import org.chorem.lima.entity.EntryBook; @@ -77,7 +78,8 @@ */ public LedgerTableModel() { reportService = - LimaServiceFactory.getInstance().getReportService(); + LimaServiceFactory.getInstance().getService( + ReportServiceMonitorable.class); } @Override Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2010-07-20 10:29:28 UTC (rev 2976) +++ trunk/pom.xml 2010-07-20 17:14:24 UTC (rev 2977) @@ -165,6 +165,14 @@ <scope>compile</scope> </dependency> + <!-- itext pdf to create document --> + + <dependency> + <groupId>com.lowagie</groupId> + <artifactId>itext</artifactId> + <version>2.1.7</version> + </dependency> + <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId>