This is an automated email from the git hooks/post-receive script. New commit to branch feature/1176 in repository lima. See http://git.chorem.org/lima.git commit 885063fb4168fee7bc4f08a277b2f3c04f8f801b Author: Tony CHEMIT <chemit@codelutin.com> Date: Sat Mar 21 01:32:19 2015 +0100 refs #1207 corrections d'erreurs majeures --- .../chorem/lima/business/ImportExportResults.java | 2 +- .../business/api/FinancialStatementService.java | 4 +- .../business/api/FinancialTransactionService.java | 6 +- .../lima/business/exceptions/AccountException.java | 7 +- ...> AlreadyExistFinancialStatementException.java} | 8 +- .../AlreadyExistVatStatementException.java | 4 +- .../ClosedPeriodicEntryBookException.java | 2 +- .../ClosedPeriodicEntryBooksException.java | 2 +- .../lima/business/exceptions/DateException.java | 2 +- .../lima/business/exceptions/EntriesException.java | 2 +- .../business/exceptions/EntryBookException.java | 2 +- .../exceptions/FinancialPeriodException.java | 2 +- .../exceptions/FinancialTransactionsException.java | 2 +- .../business/exceptions/FiscalPeriodException.java | 2 +- .../business/exceptions/ImportFileException.java | 2 +- .../MoreOneUnlockFiscalPeriodException.java | 9 +- .../exceptions/NotAllowedLabelException.java | 2 +- .../UnbalancedFinancialTransactionsException.java | 3 - .../business/utils/FinancialPeriodComparator.java | 4 - .../ejb/FinancialTransactionServiceImpl.java | 18 +-- .../ejb/report/BalanceReportServiceImpl.java | 24 +-- .../lima/business/utils/EntryEBPComparator.java | 7 +- .../utils/FinancialTransactionComparator.java | 42 ------ .../org/chorem/lima/entity/AccountTopiaDao.java | 2 +- .../org/chorem/lima/business/AccountDaoTest.java | 7 +- .../lima/business/EntryBookServiceImplTest.java | 3 +- .../lima/business/ImportExportServiceTest.java | 2 +- .../lima/business/ReportServiceImplTest.java | 2 +- .../lima/beans/AbstractBigDecimalCondition.java | 2 +- .../chorem/lima/beans/AbstractStringCondition.java | 2 +- .../java/org/chorem/lima/beans/DateCondition.java | 2 +- .../java/org/chorem/lima/report/DocumentsEnum.java | 2 +- .../lima/report/service/DocumentService.java | 8 +- .../java/org/chorem/lima/server/FormatsEnum.java | 2 +- .../java/org/chorem/lima/server/LimaServer.java | 24 ++- .../chorem/lima/LimaSwingApplicationContext.java | 6 +- .../main/java/org/chorem/lima/LimaSwingConfig.java | 21 ++- .../java/org/chorem/lima/enums/EncodingEnum.java | 13 +- .../AccountCondition/AccountConditionHandler.java | 4 - .../BigDecimalConditionHandler.java | 4 - .../chorem/lima/ui/Filter/ConditionHandler.java | 6 +- .../EntryBookConditionHandler.java | 8 +- .../StringCondition/StringConditionHandler.java | 7 - .../Filter/dateCondition/DateConditionHandler.java | 7 - .../DateIntervalConditionHandler.java | 7 - .../FinancialPeriodConditionHandler.java | 11 +- .../FiscalPeriodConditionHandler.java | 8 +- .../java/org/chorem/lima/ui/LimaRendererUtil.java | 8 +- .../java/org/chorem/lima/ui/MainViewHandler.java | 19 ++- .../chorem/lima/ui/account/AccountViewHandler.java | 2 +- .../ui/celleditor/AutoCompleteTableCellEditor.java | 2 +- .../lima/ui/celleditor/DateTableCellEditor.java | 11 +- .../lima/ui/celleditor/EmptyCellRenderer.java | 4 - .../lima/ui/combobox/AccountComboBoxModel.java | 10 +- .../lima/ui/combobox/EntryBookComboBoxModel.java | 3 - .../ui/combobox/FinancialPeriodComboBoxModel.java | 167 --------------------- .../ui/combobox/FiscalPeriodComboBoxModel.java | 12 +- .../lima/ui/combobox/LeafAccountComboBoxModel.java | 2 - .../lima/ui/combobox/LetterComboBoxModel.java | 100 ------------ .../chorem/lima/ui/common/IntervalListener.java | 29 ---- .../chorem/lima/ui/common/TableModelWithGroup.java | 14 -- .../FinancialTransactionDefaultTable.java | 9 +- .../FinancialTransactionViewHandler.java | 2 +- .../FinancialTransactionSearchViewHandler.java | 14 +- .../ui/fiscalperiod/FiscalPeriodTableModel.java | 4 - .../chorem/lima/ui/importexport/ImportExport.java | 6 +- .../org/chorem/lima/ui/lettering/TypeEntry.java | 2 +- .../ui/opening/CreateIdentityPanelHandler.java | 7 +- .../lima/ui/vatchart/VatChartTreeTableModel.java | 6 +- .../lima/ui/vatchart/VatChartViewHandler.java | 15 +- .../java/org/chorem/lima/util/ErrorHelper.java | 19 --- 71 files changed, 151 insertions(+), 634 deletions(-) diff --git a/lima-business-api/src/main/java/org/chorem/lima/business/ImportExportResults.java b/lima-business-api/src/main/java/org/chorem/lima/business/ImportExportResults.java index da6b9eb..7341b55 100644 --- a/lima-business-api/src/main/java/org/chorem/lima/business/ImportExportResults.java +++ b/lima-business-api/src/main/java/org/chorem/lima/business/ImportExportResults.java @@ -37,7 +37,7 @@ public class ImportExportResults implements Serializable{ List<ExportResult> exportResults; - boolean errors = false; + protected boolean errors; public List<ImportResult> getImportResults() { return importResults; diff --git a/lima-business-api/src/main/java/org/chorem/lima/business/api/FinancialStatementService.java b/lima-business-api/src/main/java/org/chorem/lima/business/api/FinancialStatementService.java index a24f032..d5a21bc 100644 --- a/lima-business-api/src/main/java/org/chorem/lima/business/api/FinancialStatementService.java +++ b/lima-business-api/src/main/java/org/chorem/lima/business/api/FinancialStatementService.java @@ -23,7 +23,7 @@ package org.chorem.lima.business.api; import org.chorem.lima.beans.FinancialStatementAmounts; -import org.chorem.lima.business.exceptions.AlreadyExistFinancialStatement; +import org.chorem.lima.business.exceptions.AlreadyExistFinancialStatementException; import org.chorem.lima.business.exceptions.LimaException; import org.chorem.lima.business.exceptions.NotAllowedLabelException; import org.chorem.lima.entity.Account; @@ -43,7 +43,7 @@ public interface FinancialStatementService { FinancialStatement createMasterFinacialStatements(FinancialStatement masterFinancialStatements); FinancialStatement createFinancialStatement(FinancialStatement masterFinancialStatement, - FinancialStatement financialStatement) throws AlreadyExistFinancialStatement, NotAllowedLabelException; + FinancialStatement financialStatement) throws AlreadyExistFinancialStatementException, NotAllowedLabelException; FinancialStatement updateFinancialStatement(FinancialStatement financialStatement); diff --git a/lima-business-api/src/main/java/org/chorem/lima/business/api/FinancialTransactionService.java b/lima-business-api/src/main/java/org/chorem/lima/business/api/FinancialTransactionService.java index da82273..c53130b 100644 --- a/lima-business-api/src/main/java/org/chorem/lima/business/api/FinancialTransactionService.java +++ b/lima-business-api/src/main/java/org/chorem/lima/business/api/FinancialTransactionService.java @@ -111,11 +111,11 @@ public interface FinancialTransactionService { * From to selected entries, create one with same account and * difference between the amounts, and another one with * account 658 or 758 and an amount conversely of the first created - * @param FirstEntrySelected first entry selected - * @param SecondEntrySelected second entry selected + * @param firstEntrySelected first entry selected + * @param secondEntrySelected second entry selected * @return table of the two new entries * */ - Entry[] getEntriesFromEqualizing(Entry FirstEntrySelected, Entry SecondEntrySelected) + Entry[] getEntriesFromEqualizing(Entry firstEntrySelected, Entry secondEntrySelected) throws LockedFinancialPeriodException, LockedEntryBookException; /** diff --git a/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/AccountException.java b/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/AccountException.java index 6bbe741..63d373a 100644 --- a/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/AccountException.java +++ b/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/AccountException.java @@ -27,7 +27,7 @@ package org.chorem.lima.business.exceptions; */ public abstract class AccountException extends LimaException { - protected String accountNumber; + private final String accountNumber; public AccountException(String accountNumber) { this.accountNumber = accountNumber; @@ -43,11 +43,6 @@ public abstract class AccountException extends LimaException { this.accountNumber = accountNumber; } - public AccountException(String accountNumber, String message, Throwable cause) { - super(message, cause); - this.accountNumber = accountNumber; - } - public String getAccountNumber() { return accountNumber; } diff --git a/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/AlreadyExistFinancialStatement.java b/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/AlreadyExistFinancialStatementException.java similarity index 82% rename from lima-business-api/src/main/java/org/chorem/lima/business/exceptions/AlreadyExistFinancialStatement.java rename to lima-business-api/src/main/java/org/chorem/lima/business/exceptions/AlreadyExistFinancialStatementException.java index d118eca..af073bf 100644 --- a/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/AlreadyExistFinancialStatement.java +++ b/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/AlreadyExistFinancialStatementException.java @@ -25,13 +25,13 @@ package org.chorem.lima.business.exceptions; /** * Created by davidcosse on 28/07/14. */ -public class AlreadyExistFinancialStatement extends LimaException { +public class AlreadyExistFinancialStatementException extends LimaException { private static final long serialVersionUID = 4816249386192290272L; - protected String financialStatementLabel; - protected String masterLabel; + private final String financialStatementLabel; + private final String masterLabel; - public AlreadyExistFinancialStatement(String label, String masterLabel) { + public AlreadyExistFinancialStatementException(String label, String masterLabel) { this.financialStatementLabel = label; this.masterLabel = masterLabel; } diff --git a/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/AlreadyExistVatStatementException.java b/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/AlreadyExistVatStatementException.java index 5de1447..cc848d0 100644 --- a/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/AlreadyExistVatStatementException.java +++ b/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/AlreadyExistVatStatementException.java @@ -28,8 +28,8 @@ package org.chorem.lima.business.exceptions; public class AlreadyExistVatStatementException extends LimaException { private static final long serialVersionUID = 4816249386192290272L; - protected String vatStatementLabel; - protected String masterLabel; + private final String vatStatementLabel; + private final String masterLabel; public AlreadyExistVatStatementException(String label, String masterLabel) { this.vatStatementLabel = label; diff --git a/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/ClosedPeriodicEntryBookException.java b/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/ClosedPeriodicEntryBookException.java index 49b5f97..81d03e2 100644 --- a/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/ClosedPeriodicEntryBookException.java +++ b/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/ClosedPeriodicEntryBookException.java @@ -29,7 +29,7 @@ import org.chorem.lima.entity.ClosedPeriodicEntryBook; */ public abstract class ClosedPeriodicEntryBookException extends LimaException { - protected ClosedPeriodicEntryBook closedPeriodicEntryBook; + private final ClosedPeriodicEntryBook closedPeriodicEntryBook; public ClosedPeriodicEntryBookException(ClosedPeriodicEntryBook closedPeriodicEntryBook) { this.closedPeriodicEntryBook = closedPeriodicEntryBook; diff --git a/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/ClosedPeriodicEntryBooksException.java b/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/ClosedPeriodicEntryBooksException.java index 652035d..29d03b1 100644 --- a/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/ClosedPeriodicEntryBooksException.java +++ b/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/ClosedPeriodicEntryBooksException.java @@ -31,7 +31,7 @@ import java.util.Collection; */ public abstract class ClosedPeriodicEntryBooksException extends LimaException { - protected Collection<ClosedPeriodicEntryBook> closedPeriodicEntryBooks; + private final Collection<ClosedPeriodicEntryBook> closedPeriodicEntryBooks; public ClosedPeriodicEntryBooksException(Collection<ClosedPeriodicEntryBook> closedPeriodicEntryBooks) { this.closedPeriodicEntryBooks = closedPeriodicEntryBooks; diff --git a/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/DateException.java b/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/DateException.java index c2fe536..e1d41d8 100644 --- a/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/DateException.java +++ b/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/DateException.java @@ -29,7 +29,7 @@ import java.util.Date; */ public abstract class DateException extends LimaException { - protected Date date; + private final Date date; public DateException(Date date) { this.date = date; diff --git a/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/EntriesException.java b/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/EntriesException.java index 0c979fd..5f339f8 100644 --- a/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/EntriesException.java +++ b/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/EntriesException.java @@ -31,7 +31,7 @@ import java.util.Collection; */ public abstract class EntriesException extends LimaException { - protected Collection<Entry> entries; + private final Collection<Entry> entries; public EntriesException(Collection<Entry> entries) { this.entries = entries; diff --git a/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/EntryBookException.java b/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/EntryBookException.java index 9ada37e..6a5de3f 100644 --- a/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/EntryBookException.java +++ b/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/EntryBookException.java @@ -30,7 +30,7 @@ import org.chorem.lima.entity.EntryBook; public abstract class EntryBookException extends LimaException { private static final long serialVersionUID = 7340316212015035903L; - protected EntryBook entryBook; + private final EntryBook entryBook; public EntryBookException(EntryBook entryBook) { this.entryBook = entryBook; diff --git a/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/FinancialPeriodException.java b/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/FinancialPeriodException.java index 124853e..45a4f6a 100644 --- a/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/FinancialPeriodException.java +++ b/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/FinancialPeriodException.java @@ -30,7 +30,7 @@ import org.chorem.lima.entity.FinancialPeriod; public abstract class FinancialPeriodException extends LimaException { private static final long serialVersionUID = 1641125531069733891L; - protected FinancialPeriod financialPeriod; + private final FinancialPeriod financialPeriod; public FinancialPeriodException(FinancialPeriod financialPeriod) { this.financialPeriod = financialPeriod; diff --git a/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/FinancialTransactionsException.java b/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/FinancialTransactionsException.java index 2c71f27..6fffc1a 100644 --- a/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/FinancialTransactionsException.java +++ b/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/FinancialTransactionsException.java @@ -31,7 +31,7 @@ import java.util.Collection; */ public abstract class FinancialTransactionsException extends LimaException { - protected Collection<FinancialTransaction> financialTransactions; + private final Collection<FinancialTransaction> financialTransactions; public FinancialTransactionsException(Collection<FinancialTransaction> financialTransactions) { this.financialTransactions = financialTransactions; diff --git a/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/FiscalPeriodException.java b/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/FiscalPeriodException.java index c9dd3f3..907d0e8 100644 --- a/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/FiscalPeriodException.java +++ b/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/FiscalPeriodException.java @@ -29,7 +29,7 @@ import org.chorem.lima.entity.FiscalPeriod; */ public abstract class FiscalPeriodException extends LimaException { - protected FiscalPeriod fiscalPeriod; + private final FiscalPeriod fiscalPeriod; public FiscalPeriodException(FiscalPeriod fiscalPeriod) { this.fiscalPeriod = fiscalPeriod; diff --git a/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/ImportFileException.java b/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/ImportFileException.java index 75fe981..3d1dc87 100644 --- a/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/ImportFileException.java +++ b/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/ImportFileException.java @@ -28,7 +28,7 @@ package org.chorem.lima.business.exceptions; public class ImportFileException extends LimaException { private static final long serialVersionUID = 3498049458931759768L; - protected String detailMessage; + private final String detailMessage; public ImportFileException(String detailMessage) { this.detailMessage = detailMessage; diff --git a/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/MoreOneUnlockFiscalPeriodException.java b/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/MoreOneUnlockFiscalPeriodException.java index 6f403c9..75dd040 100644 --- a/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/MoreOneUnlockFiscalPeriodException.java +++ b/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/MoreOneUnlockFiscalPeriodException.java @@ -30,10 +30,11 @@ import java.util.Date; public class MoreOneUnlockFiscalPeriodException extends LimaException { private static final long serialVersionUID = -9215191603583397411L; - Date beginDate; - Date endDate; - Boolean isLocked; - long countUnlockFiscalPeriod; + + private Date beginDate; + private Date endDate; + private Boolean isLocked; + private long countUnlockFiscalPeriod; public MoreOneUnlockFiscalPeriodException(Date beginDate, Date endDate, Boolean isLocked, long countUnlockFiscalPeriod) { this.beginDate = beginDate; diff --git a/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/NotAllowedLabelException.java b/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/NotAllowedLabelException.java index e1487fe..0813747 100644 --- a/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/NotAllowedLabelException.java +++ b/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/NotAllowedLabelException.java @@ -28,7 +28,7 @@ package org.chorem.lima.business.exceptions; public class NotAllowedLabelException extends LimaException { private static final long serialVersionUID = -4092985460788892883L; - protected String label; + private String label; public NotAllowedLabelException(String label) { this.label = label; diff --git a/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/UnbalancedFinancialTransactionsException.java b/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/UnbalancedFinancialTransactionsException.java index 31793e1..dd3209c 100644 --- a/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/UnbalancedFinancialTransactionsException.java +++ b/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/UnbalancedFinancialTransactionsException.java @@ -37,7 +37,4 @@ public class UnbalancedFinancialTransactionsException extends FinancialTransacti super(financialTransactions); } - public UnbalancedFinancialTransactionsException(Collection<FinancialTransaction> financialTransactions, Throwable cause) { - super(financialTransactions, cause); - } } diff --git a/lima-business-api/src/main/java/org/chorem/lima/business/utils/FinancialPeriodComparator.java b/lima-business-api/src/main/java/org/chorem/lima/business/utils/FinancialPeriodComparator.java index 88b089c..4a1c1aa 100644 --- a/lima-business-api/src/main/java/org/chorem/lima/business/utils/FinancialPeriodComparator.java +++ b/lima-business-api/src/main/java/org/chorem/lima/business/utils/FinancialPeriodComparator.java @@ -21,8 +21,6 @@ */ package org.chorem.lima.business.utils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import org.chorem.lima.entity.ClosedPeriodicEntryBook; import java.io.Serializable; @@ -32,8 +30,6 @@ public class FinancialPeriodComparator implements Serializable, Comparator<Close private static final long serialVersionUID = 1L; - private static final Log log = LogFactory.getLog(FinancialPeriodComparator.class); - @Override public int compare(ClosedPeriodicEntryBook o1, ClosedPeriodicEntryBook o2) { if (o1.getFinancialPeriod().getBeginDate().compareTo(o2.getFinancialPeriod().getBeginDate()) == 0) { diff --git a/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java b/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java index ba41e51..52e241a 100644 --- a/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java +++ b/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java @@ -197,13 +197,13 @@ public class FinancialTransactionServiceImpl extends AbstractLimaService impleme } @Override - public Entry[] getEntriesFromEqualizing(Entry FirstEntrySelected, Entry SecondEntrySelected) + public Entry[] getEntriesFromEqualizing(Entry firstEntrySelected, Entry secondEntrySelected) throws LockedFinancialPeriodException, LockedEntryBookException { Entry newSameAccountEntry = null; Entry newCostOrProductEntry = null; - BigDecimal firstSelectedEntryAmount = FirstEntrySelected.getAmount(); - BigDecimal secondSelectedEntryAmount = SecondEntrySelected.getAmount(); + BigDecimal firstSelectedEntryAmount = firstEntrySelected.getAmount(); + BigDecimal secondSelectedEntryAmount = secondEntrySelected.getAmount(); if ( (firstSelectedEntryAmount.compareTo(BigDecimal.ZERO) != 0 && secondSelectedEntryAmount.compareTo(BigDecimal.ZERO) != 0) && !firstSelectedEntryAmount.equals(secondSelectedEntryAmount)) { @@ -211,8 +211,8 @@ public class FinancialTransactionServiceImpl extends AbstractLimaService impleme /*Calculation of result with it * Tab : 0 : debit * 1 : credit*/ - BigDecimal[] firstEntryDebitCredit = debitCreditCalculation(FirstEntrySelected); - BigDecimal[] secondEntryDebitCredit = debitCreditCalculation(SecondEntrySelected); + BigDecimal[] firstEntryDebitCredit = debitCreditCalculation(firstEntrySelected); + BigDecimal[] secondEntryDebitCredit = debitCreditCalculation(secondEntrySelected); /*Subtraction between debit and credit of first and second selected line*/ BigDecimal firstEntryDebitSubtract = firstEntryDebitCredit[0].subtract(secondEntryDebitCredit[1]); @@ -224,12 +224,12 @@ public class FinancialTransactionServiceImpl extends AbstractLimaService impleme /*Set result in the amount of the new entries*/ if (firstEntryDebitSubtract.compareTo(BigDecimal.ZERO) != 0) { - sameAccountEntry = copyEntryWithoutAmount(FirstEntrySelected); - costOrProductEntry = copyEntryWithoutAmount(FirstEntrySelected); + sameAccountEntry = copyEntryWithoutAmount(firstEntrySelected); + costOrProductEntry = copyEntryWithoutAmount(firstEntrySelected); amountsCalculation(firstEntryDebitSubtract, sameAccountEntry, costOrProductEntry); } else { - sameAccountEntry = copyEntryWithoutAmount(SecondEntrySelected); - costOrProductEntry = copyEntryWithoutAmount(SecondEntrySelected); + sameAccountEntry = copyEntryWithoutAmount(secondEntrySelected); + costOrProductEntry = copyEntryWithoutAmount(secondEntrySelected); amountsCalculation(secondEntryDebitSubtract, sameAccountEntry, costOrProductEntry); } diff --git a/lima-business/src/main/java/org/chorem/lima/business/ejb/report/BalanceReportServiceImpl.java b/lima-business/src/main/java/org/chorem/lima/business/ejb/report/BalanceReportServiceImpl.java index b9446a5..f4ecd08 100644 --- a/lima-business/src/main/java/org/chorem/lima/business/ejb/report/BalanceReportServiceImpl.java +++ b/lima-business/src/main/java/org/chorem/lima/business/ejb/report/BalanceReportServiceImpl.java @@ -168,14 +168,14 @@ public class BalanceReportServiceImpl extends AbstractLimaService implements Bal * @throws org.nuiton.topia.persistence.TopiaException */ protected BalanceAccount bindAccountToBalanceReportAccount(String mainAccountLabel, Account account, Date beginDate, Date endDate, DecimalFormat bigDecimalFormat) { - BalanceAccount BalanceAccount = new BalanceAccountImpl(); - BalanceAccount.setMainAccountLabel(mainAccountLabel); - BalanceAccount.setFormatter(bigDecimalFormat); + BalanceAccount balanceAccount = new BalanceAccountImpl(); + balanceAccount.setMainAccountLabel(mainAccountLabel); + balanceAccount.setFormatter(bigDecimalFormat); String accountNumber = account.getAccountNumber(); accountNumber = StringUtils.rightPad(accountNumber, ACCOUNT_NUMBER_SIZE - accountNumber.length(), '0'); - BalanceAccount.setAccountNumber(accountNumber); - BalanceAccount.setLabel(account.getLabel()); + balanceAccount.setAccountNumber(accountNumber); + balanceAccount.setLabel(account.getLabel()); EntryTopiaDao entryTopiaDao = getDaoHelper().getEntryDao(); @@ -204,16 +204,16 @@ public class BalanceReportServiceImpl extends AbstractLimaService implements Bal sold = sold.subtract(credit); if (sold.compareTo(BigDecimal.ZERO) == 1) { - BalanceAccount.setSoldeDebit(sold.abs()); - BalanceAccount.setSoldeCredit(BigDecimal.ZERO); + balanceAccount.setSoldeDebit(sold.abs()); + balanceAccount.setSoldeCredit(BigDecimal.ZERO); } else { - BalanceAccount.setSoldeCredit(sold.abs()); - BalanceAccount.setSoldeDebit(BigDecimal.ZERO); + balanceAccount.setSoldeCredit(sold.abs()); + balanceAccount.setSoldeDebit(BigDecimal.ZERO); } - BalanceAccount.setAmountCredit(credit); - BalanceAccount.setAmountDebit(debit); + balanceAccount.setAmountCredit(credit); + balanceAccount.setAmountDebit(debit); - return BalanceAccount; + return balanceAccount; } } diff --git a/lima-business/src/main/java/org/chorem/lima/business/utils/EntryEBPComparator.java b/lima-business/src/main/java/org/chorem/lima/business/utils/EntryEBPComparator.java index efc17d5..ead402c 100644 --- a/lima-business/src/main/java/org/chorem/lima/business/utils/EntryEBPComparator.java +++ b/lima-business/src/main/java/org/chorem/lima/business/utils/EntryEBPComparator.java @@ -22,8 +22,6 @@ package org.chorem.lima.business.utils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import org.chorem.lima.beans.EntryEBP; import java.io.Serializable; @@ -32,14 +30,11 @@ import java.util.Date; public class EntryEBPComparator implements Serializable, Comparator<EntryEBP> { - private static final Log log = - LogFactory.getLog(EntryEBPComparator.class); - private static final long serialVersionUID = 1L; @Override public int compare(EntryEBP o1, EntryEBP o2) { - int result = 0; + int result; Date date1 = o1.getDatEcr(); Date date2 = o2.getDatEcr(); result = date1.compareTo(date2); diff --git a/lima-business/src/main/java/org/chorem/lima/business/utils/FinancialTransactionComparator.java b/lima-business/src/main/java/org/chorem/lima/business/utils/FinancialTransactionComparator.java deleted file mode 100644 index 3ee0bc8..0000000 --- a/lima-business/src/main/java/org/chorem/lima/business/utils/FinancialTransactionComparator.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.chorem.lima.business.utils; - -/* - * #%L - * Lima :: business - * %% - * Copyright (C) 2008 - 2013 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 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% - */ - -import org.chorem.lima.entity.FinancialTransaction; - -import java.util.Comparator; - -/** - * @author Sylvain Bavencoff <bavencoff@codelutin.com> - */ -public class FinancialTransactionComparator implements Comparator<FinancialTransaction> { - - @Override - public int compare(FinancialTransaction o1, FinancialTransaction o2) { - int result = o1.getTransactionDate().compareTo(o2.getTransactionDate()); - if (result == 0) { - result = o1.getTopiaCreateDate().compareTo(o2.getTopiaCreateDate()); - } - return result; - } -} diff --git a/lima-business/src/main/java/org/chorem/lima/entity/AccountTopiaDao.java b/lima-business/src/main/java/org/chorem/lima/entity/AccountTopiaDao.java index 11cf510..9e64d9d 100644 --- a/lima-business/src/main/java/org/chorem/lima/entity/AccountTopiaDao.java +++ b/lima-business/src/main/java/org/chorem/lima/entity/AccountTopiaDao.java @@ -53,7 +53,7 @@ public class AccountTopiaDao extends AbstractAccountTopiaDao<Account> { // // List<Account> result = findAll(query); - List<Account> result = (List<Account>) findAll(); + List<Account> result = findAll(); Iterator<Account> itAccount = result.iterator(); while (itAccount.hasNext()) { Account acc = itAccount.next(); diff --git a/lima-business/src/test/java/org/chorem/lima/business/AccountDaoTest.java b/lima-business/src/test/java/org/chorem/lima/business/AccountDaoTest.java index 4a5ee0a..b4311d4 100644 --- a/lima-business/src/test/java/org/chorem/lima/business/AccountDaoTest.java +++ b/lima-business/src/test/java/org/chorem/lima/business/AccountDaoTest.java @@ -508,15 +508,11 @@ public class AccountDaoTest extends AbstractLimaTest { accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "609"); for (int i = 0 ; i < 10 ; i++ ) { - long before = System.currentTimeMillis(); List<Account> accounts = accountTopiaDao.findAllLeafAccounts(); - long after = System.currentTimeMillis(); -// log.info("temps refactoré:" + (after - before)); // code temporaire non performant en attandant: - long before1 = System.currentTimeMillis(); - List<Account> allAccounts = (List<Account>) accountTopiaDao.findAll(); + List<Account> allAccounts = accountTopiaDao.findAll(); Iterator<Account> itAccount = allAccounts.iterator(); while (itAccount.hasNext()) { Account acc = itAccount.next(); @@ -528,7 +524,6 @@ public class AccountDaoTest extends AbstractLimaTest { } } } - long after1 = System.currentTimeMillis(); // log.info("temps original:" + (after1 - before1)); Assert.assertEquals(allAccounts.size(), accounts.size()); diff --git a/lima-business/src/test/java/org/chorem/lima/business/EntryBookServiceImplTest.java b/lima-business/src/test/java/org/chorem/lima/business/EntryBookServiceImplTest.java index db4f3e0..104b357 100644 --- a/lima-business/src/test/java/org/chorem/lima/business/EntryBookServiceImplTest.java +++ b/lima-business/src/test/java/org/chorem/lima/business/EntryBookServiceImplTest.java @@ -35,7 +35,6 @@ import org.junit.Before; import org.junit.Test; import java.text.ParseException; -import java.util.List; /** * Tests pour la gestion des journaux. @@ -61,7 +60,7 @@ public class EntryBookServiceImplTest extends AbstractLimaTest { */ @Test public void modifyJournalTest() throws LimaException { - List<EntryBook> entryBooks = entryBookService.getAllEntryBooks(); + entryBookService.getAllEntryBooks(); EntryBook entryBook = entryBookService.getEntryBookByCode("jdv"); Assert.assertNotNull(entryBook); Assert.assertEquals(JOURNAL_DES_VENTES, entryBook.getLabel()); diff --git a/lima-business/src/test/java/org/chorem/lima/business/ImportExportServiceTest.java b/lima-business/src/test/java/org/chorem/lima/business/ImportExportServiceTest.java index 92d6e08..23ea2d9 100644 --- a/lima-business/src/test/java/org/chorem/lima/business/ImportExportServiceTest.java +++ b/lima-business/src/test/java/org/chorem/lima/business/ImportExportServiceTest.java @@ -500,7 +500,7 @@ public class ImportExportServiceTest extends AbstractLimaTest { Assert.assertEquals(28, result.getNbCreated()); entriesStream.close(); - EntryBook entryBook = entryBookService.getEntryBookByCode("AN"); + entryBookService.getEntryBookByCode("AN"); List<FinancialTransaction> _31JanuaryFinancialTransactions = financialTransactionService.getAllFinancialTransactions(df.parse("January 31, 2010"), df.parse("January 31, 2010")); Assert.assertEquals(3, _31JanuaryFinancialTransactions.size()); diff --git a/lima-business/src/test/java/org/chorem/lima/business/ReportServiceImplTest.java b/lima-business/src/test/java/org/chorem/lima/business/ReportServiceImplTest.java index 189048e..36b376b 100644 --- a/lima-business/src/test/java/org/chorem/lima/business/ReportServiceImplTest.java +++ b/lima-business/src/test/java/org/chorem/lima/business/ReportServiceImplTest.java @@ -96,7 +96,7 @@ public class ReportServiceImplTest extends AbstractLimaTest { tr1Entry1.setFinancialTransaction(transaction1); tr1Entry1.setDescription("test desc"); tr1Entry1.setVoucher("voucher"); - tr1Entry1 = financialTransactionService.createEntry(tr1Entry1); + financialTransactionService.createEntry(tr1Entry1); Date beginDate = df.parse("April 1, 2012"); Date endDate = df.parse("May 31, 2012"); diff --git a/lima-callao/src/main/java/org/chorem/lima/beans/AbstractBigDecimalCondition.java b/lima-callao/src/main/java/org/chorem/lima/beans/AbstractBigDecimalCondition.java index b5e48c2..687e915 100644 --- a/lima-callao/src/main/java/org/chorem/lima/beans/AbstractBigDecimalCondition.java +++ b/lima-callao/src/main/java/org/chorem/lima/beans/AbstractBigDecimalCondition.java @@ -56,7 +56,7 @@ public abstract class AbstractBigDecimalCondition implements Condition, Serializ this.operand = operand; } - public static enum Operand implements Labeled { + public enum Operand implements Labeled { EQUAL(t("lima.enum.BigDecimal.operand.equal")), NOT_EQUAL(t("lima.enum.BigDecimal.operand.notequal")), LOWER(t("lima.enum.BigDecimal.operand.lower")), diff --git a/lima-callao/src/main/java/org/chorem/lima/beans/AbstractStringCondition.java b/lima-callao/src/main/java/org/chorem/lima/beans/AbstractStringCondition.java index b22f9b6..705012c 100644 --- a/lima-callao/src/main/java/org/chorem/lima/beans/AbstractStringCondition.java +++ b/lima-callao/src/main/java/org/chorem/lima/beans/AbstractStringCondition.java @@ -66,7 +66,7 @@ public abstract class AbstractStringCondition implements Condition, Serializable this.sensitiveCase = sensitiveCase; } - public static enum Operand implements Labeled { + public enum Operand implements Labeled { EQUAL(t("lima.enum.string.operand.equal")), NOT_EQUAL(t("lima.string.date.operand.notequal")), BEGIN(t("lima.enum.string.operand.begin")), diff --git a/lima-callao/src/main/java/org/chorem/lima/beans/DateCondition.java b/lima-callao/src/main/java/org/chorem/lima/beans/DateCondition.java index c697816..a83fec0 100644 --- a/lima-callao/src/main/java/org/chorem/lima/beans/DateCondition.java +++ b/lima-callao/src/main/java/org/chorem/lima/beans/DateCondition.java @@ -66,7 +66,7 @@ public class DateCondition implements Condition, Serializable { v.visitDateCondition(this); } - public static enum Operand implements Labeled { + public enum Operand implements Labeled { SAME(t("lima.enum.date.operand.same")), AFTER(t("lima.enum.date.operand.after")), PREVIOUS(t("lima.enum.date.operand.previous")), diff --git a/lima-report/src/main/java/org/chorem/lima/report/DocumentsEnum.java b/lima-report/src/main/java/org/chorem/lima/report/DocumentsEnum.java index a077961..68ea24b 100644 --- a/lima-report/src/main/java/org/chorem/lima/report/DocumentsEnum.java +++ b/lima-report/src/main/java/org/chorem/lima/report/DocumentsEnum.java @@ -38,7 +38,7 @@ public enum DocumentsEnum { private final String description; - private DocumentsEnum(String description, String fileName) { + DocumentsEnum(String description, String fileName) { this.description = description; this.fileName = fileName; } diff --git a/lima-report/src/main/java/org/chorem/lima/report/service/DocumentService.java b/lima-report/src/main/java/org/chorem/lima/report/service/DocumentService.java index b85a78b..dea0e41 100644 --- a/lima-report/src/main/java/org/chorem/lima/report/service/DocumentService.java +++ b/lima-report/src/main/java/org/chorem/lima/report/service/DocumentService.java @@ -449,12 +449,12 @@ public class DocumentService { protected String constructTableLine(String[] cells, boolean even) { String style = even ? "line_even" : "line_odd"; - String line = "\t\t<tr class=\"" + style + "\">\n"; + StringBuilder builder = new StringBuilder("\t\t<tr class=\"" + style + "\">\n"); for (String cell : cells) { - line += "\t\t\t<td>" + cell + "</td>\n"; + builder.append("\t\t\t<td>").append(cell).append("</td>\n"); } - line += "\t\t</tr>\n"; - return line; + builder.append("\t\t</tr>\n"); + return builder.toString(); } protected String constructTableLine(String... cells) { diff --git a/lima-server/src/main/java/org/chorem/lima/server/FormatsEnum.java b/lima-server/src/main/java/org/chorem/lima/server/FormatsEnum.java index b588eb9..59d5568 100644 --- a/lima-server/src/main/java/org/chorem/lima/server/FormatsEnum.java +++ b/lima-server/src/main/java/org/chorem/lima/server/FormatsEnum.java @@ -35,7 +35,7 @@ public enum FormatsEnum { private final String description; - private FormatsEnum(String extension, String mimeType, String description) { + FormatsEnum(String extension, String mimeType, String description) { this.extension = extension; this.mimeType = mimeType; this.description = description; diff --git a/lima-server/src/main/java/org/chorem/lima/server/LimaServer.java b/lima-server/src/main/java/org/chorem/lima/server/LimaServer.java index 40271d2..8f1eb48 100644 --- a/lima-server/src/main/java/org/chorem/lima/server/LimaServer.java +++ b/lima-server/src/main/java/org/chorem/lima/server/LimaServer.java @@ -30,11 +30,9 @@ import org.chorem.lima.business.LimaBusinessConfig; import org.chorem.lima.business.LimaServiceFactory; import org.chorem.lima.report.LimaReportConfig; import org.nuiton.config.ApplicationConfig; -import org.apache.openejb.client.RemoteInitialContextFactory; import javax.naming.Context; import javax.naming.NamingException; -import java.util.Properties; /** * Lima server class. @@ -50,12 +48,16 @@ import java.util.Properties; public class LimaServer { private static final Log log = LogFactory.getLog(LimaServer.class); - public static final String EJB_URL = "ejbd://%s:%d"; /** http serveur */ protected static HttpServerService httpServerService; /** + * To lock + */ + private static final Object LOCK = new Object(); + + /** * Lima server. * * @param args @@ -70,16 +72,14 @@ public class LimaServer { LimaServerConfig serverConfig = LimaServerConfig.getInstance(accountabilityName); - Properties properties = serverConfig.getFlatOptions(); - launch(serverConfig.getConfig()); LimaServerConfig.getInstance().getConfig().saveForUser(); // block main otherwize, main will end - synchronized (LimaServer.class) { + synchronized (LOCK) { try { - properties.wait(); + LOCK.wait(); } catch (InterruptedException e) { e.printStackTrace(); } @@ -92,8 +92,8 @@ public class LimaServer { public static void launch(ApplicationConfig moduleConfig) { - boolean mustStartServer = StringUtils.isBlank(moduleConfig.getOption(LimaBusinessConfig.BusinessConfigOption.HOST_ADDRESS.getKey())) || - moduleConfig.getOptionAsBoolean(LimaServerConfig.ServerConfigOption.EJB_REMOTABLE.getKey()); + boolean mustStartServer = StringUtils.isBlank(moduleConfig.getOption(Context.PROVIDER_URL)) || + moduleConfig.getOptionAsBoolean("openejb.embedded.remotable"); ApplicationConfig initConfig = moduleConfig; @@ -102,12 +102,6 @@ public class LimaServer { initConfig = LimaServerConfig.getInstance(initConfig).getConfig(); initConfig = LimaBusinessConfig.getInstance(initConfig).getConfig(); initConfig = LimaReportConfig.getInstance(initConfig).getConfig(); - } else { - LimaBusinessConfig config = LimaBusinessConfig.getInstance(initConfig); - initConfig = config.getConfig(); - String url = String.format(EJB_URL, config.getHostAddress(), config.getHostEjbPort()); - initConfig.setOption(Context.PROVIDER_URL, url); - initConfig.setOption(Context.INITIAL_CONTEXT_FACTORY, RemoteInitialContextFactory.class.getName()); } // start EJB container (either local or remote) diff --git a/lima-swing/src/main/java/org/chorem/lima/LimaSwingApplicationContext.java b/lima-swing/src/main/java/org/chorem/lima/LimaSwingApplicationContext.java index 4e3cdb0..d4a3c55 100644 --- a/lima-swing/src/main/java/org/chorem/lima/LimaSwingApplicationContext.java +++ b/lima-swing/src/main/java/org/chorem/lima/LimaSwingApplicationContext.java @@ -50,11 +50,11 @@ public class LimaSwingApplicationContext extends DefaultApplicationContext { */ protected static LimaSwingApplicationContext instance; - public static JAXXContextEntryDef<MainView> MAIN_UI_ENTRY_DEF = JAXXUtil.newContextEntryDef("mainUI", MainView.class); + public static final JAXXContextEntryDef<MainView> MAIN_UI_ENTRY_DEF = JAXXUtil.newContextEntryDef("mainUI", MainView.class); - public static JAXXContextEntryDef<DecoratorProvider> DECORATOR_PROVIDER_DEF = JAXXUtil.newContextEntryDef("decoratorProvider", DecoratorProvider.class); + public static final JAXXContextEntryDef<DecoratorProvider> DECORATOR_PROVIDER_DEF = JAXXUtil.newContextEntryDef("decoratorProvider", DecoratorProvider.class); - public static JAXXContextEntryDef<LimaSwingConfig> CONFIG_DEF = JAXXUtil.newContextEntryDef("limaConfig", LimaSwingConfig.class); + public static final JAXXContextEntryDef<LimaSwingConfig> CONFIG_DEF = JAXXUtil.newContextEntryDef("limaConfig", LimaSwingConfig.class); /** * @return <code>true</code> si le context a été initialisé via la méthode diff --git a/lima-swing/src/main/java/org/chorem/lima/LimaSwingConfig.java b/lima-swing/src/main/java/org/chorem/lima/LimaSwingConfig.java index 5f02b0e..a7dd524 100644 --- a/lima-swing/src/main/java/org/chorem/lima/LimaSwingConfig.java +++ b/lima-swing/src/main/java/org/chorem/lima/LimaSwingConfig.java @@ -24,7 +24,6 @@ package org.chorem.lima; import com.google.common.collect.ImmutableSet; import jaxx.runtime.JAXXUtil; - import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.lima.actions.MiscAction; @@ -366,7 +365,7 @@ public class LimaSwingConfig extends ApplicationConfig implements BigDecimalToSt * <p/> * Contains all lima configuration key, with defaut value and * information for jaxx configuration frame ({@link #type}, - * {@link #_transient}, {@link #_final}...) + * {@link #transientState}, {@link #finalState}...) */ public enum Option implements LimaConfigOptionDef { @@ -591,39 +590,39 @@ public class LimaSwingConfig extends ApplicationConfig implements BigDecimalToSt protected final Class<?> type; - protected boolean _transient; + protected boolean transientState; - protected boolean _final; + protected boolean finalState; Option(String key, String label, String description, String defaultValue, - Class<?> type, boolean _transient, boolean _final) { + Class<?> type, boolean transientState, boolean finalState) { this.key = key; this.label = label; this.description = description; this.defaultValue = defaultValue; this.type = type; - this._final = _final; - this._transient = _transient; + this.finalState = finalState; + this.transientState = transientState; } @Override public boolean isFinal() { - return _final; + return finalState; } @Override public void setFinal(boolean _final) { - this._final = _final; + this.finalState = _final; } @Override public boolean isTransient() { - return _transient; + return transientState; } @Override public void setTransient(boolean _transient) { - this._transient = _transient; + this.transientState = _transient; } @Override diff --git a/lima-swing/src/main/java/org/chorem/lima/enums/EncodingEnum.java b/lima-swing/src/main/java/org/chorem/lima/enums/EncodingEnum.java index 85fd18b..364d59a 100644 --- a/lima-swing/src/main/java/org/chorem/lima/enums/EncodingEnum.java +++ b/lima-swing/src/main/java/org/chorem/lima/enums/EncodingEnum.java @@ -32,7 +32,7 @@ public enum EncodingEnum { protected final String description; - private EncodingEnum(String encoding, String description) { + EncodingEnum(String encoding, String description) { this.encoding = encoding; this.description = description; } @@ -55,15 +55,4 @@ public enum EncodingEnum { return descriptions; } - public static EncodingEnum valueOfDescription(String description) { - EncodingEnum value = null; - - for (EncodingEnum encodingEnum : EncodingEnum.values()) { - if (description.equals(encodingEnum.description)) { - value = encodingEnum; - break; - } - } - return value; - } } diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/Filter/AccountCondition/AccountConditionHandler.java b/lima-swing/src/main/java/org/chorem/lima/ui/Filter/AccountCondition/AccountConditionHandler.java index 9fd5cd4..f2f2b49 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/Filter/AccountCondition/AccountConditionHandler.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/Filter/AccountCondition/AccountConditionHandler.java @@ -22,8 +22,6 @@ package org.chorem.lima.ui.Filter.AccountCondition; * #L% */ -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import org.chorem.lima.beans.AccountCondition; import org.chorem.lima.entity.Account; import org.chorem.lima.ui.Filter.ConditionHandler; @@ -36,8 +34,6 @@ import java.awt.event.ItemEvent; */ public class AccountConditionHandler implements ConditionHandler { - private static final Log log = LogFactory.getLog(AccountConditionHandler.class); - protected AccountCondition condition; protected AccountConditionView view; diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/Filter/BigDecimalCondition/BigDecimalConditionHandler.java b/lima-swing/src/main/java/org/chorem/lima/ui/Filter/BigDecimalCondition/BigDecimalConditionHandler.java index 91455db..e8c3f14 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/Filter/BigDecimalCondition/BigDecimalConditionHandler.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/Filter/BigDecimalCondition/BigDecimalConditionHandler.java @@ -22,8 +22,6 @@ package org.chorem.lima.ui.Filter.BigDecimalCondition; * #L% */ -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import org.chorem.lima.beans.AbstractBigDecimalCondition; import org.chorem.lima.beans.Condition; import org.chorem.lima.beans.DebitCondition; @@ -38,8 +36,6 @@ import java.math.BigDecimal; */ public class BigDecimalConditionHandler implements ConditionHandler { - private static final Log log = LogFactory.getLog(BigDecimalConditionHandler.class); - protected BigDecimalConditionView view; protected AbstractBigDecimalCondition condition; diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/Filter/ConditionHandler.java b/lima-swing/src/main/java/org/chorem/lima/ui/Filter/ConditionHandler.java index 5dbf4ec..83144df 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/Filter/ConditionHandler.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/Filter/ConditionHandler.java @@ -32,9 +32,9 @@ import javax.swing.*; */ public interface ConditionHandler { - public Condition getCondition(); + Condition getCondition(); - public JInternalFrame getView(); + JInternalFrame getView(); - public void setFilterHandler(FinancialTransactionConditionHandler filterHandler); + void setFilterHandler(FinancialTransactionConditionHandler filterHandler); } diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/Filter/EntryBookCondition/EntryBookConditionHandler.java b/lima-swing/src/main/java/org/chorem/lima/ui/Filter/EntryBookCondition/EntryBookConditionHandler.java index a212521..5dbebec 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/Filter/EntryBookCondition/EntryBookConditionHandler.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/Filter/EntryBookCondition/EntryBookConditionHandler.java @@ -22,17 +22,15 @@ package org.chorem.lima.ui.Filter.EntryBookCondition; * #L% */ -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import org.chorem.lima.beans.Condition; import org.chorem.lima.beans.EntryBookCondition; +import org.chorem.lima.business.LimaServiceFactory; import org.chorem.lima.business.api.EntryBookService; import org.chorem.lima.entity.EntryBook; -import org.chorem.lima.business.LimaServiceFactory; import org.chorem.lima.ui.Filter.ConditionHandler; import org.chorem.lima.ui.Filter.financialTransactionCondition.FinancialTransactionConditionHandler; -import javax.swing.*; +import javax.swing.JList; import javax.swing.event.ListSelectionEvent; import java.util.List; @@ -41,8 +39,6 @@ import java.util.List; */ public class EntryBookConditionHandler implements ConditionHandler { - private static final Log log = LogFactory.getLog(EntryBookConditionHandler.class); - protected EntryBookConditionView view; protected EntryBookCondition condition; diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/Filter/StringCondition/StringConditionHandler.java b/lima-swing/src/main/java/org/chorem/lima/ui/Filter/StringCondition/StringConditionHandler.java index 2d6e25c..4983cda 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/Filter/StringCondition/StringConditionHandler.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/Filter/StringCondition/StringConditionHandler.java @@ -22,14 +22,11 @@ package org.chorem.lima.ui.Filter.StringCondition; * #L% */ -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import org.chorem.lima.beans.AbstractStringCondition; import org.chorem.lima.beans.Condition; import org.chorem.lima.beans.VoucherCondition; import org.chorem.lima.ui.Filter.ConditionHandler; import org.chorem.lima.ui.Filter.financialTransactionCondition.FinancialTransactionConditionHandler; -import org.chorem.lima.ui.financialtransactionsearch.FinancialTransactionSearchViewHandler; import java.awt.event.ActionEvent; import java.awt.event.ItemEvent; @@ -40,10 +37,6 @@ import java.awt.event.KeyEvent; */ public class StringConditionHandler implements ConditionHandler { - /** log. */ - private static final Log log = - LogFactory.getLog(FinancialTransactionSearchViewHandler.class); - protected StringConditionView view; protected AbstractStringCondition condition; diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/Filter/dateCondition/DateConditionHandler.java b/lima-swing/src/main/java/org/chorem/lima/ui/Filter/dateCondition/DateConditionHandler.java index 34a66a3..322b7e8 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/Filter/dateCondition/DateConditionHandler.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/Filter/dateCondition/DateConditionHandler.java @@ -22,13 +22,10 @@ package org.chorem.lima.ui.Filter.dateCondition; * #L% */ -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import org.chorem.lima.beans.Condition; import org.chorem.lima.beans.DateCondition; import org.chorem.lima.ui.Filter.ConditionHandler; import org.chorem.lima.ui.Filter.financialTransactionCondition.FinancialTransactionConditionHandler; -import org.chorem.lima.ui.financialtransactionsearch.FinancialTransactionSearchViewHandler; import java.awt.event.ItemEvent; import java.text.DateFormat; @@ -40,10 +37,6 @@ import java.util.Date; */ public class DateConditionHandler implements ConditionHandler { - /** log. */ - private static final Log log = - LogFactory.getLog(FinancialTransactionSearchViewHandler.class); - protected DateConditionView view; protected DateCondition condition; diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/Filter/dateIntervalCondition/DateIntervalConditionHandler.java b/lima-swing/src/main/java/org/chorem/lima/ui/Filter/dateIntervalCondition/DateIntervalConditionHandler.java index bc31329..80eb2e5 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/Filter/dateIntervalCondition/DateIntervalConditionHandler.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/Filter/dateIntervalCondition/DateIntervalConditionHandler.java @@ -22,13 +22,10 @@ package org.chorem.lima.ui.Filter.dateIntervalCondition; * #L% */ -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import org.chorem.lima.beans.Condition; import org.chorem.lima.beans.DateIntervalCondition; import org.chorem.lima.ui.Filter.ConditionHandler; import org.chorem.lima.ui.Filter.financialTransactionCondition.FinancialTransactionConditionHandler; -import org.chorem.lima.ui.financialtransactionsearch.FinancialTransactionSearchViewHandler; import java.text.DateFormat; import java.text.SimpleDateFormat; @@ -39,10 +36,6 @@ import java.util.Date; */ public class DateIntervalConditionHandler implements ConditionHandler { - /** log. */ - private static final Log log = - LogFactory.getLog(FinancialTransactionSearchViewHandler.class); - protected DateIntervalConditionView view; protected DateIntervalCondition condition; diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/Filter/financialPeriodCondition/FinancialPeriodConditionHandler.java b/lima-swing/src/main/java/org/chorem/lima/ui/Filter/financialPeriodCondition/FinancialPeriodConditionHandler.java index 5b2abf0..0fbaff9 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/Filter/financialPeriodCondition/FinancialPeriodConditionHandler.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/Filter/financialPeriodCondition/FinancialPeriodConditionHandler.java @@ -22,18 +22,15 @@ package org.chorem.lima.ui.Filter.financialPeriodCondition; * #L% */ -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import org.chorem.lima.beans.Condition; import org.chorem.lima.beans.FinancialPeriodCondition; +import org.chorem.lima.business.LimaServiceFactory; import org.chorem.lima.business.api.FinancialPeriodService; import org.chorem.lima.entity.FinancialPeriod; -import org.chorem.lima.business.LimaServiceFactory; import org.chorem.lima.ui.Filter.ConditionHandler; import org.chorem.lima.ui.Filter.financialTransactionCondition.FinancialTransactionConditionHandler; -import org.chorem.lima.ui.financialtransactionsearch.FinancialTransactionSearchViewHandler; -import javax.swing.*; +import javax.swing.JList; import javax.swing.event.ListSelectionEvent; import java.util.List; @@ -42,10 +39,6 @@ import java.util.List; */ public class FinancialPeriodConditionHandler implements ConditionHandler { - /** log. */ - private static final Log log = - LogFactory.getLog(FinancialTransactionSearchViewHandler.class); - protected FinancialPeriodConditionView view; protected FinancialPeriodCondition condition; diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/Filter/fiscalPeriodCondition/FiscalPeriodConditionHandler.java b/lima-swing/src/main/java/org/chorem/lima/ui/Filter/fiscalPeriodCondition/FiscalPeriodConditionHandler.java index d8f74c3..59496d5 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/Filter/fiscalPeriodCondition/FiscalPeriodConditionHandler.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/Filter/fiscalPeriodCondition/FiscalPeriodConditionHandler.java @@ -22,17 +22,15 @@ package org.chorem.lima.ui.Filter.fiscalPeriodCondition; * #L% */ -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import org.chorem.lima.beans.Condition; import org.chorem.lima.beans.FiscalPeriodCondition; +import org.chorem.lima.business.LimaServiceFactory; import org.chorem.lima.business.api.FiscalPeriodService; import org.chorem.lima.entity.FiscalPeriod; -import org.chorem.lima.business.LimaServiceFactory; import org.chorem.lima.ui.Filter.ConditionHandler; import org.chorem.lima.ui.Filter.financialTransactionCondition.FinancialTransactionConditionHandler; -import javax.swing.*; +import javax.swing.JList; import javax.swing.event.ListSelectionEvent; import java.util.List; @@ -42,8 +40,6 @@ import java.util.List; */ public class FiscalPeriodConditionHandler implements ConditionHandler { - private static final Log log = LogFactory.getLog(FiscalPeriodConditionHandler.class); - protected FiscalPeriodConditionView view; protected FiscalPeriodCondition condition; diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/LimaRendererUtil.java b/lima-swing/src/main/java/org/chorem/lima/ui/LimaRendererUtil.java index f69121e..38e2f58 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/LimaRendererUtil.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/LimaRendererUtil.java @@ -22,12 +22,11 @@ package org.chorem.lima.ui; import jaxx.runtime.swing.renderer.DecoratorListCellRenderer; -import jaxx.runtime.swing.renderer.DecoratorProviderListCellRenderer; import org.chorem.lima.LimaSwingApplicationContext; import org.nuiton.decorator.Decorator; import org.nuiton.decorator.DecoratorProvider; -import javax.swing.*; +import javax.swing.ListCellRenderer; /** * Helper class to deal with renderers. @@ -37,11 +36,6 @@ import javax.swing.*; */ public class LimaRendererUtil { - public static ListCellRenderer newDecoratorProviderListCellRenderer() { - DecoratorProvider decoratorProvider = LimaSwingApplicationContext.get().getDecoratorProvider(); - return new DecoratorProviderListCellRenderer(decoratorProvider); - } - public static ListCellRenderer newDecoratorListCellRenderer(Class<?> type) { DecoratorProvider decoratorProvider = LimaSwingApplicationContext.get().getDecoratorProvider(); diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java b/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java index 4d3eacf..2012972 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java @@ -29,9 +29,10 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.lima.LimaSwingApplicationContext; import org.chorem.lima.LimaSwingConfig; -import org.chorem.lima.business.LimaServiceFactory; +import org.chorem.lima.LimaTechnicalException; import org.chorem.lima.business.api.OptionsService; import org.chorem.lima.enums.ImportExportEnum; +import org.chorem.lima.business.LimaServiceFactory; import org.chorem.lima.ui.account.AccountView; import org.chorem.lima.ui.celleditor.NumberSeparatorCellRenderer; import org.chorem.lima.ui.celleditor.NumberSeparatorTableCellRenderer; @@ -50,12 +51,19 @@ import org.chorem.lima.ui.vatchart.VatChartView; import org.nuiton.util.DesktopUtil; import org.nuiton.widget.SwingSession; -import javax.swing.*; +import javax.swing.DefaultCellEditor; +import javax.swing.ImageIcon; +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JEditorPane; +import javax.swing.JScrollPane; +import javax.swing.JTabbedPane; +import javax.swing.UIManager; import javax.swing.border.LineBorder; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.plaf.BorderUIResource; -import java.awt.*; +import java.awt.Component; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; @@ -63,6 +71,7 @@ import java.net.URI; import java.net.URL; import java.util.Locale; +import static org.nuiton.i18n.I18n.setDefaultLocale; import static org.nuiton.i18n.I18n.t; /** @@ -268,7 +277,7 @@ public class MainViewHandler { try { DesktopUtil.browse(siteURL.toURI()); } catch (Exception e) { - throw new RuntimeException("Can't open lima website at " + siteURL, e); + throw new LimaTechnicalException("Can't open lima website at " + siteURL, e); } } @@ -499,7 +508,7 @@ public class MainViewHandler { OptionsService optionsService = LimaServiceFactory.getService(OptionsService.class); - String host = optionsService.getLimaHostAddress(); + String host = optionsService.getLimaHttpHost(); int port = optionsService.getLimaHttpPort(); String url; diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java b/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java index 9dc3d91..3510a61 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java @@ -272,7 +272,7 @@ public class AccountViewHandler implements ServiceListener { List<MutableTreeTableNode> nodesToMove = findSubNodes(node, newAccount.getAccountNumber()); for (MutableTreeTableNode nodeToMove : nodesToMove) { - model.removeNodeFromParent((MutableTreeTableNode)nodeToMove); + model.removeNodeFromParent(nodeToMove); newNode.add(nodeToMove); } diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/AutoCompleteTableCellEditor.java b/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/AutoCompleteTableCellEditor.java index 08e7942..0c2341d 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/AutoCompleteTableCellEditor.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/AutoCompleteTableCellEditor.java @@ -34,7 +34,7 @@ import java.util.Map; */ public class AutoCompleteTableCellEditor extends StringTableCellEditor { - protected static Map<String, List<String>> precedingValuesById = Maps.newHashMap(); + protected static final Map<String, List<String>> precedingValuesById = Maps.newHashMap(); List<String> precedingValues; diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/DateTableCellEditor.java b/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/DateTableCellEditor.java index 5a5d334..7d1bb6f 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/DateTableCellEditor.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/DateTableCellEditor.java @@ -29,11 +29,14 @@ import org.chorem.lima.LimaSwingApplicationContext; import org.chorem.lima.LimaSwingConfig; import org.jdesktop.swingx.JXDatePicker; -import javax.swing.*; +import javax.swing.AbstractCellEditor; +import javax.swing.JFormattedTextField; +import javax.swing.JTable; +import javax.swing.SwingUtilities; import javax.swing.event.AncestorEvent; import javax.swing.event.AncestorListener; import javax.swing.table.TableCellEditor; -import java.awt.*; +import java.awt.Component; import java.awt.event.FocusEvent; import java.awt.event.FocusListener; import java.text.DateFormat; @@ -86,7 +89,9 @@ public class DateTableCellEditor extends AbstractCellEditor try { datePicker.commitEdit(); } catch (ParseException e) { - e.printStackTrace(); + if (log.isErrorEnabled()) { + log.error("Could not commit date editor value", e); + } } Calendar calendar = Calendar.getInstance(); diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/EmptyCellRenderer.java b/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/EmptyCellRenderer.java index caaad9f..522b880 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/EmptyCellRenderer.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/EmptyCellRenderer.java @@ -45,10 +45,6 @@ public class EmptyCellRenderer extends DefaultTableCellRenderer { /** serialVersionUID. */ private static final long serialVersionUID = -7834417406160620726L; - public EmptyCellRenderer() { - - } - public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/combobox/AccountComboBoxModel.java b/lima-swing/src/main/java/org/chorem/lima/ui/combobox/AccountComboBoxModel.java index 2f100c2..9e59ec7 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/combobox/AccountComboBoxModel.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/combobox/AccountComboBoxModel.java @@ -22,15 +22,14 @@ package org.chorem.lima.ui.combobox; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.chorem.lima.business.LimaServiceFactory; import org.chorem.lima.business.ServiceListener; import org.chorem.lima.business.api.AccountService; import org.chorem.lima.business.api.ImportService; import org.chorem.lima.entity.Account; -import org.chorem.lima.business.LimaServiceFactory; -import javax.swing.*; +import javax.swing.AbstractListModel; +import javax.swing.ComboBoxModel; import java.util.List; /** Account combo box model. */ @@ -39,9 +38,6 @@ public class AccountComboBoxModel extends AbstractListModel implements ComboBoxM private static final long serialVersionUID = 1L; - private static final Log log = - LogFactory.getLog(AccountComboBoxModel.class); - protected Object selectedAccount; protected List<Account> datasCache; diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/combobox/EntryBookComboBoxModel.java b/lima-swing/src/main/java/org/chorem/lima/ui/combobox/EntryBookComboBoxModel.java index aa0313a..ddc2a84 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/combobox/EntryBookComboBoxModel.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/combobox/EntryBookComboBoxModel.java @@ -46,9 +46,6 @@ public class EntryBookComboBoxModel extends AbstractListModel implements ComboBo private static final long serialVersionUID = 1L; - private static final Log log = - LogFactory.getLog(EntryBookComboBoxModel.class); - protected Object selectedEntryBook; protected EntryBookService entryBookService; diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FinancialPeriodComboBoxModel.java b/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FinancialPeriodComboBoxModel.java deleted file mode 100644 index 16f2ce8..0000000 --- a/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FinancialPeriodComboBoxModel.java +++ /dev/null @@ -1,167 +0,0 @@ -/* - * #%L - * Lima :: Swing - * %% - * Copyright (C) 2008 - 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.combobox; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.chorem.lima.business.ServiceListener; -import org.chorem.lima.business.api.FinancialPeriodService; -import org.chorem.lima.business.api.FiscalPeriodService; -import org.chorem.lima.business.api.ImportService; -import org.chorem.lima.entity.FinancialPeriod; -import org.chorem.lima.entity.FiscalPeriod; -import org.chorem.lima.business.LimaServiceFactory; - -import javax.swing.*; -import java.util.List; - -/** - * Opened financial period combo box model. - * - * @author chatellier - * @version $Revision$ - * <p/> - * Last update : $Date$ - * By : $Author$ - */ -public class FinancialPeriodComboBoxModel extends AbstractListModel implements ComboBoxModel, ServiceListener { - - private static final long serialVersionUID = 1L; - - private static final Log log = - LogFactory.getLog(FinancialPeriodComboBoxModel.class); - - protected Object selectedFinancialPeriod; - - protected List<FinancialPeriod> datasCache; - - protected FinancialPeriodService financialPeriodService; - - protected FiscalPeriod selectedFiscalPeriod; - - private boolean displayAllPeriods; - - /** Constructor for locked period list. */ - public FinancialPeriodComboBoxModel() { - this(false); - } - - /** - * Constructor for period list. - * - * @param displayAllPeriods if {@code true}, display all available period, otherwize - * display only locked ones - */ - public FinancialPeriodComboBoxModel(boolean displayAllPeriods) { - - this.displayAllPeriods = displayAllPeriods; - - financialPeriodService = - LimaServiceFactory.getService( - FinancialPeriodService.class); - LimaServiceFactory.addServiceListener(FinancialPeriodService.class, this); - LimaServiceFactory.addServiceListener(FiscalPeriodService.class, this); - LimaServiceFactory.addServiceListener(ImportService.class, this); - if (displayAllPeriods) { - datasCache = getAllDataList(); - } else { - datasCache = getDataList(); - } - for (FinancialPeriod financialPeriod : datasCache) { - - } - } - - public void setSelectedFiscalPeriod(FiscalPeriod fiscalPeriod) { - selectedFiscalPeriod = fiscalPeriod; - if (displayAllPeriods) { - datasCache = getAllDataList(); - } else { - datasCache = getDataList(); - } - fireContentsChanged(this, 0, datasCache.size()); - } - - @Override - public int getSize() { - return datasCache.size(); - } - - @Override - public Object getElementAt(int index) { - return datasCache.get(index); - } - - @Override - public void setSelectedItem(Object anItem) { - selectedFinancialPeriod = anItem; - } - - @Override - public Object getSelectedItem() { - return selectedFinancialPeriod; - } - - //get unblocked financial periods data list - public List<FinancialPeriod> getDataList() { - List<FinancialPeriod> result = null; - if (selectedFiscalPeriod != null) { - result = financialPeriodService.getFinancialPeriods(selectedFiscalPeriod.getBeginDate(), selectedFiscalPeriod.getEndDate()); - } else { - result = financialPeriodService.getUnblockedFinancialPeriods(); - } - return result; - } - - //get all financial periods data list - public List<FinancialPeriod> getAllDataList() { - List<FinancialPeriod> result = null; - if (selectedFiscalPeriod != null) { - result = financialPeriodService.getFinancialPeriods(selectedFiscalPeriod.getBeginDate(), selectedFiscalPeriod.getEndDate()); - } else { - result = financialPeriodService.getAllFinancialPeriods(); - } - return result; - } - - public void refresh() { - datasCache = getDataList(); - fireContentsChanged(this, 0, datasCache.size()); - } - - public void refreshAll() { - datasCache = getAllDataList(); - fireContentsChanged(this, 0, datasCache.size()); - } - - @Override - public void notifyMethod(String serviceName, String methodeName) { - if (serviceName.contains("Period") || methodeName.contains("importAll")) { - if (displayAllPeriods) { - datasCache = getAllDataList(); - } else { - datasCache = getDataList(); - } - } - } -} diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FiscalPeriodComboBoxModel.java b/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FiscalPeriodComboBoxModel.java index dc01fc5..2d297db 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FiscalPeriodComboBoxModel.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FiscalPeriodComboBoxModel.java @@ -60,16 +60,6 @@ public class FiscalPeriodComboBoxModel extends AbstractListModel implements Comb } } - //constructor for all fiscal period - public FiscalPeriodComboBoxModel(boolean all) { - fiscalPeriodService = - LimaServiceFactory.getService( - FiscalPeriodService.class); - LimaServiceFactory.addServiceListener(FiscalPeriodService.class, this); - LimaServiceFactory.addServiceListener(ImportService.class, this); - datasCache = getAllDataList(); - } - @Override public int getSize() { return datasCache.size(); @@ -88,7 +78,7 @@ public class FiscalPeriodComboBoxModel extends AbstractListModel implements Comb log.debug("Beginning and end dates of first fiscal period : " + ((FiscalPeriod) getElementAt(0)).getBeginDate() + ", " + ((FiscalPeriod) getElementAt(0)).getEndDate()); } - selectedFiscalPeriod = (FiscalPeriod)anItem; + selectedFiscalPeriod = anItem; } @Override diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/combobox/LeafAccountComboBoxModel.java b/lima-swing/src/main/java/org/chorem/lima/ui/combobox/LeafAccountComboBoxModel.java index 15df29a..149a76c 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/combobox/LeafAccountComboBoxModel.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/combobox/LeafAccountComboBoxModel.java @@ -42,8 +42,6 @@ public class LeafAccountComboBoxModel extends AbstractListModel implements Combo private static final long serialVersionUID = 1L; - private static final Log log = LogFactory.getLog(LeafAccountComboBoxModel.class); - protected Object selectedAccount; protected List<Account> datasCache; diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/combobox/LetterComboBoxModel.java b/lima-swing/src/main/java/org/chorem/lima/ui/combobox/LetterComboBoxModel.java deleted file mode 100644 index efe82d0..0000000 --- a/lima-swing/src/main/java/org/chorem/lima/ui/combobox/LetterComboBoxModel.java +++ /dev/null @@ -1,100 +0,0 @@ -package org.chorem.lima.ui.combobox; -/* - * #%L - * Lima :: Swing - * %% - * Copyright (C) 2008 - 2012 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 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% - */ - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.chorem.lima.business.ServiceListener; -import org.chorem.lima.business.api.FinancialTransactionService; -import org.chorem.lima.business.LimaServiceFactory; - -import javax.swing.*; -import java.util.List; - -/** - * Date: 13/08/12 - * - * @author mallon <mallon@codelutin.com> - * @since 0.6-alpha-2 - */ -public class LetterComboBoxModel extends AbstractListModel implements ComboBoxModel, ServiceListener { - - private static final long serialVersionUID = 1L; - - private static final Log log = - LogFactory.getLog(AccountComboBoxModel.class); - - protected Object selectedAccount; - - protected List<String> datasCache; - - protected FinancialTransactionService financialTransactionService; - - public LetterComboBoxModel() { - financialTransactionService = - LimaServiceFactory.getService(FinancialTransactionService.class); - LimaServiceFactory.addServiceListener(FinancialTransactionService.class, this); - datasCache = getDataList(); - } - - @Override - public Object getSelectedItem() { - return selectedAccount; - } - - @Override - public void setSelectedItem(Object anItem) { - selectedAccount = anItem; - fireContentsChanged(this, -1, -1); - } - - - @Override - public Object getElementAt(int index) { - return datasCache.get(index); - } - - @Override - public int getSize() { - return datasCache.size(); - } - - public List<String> getDataList() { - List<String> result = financialTransactionService.getAllLetters(); - return result; - - } - - public void refresh() { - datasCache = getDataList(); - fireContentsChanged(this, 0, datasCache.size()); - } - - @Override - public void notifyMethod(String serviceName, String methodeName) { - if (methodeName.contains("Letter") || - methodeName.contains("importAll")) { - refresh(); - } - } - -} diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/common/IntervalListener.java b/lima-swing/src/main/java/org/chorem/lima/ui/common/IntervalListener.java deleted file mode 100644 index 4729919..0000000 --- a/lima-swing/src/main/java/org/chorem/lima/ui/common/IntervalListener.java +++ /dev/null @@ -1,29 +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.common; - -import java.util.EventListener; -import java.util.EventObject; - -public interface IntervalListener extends EventListener { - public void intervalChanged(EventObject e); -} diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/common/TableModelWithGroup.java b/lima-swing/src/main/java/org/chorem/lima/ui/common/TableModelWithGroup.java index 2e2a8c7..6371117 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/common/TableModelWithGroup.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/common/TableModelWithGroup.java @@ -29,20 +29,6 @@ public abstract class TableModelWithGroup<E> extends AbstractLimaTableModel<E> { private static final long serialVersionUID = 2349944168938847283L; - public int indexGroupAt(int row) { - int countGroup = 0; - E precedingValue = get(0); - for (int precedingRow = 1; precedingRow <= row; precedingRow++) { - E value = get(precedingRow); - if ( ! sameGroup(precedingValue, value)) { - countGroup++; - } - precedingValue = value; - } - return countGroup; - - } - public int indexInGroup(int row) { int index = 0; while (row-index > 0 && sameGroup(get(row), get(row-index-1))) { diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionDefaultTable.java b/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionDefaultTable.java index a871e51..9cbe321 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionDefaultTable.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionDefaultTable.java @@ -22,8 +22,6 @@ package org.chorem.lima.ui.financialtransaction; * #L% */ -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.ui.celleditor.AccountTableCellRenderer; @@ -36,7 +34,10 @@ import org.chorem.lima.ui.common.AbstractLimaTable; import org.chorem.lima.ui.common.CellRouteHorizontalAction; import org.chorem.lima.ui.common.CellRouteVerticalAction; -import javax.swing.*; +import javax.swing.ActionMap; +import javax.swing.InputMap; +import javax.swing.JComponent; +import javax.swing.KeyStroke; import java.awt.event.KeyEvent; import java.math.BigDecimal; import java.util.Date; @@ -49,8 +50,6 @@ public class FinancialTransactionDefaultTable<H> extends AbstractLimaTable<H> { /** serialVersionUID. */ private static final long serialVersionUID = 3133690382049594727L; - private static final Log log = LogFactory.getLog(FinancialTransactionTable.class); - public FinancialTransactionDefaultTable(H handler) { super(handler); setSortable(false); 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 44ab57b..f65d248 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 @@ -986,7 +986,7 @@ public class FinancialTransactionViewHandler implements ServiceListener, TableMo BigDecimal totalDebit = BigDecimal.ZERO; BigDecimal totalCredit = BigDecimal.ZERO; - BigDecimal balance = BigDecimal.ZERO; + BigDecimal balance; for (Entry entry : tableModel.getValues()) { diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchViewHandler.java b/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchViewHandler.java index d0936fb..2b65659 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchViewHandler.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchViewHandler.java @@ -22,11 +22,9 @@ package org.chorem.lima.ui.financialtransactionsearch; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import org.chorem.lima.beans.FinancialTransactionCondition; -import org.chorem.lima.business.api.FinancialTransactionService; import org.chorem.lima.business.LimaServiceFactory; +import org.chorem.lima.business.api.FinancialTransactionService; import org.chorem.lima.ui.Filter.AccountCondition.AccountConditionView; import org.chorem.lima.ui.Filter.BigDecimalCondition.CreditConditionView; import org.chorem.lima.ui.Filter.BigDecimalCondition.DebitConditionView; @@ -43,7 +41,11 @@ import org.chorem.lima.ui.Filter.financialTransactionCondition.FinancialTransact import org.chorem.lima.ui.Filter.fiscalPeriodCondition.FiscalPeriodConditionView; import org.chorem.lima.ui.financialtransaction.FinancialTransactionDefaultTable; -import javax.swing.*; +import javax.swing.AbstractAction; +import javax.swing.ActionMap; +import javax.swing.InputMap; +import javax.swing.JComponent; +import javax.swing.KeyStroke; import java.awt.event.ActionEvent; import java.awt.event.KeyEvent; @@ -58,10 +60,6 @@ import java.awt.event.KeyEvent; */ public class FinancialTransactionSearchViewHandler { - /** log. */ - private static final Log log = - LogFactory.getLog(FinancialTransactionSearchViewHandler.class); - protected FinancialTransactionSearchView view; protected FinancialTransactionSearchTableModel tableModel; diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodTableModel.java b/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodTableModel.java index f550f08..60887dd 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodTableModel.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodTableModel.java @@ -22,8 +22,6 @@ package org.chorem.lima.ui.fiscalperiod; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import org.chorem.lima.business.utils.FiscalPeriodComparator; import org.chorem.lima.entity.FiscalPeriod; import org.chorem.lima.ui.common.AbstractColumn; @@ -47,8 +45,6 @@ public class FiscalPeriodTableModel extends AbstractLimaTableModel<FiscalPeriod> /** serialVersionUID. */ private static final long serialVersionUID = 77027335135838258L; - private static final Log log = LogFactory.getLog(FiscalPeriodTableModel.class); - public FiscalPeriodTableModel() { comparator = new FiscalPeriodComparator(); } diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java b/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java index 8ab4506..164ec2d 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java @@ -36,7 +36,7 @@ import org.chorem.lima.business.ImportExportResults; import org.chorem.lima.business.ImportResult; import org.chorem.lima.business.api.ExportService; import org.chorem.lima.business.api.ImportService; -import org.chorem.lima.business.exceptions.AlreadyExistFinancialStatement; +import org.chorem.lima.business.exceptions.AlreadyExistFinancialStatementException; import org.chorem.lima.business.exceptions.AlreadyExistVatStatementException; import org.chorem.lima.business.exceptions.BeginAfterEndFiscalPeriodException; import org.chorem.lima.business.exceptions.ImportFileException; @@ -436,8 +436,8 @@ public class ImportExport { result.append(t("lima.fiscalPeriod.error.lockedFinancialPeriod") + "\n"); } else if (importException instanceof LockedEntryBookException) { result.append(t("lima.entryBook.error.lockedEntryBook", ((LockedEntryBookException) importException).getClosedPeriodicEntryBook().getFinancialPeriod().getBeginDate(), ((LockedEntryBookException) importException).getClosedPeriodicEntryBook().getFinancialPeriod().getEndDate()) + "\n"); - } else if (importException instanceof AlreadyExistFinancialStatement) { - result.append(t("lima.financialStatement.error.alreadyExistFinancialStatement", ((AlreadyExistFinancialStatement) importException).getFinancialStatementLabel()) + "\n"); + } else if (importException instanceof AlreadyExistFinancialStatementException) { + result.append(t("lima.financialStatement.error.alreadyExistFinancialStatement", ((AlreadyExistFinancialStatementException) importException).getFinancialStatementLabel()) + "\n"); } else if (importException instanceof AlreadyExistVatStatementException) { result.append(t("lima.vatStatement.error.alreadyExistVatStatement", ((AlreadyExistVatStatementException) importException).getVatStatementLabel()) + "\n"); } else if (importException instanceof NoFiscalPeriodFoundException) { diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/lettering/TypeEntry.java b/lima-swing/src/main/java/org/chorem/lima/ui/lettering/TypeEntry.java index 6fd4c90..9ac2c00 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/lettering/TypeEntry.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/lettering/TypeEntry.java @@ -39,7 +39,7 @@ public enum TypeEntry { private boolean noLettered; - private TypeEntry(boolean lettered, boolean noLettered) { + TypeEntry(boolean lettered, boolean noLettered) { this.lettered = lettered; this.noLettered = noLettered; } diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateIdentityPanelHandler.java b/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateIdentityPanelHandler.java index 5dfe631..fc83caa 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateIdentityPanelHandler.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateIdentityPanelHandler.java @@ -22,13 +22,10 @@ package org.chorem.lima.ui.opening; * #L% */ -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.chorem.lima.business.LimaServiceFactory; import org.chorem.lima.business.api.IdentityService; import org.chorem.lima.entity.Identity; import org.chorem.lima.entity.IdentityImpl; -import org.chorem.lima.business.LimaServiceFactory; -import org.chorem.lima.ui.identity.IdentityHandler; /** * @author Sylvain Bavencoff <bavencoff@codelutin.com> @@ -39,8 +36,6 @@ public class CreateIdentityPanelHandler { protected CreateIdentityPanel view; - private static final Log log = LogFactory.getLog(IdentityHandler.class); - public CreateIdentityPanelHandler(CreateIdentityPanel view) { this.view = view; diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartTreeTableModel.java b/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartTreeTableModel.java index 8b97ba9..847c1d0 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartTreeTableModel.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartTreeTableModel.java @@ -79,7 +79,7 @@ public class VatChartTreeTableModel extends AbstractTreeTableModel { @Override public int getChildCount(Object node) { - int result = 0; + int result; if (node == getRoot()) { result = vatStatementService. getChildrenVatStatement(null).size(); @@ -94,7 +94,7 @@ public class VatChartTreeTableModel extends AbstractTreeTableModel { @Override public Object getChild(Object parent, int index) { - Object result = null; + Object result; if (parent == getRoot()) { List<VatStatement> vatStatements = vatStatementService.getChildrenVatStatement(null); @@ -111,7 +111,7 @@ public class VatChartTreeTableModel extends AbstractTreeTableModel { @Override public int getIndexOfChild(Object parent, Object child) { - int result = 0; + int result; if (parent == getRoot()) { List<VatStatement> vatStatements = diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartViewHandler.java b/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartViewHandler.java index a876f34..cc1c383 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartViewHandler.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartViewHandler.java @@ -21,20 +21,22 @@ */ package org.chorem.lima.ui.vatchart; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.chorem.lima.business.LimaServiceFactory; import org.chorem.lima.business.ServiceListener; import org.chorem.lima.business.api.ImportService; import org.chorem.lima.business.api.VatStatementService; import org.chorem.lima.entity.VatStatement; import org.chorem.lima.entity.VatStatementImpl; import org.chorem.lima.enums.ImportExportEnum; -import org.chorem.lima.enums.VatStatementsChartEnum; -import org.chorem.lima.business.LimaServiceFactory; import org.chorem.lima.ui.importexport.ImportExport; import org.jdesktop.swingx.JXTreeTable; -import javax.swing.*; +import javax.swing.AbstractAction; +import javax.swing.ActionMap; +import javax.swing.InputMap; +import javax.swing.JComponent; +import javax.swing.JOptionPane; +import javax.swing.KeyStroke; import javax.swing.tree.TreePath; import java.awt.event.ActionEvent; import java.awt.event.KeyEvent; @@ -43,9 +45,6 @@ import static org.nuiton.i18n.I18n.t; public class VatChartViewHandler implements ServiceListener { - /** log. */ - private static final Log log = LogFactory.getLog(VatChartViewHandler.class); - protected VatStatementService vatStatementService; protected VatChartView view; diff --git a/lima-swing/src/main/java/org/chorem/lima/util/ErrorHelper.java b/lima-swing/src/main/java/org/chorem/lima/util/ErrorHelper.java index 5547706..8a1a184 100644 --- a/lima-swing/src/main/java/org/chorem/lima/util/ErrorHelper.java +++ b/lima-swing/src/main/java/org/chorem/lima/util/ErrorHelper.java @@ -88,31 +88,12 @@ public class ErrorHelper implements ErrorReporter { * * @param message message for user */ - public void showErrorDialog(String message) { - showErrorDialog(message, null); - } - - /** - * Display a user friendly error frame. - * - * @param message message for user - */ public void showErrorMessage(String message) { JOptionPane.showMessageDialog(null, message, t("lima.error"), JOptionPane.ERROR_MESSAGE); } - /** - * Display a user friendly error frame. - * - * @param message message for user - * @param cause exception cause - */ - public void showErrorDialog(String message, Throwable cause) { - showErrorDialog(null, message, cause); - } - /* * @see org.jdesktop.swingx.error.ErrorReporter#reportError(org.jdesktop.swingx.error.ErrorInfo) */ -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.