This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository lima. See https://gitlab.nuiton.org/chorem/lima.git commit d1884b544de90e0e17926c253a6e13b2c12920c2 Author: David Cossé <cosse@codelutin.com> Date: Thu Oct 26 00:39:37 2017 +0200 refs #1394 onglet saisie des écriture un peu plus rapide --- .../FinancialTransactionViewHandler.java | 66 ++++++++++------------ 1 file changed, 31 insertions(+), 35 deletions(-) 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 df8649b0..04da37d7 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 @@ -102,6 +102,8 @@ public class FinancialTransactionViewHandler implements ServiceListener, TableMo protected boolean initializationComplete; + protected boolean isLock = false; + public FinancialTransactionViewHandler(FinancialTransactionView view) { this.view = view; initializationComplete = false; @@ -109,9 +111,6 @@ public class FinancialTransactionViewHandler implements ServiceListener, TableMo financialPeriodService = LimaServiceFactory.getService(FinancialPeriodService.class); fiscalPeriodService = LimaServiceFactory.getService(FiscalPeriodService.class); financialTransactionService = LimaServiceFactory.getService(FinancialTransactionService.class); - LimaServiceFactory.addServiceListener(FinancialPeriodService.class, this); - LimaServiceFactory.addServiceListener(FiscalPeriodService.class, this); - LimaServiceFactory.addServiceListener(ImportService.class, this); errorHelper = new ErrorHelper(LimaSwingConfig.getInstance()); initShortCuts(); } @@ -156,6 +155,10 @@ public class FinancialTransactionViewHandler implements ServiceListener, TableMo } protected void addListeners() { + LimaServiceFactory.addServiceListener(FinancialPeriodService.class, this); + LimaServiceFactory.addServiceListener(FiscalPeriodService.class, this); + LimaServiceFactory.addServiceListener(ImportService.class, this); + FinancialTransactionTable table = view.getFinancialTransactionTable(); table.getColumnModel().addColumnModelListener(this); SwingUtil.fixTableColumnWidth(table, 0, 40); @@ -313,7 +316,7 @@ public class FinancialTransactionViewHandler implements ServiceListener, TableMo * @param event event */ public void fiscalPeriodSelected(ItemEvent event) { - if ( event.getStateChange() == ItemEvent.SELECTED ) { + if ( event.getStateChange() == ItemEvent.SELECTED) { FiscalPeriod selectedFiscalPeriod = (FiscalPeriod) event.getItem(); List<FinancialPeriod> financialPeriods = financialPeriodService.getFinancialPeriodsWithBeginDateWithin(selectedFiscalPeriod.getBeginDate(), @@ -334,7 +337,7 @@ public class FinancialTransactionViewHandler implements ServiceListener, TableMo * @param event event */ public void financialPeriodSelected(ItemEvent event) { - if ( event.getStateChange() == ItemEvent.SELECTED ) { + if ( event.getStateChange() == ItemEvent.SELECTED) { updateFinancialTransactions(); computePeriodStatusText(); setAddEntryAllowed(); @@ -347,7 +350,7 @@ public class FinancialTransactionViewHandler implements ServiceListener, TableMo * @param event event */ public void entryBookSelected(ItemEvent event) { - if ( event.getStateChange() == ItemEvent.SELECTED ) { + if ( event.getStateChange() == ItemEvent.SELECTED) { updateFinancialTransactions(); computePeriodStatusText(); setAddEntryAllowed(); @@ -364,17 +367,17 @@ public class FinancialTransactionViewHandler implements ServiceListener, TableMo view.getFinancialPeriodComboBox().getSelectedItem() != null && initializationComplete) { + FinancialTransactionTable table = view.getFinancialTransactionTable(); + table.exit(); + FinancialPeriod financialPeriod = (FinancialPeriod) view.getFinancialPeriodComboBox().getSelectedItem(); EntryBook entryBook = (EntryBook) view.getEntryBookComboBox().getSelectedItem(); List<FinancialTransaction> transactions = financialTransactionService.getAllFinancialTransactions(financialPeriod, entryBook); - FinancialTransactionTable table = view.getFinancialTransactionTable(); FinancialTransactionTableModel tableModel = view.getFinancialTransactionTableModel(); - table.exit(); - - boolean isLock = isTableLock(financialPeriod, entryBook); + isLock = isTableLock(financialPeriod, entryBook); tableModel.setGlobalyLocked(isLock); tableModel.setTransactions(transactions); @@ -398,13 +401,6 @@ public class FinancialTransactionViewHandler implements ServiceListener, TableMo return result; } - public boolean getIsTableLock() { - FinancialPeriod financialPeriod = (FinancialPeriod) view.getFinancialPeriodComboBox().getSelectedItem(); - EntryBook entryBook = (EntryBook) view.getEntryBookComboBox().getSelectedItem(); - boolean isLock = isTableLock(financialPeriod, entryBook); - return isLock; - } - public void selectionChanged() { FinancialTransactionTable table = view.getFinancialTransactionTable(); FinancialTransactionTableModel tableModel = view.getFinancialTransactionTableModel(); @@ -1067,25 +1063,26 @@ public class FinancialTransactionViewHandler implements ServiceListener, TableMo protected void computePeriodStatusText() { - FinancialPeriod period = (FinancialPeriod) view.getFinancialPeriodComboBoxModel().getSelectedItem(); - EntryBook entryBook = (EntryBook) view.getEntryBookComboBoxModel().getSelectedItem(); - boolean isLock = isTableLock(period, entryBook); + if (initializationComplete) { - String subText = ""; - if (period == null) { - subText = t("lima.financialTransaction.statusTextPeriod.noFiscalPeriodFound"); - } - if (entryBook == null) { - String noEntryBookSubText = t("lima.financialTransaction.statusTextPeriod.noEntryBookFound"); - subText = subText.length() > 0 ? subText + "," + noEntryBookSubText : subText + noEntryBookSubText; - } - if (period != null && entryBook != null){ - subText = subText + (isLock ? t("lima.financialTransaction.statusTextPeriod.close", period.getBeginDate(), period.getEndDate(), entryBook.getCode()) : t("lima.financialTransaction.statusTextPeriod.open", period.getBeginDate(), period.getEndDate())); - } - String result = String.format(t("lima.financialTransaction.statusTextPeriod"), subText); + FinancialPeriod period = (FinancialPeriod) view.getFinancialPeriodComboBoxModel().getSelectedItem(); + EntryBook entryBook = (EntryBook) view.getEntryBookComboBoxModel().getSelectedItem(); - view.getPeriodStatusLabel().setText(result); + String subText = ""; + if (period == null) { + subText = t("lima.financialTransaction.statusTextPeriod.noFiscalPeriodFound"); + } + if (entryBook == null) { + String noEntryBookSubText = t("lima.financialTransaction.statusTextPeriod.noEntryBookFound"); + subText = subText.length() > 0 ? subText + "," + noEntryBookSubText : subText + noEntryBookSubText; + } + if (period != null && entryBook != null) { + subText = subText + (isLock ? t("lima.financialTransaction.statusTextPeriod.close", period.getBeginDate(), period.getEndDate(), entryBook.getCode()) : t("lima.financialTransaction.statusTextPeriod.open", period.getBeginDate(), period.getEndDate())); + } + String result = String.format(t("lima.financialTransaction.statusTextPeriod"), subText); + view.getPeriodStatusLabel().setText(result); + } } @@ -1120,8 +1117,7 @@ public class FinancialTransactionViewHandler implements ServiceListener, TableMo } protected void setAddEntryAllowed() { - boolean isTableLock = getIsTableLock(); - view.setAddEntryAllowed(!isTableLock); + view.setAddEntryAllowed(!isLock); } } -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.