r2901 - in trunk: . .settings 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/test/java/org/chorem/lima/business lima-callao/src/main/xmi lima-swing/src/main/java/org/chorem/lima/service lima-swing/src/main/java/org/chorem/lima/ui lima-swing/src/main/java/org/chorem/lima/ui/accountsreports lima-swing/src/main/java/org/chorem/lima/ui/balance lima-
Author: jpepin Date: 2010-05-19 12:52:43 +0200 (Wed, 19 May 2010) New Revision: 2901 Url: http://chorem.org/repositories/revision/lima/2901 Log: Migration du calcul des donn?\195?\169es, totaux et soldes dans ReportService. Added: trunk/.settings/ trunk/.settings/org.maven.ide.eclipse.prefs trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/AccountComparator.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/CriteriaWidget.jaxx trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionHelper.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionView.jaxx trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionViewHandler.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/LetteringView.jaxx trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/SearchFinancialTransactionViewHandler.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/SearchTransactionView.jaxx trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/table/ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/table/AccountTableCellEditor.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/table/DateTableCellEditor.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/table/EntryBookTableCellEditor.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/table/FinancialTransactionTable.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/table/FinancialTransactionTableModel.java Removed: trunk/lima-business/src/test/java/org/chorem/lima/business/utils/ trunk/lima-swing/src/main/java/org/chorem/lima/ui/transaction/CriteriaWidget.jaxx trunk/lima-swing/src/main/java/org/chorem/lima/ui/transaction/FinancialTransactionHelper.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/transaction/FinancialTransactionView.jaxx trunk/lima-swing/src/main/java/org/chorem/lima/ui/transaction/FinancialTransactionViewHandler.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/transaction/LetteringView.jaxx trunk/lima-swing/src/main/java/org/chorem/lima/ui/transaction/SearchFinancialTransactionViewHandler.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/transaction/SearchTransactionView.jaxx trunk/lima-swing/src/main/java/org/chorem/lima/ui/transaction/table/AccountTableCellEditor.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/transaction/table/DateTableCellEditor.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/transaction/table/EntryBookTableCellEditor.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/transaction/table/FinancialTransactionTable.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/transaction/table/FinancialTransactionTableModel.java Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/AccountService.java trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialTransactionService.java trunk/lima-business/src/main/java/org/chorem/lima/business/ReportService.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/FilesServiceImpl.java trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialPeriodServiceImpl.java trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ReportServiceImpl.java trunk/lima-callao/src/main/xmi/accounting.properties trunk/lima-callao/src/main/xmi/accounting.zargo trunk/lima-swing/src/main/java/org/chorem/lima/service/LimaServiceFactory.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsTableModel.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/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/entrybooksreports/EntryBooksReportsTableModel.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsViewHandler.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/pom.xml Added: trunk/.settings/org.maven.ide.eclipse.prefs =================================================================== --- trunk/.settings/org.maven.ide.eclipse.prefs (rev 0) +++ trunk/.settings/org.maven.ide.eclipse.prefs 2010-05-19 10:52:43 UTC (rev 2901) @@ -0,0 +1,9 @@ +#Wed May 19 12:27:54 CEST 2010 +activeProfiles= +eclipse.preferences.version=1 +fullBuildGoals=process-test-resources +includeModules=false +resolveWorkspaceProjects=true +resourceFilterGoals=process-resources resources\:testResources +skipCompilerPlugin=true +version=1 Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/AccountService.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/AccountService.java 2010-05-17 09:08:42 UTC (rev 2900) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/AccountService.java 2010-05-19 10:52:43 UTC (rev 2901) @@ -19,8 +19,10 @@ package org.chorem.lima.business; +import java.util.Date; import java.util.List; +import org.chorem.lima.beans.BalanceTrial; import org.chorem.lima.entity.Account; /** @@ -35,7 +37,7 @@ public interface AccountService { List<Account> getAllAccounts() throws LimaException; - + /** * Create new account. If {@code masterAccount} is not null, {@code account} * is added in {@code masterAccount}'s subAccounts. Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialTransactionService.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialTransactionService.java 2010-05-17 09:08:42 UTC (rev 2900) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialTransactionService.java 2010-05-19 10:52:43 UTC (rev 2901) @@ -22,12 +22,12 @@ import java.util.Date; import java.util.List; +import org.chorem.lima.beans.ReportsDatas; import org.chorem.lima.entity.Account; import org.chorem.lima.entity.Entry; import org.chorem.lima.entity.EntryBook; import org.chorem.lima.entity.FinancialPeriod; import org.chorem.lima.entity.FinancialTransaction; -import org.nuiton.topia.TopiaException; /** * Transaction service. @@ -88,9 +88,5 @@ void updateEntry(Entry entry) throws LimaException; void removeEntry(Entry entry) throws LimaException; - - List<Entry> getAllEntriesForAccount(Account account, Date beginDate, Date endDate) throws LimaException; - List<Entry> getAllEntriesForEntryBook(EntryBook entryBook, Date beginDate, Date endDate) throws LimaException; - } Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ReportService.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ReportService.java 2010-05-17 09:08:42 UTC (rev 2900) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ReportService.java 2010-05-19 10:52:43 UTC (rev 2901) @@ -19,8 +19,12 @@ package org.chorem.lima.business; -import org.chorem.lima.beans.BalanceSheet; +import java.util.Date; + import org.chorem.lima.beans.BalanceTrial; +import org.chorem.lima.beans.ReportsDatas; +import org.chorem.lima.entity.Account; +import org.chorem.lima.entity.EntryBook; import org.chorem.lima.entity.FinancialPeriod; import org.chorem.lima.entity.FiscalPeriod; @@ -47,8 +51,8 @@ * @param fiscalPeriod exercice * @return le bilan * @throws LimaException + * BalanceSheet generateBalanceSheet(FiscalPeriod fiscalPeriod) throws LimaException; */ - BalanceSheet generateBalanceSheet(FiscalPeriod fiscalPeriod) throws LimaException; /** * Generation de la balance. @@ -57,6 +61,16 @@ * @return la balance * @throws LimaException */ - BalanceTrial generateBalanceTrial(FinancialPeriod financialPeriod) throws LimaException; + BalanceTrial generateBalanceTrial(Date beginDate, Date endDate) throws LimaException; + /** + * Generation du rapports des comptes + */ + ReportsDatas generateAccountsReports(Account account, Date beginDate, Date endDate) throws LimaException; + + /** + * Generation du rapports des journaux + */ + ReportsDatas generateEntryBooksReports(EntryBook entryBook, Date beginDate, Date endDate) throws LimaException; + } 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 2010-05-17 09:08:42 UTC (rev 2900) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/DefaultAccountingRules.java 2010-05-19 10:52:43 UTC (rev 2901) @@ -26,7 +26,6 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.lima.business.AccountingRules; -import org.chorem.lima.business.FinancialPeriodService; import org.chorem.lima.business.LimaBusinessException; import org.chorem.lima.business.LimaException; import org.chorem.lima.business.ejb.AccountServiceImpl; @@ -39,14 +38,11 @@ import org.chorem.lima.entity.EntryBookDAO; import org.chorem.lima.entity.EntryDAO; import org.chorem.lima.entity.FinancialPeriod; -import org.chorem.lima.entity.FinancialPeriodDAO; import org.chorem.lima.entity.FinancialTransaction; -import org.chorem.lima.entity.FinancialTransactionDAO; import org.chorem.lima.entity.FiscalPeriod; import org.chorem.lima.entity.LimaCallaoDAOHelper; import org.nuiton.topia.TopiaContext; import org.nuiton.topia.TopiaException; -import org.nuiton.topia.framework.TopiaQuery; /** * Defaults rules, if no localized rules classes is instantiated * this default class contain the strict minimum rules to check the data integrity 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 2010-05-17 09:08:42 UTC (rev 2900) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java 2010-05-19 10:52:43 UTC (rev 2901) @@ -24,7 +24,6 @@ import java.util.ArrayList; import java.util.List; import java.util.ListIterator; -import java.util.Properties; import javax.ejb.Stateless; @@ -37,7 +36,6 @@ import org.chorem.lima.business.LimaException; import org.chorem.lima.entity.Account; 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.TopiaContextFactory; @@ -351,4 +349,5 @@ throw new LimaException("Can't update account", ex); } } + } \ No newline at end of file Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FilesServiceImpl.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FilesServiceImpl.java 2010-05-17 09:08:42 UTC (rev 2900) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FilesServiceImpl.java 2010-05-19 10:52:43 UTC (rev 2901) @@ -23,7 +23,6 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.chorem.lima.business.utils.DateUtil; import org.chorem.lima.entity.Account; import org.jdom.Document; import org.jdom.Element; @@ -45,8 +44,6 @@ static org.jdom.Document document = new Document(racine); - private static DateUtil dateUtil = new DateUtil(); - private AccountServiceImpl accountServiceImpl = new AccountServiceImpl(); private EntryBookServiceImpl journalServiceImpl = new EntryBookServiceImpl(); Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialPeriodServiceImpl.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialPeriodServiceImpl.java 2010-05-17 09:08:42 UTC (rev 2900) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialPeriodServiceImpl.java 2010-05-19 10:52:43 UTC (rev 2901) @@ -26,21 +26,16 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.lima.business.FinancialPeriodService; -import org.chorem.lima.business.FiscalPeriodService; import org.chorem.lima.business.LimaConfig; import org.chorem.lima.business.LimaException; -import org.chorem.lima.entity.Account; -import org.chorem.lima.entity.AccountDAO; import org.chorem.lima.entity.ClosedPeriodicEntryBook; import org.chorem.lima.entity.ClosedPeriodicEntryBookDAO; import org.chorem.lima.entity.ClosedPeriodicEntryBookImpl; -import org.chorem.lima.entity.Entry; import org.chorem.lima.entity.EntryBook; import org.chorem.lima.entity.EntryBookDAO; import org.chorem.lima.entity.FinancialPeriod; import org.chorem.lima.entity.FinancialPeriodDAO; import org.chorem.lima.entity.FinancialPeriodImpl; -import org.chorem.lima.entity.FinancialTransaction; import org.chorem.lima.entity.FiscalPeriod; import org.chorem.lima.entity.LimaCallaoDAOHelper; import org.nuiton.topia.TopiaContext; @@ -48,7 +43,6 @@ import org.nuiton.topia.TopiaException; import org.nuiton.topia.TopiaNotFoundException; import org.nuiton.topia.framework.TopiaQuery; -import org.nuiton.topia.framework.TopiaQuery.Op; /** @@ -285,17 +279,12 @@ = LimaCallaoDAOHelper.getClosedPeriodicEntryBookDAO(transaction); TopiaQuery query = closedPeriodicEntryBookDAO.createQuery(); - String closedPeriodicEntryBookProperty = TopiaQuery.getProperty(ClosedPeriodicEntryBook.FINANCIAL_PERIOD, FinancialPeriod.FISCAL_PERIOD, FiscalPeriod.LOCKED); + String closedPeriodicEntryBookProperty = + TopiaQuery.getProperty(ClosedPeriodicEntryBook.FINANCIAL_PERIOD, + FinancialPeriod.FISCAL_PERIOD, FiscalPeriod.LOCKED); query.add(closedPeriodicEntryBookProperty, Boolean.FALSE); - + query.addOrder(ClosedPeriodicEntryBook.FINANCIAL_PERIOD); result = closedPeriodicEntryBookDAO.findAllByQuery(query); - log.debug(result); - - // FOR NO LAZY EXCEPTION - for (ClosedPeriodicEntryBook closedPeriodicEntryBook : result) { - closedPeriodicEntryBook.getEntryBook().getLabel(); - closedPeriodicEntryBook.getFinancialPeriod().getBeginDate(); - } // commit transaction.commitTransaction(); Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java 2010-05-17 09:08:42 UTC (rev 2900) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java 2010-05-19 10:52:43 UTC (rev 2901) @@ -29,7 +29,6 @@ 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.LimaConfig; import org.chorem.lima.business.LimaException; import org.chorem.lima.business.FinancialTransactionService; @@ -92,7 +91,8 @@ topiaContext = rootContext.beginTransaction(); //check if the financial period is blocked - accountingRules.checkFinancialPeriodBlockedWithFinancialTransaction(financialtransaction, topiaContext); + accountingRules.checkFinancialPeriodBlockedWithFinancialTransaction( + financialtransaction, topiaContext); FinancialTransactionDAO financialtransactionDAO = LimaCallaoDAOHelper .getFinancialTransactionDAO(topiaContext); @@ -122,7 +122,8 @@ */ protected FinancialTransaction findByEntryBook(TopiaContext topiaTransaction, EntryBook entryBook) throws TopiaException { - FinancialTransactionDAO transactionDAO = LimaCallaoDAOHelper.getFinancialTransactionDAO(topiaTransaction); + FinancialTransactionDAO transactionDAO = + LimaCallaoDAOHelper.getFinancialTransactionDAO(topiaTransaction); TopiaQuery query = transactionDAO.createQuery(); // entryBook is not visible, but column "entryBook" @@ -199,7 +200,8 @@ TopiaContext topiaTransaction = null; try { topiaTransaction = rootContext.beginTransaction(); - FinancialTransactionDAO transactionDAO = LimaCallaoDAOHelper.getFinancialTransactionDAO(topiaTransaction); + FinancialTransactionDAO transactionDAO = + LimaCallaoDAOHelper.getFinancialTransactionDAO(topiaTransaction); // filter with topia query TopiaQuery query = transactionDAO.createQuery(); @@ -211,7 +213,6 @@ if (financialPeriod != null) { query.add("financialPeriod", financialPeriod); } - transactions = transactionDAO.findAllByQuery(query); //IMPORTANT : LOADING ENTRIES AND IS COLUMN FOR NO LAZY EXCEPTION @@ -247,7 +248,8 @@ accountingRules.checkFinancialPeriodBlockedWithFinancialTransaction(financialtransaction, topiaTransaction); - FinancialTransactionDAO transactionDAO = LimaCallaoDAOHelper.getFinancialTransactionDAO(topiaTransaction); + FinancialTransactionDAO transactionDAO = + LimaCallaoDAOHelper.getFinancialTransactionDAO(topiaTransaction); transactionDAO.update(financialtransaction); // commit topiaTransaction.commitTransaction(); @@ -271,8 +273,10 @@ //check if the financial period is blocked accountingRules.checkFinancialPeriodBlockedWithFinancialTransaction(financialtransaction, topiaTransaction); - FinancialTransactionDAO transactionDAO = LimaCallaoDAOHelper.getFinancialTransactionDAO(topiaTransaction); - FinancialTransaction financialTransaction2 = transactionDAO.findByTopiaId(financialtransaction.getTopiaId()); + FinancialTransactionDAO transactionDAO = + LimaCallaoDAOHelper.getFinancialTransactionDAO(topiaTransaction); + FinancialTransaction financialTransaction2 = + transactionDAO.findByTopiaId(financialtransaction.getTopiaId()); transactionDAO.delete(financialTransaction2); // commit topiaTransaction.commitTransaction(); @@ -371,84 +375,4 @@ doFinally(topiaContext, log); } } - - @Override - public List<Entry> getAllEntriesForAccount(Account account, Date beginDate, Date endDate) throws LimaException { - List<Entry> entries = null; - TopiaContext topiaTransaction = null; - try { - topiaTransaction = rootContext.beginTransaction(); - EntryDAO entryDAO= LimaCallaoDAOHelper.getEntryDAO(topiaTransaction); - TopiaQuery query = entryDAO.createQuery(); - - if (account != null) { - query - .add(Entry.ACCOUNT, account); - } - if (beginDate != null && endDate != null){ - String transactionDateProperty = TopiaQuery.getProperty(Entry.FINANCIAL_TRANSACTION, FinancialTransaction.TRANSACTION_DATE); - query.add(transactionDateProperty+" BETWEEN :beginDate AND :endDate") - .addParam("beginDate", beginDate) - .addParam("endDate", endDate); - } - entries=entryDAO.findAllByQuery(query); - - //IMPORTANT : LOADING ENTRIES AND IS COLUMN FOR NO LAZY EXCEPTION - for (Entry entry : entries) { - entry.getEntryBook(); - entry.getFinancialTransaction().getTransactionDate(); - } - - // commit - topiaTransaction.commitTransaction(); - } - catch (TopiaException ex) { - doCatch(topiaTransaction, ex, log); - } - finally { - doFinally(topiaTransaction, log); - } - - return entries; - } - - @Override - public List<Entry> getAllEntriesForEntryBook(EntryBook entryBook, Date beginDate, Date endDate) throws LimaException { - List<Entry> entries = null; - TopiaContext topiaTransaction = null; - try { - topiaTransaction = rootContext.beginTransaction(); - EntryDAO entryDAO= LimaCallaoDAOHelper.getEntryDAO(topiaTransaction); - TopiaQuery query = entryDAO.createQuery(); - - if (entryBook != null) { - query - .add(Entry.ENTRY_BOOK, entryBook); - } - if (beginDate != null && endDate != null){ - String transactionDateProperty = TopiaQuery.getProperty(Entry.FINANCIAL_TRANSACTION, FinancialTransaction.TRANSACTION_DATE); - query.add(transactionDateProperty+" BETWEEN :beginDate AND :endDate") - .addParam("beginDate", beginDate) - .addParam("endDate", endDate); - } - entries=entryDAO.findAllByQuery(query); - - //IMPORTANT : LOADING ENTRIES AND IS COLUMN FOR NO LAZY EXCEPTION - for (Entry entry : entries) { - entry.getAccount(); - entry.getFinancialTransaction().getTransactionDate(); - } - - // commit - topiaTransaction.commitTransaction(); - } - catch (TopiaException ex) { - doCatch(topiaTransaction, ex, log); - } - finally { - doFinally(topiaTransaction, log); - } - - return entries; - } } \ No newline at end of file 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 2010-05-17 09:08:42 UTC (rev 2900) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ReportServiceImpl.java 2010-05-19 10:52:43 UTC (rev 2901) @@ -19,45 +19,255 @@ package org.chorem.lima.business.ejb; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + import javax.ejb.Stateless; -import org.chorem.lima.beans.BalanceSheet; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; 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.LimaConfig; import org.chorem.lima.business.LimaException; import org.chorem.lima.business.ReportService; -import org.chorem.lima.entity.FinancialPeriod; -import org.chorem.lima.entity.FiscalPeriod; +import org.chorem.lima.entity.Account; +import org.chorem.lima.entity.AccountDAO; +import org.chorem.lima.entity.Entry; +import org.chorem.lima.entity.EntryBook; +import org.chorem.lima.entity.EntryDAO; +import org.chorem.lima.entity.FinancialTransaction; +import org.chorem.lima.entity.LimaCallaoDAOHelper; +import org.nuiton.topia.TopiaContext; +import org.nuiton.topia.TopiaContextFactory; +import org.nuiton.topia.TopiaException; +import org.nuiton.topia.TopiaNotFoundException; +import org.nuiton.topia.framework.TopiaQuery; @Stateless -public class ReportServiceImpl implements ReportService { +public class ReportServiceImpl extends AbstractLimaService implements ReportService { + + private static final Log log = LogFactory.getLog(AccountServiceImpl.class); + + private TopiaContext rootContext; + + public ReportServiceImpl() { + LimaConfig config = LimaConfig.getInstance(); + try { + rootContext = TopiaContextFactory.getContext(config.getOptions()); + } catch (TopiaNotFoundException ex) { + if (log.isErrorEnabled()) { + log.error("Can't init topia context", ex); + } + } + } + + @Override + public ReportsDatas generateAccountsReports(Account account, Date beginDate, Date endDate) throws LimaException { + ReportsDatas reportsDatas = null; + + TopiaContext topiaTransaction = null; + try { + topiaTransaction = rootContext.beginTransaction(); + + reportsDatas = + generateAccountReportsWithTransaction(account, beginDate, + endDate, topiaTransaction); + } + catch (TopiaException ex) { + doCatch(topiaTransaction, ex, log); + } + finally { + doFinally(topiaTransaction, log); + } + + return reportsDatas; + } - public String generateAccount(String number, String amount, String label) { - return null; - } + + public ReportsDatas generateAccountReportsWithTransaction (Account account, Date beginDate, Date endDate, TopiaContext topiaContext) throws LimaException{ + ReportsDatas reportsDatas = new ReportsDatasImpl(); + double credit = 0, debit = 0, solde = 0; - public BalanceSheet generateBalanceSheet(FiscalPeriod fiscalPeriod) throws LimaException { - // bilan - return null; - } + try { + EntryDAO entryDAO= LimaCallaoDAOHelper.getEntryDAO(topiaContext); + TopiaQuery query = entryDAO.createQuery(); + + if (account != null) { + query + .add(Entry.ACCOUNT, account); + } + if (beginDate != null && endDate != null){ + String transactionDateProperty = + TopiaQuery.getProperty(Entry.FINANCIAL_TRANSACTION, + FinancialTransaction.TRANSACTION_DATE); + query.add(transactionDateProperty+" BETWEEN :beginDate AND :endDate") + .addParam("beginDate", beginDate) + .addParam("endDate", endDate); + } + reportsDatas.setListEntry(entryDAO.findAllByQuery(query)); + + for (Entry entry : reportsDatas.getListEntry()) { + //IMPORTANT : LOADING ENTRIES AND IS COLUMN FOR NO LAZY EXCEPTION + entry.getEntryBook(); + entry.getFinancialTransaction().getTransactionDate(); + //calulate the amounts + if (entry.getDebit()) { + debit += entry.getAmount(); + } + else { + credit += entry.getAmount(); + } + } + + // set the amounts and solde + solde = debit - credit; + if (solde > 0){ + reportsDatas.setSoldeDebit(true); + } + solde = Math.abs(solde); + reportsDatas.setAmountCredit(credit); + reportsDatas.setAmountDebit(debit); + reportsDatas.setAmountSolde(solde); - public BalanceTrial generateBalanceTrial(FinancialPeriod financialPeriod) throws LimaException { - // balance - return null; + // commit + topiaContext.commitTransaction(); + } + catch (TopiaException ex) { + doCatch(topiaContext, ex, log); + } + + return reportsDatas; } + + /** + * Get all entry from an entrybook and a begin-end dates order by financial transaction date + * + * Calculate the amounts and the solde + * + */ + @Override + public ReportsDatas generateEntryBooksReports(EntryBook entryBook, Date beginDate, Date endDate) throws LimaException { + ReportsDatas reportsDatas = new ReportsDatasImpl(); + double credit = 0, debit = 0, solde = 0; + + // Get all entries with a topia query + TopiaContext topiaTransaction = null; + try { + topiaTransaction = rootContext.beginTransaction(); + EntryDAO entryDAO= LimaCallaoDAOHelper.getEntryDAO(topiaTransaction); + TopiaQuery query = entryDAO.createQuery(); + + if (entryBook != null) { + query + .add(Entry.ENTRY_BOOK, entryBook); + } + if (beginDate != null && endDate != null){ + String transactionDateProperty = + TopiaQuery.getProperty(Entry.FINANCIAL_TRANSACTION, + FinancialTransaction.TRANSACTION_DATE); + query.add(transactionDateProperty+" BETWEEN :beginDate AND :endDate") + .addParam("beginDate", beginDate) + .addParam("endDate", endDate); + String orderProperty = + TopiaQuery.getProperty(Entry.FINANCIAL_TRANSACTION, + FinancialTransaction.TRANSACTION_DATE); + query.addOrder(orderProperty); + } + reportsDatas.setListEntry(entryDAO.findAllByQuery(query)); + + for (Entry entry : reportsDatas.getListEntry()) { + //IMPORTANT : LOADING ENTRIES AND IS COLUMN FOR NO LAZY EXCEPTION + entry.getAccount(); + entry.getFinancialTransaction().getTransactionDate(); + //calulate the amounts + if (entry.getDebit()) { + debit += entry.getAmount(); + } + else { + credit += entry.getAmount(); + } + } + + // set the amounts and solde + solde = debit - credit; + if (solde > 0){ + reportsDatas.setSoldeDebit(true); + } + solde = Math.abs(solde); + reportsDatas.setAmountCredit(credit); + reportsDatas.setAmountDebit(debit); + reportsDatas.setAmountSolde(solde); + + // commit + topiaTransaction.commitTransaction(); + } + catch (TopiaException ex) { + doCatch(topiaTransaction, ex, log); + } + finally { + doFinally(topiaTransaction, log); + } + + return reportsDatas; + } - public String generateCashFlowStatement(String period) { - return null; - } - - public String generateGeneralLedger(String period) { - return null; - } - - public String generateIncomeStatement(String period) { - return null; - } - - public String generateJournal(String type, String period) { - return null; - } + /** + * Get balance trial + * + * Calculate the amounts and the solde + */ + @Override + public BalanceTrial generateBalanceTrial(Date beginDate, Date endDate) throws LimaException { + BalanceTrial balanceTrial = new BalanceTrialImpl(); + balanceTrial.setReportsDatas(new ArrayList<ReportsDatas>()); + double credit = 0, debit = 0, solde = 0; + List<Account> accountsList = new ArrayList<Account>(); + + TopiaContext topiaTransaction = null; + try { + topiaTransaction = rootContext.beginTransaction(); + + //Get All account + AccountDAO accountDAO = + LimaCallaoDAOHelper.getAccountDAO(topiaTransaction); + List<Account> accounts = accountDAO.findAll(); + accountsList.addAll(accounts); + + //for each account create a balance sheet with a ReportsDatas + for (Account account : accounts) { + ReportsDatas reportsDatas = + generateAccountReportsWithTransaction(account, beginDate, endDate, topiaTransaction); + reportsDatas.setAccount(account); + // add balance sheet to balance trial + balanceTrial.addReportsDatas(reportsDatas); + if (reportsDatas.getSoldeDebit()) { + debit += reportsDatas.getAmountSolde(); + } + else { + credit += reportsDatas.getAmountSolde(); + } + } + // set the amounts and solde + solde = debit - credit; + if (solde > 0){ + balanceTrial.setSoldeDebit(true); + } + solde = Math.abs(solde); + balanceTrial.setAmountCredit(credit); + balanceTrial.setAmountDebit(debit); + balanceTrial.setAmountSolde(solde); + } + catch (TopiaException ex) { + doCatch(topiaTransaction, ex, log); + } + finally { + doFinally(topiaTransaction, log); + } + + return balanceTrial; + } } Modified: trunk/lima-callao/src/main/xmi/accounting.properties =================================================================== --- trunk/lima-callao/src/main/xmi/accounting.properties 2010-05-17 09:08:42 UTC (rev 2900) +++ trunk/lima-callao/src/main/xmi/accounting.properties 2010-05-19 10:52:43 UTC (rev 2901) @@ -5,6 +5,8 @@ org.chorem.lima.entity.Account.attribute.identity.tagvalue.lazy=false org.chorem.lima.entity.FinancialTransaction.attribute.financialPeriod.tagvalue.lazy=false org.chorem.lima.entity.FiscalPeriod.attribute.financialPeriod.tagvalue.lazy=false +org.chorem.lima.entity.ClosedPeriodicEntryBook.attribute.financialPeriod.tagvalue.lazy=false +org.chorem.lima.entity.ClosedPeriodicEntryBook.attribute.entryBook.tagvalue.lazy=false #model.tagvalue.dbSchema=Callao model.tagvalue.String=text \ No newline at end of file Modified: trunk/lima-callao/src/main/xmi/accounting.zargo =================================================================== (Binary files differ) 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-05-17 09:08:42 UTC (rev 2900) +++ trunk/lima-swing/src/main/java/org/chorem/lima/service/LimaServiceFactory.java 2010-05-19 10:52:43 UTC (rev 2901) @@ -37,6 +37,7 @@ import org.chorem.lima.business.FiscalPeriodService; 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. @@ -232,11 +233,33 @@ return ejbHome; } + /** * Get record service. * * @return record service proxy */ + public ReportService getReportService() { + + // TODO EC-20100410 put lookup name in configuration + // name should be fully configurable due to custom implementation used + String lookupName = "ReportServiceImplLocal"; + ReportService ejbHome = null; + try { + ejbHome = (ReportService)ctx.lookup(lookupName); + } catch (NamingException eee) { + if (log.isErrorEnabled()) { + log.error("Can't lookup for service : " + lookupName, eee); + } + } + return ejbHome; + } + + /** + * Get record service. + * + * @return record service proxy + */ public RecordService getRecordService() { // TODO EC-20100410 put lookup name in configuration Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java 2010-05-17 09:08:42 UTC (rev 2900) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java 2010-05-19 10:52:43 UTC (rev 2901) @@ -41,8 +41,8 @@ import org.chorem.lima.ui.entrybooksreports.EntryBooksReportsView; import org.chorem.lima.ui.financialperiod.FinancialPeriodView; import org.chorem.lima.ui.fiscalperiod.FiscalPeriodView; -import org.chorem.lima.ui.transaction.FinancialTransactionView; -import org.chorem.lima.ui.transaction.LetteringView; +import org.chorem.lima.ui.financialtransaction.FinancialTransactionView; +import org.chorem.lima.ui.financialtransaction.LetteringView; import org.chorem.lima.util.ErrorHelper; /** 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-05-17 09:08:42 UTC (rev 2900) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsTableModel.java 2010-05-19 10:52:43 UTC (rev 2901) @@ -22,22 +22,18 @@ import static org.nuiton.i18n.I18n._; import java.text.SimpleDateFormat; -import java.util.ArrayList; import java.util.Date; -import java.util.List; import javax.swing.table.AbstractTableModel; import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.chorem.lima.business.EntryBookService; -import org.chorem.lima.business.FinancialTransactionService; +import org.chorem.lima.beans.ReportsDatas; import org.chorem.lima.business.LimaException; +import org.chorem.lima.business.ReportService; import org.chorem.lima.entity.Account; import org.chorem.lima.entity.Entry; -import org.chorem.lima.entity.EntryBook; -import org.chorem.lima.entity.FinancialTransaction; import org.chorem.lima.service.LimaServiceFactory; import org.chorem.lima.util.ErrorHelper; @@ -60,7 +56,7 @@ private static final Log log = LogFactory.getLog(AccountsReportsTableModel.class); /** Services. */ - protected FinancialTransactionService financialTransactionService; + protected ReportService reportService; /** Account. */ protected Account selectedAccount; @@ -72,15 +68,14 @@ protected Date selectedEndDate; /** data cache */ - protected List<Entry> cacheDataList; + protected ReportsDatas cacheDataList; /** * Constructor. */ public AccountsReportsTableModel() { - financialTransactionService = - LimaServiceFactory.getInstance().getTransactionService(); + reportService = LimaServiceFactory.getInstance().getReportService(); } @Override @@ -89,7 +84,7 @@ // just prevent too much result if (selectedAccount != null) { - result = cacheDataList.size(); + result = cacheDataList.getListEntry().size(); } else { if (log.isDebugEnabled()) { @@ -135,7 +130,7 @@ public Object getValueAt(int row, int column) { Object result = null; if(selectedAccount != null) { - Entry currentRow = cacheDataList.get(row); + Entry currentRow = cacheDataList.getListEntry().get(row); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd MMM yyyy"); @@ -205,12 +200,11 @@ fireTableDataChanged(); } - public List<Entry> getDataList(){ - List<Entry> results = new ArrayList<Entry>(); + public ReportsDatas getDataList(){ + ReportsDatas results = null; try { - results = - financialTransactionService.getAllEntriesForAccount( - selectedAccount, selectedBeginDate, selectedEndDate); + results = reportService.generateAccountsReports(selectedAccount, + selectedBeginDate, selectedEndDate); } catch (LimaException eee) { if (log.isErrorEnabled()) { 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 2010-05-17 09:08:42 UTC (rev 2900) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsViewHandler.java 2010-05-19 10:52:43 UTC (rev 2901) @@ -20,11 +20,9 @@ import static org.nuiton.i18n.I18n._; -import java.util.List; - import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.chorem.lima.entity.Entry; +import org.chorem.lima.beans.ReportsDatas; import org.chorem.lima.ui.ReportsHelper; @@ -52,32 +50,36 @@ this.view = view; } + /* + * set text and amounts of labels credit, debit, solde + */ public void updateFooterLabel(){ AccountsReportsTableModel tablemodel = (AccountsReportsTableModel) view.getAccountsReportsTable().getModel(); - List<Entry> cacheDataList = tablemodel.getDataList(); + ReportsDatas cacheDataList = tablemodel.cacheDataList; - if (tablemodel.getDataList() != null){ - Double amountCredit = helper.getTotalCredit(cacheDataList); - Double amountDebit = helper.getTotalDebit(cacheDataList); - view.amountCreditLabel.setText(String.valueOf(amountCredit)); - view.amountDebitLabel.setText(String.valueOf(amountDebit)); - Double amountSolde = Math.abs(helper.getSolde(cacheDataList)); + if (cacheDataList != null){ + // set amounts credit and debit and solde + view.amountCreditLabel.setText(String.valueOf(cacheDataList.amountCredit)); + view.amountDebitLabel.setText(String.valueOf(cacheDataList.amountDebit)); + Double amountSolde = cacheDataList.amountSolde; view.amountSoldeLabel.setText(String.valueOf(amountSolde)); - if (amountSolde <0){ - //solde debiteur - view.soldeLabel.setText(_("lima.soldecredit")); + + + if (amountSolde == 0){ + view.soldeLabel.setText(_("lima.solde")); } - else if(amountSolde > 0) { - //solde créditeur - view.soldeLabel.setText(_("lima.soldedebit")); - } else { - //solde = 0 - view.soldeLabel.setText(_("lima.solde")); + // set label solde: credit or debit + if (cacheDataList.soldeDebit) { + view.soldeLabel.setText(_("lima.soldedebit")); + } + else { + view.soldeLabel.setText(_("lima.soldecredit")); + } } - } + } } } 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-05-17 09:08:42 UTC (rev 2900) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceTableModel.java 2010-05-19 10:52:43 UTC (rev 2901) @@ -21,7 +21,6 @@ import static org.nuiton.i18n.I18n._; -import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -29,11 +28,12 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.chorem.lima.business.AccountService; -import org.chorem.lima.business.FinancialTransactionService; +import org.chorem.lima.beans.BalanceTrial; +import org.chorem.lima.beans.BalanceTrialImpl; +import org.chorem.lima.beans.ReportsDatas; import org.chorem.lima.business.LimaException; +import org.chorem.lima.business.ReportService; import org.chorem.lima.entity.Account; -import org.chorem.lima.entity.Entry; import org.chorem.lima.service.LimaServiceFactory; import org.chorem.lima.ui.ReportsHelper; import org.chorem.lima.util.ErrorHelper; @@ -57,8 +57,7 @@ private static final Log log = LogFactory.getLog(BalanceTableModel.class); /** Services. */ - protected AccountService accountService; - protected FinancialTransactionService financialTransactionService; + protected ReportService reportService; /** Helper */ protected ReportsHelper helper; @@ -73,21 +72,18 @@ protected Date selectedEndDate; /** data cache */ - protected List<Account> cacheDataList; + protected BalanceTrial cacheDataList; /** * Constructor. */ public BalanceTableModel() { - accountService = LimaServiceFactory.getInstance().getAccountService(); - financialTransactionService = - LimaServiceFactory.getInstance().getTransactionService(); - + reportService = LimaServiceFactory.getInstance().getReportService(); } @Override public int getRowCount() { - return cacheDataList.size(); + return cacheDataList.getReportsDatas().size(); } @Override @@ -124,39 +120,33 @@ @Override public Object getValueAt(int row, int column) { Object result = null; - Account currentRow = cacheDataList.get(row); + ReportsDatas currentRow = ((List<ReportsDatas>) cacheDataList.getReportsDatas()).get(row); //get entries for the period for the current row try { - List<Entry> entries = - financialTransactionService.getAllEntriesForAccount(currentRow, - selectedBeginDate, selectedEndDate); - Double solde = helper.getSolde(entries); - Double debit = helper.getTotalDebit(entries); - Double credit = helper.getTotalCredit(entries); switch (column) { case 0: - result = currentRow.getAccountNumber(); //account number + result = currentRow.account.getAccountNumber(); //account number break; case 1: - result = currentRow.getLabel(); //account label + result = currentRow.account.getLabel(); //account label break; case 2: - result = debit; // total debit + result = currentRow.getAmountDebit(); // total debit break; case 3: - result = credit; // total crédit + result = currentRow.getAmountCredit(); // total crédit break; case 4: // solde debit - if (solde>0){ - result = Math.abs(solde); + if (currentRow.getSoldeDebit()){ + result = currentRow.getAmountSolde(); } else { result = 0; } break; case 5: // solde credit - if (solde<0){ - result = Math.abs(solde); + if (!currentRow.getSoldeDebit()){ + result = currentRow.getAmountSolde(); } else { result = 0; @@ -180,14 +170,12 @@ public void setBeginDate(Date date){ selectedBeginDate = date; - log.debug(selectedBeginDate); cacheDataList=getDataList(); fireTableDataChanged(); } public void setEndDate(Date date){ selectedEndDate = date; - log.debug(selectedEndDate); cacheDataList=getDataList(); fireTableDataChanged(); } @@ -196,11 +184,11 @@ * get all account fot the selected period * @return */ - public List<Account> getDataList(){ - List<Account> results = new ArrayList<Account>(); + public BalanceTrial getDataList(){ + BalanceTrial results = new BalanceTrialImpl(); try { - results = accountService.getAllAccounts(); + results = reportService.generateBalanceTrial(selectedBeginDate, selectedEndDate); } catch (LimaException eee) { if (log.isErrorEnabled()) { 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-05-17 09:08:42 UTC (rev 2900) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceViewHandler.java 2010-05-19 10:52:43 UTC (rev 2901) @@ -24,6 +24,8 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.chorem.lima.beans.BalanceTrial; +import org.chorem.lima.beans.ReportsDatas; import org.chorem.lima.business.FinancialTransactionService; import org.chorem.lima.business.LimaException; import org.chorem.lima.entity.Account; @@ -67,40 +69,29 @@ * get all entries for all accounts on the selected period */ public void updateFooterLabel(){ - Double totalCredit = 0.00, totalDebit = 0.00, solde = 0.00; BalanceTableModel tablemodel = (BalanceTableModel) view.getBalanceTable().getModel(); - try { - for (Account account : tablemodel.cacheDataList) { - List<Entry> entries; - entries = financialTransactionService. - getAllEntriesForAccount(account, - tablemodel.selectedBeginDate, - tablemodel.selectedEndDate); - totalCredit += helper.getTotalCredit(entries); - totalDebit += helper.getTotalDebit(entries); - solde += helper.getSolde(entries); - } + BalanceTrial cacheDataList = tablemodel.cacheDataList; + + if (cacheDataList != null){ + // set amounts credit, debit and solde + view.amountCreditLabel.setText(String.valueOf(cacheDataList.amountCredit)); + view.amountDebitLabel.setText(String.valueOf(cacheDataList.amountDebit)); + Double amountSolde = cacheDataList.amountSolde; + view.amountSoldeLabel.setText(String.valueOf(amountSolde)); - view.amountCreditLabel.setText(String.valueOf(totalCredit)); - view.amountDebitLabel.setText(String.valueOf(totalDebit)); - view.amountSoldeLabel.setText(String.valueOf(solde)); - if (solde <0){ - //solde debiteur - view.soldeLabel.setText(_("lima.soldecredit")); + + if (amountSolde == 0){ + view.soldeLabel.setText(_("lima.solde")); } - else if(solde > 0) { - //solde créditeur - view.soldeLabel.setText(_("lima.soldedebit")); - } else { - //solde = 0 - view.soldeLabel.setText(_("lima.solde")); - } - } - catch (LimaException eee){ - if (log.isDebugEnabled()){ - log.debug("Can't update footer labels",eee); + // set label solde: credit or debit + if (cacheDataList.soldeDebit) { + view.soldeLabel.setText(_("lima.soldedebit")); + } + else { + view.soldeLabel.setText(_("lima.soldecredit")); + } } } } 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-05-17 09:08:42 UTC (rev 2900) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/AccountComboBoxModel.java 2010-05-19 10:52:43 UTC (rev 2901) @@ -18,12 +18,20 @@ package org.chorem.lima.ui.combobox; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + import javax.swing.ComboBoxModel; import javax.swing.event.ListDataListener; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.chorem.lima.business.AccountService; import org.chorem.lima.business.LimaException; +import org.chorem.lima.entity.Account; import org.chorem.lima.service.LimaServiceFactory; +import org.chorem.lima.ui.financialperiod.FinancialPeriodTableModel; /** * Account combo box model. @@ -31,6 +39,8 @@ public class AccountComboBoxModel implements ComboBoxModel { + private static final Log log = LogFactory.getLog(FinancialPeriodTableModel.class); + protected Object selectedAccount; protected AccountService accountService; @@ -57,30 +67,12 @@ @Override public Object getElementAt(int index) { - Object result = null; - // TODO add cache - try { - result = accountService.getAllAccounts().get(index); - } - catch (LimaException ex) { - // TODO Auto-generated catch block - ex.printStackTrace(); - } - return result; + return getDataList().get(index); } @Override public int getSize() { - int result = 0; - // TODO add cache - try { - result = accountService.getAllAccounts().size(); - } - catch (LimaException ex) { - // TODO Auto-generated catch block - ex.printStackTrace(); - } - return result; + return getDataList().size(); } @Override @@ -89,7 +81,21 @@ } - + public List<Account> getDataList(){ + List<Account> result = new ArrayList<Account>(); + try { + result = accountService.getAllAccounts(); + Collections.sort(result, new AccountComparator()); + } + catch (LimaException eee) { + // TODO Auto-generated catch block + if (log.isDebugEnabled()){ + log.debug("Can't get list accounts", eee); + } + } + return result; + + } } Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/AccountComparator.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/AccountComparator.java (rev 0) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/AccountComparator.java 2010-05-19 10:52:43 UTC (rev 2901) @@ -0,0 +1,32 @@ +/* *##% 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.ui.combobox; + +import java.util.Comparator; + +import org.chorem.lima.entity.Account; + +public class AccountComparator implements Comparator<Account>{ + + @Override + public int compare(Account o1, Account o2) { + return o1.getAccountNumber().compareTo(o2.getAccountNumber()); + } + +} 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-05-17 09:08:42 UTC (rev 2900) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/EntryBookComboBoxModel.java 2010-05-19 10:52:43 UTC (rev 2901) @@ -18,12 +18,19 @@ package org.chorem.lima.ui.combobox; +import java.util.ArrayList; +import java.util.List; + import javax.swing.ComboBoxModel; import javax.swing.event.ListDataListener; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.chorem.lima.business.EntryBookService; import org.chorem.lima.business.LimaException; +import org.chorem.lima.entity.EntryBook; import org.chorem.lima.service.LimaServiceFactory; +import org.chorem.lima.ui.financialperiod.FinancialPeriodTableModel; /** * Opened financial period combo box model. @@ -36,6 +43,8 @@ */ public class EntryBookComboBoxModel implements ComboBoxModel { + private static final Log log = LogFactory.getLog(FinancialPeriodTableModel.class); + protected Object selectedEntryBook; protected EntryBookService entryBookService; @@ -49,16 +58,7 @@ */ @Override public int getSize() { - int result = 0; - // TODO add cache - try { - result = entryBookService.getAllEntryBooks().size(); - } - catch (LimaException ex) { - // TODO Auto-generated catch block - ex.printStackTrace(); - } - return result; + return getDataList().size(); } /* @@ -66,16 +66,7 @@ */ @Override public Object getElementAt(int index) { - Object result = null; - // TODO add cache - try { - result = entryBookService.getAllEntryBooks().get(index); - } - catch (LimaException ex) { - // TODO Auto-generated catch block - ex.printStackTrace(); - } - return result; + return getDataList().get(index); } /* @@ -109,4 +100,21 @@ public Object getSelectedItem() { return selectedEntryBook; } + + /* + * get the accounts list + */ + public List<EntryBook> getDataList(){ + List<EntryBook> result = new ArrayList<EntryBook>(); + try { + result = entryBookService.getAllEntryBooks(); + } + catch (LimaException eee) { + if (log.isDebugEnabled()){ + log.debug("Can't get list accounts", eee); + } + } + return result; + } + } 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-05-17 09:08:42 UTC (rev 2900) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsTableModel.java 2010-05-19 10:52:43 UTC (rev 2901) @@ -21,6 +21,7 @@ import static org.nuiton.i18n.I18n._; +import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -29,9 +30,12 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.chorem.lima.beans.ReportsDatas; +import org.chorem.lima.beans.ReportsDatasImpl; import org.chorem.lima.business.EntryBookService; import org.chorem.lima.business.FinancialTransactionService; import org.chorem.lima.business.LimaException; +import org.chorem.lima.business.ReportService; import org.chorem.lima.entity.Account; import org.chorem.lima.entity.Entry; import org.chorem.lima.entity.EntryBook; @@ -58,7 +62,7 @@ private static final Log log = LogFactory.getLog(EntryBooksReportsTableModel.class); /** Services. */ - protected FinancialTransactionService financialTransactionService; + protected ReportService reportService; /** Account. */ protected EntryBook selectedEntryBook; @@ -70,15 +74,15 @@ protected Date selectedEndDate; /** data cache */ - protected List<Entry> cacheDataList; + protected ReportsDatas cacheDataList; /** * Constructor. */ public EntryBooksReportsTableModel() { - financialTransactionService = - LimaServiceFactory.getInstance().getTransactionService(); + reportService = + LimaServiceFactory.getInstance().getReportService(); } @Override @@ -87,7 +91,7 @@ // just prevent too much result if (selectedEntryBook != null) { - result = cacheDataList.size(); + result = cacheDataList.listEntry.size(); } else { if (log.isDebugEnabled()) { @@ -133,11 +137,14 @@ public Object getValueAt(int row, int column) { Object result = null; if(selectedEntryBook != null) { - Entry currentRow = cacheDataList.get(row); + Entry currentRow = cacheDataList.listEntry.get(row); + SimpleDateFormat simpleDateFormat = + new SimpleDateFormat("dd MMMMM yyyy"); switch (column) { case 0: - result = currentRow.getFinancialTransaction().getTransactionDate(); + result = simpleDateFormat. + format(currentRow.getFinancialTransaction().getTransactionDate()); break; case 1: if (currentRow.getAccount() != null){ @@ -200,12 +207,11 @@ fireTableDataChanged(); } - public List<Entry> getDataList(){ - List<Entry> results = new ArrayList<Entry>(); + public ReportsDatas getDataList(){ + ReportsDatas results = new ReportsDatasImpl(); try { results = - financialTransactionService.getAllEntriesForEntryBook( - selectedEntryBook, selectedBeginDate, selectedEndDate); + reportService.generateEntryBooksReports(selectedEntryBook, selectedBeginDate, selectedEndDate); } catch (LimaException eee) { if (log.isErrorEnabled()) { 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 2010-05-17 09:08:42 UTC (rev 2900) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsViewHandler.java 2010-05-19 10:52:43 UTC (rev 2901) @@ -20,11 +20,9 @@ import static org.nuiton.i18n.I18n._; -import java.util.List; - import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.chorem.lima.entity.Entry; +import org.chorem.lima.beans.ReportsDatas; import org.chorem.lima.ui.ReportsHelper; @@ -52,30 +50,35 @@ this.view = view; } + + /* + * set text and amounts of labels credit, debit, solde + */ public void updateFooterLabel(){ EntryBooksReportsTableModel tablemodel = (EntryBooksReportsTableModel) view.getEntryBooksReportsTable().getModel(); - List<Entry> cacheDataList = tablemodel.getDataList(); + ReportsDatas cacheDataList = tablemodel.cacheDataList; - if (tablemodel.getDataList() != null){ - Double amountCredit = helper.getTotalCredit(cacheDataList); - Double amountDebit = helper.getTotalDebit(cacheDataList); - view.amountCreditLabel.setText(String.valueOf(amountCredit)); - view.amountDebitLabel.setText(String.valueOf(amountDebit)); - Double amountSolde = Math.abs(helper.getSolde(cacheDataList)); + if (cacheDataList != null){ + // set amounts credit, debit and solde + view.amountCreditLabel.setText(String.valueOf(cacheDataList.amountCredit)); + view.amountDebitLabel.setText(String.valueOf(cacheDataList.amountDebit)); + Double amountSolde = cacheDataList.amountSolde; view.amountSoldeLabel.setText(String.valueOf(amountSolde)); - if (amountSolde <0){ - //solde debiteur - view.soldeLabel.setText(_("lima.soldecredit")); + + + if (amountSolde == 0){ + view.soldeLabel.setText(_("lima.solde")); } - else if(amountSolde > 0) { - //solde créditeur - view.soldeLabel.setText(_("lima.soldedebit")); - } else { - //solde = 0 - view.soldeLabel.setText(_("lima.solde")); + // set label solde: credit or debit + if (cacheDataList.soldeDebit) { + view.soldeLabel.setText(_("lima.soldedebit")); + } + else { + view.soldeLabel.setText(_("lima.soldecredit")); + } } } } 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-05-17 09:08:42 UTC (rev 2900) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodTable.java 2010-05-19 10:52:43 UTC (rev 2901) @@ -37,7 +37,8 @@ public class FinancialPeriodTable extends JXTable { - private static final Log log = LogFactory.getLog(FinancialPeriodTableModel.class); + private static final Log log = + LogFactory.getLog(FinancialPeriodTableModel.class); protected FinancialPeriodViewHandler handler; @@ -47,17 +48,24 @@ private Highlighter colorTransaction; + /* + * Constructor, call highlighter + */ public FinancialPeriodTable(FinancialPeriodViewHandler handler) { this.handler = handler; model = this.handler.getView().modelFinancialPeriodTable; - financialPeriodService = LimaServiceFactory.getInstance().getFinancialPeriodService(); + financialPeriodService = + LimaServiceFactory.getInstance().getFinancialPeriodService(); //highlight financial financial transactions addMonthColor(); addBlockColor(); } + /* + * Color the background row in grey if the month number is even (pair in french) + */ protected void addMonthColor() { HighlightPredicate predicate = new HighlightPredicate() { @Override @@ -65,8 +73,6 @@ ComponentAdapter adapter) { ClosedPeriodicEntryBook closedPeriodicEntryBook = (ClosedPeriodicEntryBook) model.getElementAt(adapter.row); - // FinancialPeriodEntryBook financialPeriodEntryBook - // = (FinancialPeriodEntryBook) model.getElementAt(adapter.row); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MM"); int month = Integer.parseInt(simpleDateFormat.format( closedPeriodicEntryBook.getFinancialPeriod().getBeginDate())); @@ -80,16 +86,24 @@ addHighlighter(colorTransaction); } + /* + * Color the font in red if period are closed + */ protected void addBlockColor() { HighlightPredicate predicate = new HighlightPredicate() { @Override public boolean isHighlighted(Component renderer, ComponentAdapter adapter) { - ClosedPeriodicEntryBook closedPeriodicEntryBook = new ClosedPeriodicEntryBookImpl(); - ClosedPeriodicEntryBook selectedClosedPeriodicEntryBook = (ClosedPeriodicEntryBook) model.getElementAt(adapter.row); + ClosedPeriodicEntryBook closedPeriodicEntryBook = + new ClosedPeriodicEntryBookImpl(); + ClosedPeriodicEntryBook selectedClosedPeriodicEntryBook = + (ClosedPeriodicEntryBook) model.getElementAt(adapter.row); // true if locked try { - closedPeriodicEntryBook = financialPeriodService.getClosedPeriodicEntryBook(selectedClosedPeriodicEntryBook.getEntryBook(), selectedClosedPeriodicEntryBook.getFinancialPeriod()); + closedPeriodicEntryBook = + financialPeriodService.getClosedPeriodicEntryBook( + selectedClosedPeriodicEntryBook.getEntryBook(), + selectedClosedPeriodicEntryBook.getFinancialPeriod()); } catch (LimaException eee) { log.debug("Can't get closePeriodicEntryBook",eee); } 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-05-17 09:08:42 UTC (rev 2900) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodTableModel.java 2010-05-19 10:52:43 UTC (rev 2901) @@ -36,6 +36,7 @@ import org.chorem.lima.business.LimaException; import org.chorem.lima.entity.ClosedPeriodicEntryBook; import org.chorem.lima.entity.EntryBook; +import org.chorem.lima.entity.FinancialPeriod; import org.chorem.lima.service.LimaServiceFactory; /** @@ -60,7 +61,6 @@ protected FinancialPeriodService financialPeriodService; /** Datas cache */ - //protected List<FinancialPeriodEntryBook> cacheDataList; protected List<ClosedPeriodicEntryBook> cacheDataList; public FinancialPeriodTableModel() { @@ -69,26 +69,20 @@ financialPeriodService = LimaServiceFactory.getInstance().getFinancialPeriodService(); } - /* - * @see javax.swing.table.TableModel#getRowCount() - */ + @Override public int getRowCount() { //cacheDataList=getDataList(); return cacheDataList.size(); } - /* - * @see javax.swing.table.TableModel#getColumnCount() - */ + @Override public int getColumnCount() { return 3; } - /* - * @see javax.swing.table.TableModel#getColumnName(int) - */ + @Override public String getColumnName(int columnIndex) { @@ -109,18 +103,14 @@ return result; } - /* - * @see javax.swing.table.TableModel#getColumnClass(int) - */ + @Override public Class<?> getColumnClass(int columnIndex) { // both String return String.class; } - /* - * @see javax.swing.table.TableModel#isCellEditable(int, int) - */ + @Override public boolean isCellEditable(int rowIndex, int columnIndex) { return false; @@ -137,9 +127,7 @@ return currentRow; } - /* - * @see javax.swing.table.TableModel#getValueAt(int, int) - */ + @Override public Object getValueAt(int rowIndex, int columnIndex) { Object result = null; @@ -149,6 +137,7 @@ if (closedPeriodicEntryBook != null){ EntryBook entryBook = closedPeriodicEntryBook.getEntryBook(); + FinancialPeriod financialPeriod = closedPeriodicEntryBook.getFinancialPeriod(); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MMMMM yyyy"); @@ -156,7 +145,7 @@ switch (columnIndex) { case 0: result = StringUtils.capitalize(simpleDateFormat. - format(closedPeriodicEntryBook.getFinancialPeriod().getBeginDate())); + format(financialPeriod.getBeginDate())); break; case 1: result = entryBook.getCode()+" - "+entryBook.getLabel(); @@ -183,15 +172,11 @@ log.debug("Can't get closedperiodicentrybook list", eee ); } } - Collections.sort(results, new ClosedPeriodicEntryBookComparator()); + //Collections.sort(results, new ClosedPeriodicEntryBookComparator()); cacheDataList=results; } public void blockFinancialPeriod(ClosedPeriodicEntryBook closedPeriodicEntryBook) throws LimaException { - /* ClosedPeriodicEntryBook closedPeriodicEntryBook = - financialPeriodService.getClosedPeriodicEntryBook( - financialPeriodEntryBook.entryBook, - financialPeriodEntryBook.financialPeriod);*/ financialPeriodService.blockClosedPeriodicEntryBook(closedPeriodicEntryBook); fireTableDataChanged(); } Copied: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/CriteriaWidget.jaxx (from rev 2883, trunk/lima-swing/src/main/java/org/chorem/lima/ui/transaction/CriteriaWidget.jaxx) =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/CriteriaWidget.jaxx (rev 0) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/CriteriaWidget.jaxx 2010-05-19 10:52:43 UTC (rev 2901) @@ -0,0 +1,41 @@ +<!-- ##% 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. + ##% --> + +<Table insets='5,5,5,5'> + <script> + protected void removeCriteriaWidget(){} + </script> + <row> + <cell> + <JAXXComboBox id="criteriaComboBox" width="200"> + <item value='date' label='{_("lima.date")}' selected="true"/> + <item value='voucher' label='{_("lima.voucher")}'/> + <item value='account' label='{_("lima.account")}'/> + <item value='description' label='{_("lima.description")}'/> + <item value='debit' label='{_("lima.debit")}'/> + <item value='credit' label='{_("lima.credit")}'/> + <item value='amount' label='{_("lima.amount")}'/> + </JAXXComboBox> + </cell> + <cell weightx="0"> + <JPanel id="criteriaPanel"/> + </cell> + <cell> + <JButton id="removeButton" text="lima.remove" onActionPerformed="removeCriteriaWidget()"/> + </cell> + </row> +</Table> \ No newline at end of file Copied: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionHelper.java (from rev 2889, trunk/lima-swing/src/main/java/org/chorem/lima/ui/transaction/FinancialTransactionHelper.java) =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionHelper.java (rev 0) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionHelper.java 2010-05-19 10:52:43 UTC (rev 2901) @@ -0,0 +1,84 @@ +/* *##% Lima Main + * Copyright (C) 2008 - 2010 CodeLutin + * + * 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>. ##%* + */ + +package org.chorem.lima.ui.financialtransaction; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.chorem.lima.entity.Entry; +import org.chorem.lima.entity.FinancialTransaction; +import org.chorem.lima.ui.accountsreports.AccountsReportsTableModel; + +/** + * TODO add comment here. + * + * @author chatellier + * @version $Revision$ + * + * Last update : $Date$ + * By : $Author$ + */ +public class FinancialTransactionHelper { + /** log. */ + private static final Log log = LogFactory.getLog(AccountsReportsTableModel.class); + + /** + * Get total credit for a transaction. + * + * @param transaction transaction to get credit + * @return total credit + */ + public static double getCredit(FinancialTransaction financialtransaction) { + double credit = 0; + for (Entry entry : financialtransaction.getEntry()) { + // TODO EC-20100407 voir si le modele correspond (amount, credit,debit) + if (!entry.getDebit()) { + credit += entry.getAmount(); + } + } + return credit; + } + + /** + * Get total debit for a transaction. + * + * @param transaction transaction to get debit + * @return total debit + */ + public static double getDebit(FinancialTransaction financialtransaction) { + double debit = 0; + for (Entry entry : financialtransaction.getEntry()) { + // TODO EC-20100407 voir si le modele correspond (amount, credit,debit) + if (entry.getDebit()) { + debit += entry.getAmount(); + } + } + return debit; + } + + /** + * Return true if transaction is balanced (credit == debit). + * + * @param transaction transaction to test + * @return {@code true} if transaction is balanced + */ + public static boolean isBalanced(FinancialTransaction financialtransaction) { + boolean balanced = getDebit(financialtransaction) == getCredit(financialtransaction); + return balanced; + } +} Copied: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionView.jaxx (from rev 2890, trunk/lima-swing/src/main/java/org/chorem/lima/ui/transaction/FinancialTransactionView.jaxx) =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionView.jaxx (rev 0) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionView.jaxx 2010-05-19 10:52:43 UTC (rev 2901) @@ -0,0 +1,90 @@ +<!-- ##% 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. + ##% --> + +<Table> + <FinancialTransactionViewHandler id="handler" javaBean="new FinancialTransactionViewHandler(this)" /> + <Boolean id="selectedRow" javaBean="false" /> + <org.chorem.lima.ui.combobox.FinancialPeriodComboBoxModel id="modelFinancialPeriod"/> + <script> + <![CDATA[ + + import org.chorem.lima.entity.FiscalPeriod; + import org.chorem.lima.entity.FinancialPeriod; + + ]]> + </script> + + <!-- <JPopupMenu id="MenuRightPanel"> + <JMenuItem text="lima.add.transaction" onActionPerformed='addEmptyTransaction()'/> + <JMenuItem text="lima.print"/> + </JPopupMenu> + <JPopupMenu id="MenuRightTransaction"> + <JMenuItem text="lima.add" onActionPerformed='addEmptyTransaction()'/> + <JMenuItem text="lima.print"/> + </JPopupMenu> --> + + <row fill="horizontal" weightx="1" weighty="0" anchor="center"> + <cell> + <JLabel id="fiscalPeriodLabel" text="lima.fiscalyear.management"/> + </cell> + <cell> + <JComboBox id="fiscalPeriodComboBox" + model="{new org.chorem.lima.ui.combobox.FiscalPeriodComboBoxModel()}" + renderer="{new org.chorem.lima.ui.combobox.FiscalPeriodComboBoxRenderer()}" + onItemStateChanged="getModelFinancialPeriod().setFiscalPeriod( (FiscalPeriod) event.getItem())" + editable="false"/> + </cell> + <cell> + <JLabel id="financialPeriodLabel" text="lima.transaction.period" + /> + </cell> + <cell> + <JComboBox id="financialPeriodComboBox" + model="{getModelFinancialPeriod()}" + renderer="{new org.chorem.lima.ui.combobox.FinancialPeriodComboBoxRenderer()}" + onItemStateChanged="getFinancialTransactionTableModel().setFinancialPeriod((FinancialPeriod) event.getItem())" + editable="false" + /> + </cell> + <cell> + <JButton text="lima.add.transaction" + onActionPerformed="getHandler().addFinancialTransaction()"/> + </cell> + <cell> + <JButton text="lima.add.entry" onActionPerformed="getHandler().addEmptyEntry()"/> + </cell> + <cell> + <JButton text="lima.common.remove" + onActionPerformed="getHandler().deleteSelectedRow()" + enabled="{isSelectedRow()}"/> + </cell> + </row> + <row> + <cell fill="both" weightx="1" weighty="1" rows="3" columns="7"> + <JScrollPane> + <org.chorem.lima.ui.financialtransaction.table.FinancialTransactionTableModel + id="financialTransactionTableModel" /> + <org.chorem.lima.ui.financialtransaction.table.FinancialTransactionTable + id="financialTransactionTable" sortable="false" rowHeight="22" + constructorParams="getHandler()" model="{getFinancialTransactionTableModel()}" + selectionMode="{ListSelectionModel.SINGLE_SELECTION}" /> + <javax.swing.ListSelectionModel javaBean="getFinancialTransactionTable().getSelectionModel()" + onValueChanged="setSelectedRow(financialTransactionTable.getSelectedRow() != -1)"/> + </JScrollPane> + </cell> + </row> +</Table> \ No newline at end of file Copied: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionViewHandler.java (from rev 2898, trunk/lima-swing/src/main/java/org/chorem/lima/ui/transaction/FinancialTransactionViewHandler.java) =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionViewHandler.java (rev 0) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionViewHandler.java 2010-05-19 10:52:43 UTC (rev 2901) @@ -0,0 +1,149 @@ +/* *##% 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.ui.financialtransaction; + +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.business.LimaException; +import org.chorem.lima.entity.FinancialTransaction; +import org.chorem.lima.ui.financialtransaction.FinancialTransactionView; +import org.chorem.lima.ui.financialtransaction.table.FinancialTransactionTable; +import org.chorem.lima.ui.financialtransaction.table.FinancialTransactionTableModel; + +/** + * Handler associated with financial transaction view. + * + * @author chatellier + * @version $Revision$ + * + * Last update : $Date$ + * By : $Author$ + */ +public class FinancialTransactionViewHandler { + + /** log. */ + private static final Log log = + LogFactory.getLog(FinancialTransactionViewHandler.class); + + protected FinancialTransactionView view; + + protected FinancialTransactionViewHandler(FinancialTransactionView view) { + this.view = view; + } + + //add a new transaction + public void addFinancialTransaction() { + FinancialTransactionTable table = + (FinancialTransactionTable)view.getFinancialTransactionTable(); + FinancialTransactionTableModel model = + (FinancialTransactionTableModel)table.getModel(); + + try { + model.addFinancialTransaction(); + } catch (LimaException ex) { + if (log.isErrorEnabled()) { + log.error("Can't add financialtransaction", ex); + } + JOptionPane.showMessageDialog(view, + _("lima.warning.entrybookscloded")); + } + } + + //implement new transaction button + //add a new entry to the selected transaction + public void addEmptyEntry(){ + + FinancialTransactionTable table = + (FinancialTransactionTable)view.getFinancialTransactionTable(); + FinancialTransactionTableModel model = + (FinancialTransactionTableModel)table.getModel(); + + int indexSelectedRow = table.getSelectedRow(); + if (indexSelectedRow != -1) { + Object selectedValue = model.getElementAt(indexSelectedRow); + try { + model.addEmptyEntry(selectedValue, indexSelectedRow); + } catch (LimaException ex){ + if (log.isErrorEnabled()) { + log.error("Can't add emptyentry", ex); + } + JOptionPane.showMessageDialog(view, + _("lima.warning.entrybookscloded")); + } + } + else { + if (log.isWarnEnabled()) { + log.warn("Call addentry selected transaction without selection"); + } + } + } + + /** + * Delete selected row in table (could be transaction or entry). + * + * Called by model. + * @throws LimaException + */ + public void deleteSelectedRow(){ + + FinancialTransactionTable table = + (FinancialTransactionTable)view.getFinancialTransactionTable(); + FinancialTransactionTableModel model = + (FinancialTransactionTableModel)table.getModel(); + + int indexSelectedRow = table.getSelectedRow(); + if (indexSelectedRow != -1) { + + Object selectedValue = model.getElementAt(indexSelectedRow); + String message = null; + if (selectedValue instanceof FinancialTransaction) { + message = _("lima.question.remove.transaction"); + } + else { + message = _("lima.question.remove.entry"); + } + + int response = JOptionPane.showConfirmDialog(view, message, + _("lima.transaction.confirmdelete"), JOptionPane.YES_NO_OPTION); + + if (response == JOptionPane.YES_OPTION) { + + try { + model.removeObject(selectedValue, indexSelectedRow); + } catch (LimaException ex) { + if (log.isErrorEnabled()) { + log.error("Can't remove transaction or entry", ex); + } + JOptionPane.showMessageDialog(view, + _("lima.warning.entrybookscloded")); + } + } + } + else { + if (log.isWarnEnabled()) { + log.warn("Call delete selected row without selection"); + } + } + } +} Copied: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/LetteringView.jaxx (from rev 2890, trunk/lima-swing/src/main/java/org/chorem/lima/ui/transaction/LetteringView.jaxx) =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/LetteringView.jaxx (rev 0) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/LetteringView.jaxx 2010-05-19 10:52:43 UTC (rev 2901) @@ -0,0 +1,122 @@ +<!-- ##% 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. + ##% --> + +<Table fill="both"> + <script> + <![CDATA[ + import org.chorem.lima.entity.Account; + import org.jdesktop.swingx.autocomplete.AutoCompleteDecorator; + import org.jdesktop.swingx.autocomplete.ObjectToStringConverter; + + // Swingx auto complete (for account) : + AutoCompleteDecorator.decorate(accountComboBox, new ObjectToStringConverter() { + @Override + public String getPreferredStringForItem(Object item) { + if (item == null) { + return ""; + } + Account account = (Account) item; + return account.getAccountNumber() + " : " + account.getLabel(); + } + }); + + protected void addLettering() { + // never been implemented :( + }; + protected void removeLettering() { + // never been implemented :( + }; + ]]> + </script> + <row> + <cell> + <Table> + <!-- account --> + <row fill="horizontal" weightx="1" anchor="center"> + <cell anchor="east"> + <JLabel text="lima.account"/> + </cell> + <cell> + <org.chorem.lima.widgets.JWideComboBox id="accountComboBox" + model="{new org.chorem.lima.ui.combobox.AccountComboBoxModel()}" /> + </cell> + </row> + <!-- from --> + <row fill="horizontal" weightx="1" anchor="center"> + <cell anchor="east"> + <JLabel text="lima.lettering.from"/> + </cell> + <cell> + <org.chorem.lima.widgets.JWideComboBox id="fromPeriodComoboBox" /> + </cell> + </row> + <!-- to --> + <row fill="horizontal" weightx="1" anchor="center"> + <cell anchor="east"> + <JLabel text="lima.lettering.to"/> + </cell> + <cell> + <org.chorem.lima.widgets.JWideComboBox id="toPeriodComoboBox" /> + </cell> + </row> + </Table> + </cell> + <cell> + <!-- entries --> + <Table fill="both"> + <row columns="3"> + <cell> + <JLabel text="lima.lettering.entries"/> + </cell> + </row> + <row> + <cell> + <JRadioButton buttonGroup='entryButtons' text='lima.lettering.lettered' + value='{_("lima.lettering.lettered")}' selected='true'/> + </cell> + <cell> + <JRadioButton buttonGroup='entryButtons' text='lima.lettering.notlettered' + value='{_("lima.lettering.notlettered")}'/> + </cell> + <cell> + <JRadioButton buttonGroup='entryButtons' text='lima.lettering.letteredall' + value='{_("lima.lettering.letteredall")}'/> + </cell> + </row> + </Table> + </cell> + </row> + <row columns="2" weightx="1" weighty="1" anchor="center" fill="both"> + <cell> + <JScrollPane> + <org.jdesktop.swingx.JXTable id="letteringTable" /> + </JScrollPane> + </cell> + </row> + <row> + <cell> + <!-- add lettering --> + <JButton id="addButton" text="lima.lettering.add" + onActionPerformed="addLettering()"/> + </cell> + <cell> + <!-- remove lettering --> + <JButton id="removeButton" text="lima.lettering.remove" + onActionPerformed="removeLettering()"/> + </cell> + </row> +</Table> \ No newline at end of file Copied: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/SearchFinancialTransactionViewHandler.java (from rev 2883, trunk/lima-swing/src/main/java/org/chorem/lima/ui/transaction/SearchFinancialTransactionViewHandler.java) =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/SearchFinancialTransactionViewHandler.java (rev 0) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/SearchFinancialTransactionViewHandler.java 2010-05-19 10:52:43 UTC (rev 2901) @@ -0,0 +1,14 @@ +package org.chorem.lima.ui.financialtransaction; + +public class SearchFinancialTransactionViewHandler { + + + protected void addCriteriaWidget() { + + } + + protected void doSearch() { + + } + +} Copied: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/SearchTransactionView.jaxx (from rev 2883, trunk/lima-swing/src/main/java/org/chorem/lima/ui/transaction/SearchTransactionView.jaxx) =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/SearchTransactionView.jaxx (rev 0) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/SearchTransactionView.jaxx 2010-05-19 10:52:43 UTC (rev 2901) @@ -0,0 +1,60 @@ +<!-- ##% 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. + ##% --> + +<JFrame title="lima.search" width="620" height="300" locationRelativeTo="{null}" + onWindowClosing="windowClosing()" + defaultCloseOperation="do_nothing_on_close" + iconImage='{Toolkit.getDefaultToolkit().getImage(getClass().getResource("/icons/lima.png"))}'> + <script> + protected void addCriteriaWidget() {}; + protected void doSearch() {}; + protected void windowClosing() {}; + </script> + <JScrollPane> + <Table fill="horizontal" insets='5,5,5,5' anchor="north" weighty="1" weightx="1"> + <row> + <cell> + <JButton id="addButton" text="lima.common.add" width="100" onActionPerformed="addCriteriaWidget()"/> + </cell> + <cell> + <JLabel text="lima.search.items.where" width="200"/> + </cell> + <cell> + <JAXXComboBox id="criteriaAllAnyComboBox" width="200"> + <item value='all' label='{_("lima.all.criteria")}' selected="true"/> + <item value='any' label='{_("lima.any.criteria")}'/> + </JAXXComboBox> + </cell> + </row> + <row> + <cell columns="3"> + <VBox id="criteriaWidgetPanel" + border='{BorderFactory.createTitledBorder(_("lima.search.title.criteria.box"))}' + /> + </cell> + </row> + <row> + <cell> + <JButton id="okButton" onActionPerformed="doSearch()" text="lima.common.ok"/> + </cell> + <cell> + <JButton id="cancelButton" text="lima.common.cancel" onActionPerformed="windowClosing()"/> + </cell> + </row> + </Table> + </JScrollPane> +</JFrame> \ No newline at end of file Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/table/AccountTableCellEditor.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/table/AccountTableCellEditor.java (rev 0) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/table/AccountTableCellEditor.java 2010-05-19 10:52:43 UTC (rev 2901) @@ -0,0 +1,81 @@ +/** + * *##% Lima Main + * Copyright (C) 2008 CodeLutin + * + * 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>. ##%* + */ + +package org.chorem.lima.ui.financialtransaction.table; + +import java.awt.Component; +import java.awt.event.MouseEvent; +import java.util.EventObject; + +import javax.swing.AbstractCellEditor; +import javax.swing.JTable; +import javax.swing.table.TableCellEditor; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.chorem.lima.entity.Account; +import org.chorem.lima.ui.combobox.AccountComboBoxModel; +import org.chorem.lima.ui.combobox.AccountRenderer; +import org.chorem.lima.widgets.JWideComboBox; + +public class AccountTableCellEditor extends AbstractCellEditor implements TableCellEditor { + + protected static final Log log = LogFactory.getLog(EntryBookTableCellEditor.class); + private final JWideComboBox comboBox; + private static final long serialVersionUID = 2580476608066111095L; + private static AccountTableCellEditor editor; + + /** + * constructor + */ + public AccountTableCellEditor() { + comboBox = new JWideComboBox(); + AccountComboBoxModel accountComboBoxModel = new AccountComboBoxModel(); + comboBox.setModel(accountComboBoxModel); + AccountRenderer accountRenderer = new AccountRenderer(); + comboBox.setRenderer(accountRenderer); + } + + @Override + public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { + if (value instanceof Account){ + comboBox.setSelectedItem((Account) value); + + } + return comboBox; + } + + @Override + public Object getCellEditorValue() { + return comboBox.getSelectedItem(); + } + + @Override + public boolean isCellEditable(EventObject evt) { + return !(evt instanceof MouseEvent) || ((MouseEvent) evt).getClickCount() == 2; + } + + public static AccountTableCellEditor getInstance() { + if (editor == null) { + editor = new AccountTableCellEditor(); + } + return editor; + } + +} Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/table/DateTableCellEditor.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/table/DateTableCellEditor.java (rev 0) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/table/DateTableCellEditor.java 2010-05-19 10:52:43 UTC (rev 2901) @@ -0,0 +1,72 @@ +/** + * *##% Lima Main + * Copyright (C) 2008 CodeLutin + * + * 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>. ##%* + */ + +package org.chorem.lima.ui.financialtransaction.table; + +import org.chorem.lima.LimaContext; +import org.jdesktop.swingx.JXDatePicker; + +import javax.swing.*; +import javax.swing.table.TableCellEditor; +import java.awt.*; +import java.awt.event.MouseEvent; +import java.util.Date; +import java.util.EventObject; + +/** + * @author ore + */ +public class DateTableCellEditor extends AbstractCellEditor implements TableCellEditor { + + private final JXDatePicker datePicker; + private static final long serialVersionUID = -8455896587828255307L; + private static DateTableCellEditor editor; + + /** + * constructor + */ + public DateTableCellEditor() { + datePicker = new JXDatePicker(LimaContext.getContext().getConfig().getLocale()); + } + + @Override + public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { + if (value instanceof Date) { + datePicker.setDate((Date) value); + } + return datePicker; + } + + @Override + public Object getCellEditorValue() { + return datePicker.getDate(); + } + + @Override + public boolean isCellEditable(EventObject evt) { + return !(evt instanceof MouseEvent) || ((MouseEvent) evt).getClickCount() == 2; + } + + public static DateTableCellEditor getInstance() { + if (editor == null) { + editor = new DateTableCellEditor(); + } + return editor; + } +} Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/table/EntryBookTableCellEditor.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/table/EntryBookTableCellEditor.java (rev 0) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/table/EntryBookTableCellEditor.java 2010-05-19 10:52:43 UTC (rev 2901) @@ -0,0 +1,86 @@ +/** + * *##% Lima Main + * Copyright (C) 2008 CodeLutin + * + * 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>. ##%* + */ + +package org.chorem.lima.ui.financialtransaction.table; + +import java.awt.Component; +import java.awt.event.MouseEvent; +import java.util.EventObject; + +import javax.swing.AbstractCellEditor; +import javax.swing.JTable; +import javax.swing.table.TableCellEditor; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.chorem.lima.entity.EntryBook; +import org.chorem.lima.ui.combobox.EntryBookComboBoxModel; +import org.chorem.lima.ui.combobox.EntryBookRenderer; +import org.chorem.lima.widgets.JWideComboBox; + +public class EntryBookTableCellEditor extends AbstractCellEditor implements TableCellEditor { + + protected static final Log log = LogFactory.getLog(EntryBookTableCellEditor.class); + private final JWideComboBox comboBox; + private static final long serialVersionUID = 2580476608066111095L; + private static EntryBookTableCellEditor editor; + + /** + * constructor + */ + public EntryBookTableCellEditor() { + comboBox = new JWideComboBox(); + EntryBookComboBoxModel entryBookComboBoxModel = new EntryBookComboBoxModel(); + comboBox.setModel(entryBookComboBoxModel); + EntryBookRenderer entryBookRenderer = new EntryBookRenderer(); + comboBox.setRenderer(entryBookRenderer); + + /*// Property Change Listener + LimaContext.getContext().getDataManager().getJournalModel().addPropertyChangeListener(comboBoxModel); + comboBox.setModel(comboBoxModel); + // AutoCompletion + AutoCompleteDecorator.decorate(comboBox, JournalToStringConverter.getInstance());*/ + } + + @Override + public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { + if (value instanceof EntryBook){ + comboBox.setSelectedItem((EntryBook) value); + + } + return comboBox; + } + + @Override + public Object getCellEditorValue() { + return comboBox.getSelectedItem(); + } + + @Override + public boolean isCellEditable(EventObject evt) { + return !(evt instanceof MouseEvent) || ((MouseEvent) evt).getClickCount() == 2; + } + + public static EntryBookTableCellEditor getInstance() { + if (editor == null) { + editor = new EntryBookTableCellEditor(); + } + return editor; + } +} Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/table/FinancialTransactionTable.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/table/FinancialTransactionTable.java (rev 0) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/table/FinancialTransactionTable.java 2010-05-19 10:52:43 UTC (rev 2901) @@ -0,0 +1,200 @@ +/* *##% 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.ui.financialtransaction.table; + +import java.awt.Color; +import java.awt.Component; +import java.awt.event.KeyEvent; +import java.awt.event.KeyListener; +import java.util.Date; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.chorem.lima.entity.Account; +import org.chorem.lima.entity.EntryBook; +import org.chorem.lima.entity.FinancialTransaction; +import org.chorem.lima.ui.financialtransaction.FinancialTransactionHelper; +import org.chorem.lima.ui.financialtransaction.FinancialTransactionViewHandler; +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; + + +/** + * Table des transaction qui ajoute des comportement (keys). + * + * @author ore + * @author Rémi Chapelet + */ +public class FinancialTransactionTable extends JXTable implements KeyListener { + + /** serialVersionUID. */ + private static final long serialVersionUID = 3133690382049594727L; + + /** log. */ + private static final Log log = LogFactory.getLog(FinancialTransactionTable.class); + + protected FinancialTransactionViewHandler handler; + + private Highlighter colorTransaction; + + private ColorHighlighter colorBalance; + + /** + */ + public FinancialTransactionTable(FinancialTransactionViewHandler handler) { + + this.handler = handler; + + addKeyListener(this); + + //Get new date editor + setDefaultEditor(Date.class, new DateTableCellEditor()); + //Get new entry book editor + setDefaultEditor(EntryBook.class, new EntryBookTableCellEditor()); + //Get new account editor + setDefaultEditor(Account.class, new AccountTableCellEditor()); + + //highlight financial financial transactions + addColorTransaction(); + // highlight unbalanced financial transactions + addColorNonBalancedTransaction(); + } + + /** + * Cette méthode permet de colorer toutes les transactions dans le tableau + * afin de bien distinguer les transactions et entrées comptables. + * On récupère la première cellule, on vérifie que c'est une date + */ + protected void addColorTransaction() { + if (colorTransaction != null) { + removeHighlighter(colorTransaction); + } + HighlightPredicate predicate = new HighlightPredicate() { + @Override + public boolean isHighlighted(Component renderer, + ComponentAdapter adapter) { + return adapter.getValueAt(adapter.row, 0) instanceof Date; + } + }; + colorTransaction = + new ColorHighlighter(predicate, new Color(222,222,222), null); + addHighlighter(colorTransaction); + } + + + + /** + * Permet de surligner une transaction dans le tableau lorsque + * cette dernière n'est pas équilibrée. + * On récupère la dernière cellule de la ligne + * et on vérifie si la valeur est différente de 0 + */ + protected void addColorNonBalancedTransaction() { + if (colorBalance != null) { + removeHighlighter(colorBalance); + } + HighlightPredicate predicate = new HighlightPredicate() { + @Override + public boolean isHighlighted(Component renderer, + ComponentAdapter adapter) { + boolean isHighlighted = false; + Object value = adapter.getValueAt(adapter.row, 8); + if (value instanceof Double) { + Double currentBalance = (Double) value; + if (currentBalance != 0) { + isHighlighted = true; + } + } + return isHighlighted; + } + }; + colorTransaction = + new ColorHighlighter(predicate, new Color(255, 198, 209), null); + addHighlighter(colorTransaction); + } + + /** + * for each action combination key are think + * for extend keyboard and laptop keyboard + */ + @Override + public void keyPressed(KeyEvent e) { + + // delete selected row with the key : delete or ctrl clear + // ou de l'entree + if ((e.getKeyCode() == KeyEvent.VK_DELETE ) + || (e.getKeyCode() == KeyEvent.VK_CLEAR + && e.getModifiers() == KeyEvent.CTRL_MASK)){ + handler.deleteSelectedRow(); + } + + // add entry with the key combination : insert or ctrl + enter + if ((e.getKeyCode() == KeyEvent.VK_INSERT ) + || (e.getKeyCode() == KeyEvent.VK_ENTER + && e.getModifiers() == KeyEvent.CTRL_MASK)) { + handler.addEmptyEntry(); + } + + // add financial transaction with the key combination : ctrl + tab + if (e.getKeyCode() == KeyEvent.VK_TAB + && e.getModifiers() == KeyEvent.CTRL_MASK) { + handler.addFinancialTransaction(); + } + + /** + * Touche tab + * Ajoute une entrée comptable si tab est sur + * la dernière cellule. + */ + if (e.getKeyChar() == KeyEvent.VK_TAB) { + // Vérifie si la cellule sélectionnée est la dernière + + int x = this.getSelectedColumn(); + int y = this.getSelectedRow(); + int max_x = this.getColumnCount() - 1; + int max_y = this.getRowCount() - 1; + if (x == max_x && y == max_y) { + handler.addEmptyEntry(); + // positionne la sélection sur la nouvelle ligne créée + this.setColumnSelectionInterval(0, 0); + this.setRowSelectionInterval(max_y + 1, max_y + 1); + } + } + + } + + /* + * @see java.awt.event.KeyListener#keyTyped(java.awt.event.KeyEvent) + */ + @Override + public void keyTyped(KeyEvent e) { + + } + + /* + * @see java.awt.event.KeyListener#keyReleased(java.awt.event.KeyEvent) + */ + @Override + public void keyReleased(KeyEvent e) { + + } +} Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/table/FinancialTransactionTableModel.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/table/FinancialTransactionTableModel.java (rev 0) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/table/FinancialTransactionTableModel.java 2010-05-19 10:52:43 UTC (rev 2901) @@ -0,0 +1,559 @@ +/* *##% 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.ui.financialtransaction.table; + +import static org.nuiton.i18n.I18n._; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +import javax.swing.table.AbstractTableModel; + +import org.apache.commons.lang.time.DateUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.chorem.lima.business.EntryBookService; +import org.chorem.lima.business.FinancialPeriodService; +import org.chorem.lima.business.LimaBusinessException; +import org.chorem.lima.business.LimaException; +import org.chorem.lima.business.FinancialTransactionService; +import org.chorem.lima.entity.Account; +import org.chorem.lima.entity.Entry; +import org.chorem.lima.entity.EntryBook; +import org.chorem.lima.entity.EntryImpl; +import org.chorem.lima.entity.FinancialPeriod; +import org.chorem.lima.entity.FinancialPeriodImpl; +import org.chorem.lima.entity.FinancialTransactionImpl; +import org.chorem.lima.entity.FinancialTransaction; +import org.chorem.lima.service.LimaServiceFactory; +import org.chorem.lima.ui.financialtransaction.FinancialTransactionHelper; +import org.chorem.lima.util.ErrorHelper; + +/** + * Basic transaction table model. + * + * Le modele est filtré sur {@link #selectedEntryBook} et + * {@link #selectedFinancialPeriod} (montée en charge !). + * + * @author ore + * @author chatellier + * @version $Revision: 2897 $ + * + * Last update : $Date: 2010-05-14 13:22:26 +0200 (ven. 14 mai 2010) $ + * By : $Author: jpepin $ + */ +public class FinancialTransactionTableModel extends AbstractTableModel { + + /** serialVersionUID. */ + private static final long serialVersionUID = 3914954536809622358L; + + /** log. */ + private static final Log log = LogFactory + .getLog(FinancialTransactionTableModel.class); + + /** Transaction service. */ + protected final FinancialTransactionService transactionService; + + /** EntryBook service. */ + protected final EntryBookService entryBookService; + + /** FinancialPeriod service. */ + protected final FinancialPeriodService financialPeriodService; + + /** selected financial period */ + protected FinancialPeriod selectedFinancialPeriod; + + /** data cache */ + protected List<Object> cacheDataList; + + /** collection + + + /** + * Model constructor. + * + * Just init service proxies. + */ + public FinancialTransactionTableModel() { + /* Services */ + // recordService = LimaServiceFactory.getInstance().getRecordService(); + transactionService = LimaServiceFactory.getInstance() + .getTransactionService(); + entryBookService = LimaServiceFactory.getInstance(). + getEntryBookService(); + financialPeriodService = LimaServiceFactory.getInstance(). + getFinancialPeriodService(); + } + + /** + * Le model est une combinaison de Transaction/Entries. + * + * + * @return + */ + protected List<Object> getDataList() { + + List<Object> results = new ArrayList<Object>(); + try { + List<FinancialTransaction> financialtransactions = + transactionService.getAllFinancialTransactionsForFinancialPeriod( + selectedFinancialPeriod); + for (FinancialTransaction financialtransaction : financialtransactions) { + results.add(financialtransaction); + results.addAll(financialtransaction.getEntry()); + } + } + catch (LimaException eee) { + if (log.isErrorEnabled()) { + log.debug("Can't update model", eee); + } + + ErrorHelper.showErrorDialog("Can't get transaction list", eee); + } + + return results; + } + + @Override + public int getColumnCount() { + return 9; + } + + @Override + public Class<?> getColumnClass(int column) { + + Class<?> result = null; + + switch (column) { + case 0: + result = Date.class; + break; + case 1: + result = EntryBook.class; + break; + case 2: + result = String.class; + break; + case 3: + result = Account.class; + break; + case 4: + result = String.class; + break; + case 5: + result = String.class; + break; + case 6: + result = Double.class; + break; + case 7: + result = Double.class; + break; + case 8: + result = Double.class; + break; + } + + return result; + } + + @Override + public String getColumnName(int column) { + String result = "n/a"; + + switch (column) { + case 0: + result = _("lima.transaction.column.date"); + break; + case 1: + result = _("lima.transaction.column.entrybook"); + break; + case 2: + result = _("lima.transaction.column.voucher"); + break; + case 3: + result = _("lima.transaction.column.account"); + break; + case 4: + result = _("lima.transaction.column.description"); + break; + case 5: + result = _("lima.transaction.column.position"); + break; + case 6: + result = _("lima.transaction.column.debit"); + break; + case 7: + result = _("lima.transaction.column.credit"); + break; + case 8: + result = _("lima.transaction.column.balance"); + break; + } + + return result; + } + + @Override + public int getRowCount() { + int result = 0; + + // just prevent too much result + if (selectedFinancialPeriod != null) { + //cacheDataList = getDataList(); + result = cacheDataList.size(); + } + else { + if (log.isDebugEnabled()) { + log.debug("No fiscalPeriod selected skip table model update"); + } + } + + return result; + } + + @Override + public Object getValueAt(int row, int column) { + Object result = null; + + // just prevent too much result + if (selectedFinancialPeriod != null) { + result = cacheDataList.get(row); + + if (result instanceof FinancialTransaction) { + FinancialTransaction currentRow = (FinancialTransaction)result; + + switch (column) { + case 0: + result = currentRow.getTransactionDate(); + break; + case 1: + result = null; // voucher + break; + case 2: + result = null; //entrybook + break; + case 3: + result = null; // account + break; + case 4: + result = null; // description + break; + case 5 : + result = null; // position + break; + case 6: + result = FinancialTransactionHelper.getDebit(currentRow); + break; + case 7: + result = FinancialTransactionHelper.getCredit(currentRow); + break; + case 8: + result = FinancialTransactionHelper.getDebit(currentRow) + - FinancialTransactionHelper.getCredit(currentRow); + break; + } + } + else if (result instanceof Entry) { + Entry currentEntry = (Entry)result; + switch (column) { + case 0: + result = null; // date + break; + case 1 : // entry book + if (currentEntry.getEntryBook() != null){ + result = currentEntry.getEntryBook().getCode(); + } + else { + result = null; + } + break; + case 2: + result = currentEntry.getVoucher(); + break; + case 3: // account + if (currentEntry.getAccount() != null){ + result = currentEntry.getAccount().getAccountNumber(); + } + else { + result = null; + } + break; + case 4: + result = currentEntry.getDescription(); + break; + case 5 : + result = currentEntry.getPosition(); + break; + case 6: + result = currentEntry.getDebit() ? currentEntry.getAmount() : 0; + break; + case 7: + result = currentEntry.getDebit() ? 0 : currentEntry.getAmount(); + break; + case 8: + result = null; // balance + break; + } + + } + } + else { + if (log.isDebugEnabled()) { + log.debug("No fiscalPeriod selected skip table model update"); + } + } + + return result; + } + + + public void setFinancialPeriod(FinancialPeriod financialPeriod){ + + selectedFinancialPeriod = financialPeriod; + cacheDataList = getDataList(); + fireTableDataChanged(); + } + + /** + * To set cells editable or not + * different condition for entry or financial transaction + */ + @Override + public boolean isCellEditable(int rowIndex, int columnIndex) { + boolean editableCell=false; + Object currentRow = cacheDataList.get(rowIndex); + // cells editable for the entry row, all cells exclude the date + if ((currentRow instanceof Entry) && !(columnIndex==0)) { + editableCell=true; + } + // cells editable for the financialtransaction row, no cells exclude the date + if ((currentRow instanceof FinancialTransaction) && (columnIndex==0)){ + editableCell=true; + } + return editableCell; + } + + /** + * @throws LimaException + */ + public void addFinancialTransaction() throws LimaException{ + /* Calling transaction service */ + FinancialTransaction financialTransaction = new FinancialTransactionImpl(); + //if a period and an entrybook is selected + if (selectedFinancialPeriod != null){ + financialTransaction.setFinancialPeriod(selectedFinancialPeriod); + // get today + Calendar actualCalendar = Calendar.getInstance(); + // get the financial period date + Date transactionDate = selectedFinancialPeriod.getBeginDate(); + // change the day + transactionDate = DateUtils.setDays(transactionDate, + actualCalendar.get(Calendar.DAY_OF_MONTH)); + // set date to the financial transaction + financialTransaction.setTransactionDate(transactionDate); + // create it + transactionService.createFinancialTransaction(financialTransaction); + //on recharge la liste + cacheDataList = getDataList(); + int row = getDataList().indexOf(financialTransaction); + fireTableRowsInserted(row, row); + //fireTableDataChanged(); + } + else { + throw new LimaBusinessException("No financial period selected"); + } + } + + + + /** + * @throws LimaException + */ + public void addEmptyEntry(Object value, int row) throws LimaException { + FinancialTransaction currentTransaction = null; + Object currentRow = cacheDataList.get(row); + Entry entry = new EntryImpl(); + //check if current row is a transaction or an entry + if (currentRow instanceof FinancialTransaction) { + currentTransaction = (FinancialTransaction)currentRow; + } + else if (currentRow instanceof Entry) { + Entry currentEntry = (Entry)currentRow; + //get back the parent transaction of the entry + currentTransaction = currentEntry.getFinancialTransaction(); + } + //create it + entry.setFinancialTransaction(currentTransaction); + transactionService.createEntry(entry); + //on recharge la liste + cacheDataList = getDataList(); + fireTableDataChanged(); + } + + /** + * to modifiy financialtransaction or entry + */ + @Override + public void setValueAt(Object value, int row, int column) { + + // just prevent too much result + if (selectedFinancialPeriod != null) { + Object currentRow = cacheDataList.get(row); + if (currentRow instanceof FinancialTransaction) { + FinancialTransaction currentFinancialTransaction = + (FinancialTransaction)currentRow; + switch (column) { + case 0: + // Truncate the date - format 01-MM-YYYY + Date dateCurrentFinancialTransaction = ((Date)value); + dateCurrentFinancialTransaction = + DateUtils.truncate( + dateCurrentFinancialTransaction, Calendar.MONTH); + + // Return the begin date of the current financial period + Date dateCurrentFinancialPeriod = + selectedFinancialPeriod.getBeginDate(); + + // Compare to the begindate of the current financial period + if (!dateCurrentFinancialPeriod.equals(dateCurrentFinancialTransaction)){ + //methode get financialperiod dans le service + FinancialPeriod newFinancialPeriod = + new FinancialPeriodImpl(); + try { + newFinancialPeriod = + financialPeriodService.getFinancialPeriodWithDate( + dateCurrentFinancialTransaction); + } catch (LimaException e) { + if (log.isDebugEnabled()){ + log.debug("Can't get new financialPeriodService"); + } + } + //if the changed financial period is unlocked + if (newFinancialPeriod != null){ + if (newFinancialPeriod.getLocked() == false){ + //update + currentFinancialTransaction. + setTransactionDate((Date)value); + currentFinancialTransaction. + setFinancialPeriod(newFinancialPeriod); + } + } + else { + if (log.isDebugEnabled()){ + log.debug("Can't update on the new date"); + } + } + } + + break; + } + // notify service for modification + try { + transactionService. + updateFinancialTransaction(currentFinancialTransaction); + } catch (LimaException e) { + if (log.isDebugEnabled()){ + log.debug("Can't update financial transaction", e); + } + } + } + else if (currentRow instanceof Entry) { + Entry currentEntry = (Entry)currentRow; + switch (column) { + case 1 : + currentEntry.setEntryBook((EntryBook)value); + break; + case 2 : + currentEntry.setVoucher((String)value); + break; + case 3: + currentEntry.setAccount((Account)value); + break; + case 4: + currentEntry.setDescription((String)value); + break; + case 5 : + currentEntry.setPosition((String)value); + break; + case 6: + currentEntry.setAmount((Double)value); + currentEntry.setDebit(true); + break; + case 7: + currentEntry.setAmount((Double)value); + currentEntry.setDebit(false); + break; + } + try { + transactionService.updateEntry(currentEntry); + } catch (LimaException e) { + if (log.isDebugEnabled()){ + log.debug("Can't update entry", e); + } + } + } + //update the financial transaction in entire + int financialTransactionRow = + getDataList().indexOf(((Entry) currentRow). + getFinancialTransaction()); + //on recharge la liste + cacheDataList = getDataList(); + fireTableRowsUpdated(financialTransactionRow, getRowCount()-1); + } + else { + if (log.isDebugEnabled()) { + log.debug("No fiscalPeriod selected skip table model update"); + } + } + } + + public Object getElementAt(int row){ + + Object currentRow = cacheDataList.get(row); + return currentRow; + } + + + /** + * Delete selected row in table (could be transaction or entry). + * + * Called by model. + * @param Object, int + * @throws LimaException + */ + public void removeObject(Object object, int row) throws LimaException { + Object currentRow = cacheDataList.get(row); + if (currentRow instanceof FinancialTransaction) { + FinancialTransaction currentTransaction = + (FinancialTransaction)currentRow; + transactionService.removeFinancialTransaction(currentTransaction); + } + else if (currentRow instanceof Entry) { + Entry currentEntry = (Entry)currentRow; + transactionService.removeEntry(currentEntry); + } + //on recharge la liste + cacheDataList = getDataList(); + fireTableRowsDeleted(row, getRowCount()); + } + +} Deleted: trunk/lima-swing/src/main/java/org/chorem/lima/ui/transaction/CriteriaWidget.jaxx =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/transaction/CriteriaWidget.jaxx 2010-05-17 09:08:42 UTC (rev 2900) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/transaction/CriteriaWidget.jaxx 2010-05-19 10:52:43 UTC (rev 2901) @@ -1,41 +0,0 @@ -<!-- ##% Lima Swing - Copyright (C) 2008 - 2010 CodeLutin - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - ##% --> - -<Table insets='5,5,5,5'> - <script> - protected void removeCriteriaWidget(){} - </script> - <row> - <cell> - <JAXXComboBox id="criteriaComboBox" width="200"> - <item value='date' label='{_("lima.date")}' selected="true"/> - <item value='voucher' label='{_("lima.voucher")}'/> - <item value='account' label='{_("lima.account")}'/> - <item value='description' label='{_("lima.description")}'/> - <item value='debit' label='{_("lima.debit")}'/> - <item value='credit' label='{_("lima.credit")}'/> - <item value='amount' label='{_("lima.amount")}'/> - </JAXXComboBox> - </cell> - <cell weightx="0"> - <JPanel id="criteriaPanel"/> - </cell> - <cell> - <JButton id="removeButton" text="lima.remove" onActionPerformed="removeCriteriaWidget()"/> - </cell> - </row> -</Table> \ No newline at end of file Deleted: trunk/lima-swing/src/main/java/org/chorem/lima/ui/transaction/FinancialTransactionHelper.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/transaction/FinancialTransactionHelper.java 2010-05-17 09:08:42 UTC (rev 2900) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/transaction/FinancialTransactionHelper.java 2010-05-19 10:52:43 UTC (rev 2901) @@ -1,84 +0,0 @@ -/* *##% Lima Main - * Copyright (C) 2008 - 2010 CodeLutin - * - * 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>. ##%* - */ - -package org.chorem.lima.ui.transaction; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.chorem.lima.entity.Entry; -import org.chorem.lima.entity.FinancialTransaction; -import org.chorem.lima.ui.accountsreports.AccountsReportsTableModel; - -/** - * TODO add comment here. - * - * @author chatellier - * @version $Revision$ - * - * Last update : $Date$ - * By : $Author$ - */ -public class FinancialTransactionHelper { - /** log. */ - private static final Log log = LogFactory.getLog(AccountsReportsTableModel.class); - - /** - * Get total credit for a transaction. - * - * @param transaction transaction to get credit - * @return total credit - */ - public static double getCredit(FinancialTransaction financialtransaction) { - double credit = 0; - for (Entry entry : financialtransaction.getEntry()) { - // TODO EC-20100407 voir si le modele correspond (amount, credit,debit) - if (!entry.getDebit()) { - credit += entry.getAmount(); - } - } - return credit; - } - - /** - * Get total debit for a transaction. - * - * @param transaction transaction to get debit - * @return total debit - */ - public static double getDebit(FinancialTransaction financialtransaction) { - double debit = 0; - for (Entry entry : financialtransaction.getEntry()) { - // TODO EC-20100407 voir si le modele correspond (amount, credit,debit) - if (entry.getDebit()) { - debit += entry.getAmount(); - } - } - return debit; - } - - /** - * Return true if transaction is balanced (credit == debit). - * - * @param transaction transaction to test - * @return {@code true} if transaction is balanced - */ - public static boolean isBalanced(FinancialTransaction financialtransaction) { - boolean balanced = getDebit(financialtransaction) == getCredit(financialtransaction); - return balanced; - } -} Deleted: trunk/lima-swing/src/main/java/org/chorem/lima/ui/transaction/FinancialTransactionView.jaxx =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/transaction/FinancialTransactionView.jaxx 2010-05-17 09:08:42 UTC (rev 2900) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/transaction/FinancialTransactionView.jaxx 2010-05-19 10:52:43 UTC (rev 2901) @@ -1,90 +0,0 @@ -<!-- ##% Lima Swing - Copyright (C) 2008 - 2010 CodeLutin - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - ##% --> - -<Table> - <FinancialTransactionViewHandler id="handler" javaBean="new FinancialTransactionViewHandler(this)" /> - <Boolean id="selectedRow" javaBean="false" /> - <org.chorem.lima.ui.combobox.FinancialPeriodComboBoxModel id="modelFinancialPeriod"/> - <script> - <![CDATA[ - - import org.chorem.lima.entity.FiscalPeriod; - import org.chorem.lima.entity.FinancialPeriod; - - ]]> - </script> - - <!-- <JPopupMenu id="MenuRightPanel"> - <JMenuItem text="lima.add.transaction" onActionPerformed='addEmptyTransaction()'/> - <JMenuItem text="lima.print"/> - </JPopupMenu> - <JPopupMenu id="MenuRightTransaction"> - <JMenuItem text="lima.add" onActionPerformed='addEmptyTransaction()'/> - <JMenuItem text="lima.print"/> - </JPopupMenu> --> - - <row fill="horizontal" weightx="1" weighty="0" anchor="center"> - <cell> - <JLabel id="fiscalPeriodLabel" text="lima.fiscalyear.management"/> - </cell> - <cell> - <JComboBox id="fiscalPeriodComboBox" - model="{new org.chorem.lima.ui.combobox.FiscalPeriodComboBoxModel()}" - renderer="{new org.chorem.lima.ui.combobox.FiscalPeriodComboBoxRenderer()}" - onItemStateChanged="getModelFinancialPeriod().setFiscalPeriod( (FiscalPeriod) event.getItem())" - editable="false"/> - </cell> - <cell> - <JLabel id="financialPeriodLabel" text="lima.transaction.period" - /> - </cell> - <cell> - <JComboBox id="financialPeriodComboBox" - model="{getModelFinancialPeriod()}" - renderer="{new org.chorem.lima.ui.combobox.FinancialPeriodComboBoxRenderer()}" - onItemStateChanged="getFinancialTransactionTableModel().setFinancialPeriod((FinancialPeriod) event.getItem())" - editable="false" - /> - </cell> - <cell> - <JButton text="lima.add.transaction" - onActionPerformed="getHandler().addFinancialTransaction()"/> - </cell> - <cell> - <JButton text="lima.add.entry" onActionPerformed="getHandler().addEmptyEntry()"/> - </cell> - <cell> - <JButton text="lima.common.remove" - onActionPerformed="getHandler().deleteSelectedRow()" - enabled="{isSelectedRow()}"/> - </cell> - </row> - <row> - <cell fill="both" weightx="1" weighty="1" rows="3" columns="7"> - <JScrollPane> - <org.chorem.lima.ui.transaction.table.FinancialTransactionTableModel - id="financialTransactionTableModel" /> - <org.chorem.lima.ui.transaction.table.FinancialTransactionTable - id="financialTransactionTable" sortable="false" rowHeight="22" - constructorParams="getHandler()" model="{getFinancialTransactionTableModel()}" - selectionMode="{ListSelectionModel.SINGLE_SELECTION}" /> - <javax.swing.ListSelectionModel javaBean="getFinancialTransactionTable().getSelectionModel()" - onValueChanged="setSelectedRow(financialTransactionTable.getSelectedRow() != -1)"/> - </JScrollPane> - </cell> - </row> -</Table> \ No newline at end of file Deleted: trunk/lima-swing/src/main/java/org/chorem/lima/ui/transaction/FinancialTransactionViewHandler.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/transaction/FinancialTransactionViewHandler.java 2010-05-17 09:08:42 UTC (rev 2900) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/transaction/FinancialTransactionViewHandler.java 2010-05-19 10:52:43 UTC (rev 2901) @@ -1,149 +0,0 @@ -/* *##% Lima Swing - * Copyright (C) 2008 - 2010 CodeLutin - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * ##%*/ - -package org.chorem.lima.ui.transaction; - -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.business.LimaException; -import org.chorem.lima.entity.FinancialTransaction; -import org.chorem.lima.ui.transaction.table.FinancialTransactionTable; -import org.chorem.lima.ui.transaction.table.FinancialTransactionTableModel; -import org.chorem.lima.util.ErrorHelper; - -/** - * Handler associated with financial transaction view. - * - * @author chatellier - * @version $Revision$ - * - * Last update : $Date$ - * By : $Author$ - */ -public class FinancialTransactionViewHandler { - - /** log. */ - private static final Log log = - LogFactory.getLog(FinancialTransactionViewHandler.class); - - protected FinancialTransactionView view; - - protected FinancialTransactionViewHandler(FinancialTransactionView view) { - this.view = view; - } - - //add a new transaction - public void addFinancialTransaction() { - FinancialTransactionTable table = - (FinancialTransactionTable)view.getFinancialTransactionTable(); - FinancialTransactionTableModel model = - (FinancialTransactionTableModel)table.getModel(); - - try { - model.addFinancialTransaction(); - } catch (LimaException ex) { - if (log.isErrorEnabled()) { - log.error("Can't add financialtransaction", ex); - } - JOptionPane.showMessageDialog(view, - _("lima.warning.entrybookscloded")); - } - } - - //implement new transaction button - //add a new entry to the selected transaction - public void addEmptyEntry(){ - - FinancialTransactionTable table = - (FinancialTransactionTable)view.getFinancialTransactionTable(); - FinancialTransactionTableModel model = - (FinancialTransactionTableModel)table.getModel(); - - int indexSelectedRow = table.getSelectedRow(); - if (indexSelectedRow != -1) { - Object selectedValue = model.getElementAt(indexSelectedRow); - try { - model.addEmptyEntry(selectedValue, indexSelectedRow); - } catch (LimaException ex){ - if (log.isErrorEnabled()) { - log.error("Can't add emptyentry", ex); - } - JOptionPane.showMessageDialog(view, - _("lima.warning.entrybookscloded")); - } - } - else { - if (log.isWarnEnabled()) { - log.warn("Call addentry selected transaction without selection"); - } - } - } - - /** - * Delete selected row in table (could be transaction or entry). - * - * Called by model. - * @throws LimaException - */ - public void deleteSelectedRow(){ - - FinancialTransactionTable table = - (FinancialTransactionTable)view.getFinancialTransactionTable(); - FinancialTransactionTableModel model = - (FinancialTransactionTableModel)table.getModel(); - - int indexSelectedRow = table.getSelectedRow(); - if (indexSelectedRow != -1) { - - Object selectedValue = model.getElementAt(indexSelectedRow); - String message = null; - if (selectedValue instanceof FinancialTransaction) { - message = _("lima.question.remove.transaction"); - } - else { - message = _("lima.question.remove.entry"); - } - - int response = JOptionPane.showConfirmDialog(view, message, - _("lima.transaction.confirmdelete"), JOptionPane.YES_NO_OPTION); - - if (response == JOptionPane.YES_OPTION) { - - try { - model.removeObject(selectedValue, indexSelectedRow); - } catch (LimaException ex) { - if (log.isErrorEnabled()) { - log.error("Can't remove transaction or entry", ex); - } - JOptionPane.showMessageDialog(view, - _("lima.warning.entrybookscloded")); - } - } - } - else { - if (log.isWarnEnabled()) { - log.warn("Call delete selected row without selection"); - } - } - } -} Deleted: trunk/lima-swing/src/main/java/org/chorem/lima/ui/transaction/LetteringView.jaxx =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/transaction/LetteringView.jaxx 2010-05-17 09:08:42 UTC (rev 2900) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/transaction/LetteringView.jaxx 2010-05-19 10:52:43 UTC (rev 2901) @@ -1,122 +0,0 @@ -<!-- ##% Lima Swing - Copyright (C) 2008 - 2010 CodeLutin - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - ##% --> - -<Table fill="both"> - <script> - <![CDATA[ - import org.chorem.lima.entity.Account; - import org.jdesktop.swingx.autocomplete.AutoCompleteDecorator; - import org.jdesktop.swingx.autocomplete.ObjectToStringConverter; - - // Swingx auto complete (for account) : - AutoCompleteDecorator.decorate(accountComboBox, new ObjectToStringConverter() { - @Override - public String getPreferredStringForItem(Object item) { - if (item == null) { - return ""; - } - Account account = (Account) item; - return account.getAccountNumber() + " : " + account.getLabel(); - } - }); - - protected void addLettering() { - // never been implemented :( - }; - protected void removeLettering() { - // never been implemented :( - }; - ]]> - </script> - <row> - <cell> - <Table> - <!-- account --> - <row fill="horizontal" weightx="1" anchor="center"> - <cell anchor="east"> - <JLabel text="lima.account"/> - </cell> - <cell> - <org.chorem.lima.widgets.JWideComboBox id="accountComboBox" - model="{new org.chorem.lima.ui.combobox.AccountComboBoxModel()}" /> - </cell> - </row> - <!-- from --> - <row fill="horizontal" weightx="1" anchor="center"> - <cell anchor="east"> - <JLabel text="lima.lettering.from"/> - </cell> - <cell> - <org.chorem.lima.widgets.JWideComboBox id="fromPeriodComoboBox" /> - </cell> - </row> - <!-- to --> - <row fill="horizontal" weightx="1" anchor="center"> - <cell anchor="east"> - <JLabel text="lima.lettering.to"/> - </cell> - <cell> - <org.chorem.lima.widgets.JWideComboBox id="toPeriodComoboBox" /> - </cell> - </row> - </Table> - </cell> - <cell> - <!-- entries --> - <Table fill="both"> - <row columns="3"> - <cell> - <JLabel text="lima.lettering.entries"/> - </cell> - </row> - <row> - <cell> - <JRadioButton buttonGroup='entryButtons' text='lima.lettering.lettered' - value='{_("lima.lettering.lettered")}' selected='true'/> - </cell> - <cell> - <JRadioButton buttonGroup='entryButtons' text='lima.lettering.notlettered' - value='{_("lima.lettering.notlettered")}'/> - </cell> - <cell> - <JRadioButton buttonGroup='entryButtons' text='lima.lettering.letteredall' - value='{_("lima.lettering.letteredall")}'/> - </cell> - </row> - </Table> - </cell> - </row> - <row columns="2" weightx="1" weighty="1" anchor="center" fill="both"> - <cell> - <JScrollPane> - <org.jdesktop.swingx.JXTable id="letteringTable" /> - </JScrollPane> - </cell> - </row> - <row> - <cell> - <!-- add lettering --> - <JButton id="addButton" text="lima.lettering.add" - onActionPerformed="addLettering()"/> - </cell> - <cell> - <!-- remove lettering --> - <JButton id="removeButton" text="lima.lettering.remove" - onActionPerformed="removeLettering()"/> - </cell> - </row> -</Table> \ No newline at end of file Deleted: trunk/lima-swing/src/main/java/org/chorem/lima/ui/transaction/SearchFinancialTransactionViewHandler.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/transaction/SearchFinancialTransactionViewHandler.java 2010-05-17 09:08:42 UTC (rev 2900) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/transaction/SearchFinancialTransactionViewHandler.java 2010-05-19 10:52:43 UTC (rev 2901) @@ -1,14 +0,0 @@ -package org.chorem.lima.ui.transaction; - -public class SearchFinancialTransactionViewHandler { - - - protected void addCriteriaWidget() { - - } - - protected void doSearch() { - - } - -} Deleted: trunk/lima-swing/src/main/java/org/chorem/lima/ui/transaction/SearchTransactionView.jaxx =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/transaction/SearchTransactionView.jaxx 2010-05-17 09:08:42 UTC (rev 2900) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/transaction/SearchTransactionView.jaxx 2010-05-19 10:52:43 UTC (rev 2901) @@ -1,60 +0,0 @@ -<!-- ##% Lima Swing - Copyright (C) 2008 - 2010 CodeLutin - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - ##% --> - -<JFrame title="lima.search" width="620" height="300" locationRelativeTo="{null}" - onWindowClosing="windowClosing()" - defaultCloseOperation="do_nothing_on_close" - iconImage='{Toolkit.getDefaultToolkit().getImage(getClass().getResource("/icons/lima.png"))}'> - <script> - protected void addCriteriaWidget() {}; - protected void doSearch() {}; - protected void windowClosing() {}; - </script> - <JScrollPane> - <Table fill="horizontal" insets='5,5,5,5' anchor="north" weighty="1" weightx="1"> - <row> - <cell> - <JButton id="addButton" text="lima.common.add" width="100" onActionPerformed="addCriteriaWidget()"/> - </cell> - <cell> - <JLabel text="lima.search.items.where" width="200"/> - </cell> - <cell> - <JAXXComboBox id="criteriaAllAnyComboBox" width="200"> - <item value='all' label='{_("lima.all.criteria")}' selected="true"/> - <item value='any' label='{_("lima.any.criteria")}'/> - </JAXXComboBox> - </cell> - </row> - <row> - <cell columns="3"> - <VBox id="criteriaWidgetPanel" - border='{BorderFactory.createTitledBorder(_("lima.search.title.criteria.box"))}' - /> - </cell> - </row> - <row> - <cell> - <JButton id="okButton" onActionPerformed="doSearch()" text="lima.common.ok"/> - </cell> - <cell> - <JButton id="cancelButton" text="lima.common.cancel" onActionPerformed="windowClosing()"/> - </cell> - </row> - </Table> - </JScrollPane> -</JFrame> \ No newline at end of file Deleted: trunk/lima-swing/src/main/java/org/chorem/lima/ui/transaction/table/AccountTableCellEditor.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/transaction/table/AccountTableCellEditor.java 2010-05-17 09:08:42 UTC (rev 2900) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/transaction/table/AccountTableCellEditor.java 2010-05-19 10:52:43 UTC (rev 2901) @@ -1,81 +0,0 @@ -/** - * *##% Lima Main - * Copyright (C) 2008 CodeLutin - * - * 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>. ##%* - */ - -package org.chorem.lima.ui.transaction.table; - -import java.awt.Component; -import java.awt.event.MouseEvent; -import java.util.EventObject; - -import javax.swing.AbstractCellEditor; -import javax.swing.JTable; -import javax.swing.table.TableCellEditor; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.chorem.lima.entity.Account; -import org.chorem.lima.ui.combobox.AccountComboBoxModel; -import org.chorem.lima.ui.combobox.AccountRenderer; -import org.chorem.lima.widgets.JWideComboBox; - -public class AccountTableCellEditor extends AbstractCellEditor implements TableCellEditor { - - protected static final Log log = LogFactory.getLog(EntryBookTableCellEditor.class); - private final JWideComboBox comboBox; - private static final long serialVersionUID = 2580476608066111095L; - private static AccountTableCellEditor editor; - - /** - * constructor - */ - public AccountTableCellEditor() { - comboBox = new JWideComboBox(); - AccountComboBoxModel accountComboBoxModel = new AccountComboBoxModel(); - comboBox.setModel(accountComboBoxModel); - AccountRenderer accountRenderer = new AccountRenderer(); - comboBox.setRenderer(accountRenderer); - } - - @Override - public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { - if (value instanceof Account){ - comboBox.setSelectedItem((Account) value); - - } - return comboBox; - } - - @Override - public Object getCellEditorValue() { - return comboBox.getSelectedItem(); - } - - @Override - public boolean isCellEditable(EventObject evt) { - return !(evt instanceof MouseEvent) || ((MouseEvent) evt).getClickCount() == 2; - } - - public static AccountTableCellEditor getInstance() { - if (editor == null) { - editor = new AccountTableCellEditor(); - } - return editor; - } - -} Deleted: trunk/lima-swing/src/main/java/org/chorem/lima/ui/transaction/table/DateTableCellEditor.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/transaction/table/DateTableCellEditor.java 2010-05-17 09:08:42 UTC (rev 2900) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/transaction/table/DateTableCellEditor.java 2010-05-19 10:52:43 UTC (rev 2901) @@ -1,72 +0,0 @@ -/** - * *##% Lima Main - * Copyright (C) 2008 CodeLutin - * - * 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>. ##%* - */ - -package org.chorem.lima.ui.transaction.table; - -import org.chorem.lima.LimaContext; -import org.jdesktop.swingx.JXDatePicker; - -import javax.swing.*; -import javax.swing.table.TableCellEditor; -import java.awt.*; -import java.awt.event.MouseEvent; -import java.util.Date; -import java.util.EventObject; - -/** - * @author ore - */ -public class DateTableCellEditor extends AbstractCellEditor implements TableCellEditor { - - private final JXDatePicker datePicker; - private static final long serialVersionUID = -8455896587828255307L; - private static DateTableCellEditor editor; - - /** - * constructor - */ - public DateTableCellEditor() { - datePicker = new JXDatePicker(LimaContext.getContext().getConfig().getLocale()); - } - - @Override - public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { - if (value instanceof Date) { - datePicker.setDate((Date) value); - } - return datePicker; - } - - @Override - public Object getCellEditorValue() { - return datePicker.getDate(); - } - - @Override - public boolean isCellEditable(EventObject evt) { - return !(evt instanceof MouseEvent) || ((MouseEvent) evt).getClickCount() == 2; - } - - public static DateTableCellEditor getInstance() { - if (editor == null) { - editor = new DateTableCellEditor(); - } - return editor; - } -} Deleted: trunk/lima-swing/src/main/java/org/chorem/lima/ui/transaction/table/EntryBookTableCellEditor.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/transaction/table/EntryBookTableCellEditor.java 2010-05-17 09:08:42 UTC (rev 2900) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/transaction/table/EntryBookTableCellEditor.java 2010-05-19 10:52:43 UTC (rev 2901) @@ -1,86 +0,0 @@ -/** - * *##% Lima Main - * Copyright (C) 2008 CodeLutin - * - * 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>. ##%* - */ - -package org.chorem.lima.ui.transaction.table; - -import java.awt.Component; -import java.awt.event.MouseEvent; -import java.util.EventObject; - -import javax.swing.AbstractCellEditor; -import javax.swing.JTable; -import javax.swing.table.TableCellEditor; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.chorem.lima.entity.EntryBook; -import org.chorem.lima.ui.combobox.EntryBookComboBoxModel; -import org.chorem.lima.ui.combobox.EntryBookRenderer; -import org.chorem.lima.widgets.JWideComboBox; - -public class EntryBookTableCellEditor extends AbstractCellEditor implements TableCellEditor { - - protected static final Log log = LogFactory.getLog(EntryBookTableCellEditor.class); - private final JWideComboBox comboBox; - private static final long serialVersionUID = 2580476608066111095L; - private static EntryBookTableCellEditor editor; - - /** - * constructor - */ - public EntryBookTableCellEditor() { - comboBox = new JWideComboBox(); - EntryBookComboBoxModel entryBookComboBoxModel = new EntryBookComboBoxModel(); - comboBox.setModel(entryBookComboBoxModel); - EntryBookRenderer entryBookRenderer = new EntryBookRenderer(); - comboBox.setRenderer(entryBookRenderer); - - /*// Property Change Listener - LimaContext.getContext().getDataManager().getJournalModel().addPropertyChangeListener(comboBoxModel); - comboBox.setModel(comboBoxModel); - // AutoCompletion - AutoCompleteDecorator.decorate(comboBox, JournalToStringConverter.getInstance());*/ - } - - @Override - public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { - if (value instanceof EntryBook){ - comboBox.setSelectedItem((EntryBook) value); - - } - return comboBox; - } - - @Override - public Object getCellEditorValue() { - return comboBox.getSelectedItem(); - } - - @Override - public boolean isCellEditable(EventObject evt) { - return !(evt instanceof MouseEvent) || ((MouseEvent) evt).getClickCount() == 2; - } - - public static EntryBookTableCellEditor getInstance() { - if (editor == null) { - editor = new EntryBookTableCellEditor(); - } - return editor; - } -} Deleted: trunk/lima-swing/src/main/java/org/chorem/lima/ui/transaction/table/FinancialTransactionTable.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/transaction/table/FinancialTransactionTable.java 2010-05-17 09:08:42 UTC (rev 2900) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/transaction/table/FinancialTransactionTable.java 2010-05-19 10:52:43 UTC (rev 2901) @@ -1,200 +0,0 @@ -/* *##% Lima Swing - * Copyright (C) 2008 - 2010 CodeLutin - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * ##%*/ - -package org.chorem.lima.ui.transaction.table; - -import java.awt.Color; -import java.awt.Component; -import java.awt.event.KeyEvent; -import java.awt.event.KeyListener; -import java.util.Date; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.chorem.lima.entity.Account; -import org.chorem.lima.entity.EntryBook; -import org.chorem.lima.entity.FinancialTransaction; -import org.chorem.lima.ui.transaction.FinancialTransactionHelper; -import org.chorem.lima.ui.transaction.FinancialTransactionViewHandler; -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; - - -/** - * Table des transaction qui ajoute des comportement (keys). - * - * @author ore - * @author Rémi Chapelet - */ -public class FinancialTransactionTable extends JXTable implements KeyListener { - - /** serialVersionUID. */ - private static final long serialVersionUID = 3133690382049594727L; - - /** log. */ - private static final Log log = LogFactory.getLog(FinancialTransactionTable.class); - - protected FinancialTransactionViewHandler handler; - - private Highlighter colorTransaction; - - private ColorHighlighter colorBalance; - - /** - */ - public FinancialTransactionTable(FinancialTransactionViewHandler handler) { - - this.handler = handler; - - addKeyListener(this); - - //Get new date editor - setDefaultEditor(Date.class, new DateTableCellEditor()); - //Get new entry book editor - setDefaultEditor(EntryBook.class, new EntryBookTableCellEditor()); - //Get new account editor - setDefaultEditor(Account.class, new AccountTableCellEditor()); - - //highlight financial financial transactions - addColorTransaction(); - // highlight unbalanced financial transactions - addColorNonBalancedTransaction(); - } - - /** - * Cette méthode permet de colorer toutes les transactions dans le tableau - * afin de bien distinguer les transactions et entrées comptables. - * On récupère la première cellule, on vérifie que c'est une date - */ - protected void addColorTransaction() { - if (colorTransaction != null) { - removeHighlighter(colorTransaction); - } - HighlightPredicate predicate = new HighlightPredicate() { - @Override - public boolean isHighlighted(Component renderer, - ComponentAdapter adapter) { - return adapter.getValueAt(adapter.row, 0) instanceof Date; - } - }; - colorTransaction = - new ColorHighlighter(predicate, new Color(222,222,222), null); - addHighlighter(colorTransaction); - } - - - - /** - * Permet de surligner une transaction dans le tableau lorsque - * cette dernière n'est pas équilibrée. - * On récupère la dernière cellule de la ligne - * et on vérifie si la valeur est différente de 0 - */ - protected void addColorNonBalancedTransaction() { - if (colorBalance != null) { - removeHighlighter(colorBalance); - } - HighlightPredicate predicate = new HighlightPredicate() { - @Override - public boolean isHighlighted(Component renderer, - ComponentAdapter adapter) { - boolean isHighlighted = false; - Object value = adapter.getValueAt(adapter.row, 8); - if (value instanceof Double) { - Double currentBalance = (Double) value; - if (currentBalance != 0) { - isHighlighted = true; - } - } - return isHighlighted; - } - }; - colorTransaction = - new ColorHighlighter(predicate, new Color(255, 198, 209), null); - addHighlighter(colorTransaction); - } - - /** - * for each action combination key are think - * for extend keyboard and laptop keyboard - */ - @Override - public void keyPressed(KeyEvent e) { - - // delete selected row with the key : delete or ctrl clear - // ou de l'entree - if ((e.getKeyCode() == KeyEvent.VK_DELETE ) - || (e.getKeyCode() == KeyEvent.VK_CLEAR - && e.getModifiers() == KeyEvent.CTRL_MASK)){ - handler.deleteSelectedRow(); - } - - // add entry with the key combination : insert or ctrl + enter - if ((e.getKeyCode() == KeyEvent.VK_INSERT ) - || (e.getKeyCode() == KeyEvent.VK_ENTER - && e.getModifiers() == KeyEvent.CTRL_MASK)) { - handler.addEmptyEntry(); - } - - // add financial transaction with the key combination : ctrl + tab - if (e.getKeyCode() == KeyEvent.VK_TAB - && e.getModifiers() == KeyEvent.CTRL_MASK) { - handler.addFinancialTransaction(); - } - - /** - * Touche tab - * Ajoute une entrée comptable si tab est sur - * la dernière cellule. - */ - if (e.getKeyChar() == KeyEvent.VK_TAB) { - // Vérifie si la cellule sélectionnée est la dernière - - int x = this.getSelectedColumn(); - int y = this.getSelectedRow(); - int max_x = this.getColumnCount() - 1; - int max_y = this.getRowCount() - 1; - if (x == max_x && y == max_y) { - handler.addEmptyEntry(); - // positionne la sélection sur la nouvelle ligne créée - this.setColumnSelectionInterval(0, 0); - this.setRowSelectionInterval(max_y + 1, max_y + 1); - } - } - - } - - /* - * @see java.awt.event.KeyListener#keyTyped(java.awt.event.KeyEvent) - */ - @Override - public void keyTyped(KeyEvent e) { - - } - - /* - * @see java.awt.event.KeyListener#keyReleased(java.awt.event.KeyEvent) - */ - @Override - public void keyReleased(KeyEvent e) { - - } -} Deleted: trunk/lima-swing/src/main/java/org/chorem/lima/ui/transaction/table/FinancialTransactionTableModel.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/transaction/table/FinancialTransactionTableModel.java 2010-05-17 09:08:42 UTC (rev 2900) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/transaction/table/FinancialTransactionTableModel.java 2010-05-19 10:52:43 UTC (rev 2901) @@ -1,559 +0,0 @@ -/* *##% Lima Swing - * Copyright (C) 2008 - 2010 CodeLutin - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * ##%*/ - -package org.chorem.lima.ui.transaction.table; - -import static org.nuiton.i18n.I18n._; - -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Date; -import java.util.List; - -import javax.swing.table.AbstractTableModel; - -import org.apache.commons.lang.time.DateUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.chorem.lima.business.EntryBookService; -import org.chorem.lima.business.FinancialPeriodService; -import org.chorem.lima.business.LimaBusinessException; -import org.chorem.lima.business.LimaException; -import org.chorem.lima.business.FinancialTransactionService; -import org.chorem.lima.entity.Account; -import org.chorem.lima.entity.Entry; -import org.chorem.lima.entity.EntryBook; -import org.chorem.lima.entity.EntryImpl; -import org.chorem.lima.entity.FinancialPeriod; -import org.chorem.lima.entity.FinancialPeriodImpl; -import org.chorem.lima.entity.FinancialTransactionImpl; -import org.chorem.lima.entity.FinancialTransaction; -import org.chorem.lima.service.LimaServiceFactory; -import org.chorem.lima.ui.transaction.FinancialTransactionHelper; -import org.chorem.lima.util.ErrorHelper; - -/** - * Basic transaction table model. - * - * Le modele est filtré sur {@link #selectedEntryBook} et - * {@link #selectedFinancialPeriod} (montée en charge !). - * - * @author ore - * @author chatellier - * @version $Revision$ - * - * Last update : $Date$ - * By : $Author$ - */ -public class FinancialTransactionTableModel extends AbstractTableModel { - - /** serialVersionUID. */ - private static final long serialVersionUID = 3914954536809622358L; - - /** log. */ - private static final Log log = LogFactory - .getLog(FinancialTransactionTableModel.class); - - /** Transaction service. */ - protected final FinancialTransactionService transactionService; - - /** EntryBook service. */ - protected final EntryBookService entryBookService; - - /** FinancialPeriod service. */ - protected final FinancialPeriodService financialPeriodService; - - /** selected financial period */ - protected FinancialPeriod selectedFinancialPeriod; - - /** data cache */ - protected List<Object> cacheDataList; - - /** collection - - - /** - * Model constructor. - * - * Just init service proxies. - */ - public FinancialTransactionTableModel() { - /* Services */ - // recordService = LimaServiceFactory.getInstance().getRecordService(); - transactionService = LimaServiceFactory.getInstance() - .getTransactionService(); - entryBookService = LimaServiceFactory.getInstance(). - getEntryBookService(); - financialPeriodService = LimaServiceFactory.getInstance(). - getFinancialPeriodService(); - } - - /** - * Le model est une combinaison de Transaction/Entries. - * - * - * @return - */ - protected List<Object> getDataList() { - - List<Object> results = new ArrayList<Object>(); - try { - List<FinancialTransaction> financialtransactions = - transactionService.getAllFinancialTransactionsForFinancialPeriod( - selectedFinancialPeriod); - for (FinancialTransaction financialtransaction : financialtransactions) { - results.add(financialtransaction); - results.addAll(financialtransaction.getEntry()); - } - } - catch (LimaException eee) { - if (log.isErrorEnabled()) { - log.debug("Can't update model", eee); - } - - ErrorHelper.showErrorDialog("Can't get transaction list", eee); - } - - return results; - } - - @Override - public int getColumnCount() { - return 9; - } - - @Override - public Class<?> getColumnClass(int column) { - - Class<?> result = null; - - switch (column) { - case 0: - result = Date.class; - break; - case 1: - result = EntryBook.class; - break; - case 2: - result = String.class; - break; - case 3: - result = Account.class; - break; - case 4: - result = String.class; - break; - case 5: - result = String.class; - break; - case 6: - result = Double.class; - break; - case 7: - result = Double.class; - break; - case 8: - result = Double.class; - break; - } - - return result; - } - - @Override - public String getColumnName(int column) { - String result = "n/a"; - - switch (column) { - case 0: - result = _("lima.transaction.column.date"); - break; - case 1: - result = _("lima.transaction.column.entrybook"); - break; - case 2: - result = _("lima.transaction.column.voucher"); - break; - case 3: - result = _("lima.transaction.column.account"); - break; - case 4: - result = _("lima.transaction.column.description"); - break; - case 5: - result = _("lima.transaction.column.position"); - break; - case 6: - result = _("lima.transaction.column.debit"); - break; - case 7: - result = _("lima.transaction.column.credit"); - break; - case 8: - result = _("lima.transaction.column.balance"); - break; - } - - return result; - } - - @Override - public int getRowCount() { - int result = 0; - - // just prevent too much result - if (selectedFinancialPeriod != null) { - //cacheDataList = getDataList(); - result = cacheDataList.size(); - } - else { - if (log.isDebugEnabled()) { - log.debug("No fiscalPeriod selected skip table model update"); - } - } - - return result; - } - - @Override - public Object getValueAt(int row, int column) { - Object result = null; - - // just prevent too much result - if (selectedFinancialPeriod != null) { - result = cacheDataList.get(row); - - if (result instanceof FinancialTransaction) { - FinancialTransaction currentRow = (FinancialTransaction)result; - - switch (column) { - case 0: - result = currentRow.getTransactionDate(); - break; - case 1: - result = null; // voucher - break; - case 2: - result = null; //entrybook - break; - case 3: - result = null; // account - break; - case 4: - result = null; // description - break; - case 5 : - result = null; // position - break; - case 6: - result = FinancialTransactionHelper.getDebit(currentRow); - break; - case 7: - result = FinancialTransactionHelper.getCredit(currentRow); - break; - case 8: - result = FinancialTransactionHelper.getDebit(currentRow) - - FinancialTransactionHelper.getCredit(currentRow); - break; - } - } - else if (result instanceof Entry) { - Entry currentEntry = (Entry)result; - switch (column) { - case 0: - result = null; // date - break; - case 1 : // entry book - if (currentEntry.getEntryBook() != null){ - result = currentEntry.getEntryBook().getCode(); - } - else { - result = null; - } - break; - case 2: - result = currentEntry.getVoucher(); - break; - case 3: // account - if (currentEntry.getAccount() != null){ - result = currentEntry.getAccount().getAccountNumber(); - } - else { - result = null; - } - break; - case 4: - result = currentEntry.getDescription(); - break; - case 5 : - result = currentEntry.getPosition(); - break; - case 6: - result = currentEntry.getDebit() ? currentEntry.getAmount() : 0; - break; - case 7: - result = currentEntry.getDebit() ? 0 : currentEntry.getAmount(); - break; - case 8: - result = null; // balance - break; - } - - } - } - else { - if (log.isDebugEnabled()) { - log.debug("No fiscalPeriod selected skip table model update"); - } - } - - return result; - } - - - public void setFinancialPeriod(FinancialPeriod financialPeriod){ - - selectedFinancialPeriod = financialPeriod; - cacheDataList = getDataList(); - fireTableDataChanged(); - } - - /** - * To set cells editable or not - * different condition for entry or financial transaction - */ - @Override - public boolean isCellEditable(int rowIndex, int columnIndex) { - boolean editableCell=false; - Object currentRow = cacheDataList.get(rowIndex); - // cells editable for the entry row, all cells exclude the date - if ((currentRow instanceof Entry) && !(columnIndex==0)) { - editableCell=true; - } - // cells editable for the financialtransaction row, no cells exclude the date - if ((currentRow instanceof FinancialTransaction) && (columnIndex==0)){ - editableCell=true; - } - return editableCell; - } - - /** - * @throws LimaException - */ - public void addFinancialTransaction() throws LimaException{ - /* Calling transaction service */ - FinancialTransaction financialTransaction = new FinancialTransactionImpl(); - //if a period and an entrybook is selected - if (selectedFinancialPeriod != null){ - financialTransaction.setFinancialPeriod(selectedFinancialPeriod); - // get today - Calendar actualCalendar = Calendar.getInstance(); - // get the financial period date - Date transactionDate = selectedFinancialPeriod.getBeginDate(); - // change the day - transactionDate = DateUtils.setDays(transactionDate, - actualCalendar.get(Calendar.DAY_OF_MONTH)); - // set date to the financial transaction - financialTransaction.setTransactionDate(transactionDate); - // create it - transactionService.createFinancialTransaction(financialTransaction); - //on recharge la liste - cacheDataList = getDataList(); - int row = getDataList().indexOf(financialTransaction); - fireTableRowsInserted(row, row); - //fireTableDataChanged(); - } - else { - throw new LimaBusinessException("No financial period selected"); - } - } - - - - /** - * @throws LimaException - */ - public void addEmptyEntry(Object value, int row) throws LimaException { - FinancialTransaction currentTransaction = null; - Object currentRow = cacheDataList.get(row); - Entry entry = new EntryImpl(); - //check if current row is a transaction or an entry - if (currentRow instanceof FinancialTransaction) { - currentTransaction = (FinancialTransaction)currentRow; - } - else if (currentRow instanceof Entry) { - Entry currentEntry = (Entry)currentRow; - //get back the parent transaction of the entry - currentTransaction = currentEntry.getFinancialTransaction(); - } - //create it - entry.setFinancialTransaction(currentTransaction); - transactionService.createEntry(entry); - //on recharge la liste - cacheDataList = getDataList(); - fireTableDataChanged(); - } - - /** - * to modifiy financialtransaction or entry - */ - @Override - public void setValueAt(Object value, int row, int column) { - - // just prevent too much result - if (selectedFinancialPeriod != null) { - Object currentRow = cacheDataList.get(row); - if (currentRow instanceof FinancialTransaction) { - FinancialTransaction currentFinancialTransaction = - (FinancialTransaction)currentRow; - switch (column) { - case 0: - // Truncate the date - format 01-MM-YYYY - Date dateCurrentFinancialTransaction = ((Date)value); - dateCurrentFinancialTransaction = - DateUtils.truncate( - dateCurrentFinancialTransaction, Calendar.MONTH); - - // Return the begin date of the current financial period - Date dateCurrentFinancialPeriod = - selectedFinancialPeriod.getBeginDate(); - - // Compare to the begindate of the current financial period - if (!dateCurrentFinancialPeriod.equals(dateCurrentFinancialTransaction)){ - //methode get financialperiod dans le service - FinancialPeriod newFinancialPeriod = - new FinancialPeriodImpl(); - try { - newFinancialPeriod = - financialPeriodService.getFinancialPeriodWithDate( - dateCurrentFinancialTransaction); - } catch (LimaException e) { - if (log.isDebugEnabled()){ - log.debug("Can't get new financialPeriodService"); - } - } - //if the changed financial period is unlocked - if (newFinancialPeriod != null){ - if (newFinancialPeriod.getLocked() == false){ - //update - currentFinancialTransaction. - setTransactionDate((Date)value); - currentFinancialTransaction. - setFinancialPeriod(newFinancialPeriod); - } - } - else { - if (log.isDebugEnabled()){ - log.debug("Can't update on the new date"); - } - } - } - - break; - } - // notify service for modification - try { - transactionService. - updateFinancialTransaction(currentFinancialTransaction); - } catch (LimaException e) { - if (log.isDebugEnabled()){ - log.debug("Can't update financial transaction", e); - } - } - } - else if (currentRow instanceof Entry) { - Entry currentEntry = (Entry)currentRow; - switch (column) { - case 1 : - currentEntry.setEntryBook((EntryBook)value); - break; - case 2 : - currentEntry.setVoucher((String)value); - break; - case 3: - currentEntry.setAccount((Account)value); - break; - case 4: - currentEntry.setDescription((String)value); - break; - case 5 : - currentEntry.setPosition((String)value); - break; - case 6: - currentEntry.setAmount((Double)value); - currentEntry.setDebit(true); - break; - case 7: - currentEntry.setAmount((Double)value); - currentEntry.setDebit(false); - break; - } - try { - transactionService.updateEntry(currentEntry); - } catch (LimaException e) { - if (log.isDebugEnabled()){ - log.debug("Can't update entry", e); - } - } - } - //update the financial transaction in entire - int financialTransactionRow = - getDataList().indexOf(((Entry) currentRow). - getFinancialTransaction()); - //on recharge la liste - cacheDataList = getDataList(); - fireTableRowsUpdated(financialTransactionRow, getRowCount()-1); - } - else { - if (log.isDebugEnabled()) { - log.debug("No fiscalPeriod selected skip table model update"); - } - } - } - - public Object getElementAt(int row){ - - Object currentRow = cacheDataList.get(row); - return currentRow; - } - - - /** - * Delete selected row in table (could be transaction or entry). - * - * Called by model. - * @param Object, int - * @throws LimaException - */ - public void removeObject(Object object, int row) throws LimaException { - Object currentRow = cacheDataList.get(row); - if (currentRow instanceof FinancialTransaction) { - FinancialTransaction currentTransaction = - (FinancialTransaction)currentRow; - transactionService.removeFinancialTransaction(currentTransaction); - } - else if (currentRow instanceof Entry) { - Entry currentEntry = (Entry)currentRow; - transactionService.removeEntry(currentEntry); - } - //on recharge la liste - cacheDataList = getDataList(); - fireTableRowsDeleted(row, getRowCount()); - } - -} Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2010-05-17 09:08:42 UTC (rev 2900) +++ trunk/pom.xml 2010-05-19 10:52:43 UTC (rev 2901) @@ -241,8 +241,8 @@ <!-- customized libs version --> <nuiton-utils.version>1.2.2</nuiton-utils.version> - <eugene.version>2.0.1</eugene.version> - <topia.version>2.3.3</topia.version> + <eugene.version>2.0.2-SNAPSHOT</eugene.version> + <topia.version>2.4-SNAPSHOT</topia.version> <jaxx.version>2.0.1</jaxx.version> <i18n.version>1.2.2</i18n.version>
participants (1)
-
jpepin@users.chorem.org