branch feature/1197-modularisation updated (c771fc5 -> 5429310)
This is an automated email from the git hooks/post-receive script. New change to branch feature/1197-modularisation in repository lima. See http://git.chorem.org/lima.git from c771fc5 refs #1197 renommage du zip du module server new 9cace2b Make module lima-report independant against lima-business (only depends on lima-business-api) new cf1949b Force BigDecimal formatting properties to be saved on server side new 1b9c881 Move some configuration (about lima-report) in lima-business common module new 5429310 Make lima-swing independent of lima-business (only lima-business-api) The 4 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit 542931034466d9b604269f3bee7b820e14c15e0c Author: Arnaud Thimel <thimel@codelutin.com> Date: Wed Mar 18 00:41:42 2015 +0100 Make lima-swing independent of lima-business (only lima-business-api) commit 1b9c88125db8eca665ef5ce980d75f92ecfe7c49 Author: Arnaud Thimel <thimel@codelutin.com> Date: Wed Mar 18 00:24:58 2015 +0100 Move some configuration (about lima-report) in lima-business common module commit cf1949b06498a6cd2520b9fb45c7fec813f68001 Author: Arnaud Thimel <thimel@codelutin.com> Date: Tue Mar 17 23:35:46 2015 +0100 Force BigDecimal formatting properties to be saved on server side commit 9cace2b6db51f0993b67822815b611a72b65350c Author: Arnaud Thimel <thimel@codelutin.com> Date: Tue Mar 17 23:08:21 2015 +0100 Make module lima-report independant against lima-business (only depends on lima-business-api) Summary of changes: lima-business-api/pom.xml | 16 +- .../chorem/lima/business}/LimaServiceFactory.java | 11 +- .../org/chorem/lima/business/ServiceListener.java | 0 .../chorem/lima/business/ServiceMonitorable.java | 0 .../lima/business}/ServiceMonitorableHandler.java | 3 +- .../chorem/lima/business/api/OptionsService.java | 32 ++-- .../lima/business/config/LimaConfigOptionDef.java | 12 ++ .../lima/business/utils/AccountComparator.java | 0 .../lima/business/utils/BigDecimalToString.java | 28 ++- .../lima/business/utils/EntryComparator.java | 2 +- .../business/utils/FinancialPeriodComparator.java | 0 .../business/utils/FiscalPeriodComparator.java | 0 lima-business/pom.xml | 13 +- .../chorem/lima/business/LimaBusinessConfig.java | 50 ++++- .../lima/business/ejb/OptionsServiceImpl.java | 57 ++++-- .../resources/i18n/lima-business_en_GB.properties | 6 + .../resources/i18n/lima-business_fr_FR.properties | 6 + .../org/chorem/lima/business/AbstractLimaTest.java | 1 - lima-callao/pom.xml | 2 +- lima-report/pom.xml | 14 +- .../chorem/lima/report}/DocumentReportTypes.java | 2 +- .../org/chorem/lima/report}/DocumentsEnum.java | 2 +- .../report/{service => }/LimaReportConfig.java | 50 ++++- .../chorem/lima/report/action/ReportBuilder.java | 6 +- .../lima/report/service/DocumentService.java | 34 ++-- .../chorem/lima/report/utils/DocumentsEnum.java | 67 ------- .../resources/i18n/lima-report_en_GB.properties | 1 + .../resources/i18n/lima-report_fr_FR.properties | 1 + .../src/main/java/org.chorem.lima/LimaServer.java | 4 +- .../org.chorem.lima/server/HttpServerService.java | 25 +-- .../org.chorem.lima/server/LimaServerConfig.java | 25 +-- lima-swing/pom.xml | 8 +- .../src/main/java/org/chorem/lima/LimaMain.java | 2 +- .../main/java/org/chorem/lima/LimaSwingConfig.java | 203 ++------------------- .../EntryBookConditionHandler.java | 2 +- .../FinancialPeriodConditionHandler.java | 2 +- .../FiscalPeriodConditionHandler.java | 2 +- .../src/main/java/org/chorem/lima/ui/MainView.jaxx | 2 +- .../java/org/chorem/lima/ui/MainViewHandler.java | 41 +++-- .../chorem/lima/ui/account/AccountViewHandler.java | 2 +- .../lima/ui/combobox/AccountComboBoxModel.java | 2 +- .../lima/ui/combobox/EntryBookComboBoxModel.java | 2 +- .../ui/combobox/FinancialPeriodComboBoxModel.java | 2 +- .../ui/combobox/FiscalPeriodComboBoxModel.java | 2 +- .../lima/ui/combobox/LeafAccountComboBoxModel.java | 2 +- .../lima/ui/combobox/LetterComboBoxModel.java | 2 +- .../ui/common/FinancialTransactionTableModel.java | 2 +- .../lima/ui/entrybook/EntryBookViewHandler.java | 2 +- .../FinancialPeriodViewHandler.java | 2 +- .../FinancialStatementChartTreeTableModel.java | 2 +- .../FinancialStatementChartViewHandler.java | 2 +- .../FinancialTransactionViewHandler.java | 2 +- .../FinancialTransactionSearchTableModel.java | 2 +- .../FinancialTransactionSearchViewHandler.java | 2 +- .../ui/fiscalperiod/FiscalPeriodViewHandler.java | 2 +- .../java/org/chorem/lima/ui/home/AccountsPane.java | 2 +- .../org/chorem/lima/ui/home/EntryBooksPane.java | 2 +- .../lima/ui/home/FinancialTransactionsPane.java | 2 +- .../org/chorem/lima/ui/home/FiscalYearsPane.java | 2 +- .../chorem/lima/ui/identity/IdentityHandler.java | 2 +- .../chorem/lima/ui/importexport/ImportExport.java | 2 +- .../lima/ui/lettering/LetteringViewHandler.java | 2 +- .../lima/ui/opening/CreateFiscalPeriodPanel.jaxx | 2 +- .../ui/opening/CreateIdentityPanelHandler.java | 2 +- .../chorem/lima/ui/opening/OpeningViewHandler.java | 2 +- .../lima/ui/vatchart/VatChartTreeTableModel.java | 2 +- .../lima/ui/vatchart/VatChartViewHandler.java | 2 +- .../org/chorem/lima/util/BigDecimalToString.java | 26 +-- .../java/org/chorem/lima/ui/AbstractLimaTest.java | 2 +- src/site/rst/devel/server.rst | 2 +- 70 files changed, 357 insertions(+), 461 deletions(-) rename {lima-business/src/main/java/org/chorem/lima/service => lima-business-api/src/main/java/org/chorem/lima/business}/LimaServiceFactory.java (95%) rename {lima-business => lima-business-api}/src/main/java/org/chorem/lima/business/ServiceListener.java (100%) rename {lima-business => lima-business-api}/src/main/java/org/chorem/lima/business/ServiceMonitorable.java (100%) rename {lima-business/src/main/java/org/chorem/lima/service => lima-business-api/src/main/java/org/chorem/lima/business}/ServiceMonitorableHandler.java (97%) create mode 100644 lima-business-api/src/main/java/org/chorem/lima/business/config/LimaConfigOptionDef.java rename {lima-business => lima-business-api}/src/main/java/org/chorem/lima/business/utils/AccountComparator.java (100%) rename {lima-business => lima-business-api}/src/main/java/org/chorem/lima/business/utils/BigDecimalToString.java (71%) rename {lima-business => lima-business-api}/src/main/java/org/chorem/lima/business/utils/EntryComparator.java (91%) rename {lima-business => lima-business-api}/src/main/java/org/chorem/lima/business/utils/FinancialPeriodComparator.java (100%) rename {lima-business => lima-business-api}/src/main/java/org/chorem/lima/business/utils/FiscalPeriodComparator.java (100%) rename {lima-business/src/main/java/org/chorem/lima/business/utils => lima-report/src/main/java/org/chorem/lima/report}/DocumentReportTypes.java (96%) rename {lima-business/src/main/java/org/chorem/lima/business/utils => lima-report/src/main/java/org/chorem/lima/report}/DocumentsEnum.java (98%) rename lima-report/src/main/java/org/chorem/lima/report/{service => }/LimaReportConfig.java (89%) delete mode 100644 lima-report/src/main/java/org/chorem/lima/report/utils/DocumentsEnum.java -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/1197-modularisation in repository lima. See http://git.chorem.org/lima.git commit 9cace2b6db51f0993b67822815b611a72b65350c Author: Arnaud Thimel <thimel@codelutin.com> Date: Tue Mar 17 23:08:21 2015 +0100 Make module lima-report independant against lima-business (only depends on lima-business-api) --- lima-business-api/pom.xml | 16 +- .../chorem/lima/business}/LimaServiceFactory.java | 11 +- .../org/chorem/lima/business/ServiceListener.java | 0 .../chorem/lima/business/ServiceMonitorable.java | 0 .../lima/business}/ServiceMonitorableHandler.java | 3 +- .../chorem/lima/business/api/OptionsService.java | 28 +-- .../lima/business/config/LimaConfigOptionDef.java | 12 ++ .../lima/business/utils/BigDecimalToString.java | 28 ++- lima-business/pom.xml | 13 +- .../chorem/lima/business/LimaBusinessConfig.java | 26 ++- .../lima/business/ejb/OptionsServiceImpl.java | 47 +++-- .../resources/i18n/lima-business_en_GB.properties | 6 + .../resources/i18n/lima-business_fr_FR.properties | 6 + .../org/chorem/lima/business/AbstractLimaTest.java | 1 - lima-callao/pom.xml | 2 +- lima-report/pom.xml | 14 +- .../chorem/lima/report}/DocumentReportTypes.java | 2 +- .../org/chorem/lima/report}/DocumentsEnum.java | 2 +- .../report/{service => }/LimaReportConfig.java | 50 ++++- .../chorem/lima/report/action/ReportBuilder.java | 6 +- .../lima/report/service/DocumentService.java | 34 +++- .../chorem/lima/report/utils/DocumentsEnum.java | 67 ------- .../resources/i18n/lima-report_en_GB.properties | 1 + .../resources/i18n/lima-report_fr_FR.properties | 1 + .../src/main/java/org.chorem.lima/LimaServer.java | 4 +- .../org.chorem.lima/server/HttpServerService.java | 4 +- .../org.chorem.lima/server/LimaServerConfig.java | 2 +- lima-swing/pom.xml | 12 +- .../src/main/java/org/chorem/lima/LimaMain.java | 2 +- .../main/java/org/chorem/lima/LimaSwingConfig.java | 221 ++++----------------- .../EntryBookConditionHandler.java | 2 +- .../FinancialPeriodConditionHandler.java | 2 +- .../FiscalPeriodConditionHandler.java | 2 +- .../java/org/chorem/lima/ui/MainViewHandler.java | 21 +- .../chorem/lima/ui/account/AccountViewHandler.java | 2 +- .../lima/ui/combobox/AccountComboBoxModel.java | 2 +- .../lima/ui/combobox/EntryBookComboBoxModel.java | 2 +- .../ui/combobox/FinancialPeriodComboBoxModel.java | 2 +- .../ui/combobox/FiscalPeriodComboBoxModel.java | 2 +- .../lima/ui/combobox/LeafAccountComboBoxModel.java | 2 +- .../lima/ui/combobox/LetterComboBoxModel.java | 2 +- .../ui/common/FinancialTransactionTableModel.java | 2 +- .../lima/ui/entrybook/EntryBookViewHandler.java | 2 +- .../FinancialPeriodViewHandler.java | 2 +- .../FinancialStatementChartTreeTableModel.java | 2 +- .../FinancialStatementChartViewHandler.java | 2 +- .../FinancialTransactionViewHandler.java | 2 +- .../FinancialTransactionSearchTableModel.java | 2 +- .../FinancialTransactionSearchViewHandler.java | 2 +- .../ui/fiscalperiod/FiscalPeriodViewHandler.java | 2 +- .../java/org/chorem/lima/ui/home/AccountsPane.java | 2 +- .../org/chorem/lima/ui/home/EntryBooksPane.java | 2 +- .../lima/ui/home/FinancialTransactionsPane.java | 2 +- .../org/chorem/lima/ui/home/FiscalYearsPane.java | 2 +- .../chorem/lima/ui/identity/IdentityHandler.java | 2 +- .../chorem/lima/ui/importexport/ImportExport.java | 2 +- .../lima/ui/lettering/LetteringViewHandler.java | 2 +- .../lima/ui/opening/CreateFiscalPeriodPanel.jaxx | 2 +- .../ui/opening/CreateIdentityPanelHandler.java | 2 +- .../chorem/lima/ui/opening/OpeningViewHandler.java | 2 +- .../lima/ui/vatchart/VatChartTreeTableModel.java | 2 +- .../lima/ui/vatchart/VatChartViewHandler.java | 2 +- .../org/chorem/lima/util/BigDecimalToString.java | 26 +-- .../java/org/chorem/lima/ui/AbstractLimaTest.java | 2 +- src/site/rst/devel/server.rst | 2 +- 65 files changed, 309 insertions(+), 425 deletions(-) diff --git a/lima-business-api/pom.xml b/lima-business-api/pom.xml index b6891aa..70ee339 100644 --- a/lima-business-api/pom.xml +++ b/lima-business-api/pom.xml @@ -11,7 +11,7 @@ <groupId>org.chorem.lima</groupId> <artifactId>lima-business-api</artifactId> - <name>Lima :: business API</name> + <name>Lima :: Business API</name> <description>Business API module for lima</description> <dependencies> @@ -26,9 +26,23 @@ <scope>provided</scope> </dependency> <dependency> + <groupId>org.apache.openejb</groupId> + <artifactId>openejb-core</artifactId> + <scope>compile</scope> + </dependency> + <!-- for remote mode only --> + <dependency> + <groupId>org.apache.openejb</groupId> + <artifactId>openejb-client</artifactId> + </dependency> + <dependency> <groupId>net.sf.jasperreports</groupId> <artifactId>jasperreports</artifactId> </dependency> + <dependency> + <groupId>org.nuiton</groupId> + <artifactId>nuiton-config</artifactId> + </dependency> </dependencies> <profiles> diff --git a/lima-business/src/main/java/org/chorem/lima/service/LimaServiceFactory.java b/lima-business-api/src/main/java/org/chorem/lima/business/LimaServiceFactory.java similarity index 95% rename from lima-business/src/main/java/org/chorem/lima/service/LimaServiceFactory.java rename to lima-business-api/src/main/java/org/chorem/lima/business/LimaServiceFactory.java index ab24e0b..4173446 100644 --- a/lima-business/src/main/java/org/chorem/lima/service/LimaServiceFactory.java +++ b/lima-business-api/src/main/java/org/chorem/lima/business/LimaServiceFactory.java @@ -20,7 +20,7 @@ * #L% */ -package org.chorem.lima.service; +package org.chorem.lima.business; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.StringUtils; @@ -28,8 +28,6 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.openejb.client.RemoteInitialContextFactory; import org.apache.openejb.core.LocalInitialContextFactory; -import org.chorem.lima.business.ServiceListener; -import org.chorem.lima.business.ServiceMonitorable; import org.nuiton.config.ApplicationConfig; import javax.ejb.embeddable.EJBContainer; @@ -44,6 +42,8 @@ import java.util.HashMap; import java.util.Map; import java.util.Properties; +import com.google.common.base.Preconditions; + /** This class is a service factory based on embedded openejb container. */ public class LimaServiceFactory { @@ -134,10 +134,7 @@ public class LimaServiceFactory { } public static <M> void addServiceListener(M service, ServiceListener listener) { - if (!(service instanceof ServiceMonitorable)) { - throw new IllegalArgumentException( - "service " + service + " does not implement " + ServiceMonitorable.class); - } + Preconditions.checkArgument(service instanceof ServiceMonitorable, "service " + service + " does not implement " + ServiceMonitorable.class); ((ServiceMonitorable) service).addServiceListener(listener); } diff --git a/lima-business/src/main/java/org/chorem/lima/business/ServiceListener.java b/lima-business-api/src/main/java/org/chorem/lima/business/ServiceListener.java similarity index 100% rename from lima-business/src/main/java/org/chorem/lima/business/ServiceListener.java rename to lima-business-api/src/main/java/org/chorem/lima/business/ServiceListener.java diff --git a/lima-business/src/main/java/org/chorem/lima/business/ServiceMonitorable.java b/lima-business-api/src/main/java/org/chorem/lima/business/ServiceMonitorable.java similarity index 100% rename from lima-business/src/main/java/org/chorem/lima/business/ServiceMonitorable.java rename to lima-business-api/src/main/java/org/chorem/lima/business/ServiceMonitorable.java diff --git a/lima-business/src/main/java/org/chorem/lima/service/ServiceMonitorableHandler.java b/lima-business-api/src/main/java/org/chorem/lima/business/ServiceMonitorableHandler.java similarity index 97% rename from lima-business/src/main/java/org/chorem/lima/service/ServiceMonitorableHandler.java rename to lima-business-api/src/main/java/org/chorem/lima/business/ServiceMonitorableHandler.java index f32751f..3d7386b 100644 --- a/lima-business/src/main/java/org/chorem/lima/service/ServiceMonitorableHandler.java +++ b/lima-business-api/src/main/java/org/chorem/lima/business/ServiceMonitorableHandler.java @@ -20,11 +20,10 @@ * #L% */ -package org.chorem.lima.service; +package org.chorem.lima.business; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.chorem.lima.business.ServiceListener; import java.lang.reflect.InvocationHandler; import java.lang.reflect.InvocationTargetException; diff --git a/lima-business-api/src/main/java/org/chorem/lima/business/api/OptionsService.java b/lima-business-api/src/main/java/org/chorem/lima/business/api/OptionsService.java index 481077a..1ccb1d9 100644 --- a/lima-business-api/src/main/java/org/chorem/lima/business/api/OptionsService.java +++ b/lima-business-api/src/main/java/org/chorem/lima/business/api/OptionsService.java @@ -21,6 +21,10 @@ */ package org.chorem.lima.business.api; +import org.chorem.lima.business.config.LimaConfigOptionDef; +import org.chorem.lima.business.utils.BigDecimalToString; +import org.nuiton.config.ConfigOptionDef; + /** * Service de report des certaines configurations du swing dans business * <p/> @@ -32,26 +36,22 @@ package org.chorem.lima.business.api; * @author salaun */ -public interface OptionsService { +public interface OptionsService extends BigDecimalToString.Config { - /** - * Sets the swing scale to the business scale - * - * @param scale scale - */ void setScale(String scale); - void setThousandSeparator(String thousandSeparator); - void setCurrency(boolean currency); void setDecimalSeparator(String decimalSeparator); - /** - * Gets the business scale - * - * @return scale - */ - int getScale(); + void setThousandSeparator(String thousandSeparator); + + LimaConfigOptionDef getScaleOption(); + + LimaConfigOptionDef getCurrencyOption(); + + LimaConfigOptionDef getDecimalSeparatorOption(); + + LimaConfigOptionDef getThousandSeparatorOption(); } diff --git a/lima-business-api/src/main/java/org/chorem/lima/business/config/LimaConfigOptionDef.java b/lima-business-api/src/main/java/org/chorem/lima/business/config/LimaConfigOptionDef.java new file mode 100644 index 0000000..f6b85d8 --- /dev/null +++ b/lima-business-api/src/main/java/org/chorem/lima/business/config/LimaConfigOptionDef.java @@ -0,0 +1,12 @@ +package org.chorem.lima.business.config; + +import org.nuiton.config.ConfigOptionDef; + +/** + * @author Arnaud Thimel (Code Lutin) + */ +public interface LimaConfigOptionDef extends ConfigOptionDef { + + String getLabel(); + +} diff --git a/lima-business/src/main/java/org/chorem/lima/business/utils/BigDecimalToString.java b/lima-business-api/src/main/java/org/chorem/lima/business/utils/BigDecimalToString.java similarity index 71% rename from lima-business/src/main/java/org/chorem/lima/business/utils/BigDecimalToString.java rename to lima-business-api/src/main/java/org/chorem/lima/business/utils/BigDecimalToString.java index bf9ede1..eea7160 100644 --- a/lima-business/src/main/java/org/chorem/lima/business/utils/BigDecimalToString.java +++ b/lima-business-api/src/main/java/org/chorem/lima/business/utils/BigDecimalToString.java @@ -22,8 +22,6 @@ package org.chorem.lima.business.utils; * #L% */ -import org.chorem.lima.business.LimaBusinessConfig; - import java.text.DecimalFormat; import java.text.DecimalFormatSymbols; @@ -32,10 +30,14 @@ import java.text.DecimalFormatSymbols; */ public class BigDecimalToString { - protected static DecimalFormat decimalFormat; + public interface Config { + int getScale(); + boolean getCurrency(); + char getDecimalSeparator(); + char getThousandSeparator(); + } - public static void generateDecimalFormat() { - LimaBusinessConfig config = LimaBusinessConfig.getInstance(); + public static DecimalFormat newDecimalFormat(Config config) { StringBuilder scale = new StringBuilder(); for (int i = 0; i < config.getScale(); i++) { scale.append("0"); @@ -44,23 +46,17 @@ public class BigDecimalToString { if (config.getCurrency()) { currency = " ¤"; } - decimalFormat = new DecimalFormat("##0." + scale.toString() + currency); + DecimalFormat result = new DecimalFormat("##0." + scale.toString() + currency); DecimalFormatSymbols symbol = new DecimalFormatSymbols(); //set decimalSeparator and thousandSeparator preferences symbol.setDecimalSeparator(config.getDecimalSeparator()); symbol.setMonetaryDecimalSeparator(config.getDecimalSeparator()); symbol.setGroupingSeparator(config.getThousandSeparator()); - decimalFormat.setDecimalFormatSymbols(symbol); + result.setDecimalFormatSymbols(symbol); //always set grouping - decimalFormat.setGroupingUsed(true); - decimalFormat.setGroupingSize(3); - } - - public static DecimalFormat getDecimalFormat() { - if (decimalFormat == null) { - BigDecimalToString.generateDecimalFormat(); - } - return decimalFormat; + result.setGroupingUsed(true); + result.setGroupingSize(3); + return result; } } diff --git a/lima-business/pom.xml b/lima-business/pom.xml index f4a6965..63fb44c 100644 --- a/lima-business/pom.xml +++ b/lima-business/pom.xml @@ -11,7 +11,7 @@ <groupId>org.chorem.lima</groupId> <artifactId>lima-business</artifactId> - <name>Lima :: business</name> + <name>Lima :: Business</name> <description>Business module for lima</description> <dependencies> @@ -80,17 +80,6 @@ <artifactId>openejb-ejbd</artifactId> </dependency> <dependency> - <groupId>org.apache.openejb</groupId> - <artifactId>openejb-core</artifactId> - <scope>compile</scope> - </dependency> - - <!-- for remote mode only --> - <dependency> - <groupId>org.apache.openejb</groupId> - <artifactId>openejb-client</artifactId> - </dependency> - <dependency> <groupId>com.google.guava</groupId> <artifactId>guava</artifactId> </dependency> diff --git a/lima-business/src/main/java/org/chorem/lima/business/LimaBusinessConfig.java b/lima-business/src/main/java/org/chorem/lima/business/LimaBusinessConfig.java index a25d44e..73bc7fc 100644 --- a/lima-business/src/main/java/org/chorem/lima/business/LimaBusinessConfig.java +++ b/lima-business/src/main/java/org/chorem/lima/business/LimaBusinessConfig.java @@ -28,6 +28,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.lima.LimaTechnicalException; import org.chorem.lima.business.accountingrules.FranceAccountingRules; +import org.chorem.lima.business.config.LimaConfigOptionDef; import org.chorem.lima.entity.LimaCallaoEntityEnum; import org.chorem.lima.entity.LimaFlywayServiceImpl; import org.nuiton.config.ApplicationConfig; @@ -271,7 +272,7 @@ public class LimaBusinessConfig { * information for jaxx configuration frame ({@code #type}, * {@code #transientBoolean}, {@code #finalBoolean}...) */ - public enum ServiceConfigOption implements ConfigOptionDef { + public enum ServiceConfigOption implements LimaConfigOptionDef { CONFIG_FILE(ApplicationConfig.CONFIG_FILE_NAME, n("lima.configFileName.description"), "lima-business.config", String.class, true, true), @@ -286,13 +287,15 @@ public class LimaBusinessConfig { DATA_DIR("lima.data.dir", n("lima.config.data.dir.description"), "${user.home}/.lima", File.class, false, false), RULES_NATIONALTY("lima.rules", n("lima.config.rulesnationality.description"), FranceAccountingRules.class.getName(), String.class, false, false), - SCALE("lima.scale", n("lima.config.scale.description"), "2", String.class, false, false), - CURRENCY("lima.config.currency", "", "false", Boolean.class, false, false), - DECIMAL_SEPARATOR("lima.data.bigDecimal.decimalSeparator", "", ",", Character.class, false, false), - THOUSAND_SEPARATOR("lima.thousandSeparator", "", " ", Character.class, false, false); + SCALE("lima.data.bigDecimal.scale", t("lima.config.scale.label"), n("lima.config.scale.description"), "2", String.class, false, false), + CURRENCY("lima.config.currency", t("lima.config.currency.label"), n("lima.config.currency.description"), "false", Boolean.class, false, false), + DECIMAL_SEPARATOR("lima.data.bigDecimal.decimalSeparator", t("lima.config.decimalSeparator.label"), "", ",", Character.class, false, false), + THOUSAND_SEPARATOR("lima.thousandSeparator", t("lima.config.thousandSeparator.label"), n("lima.config.thousandSeparator.description"), " ", Character.class, false, false); private final String key; + protected final String label; + private final String description; private String defaultValue; @@ -303,9 +306,10 @@ public class LimaBusinessConfig { private boolean finalBoolean; - ServiceConfigOption(String key, String description, String defaultValue, + ServiceConfigOption(String key, String label, String description, String defaultValue, Class<?> type, boolean transientBoolean, boolean finalBoolean) { this.key = key; + this.label = label; this.description = description; this.defaultValue = defaultValue; this.type = type; @@ -313,6 +317,11 @@ public class LimaBusinessConfig { this.transientBoolean = transientBoolean; } + ServiceConfigOption(String key, String description, String defaultValue, + Class<?> type, boolean transientBoolean, boolean finalBoolean) { + this(key, null, description, defaultValue, type, transientBoolean, finalBoolean); + } + @Override public boolean isFinal() { return finalBoolean; @@ -357,6 +366,11 @@ public class LimaBusinessConfig { public Class<?> getType() { return type; } + + @Override + public String getLabel() { + return label; + } } } diff --git a/lima-business/src/main/java/org/chorem/lima/business/ejb/OptionsServiceImpl.java b/lima-business/src/main/java/org/chorem/lima/business/ejb/OptionsServiceImpl.java index 2a5a893..11d4f4b 100644 --- a/lima-business/src/main/java/org/chorem/lima/business/ejb/OptionsServiceImpl.java +++ b/lima-business/src/main/java/org/chorem/lima/business/ejb/OptionsServiceImpl.java @@ -23,7 +23,7 @@ package org.chorem.lima.business.ejb; import org.chorem.lima.business.LimaBusinessConfig; import org.chorem.lima.business.api.OptionsService; -import org.chorem.lima.business.utils.BigDecimalToString; +import org.chorem.lima.business.config.LimaConfigOptionDef; import javax.ejb.Remote; import javax.ejb.Stateless; @@ -32,41 +32,64 @@ import javax.ejb.Stateless; @Remote(OptionsService.class) public class OptionsServiceImpl extends AbstractLimaService implements OptionsService { - protected int scale; + @Override + public int getScale() { + return LimaBusinessConfig.getInstance().getScale(); + } - protected String vatPDFUrl; + @Override + public boolean getCurrency() { + return LimaBusinessConfig.getInstance().getCurrency(); + } - public OptionsServiceImpl() { - scale = LimaBusinessConfig.getInstance().getScale(); - BigDecimalToString.generateDecimalFormat(); + @Override + public char getDecimalSeparator() { + return LimaBusinessConfig.getInstance().getDecimalSeparator(); } @Override - public int getScale() { - return scale; + public char getThousandSeparator() { + return LimaBusinessConfig.getInstance().getThousandSeparator(); } @Override public void setScale(String scale) { LimaBusinessConfig.getInstance().setScale(scale); - BigDecimalToString.generateDecimalFormat(); } @Override public void setThousandSeparator(String thousandSeparator) { LimaBusinessConfig.getInstance().setThousandSeparator(thousandSeparator); - BigDecimalToString.generateDecimalFormat(); } @Override public void setCurrency(boolean currency) { LimaBusinessConfig.getInstance().setCurrency(Boolean.toString(currency)); - BigDecimalToString.generateDecimalFormat(); } @Override public void setDecimalSeparator(String decimalSeparator) { LimaBusinessConfig.getInstance().setDecimalSeparator(decimalSeparator); - BigDecimalToString.generateDecimalFormat(); } + + @Override + public LimaConfigOptionDef getScaleOption() { + return LimaBusinessConfig.ServiceConfigOption.SCALE; + } + + @Override + public LimaConfigOptionDef getCurrencyOption() { + return LimaBusinessConfig.ServiceConfigOption.CURRENCY; + } + + @Override + public LimaConfigOptionDef getDecimalSeparatorOption() { + return LimaBusinessConfig.ServiceConfigOption.DECIMAL_SEPARATOR; + } + + @Override + public LimaConfigOptionDef getThousandSeparatorOption() { + return LimaBusinessConfig.ServiceConfigOption.THOUSAND_SEPARATOR; + } + } diff --git a/lima-business/src/main/resources/i18n/lima-business_en_GB.properties b/lima-business/src/main/resources/i18n/lima-business_en_GB.properties index 7d7f2af..64a3eef 100644 --- a/lima-business/src/main/resources/i18n/lima-business_en_GB.properties +++ b/lima-business/src/main/resources/i18n/lima-business_en_GB.properties @@ -51,7 +51,10 @@ lima-business.import.entries.error.lockedFinancialPeriod=locked fiancial period lima-business.import.entriesoutofdatesrange=WARNING \: %s entries is out of range of opened fiscal periods. Entry was skip \!\n lima-business.import.noaccount=ERROR \: This file contains no account lima.config.configFileName.description=Filename of Lima's configuration +lima.config.currency.description= +lima.config.currency.label= lima.config.data.dir.description=Data directory of Lima +lima.config.decimalSeparator.label= lima.config.documentReport.account.documentReportModelPath.description= lima.config.documentReport.balance.balanceAccountReportModelPath.description= lima.config.documentReport.balance.balanceSubAccountReportModelPath.description= @@ -72,7 +75,10 @@ lima.config.reports.dir.description= lima.config.reportvatpdfurl.description= lima.config.rulesnationality.description=Rules Nationality lima.config.scale.description=Scale +lima.config.scale.label= lima.config.serveraddress.description=Server Address +lima.config.thousandSeparator.description= +lima.config.thousandSeparator.label= lima.configFileName.description=Descriontion lima.financialtransaction.account=Account lima.fiscalperiod.fiscalperiod=Fiscal period diff --git a/lima-business/src/main/resources/i18n/lima-business_fr_FR.properties b/lima-business/src/main/resources/i18n/lima-business_fr_FR.properties index cac64f4..e754859 100644 --- a/lima-business/src/main/resources/i18n/lima-business_fr_FR.properties +++ b/lima-business/src/main/resources/i18n/lima-business_fr_FR.properties @@ -50,7 +50,10 @@ lima-business.import.entries.error.lockedEntryBook= lima-business.import.entries.error.lockedFinancialPeriod= lima-business.import.entriesoutofdatesrange=Attention \: Cette entrée %s ne fait partie d'aucune période ouverte. Entrée non importée lima-business.import.noaccount\=Erreur \: Ce fichier ne contient aucun compte. lima.config.configFileName.description=Nom du fichier de configuration de Lima +lima.config.currency.description= +lima.config.currency.label= lima.config.data.dir.description=Répertoire des données de Lima +lima.config.decimalSeparator.label= lima.config.documentReport.account.accountModelPath.description=fichier source (.jrxml) généré par Jasper Report gérant les beans 'account' lima.config.documentReport.account.documentReportModelPath.description=fichier source (.jrxml) généré par Jasper Report gérant les beans 'DocumentReport' lima.config.documentReport.balance.balanceAccountReportModelPath.description=fichier source (.jrxml) généré par Jasper Report gérant les beans 'BalanceAccount' @@ -75,7 +78,10 @@ lima.config.reports.dir.description=Dossier des rapports lima.config.reportvatpdfurl.description=Chemin du raport lima.config.rulesnationality.description=Règles nationales lima.config.scale.description=Précision +lima.config.scale.label= lima.config.serveraddress.description=Addresse serveur +lima.config.thousandSeparator.description= +lima.config.thousandSeparator.label= lima.configFileName.description= lima.financialtransaction.account=compte lima.fiscalperiod.fiscalperiod=Période fiscale diff --git a/lima-business/src/test/java/org/chorem/lima/business/AbstractLimaTest.java b/lima-business/src/test/java/org/chorem/lima/business/AbstractLimaTest.java index 90a0a97..9550225 100644 --- a/lima-business/src/test/java/org/chorem/lima/business/AbstractLimaTest.java +++ b/lima-business/src/test/java/org/chorem/lima/business/AbstractLimaTest.java @@ -52,7 +52,6 @@ import org.chorem.lima.entity.FiscalPeriodImpl; import org.chorem.lima.entity.LimaCallaoEntityEnum; import org.chorem.lima.entity.LimaCallaoTopiaApplicationContext; import org.chorem.lima.entity.LimaCallaoTopiaPersistenceContext; -import org.chorem.lima.service.LimaServiceFactory; import org.hibernate.cfg.Environment; import org.junit.After; import org.junit.Before; diff --git a/lima-callao/pom.xml b/lima-callao/pom.xml index fa23405..df54c88 100644 --- a/lima-callao/pom.xml +++ b/lima-callao/pom.xml @@ -11,7 +11,7 @@ <groupId>org.chorem.lima</groupId> <artifactId>lima-callao</artifactId> - <name>Lima :: callao</name> + <name>Lima :: Callao</name> <description>Module persistence de Lima (Callao)</description> <dependencies> diff --git a/lima-report/pom.xml b/lima-report/pom.xml index 7e9b7f2..6f40159 100644 --- a/lima-report/pom.xml +++ b/lima-report/pom.xml @@ -11,7 +11,7 @@ <groupId>org.chorem.lima</groupId> <artifactId>lima-report</artifactId> - <name>Lima :: report</name> + <name>Lima :: Report</name> <description>Lima Report Module</description> <dependencies> @@ -21,12 +21,12 @@ <version>${project.version}</version> <scope>compile</scope> </dependency> - <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>lima-business</artifactId> - <version>${project.version}</version> - <scope>compile</scope> - </dependency> + <!--<dependency>--> + <!--<groupId>${project.groupId}</groupId>--> + <!--<artifactId>lima-business</artifactId>--> + <!--<version>${project.version}</version>--> + <!--<scope>compile</scope>--> + <!--</dependency>--> <dependency> <groupId>${project.groupId}</groupId> <artifactId>lima-callao</artifactId> diff --git a/lima-business/src/main/java/org/chorem/lima/business/utils/DocumentReportTypes.java b/lima-report/src/main/java/org/chorem/lima/report/DocumentReportTypes.java similarity index 96% rename from lima-business/src/main/java/org/chorem/lima/business/utils/DocumentReportTypes.java rename to lima-report/src/main/java/org/chorem/lima/report/DocumentReportTypes.java index 3bac31f..cbc142d 100644 --- a/lima-business/src/main/java/org/chorem/lima/business/utils/DocumentReportTypes.java +++ b/lima-report/src/main/java/org/chorem/lima/report/DocumentReportTypes.java @@ -1,4 +1,4 @@ -package org.chorem.lima.business.utils; +package org.chorem.lima.report; /* * #%L diff --git a/lima-business/src/main/java/org/chorem/lima/business/utils/DocumentsEnum.java b/lima-report/src/main/java/org/chorem/lima/report/DocumentsEnum.java similarity index 98% rename from lima-business/src/main/java/org/chorem/lima/business/utils/DocumentsEnum.java rename to lima-report/src/main/java/org/chorem/lima/report/DocumentsEnum.java index 5fa414d..a077961 100644 --- a/lima-business/src/main/java/org/chorem/lima/business/utils/DocumentsEnum.java +++ b/lima-report/src/main/java/org/chorem/lima/report/DocumentsEnum.java @@ -20,7 +20,7 @@ * #L% */ -package org.chorem.lima.business.utils; +package org.chorem.lima.report; import static org.nuiton.i18n.I18n.t; diff --git a/lima-report/src/main/java/org/chorem/lima/report/service/LimaReportConfig.java b/lima-report/src/main/java/org/chorem/lima/report/LimaReportConfig.java similarity index 89% rename from lima-report/src/main/java/org/chorem/lima/report/service/LimaReportConfig.java rename to lima-report/src/main/java/org/chorem/lima/report/LimaReportConfig.java index 5c97e3e..dc43493 100644 --- a/lima-report/src/main/java/org/chorem/lima/report/service/LimaReportConfig.java +++ b/lima-report/src/main/java/org/chorem/lima/report/LimaReportConfig.java @@ -1,9 +1,9 @@ -package org.chorem.lima.report.service; +package org.chorem.lima.report; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.lima.LimaTechnicalException; -import org.chorem.lima.business.utils.DocumentReportTypes; +import org.chorem.lima.business.utils.BigDecimalToString; import org.nuiton.config.ApplicationConfig; import org.nuiton.config.ArgumentsParserException; import org.nuiton.config.ConfigOptionDef; @@ -19,7 +19,7 @@ import static org.nuiton.i18n.I18n.t; /** * Created by davidcosse on 13/03/15. */ -public class LimaReportConfig { +public class LimaReportConfig implements BigDecimalToString.Config { protected static final Log log = LogFactory.getLog(LimaReportConfig.class); @@ -316,6 +316,43 @@ public class LimaReportConfig { config.saveForUser(); } + public int getScale() { + return config.getOptionAsInt(ServiceConfigOption.SCALE.key); + } + + public void setScale(String locale) { + config.setOption(ServiceConfigOption.SCALE.key, locale); + config.saveForUser(); + } + + public boolean getCurrency() { + return config.getOptionAsBoolean(ServiceConfigOption.CURRENCY.key); + } + + public void setCurrency(String locale) { + config.setOption(ServiceConfigOption.CURRENCY.key, locale); + config.saveForUser(); + } + + public char getDecimalSeparator() { + char decimalSeparator = config.getOption(ServiceConfigOption.DECIMAL_SEPARATOR.key).charAt(0); + return decimalSeparator; + } + + public void setDecimalSeparator(String locale) { + config.setOption(ServiceConfigOption.DECIMAL_SEPARATOR.key, locale); + config.saveForUser(); + } + + public char getThousandSeparator() { + return config.getOption(ServiceConfigOption.THOUSAND_SEPARATOR.key).charAt(0); + } + + public void setThousandSeparator(String locale) { + config.setOption(ServiceConfigOption.THOUSAND_SEPARATOR.key, locale); + config.saveForUser(); + } + public enum ServiceConfigOption implements ConfigOptionDef { @@ -344,7 +381,12 @@ public class LimaReportConfig { GENERAL_LEDGER_DOCUMENT_REPORT_MODEL_PATH("lima.config.documentReport.generalLedger.documentReportModelPath", n("lima.config.documentReport.generalLedger.documentReportModelPath.description"), "/jasperreports/generalLedger/DocumentReport.jrxml", String.class, false, false), GENERAL_LEDGER_MODEL_PATH("lima.config.documentReport.generalLedger.generalLedgerModelPath", n("lima.config.documentReport.generalLedger.generalLedgerModelPath.description"), "/jasperreports/generalLedger/GeneralLedgerReport.jrxml", String.class, false, false), - GENERAL_LEDGER_ENTRY_MODEL_PATH("lima.config.documentReport.generalLedger.generalLedgerEntryModelPath", n("lima.config.documentReport.generalLedger.generalLedgerEntryModelPath.description"), "/jasperreports/generalLedger/GeneralLedgerEntryReport.jrxml", String.class, false, false); + GENERAL_LEDGER_ENTRY_MODEL_PATH("lima.config.documentReport.generalLedger.generalLedgerEntryModelPath", n("lima.config.documentReport.generalLedger.generalLedgerEntryModelPath.description"), "/jasperreports/generalLedger/GeneralLedgerEntryReport.jrxml", String.class, false, false), + + SCALE("lima.scale", n("lima.config.scale.description"), "2", String.class, false, false), // FIXME AThimel 16/03/15 This should be the same as lima-swing module + CURRENCY("lima.config.currency", "", "false", Boolean.class, false, false), // FIXME AThimel 16/03/15 This should be the same as lima-swing module + DECIMAL_SEPARATOR("lima.data.bigDecimal.decimalSeparator", "", ",", Character.class, false, false), // FIXME AThimel 16/03/15 This should be the same as lima-swing module + THOUSAND_SEPARATOR("lima.thousandSeparator", "", " ", Character.class, false, false); // FIXME AThimel 16/03/15 This should be the same as lima-swing module private final String key; diff --git a/lima-report/src/main/java/org/chorem/lima/report/action/ReportBuilder.java b/lima-report/src/main/java/org/chorem/lima/report/action/ReportBuilder.java index de306cb..96e17eb 100644 --- a/lima-report/src/main/java/org/chorem/lima/report/action/ReportBuilder.java +++ b/lima-report/src/main/java/org/chorem/lima/report/action/ReportBuilder.java @@ -34,9 +34,9 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.lima.LimaTechnicalException; import org.chorem.lima.beans.DocumentReport; -import org.chorem.lima.business.utils.DocumentReportTypes; -import org.chorem.lima.business.utils.DocumentsEnum; -import org.chorem.lima.report.service.LimaReportConfig; +import org.chorem.lima.report.DocumentReportTypes; +import org.chorem.lima.report.DocumentsEnum; +import org.chorem.lima.report.LimaReportConfig; import java.io.IOException; import java.io.InputStream; 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 6041b80..32eea02 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 @@ -31,6 +31,7 @@ import org.chorem.lima.LimaTechnicalException; import org.chorem.lima.beans.DocumentReport; import org.chorem.lima.beans.FinancialStatementAmounts; import org.chorem.lima.beans.ReportsDatas; +import org.chorem.lima.business.LimaServiceFactory; import org.chorem.lima.business.api.AccountService; import org.chorem.lima.business.api.ClosedPeriodicEntryBookService; import org.chorem.lima.business.api.EntryService; @@ -46,18 +47,20 @@ import org.chorem.lima.business.utils.BigDecimalToString; import org.chorem.lima.entity.Account; import org.chorem.lima.entity.Entry; import org.chorem.lima.entity.Identity; +import org.chorem.lima.report.DocumentsEnum; +import org.chorem.lima.report.LimaReportConfig; import org.chorem.lima.report.action.ReportBuilder; -import org.chorem.lima.report.utils.DocumentsEnum; -import org.chorem.lima.service.LimaServiceFactory; -import javax.swing.*; import java.io.File; import java.math.BigDecimal; +import java.text.DecimalFormat; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; +import javax.swing.*; + import static org.nuiton.i18n.I18n.t; @@ -96,6 +99,8 @@ public class DocumentService { protected final String ENTRY_BOOKS_REPORT_PDF_FILE_PATH = path + File.separator + DocumentsEnum.ENTRY_BOOKS.getFileName() + ".pdf"; protected final String LEDGER_REPORT_PDF_FILE_PATH = path + File.separator + DocumentsEnum.LEDGER.getFileName() + ".pdf"; + protected DecimalFormat decimalFormat; + public DocumentService() { identityService = LimaServiceFactory.getService(IdentityService.class); financialStatementService = LimaServiceFactory.getService(FinancialStatementService.class); @@ -534,12 +539,19 @@ public class DocumentService { return headerTitle; } + protected DecimalFormat getDecimalFormat() { + if (decimalFormat == null) { + decimalFormat = BigDecimalToString.newDecimalFormat(LimaReportConfig.getInstance()); + } + return decimalFormat; + } + //############## balance ############## public void createBalanceDocuments(Date beginDate, Date endDate, String fromToAccount) { JasperReport balanceMainAccountsReport = reportBuilder.getBalanceManAccountsReport(); JasperReport balanceSubAccountsReport = reportBuilder.getBalanceSubAccountsReport(); - DocumentReport report = balanceReportService.getBalanceDocumentReport(beginDate, endDate, fromToAccount, BigDecimalToString.getDecimalFormat(), balanceMainAccountsReport, balanceSubAccountsReport); - reportBuilder.generatePDFReport(org.chorem.lima.business.utils.DocumentsEnum.BALANCE, BALANCE_FILE_PATH, Lists.newArrayList(report)); + DocumentReport report = balanceReportService.getBalanceDocumentReport(beginDate, endDate, fromToAccount, getDecimalFormat(), balanceMainAccountsReport, balanceSubAccountsReport); + reportBuilder.generatePDFReport(DocumentsEnum.BALANCE, BALANCE_FILE_PATH, Lists.newArrayList(report)); } //############## EntryBook ############# @@ -547,23 +559,23 @@ public class DocumentService { JasperReport entryBookEntryBooksReport = reportBuilder.getEntryBookEntryBooksReport(); JasperReport entryBookFinancialPeriodsReport = reportBuilder.getEntryBookFinancialPeriodsReport(); JasperReport entryBookTransactionsReport = reportBuilder.getEntryBookTransactionsReport(); - DocumentReport report = entryBookReportService.getEntryBookDocumentReport(beginDate, endDate, entryBookCodes, BigDecimalToString.getDecimalFormat(), entryBookEntryBooksReport, entryBookFinancialPeriodsReport, entryBookTransactionsReport); - reportBuilder.generatePDFReport(org.chorem.lima.business.utils.DocumentsEnum.ENTRY_BOOKS, ENTRY_BOOKS_REPORT_PDF_FILE_PATH, Lists.newArrayList(report)); + DocumentReport report = entryBookReportService.getEntryBookDocumentReport(beginDate, endDate, entryBookCodes, getDecimalFormat(), entryBookEntryBooksReport, entryBookFinancialPeriodsReport, entryBookTransactionsReport); + reportBuilder.generatePDFReport(DocumentsEnum.ENTRY_BOOKS, ENTRY_BOOKS_REPORT_PDF_FILE_PATH, Lists.newArrayList(report)); } //############## General EntryBook ############# public void createGeneralEntryBooksDocuments(Date beginDate, Date endDate) { JasperReport generalEntryBookGeneralEntryBooksReport = reportBuilder.getGeneralEntryBookGeneralEntryBooksReport(); JasperReport generalEntryBookEntriesReport = reportBuilder.getGeneralEntryBookEntriesReport(); - DocumentReport report = generalEntryBookReportService.getGeneralEntryBookDocumentReport(beginDate, endDate, BigDecimalToString.getDecimalFormat(), generalEntryBookGeneralEntryBooksReport, generalEntryBookEntriesReport); - reportBuilder.generatePDFReport(org.chorem.lima.business.utils.DocumentsEnum.GENERAL_ENTRY_BOOK, GENERAL_ENTRY_BOOK_REPORT_PDF_FILE_PATH, Lists.newArrayList(report)); + DocumentReport report = generalEntryBookReportService.getGeneralEntryBookDocumentReport(beginDate, endDate, getDecimalFormat(), generalEntryBookGeneralEntryBooksReport, generalEntryBookEntriesReport); + reportBuilder.generatePDFReport(DocumentsEnum.GENERAL_ENTRY_BOOK, GENERAL_ENTRY_BOOK_REPORT_PDF_FILE_PATH, Lists.newArrayList(report)); } //############## Ledger ############# public void createLedgerDocuments(Date beginDate, Date endDate) { JasperReport generalLedgerGeneralLedgersReport = reportBuilder.getGeneralLedgerGeneralLedgersReport(); JasperReport generalLedgerEntriesReport = reportBuilder.getGeneralLedgerEntriesReport(); - DocumentReport report = ledgerReportService.getLedgerDocumentReport(beginDate, endDate, BigDecimalToString.getDecimalFormat(), generalLedgerGeneralLedgersReport, generalLedgerEntriesReport); - reportBuilder.generatePDFReport(org.chorem.lima.business.utils.DocumentsEnum.LEDGER, LEDGER_REPORT_PDF_FILE_PATH, Lists.newArrayList(report)); + DocumentReport report = ledgerReportService.getLedgerDocumentReport(beginDate, endDate, getDecimalFormat(), generalLedgerGeneralLedgersReport, generalLedgerEntriesReport); + reportBuilder.generatePDFReport(DocumentsEnum.LEDGER, LEDGER_REPORT_PDF_FILE_PATH, Lists.newArrayList(report)); } } diff --git a/lima-report/src/main/java/org/chorem/lima/report/utils/DocumentsEnum.java b/lima-report/src/main/java/org/chorem/lima/report/utils/DocumentsEnum.java deleted file mode 100644 index 4317ce4..0000000 --- a/lima-report/src/main/java/org/chorem/lima/report/utils/DocumentsEnum.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * #%L - * Lima :: business - * %% - * Copyright (C) 2008 - 2010 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% - */ - -package org.chorem.lima.report.utils; - -import static org.nuiton.i18n.I18n.t; - - -public enum DocumentsEnum { - - GENERAL_ENTRY_BOOK(t("lima-business.document.generalentrybook"), "lima_general_entybook"), - ENTRY_BOOKS(t("lima-business.document.entrybook"), "lima_entrybooks"), - BALANCE(t("lima-business.document.balance"), "lima_balance"), - LEDGER(t("lima-business.document.ledger"), "lima_ledger"), - FINANCIAL_STATEMENT(t("lima-business.document.financialstatement"), "lima_financialstatements"), - VAT(t("lima-business.document.vat"), "lima_vat"), - ACCOUNT(t("lima-business.document.account"), "lima_account"); - - private final String fileName; - - private final String description; - - private DocumentsEnum(String description, String fileName) { - this.description = description; - this.fileName = fileName; - } - - public String getFileName() { - return fileName; - } - - public String getDescription() { - return description; - } - - public static DocumentsEnum valueOfLink(String label) { - DocumentsEnum value = null; - - for (DocumentsEnum documentsEnum : DocumentsEnum.values()) { - if (label.equals(documentsEnum.fileName)) { - value = documentsEnum; - break; - } - } - return value; - } - -} diff --git a/lima-report/src/main/resources/i18n/lima-report_en_GB.properties b/lima-report/src/main/resources/i18n/lima-report_en_GB.properties index ff86347..44c6f31 100644 --- a/lima-report/src/main/resources/i18n/lima-report_en_GB.properties +++ b/lima-report/src/main/resources/i18n/lima-report_en_GB.properties @@ -42,6 +42,7 @@ lima.config.documentReport.generalLedger.generalLedgerEntryModelPath.description lima.config.documentReport.generalLedger.generalLedgerModelPath.description= lima.config.httpport.description= lima.config.reports.dir.description= +lima.config.scale.description= lima.config.serveraddress.description= lima.configFileName.description= lima.financialtransaction.account= diff --git a/lima-report/src/main/resources/i18n/lima-report_fr_FR.properties b/lima-report/src/main/resources/i18n/lima-report_fr_FR.properties index ff86347..44c6f31 100644 --- a/lima-report/src/main/resources/i18n/lima-report_fr_FR.properties +++ b/lima-report/src/main/resources/i18n/lima-report_fr_FR.properties @@ -42,6 +42,7 @@ lima.config.documentReport.generalLedger.generalLedgerEntryModelPath.description lima.config.documentReport.generalLedger.generalLedgerModelPath.description= lima.config.httpport.description= lima.config.reports.dir.description= +lima.config.scale.description= lima.config.serveraddress.description= lima.configFileName.description= lima.financialtransaction.account= diff --git a/lima-server/src/main/java/org.chorem.lima/LimaServer.java b/lima-server/src/main/java/org.chorem.lima/LimaServer.java index ed697cd..fd76fc1 100644 --- a/lima-server/src/main/java/org.chorem.lima/LimaServer.java +++ b/lima-server/src/main/java/org.chorem.lima/LimaServer.java @@ -26,10 +26,10 @@ import org.apache.commons.lang3.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.lima.business.LimaBusinessConfig; -import org.chorem.lima.report.service.LimaReportConfig; +import org.chorem.lima.report.LimaReportConfig; import org.chorem.lima.server.HttpServerService; import org.chorem.lima.server.LimaServerConfig; -import org.chorem.lima.service.LimaServiceFactory; +import org.chorem.lima.business.LimaServiceFactory; import org.nuiton.config.ApplicationConfig; import javax.naming.Context; diff --git a/lima-server/src/main/java/org.chorem.lima/server/HttpServerService.java b/lima-server/src/main/java/org.chorem.lima/server/HttpServerService.java index f74c21f..a195ff9 100644 --- a/lima-server/src/main/java/org.chorem.lima/server/HttpServerService.java +++ b/lima-server/src/main/java/org.chorem.lima/server/HttpServerService.java @@ -29,12 +29,12 @@ import org.apache.commons.lang3.time.DateUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.lima.business.api.AccountService; -import org.chorem.lima.business.utils.DocumentsEnum; +import org.chorem.lima.report.DocumentsEnum; import org.chorem.lima.business.utils.FormatsEnum; import org.chorem.lima.entity.Account; import org.chorem.lima.report.action.ReportBuilder; import org.chorem.lima.report.service.DocumentService; -import org.chorem.lima.service.LimaServiceFactory; +import org.chorem.lima.business.LimaServiceFactory; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.servlet.ServletContextHandler; import org.eclipse.jetty.servlet.ServletHolder; diff --git a/lima-server/src/main/java/org.chorem.lima/server/LimaServerConfig.java b/lima-server/src/main/java/org.chorem.lima/server/LimaServerConfig.java index 5c6dbb3..18df1c6 100644 --- a/lima-server/src/main/java/org.chorem.lima/server/LimaServerConfig.java +++ b/lima-server/src/main/java/org.chorem.lima/server/LimaServerConfig.java @@ -6,7 +6,7 @@ import org.apache.commons.logging.LogFactory; import org.apache.openejb.core.LocalInitialContextFactory; import org.chorem.lima.LimaTechnicalException; import org.chorem.lima.business.accountingrules.FranceAccountingRules; -import org.chorem.lima.business.utils.DocumentReportTypes; +import org.chorem.lima.report.DocumentReportTypes; import org.nuiton.config.ApplicationConfig; import org.nuiton.config.ArgumentsParserException; import org.nuiton.config.ConfigOptionDef; diff --git a/lima-swing/pom.xml b/lima-swing/pom.xml index d5e5412..c734be2 100644 --- a/lima-swing/pom.xml +++ b/lima-swing/pom.xml @@ -50,12 +50,12 @@ <version>${project.version}</version> <scope>compile</scope> </dependency> - <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>lima-business</artifactId> - <version>${project.version}</version> - <scope>compile</scope> - </dependency> + <!--<dependency>--> + <!--<groupId>${project.groupId}</groupId>--> + <!--<artifactId>lima-business</artifactId>--> + <!--<version>${project.version}</version>--> + <!--<scope>compile</scope>--> + <!--</dependency>--> <dependency> <groupId>${project.groupId}</groupId> <artifactId>lima-business-api</artifactId> diff --git a/lima-swing/src/main/java/org/chorem/lima/LimaMain.java b/lima-swing/src/main/java/org/chorem/lima/LimaMain.java index 737acd3..e82e82d 100644 --- a/lima-swing/src/main/java/org/chorem/lima/LimaMain.java +++ b/lima-swing/src/main/java/org/chorem/lima/LimaMain.java @@ -26,7 +26,7 @@ import jaxx.runtime.SwingUtil; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.lima.business.api.AccountService; -import org.chorem.lima.service.LimaServiceFactory; +import org.chorem.lima.business.LimaServiceFactory; import org.chorem.lima.ui.MainView; import org.chorem.lima.ui.MainViewHandler; import org.chorem.lima.ui.opening.OpeningView; 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 e635bd5..caad54c 100644 --- a/lima-swing/src/main/java/org/chorem/lima/LimaSwingConfig.java +++ b/lima-swing/src/main/java/org/chorem/lima/LimaSwingConfig.java @@ -24,16 +24,17 @@ package org.chorem.lima; import com.google.common.collect.ImmutableSet; import jaxx.runtime.JAXXUtil; -import org.apache.commons.lang3.StringUtils; + import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.lima.actions.MiscAction; import org.chorem.lima.business.api.OptionsService; +import org.chorem.lima.business.config.LimaConfigOptionDef; +import org.chorem.lima.business.utils.BigDecimalToString; import org.chorem.lima.entity.LimaCallaoEntityEnum; -import org.chorem.lima.service.LimaServiceFactory; +import org.chorem.lima.business.LimaServiceFactory; import org.nuiton.config.ApplicationConfig; import org.nuiton.config.ArgumentsParserException; -import org.nuiton.config.ConfigOptionDef; import org.nuiton.converter.ConverterUtil; import org.nuiton.topia.persistence.TopiaConfigurationConstants; import org.nuiton.util.version.Version; @@ -58,7 +59,7 @@ import static org.nuiton.i18n.I18n.t; * Last update : $Date$ * By : $Author$ */ -public class LimaSwingConfig extends ApplicationConfig { +public class LimaSwingConfig extends ApplicationConfig implements BigDecimalToString.Config { /** to use log facility, just put in your code: log.info(\"...\"); */ private static Log log = LogFactory.getLog(LimaSwingConfig.class); @@ -186,8 +187,7 @@ public class LimaSwingConfig extends ApplicationConfig { * @return configuration application decimal separator */ public char getDecimalSeparator() { - char decimalSeparator = getOption(Option.DECIMAL_SEPARATOR.key).charAt(0); - return decimalSeparator; + return optionsService.getDecimalSeparator(); } /** @@ -197,9 +197,7 @@ public class LimaSwingConfig extends ApplicationConfig { * @param decimalSeparator new DecimalSeparator */ public void setDecimalSeparator(String decimalSeparator) { - setOption(Option.DECIMAL_SEPARATOR.key, decimalSeparator); optionsService.setDecimalSeparator(decimalSeparator); - saveForUser(); firePropertyChange("decimalSeparator", null, decimalSeparator); } @@ -209,7 +207,7 @@ public class LimaSwingConfig extends ApplicationConfig { * @return configuration application scale */ public int getScale() { - return getOptionAsInt(Option.SCALE.key); + return optionsService.getScale(); } /** @@ -219,9 +217,7 @@ public class LimaSwingConfig extends ApplicationConfig { * @param scale new Scale */ public void setScale(String scale) { - setOption(Option.SCALE.key, scale); optionsService.setScale(scale); - saveForUser(); firePropertyChange("scale", null, scale); if (log.isInfoEnabled()) { log.info("new scale" + scale); @@ -234,7 +230,7 @@ public class LimaSwingConfig extends ApplicationConfig { * @return configuration application thousand separator */ public char getThousandSeparator() { - return getOption(Option.THOUSAND_SEPARATOR.key).charAt(0); + return optionsService.getThousandSeparator(); } /** @@ -244,9 +240,7 @@ public class LimaSwingConfig extends ApplicationConfig { * @param thousandSeparator new thousandSeparator */ public void setThousandSeparator(String thousandSeparator) { - setOption(Option.THOUSAND_SEPARATOR.key, thousandSeparator); optionsService.setThousandSeparator(thousandSeparator); - saveForUser(); firePropertyChange("thousandSeparator", null, thousandSeparator); } @@ -256,7 +250,7 @@ public class LimaSwingConfig extends ApplicationConfig { * @return {@code true} if the currency must be displayed */ public boolean getCurrency() { - return getOptionAsBoolean(Option.CURRENCY.key); + return optionsService.getCurrency(); } /** @@ -265,9 +259,7 @@ public class LimaSwingConfig extends ApplicationConfig { * @param currency the new currency to set in configuration */ public void setCurrency(boolean currency) { - setOption(Option.CURRENCY.key, Boolean.toString(currency)); optionsService.setCurrency(currency); - saveForUser(); firePropertyChange("currency", null, currency); } @@ -354,68 +346,6 @@ public class LimaSwingConfig extends ApplicationConfig { return getOptionAsBoolean((Option.SELECT_ALL_EDITING_CELL.key)); } - public File getReportsDir() { - String reportsDirPath = getOption(Option.REPORTS_DIR.key); - File reportsDir = new File(reportsDirPath); - return reportsDir; - } - - // reports - public String getAccountDocumentReportModelPath() { - String result = getOption(Option.ACCOUNT_DOCUMENT_REPORT_MODEL_PATH.key); - return result; - } - - public String getBalanceDocumentReportModelPath() { - String result = getOption(Option.BALANCE_DOCUMENT_REPORT_MODEL_PATH.key); - return result; - } - - public String getBalanceAccountReportModelPath() { - String result = getOption(Option.BALANCE_ACCOUNT_REPORT_MODEL_PATH.key); - return result; - } - - public String getBalanceSubAccountReportModelPath() { - String result = getOption(Option.BALANCE_SUB_ACCOUNT_REPORT_MODEL_PATH.key); - return result; - } - - public String getGeneralEntryBookDocumentReportModelPath() { - String result = getOption(Option.GENERAL_ENTRY_BOOK_DOCUMENT_REPORT_MODEL_PATH.key); - return result; - } - - public String getGeneralEntryBookReportModelPath() { - String result = getOption(Option.GENERAL_ENTRY_BOOK_REPORT_MODEL_PATH.key); - return result; - } - - public String getGeneralEntryBookGeneralEntryBookEntryReportPath() { - String result = getOption(Option.GENERAL_ENTRY_BOOK_ENTRY_REPORT_MODEL_PATH.key); - return result; - } - - public String getProvisionalEntryBookEntryBookMainReportPath() { - String result = getOption(Option.ENTRY_BOOK_DOCUMENT_REPORT_MODEL_PATH.getKey()); - return result; - } - - public String getProvisionalEntryBookEntryBookReportPath() { - String result = getOption(Option.ENTRY_BOOK_ENTRY_BOOK_REPORT_MODEL_PATH.getKey()); - return result; - } - - public String getProvisionalEntryBookFinancialPeriodReportPath() { - String result = getOption(Option.ENTRY_BOOK_FINANCIAL_PERIOD_REPORT_MODEL_PATH.getKey()); - return result; - } - - public String getProvisionalEntryBookTransactionReportPath() { - String result = getOption(Option.ENTRY_BOOK_TRANSACTION_REPORT_MODEL_PATH.getKey()); - return result; - } - /** Used in ???? */ protected static final String[] DEFAULT_JAXX_PCS = {"fullScreen", "locale", "decimalSeparator", "scale", "thousandSeparator", "currency"}; @@ -445,7 +375,7 @@ public class LimaSwingConfig extends ApplicationConfig { * information for jaxx configuration frame ({@link #type}, * {@link #_transient}, {@link #_final}...) */ - public enum Option implements ConfigOptionDef { + public enum Option implements LimaConfigOptionDef { CONFIG_FILE(ApplicationConfig.CONFIG_FILE_NAME, t("lima.config.configFileName.label"), @@ -477,29 +407,29 @@ public class LimaSwingConfig extends ApplicationConfig { "fr_FR", Locale.class, false, false), - DECIMAL_SEPARATOR("lima.data.bigDecimal.decimalSeparator", - t("lima.config.decimalSeparator.label"), - n("lima.config.decimalSeparator.description"), - ",", - Character.class, false, false), - - SCALE("lima.data.bigDecimal.scale", - t("lima.config.scale.label"), - n("lima.config.scale.description"), - "2", - Integer.class, false, false), - - THOUSAND_SEPARATOR("lima.thousandSeparator", - t("lima.config.thousandSeparator.label"), - n("lima.config.thousandSeparator.description"), - " ", - Character.class, false, false), - - CURRENCY("lima.config.currency", - t("lima.config.currency.label"), - n("lima.config.currency.description"), - "false", - Boolean.class, false, false), +// DECIMAL_SEPARATOR("lima.data.bigDecimal.decimalSeparator", +// t("lima.config.decimalSeparator.label"), +// n("lima.config.decimalSeparator.description"), +// ",", +// Character.class, false, false), +// +// SCALE("lima.data.bigDecimal.scale", +// t("lima.config.scale.label"), +// n("lima.config.scale.description"), +// "2", +// Integer.class, false, false), +// +// THOUSAND_SEPARATOR("lima.thousandSeparator", +// t("lima.config.thousandSeparator.label"), +// n("lima.config.thousandSeparator.description"), +// " ", +// Character.class, false, false), +// +// CURRENCY("lima.config.currency", +// t("lima.config.currency.label"), +// n("lima.config.currency.description"), +// "false", +// Boolean.class, false, false), LAUNCH_UI("lima.ui.launchui", t("lima.config.ui.launchUi.label"), @@ -684,80 +614,7 @@ public class LimaSwingConfig extends ApplicationConfig { t("lima.config.cell.pair.selected.mandatory.foreground.label"), n("lima.config.cell.pair.selected.mandatory.foreground.description"), "#000000", - Color.class, false, false), - - REPORTS_DIR("lima.reports.dir", - "", - n("lima.config.reports.dir.description"), - "${lima.data.dir}/reports", File.class, false, false), - - - ACCOUNT_DOCUMENT_REPORT_MODEL_PATH("lima.config.documentReport.account.documentReportModelPath", - "", - n("lima.config.documentReport.account.documentReportModelPath.description"), - "/jasperreports/account/DocumentReport.jrxml", - String.class, false, false), - - BALANCE_DOCUMENT_REPORT_MODEL_PATH("lima.config.documentReport.balance.documentReportModelPath", - "", - n("lima.config.documentReport.balance.documentReportModelPath.description"), - "/jasperreports/balance/DocumentReport.jrxml", - String.class, false, false), - - BALANCE_ACCOUNT_REPORT_MODEL_PATH("lima.config.documentReport.balance.balanceAccountReportModelPath", - "", - n("lima.config.documentReport.balance.balanceAccountReportModelPath.description"), - "/jasperreports/balance/BalanceReportAccountReport.jrxml", - String.class, false, false), - - BALANCE_SUB_ACCOUNT_REPORT_MODEL_PATH("lima.config.documentReport.balance.balanceSubAccountReportModelPath", - "", - n("lima.config.documentReport.balance.balanceSubAccountReportModelPath.description"), - "/jasperreports/balance/BalanceSubAccountsReport.jrxml", - String.class, false, false), - - GENERAL_ENTRY_BOOK_DOCUMENT_REPORT_MODEL_PATH("lima.config.documentReport.generalEntrybook.documentReportModelPath", - "", - n("lima.config.documentReport.generalEntrybook.documentReportModelPath.description"), - "/jasperreports/generalEntryBook/DocumentReport.jrxml", - String.class, false, false), - - GENERAL_ENTRY_BOOK_REPORT_MODEL_PATH("lima.config.documentReport.generalEntrybook.generalEntryBookModelPath", - "", - n("lima.config.documentReport.generalEntrybook.generalEntryBookModelPath.description"), - "/jasperreports/generalEntryBook/EntryBookPeriodReport.jrxml", - String.class, false, false), - - - GENERAL_ENTRY_BOOK_ENTRY_REPORT_MODEL_PATH("lima.config.documentReport.generalEntrybook.generalEntryBookEntryModelPath", - "", - n("blima.config.documentReport.generalEntrybook.generalEntryBookEntryModelPath.description"), - "/jasperreports/generalEntryBook/GeneralEntryBookEntryReport.jrxml", - String.class, false, false), - - ENTRY_BOOK_DOCUMENT_REPORT_MODEL_PATH("lima.config.documentReport.entrybook.documentReportModelPath", - "", - n("lima.config.documentReport.entrybook.documentReportModelPath.description"), - "/jasperreports/entryBook/DocumentReport.jrxml", - String.class,false, false), - - ENTRY_BOOK_ENTRY_BOOK_REPORT_MODEL_PATH("lima.config.documentReport.entrybook.entryBookModelPath", - "", - n("lima.config.documentReport.entrybook.entryBookModelPath.description"), - "/jasperreports/entryBook/EntryBookReport.jrxml", - String.class,false, false), - - ENTRY_BOOK_FINANCIAL_PERIOD_REPORT_MODEL_PATH("lima.config.documentReport.entrybook.financialPeriodModelPath", - "", - n("lima.config.documentReport.entrybook.financialPeriodModelPath.description"), - "/jasperreports/entryBook/FinancialPeriodReport.jrxml", - String.class, false, false), - - ENTRY_BOOK_TRANSACTION_REPORT_MODEL_PATH("lima.config.documentReport.entrybook.transactionReportModelPath", - "", - n("lima.config.documentReport.entrybook.transactionReportModelPath.description"), - "/jasperreports/entryBook/TransactionReport.jrxml", - String.class, false, false); + Color.class, false, false); protected enum ComportmentEditingCellEnum {ALL, NOTHING} @@ -877,11 +734,11 @@ public class LimaSwingConfig extends ApplicationConfig { // propagate scale option to serveur option optionsService = LimaServiceFactory.getService(OptionsService.class); - // scale server option - String scaleOption = getOption(Option.SCALE.key); - if (StringUtils.isNotBlank(scaleOption)) { - optionsService.setScale(scaleOption); - } +// // scale server option +// String scaleOption = getOption(Option.SCALE.key); +// if (StringUtils.isNotBlank(scaleOption)) { +// optionsService.setScale(scaleOption); +// } } } 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 fb5ad34..a212521 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 @@ -28,7 +28,7 @@ import org.chorem.lima.beans.Condition; import org.chorem.lima.beans.EntryBookCondition; import org.chorem.lima.business.api.EntryBookService; import org.chorem.lima.entity.EntryBook; -import org.chorem.lima.service.LimaServiceFactory; +import org.chorem.lima.business.LimaServiceFactory; import org.chorem.lima.ui.Filter.ConditionHandler; import org.chorem.lima.ui.Filter.financialTransactionCondition.FinancialTransactionConditionHandler; 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 8064a3d..5b2abf0 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 @@ -28,7 +28,7 @@ import org.chorem.lima.beans.Condition; import org.chorem.lima.beans.FinancialPeriodCondition; import org.chorem.lima.business.api.FinancialPeriodService; import org.chorem.lima.entity.FinancialPeriod; -import org.chorem.lima.service.LimaServiceFactory; +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; 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 3807655..d8f74c3 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 @@ -28,7 +28,7 @@ import org.chorem.lima.beans.Condition; import org.chorem.lima.beans.FiscalPeriodCondition; import org.chorem.lima.business.api.FiscalPeriodService; import org.chorem.lima.entity.FiscalPeriod; -import org.chorem.lima.service.LimaServiceFactory; +import org.chorem.lima.business.LimaServiceFactory; import org.chorem.lima.ui.Filter.ConditionHandler; import org.chorem.lima.ui.Filter.financialTransactionCondition.FinancialTransactionConditionHandler; 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 5ac4ab1..f8205ab 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,8 +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.api.OptionsService; import org.chorem.lima.enums.ImportExportEnum; import org.chorem.lima.server.LimaServerConfig; +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; @@ -227,24 +229,27 @@ public class MainViewHandler { DefaultCellEditor separatorEditor = new DefaultCellEditor(comboBoxSeparator); comboBoxSeparator.setRenderer(new NumberSeparatorCellRenderer()); NumberSeparatorTableCellRenderer separatorRenderer = new NumberSeparatorTableCellRenderer(); - helper.addOption(LimaSwingConfig.Option.DECIMAL_SEPARATOR); - helper.setOptionShortLabel(LimaSwingConfig.Option.DECIMAL_SEPARATOR.getLabel()); + + OptionsService optionsService = LimaServiceFactory.getService(OptionsService.class); + + helper.addOption(optionsService.getDecimalSeparatorOption()); + helper.setOptionShortLabel(optionsService.getDecimalSeparatorOption().getLabel()); helper.setOptionRenderer(separatorRenderer); helper.setOptionEditor(separatorEditor); JComboBox<Integer> comboBoxDecimal = new JComboBox<Integer>(LimaSwingConfig.NUMBER_DECIMALS.toArray(new Integer[LimaSwingConfig.NUMBER_DECIMALS.size()])); DefaultCellEditor decimalEditor = new DefaultCellEditor(comboBoxDecimal); - helper.addOption(LimaSwingConfig.Option.SCALE); - helper.setOptionShortLabel(LimaSwingConfig.Option.SCALE.getLabel()); + helper.addOption(optionsService.getScaleOption()); + helper.setOptionShortLabel(optionsService.getScaleOption().getLabel()); helper.setOptionEditor(decimalEditor); - helper.addOption(LimaSwingConfig.Option.THOUSAND_SEPARATOR); - helper.setOptionShortLabel(LimaSwingConfig.Option.THOUSAND_SEPARATOR.getLabel()); + helper.addOption(optionsService.getThousandSeparatorOption()); + helper.setOptionShortLabel(optionsService.getThousandSeparatorOption().getLabel()); helper.setOptionRenderer(separatorRenderer); helper.setOptionEditor(separatorEditor); - helper.addOption(LimaSwingConfig.Option.CURRENCY); - helper.setOptionShortLabel(LimaSwingConfig.Option.CURRENCY.getLabel()); + helper.addOption(optionsService.getCurrencyOption()); + helper.setOptionShortLabel(optionsService.getCurrencyOption().getLabel()); /*Pas de 'callBack' sur le changement de comportement lors de l'édition d'une cellule, * car les deux éditeurs concernés rappellent la config dans un listener ('focusGained')*/ helper.addOption(LimaSwingConfig.Option.SELECT_ALL_EDITING_CELL); 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 e0e40d4..0eb1f29 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 @@ -36,7 +36,7 @@ import org.chorem.lima.business.exceptions.UsedAccountException; import org.chorem.lima.entity.Account; import org.chorem.lima.enums.AccountsChartEnum; import org.chorem.lima.enums.ImportExportEnum; -import org.chorem.lima.service.LimaServiceFactory; +import org.chorem.lima.business.LimaServiceFactory; import org.chorem.lima.ui.importexport.ImportExport; import org.chorem.lima.util.ErrorHelper; import org.jdesktop.swingx.JXTreeTable; 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 6292bd8..2f100c2 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 @@ -28,7 +28,7 @@ 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.service.LimaServiceFactory; +import org.chorem.lima.business.LimaServiceFactory; import javax.swing.*; import java.util.List; 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 4b0d663..aa0313a 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 @@ -28,7 +28,7 @@ import org.chorem.lima.business.ServiceListener; import org.chorem.lima.business.api.EntryBookService; import org.chorem.lima.business.api.ImportService; import org.chorem.lima.entity.EntryBook; -import org.chorem.lima.service.LimaServiceFactory; +import org.chorem.lima.business.LimaServiceFactory; import javax.swing.*; import java.util.List; 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 index 658d925..16f2ce8 100644 --- 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 @@ -30,7 +30,7 @@ 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.service.LimaServiceFactory; +import org.chorem.lima.business.LimaServiceFactory; import javax.swing.*; import java.util.List; 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 0adf0f3..dc01fc5 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 @@ -28,7 +28,7 @@ import org.chorem.lima.business.ServiceListener; import org.chorem.lima.business.api.FiscalPeriodService; import org.chorem.lima.business.api.ImportService; import org.chorem.lima.entity.FiscalPeriod; -import org.chorem.lima.service.LimaServiceFactory; +import org.chorem.lima.business.LimaServiceFactory; import javax.swing.*; import java.util.List; 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 d4496e3..15df29a 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 @@ -29,7 +29,7 @@ import org.chorem.lima.business.api.AccountService; import org.chorem.lima.business.api.ImportService; import org.chorem.lima.business.utils.AccountComparator; import org.chorem.lima.entity.Account; -import org.chorem.lima.service.LimaServiceFactory; +import org.chorem.lima.business.LimaServiceFactory; import javax.swing.*; import java.util.Collections; 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 index 9e0cb4a..efe82d0 100644 --- 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 @@ -25,7 +25,7 @@ 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.service.LimaServiceFactory; +import org.chorem.lima.business.LimaServiceFactory; import javax.swing.*; import java.util.List; diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/common/FinancialTransactionTableModel.java b/lima-swing/src/main/java/org/chorem/lima/ui/common/FinancialTransactionTableModel.java index ad5b5e0..ecb9e9d 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/common/FinancialTransactionTableModel.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/common/FinancialTransactionTableModel.java @@ -34,7 +34,7 @@ import org.chorem.lima.entity.Entry; import org.chorem.lima.entity.EntryImpl; import org.chorem.lima.entity.FinancialTransaction; import org.chorem.lima.entity.FinancialTransactionImpl; -import org.chorem.lima.service.LimaServiceFactory; +import org.chorem.lima.business.LimaServiceFactory; import org.chorem.lima.ui.financialtransaction.AccountColumn; import org.chorem.lima.ui.financialtransaction.CreditColumn; import org.chorem.lima.ui.financialtransaction.DayColumn; diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookViewHandler.java b/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookViewHandler.java index 8f0073f..3236d79 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookViewHandler.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookViewHandler.java @@ -34,7 +34,7 @@ import org.chorem.lima.entity.EntryBook; import org.chorem.lima.entity.EntryBookImpl; import org.chorem.lima.enums.EntryBooksChartEnum; import org.chorem.lima.enums.ImportExportEnum; -import org.chorem.lima.service.LimaServiceFactory; +import org.chorem.lima.business.LimaServiceFactory; import org.chorem.lima.ui.importexport.ImportExport; import org.chorem.lima.util.ErrorHelper; import org.jdesktop.swingx.JXTable; diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodViewHandler.java b/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodViewHandler.java index 2ccee6c..4710d8e 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodViewHandler.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodViewHandler.java @@ -38,7 +38,7 @@ import org.chorem.lima.business.utils.FinancialPeriodComparator; import org.chorem.lima.entity.ClosedPeriodicEntryBook; import org.chorem.lima.entity.Entry; import org.chorem.lima.entity.FinancialTransaction; -import org.chorem.lima.service.LimaServiceFactory; +import org.chorem.lima.business.LimaServiceFactory; import org.chorem.lima.util.BigDecimalToString; import org.chorem.lima.util.ErrorHelper; import org.jdesktop.swingx.JXTable; diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartTreeTableModel.java b/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartTreeTableModel.java index 5f9a878..b5f0cab 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartTreeTableModel.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartTreeTableModel.java @@ -31,7 +31,7 @@ import org.chorem.lima.business.exceptions.AlreadyExistFinancialStatement; import org.chorem.lima.business.exceptions.NotAllowedLabelException; import org.chorem.lima.entity.FinancialStatement; import org.chorem.lima.entity.FinancialStatementImpl; -import org.chorem.lima.service.LimaServiceFactory; +import org.chorem.lima.business.LimaServiceFactory; import org.chorem.lima.util.ErrorHelper; import org.jdesktop.swingx.treetable.AbstractTreeTableModel; diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartViewHandler.java b/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartViewHandler.java index 3e5bc1b..70f0a6c 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartViewHandler.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartViewHandler.java @@ -32,7 +32,7 @@ import org.chorem.lima.entity.FinancialStatement; import org.chorem.lima.entity.FinancialStatementImpl; import org.chorem.lima.enums.FinancialStatementsChartEnum; import org.chorem.lima.enums.ImportExportEnum; -import org.chorem.lima.service.LimaServiceFactory; +import org.chorem.lima.business.LimaServiceFactory; import org.chorem.lima.ui.importexport.ImportExport; import org.chorem.lima.util.ReportDialogView; import org.jdesktop.swingx.JXTreeTable; 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 c65b720..6666f0b 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 @@ -45,7 +45,7 @@ import org.chorem.lima.entity.FinancialPeriod; import org.chorem.lima.entity.FinancialTransaction; import org.chorem.lima.entity.FinancialTransactionImpl; import org.chorem.lima.entity.FiscalPeriod; -import org.chorem.lima.service.LimaServiceFactory; +import org.chorem.lima.business.LimaServiceFactory; import org.chorem.lima.ui.common.FinancialTransactionTableModel; import org.chorem.lima.util.BigDecimalToString; import org.chorem.lima.util.ErrorHelper; diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchTableModel.java b/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchTableModel.java index ba0bfbe..7dc70ae 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchTableModel.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchTableModel.java @@ -26,7 +26,7 @@ import org.chorem.lima.beans.FinancialTransactionCondition; import org.chorem.lima.business.api.FinancialPeriodService; import org.chorem.lima.entity.FinancialTransaction; import org.chorem.lima.entity.FiscalPeriod; -import org.chorem.lima.service.LimaServiceFactory; +import org.chorem.lima.business.LimaServiceFactory; import org.chorem.lima.ui.common.FinancialTransactionTableModel; import org.chorem.lima.ui.financialtransaction.AccountColumn; import org.chorem.lima.ui.financialtransaction.BalanceColumn; 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 3f87ab1..37119d1 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 @@ -26,7 +26,7 @@ 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.service.LimaServiceFactory; +import org.chorem.lima.business.LimaServiceFactory; import org.chorem.lima.ui.Filter.AccountCondition.AccountConditionView; import org.chorem.lima.ui.Filter.BigDecimalCondition.CreditConditionView; import org.chorem.lima.ui.Filter.BigDecimalCondition.DebitConditionView; diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodViewHandler.java b/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodViewHandler.java index b322e4e..514f805 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodViewHandler.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodViewHandler.java @@ -41,7 +41,7 @@ import org.chorem.lima.entity.EntryBookImpl; import org.chorem.lima.entity.FinancialTransaction; import org.chorem.lima.entity.FiscalPeriod; import org.chorem.lima.entity.FiscalPeriodImpl; -import org.chorem.lima.service.LimaServiceFactory; +import org.chorem.lima.business.LimaServiceFactory; import org.chorem.lima.util.ErrorHelper; import org.nuiton.util.DateUtil; diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/home/AccountsPane.java b/lima-swing/src/main/java/org/chorem/lima/ui/home/AccountsPane.java index be08993..514eda0 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/home/AccountsPane.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/home/AccountsPane.java @@ -28,7 +28,7 @@ import org.chorem.lima.LimaSwingApplicationContext; import org.chorem.lima.business.ServiceListener; import org.chorem.lima.business.api.AccountService; import org.chorem.lima.business.api.ImportService; -import org.chorem.lima.service.LimaServiceFactory; +import org.chorem.lima.business.LimaServiceFactory; import org.chorem.lima.ui.MainView; import javax.swing.event.HyperlinkEvent; diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/home/EntryBooksPane.java b/lima-swing/src/main/java/org/chorem/lima/ui/home/EntryBooksPane.java index 673ed7f..f9cff5e 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/home/EntryBooksPane.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/home/EntryBooksPane.java @@ -29,7 +29,7 @@ import org.chorem.lima.business.ServiceListener; import org.chorem.lima.business.api.EntryBookService; import org.chorem.lima.business.api.ImportService; import org.chorem.lima.entity.EntryBook; -import org.chorem.lima.service.LimaServiceFactory; +import org.chorem.lima.business.LimaServiceFactory; import org.chorem.lima.ui.MainView; import javax.swing.event.HyperlinkEvent; diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/home/FinancialTransactionsPane.java b/lima-swing/src/main/java/org/chorem/lima/ui/home/FinancialTransactionsPane.java index 062a453..806ae7b 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/home/FinancialTransactionsPane.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/home/FinancialTransactionsPane.java @@ -33,7 +33,7 @@ import org.chorem.lima.business.api.ImportService; import org.chorem.lima.entity.EntryBook; import org.chorem.lima.entity.FinancialTransaction; import org.chorem.lima.entity.FiscalPeriod; -import org.chorem.lima.service.LimaServiceFactory; +import org.chorem.lima.business.LimaServiceFactory; import org.chorem.lima.ui.MainView; import javax.swing.event.HyperlinkEvent; diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/home/FiscalYearsPane.java b/lima-swing/src/main/java/org/chorem/lima/ui/home/FiscalYearsPane.java index 3c21459..97c2542 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/home/FiscalYearsPane.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/home/FiscalYearsPane.java @@ -29,7 +29,7 @@ import org.chorem.lima.business.ServiceListener; import org.chorem.lima.business.api.FiscalPeriodService; import org.chorem.lima.business.api.ImportService; import org.chorem.lima.entity.FiscalPeriod; -import org.chorem.lima.service.LimaServiceFactory; +import org.chorem.lima.business.LimaServiceFactory; import org.chorem.lima.ui.MainView; import javax.swing.event.HyperlinkEvent; diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/identity/IdentityHandler.java b/lima-swing/src/main/java/org/chorem/lima/ui/identity/IdentityHandler.java index 7eaad66..f0bcc1f 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/identity/IdentityHandler.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/identity/IdentityHandler.java @@ -27,7 +27,7 @@ import org.apache.commons.logging.LogFactory; import org.chorem.lima.business.api.IdentityService; import org.chorem.lima.entity.Identity; import org.chorem.lima.entity.IdentityImpl; -import org.chorem.lima.service.LimaServiceFactory; +import org.chorem.lima.business.LimaServiceFactory; public class IdentityHandler { 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 afedfb3..d0c4de2 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 @@ -60,7 +60,7 @@ import org.chorem.lima.entity.Identity; import org.chorem.lima.entity.VatStatement; import org.chorem.lima.enums.EncodingEnum; import org.chorem.lima.enums.ImportExportEnum; -import org.chorem.lima.service.LimaServiceFactory; +import org.chorem.lima.business.LimaServiceFactory; import org.chorem.lima.util.ErrorHelper; import org.jdesktop.swingx.painter.BusyPainter; diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java b/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java index 92e86a4..d0a832c 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java @@ -42,7 +42,7 @@ import org.chorem.lima.entity.Account; import org.chorem.lima.entity.AccountImpl; import org.chorem.lima.entity.Entry; import org.chorem.lima.entity.FiscalPeriod; -import org.chorem.lima.service.LimaServiceFactory; +import org.chorem.lima.business.LimaServiceFactory; import org.chorem.lima.util.BigDecimalToString; import org.chorem.lima.util.ErrorHelper; diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateFiscalPeriodPanel.jaxx b/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateFiscalPeriodPanel.jaxx index e5d2926..b7d1fe9 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateFiscalPeriodPanel.jaxx +++ b/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateFiscalPeriodPanel.jaxx @@ -28,7 +28,7 @@ org.chorem.lima.entity.FiscalPeriod org.chorem.lima.business.api.FiscalPeriodService org.chorem.lima.business.exceptions.LimaException - org.chorem.lima.service.LimaServiceFactory + org.chorem.lima.business.LimaServiceFactory </import> <script> <![CDATA[ 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 5b51ac2..5dfe631 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 @@ -27,7 +27,7 @@ import org.apache.commons.logging.LogFactory; import org.chorem.lima.business.api.IdentityService; import org.chorem.lima.entity.Identity; import org.chorem.lima.entity.IdentityImpl; -import org.chorem.lima.service.LimaServiceFactory; +import org.chorem.lima.business.LimaServiceFactory; import org.chorem.lima.ui.identity.IdentityHandler; /** diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/opening/OpeningViewHandler.java b/lima-swing/src/main/java/org/chorem/lima/ui/opening/OpeningViewHandler.java index f56d2f4..fb8079e 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/opening/OpeningViewHandler.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/opening/OpeningViewHandler.java @@ -33,7 +33,7 @@ import org.chorem.lima.enums.EntryBooksChartEnum; import org.chorem.lima.enums.FinancialStatementsChartEnum; import org.chorem.lima.enums.ImportExportEnum; import org.chorem.lima.enums.VatStatementsChartEnum; -import org.chorem.lima.service.LimaServiceFactory; +import org.chorem.lima.business.LimaServiceFactory; import org.chorem.lima.ui.importexport.ImportExport; import javax.swing.*; 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 f02f13f..8b97ba9 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 @@ -28,7 +28,7 @@ import org.chorem.lima.business.exceptions.AlreadyExistVatStatementException; import org.chorem.lima.business.exceptions.NotAllowedLabelException; import org.chorem.lima.entity.VatStatement; import org.chorem.lima.entity.VatStatementImpl; -import org.chorem.lima.service.LimaServiceFactory; +import org.chorem.lima.business.LimaServiceFactory; import org.chorem.lima.util.ErrorHelper; import org.jdesktop.swingx.treetable.AbstractTreeTableModel; 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 cc56408..6ac3baf 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 @@ -30,7 +30,7 @@ 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.service.LimaServiceFactory; +import org.chorem.lima.business.LimaServiceFactory; import org.chorem.lima.ui.importexport.ImportExport; import org.jdesktop.swingx.JXTreeTable; diff --git a/lima-swing/src/main/java/org/chorem/lima/util/BigDecimalToString.java b/lima-swing/src/main/java/org/chorem/lima/util/BigDecimalToString.java index ee26da8..c1ccea3 100644 --- a/lima-swing/src/main/java/org/chorem/lima/util/BigDecimalToString.java +++ b/lima-swing/src/main/java/org/chorem/lima/util/BigDecimalToString.java @@ -36,32 +36,10 @@ public class BigDecimalToString { public static String format(BigDecimal value) { - DecimalFormat formatter = getDecimalFormat(); + LimaSwingConfig config = LimaSwingApplicationContext.getContext().getConfig(); + DecimalFormat formatter = org.chorem.lima.business.utils.BigDecimalToString.newDecimalFormat(config); String result = formatter.format(value); return result; } - public static DecimalFormat getDecimalFormat() { - LimaSwingConfig config = LimaSwingApplicationContext.getContext().getConfig(); - StringBuilder scale = new StringBuilder(); - for (int i = 0; i < config.getScale(); i++) { - scale.append("0"); - } - String currency = ""; - if (config.getCurrency()) { - currency = " ¤"; - } - DecimalFormat formatter = new DecimalFormat("##0." + scale.toString() + currency); - DecimalFormatSymbols symbol = new DecimalFormatSymbols(); - //set decimalSeparator and thousandSeparator preferences - symbol.setDecimalSeparator(config.getDecimalSeparator()); - symbol.setMonetaryDecimalSeparator(config.getDecimalSeparator()); - symbol.setGroupingSeparator(config.getThousandSeparator()); - formatter.setDecimalFormatSymbols(symbol); - //always set grouping - formatter.setGroupingUsed(true); - formatter.setGroupingSize(3); - return formatter; - } - } diff --git a/lima-swing/src/test/java/org/chorem/lima/ui/AbstractLimaTest.java b/lima-swing/src/test/java/org/chorem/lima/ui/AbstractLimaTest.java index 4cf5ad1..6415f87 100644 --- a/lima-swing/src/test/java/org/chorem/lima/ui/AbstractLimaTest.java +++ b/lima-swing/src/test/java/org/chorem/lima/ui/AbstractLimaTest.java @@ -44,7 +44,7 @@ import org.chorem.lima.entity.LimaCallaoEntityEnum; import org.chorem.lima.entity.LimaCallaoTopiaApplicationContext; import org.chorem.lima.entity.LimaCallaoTopiaPersistenceContext; import org.chorem.lima.server.LimaServerConfig; -import org.chorem.lima.service.LimaServiceFactory; +import org.chorem.lima.business.LimaServiceFactory; import org.hibernate.cfg.Environment; import org.junit.Before; import org.nuiton.i18n.I18n; diff --git a/src/site/rst/devel/server.rst b/src/site/rst/devel/server.rst index 0d75450..0b58f03 100644 --- a/src/site/rst/devel/server.rst +++ b/src/site/rst/devel/server.rst @@ -35,7 +35,7 @@ Client ------ Configurer le client pour se connecter au serveur via le fichier de -configuration : ``$HOME/.config/lima-config.properties`` +configuration : ``$HOME/.config/lima-swing.config`` java.naming.factory.initial=org.apache.openejb.client.RemoteInitialContextFactory -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/1197-modularisation in repository lima. See http://git.chorem.org/lima.git commit cf1949b06498a6cd2520b9fb45c7fec813f68001 Author: Arnaud Thimel <thimel@codelutin.com> Date: Tue Mar 17 23:35:46 2015 +0100 Force BigDecimal formatting properties to be saved on server side --- .../main/java/org/chorem/lima/LimaSwingConfig.java | 38 +++++----------------- 1 file changed, 9 insertions(+), 29 deletions(-) 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 caad54c..18a0d79 100644 --- a/lima-swing/src/main/java/org/chorem/lima/LimaSwingConfig.java +++ b/lima-swing/src/main/java/org/chorem/lima/LimaSwingConfig.java @@ -407,30 +407,6 @@ public class LimaSwingConfig extends ApplicationConfig implements BigDecimalToSt "fr_FR", Locale.class, false, false), -// DECIMAL_SEPARATOR("lima.data.bigDecimal.decimalSeparator", -// t("lima.config.decimalSeparator.label"), -// n("lima.config.decimalSeparator.description"), -// ",", -// Character.class, false, false), -// -// SCALE("lima.data.bigDecimal.scale", -// t("lima.config.scale.label"), -// n("lima.config.scale.description"), -// "2", -// Integer.class, false, false), -// -// THOUSAND_SEPARATOR("lima.thousandSeparator", -// t("lima.config.thousandSeparator.label"), -// n("lima.config.thousandSeparator.description"), -// " ", -// Character.class, false, false), -// -// CURRENCY("lima.config.currency", -// t("lima.config.currency.label"), -// n("lima.config.currency.description"), -// "false", -// Boolean.class, false, false), - LAUNCH_UI("lima.ui.launchui", t("lima.config.ui.launchUi.label"), n("lima.config.ui.launchUi.description"), @@ -734,11 +710,15 @@ public class LimaSwingConfig extends ApplicationConfig implements BigDecimalToSt // propagate scale option to serveur option optionsService = LimaServiceFactory.getService(OptionsService.class); -// // scale server option -// String scaleOption = getOption(Option.SCALE.key); -// if (StringUtils.isNotBlank(scaleOption)) { -// optionsService.setScale(scaleOption); -// } + // Need to push again the values to server + String scale = getOption(optionsService.getScaleOption().getKey()); + optionsService.setScale(scale); + boolean currency = getOptionAsBoolean(optionsService.getCurrencyOption().getKey()); + optionsService.setCurrency(currency); + String decimalSeparator = getOption(optionsService.getDecimalSeparatorOption().getKey()); + optionsService.setDecimalSeparator(decimalSeparator); + String throusandSeparator = getOption(optionsService.getThousandSeparatorOption().getKey()); + optionsService.setThousandSeparator(throusandSeparator); } } -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/1197-modularisation in repository lima. See http://git.chorem.org/lima.git commit 1b9c88125db8eca665ef5ce980d75f92ecfe7c49 Author: Arnaud Thimel <thimel@codelutin.com> Date: Wed Mar 18 00:24:58 2015 +0100 Move some configuration (about lima-report) in lima-business common module --- .../chorem/lima/business/api/OptionsService.java | 4 ++++ .../lima/business/utils/EntryComparator.java | 2 +- .../business/utils/FinancialPeriodComparator.java | 0 .../chorem/lima/business/LimaBusinessConfig.java | 24 +++++++++++++++++++++- .../lima/business/ejb/OptionsServiceImpl.java | 10 +++++++++ .../org.chorem.lima/server/HttpServerService.java | 21 +++++++++++-------- .../org.chorem.lima/server/LimaServerConfig.java | 23 --------------------- .../src/main/java/org/chorem/lima/ui/MainView.jaxx | 2 +- .../java/org/chorem/lima/ui/MainViewHandler.java | 21 ++++++++++++++----- 9 files changed, 67 insertions(+), 40 deletions(-) diff --git a/lima-business-api/src/main/java/org/chorem/lima/business/api/OptionsService.java b/lima-business-api/src/main/java/org/chorem/lima/business/api/OptionsService.java index 1ccb1d9..9942002 100644 --- a/lima-business-api/src/main/java/org/chorem/lima/business/api/OptionsService.java +++ b/lima-business-api/src/main/java/org/chorem/lima/business/api/OptionsService.java @@ -54,4 +54,8 @@ public interface OptionsService extends BigDecimalToString.Config { LimaConfigOptionDef getThousandSeparatorOption(); + String getLimaReportHost(); + + int getLimaReportPort(); + } diff --git a/lima-business/src/main/java/org/chorem/lima/business/utils/EntryComparator.java b/lima-business-api/src/main/java/org/chorem/lima/business/utils/EntryComparator.java similarity index 91% rename from lima-business/src/main/java/org/chorem/lima/business/utils/EntryComparator.java rename to lima-business-api/src/main/java/org/chorem/lima/business/utils/EntryComparator.java index 466a846..b2e0faf 100644 --- a/lima-business/src/main/java/org/chorem/lima/business/utils/EntryComparator.java +++ b/lima-business-api/src/main/java/org/chorem/lima/business/utils/EntryComparator.java @@ -35,7 +35,7 @@ public class EntryComparator implements Serializable, Comparator<Entry> { public int compare(Entry o1, Entry o2) { int result = o1.getFinancialTransaction().getTransactionDate().compareTo(o2.getFinancialTransaction().getTransactionDate()); if (result == 0) { - result = o1.getFinancialTransaction().getTopiaCreateDate().compareTo(o2.getFinancialTransaction().getTopiaCreateDate()); + result = o1.getFinancialTransaction().getTopiaCreateDate().compareTo(o2.getFinancialTransaction().getTopiaCreateDate()); } if (result == 0) { result = o1.getTopiaCreateDate().compareTo(o2.getTopiaCreateDate()); diff --git a/lima-business/src/main/java/org/chorem/lima/business/utils/FinancialPeriodComparator.java b/lima-business-api/src/main/java/org/chorem/lima/business/utils/FinancialPeriodComparator.java similarity index 100% rename from lima-business/src/main/java/org/chorem/lima/business/utils/FinancialPeriodComparator.java rename to lima-business-api/src/main/java/org/chorem/lima/business/utils/FinancialPeriodComparator.java diff --git a/lima-business/src/main/java/org/chorem/lima/business/LimaBusinessConfig.java b/lima-business/src/main/java/org/chorem/lima/business/LimaBusinessConfig.java index 73bc7fc..951af46 100644 --- a/lima-business/src/main/java/org/chorem/lima/business/LimaBusinessConfig.java +++ b/lima-business/src/main/java/org/chorem/lima/business/LimaBusinessConfig.java @@ -33,7 +33,6 @@ import org.chorem.lima.entity.LimaCallaoEntityEnum; import org.chorem.lima.entity.LimaFlywayServiceImpl; import org.nuiton.config.ApplicationConfig; import org.nuiton.config.ArgumentsParserException; -import org.nuiton.config.ConfigOptionDef; import org.nuiton.topia.flyway.TopiaFlywayService; import org.nuiton.topia.persistence.TopiaConfigurationConstants; @@ -265,6 +264,26 @@ public class LimaBusinessConfig { config.saveForUser(); } + public String getReportHost() { + String host = config.getOption(ServiceConfigOption.REPORT_HOST.getKey()); + return host; + } + + public void setReportHost(String serverAddress) { + config.setOption(ServiceConfigOption.REPORT_HOST.key, serverAddress); + config.saveForUser(); + } + + public int getReportPort() { + int port = config.getOptionAsInt(ServiceConfigOption.REPORT_PORT.getKey()); + return port; + } + + public void setReportPort(int port) { + config.setOption(ServiceConfigOption.REPORT_PORT.key, String.valueOf(port)); + config.saveForUser(); + } + /** * Lima option definition. * <p/> @@ -287,6 +306,9 @@ public class LimaBusinessConfig { DATA_DIR("lima.data.dir", n("lima.config.data.dir.description"), "${user.home}/.lima", File.class, false, false), RULES_NATIONALTY("lima.rules", n("lima.config.rulesnationality.description"), FranceAccountingRules.class.getName(), String.class, false, false), + REPORT_HOST("lima.serveraddress", n("lima.config.serveraddress.description"), "localhost", String.class, false, false), + REPORT_PORT("lima.httpport", n("lima.config.httpport.description"), "5462", Integer.class, false, false), + SCALE("lima.data.bigDecimal.scale", t("lima.config.scale.label"), n("lima.config.scale.description"), "2", String.class, false, false), CURRENCY("lima.config.currency", t("lima.config.currency.label"), n("lima.config.currency.description"), "false", Boolean.class, false, false), DECIMAL_SEPARATOR("lima.data.bigDecimal.decimalSeparator", t("lima.config.decimalSeparator.label"), "", ",", Character.class, false, false), diff --git a/lima-business/src/main/java/org/chorem/lima/business/ejb/OptionsServiceImpl.java b/lima-business/src/main/java/org/chorem/lima/business/ejb/OptionsServiceImpl.java index 11d4f4b..635bf98 100644 --- a/lima-business/src/main/java/org/chorem/lima/business/ejb/OptionsServiceImpl.java +++ b/lima-business/src/main/java/org/chorem/lima/business/ejb/OptionsServiceImpl.java @@ -92,4 +92,14 @@ public class OptionsServiceImpl extends AbstractLimaService implements OptionsSe return LimaBusinessConfig.ServiceConfigOption.THOUSAND_SEPARATOR; } + @Override + public String getLimaReportHost() { + return LimaBusinessConfig.getInstance().getReportHost(); + } + + @Override + public int getLimaReportPort() { + return LimaBusinessConfig.getInstance().getReportPort(); + } + } diff --git a/lima-server/src/main/java/org.chorem.lima/server/HttpServerService.java b/lima-server/src/main/java/org.chorem.lima/server/HttpServerService.java index a195ff9..6daf877 100644 --- a/lima-server/src/main/java/org.chorem.lima/server/HttpServerService.java +++ b/lima-server/src/main/java/org.chorem.lima/server/HttpServerService.java @@ -29,6 +29,7 @@ import org.apache.commons.lang3.time.DateUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.lima.business.api.AccountService; +import org.chorem.lima.business.api.OptionsService; import org.chorem.lima.report.DocumentsEnum; import org.chorem.lima.business.utils.FormatsEnum; import org.chorem.lima.entity.Account; @@ -72,7 +73,8 @@ public class HttpServerService { //protected String path; - protected int port; + protected String limaReportHost; + protected int limaReportPort; private static final SimpleDateFormat DATEFORMAT = new SimpleDateFormat("yyyy-MM-dd"); @@ -80,8 +82,11 @@ public class HttpServerService { public HttpServerService() { - port = LimaServerConfig.getInstance().getHttpPort(); + OptionsService optionsService = LimaServiceFactory.getService(OptionsService.class); accountService = LimaServiceFactory.getService(AccountService.class); + + limaReportHost = optionsService.getLimaReportHost(); + limaReportPort = optionsService.getLimaReportPort(); documentService = new DocumentService(); reportBuilder = new ReportBuilder(); } @@ -94,7 +99,7 @@ public class HttpServerService { FileUtil.createDirectoryIfNecessary(reportDir); - server = new Server(port); + server = new Server(limaReportPort); ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS); context.setContextPath("/"); @@ -103,7 +108,7 @@ public class HttpServerService { server.start(); if (log.isInfoEnabled()) { - log.info("Web server running on port: " + port); + log.info("Web server running on port: " + limaReportPort); } } catch (Exception eee) { @@ -113,7 +118,7 @@ public class HttpServerService { } public int getHttpPort() { - return port; + return limaReportPort; } /** @@ -122,8 +127,6 @@ public class HttpServerService { public class MainServlet extends HttpServlet { private static final long serialVersionUID = 1L; - private String serverAddressConfig = LimaServerConfig.getInstance().getAddressServer(); - @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { @@ -222,10 +225,10 @@ public class HttpServerService { log.info("Page load"); /** create server Address : static config if exist or dynamical adress */ - if (serverAddressConfig.equals("")) { + if (limaReportHost.equals("")) { serverAddress += req.getServerName() + ":" + req.getServerPort(); } else { - serverAddress += serverAddressConfig + ":" + getHttpPort(); + serverAddress += limaReportHost + ":" + getHttpPort(); } Calendar calendar = Calendar.getInstance(); diff --git a/lima-server/src/main/java/org.chorem.lima/server/LimaServerConfig.java b/lima-server/src/main/java/org.chorem.lima/server/LimaServerConfig.java index 18df1c6..afea90b 100644 --- a/lima-server/src/main/java/org.chorem.lima/server/LimaServerConfig.java +++ b/lima-server/src/main/java/org.chorem.lima/server/LimaServerConfig.java @@ -110,27 +110,6 @@ public class LimaServerConfig { return dataDir; } - public String getAddressServer() { - String serverAddress = config.getOption(ServiceConfigOption.SERVER_ADRESS.getKey()); - return serverAddress; - } - - public void setAddressServer(String serverAddress) { - config.setOption(ServiceConfigOption.SERVER_ADRESS.key, serverAddress); - config.saveForUser(); - } - - public int getHttpPort() { - String httpPort = config.getOption(ServiceConfigOption.HTTP_PORT.getKey()); - Integer port = Integer.valueOf(httpPort); - return port; - } - - public void setHttpPort(int port) { - config.setOption(ServiceConfigOption.HTTP_PORT.key, String.valueOf(port)); - config.saveForUser(); - } - public String getVatPDFUrl() { String vatPDFUrl = config.getOption(ServiceConfigOption.VAT_PDF_URL.getKey()); return vatPDFUrl; @@ -396,8 +375,6 @@ public class LimaServerConfig { APPLICATION_VERSION("application.version", n("application.version"), null, String.class, false, false), DATA_DIR("lima.data.dir", n("lima.config.data.dir.description"), "${user.home}/.lima", File.class, false, false), RULES_NATIONALTY("lima.rules", n("lima.config.rulesnationality.description"), FranceAccountingRules.class.getName(), String.class, false, false), - HTTP_PORT("lima.httpport", n("lima.config.httpport.description"), "5462", String.class, false, false), - SERVER_ADRESS("lima.serveraddress", n("lima.config.serveraddress.description"), "localhost", String.class, false, false), VAT_PDF_URL("lima.report.vatpdfurl", n("lima.config.reportvatpdfurl.description"), "default", String.class, false, false), REPORTS_MODEL_DIR("lima.reports.dir",n("lima.config.reports.dir.description"),"${lima.data.dir}/reports", File.class, false, false), diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/MainView.jaxx b/lima-swing/src/main/java/org/chorem/lima/ui/MainView.jaxx index 9ddecce..7e1d4ac 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/MainView.jaxx +++ b/lima-swing/src/main/java/org/chorem/lima/ui/MainView.jaxx @@ -107,7 +107,7 @@ </JMenu> <JSeparator/> <JMenuItem id="documents" - onActionPerformed="getHandler().loadURI(this)"/> + onActionPerformed="getHandler().openLimaReport(this)"/> <JSeparator/> <JMenuItem id="identity" onActionPerformed="getHandler().showIdentity(this)"/> 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 f8205ab..cbe4203 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 @@ -31,8 +31,8 @@ import org.chorem.lima.LimaSwingApplicationContext; import org.chorem.lima.LimaSwingConfig; import org.chorem.lima.business.api.OptionsService; import org.chorem.lima.enums.ImportExportEnum; -import org.chorem.lima.server.LimaServerConfig; import org.chorem.lima.business.LimaServiceFactory; +import org.chorem.lima.server.LimaServerConfig; import org.chorem.lima.ui.account.AccountView; import org.chorem.lima.ui.celleditor.NumberSeparatorCellRenderer; import org.chorem.lima.ui.celleditor.NumberSeparatorTableCellRenderer; @@ -491,10 +491,21 @@ public class MainViewHandler { importExport.processImportExport(type, true); } - public void loadURI(MainView ui) { - int port = LimaServerConfig.getInstance().getHttpPort(); - String address = LimaServerConfig.getInstance().getHostAddress(); - String url = "http://" + address + ":" + port + "/"; + public void openLimaReport(MainView ui) { + + OptionsService optionsService = LimaServiceFactory.getService(OptionsService.class); + + String host = optionsService.getLimaReportHost(); + int port = optionsService.getLimaReportPort(); + + String url; + if (port == 80) { + url = String.format("http://%s/", host); + } else if (port == 443) { + url = String.format("https://%s/", host); + } else { + url = String.format("http://%s:%d/", host, port); + } if (log.isDebugEnabled()) { log.debug("URL : " + url); -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/1197-modularisation in repository lima. See http://git.chorem.org/lima.git commit 542931034466d9b604269f3bee7b820e14c15e0c Author: Arnaud Thimel <thimel@codelutin.com> Date: Wed Mar 18 00:41:42 2015 +0100 Make lima-swing independent of lima-business (only lima-business-api) --- .../chorem/lima/business/utils/AccountComparator.java | 0 .../lima/business/utils/FiscalPeriodComparator.java | 0 lima-swing/pom.xml | 18 ++++++++++++------ .../main/java/org/chorem/lima/ui/MainViewHandler.java | 1 - 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/lima-business/src/main/java/org/chorem/lima/business/utils/AccountComparator.java b/lima-business-api/src/main/java/org/chorem/lima/business/utils/AccountComparator.java similarity index 100% rename from lima-business/src/main/java/org/chorem/lima/business/utils/AccountComparator.java rename to lima-business-api/src/main/java/org/chorem/lima/business/utils/AccountComparator.java diff --git a/lima-business/src/main/java/org/chorem/lima/business/utils/FiscalPeriodComparator.java b/lima-business-api/src/main/java/org/chorem/lima/business/utils/FiscalPeriodComparator.java similarity index 100% rename from lima-business/src/main/java/org/chorem/lima/business/utils/FiscalPeriodComparator.java rename to lima-business-api/src/main/java/org/chorem/lima/business/utils/FiscalPeriodComparator.java diff --git a/lima-swing/pom.xml b/lima-swing/pom.xml index c734be2..b84c24e 100644 --- a/lima-swing/pom.xml +++ b/lima-swing/pom.xml @@ -49,13 +49,19 @@ <artifactId>lima-server</artifactId> <version>${project.version}</version> <scope>compile</scope> + <exclusions> <!-- Exclude lima-business to make sure dependency is runtime only --> + <exclusion> + <groupId>${project.groupId}</groupId> + <artifactId>lima-business</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>lima-business</artifactId> + <version>${project.version}</version> + <scope>runtime</scope> </dependency> - <!--<dependency>--> - <!--<groupId>${project.groupId}</groupId>--> - <!--<artifactId>lima-business</artifactId>--> - <!--<version>${project.version}</version>--> - <!--<scope>compile</scope>--> - <!--</dependency>--> <dependency> <groupId>${project.groupId}</groupId> <artifactId>lima-business-api</artifactId> 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 cbe4203..8acea8b 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 @@ -32,7 +32,6 @@ import org.chorem.lima.LimaSwingConfig; import org.chorem.lima.business.api.OptionsService; import org.chorem.lima.enums.ImportExportEnum; import org.chorem.lima.business.LimaServiceFactory; -import org.chorem.lima.server.LimaServerConfig; import org.chorem.lima.ui.account.AccountView; import org.chorem.lima.ui.celleditor.NumberSeparatorCellRenderer; import org.chorem.lima.ui.celleditor.NumberSeparatorTableCellRenderer; -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
participants (1)
-
chorem.org scm