This is an automated email from the git hooks/post-receive script. New commit to branch feature/1173_ajout_toto in repository lima. See http://git.chorem.org/lima.git commit 341015650c116d0c09ae378d05c6a57e17523d13 Author: dcosse <cosse@codelutin.com> Date: Fri Feb 27 17:36:17 2015 +0100 fixes #1178 formatage des nombres selon la configuration utilisateur, ajout de la balance, affichage en rouge de la balance si balance !=0 --- .../financialtransaction/FinancialTransactionView.css | 1 + .../FinancialTransactionView.jaxx | 19 +++++-------------- .../FinancialTransactionViewHandler.java | 19 +++++++++++++------ .../main/resources/i18n/lima-swing_en_GB.properties | 2 ++ .../main/resources/i18n/lima-swing_fr_FR.properties | 2 ++ 5 files changed, 23 insertions(+), 20 deletions(-) diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionView.css b/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionView.css index 451745b..de16542 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionView.css +++ b/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionView.css @@ -129,4 +129,5 @@ #statusLabel { text: {getStatusText()}; horizontalTextPosition:{JLabel.RIGHT}; + border: {BorderFactory.createEmptyBorder(0, 20, 0, 0)} } \ No newline at end of file diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionView.jaxx b/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionView.jaxx index 0805eb8..67c2962 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionView.jaxx +++ b/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionView.jaxx @@ -22,15 +22,16 @@ <JPanel layout="{new BorderLayout()}"> <import> - javax.swing.ListSelectionModel - javax.swing.DefaultListSelectionModel - org.chorem.lima.entity.FiscalPeriod - org.chorem.lima.entity.FinancialPeriod org.chorem.lima.entity.EntryBook + org.chorem.lima.entity.FinancialPeriod + org.chorem.lima.entity.FiscalPeriod org.chorem.lima.ui.common.EntryBookListRenderer org.chorem.lima.ui.common.FinancialTransactionTableModel java.awt.event.KeyEvent + javax.swing.BorderFactory + javax.swing.DefaultListSelectionModel javax.swing.KeyStroke + javax.swing.ListSelectionModel </import> <FinancialTransactionViewHandler id="handler" constructorParams="this"/> @@ -141,15 +142,5 @@ <JPanel constraints="BorderLayout.SOUTH" layout="{new BorderLayout()}"> <JLabel id='statusLabel' constraints="BorderLayout.EAST"/> </JPanel> - <!--Table fill="both" weightx="1" constraints="BorderLayout.SOUTH"> - <row> - <cell weightx="1"> - <JLabel/> - </cell> - <cell anchor="east"> - <JLabel id='statusLabel'/> - </cell> - </row> - </Table--> </JPanel> 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 11d5967..c65b720 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 @@ -47,6 +47,7 @@ import org.chorem.lima.entity.FinancialTransactionImpl; import org.chorem.lima.entity.FiscalPeriod; import org.chorem.lima.service.LimaServiceFactory; import org.chorem.lima.ui.common.FinancialTransactionTableModel; +import org.chorem.lima.util.BigDecimalToString; import org.chorem.lima.util.ErrorHelper; import javax.swing.*; @@ -144,9 +145,9 @@ public class FinancialTransactionViewHandler implements ServiceListener, TableMo public void tableChanged(TableModelEvent e) { boolean mustRecompute = e.getType() == TableModelEvent.DELETE - || e.getType() == TableModelEvent.INSERT - || (e.getType() == TableModelEvent.UPDATE && - (e.getColumn() == TableModelEvent.ALL_COLUMNS || e.getColumn() == 4 || e.getColumn() == 5)); + || e.getType() == TableModelEvent.INSERT + || (e.getType() == TableModelEvent.UPDATE && + (e.getColumn() == TableModelEvent.ALL_COLUMNS || e.getColumn() == 4 || e.getColumn() == 5)); if (mustRecompute) { computeStatusText(); @@ -972,11 +973,12 @@ public class FinancialTransactionViewHandler implements ServiceListener, TableMo } protected void computeStatusText() { - + String result; FinancialTransactionTableModel tableModel = view.getFinancialTransactionTableModel(); BigDecimal totalDebit = BigDecimal.ZERO; BigDecimal totalCredit = BigDecimal.ZERO; + BigDecimal balance = BigDecimal.ZERO; for (Entry entry : tableModel.getValues()) { @@ -989,8 +991,13 @@ public class FinancialTransactionViewHandler implements ServiceListener, TableMo } } - //TODO Just do mi ! - String result = String.format("<html>Débit <strong><font color=#ffffdd>%s</font></strong> - Crédit <b>%s</b>", totalDebit, totalCredit); + balance = totalDebit.subtract(totalCredit); + if (balance.compareTo(BigDecimal.ZERO) == 0) { + result = String.format(t("lima.financialTransaction.statusTextDebitCredit"), BigDecimalToString.format(totalDebit), BigDecimalToString.format(totalCredit), BigDecimalToString.format(balance)); + } else { + result = String.format(t("lima.financialTransaction.statusTextDebitCreditError"), BigDecimalToString.format(totalDebit), BigDecimalToString.format(totalCredit), BigDecimalToString.format(balance)); + } + view.setStatusText(result); } 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 ec5e45f..f8e6fe0 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 @@ -278,6 +278,8 @@ lima.financialTransaction.day=Day lima.financialTransaction.nextFinancialPeriod= lima.financialTransaction.previousFinancialPeriod= lima.financialTransaction.remove.confirm= +lima.financialTransaction.statusTextDebitCredit=<html>Debit\: <b>%s</b> - Credit\: <b>%s</b> - Balance\: <b>%s</b> +lima.financialTransaction.statusTextDebitCreditError=<html>Debit\: <b>%s</b> - Credit\: <b>%s</b> - Balance\: <b><font color\=\#ff4000>%s</font></b> lima.financialTransaction.update.error.afterLastFiscalPeriod= lima.financialTransaction.update.error.beforeFirstFiscalPeriod= lima.financialTransaction.update.error.lockedEntryBook= 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 33f0270..282493f 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 @@ -290,6 +290,8 @@ lima.financialTransaction.day=Jour lima.financialTransaction.nextFinancialPeriod=Période suivante lima.financialTransaction.previousFinancialPeriod=Période précédente lima.financialTransaction.remove.confirm=Voulez-vous supprimer cette transaction? +lima.financialTransaction.statusTextDebitCredit=<html>Débit\: <b>%s</b> - Crédit\: <b>%s</b> - Balance\: <b>%s</b> +lima.financialTransaction.statusTextDebitCreditError=<html>Débit\: <b>%s</b> - Crédit\: <b>%s</b> - Balance\: <b><font color\=\#ff4000>%s</font></b> lima.financialTransaction.update.error.afterLastFiscalPeriod=Impossible de déplacer une transaction après le %1$te %1$tB %1$tY fin du dernier exercice. lima.financialTransaction.update.error.beforeFirstFiscalPeriod=Impossible de déplacer une transaction avant le %1$te %1$tB %1$tY début du premier exercice. lima.financialTransaction.update.error.lockedEntryBook=Impossible de déplacer une transaction car le jounal %2$s (%1$s) est cloturé pour la période du %3$te %3$tB %3$tY au %4$te %4$tB %4$tY. -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.