This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository lima. See http://git.chorem.org/lima.git commit 565f06b1c1d636c2188fdf08e1d390222cc7d089 Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Fri May 15 14:50:48 2015 +0200 fixes #1208 : ajouter le moi en toutes lettres + afficher la période dans la bar de statut --- .../ui/common/FinancialPeriodListRenderer.java | 14 +++++++++----- .../FinancialTransactionView.css | 13 +++++++++---- .../FinancialTransactionView.jaxx | 5 ++--- .../FinancialTransactionViewHandler.java | 22 +++++++++++++++++----- .../resources/i18n/lima-swing_en_GB.properties | 1 + .../resources/i18n/lima-swing_fr_FR.properties | 1 + 6 files changed, 39 insertions(+), 17 deletions(-) diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/common/FinancialPeriodListRenderer.java b/lima-swing/src/main/java/org/chorem/lima/ui/common/FinancialPeriodListRenderer.java index e6fcdd2..b973b78 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/common/FinancialPeriodListRenderer.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/common/FinancialPeriodListRenderer.java @@ -24,9 +24,9 @@ package org.chorem.lima.ui.common; import org.chorem.lima.entity.FinancialPeriod; -import javax.swing.*; -import java.awt.*; -import java.text.SimpleDateFormat; +import javax.swing.DefaultListCellRenderer; +import javax.swing.JList; +import java.awt.Component; /** * Financial period list renderer. @@ -42,7 +42,7 @@ public class FinancialPeriodListRenderer extends DefaultListCellRenderer { /** serialVersionUID. */ private static final long serialVersionUID = -9089182547408397051L; - protected SimpleDateFormat df = new SimpleDateFormat("MM"); + // 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, @@ -51,7 +51,11 @@ public class FinancialPeriodListRenderer extends DefaultListCellRenderer { FinancialPeriod financialPeriod = (FinancialPeriod)value; Object newValue = financialPeriod; if (financialPeriod != null) { - newValue = df.format(financialPeriod.getBeginDate()); + // index = -1 pour la valeur sectionné + if (index < 0) { + index = list.getSelectedIndex(); + } + newValue = String.format("%1$tB (%2$d)", financialPeriod.getBeginDate(), index + 1); } return super.getListCellRendererComponent(list, newValue, index, isSelected, cellHasFocus); 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 de16542..ba07282 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 @@ -126,8 +126,13 @@ rowHeight : 22; } -#statusLabel { - text: {getStatusText()}; +#periodStatusLabel { + horizontalTextPosition:{JLabel.LEFT}; + border: {BorderFactory.createEmptyBorder(0, 5, 0, 0)} +} + +#balanceStatusLabel { horizontalTextPosition:{JLabel.RIGHT}; - border: {BorderFactory.createEmptyBorder(0, 20, 0, 0)} -} \ No newline at end of file + border: {BorderFactory.createEmptyBorder(0, 0, 0, 0)} +} + 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 67c2962..0d2b9c0 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 @@ -137,10 +137,9 @@ model='{financialTransactionTableModel}'/> </JScrollPane> - <String id="statusText" javaBean=''/> - <JPanel constraints="BorderLayout.SOUTH" layout="{new BorderLayout()}"> - <JLabel id='statusLabel' constraints="BorderLayout.EAST"/> + <JLabel id='periodStatusLabel' constraints="BorderLayout.WEST"/> + <JLabel id='balanceStatusLabel' constraints="BorderLayout.EAST"/> </JPanel> </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 f65d248..98279e9 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 @@ -155,7 +155,7 @@ public class FinancialTransactionViewHandler implements ServiceListener, TableMo (e.getColumn() == TableModelEvent.ALL_COLUMNS || e.getColumn() == 4 || e.getColumn() == 5)); if (mustRecompute) { - computeStatusText(); + computeBalanceStatusText(); } } @@ -322,6 +322,7 @@ public class FinancialTransactionViewHandler implements ServiceListener, TableMo public void financialPeriodSelected(ItemEvent event) { if ( event.getStateChange() == ItemEvent.SELECTED ) { updateFinancialTransactions(); + computePeriodStatusText(); } } @@ -980,7 +981,18 @@ public class FinancialTransactionViewHandler implements ServiceListener, TableMo return lastAssignDate; } - protected void computeStatusText() { + protected void computePeriodStatusText() { + + FinancialPeriod period = (FinancialPeriod) view.getFinancialPeriodComboBoxModel().getSelectedItem(); + + String result = t("lima.financialTransaction.statusTextPeriod", period.getBeginDate(), period.getEndDate()); + + view.getPeriodStatusLabel().setText(result); + + } + + + protected void computeBalanceStatusText() { String result; FinancialTransactionTableModel tableModel = view.getFinancialTransactionTableModel(); @@ -1001,12 +1013,12 @@ public class FinancialTransactionViewHandler implements ServiceListener, TableMo 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)); + result = 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)); + result = t("lima.financialTransaction.statusTextDebitCreditError", BigDecimalToString.format(totalDebit), BigDecimalToString.format(totalCredit), BigDecimalToString.format(balance)); } - view.setStatusText(result); + view.getBalanceStatusLabel().setText(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 e714505..352e1f2 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 @@ -281,6 +281,7 @@ lima.financialTransaction.previousFinancialPeriod=Previous financial period lima.financialTransaction.remove.confirm=Do you really want to remove this financial transaction? 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.statusTextPeriod= lima.financialTransaction.update.error.afterLastFiscalPeriod=Update financial transaction failed, financial transaction date is after last fiscal period date lima.financialTransaction.update.error.beforeFirstFiscalPeriod=Update financial transaction failed, financial transaction date is before first fiscal period date lima.financialTransaction.update.error.lockedEntryBook=Update financial transaction failed, locked entry book. 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 1045050..ddb71f5 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 @@ -298,6 +298,7 @@ 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.statusTextPeriod=<html>Période du <b>%1$td %1$tB %1$tY</b> au <b>%2$td %2$tB %2$tY</b></html> 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>.