This is an automated email from the git hooks/post-receive script. New change to branch feature/1293-addAccountViewerTab in repository lima. See http://git.chorem.org/lima.git from 93c9475 refs #1293 correction i18n new b3e00d9 refs #1293 modification concernnt l'affichage des infos résumées The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit b3e00d99521ee261a4e169084836aa10e5395a31 Author: dcosse <cosse@codelutin.com> Date: Tue Sep 22 17:58:13 2015 +0200 refs #1293 modification concernnt l'affichage des infos résumées Summary of changes: .../lima/business/api/FinancialPeriodService.java | 6 +- .../business/ejb/FinancialPeriodServiceImpl.java | 13 +- .../lima/business/ejb/ReportServiceImpl.java | 2 +- .../report/GeneralEntryBookReportServiceImpl.java | 2 +- .../ProvisionalEntryBookReportServiceImpl.java | 2 +- .../lima/entity/FinancialPeriodTopiaDao.java | 10 +- .../lima/business/FiscalPeriodServiceImplTest.java | 4 +- .../lima/ui/accountViewer/AccountViewerFilter.java | 41 +++ .../ui/accountViewer/AccountViewerTableModel.java | 10 - .../lima/ui/accountViewer/AccountViewerView.css | 77 ++++- .../lima/ui/accountViewer/AccountViewerView.jaxx | 106 +++++-- .../ui/accountViewer/AccountViewerViewHandler.java | 322 ++++++++++----------- .../accountViewer/FinancialPeriodListRenderer.java | 68 ----- .../FinancialTransactionViewHandler.java | 4 +- .../resources/i18n/lima-swing_en_GB.properties | 2 + .../resources/i18n/lima-swing_fr_FR.properties | 2 + 16 files changed, 386 insertions(+), 285 deletions(-) create mode 100644 lima-swing/src/main/java/org/chorem/lima/ui/accountViewer/AccountViewerFilter.java delete mode 100644 lima-swing/src/main/java/org/chorem/lima/ui/accountViewer/FinancialPeriodListRenderer.java -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/1293-addAccountViewerTab in repository lima. See http://git.chorem.org/lima.git commit b3e00d99521ee261a4e169084836aa10e5395a31 Author: dcosse <cosse@codelutin.com> Date: Tue Sep 22 17:58:13 2015 +0200 refs #1293 modification concernnt l'affichage des infos résumées --- .../lima/business/api/FinancialPeriodService.java | 6 +- .../business/ejb/FinancialPeriodServiceImpl.java | 13 +- .../lima/business/ejb/ReportServiceImpl.java | 2 +- .../report/GeneralEntryBookReportServiceImpl.java | 2 +- .../ProvisionalEntryBookReportServiceImpl.java | 2 +- .../lima/entity/FinancialPeriodTopiaDao.java | 10 +- .../lima/business/FiscalPeriodServiceImplTest.java | 4 +- .../lima/ui/accountViewer/AccountViewerFilter.java | 41 +++ .../ui/accountViewer/AccountViewerTableModel.java | 10 - .../lima/ui/accountViewer/AccountViewerView.css | 77 ++++- .../lima/ui/accountViewer/AccountViewerView.jaxx | 106 +++++-- .../ui/accountViewer/AccountViewerViewHandler.java | 322 ++++++++++----------- .../accountViewer/FinancialPeriodListRenderer.java | 68 ----- .../FinancialTransactionViewHandler.java | 4 +- .../resources/i18n/lima-swing_en_GB.properties | 2 + .../resources/i18n/lima-swing_fr_FR.properties | 2 + 16 files changed, 386 insertions(+), 285 deletions(-) diff --git a/lima-business-api/src/main/java/org/chorem/lima/business/api/FinancialPeriodService.java b/lima-business-api/src/main/java/org/chorem/lima/business/api/FinancialPeriodService.java index 3b078dd..4ed0a10 100644 --- a/lima-business-api/src/main/java/org/chorem/lima/business/api/FinancialPeriodService.java +++ b/lima-business-api/src/main/java/org/chorem/lima/business/api/FinancialPeriodService.java @@ -58,6 +58,8 @@ public interface FinancialPeriodService { List<FinancialPeriod> getAllFinancialPeriods(); - List<FinancialPeriod> getFinancialPeriods(Date beginDate, - Date endDate); + FinancialPeriod getFinancialForDate(Date date); + + List<FinancialPeriod> getFinancialPeriodsWithBeginDateWithin(Date beginDateFirst, + Date endDateLast); } diff --git a/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialPeriodServiceImpl.java b/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialPeriodServiceImpl.java index cabbf73..02c2df2 100644 --- a/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialPeriodServiceImpl.java +++ b/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialPeriodServiceImpl.java @@ -62,12 +62,21 @@ public class FinancialPeriodServiceImpl extends AbstractLimaService implements F return result; } + @Override + public FinancialPeriod getFinancialForDate(Date date) { + + FinancialPeriodTopiaDao financialPeriodTopiaDao = getDaoHelper().getFinancialPeriodDao(); + FinancialPeriod result = financialPeriodTopiaDao.findByDate(date); + + return result; + } + /** @return all financial period from a fiscal period */ @Override - public List<FinancialPeriod> getFinancialPeriods(Date beginDate, Date endDate) { + public List<FinancialPeriod> getFinancialPeriodsWithBeginDateWithin(Date beginDateFirst, Date endDateLast) { FinancialPeriodTopiaDao financialPeriodTopiaDao = getDaoHelper().getFinancialPeriodDao(); - List<FinancialPeriod> result = financialPeriodTopiaDao.findByDates(beginDate, endDate); + List<FinancialPeriod> result = financialPeriodTopiaDao.findForBeginDateBetween(beginDateFirst, endDateLast); return result; } diff --git a/lima-business/src/main/java/org/chorem/lima/business/ejb/ReportServiceImpl.java b/lima-business/src/main/java/org/chorem/lima/business/ejb/ReportServiceImpl.java index 04031f4..ce9e57e 100644 --- a/lima-business/src/main/java/org/chorem/lima/business/ejb/ReportServiceImpl.java +++ b/lima-business/src/main/java/org/chorem/lima/business/ejb/ReportServiceImpl.java @@ -406,7 +406,7 @@ public class ReportServiceImpl extends AbstractLimaService implements ReportServ AccountTopiaDao accountTopiaDao = getDaoHelper().getAccountDao(); List<Account> accountsList; //gets all financial periods from the fiscal period - List<FinancialPeriod> financialPeriod = financialPeriodService.getFinancialPeriods( + List<FinancialPeriod> financialPeriod = financialPeriodService.getFinancialPeriodsWithBeginDateWithin( fiscalPeriod.getBeginDate(), fiscalPeriod.getEndDate()); for (FinancialPeriod fp : financialPeriod) { list.add(fp); diff --git a/lima-business/src/main/java/org/chorem/lima/business/ejb/report/GeneralEntryBookReportServiceImpl.java b/lima-business/src/main/java/org/chorem/lima/business/ejb/report/GeneralEntryBookReportServiceImpl.java index 9615820..b81b9a5 100644 --- a/lima-business/src/main/java/org/chorem/lima/business/ejb/report/GeneralEntryBookReportServiceImpl.java +++ b/lima-business/src/main/java/org/chorem/lima/business/ejb/report/GeneralEntryBookReportServiceImpl.java @@ -112,7 +112,7 @@ public class GeneralEntryBookReportServiceImpl extends AbstractLimaService imple documentReport.setSubReport(generalEntryBooksJasperReport); documentReport.setFormatter(bigDecimalFormat); - List<FinancialPeriod> financialPeriods = financialPeriodService.getFinancialPeriods(beginDate, endDate); + List<FinancialPeriod> financialPeriods = financialPeriodService.getFinancialPeriodsWithBeginDateWithin(beginDate, endDate); BigDecimal amountDebit = BigDecimal.ZERO; BigDecimal amountCredit = BigDecimal.ZERO; diff --git a/lima-business/src/main/java/org/chorem/lima/business/ejb/report/ProvisionalEntryBookReportServiceImpl.java b/lima-business/src/main/java/org/chorem/lima/business/ejb/report/ProvisionalEntryBookReportServiceImpl.java index 0340918..dca89da 100644 --- a/lima-business/src/main/java/org/chorem/lima/business/ejb/report/ProvisionalEntryBookReportServiceImpl.java +++ b/lima-business/src/main/java/org/chorem/lima/business/ejb/report/ProvisionalEntryBookReportServiceImpl.java @@ -109,7 +109,7 @@ public class ProvisionalEntryBookReportServiceImpl implements ProvisionalEntryBo BigDecimal documentReportDebit = BigDecimal.ZERO; BigDecimal documentReportCredit = BigDecimal.ZERO; - List<FinancialPeriod> financialPeriods = financialPeriodService.getFinancialPeriods(beginDate, endDate); + List<FinancialPeriod> financialPeriods = financialPeriodService.getFinancialPeriodsWithBeginDateWithin(beginDate, endDate); List<EntryBook> entryBooks; diff --git a/lima-business/src/main/java/org/chorem/lima/entity/FinancialPeriodTopiaDao.java b/lima-business/src/main/java/org/chorem/lima/entity/FinancialPeriodTopiaDao.java index e951ade..9d9a77d 100644 --- a/lima-business/src/main/java/org/chorem/lima/entity/FinancialPeriodTopiaDao.java +++ b/lima-business/src/main/java/org/chorem/lima/entity/FinancialPeriodTopiaDao.java @@ -49,15 +49,15 @@ public class FinancialPeriodTopiaDao extends AbstractFinancialPeriodTopiaDao<Fin /** * Return all FinancialPeriod with begin date between two given dates. * - * @param beginDate period begin date - * @param endDate period end date + * @param beginDateFirst period begin date + * @param beginDateLast period end date * @return FinancialPeriod for {@code date} */ - public List<FinancialPeriod> findByDates(Date beginDate, Date endDate) { + public List<FinancialPeriod> findForBeginDateBetween(Date beginDateFirst, Date beginDateLast) { HqlAndParametersBuilder<FinancialPeriod> builder = newHqlAndParametersBuilder(); - builder.addGreaterOrEquals(FinancialPeriod.PROPERTY_BEGIN_DATE, beginDate); - builder.addLowerOrEquals(FinancialPeriod.PROPERTY_BEGIN_DATE, endDate); + builder.addGreaterOrEquals(FinancialPeriod.PROPERTY_BEGIN_DATE, beginDateFirst); + builder.addLowerOrEquals(FinancialPeriod.PROPERTY_BEGIN_DATE, beginDateLast); builder.setOrderByArguments(FinancialPeriod.PROPERTY_BEGIN_DATE); List<FinancialPeriod> financialPeriod = findAll(builder.getHql(), builder.getHqlParameters()); diff --git a/lima-business/src/test/java/org/chorem/lima/business/FiscalPeriodServiceImplTest.java b/lima-business/src/test/java/org/chorem/lima/business/FiscalPeriodServiceImplTest.java index 7a74550..08168f9 100644 --- a/lima-business/src/test/java/org/chorem/lima/business/FiscalPeriodServiceImplTest.java +++ b/lima-business/src/test/java/org/chorem/lima/business/FiscalPeriodServiceImplTest.java @@ -293,7 +293,7 @@ public class FiscalPeriodServiceImplTest extends AbstractLimaTest { Assert.assertEquals(1, unblockedFiscalPeriods.size()); Assert.assertEquals(true, unblockedFiscalPeriods.contains(periodSave2)); - for (FinancialPeriod financialPeriod : financialPeriodService.getFinancialPeriods(periodSave1.getBeginDate(), periodSave1.getEndDate())) { + for (FinancialPeriod financialPeriod : financialPeriodService.getFinancialPeriodsWithBeginDateWithin(periodSave1.getBeginDate(), periodSave1.getEndDate())) { Assert.assertEquals(true, financialPeriod.isLocked()); for (EntryBook entryBook : entryBookService.getAllEntryBooks()) { ClosedPeriodicEntryBook closedPeriodicEntryBook = @@ -509,7 +509,7 @@ public class FiscalPeriodServiceImplTest extends AbstractLimaTest { Assert.assertEquals(1, unblockedFiscalPeriods.size()); Assert.assertEquals(true, unblockedFiscalPeriods.contains(periodSave2)); - for (FinancialPeriod financialPeriod : financialPeriodService.getFinancialPeriods(periodSave1.getBeginDate(), periodSave1.getEndDate())) { + for (FinancialPeriod financialPeriod : financialPeriodService.getFinancialPeriodsWithBeginDateWithin(periodSave1.getBeginDate(), periodSave1.getEndDate())) { Assert.assertEquals(true, financialPeriod.isLocked()); for (EntryBook entryBook : entryBookService.getAllEntryBooks()) { ClosedPeriodicEntryBook closedPeriodicEntryBook = diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/accountViewer/AccountViewerFilter.java b/lima-swing/src/main/java/org/chorem/lima/ui/accountViewer/AccountViewerFilter.java new file mode 100644 index 0000000..362cf69 --- /dev/null +++ b/lima-swing/src/main/java/org/chorem/lima/ui/accountViewer/AccountViewerFilter.java @@ -0,0 +1,41 @@ +package org.chorem.lima.ui.accountViewer; + +import org.chorem.lima.beans.LetteringFilterImpl; +import org.chorem.lima.entity.FinancialPeriod; +import org.chorem.lima.entity.FiscalPeriod; + +/** + * Created by davidcosse on 21/09/15. + */ +public class AccountViewerFilter extends LetteringFilterImpl { + + protected PeriodChoice periodChoice = PeriodChoice.FINANCIAL_PERIOD; + + protected FinancialPeriod financialPeriod; + + protected FiscalPeriod fiscalPeriod; + + public PeriodChoice getPeriodChoice() { + return periodChoice; + } + + public void setPeriodChoice(PeriodChoice periodChoice) { + this.periodChoice = periodChoice; + } + + public FinancialPeriod getFinancialPeriod() { + return financialPeriod; + } + + public void setFinancialPeriod(FinancialPeriod financialPeriod) { + this.financialPeriod = financialPeriod; + } + + public FiscalPeriod getFiscalPeriod() { + return fiscalPeriod; + } + + public void setFiscalPeriod(FiscalPeriod fiscalPeriod) { + this.fiscalPeriod = fiscalPeriod; + } +} diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/accountViewer/AccountViewerTableModel.java b/lima-swing/src/main/java/org/chorem/lima/ui/accountViewer/AccountViewerTableModel.java index 3180fbf..767d234 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/accountViewer/AccountViewerTableModel.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/accountViewer/AccountViewerTableModel.java @@ -43,12 +43,6 @@ public class AccountViewerTableModel extends AbstractLimaTableModel<Entry> { /** serialVersionUID. */ private static final long serialVersionUID = 1L; - public BigDecimal getPreviousPeriodSold() { - return previousPeriodSold; - } - - protected BigDecimal previousPeriodSold; - @Override protected void initColumn() { addColumn(new AbstractColumn<AccountViewerTableModel>(Date.class, t("lima.table.date"), false) { @@ -127,8 +121,4 @@ public class AccountViewerTableModel extends AbstractLimaTableModel<Entry> { }); } - - public void setPreviousPeriodSold(BigDecimal previousPeriodSold) { - this.previousPeriodSold = previousPeriodSold; - } } diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/accountViewer/AccountViewerView.css b/lima-swing/src/main/java/org/chorem/lima/ui/accountViewer/AccountViewerView.css index 07b91f7..9682494 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/accountViewer/AccountViewerView.css +++ b/lima-swing/src/main/java/org/chorem/lima/ui/accountViewer/AccountViewerView.css @@ -68,7 +68,7 @@ } #fiscalPeriodComboBox { - visible : {PeriodChoice.FISCAL_PERIOD.equals(periodChoice)}; + visible : {PeriodChoice.FISCAL_PERIOD.equals(periodChoice) || PeriodChoice.FINANCIAL_PERIOD.equals(periodChoice)}; toolTipText : "lima.entries.fiscalYear"; renderer : "{new org.chorem.lima.ui.common.FiscalPeriodListRenderer()}"; } @@ -76,7 +76,7 @@ #financialPeriodComboBox { preferredSize : {new Dimension(200, 22)}; toolTipText : "lima.entries.financialPeriod"; - renderer : "{new org.chorem.lima.ui.accountViewer.FinancialPeriodListRenderer()}"; + renderer : "{new org.chorem.lima.ui.common.FinancialPeriodListRenderer()}"; } #refresh { @@ -84,12 +84,79 @@ actionIcon : "refresh"; } +#beginDebitLabel { + text : "lima.table.debit"; +} + +#beginDebit { + editable : false; +} + +#beginCreditLabel { + text : "lima.table.credit"; +} + +#beginCredit { + editable : false; +} + +#beginSoldLabel { + text : "lima.table.balance"; +} + +#beginSold { + editable : false; +} + #table { sortable : false; rowHeight : 22; } -#balanceStatusLabel { - horizontalTextPosition:{JLabel.RIGHT}; - border: {BorderFactory.createEmptyBorder(0, 0, 0, 20)}; +#endDebitLabel { + text : "lima.table.debit"; +} + +#endDebit { + editable : false; +} + +#endCreditLabel { + text : "lima.table.credit"; } + +#endCredit { + editable : false; +} + +#endSoldLabel { + text : "lima.table.balance"; +} + +#endSold { + editable : false; +} + +#selectionDebitLabel { + text : "lima.table.debit"; +} + +#selectionDebit { + editable : false; +} + +#selectionCreditLabel { + text : "lima.table.credit"; +} + +#selectionCredit { + editable : false; +} + +#selectionSoldLabel { + text : "lima.table.balance"; +} + +#selectionSold { + editable : false; +} \ No newline at end of file diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/accountViewer/AccountViewerView.jaxx b/lima-swing/src/main/java/org/chorem/lima/ui/accountViewer/AccountViewerView.jaxx index e615d60..e394d6c 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/accountViewer/AccountViewerView.jaxx +++ b/lima-swing/src/main/java/org/chorem/lima/ui/accountViewer/AccountViewerView.jaxx @@ -21,6 +21,7 @@ <JPanel layout="{new BorderLayout()}"> <import> + java.awt.FlowLayout java.awt.Dimension org.chorem.lima.util.WrapToolBarLayout org.chorem.lima.ui.common.FinancialPeriodComboBoxModel @@ -41,10 +42,10 @@ <script> <![CDATA[ - void $afterCompleteSetup() { - handler.init(); - } - ]]> + void $afterCompleteSetup() { + handler.init(); + } + ]]> </script> <JToolBar styleClass="toolbar" @@ -71,7 +72,7 @@ <JLabel id="beginPeriodLabel"/> - <org.chorem.lima.ui.combobox.FiscalPeriodComboBoxModel id="fiscalPeriodComboBoxModel"/> + <org.chorem.lima.ui.common.FiscalPeriodComboBoxModel id="fiscalPeriodComboBoxModel"/> <JComboBox id="fiscalPeriodComboBox" model="{fiscalPeriodComboBoxModel}" onItemStateChanged="handler.onFiscalPeriodChange(event)"/> @@ -102,21 +103,88 @@ <JButton id="refresh" onActionPerformed="handler.updateAllEntries(null)"/> - </JToolBar> - <JScrollPane constraints="BorderLayout.CENTER"> - <AccountViewerTableModel id="tableModel"/> - <AccountViewerSelectionModel id='accountViewerSelectionModel' constructorParams='tableModel' - onValueChanged="handler.balanceAndActions()"/> - - <AccountViewerTable id="table" - constructorParams="handler" - model="{tableModel}" - selectionModel="{accountViewerSelectionModel}"/> - </JScrollPane> - - <JPanel constraints="BorderLayout.SOUTH" layout="{new BorderLayout()}"> - <JLabel id='balanceStatusLabel' constraints="BorderLayout.EAST"/> + + <JPanel layout="{new BorderLayout()}" + constraints="BorderLayout.CENTER"> + + <JPanel constraints="BorderLayout.NORTH" layout="{new FlowLayout(FlowLayout.RIGHT)}" id="beginBalanceStatus"> + <JLabel id="beginPeriodSummary" /> + <JLabel id="beginDebitLabel" /> + <JTextField id="beginDebit"/> + <JLabel id="beginCreditLabel" /> + <JTextField id="beginCredit"/> + <JLabel id="beginSoldLabel" /> + <JTextField id="beginSold"/> + </JPanel> + + <JScrollPane constraints="BorderLayout.CENTER"> + <AccountViewerTableModel id="tableModel"/> + <AccountViewerSelectionModel id='accountViewerSelectionModel' constructorParams='tableModel' + onValueChanged="handler.balanceAndActions()"/> + + <AccountViewerTable id="table" + constructorParams="handler" + model="{tableModel}" + selectionModel="{accountViewerSelectionModel}"/> + </JScrollPane> + + <JPanel constraints="BorderLayout.SOUTH" layout="{new BorderLayout()}"> + <Table id='endBalanceStatus' constraints="BorderLayout.EAST"> + <row> + <cell anchor="east"> + <JLabel id="endPeriodSummary" /> + </cell> + + <cell anchor="east"> + <JLabel id="endDebitLabel" /> + </cell> + <cell anchor="west"> + <JTextField id="endDebit"/> + </cell> + + <cell anchor="east"> + <JLabel id="endCreditLabel" /> + </cell> + <cell anchor="west"> + <JTextField id="endCredit"/> + </cell> + + <cell anchor="east"> + <JLabel id="endSoldLabel" /> + </cell> + <cell anchor="west"> + <JTextField id="endSold"/> + </cell> + </row> + <row> + <cell anchor="east"> + <JLabel id="selectionDescription" /> + </cell> + + <cell anchor="east"> + <JLabel id="selectionDebitLabel" /> + </cell> + <cell anchor="west"> + <JTextField id="selectionDebit"/> + </cell> + + <cell anchor="east"> + <JLabel id="selectionCreditLabel" /> + </cell> + <cell anchor="west"> + <JTextField id="selectionCredit"/> + </cell> + + <cell anchor="east"> + <JLabel id="selectionSoldLabel" /> + </cell> + <cell anchor="west"> + <JTextField id="selectionSold"/> + </cell> + </row> + </Table> + </JPanel> </JPanel> </JPanel> \ No newline at end of file diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/accountViewer/AccountViewerViewHandler.java b/lima-swing/src/main/java/org/chorem/lima/ui/accountViewer/AccountViewerViewHandler.java index 50a17a0..f1450f5 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/accountViewer/AccountViewerViewHandler.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/accountViewer/AccountViewerViewHandler.java @@ -22,7 +22,6 @@ package org.chorem.lima.ui.accountViewer; -import com.google.common.collect.Lists; import jaxx.runtime.SwingUtil; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.time.DateUtils; @@ -39,16 +38,11 @@ import org.chorem.lima.business.api.FinancialTransactionService; import org.chorem.lima.business.api.FiscalPeriodService; import org.chorem.lima.entity.Account; import org.chorem.lima.entity.Entry; -import org.chorem.lima.entity.EntryImpl; import org.chorem.lima.entity.FinancialPeriod; -import org.chorem.lima.entity.FinancialTransaction; -import org.chorem.lima.entity.FinancialTransactionImpl; import org.chorem.lima.entity.FiscalPeriod; import org.chorem.lima.ui.combobox.AccountComboBox; import org.chorem.lima.util.BigDecimalToString; import org.chorem.lima.util.ErrorHelper; -import org.nuiton.util.beans.Binder; -import org.nuiton.util.beans.BinderFactory; import javax.swing.*; import java.awt.event.ActionEvent; @@ -59,9 +53,7 @@ import java.beans.PropertyChangeListener; import java.math.BigDecimal; import java.text.DateFormat; import java.util.Calendar; -import java.util.Collection; import java.util.Date; -import java.util.Iterator; import java.util.List; import java.util.Locale; @@ -87,7 +79,7 @@ public class AccountViewerViewHandler { protected FinancialTransactionService financialTransactionService; protected FiscalPeriodService fiscalPeriodService; - protected LetteringFilterImpl filter; + protected AccountViewerFilter filter; protected AccountViewerEditModel editModel; @@ -100,6 +92,7 @@ public class AccountViewerViewHandler { protected boolean initializationComplete; public AccountViewerViewHandler(AccountViewerView view) { + initializationComplete = false; this.view = view; initShortCuts(); @@ -117,9 +110,11 @@ public class AccountViewerViewHandler { * Init all combo box in view. */ public void init() { - filter = new LetteringFilterImpl(); + filter = new AccountViewerFilter(); editModel = view.getEditModel(); - initViewWithDefaultFinancialPeriod(); + initFiscalPeriodView(); + initDefaultFinancialPeriodView(); + initSoldPeriodView(); editModel.addPropertyChangeListener(AccountViewerEditModel.PROPERTY_DEBIT, new PropertyChangeListener() { @Override @@ -157,7 +152,6 @@ public class AccountViewerViewHandler { SwingUtil.fixTableColumnWidth(view.getTable(), 4, 50); initializationComplete = true; - updateAllEntries(null); updateSoldStatus(); } @@ -170,7 +164,6 @@ public class AccountViewerViewHandler { //To block reaction of the dual key 'ctrl+a' (Selection of all lines) inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_A, InputEvent.CTRL_MASK), "none"); - // refresh binding = "refresh"; inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_F5, 0), binding); @@ -193,28 +186,30 @@ public class AccountViewerViewHandler { } protected void onPeriodChoiceChanged(PeriodChoice periodChoice) { - if (initializationComplete) { - switch (periodChoice) { - case FINANCIAL_PERIOD: - view.getFiscalPeriodComboBox().setVisible(false); - view.getFinancialPeriodComboBox().setVisible(true); - view.getBeginPeriodPicker().setVisible(false); - view.getEndPeriodPicker().setVisible(false); - initViewWithDefaultFinancialPeriod(); - break; - case FISCAL_PERIOD: - view.getFiscalPeriodComboBox().setVisible(true); - view.getFinancialPeriodComboBox().setVisible(false); - view.getBeginPeriodPicker().setVisible(false); - view.getEndPeriodPicker().setVisible(false); - initFiscalPeriodModel(); - break; - case DATE: - view.getFiscalPeriodComboBox().setVisible(false); - view.getFinancialPeriodComboBox().setVisible(false); - view.getBeginPeriodPicker().setVisible(true); - view.getEndPeriodPicker().setVisible(true); - break; + if (initializationComplete && !filter.getPeriodChoice().equals(periodChoice)) { + filter.setPeriodChoice(periodChoice); + switch (periodChoice) { + case FINANCIAL_PERIOD: + view.getFiscalPeriodComboBox().setVisible(true); + view.getFinancialPeriodComboBox().setVisible(true); + view.getBeginPeriodPicker().setVisible(false); + view.getEndPeriodPicker().setVisible(false); + initDefaultFinancialPeriodView(); + break; + case FISCAL_PERIOD: + view.getFiscalPeriodComboBox().setVisible(true); + view.getFinancialPeriodComboBox().setVisible(false); + view.getBeginPeriodPicker().setVisible(false); + view.getEndPeriodPicker().setVisible(false); + initFiscalPeriodView(); + break; + case DATE: + view.getFiscalPeriodComboBox().setVisible(false); + view.getFinancialPeriodComboBox().setVisible(false); + view.getBeginPeriodPicker().setVisible(true); + view.getEndPeriodPicker().setVisible(true); + initDateIntervalView(); + break; } updateAllEntries(null); } @@ -256,31 +251,48 @@ public class AccountViewerViewHandler { } protected void onFiscalPeriodChange(java.awt.event.ItemEvent event) { - if (initializationComplete) { - FiscalPeriod fiscalPeriod = (FiscalPeriod) event.getItem(); - updateAllEntriesForFiscalPeriodChange(fiscalPeriod); + FiscalPeriod fiscalPeriod = (FiscalPeriod) event.getItem(); + if (initializationComplete && filter.getFiscalPeriod() != fiscalPeriod) { + filter.setFiscalPeriod(fiscalPeriod); + + //FISCAL_PERIOD + if (PeriodChoice.FISCAL_PERIOD.equals(view.getPeriodChoice().getSelectedItem())) { + updateAllEntriesForFiscalPeriodChange(fiscalPeriod); + } else { + //FINANCIAL_PERIOD + initDefaultFinancialPeriodView(); + } } } protected void onFinancialPeriodChange(java.awt.event.ItemEvent event) { - if (initializationComplete) { - FinancialPeriod financialPeriod = (FinancialPeriod) event.getItem(); + FinancialPeriod financialPeriod = (FinancialPeriod) event.getItem(); + if (initializationComplete && filter.getFinancialPeriod() != financialPeriod) { + filter.setFinancialPeriod(financialPeriod); updateAllEntriesForFinancialPeriodChange(financialPeriod); } } public void onDateStartChange(Date date) { if (initializationComplete) { - filter.setDateStart(date); - updateAllEntriesForDateChange(); + if (date != null && !DateUtils.isSameDay(date, filter.getDateStart())) { + filter.setDateStart(date); + if (filter.getDateEnd().before(date)) { + filter.setDateEnd(filter.getDateEnd().before(date) ? date : filter.getDateEnd()); + view.getEndPeriodPicker().setDate(filter.getDateEnd()); + } + updateAllEntriesForDateChange(); + } } } public void onDateEndChange(Date date) { if (initializationComplete) { - filter.setDateEnd(date); - updateAllEntriesForDateChange(); + if (date != null && !DateUtils.isSameDay(date, filter.getDateEnd())) { + filter.setDateEnd(date); + updateAllEntriesForDateChange(); + } } } @@ -300,32 +312,32 @@ public class AccountViewerViewHandler { public void updateSoldStatus() { if (initializationComplete) { - view.getBalanceStatusLabel().setText(t("lima.lettering.accountViewerBalanceStatus", - getDateFormat().format(editModel.getFiscalPeriodBeginDate()), - getDateFormat().format(filter.getDateEnd()), - - BigDecimalToString.format(editModel.getGlobalDebit()), - BigDecimalToString.format(editModel.getGlobalCredit()), - BigDecimalToString.format(editModel.getGlobalSold()), - - BigDecimalToString.format(editModel.getDebit()), - BigDecimalToString.format(editModel.getCredit()), - BigDecimalToString.format(editModel.getSold()))); + view.getSelectionDescription().setText(t("lima.accountViewer.selectionDescription")); + view.getSelectionDebit().setText(BigDecimalToString.format(editModel.getDebit())); + view.getSelectionCredit().setText(BigDecimalToString.format(editModel.getCredit())); + view.getSelectionSold().setText(BigDecimalToString.format(editModel.getSold())); } } public void updateAllEntriesForFiscalPeriodChange(FiscalPeriod fiscalPeriod) { - filter.setDateStart(fiscalPeriod.getBeginDate()); - filter.setDateEnd(fiscalPeriod.getEndDate()); + if (!DateUtils.isSameDay(fiscalPeriod.getBeginDate(), filter.getDateStart()) || + !DateUtils.isSameDay(fiscalPeriod.getEndDate(), filter.getDateEnd())) { + filter.setDateStart(fiscalPeriod.getBeginDate()); + filter.setDateEnd(fiscalPeriod.getEndDate()); - updateAllEntries(fiscalPeriod); + updateAllEntries(fiscalPeriod); + } } public void updateAllEntriesForFinancialPeriodChange(FinancialPeriod financialPeriod) { - filter.setDateStart(financialPeriod.getBeginDate()); - filter.setDateEnd(financialPeriod.getEndDate()); - updateAllEntries(null); + if (!DateUtils.isSameDay(financialPeriod.getBeginDate(), filter.getDateStart()) || + !DateUtils.isSameDay(financialPeriod.getEndDate(), filter.getDateEnd())) { + filter.setDateStart(financialPeriod.getBeginDate()); + filter.setDateEnd(financialPeriod.getEndDate()); + + updateAllEntries(null); + } } public void updateAllEntriesForDateChange() { @@ -333,91 +345,95 @@ public class AccountViewerViewHandler { } public void updateAllEntries(FiscalPeriod fiscalPeriod) { - if (initializationComplete && filter.getAccount() != null && filter.getDateStart() != null && filter.getDateEnd() != null) { - - List<Entry> entriesAndResume = Lists.newArrayList(); - List<Entry> entries = financialTransactionService.getAllEntrieByDatesAndAccountAndLettering(filter); fiscalPeriod = fiscalPeriod == null ? fiscalPeriodService.getFiscalPeriodForDate(filter.getDateStart()) : fiscalPeriod; + LetteringFilter previousPeriodFilter = computePreviousPeriodFilter(fiscalPeriod); + LetteringFilter actualPeriodFilter = computeActualPeriodFilter(fiscalPeriod); + setViewPreviousSold(previousPeriodFilter); + setViewActualSold(fiscalPeriod, actualPeriodFilter); - if (CollectionUtils.isNotEmpty(entries)) { - // can be null if there are no fiscal period for the begin date - if (fiscalPeriod != null) { - LetteringFilter previousPeriodFilter = computePreviousPeriodFilter(fiscalPeriod); - LetteringFilter actualPeriodFilter = computeActualPeriodFilter(fiscalPeriod); - addPreviousSoldToModel(previousPeriodFilter); - addPreviousSoldEntryToEntries(entriesAndResume, entries, previousPeriodFilter); - addActualSoldToModel(fiscalPeriod, actualPeriodFilter); - } - } - entriesAndResume.addAll(entries); - view.getTableModel().setValues(entriesAndResume); + view.getTableModel().setValues(entries); } onBalanceChanged(null); } - public void initFiscalPeriodModel() { + public void initFiscalPeriodView() { + List<FiscalPeriod> fiscalPeriods = fiscalPeriodService.getAllFiscalPeriods(); + view.getFiscalPeriodComboBoxModel().setObjects(fiscalPeriods); + FiscalPeriod fiscalPeriod = fiscalPeriodService.getLastFiscalPeriod(); if (fiscalPeriod != null) { + filter.setFiscalPeriod(fiscalPeriod); + filter.setDateStart(fiscalPeriod.getBeginDate()); + filter.setDateEnd(fiscalPeriod.getEndDate()); view.getFiscalPeriodComboBox().setSelectedItem(fiscalPeriod); - view.getBeginPeriodPicker().setDate(fiscalPeriod.getBeginDate()); - view.getEndPeriodPicker().setDate(fiscalPeriod.getEndDate()); + view.getFiscalPeriodComboBox().setVisible(true); } } - public void initViewWithDefaultFinancialPeriod() { - List<FinancialPeriod> financialPeriods = financialPeriodService.getAllFinancialPeriods(); - view.getFinancialPeriodComboBoxModel().setObjects(financialPeriods); - - FiscalPeriod fiscalPeriod = fiscalPeriodService.getLastFiscalPeriod(); - - FinancialPeriod defaultFinancialPeriod = getDefaultFinancialPeriod(financialPeriods, fiscalPeriod); - - Calendar calendar = Calendar.getInstance(); - int lastCurrentMonthDay = calendar.getActualMaximum(Calendar.DATE); - int firstCurrentMonthDay = calendar.getActualMinimum(Calendar.DATE); - - Date defaultDateBeginFinancialPeriod, defaultDateEndCurrent; - defaultDateBeginFinancialPeriod = defaultFinancialPeriod == null ? DateUtils.setDays(new Date(), firstCurrentMonthDay) : defaultFinancialPeriod.getBeginDate(); - defaultDateEndCurrent = defaultFinancialPeriod == null ? DateUtils.setDays(new Date(), lastCurrentMonthDay) : defaultFinancialPeriod.getEndDate(); - - view.getFinancialPeriodComboBoxModel().setSelectedItem(defaultFinancialPeriod); - - view.getBeginPeriodPicker().setDate(defaultDateBeginFinancialPeriod); - view.getEndPeriodPicker().setDate(defaultDateEndCurrent); - - filter.setDateStart(defaultDateBeginFinancialPeriod); - filter.setDateEnd(defaultDateEndCurrent); + public void initDateIntervalView() { + FiscalPeriod fiscalPeriod = (FiscalPeriod) view.getFiscalPeriodComboBox().getSelectedItem(); + FinancialPeriod defaultFinancialPeriod; + if (fiscalPeriod != null) { + Date today = new Date(); + defaultFinancialPeriod = financialPeriodService.getFinancialForDate(today); - editModel.setFiscalPeriodBeginDate(fiscalPeriod != null ? fiscalPeriod.getBeginDate() : defaultDateBeginFinancialPeriod); + if (defaultFinancialPeriod == null) { + defaultFinancialPeriod = financialPeriodService.getFinancialForDate(fiscalPeriod.getEndDate()); + } + filter.setDateStart(defaultFinancialPeriod.getBeginDate()); + filter.setDateEnd(defaultFinancialPeriod.getEndDate()); + view.getBeginPeriodPicker().setDate(defaultFinancialPeriod.getBeginDate()); + view.getEndPeriodPicker().setDate(defaultFinancialPeriod.getEndDate()); + } } - protected FinancialPeriod getDefaultFinancialPeriod(List<FinancialPeriod> financialPeriods, FiscalPeriod fiscalPeriod) { - FinancialPeriod defaultFinancialPeriod = null; + public void initDefaultFinancialPeriodView() { + FiscalPeriod fiscalPeriod = (FiscalPeriod) view.getFiscalPeriodComboBox().getSelectedItem(); - if ((fiscalPeriod != null && fiscalPeriod.getFinancialPeriod() != null)) { - - Collection<FinancialPeriod> fiscalPeriodFinancialPeriods = financialPeriodService.getFinancialPeriods(fiscalPeriod.getBeginDate(), fiscalPeriod.getEndDate()); - Iterator<FinancialPeriod> financialPeriodIterator = fiscalPeriodFinancialPeriods.iterator(); - if (financialPeriodIterator.hasNext()) { - defaultFinancialPeriod = financialPeriodIterator.next(); + FinancialPeriod defaultFinancialPeriod = null; + if (fiscalPeriod != null) { + List<FinancialPeriod> financialPeriods = financialPeriodService.getFinancialPeriodsWithBeginDateWithin(fiscalPeriod.getBeginDate(), fiscalPeriod.getEndDate()); + view.getFinancialPeriodComboBoxModel().setObjects(financialPeriods); + + boolean isCurrentDatePartOfSelectedFiscalPeriod; + Date today = new Date(); + isCurrentDatePartOfSelectedFiscalPeriod = fiscalPeriod.getBeginDate().before(today) && (fiscalPeriod.getEndDate().after(today)); + if (isCurrentDatePartOfSelectedFiscalPeriod) { + defaultFinancialPeriod = financialPeriodService.getFinancialForDate(today); + } else if (!financialPeriods.isEmpty()) { + defaultFinancialPeriod = financialPeriods.get(financialPeriods.size() - 1); } + view.getFinancialPeriodComboBoxModel().setSelectedItem(defaultFinancialPeriod); } - defaultFinancialPeriod = defaultFinancialPeriod != null ? defaultFinancialPeriod : CollectionUtils.isNotEmpty(financialPeriods) ? financialPeriods.get(0) : null; - return defaultFinancialPeriod; + Date defaultDateBegin, defaultDateEnd; + Calendar calendar = Calendar.getInstance(); + int firstCurrentMonthDay = calendar.getActualMinimum(Calendar.DATE); + int lastCurrentMonthDay = calendar.getActualMaximum(Calendar.DATE); + defaultDateBegin = defaultFinancialPeriod == null ? DateUtils.setDays(new Date(), firstCurrentMonthDay) : defaultFinancialPeriod.getBeginDate(); + defaultDateEnd = defaultFinancialPeriod == null ? DateUtils.setDays(new Date(), lastCurrentMonthDay) : defaultFinancialPeriod.getEndDate(); + + filter.setDateStart(defaultDateBegin); + filter.setDateEnd(defaultDateEnd); + + editModel.setFiscalPeriodBeginDate(defaultFinancialPeriod != null ? defaultFinancialPeriod.getBeginDate() : defaultDateBegin); } - protected void addPreviousSoldEntryToEntries(List<Entry> entriesAndResume, List<Entry> entries, LetteringFilter previousPeriodFilter) { - // no previous sold to add if selected starting date is same as fiscal period one - if (!DateUtils.isSameDay(filter.getDateStart(), previousPeriodFilter.getDateStart()) && CollectionUtils.isNotEmpty(entries)) { - entriesAndResume.add(getFirstLinePreviousSoldEntry(entries, previousPeriodFilter)); - } + protected void initSoldPeriodView() { + view.getBeginPeriodSummary().setText(String.format("Pour la période du %s au %s,", getDateFormat().format(editModel.getFiscalPeriodBeginDate()), getDateFormat().format(filter.getDateEnd()))); + view.getBeginDebit().setText(BigDecimalToString.format(BigDecimal.ZERO)); + view.getBeginCredit().setText(BigDecimalToString.format(BigDecimal.ZERO)); + view.getBeginSold().setText(BigDecimalToString.format(BigDecimal.ZERO)); + view.getEndPeriodSummary().setText(String.format("Pour la période du %s au %s,", getDateFormat().format(editModel.getFiscalPeriodBeginDate()), getDateFormat().format(filter.getDateEnd()))); + view.getEndDebit().setText(BigDecimalToString.format(BigDecimal.ZERO)); + view.getEndCredit().setText(BigDecimalToString.format(BigDecimal.ZERO)); + view.getEndSold().setText(BigDecimalToString.format(BigDecimal.ZERO)); } protected void addFiscalPeriodBeginDate(FiscalPeriod fiscalPeriod) { @@ -426,45 +442,25 @@ public class AccountViewerViewHandler { } } - protected Entry getFirstLinePreviousSoldEntry(List<Entry> entries, LetteringFilter previousPeriodFilter) { - Entry firstEntry = entries.get(0); - FinancialTransaction firstTransaction = firstEntry.getFinancialTransaction(); - FinancialTransaction firstLineTransaction = new FinancialTransactionImpl(); - Binder<FinancialTransaction, FinancialTransaction> binder = BinderFactory.newBinder(FinancialTransaction.class); - binder.copyExcluding(firstTransaction, firstLineTransaction, FinancialTransaction.PROPERTY_TOPIA_ID); - Date previousSoldEndDate = getDayMinus1Calendar(previousPeriodFilter).getTime(); - firstLineTransaction.setTransactionDate(previousSoldEndDate); - - Entry resumeEntry = new EntryImpl(); - resumeEntry.setDescription(String.format(t("lima.accountViewer.previousSold"), getDateFormat().format(previousSoldEndDate))); - resumeEntry.setAmount(view.getTableModel().getPreviousPeriodSold().abs()); - resumeEntry.setDebit(BigDecimal.ZERO.compareTo(view.getTableModel().getPreviousPeriodSold()) < 0); - resumeEntry.setFinancialTransaction(firstLineTransaction); - return resumeEntry; - } - - protected void addPreviousSoldToModel(LetteringFilter previousPeriodFilter) { - BigDecimal previousSold; - if (previousPeriodFilter == null) { - previousSold = BigDecimal.ZERO; - } else { - List<Object[]> initialDebitCredit = financialTransactionService.getAccountEntriesDebitCreditFromIncludingToExcludingPeriod(previousPeriodFilter); - DebitCreditSold debitCreditSold = new DebitCreditSold().invoke(initialDebitCredit); - previousSold = debitCreditSold.getSold(); - } - view.getTableModel().setPreviousPeriodSold(previousSold); + protected void setViewPreviousSold(LetteringFilter previousPeriodFilter) { + List<Object[]> initialDebitCredit = financialTransactionService.getAccountEntriesDebitCreditFromIncludingToExcludingPeriod(previousPeriodFilter); + DebitCreditSold debitCreditSold = new DebitCreditSold().invoke(initialDebitCredit); + view.getBeginPeriodSummary().setText(String.format("Pour la période du %s au %s,", getDateFormat().format(previousPeriodFilter.getDateStart()), getDateFormat().format(previousPeriodFilter.getDateEnd()))); + view.getBeginDebit().setText(BigDecimalToString.format(debitCreditSold.getDebit())); + view.getBeginCredit().setText(BigDecimalToString.format(debitCreditSold.getCredit())); + view.getBeginSold().setText(BigDecimalToString.format(debitCreditSold.getSold())); } - protected void addActualSoldToModel(FiscalPeriod fiscalPeriod, LetteringFilter actualPeriodFilter) { + protected void setViewActualSold(FiscalPeriod fiscalPeriod, LetteringFilter actualPeriodFilter) { addFiscalPeriodBeginDate(fiscalPeriod); List<Object[]> initialDebitCredit = financialTransactionService.getAccountEntriesDebitCreditFromIncludingToIncludingPeriod(actualPeriodFilter); DebitCreditSold debitCreditSold = new DebitCreditSold().invoke(initialDebitCredit); - editModel.setGlobalDebit(debitCreditSold.getDebit()); - editModel.setGlobalCredit(debitCreditSold.getCredit()); - editModel.setGlobalSold(debitCreditSold.getSold()); + view.getEndPeriodSummary().setText(String.format("Pour la période du %s au %s,", getDateFormat().format(actualPeriodFilter.getDateStart()), getDateFormat().format(actualPeriodFilter.getDateEnd()))); + view.getEndDebit().setText(BigDecimalToString.format(debitCreditSold.getDebit())); + view.getEndCredit().setText(BigDecimalToString.format(debitCreditSold.getCredit())); + view.getEndSold().setText(BigDecimalToString.format(debitCreditSold.getSold())); } - public void balanceAndActions() { if (log.isDebugEnabled()) { log.debug("balanceAndActions"); @@ -541,27 +537,19 @@ public class AccountViewerViewHandler { } protected LetteringFilter computePreviousPeriodFilter(FiscalPeriod fiscalPeriod) { - LetteringFilter previousPeriodFilter = null; - - if (fiscalPeriod != null) { - previousPeriodFilter = new LetteringFilterImpl(); - previousPeriodFilter.setDateStart(fiscalPeriod.getBeginDate()); - previousPeriodFilter.setDateEnd(filter.getDateStart()); - previousPeriodFilter.setAccount(filter.getAccount()); - } + LetteringFilter previousPeriodFilter = new LetteringFilterImpl(); + previousPeriodFilter.setDateStart(fiscalPeriod == null ? filter.getDateStart() : fiscalPeriod.getBeginDate()); + previousPeriodFilter.setDateEnd(filter.getDateStart()); + previousPeriodFilter.setAccount(filter.getAccount()); return previousPeriodFilter; } private LetteringFilter computeActualPeriodFilter(FiscalPeriod fiscalPeriod) { - LetteringFilter actualPeriodFilter = null; - - if (fiscalPeriod != null) { - actualPeriodFilter = new LetteringFilterImpl(); - actualPeriodFilter.setDateStart(fiscalPeriod.getBeginDate()); - actualPeriodFilter.setDateEnd(filter.getDateEnd()); - actualPeriodFilter.setAccount(filter.getAccount()); - } + LetteringFilter actualPeriodFilter = new LetteringFilterImpl(); + actualPeriodFilter.setDateStart(fiscalPeriod == null ? filter.getDateStart() : fiscalPeriod.getBeginDate()); + actualPeriodFilter.setDateEnd(filter.getDateEnd()); + actualPeriodFilter.setAccount(filter.getAccount()); return actualPeriodFilter; } diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/accountViewer/FinancialPeriodListRenderer.java b/lima-swing/src/main/java/org/chorem/lima/ui/accountViewer/FinancialPeriodListRenderer.java deleted file mode 100644 index cb1498c..0000000 --- a/lima-swing/src/main/java/org/chorem/lima/ui/accountViewer/FinancialPeriodListRenderer.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * #%L - * Lima :: Swing - * %% - * Copyright (C) 2012 Codelutin, Chatellier Eric - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -package org.chorem.lima.ui.accountViewer; - -import org.chorem.lima.LimaSwingConfig; -import org.chorem.lima.entity.FinancialPeriod; - -import javax.swing.*; -import java.awt.*; -import java.text.DateFormat; -import java.util.Locale; - -/** - * Financial period list renderer. - * - * @author chatellier - * @version $Revision$ - * - * Last update : $Date$ - * By : $Author$ - */ -public class FinancialPeriodListRenderer extends DefaultListCellRenderer { - - /** serialVersionUID. */ - private static final long serialVersionUID = -1L; - - // afiche le mois en lettre et le numero de la période, pour eviter les confusions entre deux mois identique pour des exercice de plus de 12 mois - - @Override - public Component getListCellRendererComponent(JList list, Object value, - int index, boolean isSelected, boolean cellHasFocus) { - - FinancialPeriod financialPeriod = (FinancialPeriod)value; - Object newValue = financialPeriod; - if (financialPeriod != null) { - newValue = String.format("%s - %s", getDateFormat().format(financialPeriod.getBeginDate()), getDateFormat().format(financialPeriod.getEndDate())); - } - return super.getListCellRendererComponent(list, newValue, index, isSelected, - cellHasFocus); - } - - protected DateFormat getDateFormat() { - Locale locale = LimaSwingConfig.getInstance().getLocale(); - DateFormat result = DateFormat.getDateInstance(DateFormat.SHORT, locale); - return result; - } - -} diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionViewHandler.java b/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionViewHandler.java index c4b7466..72da3fe 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionViewHandler.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionViewHandler.java @@ -302,8 +302,8 @@ public class FinancialTransactionViewHandler implements ServiceListener, TableMo if ( event.getStateChange() == ItemEvent.SELECTED ) { FiscalPeriod selectedFiscalPeriod = (FiscalPeriod) event.getItem(); - List<FinancialPeriod> financialPeriods = financialPeriodService.getFinancialPeriods(selectedFiscalPeriod.getBeginDate(), - selectedFiscalPeriod.getEndDate()); + List<FinancialPeriod> financialPeriods = financialPeriodService.getFinancialPeriodsWithBeginDateWithin(selectedFiscalPeriod.getBeginDate(), + selectedFiscalPeriod.getEndDate()); if (log.isDebugEnabled()) { log.debug(String.format("Loaded %d financial periods", financialPeriods.size())); diff --git a/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties b/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties index ccb31c0..75c5b61 100644 --- a/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties +++ b/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties @@ -14,6 +14,7 @@ lima.account.remove.error.usedAccount=There are financial statement on this acco lima.account.update.error.invalidAccountNumber=Invalid account number\: %1$s lima.account.update.form=Update account lima.accountViewer.previousSold=<html><b>On %s the sold was</b></html> +lima.accountViewer.selectionDescription=For selected entries, lima.accounts=Accounts lima.action.commandline.help=Show help in console lima.balance=Balance @@ -507,6 +508,7 @@ lima.table.label=Label lima.table.letter=Letter lima.table.number=Account Number lima.table.provisionDeprecation=Provision Deprecation +lima.table.sold= lima.table.voucher=Voucher lima.title=Lutin Invoice Monitoring and Accounting lima.transaction=Transaction diff --git a/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties b/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties index 0b27199..6de9feb 100644 --- a/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties +++ b/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties @@ -16,6 +16,7 @@ lima.account.remove.error.usedAccount=Il exist des transactions sur ce compte lima.account.update.error.invalidAccountNumber=Le numéro du compte %1$s n'est pas valide lima.account.update.form=Modification d'un compte lima.accountViewer.previousSold=<html><b>Solde au %s</b></html> +lima.accountViewer.selectionDescription=Pour la sélection, lima.accounts=Comptes lima.action.commandline.help=Afficher l'aide en console lima.balance=Équilibrer @@ -514,6 +515,7 @@ lima.table.label=Libellé lima.table.letter=Lettre lima.table.number=Numéro de compte lima.table.provisionDeprecation=Amortissements et provisions +lima.table.sold= lima.table.voucher=Pièce comptable lima.title=Lutin Invoice Monitoring and Accounting lima.transaction=Transaction -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
participants (1)
-
chorem.org scm