Lima-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
September 2014
- 2 participants
- 17 discussions
r3929 - in trunk: lima-business/src/main/java/org/chorem/lima/business lima-business/src/test/java/org/chorem/lima/business lima-swing/src/main/java/org/chorem/lima
by dcosse@users.chorem.org 29 Sep '14
by dcosse@users.chorem.org 29 Sep '14
29 Sep '14
Author: dcosse
Date: 2014-09-29 18:26:31 +0200 (Mon, 29 Sep 2014)
New Revision: 3929
Url: http://forge.chorem.org/projects/lima/repository/revisions/3929
Log:
refs #1115 on s'assure que LimaServiceConfig ne peut-?\195?\170tre qu'un singleton, le constructeur n'est plus public
Modified:
trunk/lima-business/src/main/java/org/chorem/lima/business/LimaServiceConfig.java
trunk/lima-business/src/test/java/org/chorem/lima/business/AbstractLimaTest.java
trunk/lima-business/src/test/java/org/chorem/lima/business/LimaTestsConfig.java
trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/LimaServiceConfig.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/LimaServiceConfig.java 2014-09-29 13:16:00 UTC (rev 3928)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/LimaServiceConfig.java 2014-09-29 16:26:31 UTC (rev 3929)
@@ -65,13 +65,13 @@
protected static final String LIMA_DEFAULT_CONF_FILENAME = "lima.properties";
- protected static ApplicationConfig config;
+ protected ApplicationConfig config;
+ protected Properties rootContextProperties;
+
protected static volatile LimaServiceConfig instance;
- protected static Properties rootContextProperties;
-
- public LimaServiceConfig(String configFileName) {
+ private LimaServiceConfig(String configFileName) {
try {
ApplicationConfig defaultConfig = new ApplicationConfig(LIMA_DEFAULT_CONF_FILENAME);
defaultConfig.loadDefaultOptions(ServiceConfigOption.values());
@@ -94,8 +94,8 @@
}
}
- public static Properties getRootContextProperties() {
- if (rootContextProperties == null) {
+ protected static Properties getRootContextProperties() {
+ if (getInstance().rootContextProperties == null) {
Properties result = instance.getFlatOptions();
// add persistence classes from generated code
result.setProperty(TopiaConfigurationConstants.CONFIG_PERSISTENCE_CLASSES, LimaCallaoEntityEnum.getImplementationClassesAsString());
@@ -110,11 +110,18 @@
result.setProperty(entry.getKey(), entry.getValue());
}
}
- rootContextProperties = result;
+ getInstance().setRootContextProperties(result);
+
+
}
- return rootContextProperties;
+ Properties result = getInstance().rootContextProperties;
+ return result;
}
+ protected void setRootContextProperties(Properties rootContextProperties) {
+ this.rootContextProperties = rootContextProperties;
+ }
+
public static LimaServiceConfig getInstance(String configFileName) {
if (instance == null) {
instance= new LimaServiceConfig(configFileName);
@@ -129,6 +136,10 @@
return instance;
}
+ protected void setConfig(ApplicationConfig config) {
+ this.config = config;
+ }
+
public ApplicationConfig getConfig() {
return config;
}
@@ -150,7 +161,7 @@
}
protected static void loadAccountingRules() {
- Class<?> accountingRulesClass = config.getOptionAsClass(ServiceConfigOption.RULES_NATIONALTY.key);
+ Class<?> accountingRulesClass = getInstance().config.getOptionAsClass(ServiceConfigOption.RULES_NATIONALTY.key);
if (accountingRulesClass == null) {
if (log.isErrorEnabled()) {
log.error("No accounting rules defined for:" + ServiceConfigOption.RULES_NATIONALTY.key);
@@ -177,7 +188,7 @@
}
public void setAccountingRule(String accountingRule) {
- LimaServiceConfig.config.setOption(ServiceConfigOption.RULES_NATIONALTY.key, accountingRule);
+ LimaServiceConfig.getInstance().config.setOption(ServiceConfigOption.RULES_NATIONALTY.key, accountingRule);
// clear cache
loadAccountingRules();
}
Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/AbstractLimaTest.java
===================================================================
--- trunk/lima-business/src/test/java/org/chorem/lima/business/AbstractLimaTest.java 2014-09-29 13:16:00 UTC (rev 3928)
+++ trunk/lima-business/src/test/java/org/chorem/lima/business/AbstractLimaTest.java 2014-09-29 16:26:31 UTC (rev 3929)
@@ -114,8 +114,8 @@
public void initAbstractTest() throws Exception {
setUpLocale();
Properties options = getTestConfiguration();
- LimaServiceConfig limaTestConfig = new LimaTestsConfig(LIMA_TEST_DEFAULT_CONF_FILENAME, options);
- initServices(limaTestConfig);
+ new LimaTestsConfig(LIMA_TEST_DEFAULT_CONF_FILENAME, options);
+ initServices();
context = createNewTestApplicationContext();
}
@@ -127,9 +127,9 @@
* Init services after i18n#init().
* @throws java.io.IOException
*/
- protected void initServices(LimaServiceConfig config) throws IOException {
+ protected void initServices() throws IOException {
if(accountService == null) {
- LimaServiceFactory.initFactory(config.getConfig());
+ LimaServiceFactory.initFactory(LimaServiceConfig.getInstance().getConfig());
accountService = LimaServiceFactory.getService(AccountService.class);
entryBookService = LimaServiceFactory.getService(EntryBookService.class);
financialPeriodService = LimaServiceFactory.getService(FinancialPeriodService.class);
Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/LimaTestsConfig.java
===================================================================
--- trunk/lima-business/src/test/java/org/chorem/lima/business/LimaTestsConfig.java 2014-09-29 13:16:00 UTC (rev 3928)
+++ trunk/lima-business/src/test/java/org/chorem/lima/business/LimaTestsConfig.java 2014-09-29 16:26:31 UTC (rev 3929)
@@ -35,21 +35,21 @@
/**
* Created by davidcosse on 11/06/14.
*/
-public class LimaTestsConfig extends LimaServiceConfig {
+public class LimaTestsConfig {
public LimaTestsConfig(String configFileName, Properties limaTestConfig) {
- super(configFileName);
- Properties standardLimaConfig = config.getFlatOptions();
+ LimaServiceConfig instance = LimaServiceConfig.getInstance(configFileName);
+ Properties standardLimaConfig = instance.getConfig().getFlatOptions();
for (Map.Entry<Object, Object> entry : limaTestConfig.entrySet()) {
standardLimaConfig.setProperty((String)entry.getKey(),(String)entry.getValue());
}
- config = new ApplicationConfig(standardLimaConfig);
- instance = this;
+ ApplicationConfig testConfig = new ApplicationConfig(standardLimaConfig);
+ instance.setConfig(testConfig);
setRootContextProperties(instance);
}
- public void setRootContextProperties(LimaServiceConfig instance) {
+ protected void setRootContextProperties(LimaServiceConfig instance) {
Properties result = instance.getFlatOptions();
// add persistence classes from generated code
result.setProperty(TopiaConfigurationConstants.CONFIG_PERSISTENCE_CLASSES, LimaCallaoEntityEnum.getImplementationClassesAsString());
@@ -64,8 +64,7 @@
result.setProperty(entry.getKey(), entry.getValue());
}
}
- rootContextProperties = result;
-
+ instance.setRootContextProperties(result);
}
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java 2014-09-29 13:16:00 UTC (rev 3928)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java 2014-09-29 16:26:31 UTC (rev 3929)
@@ -53,10 +53,10 @@
private static final Log log = LogFactory.getLog(LimaMain.class);
/** Lima configuration. */
- public static LimaSwingConfig config;
+ protected static LimaSwingConfig config;
/** splash */
- private static LimaSplash splash;
+ protected static LimaSplash splash;
/**
* Lima main method.
1
0
r3928 - trunk/lima-business/src/main/java/org/chorem/lima/business/ejb
by dcosse@users.chorem.org 29 Sep '14
by dcosse@users.chorem.org 29 Sep '14
29 Sep '14
Author: dcosse
Date: 2014-09-29 15:16:00 +0200 (Mon, 29 Sep 2014)
New Revision: 3928
Url: http://forge.chorem.org/projects/lima/repository/revisions/3928
Log:
refs #1032 refactoring sur service d'import export
Modified:
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java 2014-09-29 12:36:53 UTC (rev 3927)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java 2014-09-29 13:16:00 UTC (rev 3928)
@@ -328,29 +328,32 @@
return results;
}
- protected FinancialStatement returnFinancialStatement (FinancialStatement rootFinancialStatement, String subFinancialStatementLabel) throws AlreadyExistFinancialStatement, NotAllowedLabelException {
- Collection<FinancialStatement> subFinancialStatements = rootFinancialStatement.getSubFinancialStatements();
+ protected FinancialStatement returnFinancialStatement (final FinancialStatement rootFinancialStatement, String subFinancialStatementLabel) throws AlreadyExistFinancialStatement, NotAllowedLabelException {
FinancialStatement targetedFinancialStatement = null;
+ if (rootFinancialStatement != null) {
+ Collection<FinancialStatement> subFinancialStatements = rootFinancialStatement.getSubFinancialStatements();
- // look for financial statement from tree range
- if (subFinancialStatements != null) {
- for (FinancialStatement subFinancialStatement : subFinancialStatements) {
- if(subFinancialStatement.getLabel().equals(subFinancialStatementLabel)){
- targetedFinancialStatement = subFinancialStatement;
- break;
+ // look for financial statement from tree range
+ if (subFinancialStatements != null) {
+ for (FinancialStatement subFinancialStatement : subFinancialStatements) {
+ if(subFinancialStatement.getLabel().equals(subFinancialStatementLabel)){
+ targetedFinancialStatement = subFinancialStatement;
+ break;
+ }
}
}
+
+ // the target financialStatement has not been created yet so we create it now.
+ if (targetedFinancialStatement == null) {
+ // not found, we need to create it
+ targetedFinancialStatement = financialStatementService.newFinancialStatement();
+ targetedFinancialStatement.setLabel(subFinancialStatementLabel);
+ // create targetedFinancialStatement and rootFinancialStatement if needed
+ targetedFinancialStatement = financialStatementService.createFinancialStatement(rootFinancialStatement, targetedFinancialStatement);
+ targetedFinancialStatement.getMasterFinancialStatement();
+ }
}
- // the target financialStatement has not been created yet so we create it now.
- if (targetedFinancialStatement == null) {
- // not found, we need to create it
- targetedFinancialStatement = financialStatementService.newFinancialStatement();
- targetedFinancialStatement.setLabel(subFinancialStatementLabel);
- // create targetedFinancialStatement and rootFinancialStatement if needed
- targetedFinancialStatement = financialStatementService.createFinancialStatement(rootFinancialStatement, targetedFinancialStatement);
- targetedFinancialStatement.getMasterFinancialStatement();
- }
return targetedFinancialStatement;
}
@@ -407,7 +410,7 @@
return results;
}
- protected void processFinancialStatementImport(ImportResult result, Map<String, FinancialStatement> orderedFinancialStatements, FinancialStatementImport financialStatementBean) {
+ protected void processFinancialStatementImport(ImportResult result, Map<String, FinancialStatement> orderedFinancialStatements, final FinancialStatementImport financialStatementBean) {
Binder<FinancialStatementImport, FinancialStatement> binder = BinderFactory.newBinder(FinancialStatementImport.class, FinancialStatement.class);
FinancialStatement financialStatement = financialStatementService.newFinancialStatement();
binder.copyExcluding(financialStatementBean, financialStatement, FinancialStatement.PROPERTY_MASTER_FINANCIAL_STATEMENT);
@@ -437,8 +440,7 @@
// in case it exist (not ordered import and previously created) values are bind to the previously created one excepted
// the sub financial statements
- boolean alreadyCreated = false;
- alreadyCreated = propagetChangesToExistingFinancialStatement(financialStatement, branchesFinancialStatement, alreadyCreated);
+ boolean alreadyCreated = propagetChangesToExistingFinancialStatement(financialStatement, branchesFinancialStatement, false);
// if necessary financial statement is created
if (!alreadyCreated) {
@@ -452,7 +454,7 @@
}
}
- private FinancialStatement getRootFinancialStatement(Map<String, FinancialStatement> orderedFinancialStatements, FinancialStatementImport financialStatementBean, FinancialStatement financialStatement) throws AlreadyExistFinancialStatement, NotAllowedLabelException {
+ private FinancialStatement getRootFinancialStatement(Map<String, FinancialStatement> orderedFinancialStatements, final FinancialStatementImport financialStatementBean, final FinancialStatement financialStatement) throws AlreadyExistFinancialStatement, NotAllowedLabelException {
FinancialStatement rootFinancialStatement = orderedFinancialStatements.get(financialStatementBean.getLabel());
if (rootFinancialStatement == null) {
@@ -467,18 +469,22 @@
return rootFinancialStatement;
}
- private FinancialStatement getBrancheFinancialStatement(String[] masterNames, FinancialStatement branchesFinancialStatement) throws AlreadyExistFinancialStatement, NotAllowedLabelException {
- for (int i = 1; i < masterNames.length; i++) {// 0 is root
- String masterName = masterNames[i];
- branchesFinancialStatement = returnFinancialStatement(branchesFinancialStatement, masterName);
+ private FinancialStatement getBrancheFinancialStatement(String[] masterNames, final FinancialStatement branchesFinancialStatement) throws AlreadyExistFinancialStatement, NotAllowedLabelException {
+ FinancialStatement _branchesFinancialStatement = branchesFinancialStatement;
+ if (_branchesFinancialStatement != null) {
+ // 0 is root, start from 1
+ for (int i = 1; i < masterNames.length; i++) {
+ String masterName = masterNames[i];
+ _branchesFinancialStatement = returnFinancialStatement(_branchesFinancialStatement, masterName);
+ }
}
- return branchesFinancialStatement;
+ return _branchesFinancialStatement;
}
- protected void createRootFinancialStatement(Map<String, FinancialStatement> orderedFinancialStatements, FinancialStatement financialStatement, FinancialStatement branchesFinancialStatement) throws AlreadyExistFinancialStatement, NotAllowedLabelException {
+ protected void createRootFinancialStatement(Map<String, FinancialStatement> orderedFinancialStatements, final FinancialStatement financialStatement, final FinancialStatement branchesFinancialStatement) throws AlreadyExistFinancialStatement, NotAllowedLabelException {
// if the master finacial statement has been modified then the current one is replace by the new one.
- financialStatement = financialStatementService.createFinancialStatement(branchesFinancialStatement, financialStatement);
- FinancialStatement targetedRootFinancialStatement = returnRootFinancialStatement(financialStatement);
+ FinancialStatement _financialStatement = financialStatementService.createFinancialStatement(branchesFinancialStatement, financialStatement);
+ FinancialStatement targetedRootFinancialStatement = returnRootFinancialStatement(_financialStatement);
// replace modified root financial statement with new one
if (orderedFinancialStatements.get(targetedRootFinancialStatement.getLabel()) != null) {
@@ -486,7 +492,7 @@
}
}
- protected boolean propagetChangesToExistingFinancialStatement(FinancialStatement financialStatement, FinancialStatement branchesFinancialStatement, boolean alreadyCreated) {
+ protected boolean propagetChangesToExistingFinancialStatement(final FinancialStatement financialStatement, final FinancialStatement branchesFinancialStatement, boolean alreadyCreated) {
if (branchesFinancialStatement != null && branchesFinancialStatement.getSubFinancialStatements() != null) {
for (FinancialStatement bfs : branchesFinancialStatement.getSubFinancialStatements()) {
if (bfs.getLabel().equals(financialStatement.getLabel())){
@@ -500,51 +506,59 @@
return alreadyCreated;
}
- protected FinancialStatement createRootFinancialStatement(Map<String, FinancialStatement> orderedFinancialStatements, String rootMasterName, FinancialStatement rootFinancialStatement) throws AlreadyExistFinancialStatement, NotAllowedLabelException {
- if (rootFinancialStatement == null) {
- rootFinancialStatement = financialStatementService.newFinancialStatement();
- rootFinancialStatement.setLabel(rootMasterName);
- rootFinancialStatement = financialStatementService.createFinancialStatement(null, rootFinancialStatement);
- orderedFinancialStatements.put(rootMasterName, rootFinancialStatement);
+ protected FinancialStatement createRootFinancialStatement(Map<String, FinancialStatement> orderedFinancialStatements, String rootMasterName, final FinancialStatement rootFinancialStatement) throws AlreadyExistFinancialStatement, NotAllowedLabelException {
+ FinancialStatement _rootFinancialStatement = rootFinancialStatement;
+ if (_rootFinancialStatement == null) {
+ _rootFinancialStatement = financialStatementService.newFinancialStatement();
+ _rootFinancialStatement.setLabel(rootMasterName);
+ _rootFinancialStatement = financialStatementService.createFinancialStatement(null, _rootFinancialStatement);
+ orderedFinancialStatements.put(rootMasterName, _rootFinancialStatement);
}
- return rootFinancialStatement;
+ return _rootFinancialStatement;
}
- protected VatStatement returnVATStatement (VatStatement rootVATStatement, String subVATStatementLabel) throws AlreadyExistVatStatementException, NotAllowedLabelException {
- Collection<VatStatement> subVatStatements = rootVATStatement.getSubVatStatements();
+ protected VatStatement returnVATStatement (final VatStatement rootVATStatement, String subVATStatementLabel) throws AlreadyExistVatStatementException, NotAllowedLabelException {
VatStatement targetedVATStatement = null;
+ if (rootVATStatement != null) {
+ Collection<VatStatement> subVatStatements = rootVATStatement.getSubVatStatements();
- // look for vatStatement from tree range
- if (subVatStatements != null) {
- for (VatStatement subVatStatement : subVatStatements) {
- if(subVatStatement.getLabel().equals(subVATStatementLabel)){
- targetedVATStatement = subVatStatement;
- break;
+ // look for vatStatement from tree range
+ if (subVatStatements != null) {
+ for (VatStatement subVatStatement : subVatStatements) {
+ if(subVatStatement.getLabel().equals(subVATStatementLabel)){
+ targetedVATStatement = subVatStatement;
+ break;
+ }
}
}
+
+ if (targetedVATStatement == null) {
+ // not found, we need to create it
+ targetedVATStatement = vatStatementService.newVatStatement();
+ targetedVATStatement.setLabel(subVATStatementLabel);
+ // create targetedVATStatement and rootVATStatement if needed
+ targetedVATStatement = vatStatementService.createVatStatement(rootVATStatement, targetedVATStatement);
+ targetedVATStatement.getMasterVatStatement();
+ }
}
- //
- if (targetedVATStatement == null) {
- // not found, we need to create it
- targetedVATStatement = vatStatementService.newVatStatement();
- targetedVATStatement.setLabel(subVATStatementLabel);
- // create targetedVATStatement and rootVATStatement if needed
- targetedVATStatement = vatStatementService.createVatStatement(rootVATStatement, targetedVATStatement);
- targetedVATStatement.getMasterVatStatement();
- }
return targetedVATStatement;
}
- protected VatStatement returnRootVATStatement(VatStatement vatStatement) {
+ protected VatStatement returnRootVATStatement(final VatStatement vatStatement) {
VatStatement rootVatStatement = null;
- while (rootVatStatement == null) {
- if (vatStatement.getMasterVatStatement() == null){
- rootVatStatement = vatStatement;
- } else {
- vatStatement = vatStatement.getMasterVatStatement();
+ VatStatement _vatStatement = vatStatement;
+
+ if (_vatStatement != null) {
+ while (rootVatStatement == null) {
+ if (_vatStatement.getMasterVatStatement() == null){
+ rootVatStatement = _vatStatement;
+ } else {
+ _vatStatement = _vatStatement.getMasterVatStatement();
+ }
}
}
+
return rootVatStatement;
}
@@ -581,7 +595,7 @@
return results;
}
- protected void importVatStatement(ImportResult result, Map<String, VatStatement> orderedVATStatements, VatStatementImport vatStatementBean) {
+ protected void importVatStatement(ImportResult result, Map<String, VatStatement> orderedVATStatements, final VatStatementImport vatStatementBean) {
Binder<VatStatementImport, VatStatement> binder = BinderFactory.newBinder(VatStatementImport.class, VatStatement.class);
VatStatement vatStatement = vatStatementService.newVatStatement();
binder.copyExcluding(vatStatementBean, vatStatement, VatStatement.PROPERTY_MASTER_VAT_STATEMENT);
@@ -611,8 +625,7 @@
// in case it exist (not ordered import and previously created) values are bind to the previously created one excepted
// the sub vatStatements
- boolean alreadyCreated = false;
- alreadyCreated = propagateVATChangeToBranche(vatStatement, branchesVATStatement, alreadyCreated);
+ boolean alreadyCreated = propagateVATChangeToBranche(vatStatement, branchesVATStatement, false);
// if necessary vatStatement is created
if (!alreadyCreated) {
@@ -627,10 +640,10 @@
}
}
- private void refreshMasterVATStatement(Map<String, VatStatement> orderedVATStatements, VatStatement vatStatement, VatStatement branchesVATStatement) throws AlreadyExistVatStatementException, NotAllowedLabelException {
+ private void refreshMasterVATStatement(Map<String, VatStatement> orderedVATStatements, final VatStatement vatStatement, final VatStatement branchesVATStatement) throws AlreadyExistVatStatementException, NotAllowedLabelException {
// if the master vatStatement has been modified then the current one is replace by the new one.
- vatStatement = vatStatementService.createVatStatement(branchesVATStatement, vatStatement);
- VatStatement targetedRootVATStatement = returnRootVATStatement(vatStatement);
+ VatStatement _vatStatement = vatStatementService.createVatStatement(branchesVATStatement, vatStatement);
+ VatStatement targetedRootVATStatement = returnRootVATStatement(_vatStatement);
// replace modified root vatStatement with new one
if (orderedVATStatements.get(targetedRootVATStatement.getLabel()) != null) {
@@ -638,7 +651,7 @@
}
}
- private boolean propagateVATChangeToBranche(VatStatement vatStatement, VatStatement branchesVATStatement, boolean alreadyCreated) {
+ private boolean propagateVATChangeToBranche(final VatStatement vatStatement, final VatStatement branchesVATStatement, boolean alreadyCreated) {
if (branchesVATStatement != null && branchesVATStatement.getSubVatStatements() != null) {
for (VatStatement bfs : branchesVATStatement.getSubVatStatements()) {
if (bfs.getLabel().equals(vatStatement.getLabel())){
@@ -652,36 +665,43 @@
return alreadyCreated;
}
- private VatStatement getBrancheVatStatement(String[] masterNames, VatStatement branchesVATStatement) throws AlreadyExistVatStatementException, NotAllowedLabelException {
+ private VatStatement getBrancheVatStatement(String[] masterNames, final VatStatement branchesVATStatement) throws AlreadyExistVatStatementException, NotAllowedLabelException {
+ VatStatement _branchesVATStatement = branchesVATStatement;
for (int i = 1; i < masterNames.length; i++) {// 0 is root
String masterName = masterNames[i];
- branchesVATStatement = returnVATStatement(branchesVATStatement, masterName);
+ _branchesVATStatement = returnVATStatement(_branchesVATStatement, masterName);
}
- return branchesVATStatement;
+ return _branchesVATStatement;
}
- private VatStatement createRootVATStatement(Map<String, VatStatement> orderedVATStatements, String rootMasterName, VatStatement rootVATStatement) throws AlreadyExistVatStatementException, NotAllowedLabelException {
- if (rootVATStatement == null) {
- rootVATStatement = vatStatementService.newVatStatement();
- rootVATStatement.setLabel(rootMasterName);
- rootVATStatement = vatStatementService.createVatStatement(null, rootVATStatement);
- orderedVATStatements.put(rootMasterName, rootVATStatement);
+ private VatStatement createRootVATStatement(Map<String, VatStatement> orderedVATStatements, String rootMasterName, final VatStatement rootVATStatement) throws AlreadyExistVatStatementException, NotAllowedLabelException {
+ VatStatement result = rootVATStatement;
+ if (result == null) {
+ result = vatStatementService.newVatStatement();
+ result.setLabel(rootMasterName);
+ result = vatStatementService.createVatStatement(null, result);
+ orderedVATStatements.put(rootMasterName, result);
}
- return rootVATStatement;
+ return result;
}
- private VatStatement getRootVatStatement(Map<String, VatStatement> orderedVATStatements, VatStatementImport vatStatementBean, VatStatement vatStatement) throws AlreadyExistVatStatementException, NotAllowedLabelException {
- VatStatement rootVATStatement = orderedVATStatements.get(vatStatementBean.getLabel());
+ private VatStatement getRootVatStatement(Map<String, VatStatement> orderedVATStatements, final VatStatementImport vatStatementBean, final VatStatement vatStatement) throws AlreadyExistVatStatementException, NotAllowedLabelException {
- if (rootVATStatement == null) {
- rootVATStatement = vatStatement;
- rootVATStatement = vatStatementService.createVatStatement(null, rootVATStatement);
- } else {
- // in case it exist (not ordered import and previously created) values are bind to the previously created one excepted
- // the sub vatStatements
- Binder<VatStatement, VatStatement> rootBinder = BinderFactory.newBinder(VatStatement.class, VatStatement.class);
- rootBinder.copyExcluding(vatStatement, rootVATStatement, VatStatement.PROPERTY_SUB_VAT_STATEMENTS);
+ VatStatement rootVATStatement = null;
+ if (vatStatementBean != null) {
+ rootVATStatement = orderedVATStatements.get(vatStatementBean.getLabel());
+
+ if (rootVATStatement == null) {
+ rootVATStatement = vatStatement;
+ rootVATStatement = vatStatementService.createVatStatement(null, rootVATStatement);
+ } else {
+ // in case it exist (not ordered import and previously created) values are bind to the previously created one excepted
+ // the sub vatStatements
+ Binder<VatStatement, VatStatement> rootBinder = BinderFactory.newBinder(VatStatement.class, VatStatement.class);
+ rootBinder.copyExcluding(vatStatement, rootVATStatement, VatStatement.PROPERTY_SUB_VAT_STATEMENTS);
+ }
}
+
return rootVATStatement;
}
@@ -805,7 +825,7 @@
return result;
}
- protected boolean validEntry(ImportResult importResult, Date dateEcr, Date fiscalPeriodsBiginDate, Date fiscalPeriodsEndingDate, Account account, String targetedAccount) {
+ protected boolean validEntry(ImportResult importResult, Date dateEcr, Date fiscalPeriodsBiginDate, Date fiscalPeriodsEndingDate, final Account account, String targetedAccount) {
boolean result = true;
// if entry date have fiscalperiod open
if (dateEcr.compareTo(fiscalPeriodsBiginDate) < 0
@@ -898,7 +918,7 @@
return results;
}
- protected Entry createEntry(EntryEBP entryEBP, Account account) {
+ protected Entry createEntry(EntryEBP entryEBP, final Account account) {
Entry entry;
BigDecimal debit;
entry = financialTransactionService.createNewEntry();
1
0
Author: dcosse
Date: 2014-09-29 14:36:53 +0200 (Mon, 29 Sep 2014)
New Revision: 3927
Url: http://forge.chorem.org/projects/lima/repository/revisions/3927
Log:
mise ?\195?\160 jour en t?\195?\170tes
Modified:
trunk/lima-business/src/main/java/org/chorem/lima/business/LimaConfigurationHelper.java
trunk/lima-business/src/test/java/org/chorem/lima/business/AccountDaoTest.java
trunk/lima-callao/src/main/java/org/chorem/lima/entity/LimaCallaoTopiaApplicationContext.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountForm.css
trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountImportForm.css
trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountView.css
trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/UpdateAccountForm.css
trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookForm.css
trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookImportForm.css
trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookView.css
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodView.css
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartView.css
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementHeaderForm.css
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementImportForm.css
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementMovementForm.css
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionView.css
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedView.css
trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/AddPeriod.css
trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodView.css
trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/RetainedEarningsEntryBookForm.css
trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/RetainedEarningsWait.css
trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateAccountsPanel.css
trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateEntryBookPanel.css
trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateFiscalPeriodPanel.css
trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/OpeningView.css
trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartImportForm.css
trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartMovementForm.css
trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartView.css
Property changes on: trunk/lima-business/src/main/java/org/chorem/lima/business/LimaConfigurationHelper.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Property changes on: trunk/lima-business/src/test/java/org/chorem/lima/business/AccountDaoTest.java
___________________________________________________________________
Added: svn:eol-style
+ native
Added: svn:keywords
+ Author Date Id Revision HeadURL
Property changes on: trunk/lima-callao/src/main/java/org/chorem/lima/entity/LimaCallaoTopiaApplicationContext.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountForm.css
___________________________________________________________________
Added: svn:eol-style
+ native
Added: svn:keywords
+ Author Date Id Revision HeadURL
Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountImportForm.css
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountView.css
___________________________________________________________________
Added: svn:eol-style
+ native
Added: svn:keywords
+ Author Date Id Revision HeadURL
Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/UpdateAccountForm.css
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookForm.css
___________________________________________________________________
Added: svn:eol-style
+ native
Added: svn:keywords
+ Author Date Id Revision HeadURL
Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookImportForm.css
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookView.css
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodView.css
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartView.css
___________________________________________________________________
Added: svn:eol-style
+ native
Added: svn:keywords
+ Author Date Id Revision HeadURL
Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementHeaderForm.css
___________________________________________________________________
Added: svn:eol-style
+ native
Added: svn:keywords
+ Author Date Id Revision HeadURL
Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementImportForm.css
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementMovementForm.css
___________________________________________________________________
Added: svn:eol-style
+ native
Added: svn:keywords
+ Author Date Id Revision HeadURL
Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionView.css
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedView.css
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/AddPeriod.css
___________________________________________________________________
Added: svn:eol-style
+ native
Added: svn:keywords
+ Author Date Id Revision HeadURL
Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodView.css
___________________________________________________________________
Added: svn:eol-style
+ native
Added: svn:keywords
+ Author Date Id Revision HeadURL
Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/RetainedEarningsEntryBookForm.css
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/RetainedEarningsWait.css
___________________________________________________________________
Added: svn:eol-style
+ native
Added: svn:keywords
+ Author Date Id Revision HeadURL
Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateAccountsPanel.css
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateEntryBookPanel.css
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateFiscalPeriodPanel.css
___________________________________________________________________
Added: svn:eol-style
+ native
Added: svn:keywords
+ Author Date Id Revision HeadURL
Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/OpeningView.css
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartImportForm.css
___________________________________________________________________
Added: svn:eol-style
+ native
Added: svn:keywords
+ Author Date Id Revision HeadURL
Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartMovementForm.css
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartView.css
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
1
0
r3926 - trunk/lima-business/src/main/java/org/chorem/lima/business/ejb
by dcosse@users.chorem.org 29 Sep '14
by dcosse@users.chorem.org 29 Sep '14
29 Sep '14
Author: dcosse
Date: 2014-09-29 14:31:46 +0200 (Mon, 29 Sep 2014)
New Revision: 3926
Url: http://forge.chorem.org/projects/lima/repository/revisions/3926
Log:
refs #1032 on ne modifie pas une variable parametre
Modified:
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java 2014-09-29 08:27:32 UTC (rev 3925)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java 2014-09-29 12:31:46 UTC (rev 3926)
@@ -354,13 +354,16 @@
return targetedFinancialStatement;
}
- protected FinancialStatement returnRootFinancialStatement(FinancialStatement financialStatement) {
+ protected FinancialStatement returnRootFinancialStatement(final FinancialStatement financialStatement) {
FinancialStatement rootFinancialStatement = null;
- while (rootFinancialStatement == null) {
- if (financialStatement.getMasterFinancialStatement() == null){
- rootFinancialStatement = financialStatement;
- } else {
- financialStatement = financialStatement.getMasterFinancialStatement();
+ FinancialStatement interFinancialStatement = financialStatement;
+ if (interFinancialStatement != null) {
+ while (rootFinancialStatement == null) {
+ if (interFinancialStatement.getMasterFinancialStatement() == null){
+ rootFinancialStatement = interFinancialStatement;
+ } else {
+ interFinancialStatement = interFinancialStatement.getMasterFinancialStatement();
+ }
}
}
return rootFinancialStatement;
1
0
Author: dcosse
Date: 2014-09-29 10:27:32 +0200 (Mon, 29 Sep 2014)
New Revision: 3925
Url: http://forge.chorem.org/projects/lima/repository/revisions/3925
Log:
correction du pom, probl?\195?\168me de d?\195?\169pendance sur nuiton-converter
Modified:
trunk/lima-swing/pom.xml
trunk/pom.xml
Modified: trunk/lima-swing/pom.xml
===================================================================
--- trunk/lima-swing/pom.xml 2014-09-26 15:58:02 UTC (rev 3924)
+++ trunk/lima-swing/pom.xml 2014-09-29 08:27:32 UTC (rev 3925)
@@ -160,6 +160,11 @@
</dependency>
<dependency>
+ <groupId>org.nuiton</groupId>
+ <artifactId>nuiton-converter</artifactId>
+ </dependency>
+
+ <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2014-09-26 15:58:02 UTC (rev 3924)
+++ trunk/pom.xml 2014-09-29 08:27:32 UTC (rev 3925)
@@ -177,6 +177,7 @@
<nuitonDecoratorVersion>3.0-alpha-3</nuitonDecoratorVersion>
<nuitonProfilingVersion>3.0</nuitonProfilingVersion>
<nuitonCsvVersion>3.0-rc-4</nuitonCsvVersion>
+ <nuitonConverterVersion>1.0</nuitonConverterVersion>
<eugeneVersion>3.0-SNAPSHOT</eugeneVersion>
<topiaVersion>3.0-SNAPSHOT</topiaVersion>
<nuitonI18nVersion>3.3</nuitonI18nVersion>
@@ -341,6 +342,12 @@
</dependency>
<dependency>
+ <groupId>org.nuiton</groupId>
+ <artifactId>nuiton-converter</artifactId>
+ <version>${nuitonConverterVersion}</version>
+ </dependency>
+
+ <dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>${h2Version}</version>
1
0
r3924 - in trunk: lima-business/src/main/java/org/chorem/lima/business lima-business/src/test/java/org/chorem/lima/business lima-swing/src/main/java/org/chorem/lima
by dcosse@users.chorem.org 26 Sep '14
by dcosse@users.chorem.org 26 Sep '14
26 Sep '14
Author: dcosse
Date: 2014-09-26 17:58:02 +0200 (Fri, 26 Sep 2014)
New Revision: 3924
Url: http://forge.chorem.org/projects/lima/repository/revisions/3924
Log:
refs #1115 refactoring sur l'initialisation des services
Modified:
trunk/lima-business/src/main/java/org/chorem/lima/business/LimaConfigurationHelper.java
trunk/lima-business/src/main/java/org/chorem/lima/business/LimaInterceptor.java
trunk/lima-business/src/main/java/org/chorem/lima/business/LimaServiceConfig.java
trunk/lima-business/src/test/java/org/chorem/lima/business/FinancialPeriodServiceImplTest.java
trunk/lima-business/src/test/java/org/chorem/lima/business/LimaTestsConfig.java
trunk/lima-swing/src/main/java/org/chorem/lima/LimaSwingApplicationContext.java
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/LimaConfigurationHelper.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/LimaConfigurationHelper.java 2014-09-26 09:10:52 UTC (rev 3923)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/LimaConfigurationHelper.java 2014-09-26 15:58:02 UTC (rev 3924)
@@ -1,14 +1,8 @@
package org.chorem.lima.business;
import com.google.common.base.Function;
-import com.google.common.collect.Maps;
-import org.chorem.lima.entity.LimaCallaoEntityEnum;
import org.chorem.lima.entity.LimaCallaoTopiaApplicationContext;
-import org.nuiton.topia.flyway.TopiaFlywayService;
-import org.nuiton.topia.flyway.TopiaFlywayServiceImpl;
-import org.nuiton.topia.persistence.TopiaConfigurationConstants;
-import java.util.Map;
import java.util.Properties;
/**
@@ -26,22 +20,4 @@
};
}
- public static Properties getRootContextProperties(LimaServiceConfig serviceConfig) {
- Properties result = serviceConfig.getFlatOptions();
- // add persistence classes from generated code
- result.setProperty(TopiaConfigurationConstants.CONFIG_PERSISTENCE_CLASSES, LimaCallaoEntityEnum.getImplementationClassesAsString());
-
- Map<String, String> toAddIfNotPresent = Maps.newLinkedHashMap();
- toAddIfNotPresent.put("topia.service.migration", TopiaFlywayServiceImpl.class.getName());
- toAddIfNotPresent.put("topia.service.migration." + TopiaFlywayService.USE_MODEL_VERSION, "true");
- toAddIfNotPresent.put(TopiaConfigurationConstants.CONFIG_PERSISTENCE_INIT_SCHEMA, "true");
-
- for (Map.Entry<String, String> entry : toAddIfNotPresent.entrySet()) {
- if (!result.containsKey(entry.getKey())) {
- result.setProperty(entry.getKey(), entry.getValue());
- }
- }
-
- return result;
- }
}
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/LimaInterceptor.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/LimaInterceptor.java 2014-09-26 09:10:52 UTC (rev 3923)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/LimaInterceptor.java 2014-09-26 15:58:02 UTC (rev 3924)
@@ -38,7 +38,6 @@
import javax.interceptor.InvocationContext;
import javax.transaction.Transaction;
import javax.transaction.TransactionManager;
-import java.util.Properties;
/**
* Interceptor for topia context transaction.
@@ -81,11 +80,10 @@
context.getTarget().getClass() + "#" + context.getMethod().getName());
}
- LimaServiceConfig config = LimaServiceConfig.getInstance();
+ LimaCallaoTopiaApplicationContext rootContext = TopiaApplicationContextCache.getContext(
+ LimaServiceConfig.getRootContextProperties(),
+ LimaConfigurationHelper.getCreateTopiaContextFunction());
- Properties contextProperties = LimaConfigurationHelper.getRootContextProperties(config);
- LimaCallaoTopiaApplicationContext rootContext = TopiaApplicationContextCache.getContext(contextProperties, LimaConfigurationHelper.getCreateTopiaContextFunction());
-
LimaCallaoTopiaPersistenceContext tx = rootContext.newPersistenceContext();
DAO_HELPER.set(tx);
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/LimaServiceConfig.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/LimaServiceConfig.java 2014-09-26 09:10:52 UTC (rev 3923)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/LimaServiceConfig.java 2014-09-26 15:58:02 UTC (rev 3924)
@@ -25,16 +25,22 @@
package org.chorem.lima.business;
+import com.google.common.collect.Maps;
import org.apache.commons.lang3.StringUtils;
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.entity.LimaCallaoEntityEnum;
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.flyway.TopiaFlywayServiceImpl;
+import org.nuiton.topia.persistence.TopiaConfigurationConstants;
import java.io.File;
+import java.util.Map;
import java.util.Properties;
import static org.nuiton.i18n.I18n.n;
@@ -63,6 +69,8 @@
protected static volatile LimaServiceConfig instance;
+ protected static Properties rootContextProperties;
+
public LimaServiceConfig(String configFileName) {
try {
ApplicationConfig defaultConfig = new ApplicationConfig(LIMA_DEFAULT_CONF_FILENAME);
@@ -80,14 +88,44 @@
}
config = defaultConfig;
}
-
instance = this;
} catch (ArgumentsParserException ex) {
throw new LimaTechnicalException("Can't read configuration", ex);
}
}
+ public static Properties getRootContextProperties() {
+ if (rootContextProperties == null) {
+ Properties result = instance.getFlatOptions();
+ // add persistence classes from generated code
+ result.setProperty(TopiaConfigurationConstants.CONFIG_PERSISTENCE_CLASSES, LimaCallaoEntityEnum.getImplementationClassesAsString());
+
+ Map<String, String> toAddIfNotPresent = Maps.newLinkedHashMap();
+ toAddIfNotPresent.put("topia.service.migration", TopiaFlywayServiceImpl.class.getName());
+ toAddIfNotPresent.put("topia.service.migration." + TopiaFlywayService.USE_MODEL_VERSION, "true");
+ toAddIfNotPresent.put(TopiaConfigurationConstants.CONFIG_PERSISTENCE_INIT_SCHEMA, "true");
+
+ for (Map.Entry<String, String> entry : toAddIfNotPresent.entrySet()) {
+ if (!result.containsKey(entry.getKey())) {
+ result.setProperty(entry.getKey(), entry.getValue());
+ }
+ }
+ rootContextProperties = result;
+ }
+ return rootContextProperties;
+ }
+
+ public static LimaServiceConfig getInstance(String configFileName) {
+ if (instance == null) {
+ instance= new LimaServiceConfig(configFileName);
+ }
+ return instance;
+ }
+
public static LimaServiceConfig getInstance() {
+ if (instance == null) {
+ instance= new LimaServiceConfig(null);
+ }
return instance;
}
Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/FinancialPeriodServiceImplTest.java
===================================================================
--- trunk/lima-business/src/test/java/org/chorem/lima/business/FinancialPeriodServiceImplTest.java 2014-09-26 09:10:52 UTC (rev 3923)
+++ trunk/lima-business/src/test/java/org/chorem/lima/business/FinancialPeriodServiceImplTest.java 2014-09-26 15:58:02 UTC (rev 3924)
@@ -29,7 +29,6 @@
import org.chorem.lima.entity.ClosedPeriodicEntryBookTopiaDao;
import org.chorem.lima.entity.LimaCallaoTopiaPersistenceContext;
import org.junit.Assert;
-import org.junit.Before;
import org.junit.Test;
import java.util.List;
@@ -48,11 +47,6 @@
*/
public class FinancialPeriodServiceImplTest extends AbstractLimaTest {
- @Before
- public void initTest() throws Exception {
- //initTestDatabase();
- }
-
/**
* Test de la fermeture d'une periode comptable pour un journal donné.
*
Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/LimaTestsConfig.java
===================================================================
--- trunk/lima-business/src/test/java/org/chorem/lima/business/LimaTestsConfig.java 2014-09-26 09:10:52 UTC (rev 3923)
+++ trunk/lima-business/src/test/java/org/chorem/lima/business/LimaTestsConfig.java 2014-09-26 15:58:02 UTC (rev 3924)
@@ -22,7 +22,12 @@
* #L%
*/
+import com.google.common.collect.Maps;
+import org.chorem.lima.entity.LimaCallaoEntityEnum;
import org.nuiton.config.ApplicationConfig;
+import org.nuiton.topia.flyway.TopiaFlywayService;
+import org.nuiton.topia.flyway.TopiaFlywayServiceImpl;
+import org.nuiton.topia.persistence.TopiaConfigurationConstants;
import java.util.Map;
import java.util.Properties;
@@ -41,6 +46,26 @@
}
config = new ApplicationConfig(standardLimaConfig);
instance = this;
+ setRootContextProperties(instance);
}
+ public void setRootContextProperties(LimaServiceConfig instance) {
+ Properties result = instance.getFlatOptions();
+ // add persistence classes from generated code
+ result.setProperty(TopiaConfigurationConstants.CONFIG_PERSISTENCE_CLASSES, LimaCallaoEntityEnum.getImplementationClassesAsString());
+
+ Map<String, String> toAddIfNotPresent = Maps.newLinkedHashMap();
+ toAddIfNotPresent.put("topia.service.migration", TopiaFlywayServiceImpl.class.getName());
+ toAddIfNotPresent.put("topia.service.migration." + TopiaFlywayService.USE_MODEL_VERSION, "true");
+ toAddIfNotPresent.put(TopiaConfigurationConstants.CONFIG_PERSISTENCE_INIT_SCHEMA, "true");
+
+ for (Map.Entry<String, String> entry : toAddIfNotPresent.entrySet()) {
+ if (!result.containsKey(entry.getKey())) {
+ result.setProperty(entry.getKey(), entry.getValue());
+ }
+ }
+ rootContextProperties = result;
+
+ }
+
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/LimaSwingApplicationContext.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/LimaSwingApplicationContext.java 2014-09-26 09:10:52 UTC (rev 3923)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/LimaSwingApplicationContext.java 2014-09-26 15:58:02 UTC (rev 3924)
@@ -90,8 +90,7 @@
}
protected static void initApplicationContext() {
- // TODO DCossé 25/09/14 revoir cette partie
- new LimaServiceConfig(null);
+ LimaServiceConfig.getInstance();
}
/**
1
0
Author: dcosse
Date: 2014-09-26 11:10:52 +0200 (Fri, 26 Sep 2014)
New Revision: 3923
Url: http://forge.chorem.org/projects/lima/repository/revisions/3923
Log:
refs #1115 refactoring recommendation sonar
Added:
trunk/lima-swing/src/main/java/org/chorem/lima/LimaSwingConfig.java
Removed:
trunk/lima-swing/src/main/java/org/chorem/lima/LimaConfig.java
Modified:
trunk/lima-business/src/main/java/org/chorem/lima/business/LimaInterceptor.java
trunk/lima-business/src/main/java/org/chorem/lima/business/LimaServiceConfig.java
trunk/lima-swing/src/main/java/org/chorem/lima/LimaExceptionHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java
trunk/lima-swing/src/main/java/org/chorem/lima/LimaSwingApplicationContext.java
trunk/lima-swing/src/main/java/org/chorem/lima/actions/MiscAction.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellEditor.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellRenderer.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/DateTableCellEditor.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/DefaultLimaTableCellRenderer.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/StringTableCellEditor.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/common/AbstractColumn.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/common/AbstractLimaTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartTreeTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/util/ErrorHelper.java
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/LimaInterceptor.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/LimaInterceptor.java 2014-09-25 15:25:32 UTC (rev 3922)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/LimaInterceptor.java 2014-09-26 09:10:52 UTC (rev 3923)
@@ -26,13 +26,10 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.LimaXAResource;
-import org.chorem.lima.entity.AccountImpl;
import org.chorem.lima.entity.LimaCallaoTopiaApplicationContext;
import org.chorem.lima.entity.LimaCallaoTopiaDaoSupplier;
import org.chorem.lima.entity.LimaCallaoTopiaPersistenceContext;
import org.nuiton.topia.persistence.TopiaApplicationContextCache;
-import org.nuiton.topia.persistence.TopiaException;
-import org.nuiton.topia.persistence.util.TopiaUtil;
import javax.annotation.Resource;
import javax.ejb.Stateless;
@@ -91,9 +88,6 @@
LimaCallaoTopiaPersistenceContext tx = rootContext.newPersistenceContext();
- // TODO DCossé 24/07/14 remove it as soon as migration service is done.
- //createShemaIfNeeded(rootContext, tx);
-
DAO_HELPER.set(tx);
Transaction tr = transactionManager.getTransaction();
@@ -118,24 +112,4 @@
return result;
}
- /**
- * Test if schema do not already exists and create it if not found.
- *
- * @param applicationContext transaction
- * @throws TopiaException
- */
- protected void createShemaIfNeeded(LimaCallaoTopiaApplicationContext applicationContext, LimaCallaoTopiaPersistenceContext tx) throws TopiaException {
- //LimaCallaoTopiaPersistenceContext
- if (!applicationContext.isSchemaEmpty()) {
- boolean exist = TopiaUtil.isSchemaExist(tx, AccountImpl.class.getName());
- if (!exist) {
-
- if (log.isInfoEnabled()) {
- log.info("Creating to schema in database");
- }
- applicationContext.createSchema();
- }
- }
- }
-
}
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/LimaServiceConfig.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/LimaServiceConfig.java 2014-09-25 15:25:32 UTC (rev 3922)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/LimaServiceConfig.java 2014-09-26 09:10:52 UTC (rev 3923)
@@ -55,8 +55,6 @@
protected static final Log log = LogFactory.getLog(LimaServiceConfig.class);
-// protected static volatile LimaServiceConfig instance;
-
protected static AccountingRules accountingRules;
protected static final String LIMA_DEFAULT_CONF_FILENAME = "lima.properties";
@@ -187,22 +185,6 @@
config.saveForUser();
}
-// /**
-// * Load configuration with custom file name.
-// */
-// protected void loadConfiguration() {
-// try {
-// config.parse();
-// } catch (ArgumentsParserException ex) {
-// if (log.isErrorEnabled()) {
-// log.error("Can't read configuration", ex);
-// }
-// }
-//
-// config.setOption(TopiaConfigurationConstants.CONFIG_PERSISTENCE_CLASSES,
-// LimaCallaoEntityEnum.getImplementationClassesAsString());
-// }
-
/**
* Lima option definition.
* <p/>
Deleted: trunk/lima-swing/src/main/java/org/chorem/lima/LimaConfig.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/LimaConfig.java 2014-09-25 15:25:32 UTC (rev 3922)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/LimaConfig.java 2014-09-26 09:10:52 UTC (rev 3923)
@@ -1,765 +0,0 @@
-/*
- * #%L
- * Lima Swing
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2008 - 2012 CodeLutin, Chatellier Eric
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-package org.chorem.lima;
-
-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.entity.LimaCallaoEntityEnum;
-import org.chorem.lima.service.LimaServiceFactory;
-import org.nuiton.config.ApplicationConfig;
-import org.nuiton.config.ArgumentsParserException;
-import org.nuiton.config.ConfigOptionDef;
-import org.nuiton.topia.persistence.TopiaConfigurationConstants;
-import org.nuiton.util.Version;
-import org.nuiton.util.VersionUtil;
-import org.nuiton.util.converter.ConverterUtil;
-
-import java.awt.*;
-import java.beans.PropertyChangeListener;
-import java.io.File;
-import java.io.IOException;
-import java.util.Locale;
-import java.util.Set;
-
-import static org.nuiton.i18n.I18n.t;
-import static org.nuiton.i18n.I18n.n;
-
-/**
- * La configuration de l'application.
- *
- * @author chemit
- * @version $Revision$
- * <p/>
- * Last update : $Date$
- * By : $Author$
- */
-public class LimaConfig extends ApplicationConfig {
-
- /** to use log facility, just put in your code: log.info(\"...\"); */
- static private Log log = LogFactory.getLog(LimaConfig.class);
-
- static public final Set<Character> NUMBER_SEPARATOR = ImmutableSet.of(' ', ',', '.', ';');
- static public final Set<Integer> NUMBER_DECIMALS = ImmutableSet.of(0, 1, 2, 3, 4, 5, 6);
-
- protected static LimaConfig instance;
-
- private static final String configFile = "lima-config.properties";
-
- protected OptionsService optionsService;
-
- /** La version du logiciel. */
- protected Version version;
-
- /**
- * Get the configuration file
- * @return name of the config. file
- * */
- /*public String getConfigFile() {
- return configFile;
- }*/
-
- /**
- * Get copyright text (include version).
- *
- * @return copyright text
- */
- public String getCopyrightText() {
- return "Version " + getVersion() + " Codelutin @ 2008-2012";
- }
-
- /**
- * Version as string.
- *
- * @return le nombre global ex: 3.2.0.0
- */
- public String getVersion() {
- return version.toString();
- }
-
- /**
- * Lima config constructor.
- * <p/>
- * Define all default options and action alias.
- */
- public LimaConfig() {
-
- // set defaut option (included configuration file name : important)
- loadDefaultOptions(Option.values());
-
- // set action alias
- for (Action a : Action.values()) {
- for (String alias : a.aliases) {
- addActionAlias(alias, a.action);
- }
- }
-
- // ajout des alias (can be set in option enum ?)
- addAlias("--disableui", "--launchui false");
-
- // initialisation des répertoires
- // TODO what is it for ?
- //FileUtil.setCurrentDirectory(getLimaUserDirectory());
- //getLimaUserDirectory().mkdirs();
-
- }
-
- public static LimaConfig getInstance() {
- if (instance == null) {
- instance = new LimaConfig();
- instance.loadConfiguration(configFile);
- }
-
- return instance;
- }
-
- protected void loadConfiguration(String configFileName) {
-
- instance.setConfigFileName(configFileName);
- try {
- instance.parse();
- } catch (ArgumentsParserException ex) {
- if (log.isErrorEnabled()) {
- log.error("Can't read configuration", ex);
- }
- }
- instance.setOption(TopiaConfigurationConstants.CONFIG_PERSISTENCE_CLASSES,
- LimaCallaoEntityEnum.getImplementationClassesAsString());
- }
-
- @Override
- public ApplicationConfig parse(String... args) throws ArgumentsParserException {
-
- // super parse, read config file etc...
- super.parse(args);
-
- // on ne peut pas connaitre la version avant la lecture du fichier
- // on supprime tout ce qui est apres - (-SNAPSHOT, -rc-1 ,...)
- String sVersion = VersionUtil.removeSnapshot(getOption("application.version"));
- version = VersionUtil.valueOf(sVersion);
-
- return this;
-
- }
-
- /**
- * Get application locale.
- *
- * @return configuration application locale
- */
- public Locale getLocale() {
- String local = getOption(Option.LOCALE.key);
- Locale result = ConverterUtil.convert(Locale.class, local);
- return result;
- }
-
- /**
- * Locale setter for command line parameters.
- *
- * @param locale new locale
- */
- public void setLocale(String locale) {
- setOption(Option.LOCALE.key, locale);
- }
-
- /**
- * Change locale (not command line version).
- * Save user file.
- *
- * @param newLocale new locale
- */
- public void setLocale(Locale newLocale) {
- setOption(Option.LOCALE.key, newLocale.toString());
- saveForUser();
- firePropertyChange("locale", null, newLocale);
- }
-
- /**
- * Get application decimal separator
- *
- * @return configuration application decimal separator
- */
- public char getDecimalSeparator() {
- char decimalSeparator = getOption(Option.DECIMAL_SEPARATOR.key).charAt(0);
- return decimalSeparator;
- }
-
- /**
- * Change decimal separator
- * Save user file.
- *
- * @param decimalSeparator new DecimalSeparator
- */
- public void setDecimalSeparator(String decimalSeparator) {
- setOption(Option.DECIMAL_SEPARATOR.key, decimalSeparator);
- saveForUser();
- firePropertyChange("decimalSeparator", null, decimalSeparator);
- }
-
- /**
- * Get application scale
- *
- * @return configuration application scale
- */
- public int getScale() {
- return getOptionAsInt(Option.SCALE.key);
- }
-
- /**
- * Change scale
- * Save user file.
- *
- * @param scale new Scale
- */
- public void setScale(String scale) {
- setOption(Option.SCALE.key, scale);
- saveForUser();
- firePropertyChange("scale", null, scale);
- if (log.isInfoEnabled()) {
- log.info("new scale" + scale);
- }
- optionsService.setScale(scale);
- }
-
- /**
- * Get application thousand separator
- *
- * @return configuration application thousand separator
- */
- public char getThousandSeparator() {
- return getOption(Option.THOUSAND_SEPARATOR.key).charAt(0);
- }
-
- /**
- * Change the thousand separator
- * Save user file.
- *
- * @param thousandSeparator new thousandSeparator
- */
- public void setThousandSeparator(String thousandSeparator) {
- setOption(Option.THOUSAND_SEPARATOR.key, thousandSeparator);
- saveForUser();
- firePropertyChange("thousandSeparator", null, thousandSeparator);
- }
-
- /**
- * currency configuration boolean
- *
- * @return {@code true} if the currency must be displayed
- */
- public boolean getCurrency() {
- return getOptionAsBoolean(Option.CURRENCY.key);
- }
-
- /**
- * Change the currency displaying
- *
- * @param currency the new currency to set in configuration
- */
- public void setCurrency(boolean currency) {
- setOption(Option.CURRENCY.key, Boolean.toString(currency));
- saveForUser();
- firePropertyChange("currency", null, currency);
- }
-
- /**
- * Launch ui configuration value.
- *
- * @return {@code true} if ui must be displayed
- */
- public boolean isLaunchui() {
- boolean launchUI = getOptionAsBoolean(Option.LAUNCH_UI.key);
- return launchUI;
- }
-
- /**
- * Launch ui setter for command line parameters.
- *
- * @param launchui new lauch ui value
- */
- public void setLaunchui(String launchui) {
- setOption(Option.LAUNCH_UI.key, launchui);
- }
-
- /**
- * Get support email address.
- *
- * @return support email
- */
- public String getSupportEmail() {
- return getOption(Option.SUPPORT_EMAIL.key);
- }
-
- /**
- * Return true if ejb mode is configured as remote.
- *
- * @return {@code true} if remote mode should be used
- */
- public boolean isEJBRemoteMode() {
- boolean result = getOptionAsBoolean(Option.OPENEJB_REMOTEMODE.key);
- return result;
- }
-
- public File getDataDirectory() {
- File result = getOptionAsFile(Option.DATA_DIR.key);
- return result;
- }
-
- public File getLimaStateFile() {
- File result = getOptionAsFile(Option.LIMA_STATE_FILE.key);
- return result;
- }
-
- public File getResourcesDirectory() {
- File result = getOptionAsFile(Option.RESOURCES_DIRECTORY.key);
- return result;
- }
-
- public File getI18nDirectory() {
- File result = getOptionAsFile(Option.I18N_DIRECTORY.key);
- return result;
- }
-
- public String getHostAdress() {
- return getOption(Option.LIMA_HOST_ADDRESS.key);
- }
-
- public void setColorSelectionFocus(String color) {
- setOption(Option.COLOR_SELECTION_FOCUS.key, color);
- }
-
- public Color getColorSelectionFocus() {
- return getOptionAsColor((Option.COLOR_SELECTION_FOCUS.key));
- }
-
- public void setSelectAllEditingCell(boolean selectAllEditingCell) {
- setOption(Option.SELECT_ALL_EDITING_CELL.key, Boolean.toString(selectAllEditingCell));
- }
-
- public boolean isSelectAllEditingCell() {
- return getOptionAsBoolean((Option.SELECT_ALL_EDITING_CELL.key));
- }
-
- /** Used in ???? */
- public static final String[] DEFAULT_JAXX_PCS = {"fullScreen", "locale", "decimalSeparator", "scale", "thousandSeparator", "currency"};
-
- /** Used in ???? */
- public void removeJaxxPropertyChangeListener() {
- PropertyChangeListener[] toRemove = JAXXUtil.findJaxxPropertyChangeListener(DEFAULT_JAXX_PCS, getPropertyChangeListeners());
- if (toRemove == null || toRemove.length == 0) {
- return;
- }
- if (log.isDebugEnabled()) {
- log.debug("before remove : " + getPropertyChangeListeners().length);
- log.debug("toRemove : " + toRemove.length);
-
- }
- for (PropertyChangeListener listener : toRemove) {
- removePropertyChangeListener(listener);
- }
- if (log.isDebugEnabled()) {
- log.debug("after remove : " + getPropertyChangeListeners().length);
- }
- }
-
- /**
- * Lima option definition.
- * <p/>
- * Contains all lima configuration key, with defaut value and
- * information for jaxx configuration frame ({@link #type},
- * {@link #_transient}, {@link #_final}...)
- */
- public enum Option implements ConfigOptionDef {
-
-
- CONFIG_FILE(CONFIG_FILE_NAME,
- t("lima.config.configFileName.label"),
- n("lima.config.configFileName.description"),
- "lima-config.properties",
- String.class, true, true),
-
- DATA_DIR("lima.data.dir",
- t("lima.config.data.dir.label"),
- n("lima.config.data.dir.description"),
- "${user.home}/.lima",
- File.class, false, false),
-
- RESOURCES_DIRECTORY("lima.resources.dir",
- t("lima.config.resources.dir.label"),
- n("lima.config.resources.dir.description"),
- "${lima.data.dir}/resources-${application.version}",
- String.class, false, false),
-
- I18N_DIRECTORY("lima.i18n.dir",
- t("lima.config.i18n.dir.label"),
- n("lima.config.i18n.dir.description"),
- "${lima.resources.dir}/i18n",
- String.class, false, false),
-
- LOCALE("lima.ui.locale",
- t("lima.config.locale.label"),
- n("lima.config.locale.description"),
- "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("limma.config.thousandseparator.label"),
- n("limma.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.flaunchui.label"),
- n("lima.config.ui.flaunchui.description"),
- "true", Boolean.class, true, true),
-
- SUPPORT_EMAIL("lima.misc.supportemail",
- t("lima.misc.supportemail.label"),
- n("lima.misc.supportemail.description"),
- "support(a)codelutin.com",
- String.class, false, false),
-
- OPENEJB_REMOTEMODE("lima.openejb.remotemode",
- t("lima.openejb.remotemode.label"),
- n("lima.openejb.remotemode.description"),
- "false",
- String.class, false, false),
-
- LIMA_HOST_ADDRESS("lima.host.address",
- t("lima.config.host.adress.label"),
- n("lima.config.host.adress.description"),
- "localhost",
- String.class, false, false),
-
- LIMA_STATE_FILE("lima.ui.state.file",
- t("lima.config.state.file.label"),
- n("lima.config.state.file.description"),
- "${lima.data.dir}/limaState.xml",
- String.class, false, false),
-
- COLOR_SELECTION_FOCUS("lima.ui.table.cell.colorSelectionFocus",
- t("lima.config.colorselectionfocus.label"),
- n("lima.config.colorselectionfocus.description"),
- "#000000",
- Color.class, false, false),
-
- SELECT_ALL_EDITING_CELL("lima.ui.table.cell.selectAllEditingCell",
- t("lima.config.selectAllEditingCell.label"),
- n("lima.config.selectAllEditingCell.description"),
- "true",
- Boolean.class, false, false),
-
- TABLE_CELL_BACKGROUND("lima.ui.table.cell.background",
- t("lima.config.cell.background.label"),
- n("lima.config.cell.background.description"),
- "#FFFFFF",
- Color.class, false, false),
-
- TABLE_CELL_FOREGROUND("lima.ui.table.cell.foreground",
- t("lima.config.cell.foreground.label"),
- n("lima.config.cell.foreground.description"),
- "#000000",
- Color.class, false, false),
-
- TABLE_CELL_PAIR_BACKGROUND("lima.ui.table.cell.pair.background",
- t("lima.config.cell.pair.background.label"),
- n("lima.config.cell.pair.background.description"),
- "#EEEEEE",
- Color.class, false, false),
-
- TABLE_CELL_PAIR_FOREGROUND("lima.ui.table.cell.pair.foreground",
- t("lima.config.cell.pair.foreground.label"),
- n("lima.config.cell.pair.foreground.description"),
- "#000000",
- Color.class, false, false),
-
- TABLE_CELL_SELECTED_BACKGROUND("lima.ui.table.cell.selected.background",
- t("lima.config.cell.selected.background.label"),
- n("lima.config.cell.selected.background.description"),
- "#0066CC",
- Color.class, false, false),
-
- TABLE_CELL_SELECTED_FOREGROUND("lima.ui.table.cell.selected.foreground",
- t("lima.config.cell.selected.foreground.label"),
- n("lima.config.cell.selected.foreground.description"),
- "#FFFFFF",
- Color.class, false, false),
-
- TABLE_CELL_PAIR_SELECTED_BACKGROUND("lima.ui.table.cell.pair.selected.background",
- t("lima.config.cell.pair.selected.background.label"),
- n("lima.config.cell.pair.selected.background.description"),
- "#006699",
- Color.class, false, false),
-
- TABLE_CELL_PAIR_SELECTED_FOREGROUND("lima.ui.table.cell.pair.selected.foreground",
- t("lima.config.cell.pair.selected.foreground.label"),
- n("lima.config.cell.pair.selected.foreground.description"),
- "#FFFFFF",
- Color.class, false, false),
-
- TABLE_CELL_ERROR_BACKGROUND("lima.ui.table.cell.error.background",
- t("lima.config.cell.error.background.label"),
- n("lima.config.cell.error.background.description"),
- "#FFFFFF",
- Color.class, false, false),
-
- TABLE_CELL_ERROR_FOREGROUND("lima.ui.table.cell.error.foreground",
- t("lima.config.cell.error.foreground.label"),
- n("lima.config.cell.error.foreground.description"),
- "#FF0936",
- Color.class, false, false),
-
- TABLE_CELL_PAIR_ERROR_BACKGROUND("lima.ui.table.cell.pair.error.background",
- t("lima.config.cell.pair.error.background.label"),
- n("lima.config.cell.pair.error.background.description"),
- "#EEEEEE",
- Color.class, false, false),
-
- TABLE_CELL_PAIR_ERROR_FOREGROUND("lima.ui.table.cell.pair.error.foreground",
- t("lima.config.cell.pair.error.foreground.label"),
- n("lima.config.cell.pair.error.foreground.description"),
- "#FC0625",
- Color.class, false, false),
-
- TABLE_CELL_SELECTED_ERROR_BACKGROUND("lima.ui.table.cell.selected.error.background",
- t("lima.config.cell.selected.error.background.label"),
- n("lima.config.cell.selected.error.background.description"),
- "#0066CC",
- Color.class, false, false),
-
- TABLE_CELL_SELECTED_ERROR_FOREGROUND("lima.ui.table.cell.selected.error.foreground",
- t("lima.config.cell.selected.error.foreground.label"),
- n("lima.config.cell.selected.error.foreground.description"),
- "#C998C1",
- Color.class, false, false),
-
- TABLE_CELL_PAIR_SELECTED_ERROR_BACKGROUND("lima.ui.table.cell.pair.selected.error.background",
- t("lima.config.cell.pair.selected.error.background.label"),
- n("lima.config.cell.pair.selected.error.background.description"),
- "#006699",
- Color.class, false, false),
-
- TABLE_CELL_PAIR_SELECTED_ERROR_FOREGROUND("lima.ui.table.cell.pair.selected.error.foreground",
- t("lima.config.cell.pair.selected.error.foreground.label"),
- n("lima.config.cell.pair.selected.error.foreground.description"),
- "#C96678",
- Color.class, false, false),
-
- TABLE_CELL_MANDATORY_BACKGROUND("lima.ui.table.cell.mandatory.background",
- t("lima.config.cell.mandatory.background.label"),
- n("lima.config.cell.mandatory.background.description"),
- "#FFCCCC",
- Color.class, false, false),
-
- TABLE_CELL_MANDATORY_FOREGROUND("lima.ui.table.cell.mandatory.foreground",
- t("lima.config.cell.mandatory.foreground.label"),
- n("lima.config.cell.mandatory.foreground.description"),
- "#000000",
- Color.class, false, false),
-
- TABLE_CELL_PAIR_MANDATORY_BACKGROUND("lima.ui.table.cell.pair.mandatory.background",
- t("lima.config.cell.pair.mandatory.background.label"),
- n("lima.config.cell.pair.mandatory.background.description"),
- "#FF99CC",
- Color.class, false, false),
-
- TABLE_CELL_PAIR_MANDATORY_FOREGROUND("lima.ui.table.cell.pair.mandatory.foreground",
- t("lima.config.cell.pair.mandatory.foreground.label"),
- n("lima.config.cell.pair.mandatory.foreground.description"),
- "#000000",
- Color.class, false, false),
-
- TABLE_CELL_SELECTED_MANDATORY_BACKGROUND("lima.ui.table.cell.selected.mandatory.background",
- t("lima.config.cell.selected.mandatory.background.label"),
- n("lima.config.cell.selected.mandatory.background.description"),
- "#FF0000",
- Color.class, false, false),
-
- TABLE_CELL_SELECTED_MANDATORY_FOREGROUND("lima.ui.table.cell.selected.mandatory.foreground",
- t("lima.config.cell.selected.mandatory.foreground.label"),
- n("lima.config.cell.selected.mandatory.foreground.description"),
- "#FFFFFF",
- Color.class, false, false),
-
- TABLE_CELL_PAIR_SELECTED_MANDATORY_BACKGROUND("lima.ui.table.cell.pair.selected.mandatory.background",
- t("lima.config.cell.pair.selected.mandatory.background.label"),
- n("lima.config.cell.pair.selected.mandatory.background.description"),
- "#990000",
- Color.class, false, false),
-
- TABLE_CELL_PAIR_SELECTED_MANDATORY_FOREGROUND("lima.ui.table.cell.pair.selected.mandatory.foreground",
- t("lima.config.cell.pair.selected.mandatory.foreground.label"),
- n("lima.config.cell.pair.selected.mandatory.foreground.description"),
- "#000000",
- Color.class, false, false);
-
- public enum ComportmentEditingCellEnum {ALL, NOTHING}
-
- public final String key;
-
- public final String label;
-
- public final String description;
-
- public String defaultValue;
-
- public final Class<?> type;
-
- public boolean _transient;
-
- public boolean _final;
-
- Option(String key, String label, String description, String defaultValue,
- Class<?> type, boolean _transient, boolean _final) {
- this.key = key;
- this.label = label;
- this.description = description;
- this.defaultValue = defaultValue;
- this.type = type;
- this._final = _final;
- this._transient = _transient;
- }
-
- @Override
- public boolean isFinal() {
- return _final;
- }
-
- @Override
- public void setFinal(boolean _final) {
- this._final = _final;
- }
-
- @Override
- public boolean isTransient() {
- return _transient;
- }
-
- @Override
- public void setTransient(boolean _transient) {
- this._transient = _transient;
- }
-
- @Override
- public String getDefaultValue() {
- return defaultValue;
- }
-
- @Override
- public void setDefaultValue(String defaultValue) {
- this.defaultValue = defaultValue;
- }
-
- public String getLabel () {
- return label;
- }
-
- @Override
- public String getDescription() {
- return t(description);
- }
-
- @Override
- public String getKey() {
- return key;
- }
-
- @Override
- public Class<?> getType() {
- return type;
- }
- }
-
- /** Lima action definition. */
- public enum Action {
-
- HELP(n("lima.action.commandline.help"), MiscAction.class.getName() + "#help", "-h", "--help");
-
- /** Before init action step. */
- public static final int BEFORE_EXIT_STEP = 0;
-
- /** After init action step. */
- public static final int AFTER_INIT_STEP = 1;
-
- public String description;
-
- public String action;
-
- public String[] aliases;
-
- Action(String description, String action, String... aliases) {
- this.description = description;
- this.action = action;
- this.aliases = aliases;
- }
-
- public String getDescription() {
- return t(description);
- }
- }
-
- /**
- * Override save action to propagate some option to server.
- */
- @Override
- public void save(File file,
- boolean forceAll,
- String... excludeKeys) throws IOException {
-
- super.save(file, forceAll, excludeKeys);
-
- // propagate scale option to serveur option
- optionsService = LimaServiceFactory.getService(OptionsService.class);
-
- // scale server option
- String scaleOption = getOption("scale");
- if (StringUtils.isNotBlank(scaleOption)) {
- optionsService.setScale(scaleOption);
- }
- }
-}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/LimaExceptionHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/LimaExceptionHandler.java 2014-09-25 15:25:32 UTC (rev 3922)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/LimaExceptionHandler.java 2014-09-26 09:10:52 UTC (rev 3923)
@@ -59,7 +59,7 @@
log.error("Global application exception", ex);
}
- ErrorHelper errorHelper = new ErrorHelper(LimaConfig.getInstance());
+ ErrorHelper errorHelper = new ErrorHelper(LimaSwingConfig.getInstance());
errorHelper.showErrorDialog(null, ex.getMessage(), ex);
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java 2014-09-25 15:25:32 UTC (rev 3922)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java 2014-09-26 09:10:52 UTC (rev 3923)
@@ -53,7 +53,7 @@
private static final Log log = LogFactory.getLog(LimaMain.class);
/** Lima configuration. */
- public static LimaConfig config;
+ public static LimaSwingConfig config;
/** splash */
private static LimaSplash splash;
@@ -76,7 +76,7 @@
// do actions
config = context.getConfig();
- config.doAction(LimaConfig.Action.AFTER_INIT_STEP);
+ config.doAction(LimaSwingConfig.Action.AFTER_INIT_STEP);
// display main ui
if (config.isLaunchui()) {
@@ -112,7 +112,7 @@
// init root context
LimaSwingApplicationContext context = LimaSwingApplicationContext.init();
- LimaConfig config = context.getConfig();
+ LimaSwingConfig config = context.getConfig();
config.parse(args);
context.initI18n(config);
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/LimaSwingApplicationContext.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/LimaSwingApplicationContext.java 2014-09-25 15:25:32 UTC (rev 3922)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/LimaSwingApplicationContext.java 2014-09-26 09:10:52 UTC (rev 3923)
@@ -58,7 +58,7 @@
public static JAXXContextEntryDef<DecoratorProvider> DECORATOR_PROVIDER_DEF = JAXXUtil.newContextEntryDef("decoratorProvider", DecoratorProvider.class);
- public static JAXXContextEntryDef<LimaConfig> CONFIG_DEF = JAXXUtil.newContextEntryDef("limaConfig", LimaConfig.class);
+ public static JAXXContextEntryDef<LimaSwingConfig> CONFIG_DEF = JAXXUtil.newContextEntryDef("limaConfig", LimaSwingConfig.class);
/**
* @return <code>true</code> si le context a été initialisé via la méthode
@@ -83,7 +83,7 @@
}
instance = new LimaSwingApplicationContext();
instance.setContextValue(new MainViewHandler());
- CONFIG_DEF.setContextValue(instance, LimaConfig.getInstance());
+ CONFIG_DEF.setContextValue(instance, LimaSwingConfig.getInstance());
DECORATOR_PROVIDER_DEF.setContextValue(instance, new LimaDecoratorProvider());
initApplicationContext();
return instance;
@@ -108,7 +108,7 @@
return instance;
}
- public LimaConfig getConfig() {
+ public LimaSwingConfig getConfig() {
return CONFIG_DEF.getContextValue(this);
}
@@ -116,7 +116,7 @@
return DECORATOR_PROVIDER_DEF.getContextValue(this);
}
- public void initI18n(LimaConfig config) {
+ public void initI18n(LimaSwingConfig config) {
I18n.close();
Copied: trunk/lima-swing/src/main/java/org/chorem/lima/LimaSwingConfig.java (from rev 3921, trunk/lima-swing/src/main/java/org/chorem/lima/LimaConfig.java)
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/LimaSwingConfig.java (rev 0)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/LimaSwingConfig.java 2014-09-26 09:10:52 UTC (rev 3923)
@@ -0,0 +1,750 @@
+/*
+ * #%L
+ * Lima Swing
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2008 - 2012 CodeLutin, Chatellier Eric
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+package org.chorem.lima;
+
+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.entity.LimaCallaoEntityEnum;
+import org.chorem.lima.service.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;
+import org.nuiton.util.version.VersionBuilder;
+
+import java.awt.*;
+import java.beans.PropertyChangeListener;
+import java.io.File;
+import java.io.IOException;
+import java.util.Locale;
+import java.util.Set;
+
+import static org.nuiton.i18n.I18n.n;
+import static org.nuiton.i18n.I18n.t;
+
+/**
+ * La configuration de l'application.
+ *
+ * @author chemit
+ * @version $Revision$
+ * <p/>
+ * Last update : $Date$
+ * By : $Author$
+ */
+public class LimaSwingConfig extends ApplicationConfig {
+
+ /** to use log facility, just put in your code: log.info(\"...\"); */
+ private static Log log = LogFactory.getLog(LimaSwingConfig.class);
+
+ public static final Set<Character> NUMBER_SEPARATOR = ImmutableSet.of(' ', ',', '.', ';');
+ public static final Set<Integer> NUMBER_DECIMALS = ImmutableSet.of(0, 1, 2, 3, 4, 5, 6);
+
+ protected static LimaSwingConfig instance;
+
+ private static final String configFile = "lima-config.properties";
+
+ protected OptionsService optionsService;
+
+ /** La version du logiciel. */
+ protected Version version;
+
+ /**
+ * Get copyright text (include version).
+ *
+ * @return copyright text
+ */
+ public String getCopyrightText() {
+ return "Version " + getVersion() + " Codelutin @ 2008-2012";
+ }
+
+ /**
+ * Version as string.
+ *
+ * @return le nombre global ex: 3.2.0.0
+ */
+ public String getVersion() {
+ return version.toString();
+ }
+
+ /**
+ * Lima config constructor.
+ * <p/>
+ * Define all default options and action alias.
+ */
+ public LimaSwingConfig() {
+
+ // set defaut option (included configuration file name : important)
+ loadDefaultOptions(Option.values());
+
+ // set action alias
+ for (Action a : Action.values()) {
+ for (String alias : a.aliases) {
+ addActionAlias(alias, a.action);
+ }
+ }
+
+ // ajout des alias (can be set in option enum ?)
+ addAlias("--disableui", "--launchui false");
+ }
+
+ public static LimaSwingConfig getInstance() {
+ if (instance == null) {
+ instance = new LimaSwingConfig();
+ instance.loadConfiguration(configFile);
+ }
+
+ return instance;
+ }
+
+ protected void loadConfiguration(String configFileName) {
+
+ instance.setConfigFileName(configFileName);
+ try {
+ instance.parse();
+ } catch (ArgumentsParserException ex) {
+ if (log.isErrorEnabled()) {
+ log.error("Can't read configuration", ex);
+ }
+ }
+ instance.setOption(TopiaConfigurationConstants.CONFIG_PERSISTENCE_CLASSES,
+ LimaCallaoEntityEnum.getImplementationClassesAsString());
+ }
+
+ @Override
+ public ApplicationConfig parse(String... args) throws ArgumentsParserException {
+
+ // super parse, read config file etc...
+ super.parse(args);
+
+ // on ne peut pas connaitre la version avant la lecture du fichier
+ VersionBuilder nb = new VersionBuilder();
+ nb.setVersion(getOption("application.version"));
+ version = nb.build();
+ return this;
+
+ }
+
+ /**
+ * Get application locale.
+ *
+ * @return configuration application locale
+ */
+ public Locale getLocale() {
+ String local = getOption(Option.LOCALE.key);
+ Locale result = ConverterUtil.convert(Locale.class, local);
+ return result;
+ }
+
+ /**
+ * Locale setter for command line parameters.
+ *
+ * @param locale new locale
+ */
+ public void setLocale(String locale) {
+ setOption(Option.LOCALE.key, locale);
+ }
+
+ /**
+ * Change locale (not command line version).
+ * Save user file.
+ *
+ * @param newLocale new locale
+ */
+ public void setLocale(Locale newLocale) {
+ setOption(Option.LOCALE.key, newLocale.toString());
+ saveForUser();
+ firePropertyChange("locale", null, newLocale);
+ }
+
+ /**
+ * Get application decimal separator
+ *
+ * @return configuration application decimal separator
+ */
+ public char getDecimalSeparator() {
+ char decimalSeparator = getOption(Option.DECIMAL_SEPARATOR.key).charAt(0);
+ return decimalSeparator;
+ }
+
+ /**
+ * Change decimal separator
+ * Save user file.
+ *
+ * @param decimalSeparator new DecimalSeparator
+ */
+ public void setDecimalSeparator(String decimalSeparator) {
+ setOption(Option.DECIMAL_SEPARATOR.key, decimalSeparator);
+ saveForUser();
+ firePropertyChange("decimalSeparator", null, decimalSeparator);
+ }
+
+ /**
+ * Get application scale
+ *
+ * @return configuration application scale
+ */
+ public int getScale() {
+ return getOptionAsInt(Option.SCALE.key);
+ }
+
+ /**
+ * Change scale
+ * Save user file.
+ *
+ * @param scale new Scale
+ */
+ public void setScale(String scale) {
+ setOption(Option.SCALE.key, scale);
+ saveForUser();
+ firePropertyChange("scale", null, scale);
+ if (log.isInfoEnabled()) {
+ log.info("new scale" + scale);
+ }
+ optionsService.setScale(scale);
+ }
+
+ /**
+ * Get application thousand separator
+ *
+ * @return configuration application thousand separator
+ */
+ public char getThousandSeparator() {
+ return getOption(Option.THOUSAND_SEPARATOR.key).charAt(0);
+ }
+
+ /**
+ * Change the thousand separator
+ * Save user file.
+ *
+ * @param thousandSeparator new thousandSeparator
+ */
+ public void setThousandSeparator(String thousandSeparator) {
+ setOption(Option.THOUSAND_SEPARATOR.key, thousandSeparator);
+ saveForUser();
+ firePropertyChange("thousandSeparator", null, thousandSeparator);
+ }
+
+ /**
+ * currency configuration boolean
+ *
+ * @return {@code true} if the currency must be displayed
+ */
+ public boolean getCurrency() {
+ return getOptionAsBoolean(Option.CURRENCY.key);
+ }
+
+ /**
+ * Change the currency displaying
+ *
+ * @param currency the new currency to set in configuration
+ */
+ public void setCurrency(boolean currency) {
+ setOption(Option.CURRENCY.key, Boolean.toString(currency));
+ saveForUser();
+ firePropertyChange("currency", null, currency);
+ }
+
+ /**
+ * Launch ui configuration value.
+ *
+ * @return {@code true} if ui must be displayed
+ */
+ public boolean isLaunchui() {
+ boolean launchUI = getOptionAsBoolean(Option.LAUNCH_UI.key);
+ return launchUI;
+ }
+
+ /**
+ * Launch ui setter for command line parameters.
+ *
+ * @param launchui new lauch ui value
+ */
+ public void setLaunchui(String launchui) {
+ setOption(Option.LAUNCH_UI.key, launchui);
+ }
+
+ /**
+ * Get support email address.
+ *
+ * @return support email
+ */
+ public String getSupportEmail() {
+ return getOption(Option.SUPPORT_EMAIL.key);
+ }
+
+ /**
+ * Return true if ejb mode is configured as remote.
+ *
+ * @return {@code true} if remote mode should be used
+ */
+ public boolean isEJBRemoteMode() {
+ boolean result = getOptionAsBoolean(Option.OPENEJB_REMOTEMODE.key);
+ return result;
+ }
+
+ public File getDataDirectory() {
+ File result = getOptionAsFile(Option.DATA_DIR.key);
+ return result;
+ }
+
+ public File getLimaStateFile() {
+ File result = getOptionAsFile(Option.LIMA_STATE_FILE.key);
+ return result;
+ }
+
+ public File getResourcesDirectory() {
+ File result = getOptionAsFile(Option.RESOURCES_DIRECTORY.key);
+ return result;
+ }
+
+ public File getI18nDirectory() {
+ File result = getOptionAsFile(Option.I18N_DIRECTORY.key);
+ return result;
+ }
+
+ public String getHostAdress() {
+ return getOption(Option.LIMA_HOST_ADDRESS.key);
+ }
+
+ public void setColorSelectionFocus(String color) {
+ setOption(Option.COLOR_SELECTION_FOCUS.key, color);
+ }
+
+ public Color getColorSelectionFocus() {
+ return getOptionAsColor((Option.COLOR_SELECTION_FOCUS.key));
+ }
+
+ public void setSelectAllEditingCell(boolean selectAllEditingCell) {
+ setOption(Option.SELECT_ALL_EDITING_CELL.key, Boolean.toString(selectAllEditingCell));
+ }
+
+ public boolean isSelectAllEditingCell() {
+ return getOptionAsBoolean((Option.SELECT_ALL_EDITING_CELL.key));
+ }
+
+ /** Used in ???? */
+ protected static final String[] DEFAULT_JAXX_PCS = {"fullScreen", "locale", "decimalSeparator", "scale", "thousandSeparator", "currency"};
+
+ /** Used in ???? */
+ public void removeJaxxPropertyChangeListener() {
+ PropertyChangeListener[] toRemove = JAXXUtil.findJaxxPropertyChangeListener(DEFAULT_JAXX_PCS, getPropertyChangeListeners());
+ if (toRemove == null || toRemove.length == 0) {
+ return;
+ }
+ if (log.isDebugEnabled()) {
+ log.debug("before remove : " + getPropertyChangeListeners().length);
+ log.debug("toRemove : " + toRemove.length);
+
+ }
+ for (PropertyChangeListener listener : toRemove) {
+ removePropertyChangeListener(listener);
+ }
+ if (log.isDebugEnabled()) {
+ log.debug("after remove : " + getPropertyChangeListeners().length);
+ }
+ }
+
+ /**
+ * Lima option definition.
+ * <p/>
+ * Contains all lima configuration key, with defaut value and
+ * information for jaxx configuration frame ({@link #type},
+ * {@link #_transient}, {@link #_final}...)
+ */
+ public enum Option implements ConfigOptionDef {
+
+
+ CONFIG_FILE(CONFIG_FILE_NAME,
+ t("lima.config.configFileName.label"),
+ n("lima.config.configFileName.description"),
+ "lima-config.properties",
+ String.class, true, true),
+
+ DATA_DIR("lima.data.dir",
+ t("lima.config.data.dir.label"),
+ n("lima.config.data.dir.description"),
+ "${user.home}/.lima",
+ File.class, false, false),
+
+ RESOURCES_DIRECTORY("lima.resources.dir",
+ t("lima.config.resources.dir.label"),
+ n("lima.config.resources.dir.description"),
+ "${lima.data.dir}/resources-${application.version}",
+ String.class, false, false),
+
+ I18N_DIRECTORY("lima.i18n.dir",
+ t("lima.config.i18n.dir.label"),
+ n("lima.config.i18n.dir.description"),
+ "${lima.resources.dir}/i18n",
+ String.class, false, false),
+
+ LOCALE("lima.ui.locale",
+ t("lima.config.locale.label"),
+ n("lima.config.locale.description"),
+ "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("limma.config.thousandseparator.label"),
+ n("limma.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.flaunchui.label"),
+ n("lima.config.ui.flaunchui.description"),
+ "true", Boolean.class, true, true),
+
+ SUPPORT_EMAIL("lima.misc.supportemail",
+ t("lima.misc.supportemail.label"),
+ n("lima.misc.supportemail.description"),
+ "support(a)codelutin.com",
+ String.class, false, false),
+
+ OPENEJB_REMOTEMODE("lima.openejb.remotemode",
+ t("lima.openejb.remotemode.label"),
+ n("lima.openejb.remotemode.description"),
+ "false",
+ String.class, false, false),
+
+ LIMA_HOST_ADDRESS("lima.host.address",
+ t("lima.config.host.adress.label"),
+ n("lima.config.host.adress.description"),
+ "localhost",
+ String.class, false, false),
+
+ LIMA_STATE_FILE("lima.ui.state.file",
+ t("lima.config.state.file.label"),
+ n("lima.config.state.file.description"),
+ "${lima.data.dir}/limaState.xml",
+ String.class, false, false),
+
+ COLOR_SELECTION_FOCUS("lima.ui.table.cell.colorSelectionFocus",
+ t("lima.config.colorselectionfocus.label"),
+ n("lima.config.colorselectionfocus.description"),
+ "#000000",
+ Color.class, false, false),
+
+ SELECT_ALL_EDITING_CELL("lima.ui.table.cell.selectAllEditingCell",
+ t("lima.config.selectAllEditingCell.label"),
+ n("lima.config.selectAllEditingCell.description"),
+ "true",
+ Boolean.class, false, false),
+
+ TABLE_CELL_BACKGROUND("lima.ui.table.cell.background",
+ t("lima.config.cell.background.label"),
+ n("lima.config.cell.background.description"),
+ "#FFFFFF",
+ Color.class, false, false),
+
+ TABLE_CELL_FOREGROUND("lima.ui.table.cell.foreground",
+ t("lima.config.cell.foreground.label"),
+ n("lima.config.cell.foreground.description"),
+ "#000000",
+ Color.class, false, false),
+
+ TABLE_CELL_PAIR_BACKGROUND("lima.ui.table.cell.pair.background",
+ t("lima.config.cell.pair.background.label"),
+ n("lima.config.cell.pair.background.description"),
+ "#EEEEEE",
+ Color.class, false, false),
+
+ TABLE_CELL_PAIR_FOREGROUND("lima.ui.table.cell.pair.foreground",
+ t("lima.config.cell.pair.foreground.label"),
+ n("lima.config.cell.pair.foreground.description"),
+ "#000000",
+ Color.class, false, false),
+
+ TABLE_CELL_SELECTED_BACKGROUND("lima.ui.table.cell.selected.background",
+ t("lima.config.cell.selected.background.label"),
+ n("lima.config.cell.selected.background.description"),
+ "#0066CC",
+ Color.class, false, false),
+
+ TABLE_CELL_SELECTED_FOREGROUND("lima.ui.table.cell.selected.foreground",
+ t("lima.config.cell.selected.foreground.label"),
+ n("lima.config.cell.selected.foreground.description"),
+ "#FFFFFF",
+ Color.class, false, false),
+
+ TABLE_CELL_PAIR_SELECTED_BACKGROUND("lima.ui.table.cell.pair.selected.background",
+ t("lima.config.cell.pair.selected.background.label"),
+ n("lima.config.cell.pair.selected.background.description"),
+ "#006699",
+ Color.class, false, false),
+
+ TABLE_CELL_PAIR_SELECTED_FOREGROUND("lima.ui.table.cell.pair.selected.foreground",
+ t("lima.config.cell.pair.selected.foreground.label"),
+ n("lima.config.cell.pair.selected.foreground.description"),
+ "#FFFFFF",
+ Color.class, false, false),
+
+ TABLE_CELL_ERROR_BACKGROUND("lima.ui.table.cell.error.background",
+ t("lima.config.cell.error.background.label"),
+ n("lima.config.cell.error.background.description"),
+ "#FFFFFF",
+ Color.class, false, false),
+
+ TABLE_CELL_ERROR_FOREGROUND("lima.ui.table.cell.error.foreground",
+ t("lima.config.cell.error.foreground.label"),
+ n("lima.config.cell.error.foreground.description"),
+ "#FF0936",
+ Color.class, false, false),
+
+ TABLE_CELL_PAIR_ERROR_BACKGROUND("lima.ui.table.cell.pair.error.background",
+ t("lima.config.cell.pair.error.background.label"),
+ n("lima.config.cell.pair.error.background.description"),
+ "#EEEEEE",
+ Color.class, false, false),
+
+ TABLE_CELL_PAIR_ERROR_FOREGROUND("lima.ui.table.cell.pair.error.foreground",
+ t("lima.config.cell.pair.error.foreground.label"),
+ n("lima.config.cell.pair.error.foreground.description"),
+ "#FC0625",
+ Color.class, false, false),
+
+ TABLE_CELL_SELECTED_ERROR_BACKGROUND("lima.ui.table.cell.selected.error.background",
+ t("lima.config.cell.selected.error.background.label"),
+ n("lima.config.cell.selected.error.background.description"),
+ "#0066CC",
+ Color.class, false, false),
+
+ TABLE_CELL_SELECTED_ERROR_FOREGROUND("lima.ui.table.cell.selected.error.foreground",
+ t("lima.config.cell.selected.error.foreground.label"),
+ n("lima.config.cell.selected.error.foreground.description"),
+ "#C998C1",
+ Color.class, false, false),
+
+ TABLE_CELL_PAIR_SELECTED_ERROR_BACKGROUND("lima.ui.table.cell.pair.selected.error.background",
+ t("lima.config.cell.pair.selected.error.background.label"),
+ n("lima.config.cell.pair.selected.error.background.description"),
+ "#006699",
+ Color.class, false, false),
+
+ TABLE_CELL_PAIR_SELECTED_ERROR_FOREGROUND("lima.ui.table.cell.pair.selected.error.foreground",
+ t("lima.config.cell.pair.selected.error.foreground.label"),
+ n("lima.config.cell.pair.selected.error.foreground.description"),
+ "#C96678",
+ Color.class, false, false),
+
+ TABLE_CELL_MANDATORY_BACKGROUND("lima.ui.table.cell.mandatory.background",
+ t("lima.config.cell.mandatory.background.label"),
+ n("lima.config.cell.mandatory.background.description"),
+ "#FFCCCC",
+ Color.class, false, false),
+
+ TABLE_CELL_MANDATORY_FOREGROUND("lima.ui.table.cell.mandatory.foreground",
+ t("lima.config.cell.mandatory.foreground.label"),
+ n("lima.config.cell.mandatory.foreground.description"),
+ "#000000",
+ Color.class, false, false),
+
+ TABLE_CELL_PAIR_MANDATORY_BACKGROUND("lima.ui.table.cell.pair.mandatory.background",
+ t("lima.config.cell.pair.mandatory.background.label"),
+ n("lima.config.cell.pair.mandatory.background.description"),
+ "#FF99CC",
+ Color.class, false, false),
+
+ TABLE_CELL_PAIR_MANDATORY_FOREGROUND("lima.ui.table.cell.pair.mandatory.foreground",
+ t("lima.config.cell.pair.mandatory.foreground.label"),
+ n("lima.config.cell.pair.mandatory.foreground.description"),
+ "#000000",
+ Color.class, false, false),
+
+ TABLE_CELL_SELECTED_MANDATORY_BACKGROUND("lima.ui.table.cell.selected.mandatory.background",
+ t("lima.config.cell.selected.mandatory.background.label"),
+ n("lima.config.cell.selected.mandatory.background.description"),
+ "#FF0000",
+ Color.class, false, false),
+
+ TABLE_CELL_SELECTED_MANDATORY_FOREGROUND("lima.ui.table.cell.selected.mandatory.foreground",
+ t("lima.config.cell.selected.mandatory.foreground.label"),
+ n("lima.config.cell.selected.mandatory.foreground.description"),
+ "#FFFFFF",
+ Color.class, false, false),
+
+ TABLE_CELL_PAIR_SELECTED_MANDATORY_BACKGROUND("lima.ui.table.cell.pair.selected.mandatory.background",
+ t("lima.config.cell.pair.selected.mandatory.background.label"),
+ n("lima.config.cell.pair.selected.mandatory.background.description"),
+ "#990000",
+ Color.class, false, false),
+
+ TABLE_CELL_PAIR_SELECTED_MANDATORY_FOREGROUND("lima.ui.table.cell.pair.selected.mandatory.foreground",
+ t("lima.config.cell.pair.selected.mandatory.foreground.label"),
+ n("lima.config.cell.pair.selected.mandatory.foreground.description"),
+ "#000000",
+ Color.class, false, false);
+
+ protected enum ComportmentEditingCellEnum {ALL, NOTHING}
+
+ protected final String key;
+
+ protected final String label;
+
+ protected final String description;
+
+ protected String defaultValue;
+
+ protected final Class<?> type;
+
+ protected boolean _transient;
+
+ protected boolean _final;
+
+ Option(String key, String label, String description, String defaultValue,
+ Class<?> type, boolean _transient, boolean _final) {
+ this.key = key;
+ this.label = label;
+ this.description = description;
+ this.defaultValue = defaultValue;
+ this.type = type;
+ this._final = _final;
+ this._transient = _transient;
+ }
+
+ @Override
+ public boolean isFinal() {
+ return _final;
+ }
+
+ @Override
+ public void setFinal(boolean _final) {
+ this._final = _final;
+ }
+
+ @Override
+ public boolean isTransient() {
+ return _transient;
+ }
+
+ @Override
+ public void setTransient(boolean _transient) {
+ this._transient = _transient;
+ }
+
+ @Override
+ public String getDefaultValue() {
+ return defaultValue;
+ }
+
+ @Override
+ public void setDefaultValue(String defaultValue) {
+ this.defaultValue = defaultValue;
+ }
+
+ public String getLabel () {
+ return label;
+ }
+
+ @Override
+ public String getDescription() {
+ return t(description);
+ }
+
+ @Override
+ public String getKey() {
+ return key;
+ }
+
+ @Override
+ public Class<?> getType() {
+ return type;
+ }
+ }
+
+ /** Lima action definition. */
+ public enum Action {
+
+ HELP(n("lima.action.commandline.help"), MiscAction.class.getName() + "#help", "-h", "--help");
+
+ /** Before init action step. */
+ public static final int BEFORE_EXIT_STEP = 0;
+
+ /** After init action step. */
+ public static final int AFTER_INIT_STEP = 1;
+
+ public String description;
+
+ public String action;
+
+ public String[] aliases;
+
+ Action(String description, String action, String... aliases) {
+ this.description = description;
+ this.action = action;
+ this.aliases = aliases;
+ }
+
+ public String getDescription() {
+ return t(description);
+ }
+ }
+
+ /**
+ * Override save action to propagate some option to server.
+ */
+ @Override
+ public void save(File file,
+ boolean forceAll,
+ String... excludeKeys) throws IOException {
+
+ super.save(file, forceAll, excludeKeys);
+
+ // propagate scale option to serveur option
+ optionsService = LimaServiceFactory.getService(OptionsService.class);
+
+ // scale server option
+ String scaleOption = getOption("scale");
+ if (StringUtils.isNotBlank(scaleOption)) {
+ optionsService.setScale(scaleOption);
+ }
+ }
+}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/actions/MiscAction.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/actions/MiscAction.java 2014-09-25 15:25:32 UTC (rev 3922)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/actions/MiscAction.java 2014-09-26 09:10:52 UTC (rev 3923)
@@ -25,8 +25,8 @@
package org.chorem.lima.actions;
-import org.chorem.lima.LimaConfig;
import org.chorem.lima.LimaMain;
+import org.chorem.lima.LimaSwingConfig;
import java.util.Arrays;
@@ -44,20 +44,20 @@
public class MiscAction {
/** La configuration de l'application. */
- protected LimaConfig config;
+ protected LimaSwingConfig config;
- public MiscAction(LimaConfig config) {
+ public MiscAction(LimaSwingConfig config) {
this.config = config;
}
public void help() {
System.out.println(t("lima.message.help.usage"));
- for (LimaConfig.Option o : LimaConfig.Option.values()) {
- System.out.println("\t" + o.key + "(" + o.defaultValue + "):" + o.getDescription());
+ for (LimaSwingConfig.Option o : LimaSwingConfig.Option.values()) {
+ System.out.println("\t" + o.getKey() + "(" + o.getDefaultValue() + "):" + o.getDescription());
}
System.out.println("Actions:");
- for (LimaConfig.Action a : LimaConfig.Action.values()) {
+ for (LimaSwingConfig.Action a : LimaSwingConfig.Action.values()) {
System.out.println("\t" + Arrays.toString(a.aliases) + "(" + a.action + "):" + a.getDescription());
}
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainView.jaxx 2014-09-25 15:25:32 UTC (rev 3922)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainView.jaxx 2014-09-26 09:10:52 UTC (rev 3923)
@@ -31,7 +31,7 @@
java.util.Locale
javax.swing.JButton
jaxx.runtime.SwingUtil
- org.chorem.lima.LimaConfig
+ org.chorem.lima.LimaSwingConfig
org.chorem.lima.LimaSwingApplicationContext
org.chorem.lima.enums.ImportExportEnum
</import>
@@ -42,7 +42,7 @@
SwingUtil.getLayer(mainPanel).setUI(betaLayer);
}
- public LimaConfig getConfig() {
+ public LimaSwingConfig getConfig() {
return LimaSwingApplicationContext.CONFIG_DEF.getContextValue(getDelegateContext());
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java 2014-09-25 15:25:32 UTC (rev 3922)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java 2014-09-26 09:10:52 UTC (rev 3923)
@@ -30,8 +30,8 @@
import jaxx.runtime.swing.config.ConfigUIHelper;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.chorem.lima.LimaConfig;
import org.chorem.lima.LimaSwingApplicationContext;
+import org.chorem.lima.LimaSwingConfig;
import org.chorem.lima.business.api.HttpServerService;
import org.chorem.lima.enums.ImportExportEnum;
import org.chorem.lima.service.LimaServiceFactory;
@@ -105,15 +105,15 @@
//Get xml lima state file
protected File getLimaStateFile() {
- LimaConfig limaConfig = LimaConfig.getInstance();
+ LimaSwingConfig limaSwingConfig = LimaSwingConfig.getInstance();
- File limaStateFile = limaConfig.getLimaStateFile();
+ File limaStateFile = limaSwingConfig.getLimaStateFile();
return limaStateFile;
}
public void changeLanguage(MainView mainUI, Locale newLocale) {
- LimaConfig config = mainUI.getConfig();
+ LimaSwingConfig config = mainUI.getConfig();
// sauvegarde de la nouvelle locale
config.setLocale(newLocale);
@@ -155,11 +155,11 @@
public void showConfig(JAXXContext context) {
MainView ui = getUI(context);
- final LimaConfig config = ui.getConfig();
+ final LimaSwingConfig config = ui.getConfig();
ConfigUIHelper helper = new ConfigUIHelper(config);
- helper.registerCallBack(LimaConfig.Option.COLOR_SELECTION_FOCUS.key, t("lima.config.colorselectionfocus"), new ImageIcon(), new Runnable() {
+ helper.registerCallBack(LimaSwingConfig.Option.COLOR_SELECTION_FOCUS.getKey(), t("lima.config.colorselectionfocus"), new ImageIcon(), new Runnable() {
@Override
public void run() {
UIManager.put("Table.focusCellHighlightBorder", new BorderUIResource(new LineBorder(config.getColorSelectionFocus(), 2)));
@@ -167,92 +167,92 @@
});
helper.addCategory(t("lima.config.category.directories"), t("lima.config.category.directories.description"));
- helper.addOption(LimaConfig.Option.CONFIG_FILE);
- helper.setOptionShortLabel(LimaConfig.Option.CONFIG_FILE.getLabel());
+ helper.addOption(LimaSwingConfig.Option.CONFIG_FILE);
+ helper.setOptionShortLabel(LimaSwingConfig.Option.CONFIG_FILE.getLabel());
helper.addCategory(t("lima.config.category.table"), t("lima.config.category.table.description"));
- helper.addOption(LimaConfig.Option.TABLE_CELL_BACKGROUND);
- helper.setOptionShortLabel(LimaConfig.Option.TABLE_CELL_BACKGROUND.getLabel());
- helper.addOption(LimaConfig.Option.TABLE_CELL_FOREGROUND);
- helper.setOptionShortLabel(LimaConfig.Option.TABLE_CELL_FOREGROUND.getLabel());
- helper.addOption(LimaConfig.Option.TABLE_CELL_PAIR_BACKGROUND);
- helper.setOptionShortLabel(LimaConfig.Option.TABLE_CELL_PAIR_BACKGROUND.getLabel());
- helper.addOption(LimaConfig.Option.TABLE_CELL_PAIR_FOREGROUND);
- helper.setOptionShortLabel(LimaConfig.Option.TABLE_CELL_PAIR_FOREGROUND.getLabel());
- helper.addOption(LimaConfig.Option.TABLE_CELL_SELECTED_BACKGROUND);
- helper.setOptionShortLabel(LimaConfig.Option.TABLE_CELL_SELECTED_BACKGROUND.getLabel());
- helper.addOption(LimaConfig.Option.TABLE_CELL_SELECTED_FOREGROUND);
- helper.setOptionShortLabel(LimaConfig.Option.TABLE_CELL_SELECTED_FOREGROUND.getLabel());
- helper.addOption(LimaConfig.Option.TABLE_CELL_PAIR_SELECTED_BACKGROUND);
- helper.setOptionShortLabel(LimaConfig.Option.TABLE_CELL_PAIR_SELECTED_BACKGROUND.getLabel());
- helper.addOption(LimaConfig.Option.TABLE_CELL_PAIR_SELECTED_FOREGROUND);
- helper.setOptionShortLabel(LimaConfig.Option.TABLE_CELL_PAIR_SELECTED_FOREGROUND.getLabel());
- helper.addOption(LimaConfig.Option.TABLE_CELL_ERROR_BACKGROUND);
- helper.setOptionShortLabel(LimaConfig.Option.TABLE_CELL_ERROR_BACKGROUND.getLabel());
- helper.addOption(LimaConfig.Option.TABLE_CELL_ERROR_FOREGROUND);
- helper.setOptionShortLabel(LimaConfig.Option.TABLE_CELL_ERROR_FOREGROUND.getLabel());
- helper.addOption(LimaConfig.Option.TABLE_CELL_PAIR_ERROR_BACKGROUND);
- helper.setOptionShortLabel(LimaConfig.Option.TABLE_CELL_PAIR_ERROR_BACKGROUND.getLabel());
- helper.addOption(LimaConfig.Option.TABLE_CELL_PAIR_ERROR_FOREGROUND);
- helper.setOptionShortLabel(LimaConfig.Option.TABLE_CELL_PAIR_ERROR_FOREGROUND.getLabel());
- helper.addOption(LimaConfig.Option.TABLE_CELL_SELECTED_ERROR_BACKGROUND);
- helper.setOptionShortLabel(LimaConfig.Option.TABLE_CELL_SELECTED_ERROR_BACKGROUND.getLabel());
- helper.addOption(LimaConfig.Option.TABLE_CELL_SELECTED_ERROR_FOREGROUND);
- helper.setOptionShortLabel(LimaConfig.Option.TABLE_CELL_SELECTED_ERROR_FOREGROUND.getLabel());
- helper.addOption(LimaConfig.Option.TABLE_CELL_PAIR_SELECTED_ERROR_BACKGROUND);
- helper.setOptionShortLabel(LimaConfig.Option.TABLE_CELL_PAIR_SELECTED_ERROR_BACKGROUND.getLabel());
- helper.addOption(LimaConfig.Option.TABLE_CELL_PAIR_SELECTED_ERROR_FOREGROUND);
- helper.setOptionShortLabel(LimaConfig.Option.TABLE_CELL_PAIR_SELECTED_ERROR_FOREGROUND.getLabel());
- helper.addOption(LimaConfig.Option.TABLE_CELL_MANDATORY_BACKGROUND);
- helper.setOptionShortLabel(LimaConfig.Option.TABLE_CELL_MANDATORY_BACKGROUND.getLabel());
- helper.addOption(LimaConfig.Option.TABLE_CELL_MANDATORY_FOREGROUND);
- helper.setOptionShortLabel(LimaConfig.Option.TABLE_CELL_MANDATORY_FOREGROUND.getLabel());
- helper.addOption(LimaConfig.Option.TABLE_CELL_PAIR_MANDATORY_BACKGROUND);
- helper.setOptionShortLabel(LimaConfig.Option.TABLE_CELL_PAIR_MANDATORY_BACKGROUND.getLabel());
- helper.addOption(LimaConfig.Option.TABLE_CELL_PAIR_MANDATORY_FOREGROUND);
- helper.setOptionShortLabel(LimaConfig.Option.TABLE_CELL_PAIR_MANDATORY_FOREGROUND.getLabel());
- helper.addOption(LimaConfig.Option.TABLE_CELL_SELECTED_MANDATORY_BACKGROUND);
- helper.setOptionShortLabel(LimaConfig.Option.TABLE_CELL_SELECTED_MANDATORY_BACKGROUND.getLabel());
- helper.addOption(LimaConfig.Option.TABLE_CELL_SELECTED_MANDATORY_FOREGROUND);
- helper.setOptionShortLabel(LimaConfig.Option.TABLE_CELL_SELECTED_MANDATORY_FOREGROUND.getLabel());
- helper.addOption(LimaConfig.Option.TABLE_CELL_PAIR_SELECTED_MANDATORY_BACKGROUND);
- helper.setOptionShortLabel(LimaConfig.Option.TABLE_CELL_PAIR_SELECTED_MANDATORY_BACKGROUND.getLabel());
- helper.addOption(LimaConfig.Option.TABLE_CELL_PAIR_SELECTED_MANDATORY_FOREGROUND);
- helper.setOptionShortLabel(LimaConfig.Option.TABLE_CELL_PAIR_SELECTED_MANDATORY_FOREGROUND.getLabel());
- helper.addOption(LimaConfig.Option.COLOR_SELECTION_FOCUS);
- helper.setOptionShortLabel(LimaConfig.Option.COLOR_SELECTION_FOCUS.getLabel());
+ helper.addOption(LimaSwingConfig.Option.TABLE_CELL_BACKGROUND);
+ helper.setOptionShortLabel(LimaSwingConfig.Option.TABLE_CELL_BACKGROUND.getLabel());
+ helper.addOption(LimaSwingConfig.Option.TABLE_CELL_FOREGROUND);
+ helper.setOptionShortLabel(LimaSwingConfig.Option.TABLE_CELL_FOREGROUND.getLabel());
+ helper.addOption(LimaSwingConfig.Option.TABLE_CELL_PAIR_BACKGROUND);
+ helper.setOptionShortLabel(LimaSwingConfig.Option.TABLE_CELL_PAIR_BACKGROUND.getLabel());
+ helper.addOption(LimaSwingConfig.Option.TABLE_CELL_PAIR_FOREGROUND);
+ helper.setOptionShortLabel(LimaSwingConfig.Option.TABLE_CELL_PAIR_FOREGROUND.getLabel());
+ helper.addOption(LimaSwingConfig.Option.TABLE_CELL_SELECTED_BACKGROUND);
+ helper.setOptionShortLabel(LimaSwingConfig.Option.TABLE_CELL_SELECTED_BACKGROUND.getLabel());
+ helper.addOption(LimaSwingConfig.Option.TABLE_CELL_SELECTED_FOREGROUND);
+ helper.setOptionShortLabel(LimaSwingConfig.Option.TABLE_CELL_SELECTED_FOREGROUND.getLabel());
+ helper.addOption(LimaSwingConfig.Option.TABLE_CELL_PAIR_SELECTED_BACKGROUND);
+ helper.setOptionShortLabel(LimaSwingConfig.Option.TABLE_CELL_PAIR_SELECTED_BACKGROUND.getLabel());
+ helper.addOption(LimaSwingConfig.Option.TABLE_CELL_PAIR_SELECTED_FOREGROUND);
+ helper.setOptionShortLabel(LimaSwingConfig.Option.TABLE_CELL_PAIR_SELECTED_FOREGROUND.getLabel());
+ helper.addOption(LimaSwingConfig.Option.TABLE_CELL_ERROR_BACKGROUND);
+ helper.setOptionShortLabel(LimaSwingConfig.Option.TABLE_CELL_ERROR_BACKGROUND.getLabel());
+ helper.addOption(LimaSwingConfig.Option.TABLE_CELL_ERROR_FOREGROUND);
+ helper.setOptionShortLabel(LimaSwingConfig.Option.TABLE_CELL_ERROR_FOREGROUND.getLabel());
+ helper.addOption(LimaSwingConfig.Option.TABLE_CELL_PAIR_ERROR_BACKGROUND);
+ helper.setOptionShortLabel(LimaSwingConfig.Option.TABLE_CELL_PAIR_ERROR_BACKGROUND.getLabel());
+ helper.addOption(LimaSwingConfig.Option.TABLE_CELL_PAIR_ERROR_FOREGROUND);
+ helper.setOptionShortLabel(LimaSwingConfig.Option.TABLE_CELL_PAIR_ERROR_FOREGROUND.getLabel());
+ helper.addOption(LimaSwingConfig.Option.TABLE_CELL_SELECTED_ERROR_BACKGROUND);
+ helper.setOptionShortLabel(LimaSwingConfig.Option.TABLE_CELL_SELECTED_ERROR_BACKGROUND.getLabel());
+ helper.addOption(LimaSwingConfig.Option.TABLE_CELL_SELECTED_ERROR_FOREGROUND);
+ helper.setOptionShortLabel(LimaSwingConfig.Option.TABLE_CELL_SELECTED_ERROR_FOREGROUND.getLabel());
+ helper.addOption(LimaSwingConfig.Option.TABLE_CELL_PAIR_SELECTED_ERROR_BACKGROUND);
+ helper.setOptionShortLabel(LimaSwingConfig.Option.TABLE_CELL_PAIR_SELECTED_ERROR_BACKGROUND.getLabel());
+ helper.addOption(LimaSwingConfig.Option.TABLE_CELL_PAIR_SELECTED_ERROR_FOREGROUND);
+ helper.setOptionShortLabel(LimaSwingConfig.Option.TABLE_CELL_PAIR_SELECTED_ERROR_FOREGROUND.getLabel());
+ helper.addOption(LimaSwingConfig.Option.TABLE_CELL_MANDATORY_BACKGROUND);
+ helper.setOptionShortLabel(LimaSwingConfig.Option.TABLE_CELL_MANDATORY_BACKGROUND.getLabel());
+ helper.addOption(LimaSwingConfig.Option.TABLE_CELL_MANDATORY_FOREGROUND);
+ helper.setOptionShortLabel(LimaSwingConfig.Option.TABLE_CELL_MANDATORY_FOREGROUND.getLabel());
+ helper.addOption(LimaSwingConfig.Option.TABLE_CELL_PAIR_MANDATORY_BACKGROUND);
+ helper.setOptionShortLabel(LimaSwingConfig.Option.TABLE_CELL_PAIR_MANDATORY_BACKGROUND.getLabel());
+ helper.addOption(LimaSwingConfig.Option.TABLE_CELL_PAIR_MANDATORY_FOREGROUND);
+ helper.setOptionShortLabel(LimaSwingConfig.Option.TABLE_CELL_PAIR_MANDATORY_FOREGROUND.getLabel());
+ helper.addOption(LimaSwingConfig.Option.TABLE_CELL_SELECTED_MANDATORY_BACKGROUND);
+ helper.setOptionShortLabel(LimaSwingConfig.Option.TABLE_CELL_SELECTED_MANDATORY_BACKGROUND.getLabel());
+ helper.addOption(LimaSwingConfig.Option.TABLE_CELL_SELECTED_MANDATORY_FOREGROUND);
+ helper.setOptionShortLabel(LimaSwingConfig.Option.TABLE_CELL_SELECTED_MANDATORY_FOREGROUND.getLabel());
+ helper.addOption(LimaSwingConfig.Option.TABLE_CELL_PAIR_SELECTED_MANDATORY_BACKGROUND);
+ helper.setOptionShortLabel(LimaSwingConfig.Option.TABLE_CELL_PAIR_SELECTED_MANDATORY_BACKGROUND.getLabel());
+ helper.addOption(LimaSwingConfig.Option.TABLE_CELL_PAIR_SELECTED_MANDATORY_FOREGROUND);
+ helper.setOptionShortLabel(LimaSwingConfig.Option.TABLE_CELL_PAIR_SELECTED_MANDATORY_FOREGROUND.getLabel());
+ helper.addOption(LimaSwingConfig.Option.COLOR_SELECTION_FOCUS);
+ helper.setOptionShortLabel(LimaSwingConfig.Option.COLOR_SELECTION_FOCUS.getLabel());
helper.addCategory(t("lima.config.category.other"), t("lima.config.category.other.description"));
- helper.addOption(LimaConfig.Option.LOCALE);
- helper.setOptionShortLabel(LimaConfig.Option.LOCALE.getLabel());
+ helper.addOption(LimaSwingConfig.Option.LOCALE);
+ helper.setOptionShortLabel(LimaSwingConfig.Option.LOCALE.getLabel());
- JComboBox<Character> comboBoxSeparator = new JComboBox<Character>(LimaConfig.NUMBER_SEPARATOR.toArray(new Character[LimaConfig.NUMBER_SEPARATOR.size()]));
+ JComboBox<Character> comboBoxSeparator = new JComboBox<Character>(LimaSwingConfig.NUMBER_SEPARATOR.toArray(new Character[LimaSwingConfig.NUMBER_SEPARATOR.size()]));
DefaultCellEditor separatorEditor = new DefaultCellEditor(comboBoxSeparator);
comboBoxSeparator.setRenderer(new NumberSeparatorCellRenderer());
NumberSeparatorTableCellRenderer separatorRenderer = new NumberSeparatorTableCellRenderer();
- helper.addOption(LimaConfig.Option.DECIMAL_SEPARATOR);
- helper.setOptionShortLabel(LimaConfig.Option.DECIMAL_SEPARATOR.getLabel());
+ helper.addOption(LimaSwingConfig.Option.DECIMAL_SEPARATOR);
+ helper.setOptionShortLabel(LimaSwingConfig.Option.DECIMAL_SEPARATOR.getLabel());
helper.setOptionRenderer(separatorRenderer);
helper.setOptionEditor(separatorEditor);
- JComboBox<Integer> comboBoxDecimal = new JComboBox<Integer>(LimaConfig.NUMBER_DECIMALS.toArray(new Integer[LimaConfig.NUMBER_DECIMALS.size()]));
+ JComboBox<Integer> comboBoxDecimal = new JComboBox<Integer>(LimaSwingConfig.NUMBER_DECIMALS.toArray(new Integer[LimaSwingConfig.NUMBER_DECIMALS.size()]));
DefaultCellEditor decimalEditor = new DefaultCellEditor(comboBoxDecimal);
- helper.addOption(LimaConfig.Option.SCALE);
- helper.setOptionShortLabel(LimaConfig.Option.SCALE.getLabel());
+ helper.addOption(LimaSwingConfig.Option.SCALE);
+ helper.setOptionShortLabel(LimaSwingConfig.Option.SCALE.getLabel());
helper.setOptionEditor(decimalEditor);
- helper.addOption(LimaConfig.Option.THOUSAND_SEPARATOR);
- helper.setOptionShortLabel(LimaConfig.Option.THOUSAND_SEPARATOR.getLabel());
+ helper.addOption(LimaSwingConfig.Option.THOUSAND_SEPARATOR);
+ helper.setOptionShortLabel(LimaSwingConfig.Option.THOUSAND_SEPARATOR.getLabel());
helper.setOptionRenderer(separatorRenderer);
helper.setOptionEditor(separatorEditor);
- helper.addOption(LimaConfig.Option.CURRENCY);
- helper.setOptionShortLabel(LimaConfig.Option.CURRENCY.getLabel());
+ helper.addOption(LimaSwingConfig.Option.CURRENCY);
+ helper.setOptionShortLabel(LimaSwingConfig.Option.CURRENCY.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(LimaConfig.Option.SELECT_ALL_EDITING_CELL);
- helper.setOptionShortLabel(LimaConfig.Option.SELECT_ALL_EDITING_CELL.getLabel());
+ helper.addOption(LimaSwingConfig.Option.SELECT_ALL_EDITING_CELL);
+ helper.setOptionShortLabel(LimaSwingConfig.Option.SELECT_ALL_EDITING_CELL.getLabel());
helper.buildUI(context, t("lima.config.category.directories"));
helper.displayUI(ui, false);
@@ -260,7 +260,7 @@
public void gotoSite(JAXXContext context) {
- LimaConfig config = getUI(context).getConfig();
+ LimaSwingConfig config = getUI(context).getConfig();
URL siteURL = config.getOptionAsURL("application.site.url");
try {
@@ -487,7 +487,7 @@
public void loadURI(MainView ui) {
int port = LimaServiceFactory.getService(
HttpServerService.class).getHttpPort();
- String address = LimaConfig.getInstance().getHostAdress();
+ String address = LimaSwingConfig.getInstance().getHostAdress();
String url = "http://" + address + ":" + port + "/";
if (log.isDebugEnabled()) {
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java 2014-09-25 15:25:32 UTC (rev 3922)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java 2014-09-26 09:10:52 UTC (rev 3923)
@@ -27,7 +27,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.chorem.lima.LimaConfig;
+import org.chorem.lima.LimaSwingConfig;
import org.chorem.lima.business.ServiceListener;
import org.chorem.lima.business.api.AccountService;
import org.chorem.lima.business.api.ImportService;
@@ -121,7 +121,7 @@
// Gets factory service
LimaServiceFactory.addServiceListener(ImportService.class, this);
accountService = LimaServiceFactory.getService(AccountService.class);
- errorHelper = new ErrorHelper(LimaConfig.getInstance());
+ errorHelper = new ErrorHelper(LimaSwingConfig.getInstance());
}
/**
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellEditor.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellEditor.java 2014-09-25 15:25:32 UTC (rev 3922)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellEditor.java 2014-09-26 09:10:52 UTC (rev 3923)
@@ -26,8 +26,8 @@
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.chorem.lima.LimaConfig;
import org.chorem.lima.LimaSwingApplicationContext;
+import org.chorem.lima.LimaSwingConfig;
import javax.swing.*;
import java.awt.event.KeyEvent;
@@ -81,7 +81,7 @@
BigDecimal cellEditorValue;
int pointIndex = stringValue.indexOf(".");
if (pointIndex != -1) {
- LimaConfig config = LimaSwingApplicationContext.getContext().getConfig();
+ LimaSwingConfig config = LimaSwingApplicationContext.getContext().getConfig();
String actualDecimals = stringValue.substring(pointIndex, stringValue.length()-1);
if (config.getScale() > actualDecimals.length()) {
cellEditorValue = new BigDecimal(stringValue);
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellRenderer.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellRenderer.java 2014-09-25 15:25:32 UTC (rev 3922)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellRenderer.java 2014-09-26 09:10:52 UTC (rev 3923)
@@ -24,8 +24,8 @@
*/
package org.chorem.lima.ui.celleditor;
-import org.chorem.lima.LimaConfig;
import org.chorem.lima.LimaSwingApplicationContext;
+import org.chorem.lima.LimaSwingConfig;
import javax.swing.*;
import java.awt.*;
@@ -39,7 +39,7 @@
public static String format(BigDecimal value) {
- LimaConfig config = LimaSwingApplicationContext.getContext().getConfig();
+ LimaSwingConfig config = LimaSwingApplicationContext.getContext().getConfig();
StringBuilder scale = new StringBuilder();
for (int i = 0; i < config.getScale(); i++) {
scale.append("0");
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/DateTableCellEditor.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/DateTableCellEditor.java 2014-09-25 15:25:32 UTC (rev 3922)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/DateTableCellEditor.java 2014-09-26 09:10:52 UTC (rev 3923)
@@ -28,8 +28,8 @@
import org.apache.commons.lang3.time.DateUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.chorem.lima.LimaConfig;
import org.chorem.lima.LimaSwingApplicationContext;
+import org.chorem.lima.LimaSwingConfig;
import org.jdesktop.swingx.JXDatePicker;
import javax.swing.*;
@@ -118,7 +118,7 @@
SwingUtilities.invokeLater(new Runnable() {
public void run() {
JFormattedTextField dateFormattedTextField = datePicker.getEditor();
- LimaConfig config = LimaConfig.getInstance();
+ LimaSwingConfig config = LimaSwingConfig.getInstance();
if (config.isSelectAllEditingCell()) {
dateFormattedTextField.selectAll();
} else {
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/DefaultLimaTableCellRenderer.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/DefaultLimaTableCellRenderer.java 2014-09-25 15:25:32 UTC (rev 3922)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/DefaultLimaTableCellRenderer.java 2014-09-26 09:10:52 UTC (rev 3923)
@@ -24,7 +24,7 @@
* #L%
*/
-import org.chorem.lima.LimaConfig;
+import org.chorem.lima.LimaSwingConfig;
import org.chorem.lima.ui.common.TableModelWithGroup;
import javax.swing.*;
@@ -64,12 +64,12 @@
line = model.indexInGroup(row);
}
- LimaConfig limaConfig = LimaConfig.getInstance();
+ LimaSwingConfig limaSwingConfig = LimaSwingConfig.getInstance();
// border
Border border = BorderFactory.createEmptyBorder(1, 1, 1, 1);
if (hasFocus) {
- Color color = limaConfig.getOptionAsColor(LimaConfig.Option.COLOR_SELECTION_FOCUS.key);
+ Color color = limaSwingConfig.getOptionAsColor(LimaSwingConfig.Option.COLOR_SELECTION_FOCUS.getKey());
border = BorderFactory.createLineBorder(color, 2);
} else if (line == 0 && table.getModel() instanceof TableModelWithGroup) {
border = BorderFactory.createMatteBorder(1, 0, 0, 0, Color.BLACK);
@@ -79,61 +79,61 @@
// color
- LimaConfig.Option backgroundOption;
- LimaConfig.Option foreGroundOption;
+ LimaSwingConfig.Option backgroundOption;
+ LimaSwingConfig.Option foreGroundOption;
if ((line & 1) == 1 || line % 2 == 1) {
if (isSelected) {
if (errorDetector.isError(table, value, row, column)) {
- backgroundOption = LimaConfig.Option.TABLE_CELL_PAIR_SELECTED_ERROR_BACKGROUND;
- foreGroundOption = LimaConfig.Option.TABLE_CELL_PAIR_SELECTED_ERROR_FOREGROUND;
+ backgroundOption = LimaSwingConfig.Option.TABLE_CELL_PAIR_SELECTED_ERROR_BACKGROUND;
+ foreGroundOption = LimaSwingConfig.Option.TABLE_CELL_PAIR_SELECTED_ERROR_FOREGROUND;
} else if (isMandatory(table, value, row, column)){
- backgroundOption = LimaConfig.Option.TABLE_CELL_PAIR_SELECTED_MANDATORY_BACKGROUND;
- foreGroundOption = LimaConfig.Option.TABLE_CELL_PAIR_SELECTED_MANDATORY_FOREGROUND;
+ backgroundOption = LimaSwingConfig.Option.TABLE_CELL_PAIR_SELECTED_MANDATORY_BACKGROUND;
+ foreGroundOption = LimaSwingConfig.Option.TABLE_CELL_PAIR_SELECTED_MANDATORY_FOREGROUND;
} else {
- backgroundOption = LimaConfig.Option.TABLE_CELL_PAIR_SELECTED_BACKGROUND;
- foreGroundOption = LimaConfig.Option.TABLE_CELL_PAIR_SELECTED_FOREGROUND;
+ backgroundOption = LimaSwingConfig.Option.TABLE_CELL_PAIR_SELECTED_BACKGROUND;
+ foreGroundOption = LimaSwingConfig.Option.TABLE_CELL_PAIR_SELECTED_FOREGROUND;
}
} else {
if (errorDetector.isError(table, value, row, column)) {
- backgroundOption = LimaConfig.Option.TABLE_CELL_PAIR_ERROR_BACKGROUND;
- foreGroundOption = LimaConfig.Option.TABLE_CELL_PAIR_ERROR_FOREGROUND;
+ backgroundOption = LimaSwingConfig.Option.TABLE_CELL_PAIR_ERROR_BACKGROUND;
+ foreGroundOption = LimaSwingConfig.Option.TABLE_CELL_PAIR_ERROR_FOREGROUND;
} else if (isMandatory(table, value, row, column)){
- backgroundOption = LimaConfig.Option.TABLE_CELL_PAIR_MANDATORY_BACKGROUND;
- foreGroundOption = LimaConfig.Option.TABLE_CELL_PAIR_MANDATORY_FOREGROUND;
+ backgroundOption = LimaSwingConfig.Option.TABLE_CELL_PAIR_MANDATORY_BACKGROUND;
+ foreGroundOption = LimaSwingConfig.Option.TABLE_CELL_PAIR_MANDATORY_FOREGROUND;
} else {
- backgroundOption = LimaConfig.Option.TABLE_CELL_PAIR_BACKGROUND;
- foreGroundOption = LimaConfig.Option.TABLE_CELL_PAIR_FOREGROUND;
+ backgroundOption = LimaSwingConfig.Option.TABLE_CELL_PAIR_BACKGROUND;
+ foreGroundOption = LimaSwingConfig.Option.TABLE_CELL_PAIR_FOREGROUND;
}
}
} else {
if (isSelected) {
if (errorDetector.isError(table, value, row, column)) {
- backgroundOption = LimaConfig.Option.TABLE_CELL_SELECTED_ERROR_BACKGROUND;
- foreGroundOption = LimaConfig.Option.TABLE_CELL_SELECTED_ERROR_FOREGROUND;
+ backgroundOption = LimaSwingConfig.Option.TABLE_CELL_SELECTED_ERROR_BACKGROUND;
+ foreGroundOption = LimaSwingConfig.Option.TABLE_CELL_SELECTED_ERROR_FOREGROUND;
} else if (isMandatory(table, value, row, column)){
- backgroundOption = LimaConfig.Option.TABLE_CELL_SELECTED_MANDATORY_BACKGROUND;
- foreGroundOption = LimaConfig.Option.TABLE_CELL_SELECTED_MANDATORY_FOREGROUND;
+ backgroundOption = LimaSwingConfig.Option.TABLE_CELL_SELECTED_MANDATORY_BACKGROUND;
+ foreGroundOption = LimaSwingConfig.Option.TABLE_CELL_SELECTED_MANDATORY_FOREGROUND;
} else {
- backgroundOption = LimaConfig.Option.TABLE_CELL_SELECTED_BACKGROUND;
- foreGroundOption = LimaConfig.Option.TABLE_CELL_SELECTED_FOREGROUND;
+ backgroundOption = LimaSwingConfig.Option.TABLE_CELL_SELECTED_BACKGROUND;
+ foreGroundOption = LimaSwingConfig.Option.TABLE_CELL_SELECTED_FOREGROUND;
}
} else {
if (errorDetector.isError(table, value, row, column)) {
- backgroundOption = LimaConfig.Option.TABLE_CELL_ERROR_BACKGROUND;
- foreGroundOption = LimaConfig.Option.TABLE_CELL_ERROR_FOREGROUND;
+ backgroundOption = LimaSwingConfig.Option.TABLE_CELL_ERROR_BACKGROUND;
+ foreGroundOption = LimaSwingConfig.Option.TABLE_CELL_ERROR_FOREGROUND;
} else if (isMandatory(table, value, row, column)){
- backgroundOption = LimaConfig.Option.TABLE_CELL_MANDATORY_BACKGROUND;
- foreGroundOption = LimaConfig.Option.TABLE_CELL_MANDATORY_FOREGROUND;
+ backgroundOption = LimaSwingConfig.Option.TABLE_CELL_MANDATORY_BACKGROUND;
+ foreGroundOption = LimaSwingConfig.Option.TABLE_CELL_MANDATORY_FOREGROUND;
} else {
- backgroundOption = LimaConfig.Option.TABLE_CELL_BACKGROUND;
- foreGroundOption = LimaConfig.Option.TABLE_CELL_FOREGROUND;
+ backgroundOption = LimaSwingConfig.Option.TABLE_CELL_BACKGROUND;
+ foreGroundOption = LimaSwingConfig.Option.TABLE_CELL_FOREGROUND;
}
}
}
- myCell.setBackground(limaConfig.getOptionAsColor(backgroundOption.key));
- myCell.setForeground(limaConfig.getOptionAsColor(foreGroundOption.key));
+ myCell.setBackground(limaSwingConfig.getOptionAsColor(backgroundOption.getKey()));
+ myCell.setForeground(limaSwingConfig.getOptionAsColor(foreGroundOption.getKey()));
setValue(value);
myCell.setText(text);
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/StringTableCellEditor.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/StringTableCellEditor.java 2014-09-25 15:25:32 UTC (rev 3922)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/StringTableCellEditor.java 2014-09-26 09:10:52 UTC (rev 3923)
@@ -26,7 +26,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.chorem.lima.LimaConfig;
+import org.chorem.lima.LimaSwingConfig;
import javax.swing.*;
import javax.swing.border.Border;
@@ -106,7 +106,7 @@
* Two kinds of edition, with LimaConfig value
* */
public void runEdition() {
- LimaConfig config = LimaConfig.getInstance();
+ LimaSwingConfig config = LimaSwingConfig.getInstance();
if (config.isSelectAllEditingCell()) {
getComponent().selectAll();
} else {
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/common/AbstractColumn.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/common/AbstractColumn.java 2014-09-25 15:25:32 UTC (rev 3922)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/common/AbstractColumn.java 2014-09-26 09:10:52 UTC (rev 3923)
@@ -24,7 +24,7 @@
* #L%
*/
-import org.chorem.lima.LimaConfig;
+import org.chorem.lima.LimaSwingConfig;
import org.chorem.lima.util.ErrorHelper;
import javax.swing.table.TableCellEditor;
@@ -50,7 +50,7 @@
this.columnClass = columnClass;
this.columnName = columnName;
this.editable = editable;
- errorHelper = new ErrorHelper(LimaConfig.getInstance());
+ errorHelper = new ErrorHelper(LimaSwingConfig.getInstance());
}
public Class<?> getColumnClass() {
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/common/AbstractLimaTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/common/AbstractLimaTableModel.java 2014-09-25 15:25:32 UTC (rev 3922)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/common/AbstractLimaTableModel.java 2014-09-26 09:10:52 UTC (rev 3923)
@@ -25,7 +25,7 @@
*/
import com.google.common.collect.Lists;
-import org.chorem.lima.LimaConfig;
+import org.chorem.lima.LimaSwingConfig;
import org.chorem.lima.util.ErrorHelper;
import javax.swing.table.AbstractTableModel;
@@ -56,7 +56,7 @@
columns = Lists.newArrayList();
- errorHelper = new ErrorHelper(LimaConfig.getInstance());
+ errorHelper = new ErrorHelper(LimaSwingConfig.getInstance());
initColumn();
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookViewHandler.java 2014-09-25 15:25:32 UTC (rev 3922)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookViewHandler.java 2014-09-26 09:10:52 UTC (rev 3923)
@@ -27,7 +27,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.chorem.lima.LimaConfig;
+import org.chorem.lima.LimaSwingConfig;
import org.chorem.lima.business.ServiceListener;
import org.chorem.lima.business.api.EntryBookService;
import org.chorem.lima.business.api.ImportService;
@@ -74,7 +74,7 @@
this.view = view;
entryBookService = LimaServiceFactory.getService(EntryBookService.class);
LimaServiceFactory.addServiceListener(ImportService.class, this);
- errorHelper = new ErrorHelper(LimaConfig.getInstance());
+ errorHelper = new ErrorHelper(LimaSwingConfig.getInstance());
}
public void init() {
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodViewHandler.java 2014-09-25 15:25:32 UTC (rev 3922)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodViewHandler.java 2014-09-26 09:10:52 UTC (rev 3923)
@@ -28,7 +28,7 @@
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.chorem.lima.LimaConfig;
+import org.chorem.lima.LimaSwingConfig;
import org.chorem.lima.business.ServiceListener;
import org.chorem.lima.business.api.FinancialPeriodService;
import org.chorem.lima.business.api.FiscalPeriodService;
@@ -79,7 +79,7 @@
financialPeriodService = LimaServiceFactory.getService(FinancialPeriodService.class);
LimaServiceFactory.addServiceListener(ImportService.class, this);
LimaServiceFactory.addServiceListener(FiscalPeriodService.class, this);
- errorHelper = new ErrorHelper(LimaConfig.getInstance());
+ errorHelper = new ErrorHelper(LimaSwingConfig.getInstance());
}
/**
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartTreeTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartTreeTableModel.java 2014-09-25 15:25:32 UTC (rev 3922)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartTreeTableModel.java 2014-09-26 09:10:52 UTC (rev 3923)
@@ -28,7 +28,7 @@
import com.google.common.collect.Lists;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.chorem.lima.LimaConfig;
+import org.chorem.lima.LimaSwingConfig;
import org.chorem.lima.business.api.FinancialStatementService;
import org.chorem.lima.business.exceptions.AlreadyExistFinancialStatement;
import org.chorem.lima.business.exceptions.NotAllowedLabelException;
@@ -70,7 +70,7 @@
// Gets factory service
financialStatementService =
LimaServiceFactory.getService(FinancialStatementService.class);
- errorHelper = new ErrorHelper(LimaConfig.getInstance());
+ errorHelper = new ErrorHelper(LimaSwingConfig.getInstance());
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionViewHandler.java 2014-09-25 15:25:32 UTC (rev 3922)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionViewHandler.java 2014-09-26 09:10:52 UTC (rev 3923)
@@ -29,7 +29,7 @@
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.chorem.lima.LimaConfig;
+import org.chorem.lima.LimaSwingConfig;
import org.chorem.lima.business.ServiceListener;
import org.chorem.lima.business.api.EntryBookService;
import org.chorem.lima.business.api.FinancialPeriodService;
@@ -106,7 +106,7 @@
LimaServiceFactory.addServiceListener(FinancialPeriodService.class, this);
LimaServiceFactory.addServiceListener(FiscalPeriodService.class, this);
LimaServiceFactory.addServiceListener(ImportService.class, this);
- errorHelper = new ErrorHelper(LimaConfig.getInstance());
+ errorHelper = new ErrorHelper(LimaSwingConfig.getInstance());
initShortCuts();
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedViewHandler.java 2014-09-25 15:25:32 UTC (rev 3922)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedViewHandler.java 2014-09-26 09:10:52 UTC (rev 3923)
@@ -27,7 +27,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.chorem.lima.LimaConfig;
+import org.chorem.lima.LimaSwingConfig;
import org.chorem.lima.business.exceptions.AfterLastFiscalPeriodException;
import org.chorem.lima.business.exceptions.BeforeFirstFiscalPeriodException;
import org.chorem.lima.business.exceptions.LockedEntryBookException;
@@ -68,7 +68,7 @@
protected FinancialTransactionUnbalancedViewHandler(FinancialTransactionUnbalancedView view) {
this.view = view;
- errorHelper = new ErrorHelper(LimaConfig.getInstance());
+ errorHelper = new ErrorHelper(LimaSwingConfig.getInstance());
initShortCuts();
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodViewHandler.java 2014-09-25 15:25:32 UTC (rev 3922)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodViewHandler.java 2014-09-26 09:10:52 UTC (rev 3923)
@@ -29,7 +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.LimaConfig;
+import org.chorem.lima.LimaSwingConfig;
import org.chorem.lima.business.ServiceListener;
import org.chorem.lima.business.api.FinancialTransactionService;
import org.chorem.lima.business.api.FiscalPeriodService;
@@ -92,7 +92,7 @@
financialTransactionService = LimaServiceFactory.getService(FinancialTransactionService.class);
LimaServiceFactory.addServiceListener(FiscalPeriodService.class, this);
- errorHelper = new ErrorHelper(LimaConfig.getInstance());
+ errorHelper = new ErrorHelper(LimaSwingConfig.getInstance());
}
public void init() {
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java 2014-09-25 15:25:32 UTC (rev 3922)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java 2014-09-26 09:10:52 UTC (rev 3923)
@@ -32,7 +32,7 @@
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.chorem.lima.LimaConfig;
+import org.chorem.lima.LimaSwingConfig;
import org.chorem.lima.LimaTechnicalException;
import org.chorem.lima.business.ExportResult;
import org.chorem.lima.business.ImportExportResults;
@@ -120,7 +120,7 @@
//services
importService = LimaServiceFactory.getService(ImportService.class);
exportService = LimaServiceFactory.getService(ExportService.class);
- errorHelper = new ErrorHelper(LimaConfig.getInstance());
+ errorHelper = new ErrorHelper(LimaSwingConfig.getInstance());
//create the wait dialog panel
waitView = new ImportExportWaitView();
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java 2014-09-25 15:25:32 UTC (rev 3922)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java 2014-09-26 09:10:52 UTC (rev 3923)
@@ -31,7 +31,7 @@
import org.apache.commons.lang3.time.DateUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.chorem.lima.LimaConfig;
+import org.chorem.lima.LimaSwingConfig;
import org.chorem.lima.beans.LetteringFilterImpl;
import org.chorem.lima.business.api.AccountService;
import org.chorem.lima.business.api.EntryBookService;
@@ -102,7 +102,7 @@
accountService = LimaServiceFactory.getService(AccountService.class);
financialTransactionService = LimaServiceFactory.getService(FinancialTransactionService.class);
entryBookService = LimaServiceFactory.getService(EntryBookService.class);
- errorHelper = new ErrorHelper(LimaConfig.getInstance());
+ errorHelper = new ErrorHelper(LimaSwingConfig.getInstance());
}
/**
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/util/ErrorHelper.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/util/ErrorHelper.java 2014-09-25 15:25:32 UTC (rev 3922)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/util/ErrorHelper.java 2014-09-26 09:10:52 UTC (rev 3923)
@@ -30,7 +30,7 @@
import org.apache.commons.logging.LogFactory;
import org.apache.commons.mail.EmailException;
import org.apache.commons.mail.MultiPartEmail;
-import org.chorem.lima.LimaConfig;
+import org.chorem.lima.LimaSwingConfig;
import org.jdesktop.swingx.JXErrorPane;
import org.jdesktop.swingx.error.ErrorInfo;
import org.jdesktop.swingx.error.ErrorReporter;
@@ -62,9 +62,9 @@
/** Log. */
private static final Log log = LogFactory.getLog(ErrorHelper.class);
- protected LimaConfig config;
+ protected LimaSwingConfig config;
- public ErrorHelper(LimaConfig config) {
+ public ErrorHelper(LimaSwingConfig config) {
this.config = config;
}
1
0
Author: dcosse
Date: 2014-09-25 17:25:32 +0200 (Thu, 25 Sep 2014)
New Revision: 3922
Url: http://forge.chorem.org/projects/lima/repository/revisions/3922
Log:
refs #1115 refactoring au tours du lancement de l'application
Added:
trunk/lima-business/src/main/java/org/chorem/lima/business/LimaConfigurationHelper.java
trunk/lima-business/src/main/java/org/chorem/lima/business/LimaServiceConfig.java
trunk/lima-callao/src/main/java/org/chorem/lima/entity/LimaCallaoTopiaApplicationContext.java
trunk/lima-callao/src/main/resources/db/
trunk/lima-callao/src/main/resources/db/migration/
trunk/lima-swing/src/main/java/org/chorem/lima/LimaSwingApplicationContext.java
Removed:
trunk/lima-business/src/main/java/org/chorem/lima/business/LimaConfig.java
trunk/lima-business/src/main/java/org/chorem/lima/business/migration/
trunk/lima-swing/src/main/java/org/chorem/lima/LimaContext.java
Modified:
trunk/lima-business/pom.xml
trunk/lima-business/src/main/java/org/chorem/lima/business/LimaInterceptor.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/DocumentServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/EntryBookServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialPeriodServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/HttpServerServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/OptionsServiceImpl.java
trunk/lima-business/src/main/resources/i18n/lima-business_en_GB.properties
trunk/lima-business/src/main/resources/i18n/lima-business_fr_FR.properties
trunk/lima-business/src/test/java/org/chorem/lima/business/AbstractLimaTest.java
trunk/lima-business/src/test/java/org/chorem/lima/business/FinancialPeriodServiceImplTest.java
trunk/lima-business/src/test/java/org/chorem/lima/business/LimaMiscTest.java
trunk/lima-business/src/test/java/org/chorem/lima/business/LimaTestsConfig.java
trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/AccountServiceRuleFrTest.java
trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/EntryBookServiceRuleFrTest.java
trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/FinancialPeriodServiceRuleFrTest.java
trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/FinancialTransactionServiceRuleFrTest.java
trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/FiscalPeriodServiceRuleFrTest.java
trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/ImportServiceRuleFrTest.java
trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/ReportServiceRuleFrTest.java
trunk/lima-business/src/test/resources/lima-test.properties
trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/LimaRendererUtil.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellEditor.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellRenderer.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/DateTableCellEditor.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/AccountsPane.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/EntryBooksPane.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/FinancialTransactionsPane.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/FiscalYearsPane.java
trunk/pom.xml
Modified: trunk/lima-business/pom.xml
===================================================================
--- trunk/lima-business/pom.xml 2014-09-19 15:21:43 UTC (rev 3921)
+++ trunk/lima-business/pom.xml 2014-09-25 15:25:32 UTC (rev 3922)
@@ -59,7 +59,7 @@
</dependency>
<dependency>
<groupId>org.nuiton.topia</groupId>
- <artifactId>topia-service-migration</artifactId>
+ <artifactId>topia-service-flyway</artifactId>
</dependency>
<dependency>
<groupId>org.nuiton</groupId>
@@ -126,6 +126,21 @@
</dependencies>
<build>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ <includes>
+ <include>lima.properties</include>
+ </includes>
+ <filtering>true</filtering>
+ </resource>
+ <resource>
+ <directory>src/main/resources</directory>
+ <excludes>
+ <exclude>lima.properties</exclude>
+ </excludes>
+ </resource>
+ </resources>
<pluginManagement>
<plugins>
<plugin>
Deleted: trunk/lima-business/src/main/java/org/chorem/lima/business/LimaConfig.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/LimaConfig.java 2014-09-19 15:21:43 UTC (rev 3921)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/LimaConfig.java 2014-09-25 15:25:32 UTC (rev 3922)
@@ -1,281 +0,0 @@
-/*
- * #%L
- * Lima business
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2008 - 2012 CodeLutin, Chatellier Eric
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-package org.chorem.lima.business;
-
-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.migration.DatabaseMigrationClass;
-import org.chorem.lima.entity.LimaCallaoEntityEnum;
-import org.nuiton.config.ApplicationConfig;
-import org.nuiton.config.ArgumentsParserException;
-import org.nuiton.config.ConfigOptionDef;
-import org.nuiton.topia.migration.TopiaMigrationEngine;
-import org.nuiton.topia.migration.TopiaMigrationService;
-import org.nuiton.topia.persistence.TopiaConfigurationConstants;
-
-import java.io.File;
-
-import static org.nuiton.i18n.I18n.n;
-import static org.nuiton.i18n.I18n.t;
-
-/**
- * Configuration pour le business.
- * <p/>
- * A voir comment le lier avec celui de lima swing.
- *
- * @author chatellier
- * @version $Revision$
- * <p/>
- * Last update : $Date$
- * By : $Author$
- */
-public class LimaConfig extends ApplicationConfig {
-
- protected static final Log log = LogFactory.getLog(LimaConfig.class);
-
- protected static volatile LimaConfig instance;
-
- protected static AccountingRules accountingRules;
-
- protected static final String LIMA_DEFAULT_CONF_FILENAME = "lima.properties";
-
- protected static ApplicationConfig config = new ApplicationConfig(LIMA_DEFAULT_CONF_FILENAME);
-
- public LimaConfig() {
- try {
- setOption("topia.service.migration", TopiaMigrationEngine.class.getName());
- setOption("topia.service.migration.callback", DatabaseMigrationClass.class.getName());
-
- setOption(TopiaMigrationService.MIGRATION_SHOW_SQL, Boolean.TRUE.toString());
- setOption(TopiaMigrationService.MIGRATION_SHOW_PROGRESSION, Boolean.TRUE.toString());
-
- LimaConfig.config.loadDefaultOptions(ServiceConfigOption.values());
- LimaConfig.config.parse();
-
- } catch (ArgumentsParserException ex) {
- throw new LimaTechnicalException("Can't read configuration", ex);
- }
- }
-
- public static LimaConfig getInstance() {
- if (LimaConfig.instance == null) {
- LimaConfig.instance = new LimaConfig();
- LimaConfig.instance.loadConfiguration();
- }
- return instance;
- }
-
- public ApplicationConfig getConfig() {
- return config;
- }
-
- /**
- * Instancie la bonne classe de nationalite en fonction du fichier de configuration.
- *
- * L'instance est conservée en cache.
- *
- * @return l'instance de rule
- */
- public AccountingRules getAccountingRules() {
-
- if (accountingRules == null) {
- loadAccountingRules();
- }
-
- return accountingRules;
- }
-
- protected static void loadAccountingRules() {
- Class<?> accountingRulesClass = config.getOptionAsClass(ServiceConfigOption.RULES_NATIONALTY.key);
- if (accountingRulesClass == null) {
- if (log.isErrorEnabled()) {
- log.error("No accounting rules defined for:" + ServiceConfigOption.RULES_NATIONALTY.key);
- }
- accountingRules = new FranceAccountingRules();
- } else {
- try {
- accountingRules = (AccountingRules) accountingRulesClass.newInstance();
- } catch (Exception ex) {
- if (log.isErrorEnabled()) {
- log.error("Can't instantiate accounting rules", ex);
- }
-
- }
- }
- }
-
- public void setAccountingRule(String accountingRule) {
- LimaConfig.config.setOption(ServiceConfigOption.RULES_NATIONALTY.key, accountingRule);
- // clear cache
- loadAccountingRules();
- }
-
- public File getDataDir() {
- File datadir = config.getOptionAsFile(ServiceConfigOption.DATA_DIR.getKey());
- return datadir;
- }
-
- public File getReportsDir() {
- File reportsDir = config.getOptionAsFile(ServiceConfigOption.REPORTS_DIR.getKey());
- return reportsDir;
- }
-
- public String getAddressServer() {
- String serverAddress = config.getOption(ServiceConfigOption.SERVER_ADRESS.getKey());
- return serverAddress;
- }
-
- public int getHttpPort() {
- String httpPort = config.getOption(ServiceConfigOption.HTTP_PORT.getKey());
- Integer port = Integer.valueOf(httpPort);
- return port;
- }
-
- public String getScale() {
- String scale = config.getOption(ServiceConfigOption.SCALE.getKey());
- return scale;
- }
-
- public void setScale(String locale) {
- config.setOption(ServiceConfigOption.SCALE.key, locale);
- config.saveForUser();
- }
-
- public String getVatPDFUrl() {
- String vatPDFUrl = config.getOption(ServiceConfigOption.VAT_PDF_URL.getKey());
- return vatPDFUrl;
- }
-
- public void setVatPDFUrl(String url) {
- config.setOption(ServiceConfigOption.VAT_PDF_URL.key, url);
- config.saveForUser();
- }
-
- /**
- * Load configuration with custom file name.
- */
- protected void loadConfiguration() {
- try {
- config.parse();
- } catch (ArgumentsParserException ex) {
- if (log.isErrorEnabled()) {
- log.error("Can't read configuration", ex);
- }
- }
-
- config.setOption(TopiaConfigurationConstants.CONFIG_PERSISTENCE_CLASSES,
- LimaCallaoEntityEnum.getImplementationClassesAsString());
- }
-
- /**
- * Lima option definition.
- * <p/>
- * Contains all lima configuration key, with defaut value and
- * information for jaxx configuration frame ({@code #type},
- * {@code #transientBoolean}, {@code #finalBoolean}...)
- */
- public enum ServiceConfigOption implements ConfigOptionDef {
-
- CONFIG_FILE(CONFIG_FILE_NAME, n("lima.configFileName.description"), "lima.properties", String.class, true, true),
- DATA_DIR("lima.data.dir", n("lima.config.data.dir.description"), "${user.home}/.lima", File.class, false, false),
- REPORTS_DIR("lima.reports.dir", n("lima.config.reports.dir.description"), "${lima.data.dir}/reports", 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"), "", String.class, false, false),
- SCALE("lima.scale", n("lima.config.scale.description"), "2", String.class, false, false),
- VAT_PDF_URL("lima.report.vatpdfurl", n("lima.config.reportvatpdfurl.description"), "default", String.class, false, false);
-
- private final String key;
-
- private final String description;
-
- private String defaultValue;
-
- private final Class<?> type;
-
- private boolean transientBoolean;
-
- private boolean finalBoolean;
-
- ServiceConfigOption(String key, String description, String defaultValue,
- Class<?> type, boolean transientBoolean, boolean finalBoolean) {
- this.key = key;
- this.description = description;
- this.defaultValue = defaultValue;
- this.type = type;
- this.finalBoolean = finalBoolean;
- this.transientBoolean = transientBoolean;
- }
-
- @Override
- public boolean isFinal() {
- return finalBoolean;
- }
-
- @Override
- public void setFinal(boolean finalBoolean) {
- this.finalBoolean = finalBoolean;
- }
-
- @Override
- public boolean isTransient() {
- return transientBoolean;
- }
-
- @Override
- public void setTransient(boolean transientBoolean) {
- this.transientBoolean = transientBoolean;
- }
-
- @Override
- public String getDefaultValue() {
- return defaultValue;
- }
-
- @Override
- public void setDefaultValue(String defaultValue) {
- this.defaultValue = defaultValue;
- }
-
- @Override
- public String getDescription() {
- return t(description);
- }
-
- @Override
- public String getKey() {
- return key;
- }
-
- @Override
- public Class<?> getType() {
- return type;
- }
- }
-
-}
Added: trunk/lima-business/src/main/java/org/chorem/lima/business/LimaConfigurationHelper.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/LimaConfigurationHelper.java (rev 0)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/LimaConfigurationHelper.java 2014-09-25 15:25:32 UTC (rev 3922)
@@ -0,0 +1,47 @@
+package org.chorem.lima.business;
+
+import com.google.common.base.Function;
+import com.google.common.collect.Maps;
+import org.chorem.lima.entity.LimaCallaoEntityEnum;
+import org.chorem.lima.entity.LimaCallaoTopiaApplicationContext;
+import org.nuiton.topia.flyway.TopiaFlywayService;
+import org.nuiton.topia.flyway.TopiaFlywayServiceImpl;
+import org.nuiton.topia.persistence.TopiaConfigurationConstants;
+
+import java.util.Map;
+import java.util.Properties;
+
+/**
+ * Created by davidcosse on 24/09/14.
+ */
+public class LimaConfigurationHelper {
+
+ public static Function<Properties, LimaCallaoTopiaApplicationContext> getCreateTopiaContextFunction() {
+ return new Function<Properties, LimaCallaoTopiaApplicationContext>() {
+ @Override
+ public LimaCallaoTopiaApplicationContext apply(Properties input) {
+ LimaCallaoTopiaApplicationContext result = new LimaCallaoTopiaApplicationContext(input);
+ return result;
+ }
+ };
+ }
+
+ public static Properties getRootContextProperties(LimaServiceConfig serviceConfig) {
+ Properties result = serviceConfig.getFlatOptions();
+ // add persistence classes from generated code
+ result.setProperty(TopiaConfigurationConstants.CONFIG_PERSISTENCE_CLASSES, LimaCallaoEntityEnum.getImplementationClassesAsString());
+
+ Map<String, String> toAddIfNotPresent = Maps.newLinkedHashMap();
+ toAddIfNotPresent.put("topia.service.migration", TopiaFlywayServiceImpl.class.getName());
+ toAddIfNotPresent.put("topia.service.migration." + TopiaFlywayService.USE_MODEL_VERSION, "true");
+ toAddIfNotPresent.put(TopiaConfigurationConstants.CONFIG_PERSISTENCE_INIT_SCHEMA, "true");
+
+ for (Map.Entry<String, String> entry : toAddIfNotPresent.entrySet()) {
+ if (!result.containsKey(entry.getKey())) {
+ result.setProperty(entry.getKey(), entry.getValue());
+ }
+ }
+
+ return result;
+ }
+}
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/LimaInterceptor.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/LimaInterceptor.java 2014-09-19 15:21:43 UTC (rev 3921)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/LimaInterceptor.java 2014-09-25 15:25:32 UTC (rev 3922)
@@ -23,7 +23,6 @@
package org.chorem.lima.business;
-import com.google.common.base.Function;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.LimaXAResource;
@@ -31,7 +30,6 @@
import org.chorem.lima.entity.LimaCallaoTopiaApplicationContext;
import org.chorem.lima.entity.LimaCallaoTopiaDaoSupplier;
import org.chorem.lima.entity.LimaCallaoTopiaPersistenceContext;
-import org.nuiton.config.ApplicationConfig;
import org.nuiton.topia.persistence.TopiaApplicationContextCache;
import org.nuiton.topia.persistence.TopiaException;
import org.nuiton.topia.persistence.util.TopiaUtil;
@@ -61,17 +59,8 @@
private static final Log log = LogFactory.getLog(LimaInterceptor.class);
- public static final ThreadLocal<LimaCallaoTopiaDaoSupplier> DAO_HELPER = new ThreadLocal<LimaCallaoTopiaDaoSupplier>();
+ public static final ThreadLocal<LimaCallaoTopiaDaoSupplier> DAO_HELPER = new ThreadLocal<>();
- protected static final Function<Properties, LimaCallaoTopiaApplicationContext> CREATE_CONTEXT_FUNCTION = new Function<Properties, LimaCallaoTopiaApplicationContext>() {
- @Override
- public LimaCallaoTopiaApplicationContext apply(Properties input) {
- return new LimaCallaoTopiaApplicationContext(input);
- }
- };
-
- protected static boolean schemaExistChecked = false;
-
@Resource
private TransactionManager transactionManager;
@@ -95,20 +84,21 @@
context.getTarget().getClass() + "#" + context.getMethod().getName());
}
- ApplicationConfig config = LimaConfig.getInstance().getConfig();
+ LimaServiceConfig config = LimaServiceConfig.getInstance();
- LimaCallaoTopiaApplicationContext rootContext = TopiaApplicationContextCache.getContext(config.getFlatOptions(), CREATE_CONTEXT_FUNCTION);
+ Properties contextProperties = LimaConfigurationHelper.getRootContextProperties(config);
+ LimaCallaoTopiaApplicationContext rootContext = TopiaApplicationContextCache.getContext(contextProperties, LimaConfigurationHelper.getCreateTopiaContextFunction());
LimaCallaoTopiaPersistenceContext tx = rootContext.newPersistenceContext();
// TODO DCossé 24/07/14 remove it as soon as migration service is done.
- createShemaIfNeeded(rootContext, tx);
+ //createShemaIfNeeded(rootContext, tx);
DAO_HELPER.set(tx);
Transaction tr = transactionManager.getTransaction();
- // enlist topia xaresource, will will commited or rollback
+ // enlist topia xaresource, will commited or rollback
// by container
tr.enlistResource(new LimaXAResource(tx));
@@ -136,7 +126,7 @@
*/
protected void createShemaIfNeeded(LimaCallaoTopiaApplicationContext applicationContext, LimaCallaoTopiaPersistenceContext tx) throws TopiaException {
//LimaCallaoTopiaPersistenceContext
- if (!schemaExistChecked) {
+ if (!applicationContext.isSchemaEmpty()) {
boolean exist = TopiaUtil.isSchemaExist(tx, AccountImpl.class.getName());
if (!exist) {
@@ -145,8 +135,6 @@
}
applicationContext.createSchema();
}
-
- schemaExistChecked = true;
}
}
Copied: trunk/lima-business/src/main/java/org/chorem/lima/business/LimaServiceConfig.java (from rev 3921, trunk/lima-business/src/main/java/org/chorem/lima/business/LimaConfig.java)
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/LimaServiceConfig.java (rev 0)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/LimaServiceConfig.java 2014-09-25 15:25:32 UTC (rev 3922)
@@ -0,0 +1,293 @@
+/*
+ * #%L
+ * Lima business
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2008 - 2012 CodeLutin, Chatellier Eric
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+package org.chorem.lima.business;
+
+import org.apache.commons.lang3.StringUtils;
+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.nuiton.config.ApplicationConfig;
+import org.nuiton.config.ArgumentsParserException;
+import org.nuiton.config.ConfigOptionDef;
+
+import java.io.File;
+import java.util.Properties;
+
+import static org.nuiton.i18n.I18n.n;
+import static org.nuiton.i18n.I18n.t;
+
+/**
+ * Configuration pour le business.
+ * <p/>
+ * A voir comment le lier avec celui de lima swing.
+ *
+ * @author chatellier
+ * @version $Revision$
+ * <p/>
+ * Last update : $Date$
+ * By : $Author$
+ */
+public class LimaServiceConfig {
+
+ protected static final Log log = LogFactory.getLog(LimaServiceConfig.class);
+
+// protected static volatile LimaServiceConfig instance;
+
+ protected static AccountingRules accountingRules;
+
+ protected static final String LIMA_DEFAULT_CONF_FILENAME = "lima.properties";
+
+ protected static ApplicationConfig config;
+
+ protected static volatile LimaServiceConfig instance;
+
+ public LimaServiceConfig(String configFileName) {
+ try {
+ ApplicationConfig defaultConfig = new ApplicationConfig(LIMA_DEFAULT_CONF_FILENAME);
+ defaultConfig.loadDefaultOptions(ServiceConfigOption.values());
+ defaultConfig.parse();
+
+ if (StringUtils.isNotBlank(configFileName)) {
+ Properties flatOptions = defaultConfig.getFlatOptions(false);
+
+ config = new ApplicationConfig(flatOptions, configFileName);
+ config.parse();
+ } else {
+ if (log.isWarnEnabled()) {
+ log.warn("No specific configuration provided, using the default one");
+ }
+ config = defaultConfig;
+ }
+
+ instance = this;
+ } catch (ArgumentsParserException ex) {
+ throw new LimaTechnicalException("Can't read configuration", ex);
+ }
+ }
+
+ public static LimaServiceConfig getInstance() {
+ return instance;
+ }
+
+ public ApplicationConfig getConfig() {
+ return config;
+ }
+
+ /**
+ * Instancie la bonne classe de nationalite en fonction du fichier de configuration.
+ *
+ * L'instance est conservée en cache.
+ *
+ * @return l'instance de rule
+ */
+ public AccountingRules getAccountingRules() {
+
+ if (accountingRules == null) {
+ loadAccountingRules();
+ }
+
+ return accountingRules;
+ }
+
+ protected static void loadAccountingRules() {
+ Class<?> accountingRulesClass = config.getOptionAsClass(ServiceConfigOption.RULES_NATIONALTY.key);
+ if (accountingRulesClass == null) {
+ if (log.isErrorEnabled()) {
+ log.error("No accounting rules defined for:" + ServiceConfigOption.RULES_NATIONALTY.key);
+ }
+ accountingRules = new FranceAccountingRules();
+ } else {
+ try {
+ accountingRules = (AccountingRules) accountingRulesClass.newInstance();
+ } catch (Exception ex) {
+ if (log.isErrorEnabled()) {
+ log.error("Can't instantiate accounting rules", ex);
+ }
+
+ }
+ }
+ }
+
+ public Properties getFlatOptions() {
+ return config.getFlatOptions();
+ }
+
+ public String getApplicationVersion() {
+ return config.getOption(ServiceConfigOption.APPLICATION_VERSION.key);
+ }
+
+ public void setAccountingRule(String accountingRule) {
+ LimaServiceConfig.config.setOption(ServiceConfigOption.RULES_NATIONALTY.key, accountingRule);
+ // clear cache
+ loadAccountingRules();
+ }
+
+ public File getDataDir() {
+ File datadir = config.getOptionAsFile(ServiceConfigOption.DATA_DIR.getKey());
+ return datadir;
+ }
+
+ public File getReportsDir() {
+ File reportsDir = config.getOptionAsFile(ServiceConfigOption.REPORTS_DIR.getKey());
+ return reportsDir;
+ }
+
+ public String getAddressServer() {
+ String serverAddress = config.getOption(ServiceConfigOption.SERVER_ADRESS.getKey());
+ return serverAddress;
+ }
+
+ public int getHttpPort() {
+ String httpPort = config.getOption(ServiceConfigOption.HTTP_PORT.getKey());
+ Integer port = Integer.valueOf(httpPort);
+ return port;
+ }
+
+ public String getScale() {
+ String scale = config.getOption(ServiceConfigOption.SCALE.getKey());
+ return scale;
+ }
+
+ public void setScale(String locale) {
+ config.setOption(ServiceConfigOption.SCALE.key, locale);
+ config.saveForUser();
+ }
+
+ public String getVatPDFUrl() {
+ String vatPDFUrl = config.getOption(ServiceConfigOption.VAT_PDF_URL.getKey());
+ return vatPDFUrl;
+ }
+
+ public void setVatPDFUrl(String url) {
+ config.setOption(ServiceConfigOption.VAT_PDF_URL.key, url);
+ config.saveForUser();
+ }
+
+// /**
+// * Load configuration with custom file name.
+// */
+// protected void loadConfiguration() {
+// try {
+// config.parse();
+// } catch (ArgumentsParserException ex) {
+// if (log.isErrorEnabled()) {
+// log.error("Can't read configuration", ex);
+// }
+// }
+//
+// config.setOption(TopiaConfigurationConstants.CONFIG_PERSISTENCE_CLASSES,
+// LimaCallaoEntityEnum.getImplementationClassesAsString());
+// }
+
+ /**
+ * Lima option definition.
+ * <p/>
+ * Contains all lima configuration key, with defaut value and
+ * information for jaxx configuration frame ({@code #type},
+ * {@code #transientBoolean}, {@code #finalBoolean}...)
+ */
+ public enum ServiceConfigOption implements ConfigOptionDef {
+
+// CONFIG_FILE(CONFIG_FILE_NAME, n("lima.configFileName.description"), "lima.properties", String.class, true, true),
+ 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),
+ REPORTS_DIR("lima.reports.dir", n("lima.config.reports.dir.description"), "${lima.data.dir}/reports", 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"), "", String.class, false, false),
+ SCALE("lima.scale", n("lima.config.scale.description"), "2", String.class, false, false),
+ VAT_PDF_URL("lima.report.vatpdfurl", n("lima.config.reportvatpdfurl.description"), "default", String.class, false, false);
+
+ private final String key;
+
+ private final String description;
+
+ private String defaultValue;
+
+ private final Class<?> type;
+
+ private boolean transientBoolean;
+
+ private boolean finalBoolean;
+
+ ServiceConfigOption(String key, String description, String defaultValue,
+ Class<?> type, boolean transientBoolean, boolean finalBoolean) {
+ this.key = key;
+ this.description = description;
+ this.defaultValue = defaultValue;
+ this.type = type;
+ this.finalBoolean = finalBoolean;
+ this.transientBoolean = transientBoolean;
+ }
+
+ @Override
+ public boolean isFinal() {
+ return finalBoolean;
+ }
+
+ @Override
+ public void setFinal(boolean finalBoolean) {
+ this.finalBoolean = finalBoolean;
+ }
+
+ @Override
+ public boolean isTransient() {
+ return transientBoolean;
+ }
+
+ @Override
+ public void setTransient(boolean transientBoolean) {
+ this.transientBoolean = transientBoolean;
+ }
+
+ @Override
+ public String getDefaultValue() {
+ return defaultValue;
+ }
+
+ @Override
+ public void setDefaultValue(String defaultValue) {
+ this.defaultValue = defaultValue;
+ }
+
+ @Override
+ public String getDescription() {
+ return t(description);
+ }
+
+ @Override
+ public String getKey() {
+ return key;
+ }
+
+ @Override
+ public Class<?> getType() {
+ return type;
+ }
+ }
+
+}
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java 2014-09-19 15:21:43 UTC (rev 3921)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java 2014-09-25 15:25:32 UTC (rev 3922)
@@ -27,7 +27,7 @@
import org.apache.commons.lang.StringUtils;
import org.chorem.lima.business.AccountingRules;
-import org.chorem.lima.business.LimaConfig;
+import org.chorem.lima.business.LimaServiceConfig;
import org.chorem.lima.business.api.AccountService;
import org.chorem.lima.business.exceptions.AlreadyExistAccountException;
import org.chorem.lima.business.exceptions.InvalidAccountNumberException;
@@ -110,7 +110,7 @@
protected Account createNewAccount(Account account) throws InvalidAccountNumberException, NotNumberAccountNumberException, NotAllowedLabelException {
// check rules before create the account
- AccountingRules accountingRules = LimaConfig.getInstance().getAccountingRules();
+ AccountingRules accountingRules = LimaServiceConfig.getInstance().getAccountingRules();
accountingRules.createAccountRules(account);
// force uppercase account number
@@ -194,7 +194,7 @@
@Override
public void removeAccount(Account account) throws UsedAccountException {
- AccountingRules accountingRules = LimaConfig.getInstance().getAccountingRules();
+ AccountingRules accountingRules = LimaServiceConfig.getInstance().getAccountingRules();
// Check rules for account if have entries
accountingRules.removeAccountRules(account);
@@ -217,7 +217,7 @@
@Override
public Account updateAccount(Account account) throws InvalidAccountNumberException, NotNumberAccountNumberException {
- AccountingRules accountingRules = LimaConfig.getInstance().getAccountingRules();
+ AccountingRules accountingRules = LimaServiceConfig.getInstance().getAccountingRules();
// DAO
AccountTopiaDao accountDao = getDaoHelper().getAccountDao();
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/DocumentServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/DocumentServiceImpl.java 2014-09-19 15:21:43 UTC (rev 3921)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/DocumentServiceImpl.java 2014-09-25 15:25:32 UTC (rev 3922)
@@ -37,7 +37,7 @@
import org.chorem.lima.beans.GeneralEntryBooksDatas;
import org.chorem.lima.beans.GeneralEntryBooksDatasImpl;
import org.chorem.lima.beans.ReportsDatas;
-import org.chorem.lima.business.LimaConfig;
+import org.chorem.lima.business.LimaServiceConfig;
import org.chorem.lima.business.api.DocumentService;
import org.chorem.lima.business.api.FinancialStatementService;
import org.chorem.lima.business.api.IdentityService;
@@ -100,7 +100,7 @@
protected String path;
public DocumentServiceImpl() {
- path = LimaConfig.getInstance().getReportsDir().getAbsolutePath();
+ path = LimaServiceConfig.getInstance().getReportsDir().getAbsolutePath();
if (log.isDebugEnabled()) {
log.debug("Path : " + path);
@@ -718,7 +718,7 @@
String filePath = path + File.separator
+ DocumentsEnum.VAT.getFileName() + ".pdf";
- String path = LimaConfig.getInstance().getReportsDir().getAbsolutePath();
+ String path = LimaServiceConfig.getInstance().getReportsDir().getAbsolutePath();
String filePathDefault = path + File.separator
+ DocumentsEnum.VAT.getFileName() + "_default.pdf";
@@ -726,7 +726,7 @@
PDDocument doc;
InputStream reportsStream;
- String vatPDFUrl = LimaConfig.getInstance().getVatPDFUrl();
+ String vatPDFUrl = LimaServiceConfig.getInstance().getVatPDFUrl();
if (vatPDFUrl.equals("default")) {
reportsStream = DocumentServiceImpl.class
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/EntryBookServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/EntryBookServiceImpl.java 2014-09-19 15:21:43 UTC (rev 3921)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/EntryBookServiceImpl.java 2014-09-25 15:25:32 UTC (rev 3922)
@@ -26,7 +26,7 @@
package org.chorem.lima.business.ejb;
import org.chorem.lima.business.AccountingRules;
-import org.chorem.lima.business.LimaConfig;
+import org.chorem.lima.business.LimaServiceConfig;
import org.chorem.lima.business.api.EntryBookService;
import org.chorem.lima.business.exceptions.AlreadyExistEntryBookException;
import org.chorem.lima.business.exceptions.UsedEntryBookException;
@@ -149,7 +149,7 @@
public void removeEntryBook(EntryBook entryBook) throws UsedEntryBookException {
// check rule
- AccountingRules accountingRules = LimaConfig.getInstance().getAccountingRules();
+ AccountingRules accountingRules = LimaServiceConfig.getInstance().getAccountingRules();
accountingRules.removeEntryBookRules(entryBook);
// re-attach to current transaction
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialPeriodServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialPeriodServiceImpl.java 2014-09-19 15:21:43 UTC (rev 3921)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialPeriodServiceImpl.java 2014-09-25 15:25:32 UTC (rev 3922)
@@ -26,7 +26,7 @@
package org.chorem.lima.business.ejb;
import org.chorem.lima.business.AccountingRules;
-import org.chorem.lima.business.LimaConfig;
+import org.chorem.lima.business.LimaServiceConfig;
import org.chorem.lima.business.api.FinancialPeriodService;
import org.chorem.lima.business.exceptions.NotLockedClosedPeriodicEntryBooksException;
import org.chorem.lima.business.exceptions.UnbalancedFinancialTransactionsException;
@@ -95,7 +95,7 @@
@Override
public ClosedPeriodicEntryBook blockClosedPeriodicEntryBook(ClosedPeriodicEntryBook closedPeriodicEntryBook) throws UnbalancedFinancialTransactionsException, UnfilledEntriesException, WithoutEntryBookFinancialTransactionsException, NotLockedClosedPeriodicEntryBooksException {
- AccountingRules accountingRules = LimaConfig.getInstance().getAccountingRules();
+ AccountingRules accountingRules = LimaServiceConfig.getInstance().getAccountingRules();
ClosedPeriodicEntryBook result;
// check rules before create the account
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java 2014-09-19 15:21:43 UTC (rev 3921)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java 2014-09-25 15:25:32 UTC (rev 3922)
@@ -34,7 +34,7 @@
import org.chorem.lima.beans.FinancialTransactionCondition;
import org.chorem.lima.beans.LetteringFilter;
import org.chorem.lima.business.AccountingRules;
-import org.chorem.lima.business.LimaConfig;
+import org.chorem.lima.business.LimaServiceConfig;
import org.chorem.lima.business.api.AccountService;
import org.chorem.lima.business.api.FinancialTransactionService;
import org.chorem.lima.business.exceptions.AfterLastFiscalPeriodException;
@@ -107,7 +107,7 @@
public FinancialTransaction createFinancialTransaction(FinancialTransaction financialtransaction)
throws LockedFinancialPeriodException, LockedEntryBookException {
- AccountingRules accountingRules = LimaConfig.getInstance().getAccountingRules();
+ AccountingRules accountingRules = LimaServiceConfig.getInstance().getAccountingRules();
//check if the financial period is blocked
accountingRules.checkFinancialPeriodBlockedWithFinancialTransaction(financialtransaction);
@@ -315,7 +315,7 @@
}
- AccountingRules accountingRules = LimaConfig.getInstance().getAccountingRules();
+ AccountingRules accountingRules = LimaServiceConfig.getInstance().getAccountingRules();
//check rules
accountingRules.addLetter(oldEntries);
@@ -483,7 +483,7 @@
public void updateFinancialTransaction(FinancialTransaction financialTransaction)
throws AfterLastFiscalPeriodException, BeforeFirstFiscalPeriodException, LockedFinancialPeriodException, LockedEntryBookException {
- AccountingRules accountingRules = LimaConfig.getInstance().getAccountingRules();
+ AccountingRules accountingRules = LimaServiceConfig.getInstance().getAccountingRules();
FinancialTransactionTopiaDao transactionTopiaDao = getDaoHelper().getFinancialTransactionDao();
FinancialTransaction financialTransactionOld = transactionTopiaDao.forTopiaIdEquals(financialTransaction.getTopiaId()).findUnique();
@@ -492,9 +492,7 @@
financialTransactionOld.setEntryBook(financialTransaction.getEntryBook());
financialTransactionOld.setTransactionDate(financialTransaction.getTransactionDate());
-
transactionTopiaDao.update(financialTransactionOld);
-
}
/**
@@ -506,7 +504,7 @@
throws LockedFinancialPeriodException, LockedEntryBookException {
// check if the financial period is blocked
- AccountingRules accountingRules = LimaConfig.getInstance().getAccountingRules();
+ AccountingRules accountingRules = LimaServiceConfig.getInstance().getAccountingRules();
accountingRules.checkFinancialPeriodBlockedWithFinancialTransaction(financialTransaction);
FinancialTransactionTopiaDao transactionTopiaDao = getDaoHelper().getFinancialTransactionDao();
@@ -523,7 +521,7 @@
@Override
public Entry createEntry(Entry entry) throws LockedFinancialPeriodException, LockedEntryBookException {
- AccountingRules accountingRules = LimaConfig.getInstance().getAccountingRules();
+ AccountingRules accountingRules = LimaServiceConfig.getInstance().getAccountingRules();
//check if the financial period is blocked
accountingRules.checkFinancialPeriodBlockedWithFinancialTransaction(
@@ -541,7 +539,7 @@
@Override
public void updateEntry(Entry entry) throws LockedEntryBookException {
- AccountingRules accountingRules = LimaConfig.getInstance().getAccountingRules();
+ AccountingRules accountingRules = LimaServiceConfig.getInstance().getAccountingRules();
EntryTopiaDao entryTopiaDao = getDaoHelper().getEntryDao();
@@ -563,7 +561,7 @@
@Override
public void removeEntry(Entry entry) throws LockedFinancialPeriodException, LockedEntryBookException {
- AccountingRules accountingRules = LimaConfig.getInstance().getAccountingRules();
+ AccountingRules accountingRules = LimaServiceConfig.getInstance().getAccountingRules();
FinancialTransaction financialTransaction = entry.getFinancialTransaction();
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java 2014-09-19 15:21:43 UTC (rev 3921)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java 2014-09-25 15:25:32 UTC (rev 3922)
@@ -30,7 +30,7 @@
import org.chorem.lima.beans.BalanceTrial;
import org.chorem.lima.beans.ReportsDatas;
import org.chorem.lima.business.AccountingRules;
-import org.chorem.lima.business.LimaConfig;
+import org.chorem.lima.business.LimaServiceConfig;
import org.chorem.lima.business.api.AccountService;
import org.chorem.lima.business.api.EntryBookService;
import org.chorem.lima.business.api.FinancialPeriodService;
@@ -115,7 +115,7 @@
FiscalPeriodTopiaDao fiscalPeriodTopiaDao = getDaoHelper().getFiscalPeriodDao();
- AccountingRules accountingRules = LimaConfig.getInstance().getAccountingRules();
+ AccountingRules accountingRules = LimaServiceConfig.getInstance().getAccountingRules();
// fix begin date at midnight and end date at 23:59:59.999
Date beginDate = fiscalPeriod.getBeginDate();
@@ -227,7 +227,7 @@
public FiscalPeriod blockFiscalPeriod(FiscalPeriod fiscalPeriod)
throws AlreadyLockedFiscalPeriodException, LastUnlockedFiscalPeriodException {
- AccountingRules accountingRules = LimaConfig.getInstance().getAccountingRules();
+ AccountingRules accountingRules = LimaServiceConfig.getInstance().getAccountingRules();
if (fiscalPeriod.isLocked()) {
throw new AlreadyLockedFiscalPeriodException(fiscalPeriod);
@@ -489,7 +489,7 @@
@Override
public void deleteFiscalPeriod(FiscalPeriod fiscalPeriod) throws NoEmptyFiscalPeriodException {
- AccountingRules accountingRules = LimaConfig.getInstance().getAccountingRules();
+ AccountingRules accountingRules = LimaServiceConfig.getInstance().getAccountingRules();
//get entities with TopiaDao
FiscalPeriodTopiaDao fiscalPeriodTopiaDao = getDaoHelper().getFiscalPeriodDao();
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/HttpServerServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/HttpServerServiceImpl.java 2014-09-19 15:21:43 UTC (rev 3921)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/HttpServerServiceImpl.java 2014-09-25 15:25:32 UTC (rev 3922)
@@ -31,7 +31,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.LimaConfig;
+import org.chorem.lima.business.LimaServiceConfig;
import org.chorem.lima.business.api.AccountService;
import org.chorem.lima.business.api.DocumentService;
import org.chorem.lima.business.api.HttpServerService;
@@ -89,8 +89,8 @@
private static final SimpleDateFormat DATEFORMAT = new SimpleDateFormat("yyyy-MM-dd");
public HttpServerServiceImpl() {
- path = LimaConfig.getInstance().getReportsDir().getAbsolutePath();
- port = LimaConfig.getInstance().getHttpPort();
+ path = LimaServiceConfig.getInstance().getReportsDir().getAbsolutePath();
+ port = LimaServiceConfig.getInstance().getHttpPort();
}
/** start the server */
@@ -129,7 +129,7 @@
public class MainServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
- private String serverAddressConfig = LimaConfig.getInstance().getAddressServer();
+ private String serverAddressConfig = LimaServiceConfig.getInstance().getAddressServer();
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
@@ -266,7 +266,7 @@
+ ":" + req.getServerPort();
} else {
serverAdress += serverAddressConfig + ":"
- + LimaConfig.getInstance().getHttpPort();
+ + LimaServiceConfig.getInstance().getHttpPort();
}
Calendar calendar = Calendar.getInstance();
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/OptionsServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/OptionsServiceImpl.java 2014-09-19 15:21:43 UTC (rev 3921)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/OptionsServiceImpl.java 2014-09-25 15:25:32 UTC (rev 3922)
@@ -24,7 +24,7 @@
*/
package org.chorem.lima.business.ejb;
-import org.chorem.lima.business.LimaConfig;
+import org.chorem.lima.business.LimaServiceConfig;
import org.chorem.lima.business.api.OptionsService;
import javax.ejb.Remote;
@@ -39,8 +39,8 @@
protected String vatPDFUrl;
public OptionsServiceImpl() {
- scale = LimaConfig.getInstance().getScale();
- vatPDFUrl = LimaConfig.getInstance().getVatPDFUrl();
+ scale = LimaServiceConfig.getInstance().getScale();
+ vatPDFUrl = LimaServiceConfig.getInstance().getVatPDFUrl();
}
public int getScale() {
@@ -52,7 +52,7 @@
}
public void setScale(String scale) {
- LimaConfig.getInstance().setScale(scale);
+ LimaServiceConfig.getInstance().setScale(scale);
}
public String getVatPDFUrl() {
@@ -60,7 +60,7 @@
}
public void setVatPDFUrl(String url) {
- LimaConfig.getInstance().setVatPDFUrl(url);
+ LimaServiceConfig.getInstance().setVatPDFUrl(url);
}
}
Modified: trunk/lima-business/src/main/resources/i18n/lima-business_en_GB.properties
===================================================================
--- trunk/lima-business/src/main/resources/i18n/lima-business_en_GB.properties 2014-09-19 15:21:43 UTC (rev 3921)
+++ trunk/lima-business/src/main/resources/i18n/lima-business_en_GB.properties 2014-09-25 15:25:32 UTC (rev 3922)
@@ -1,3 +1,4 @@
+application.version=
lima-Business.defaultaccountingrules.updateentryerror=Can't update entry \: financialperiod of this entrybook is closed
lima-Business.defaultaccountingrules.updatefinancialtransactionnewperioderror=Can't update financialtransaction \: this financialperiod of new entrybook is closed
lima-Business.defaultaccountingrules.updatefinancialtransactionperioderror=Can't update financialtransaction \: the new financialperiod of this entrybook is closed
@@ -139,6 +140,7 @@
lima.reports.account.noaccount=
lima.reports.account.noaccounttitle=
lima.reports.accounts=
+lima.services.application.version=
lima.table.credit=
lima.table.date=
lima.table.debit=
Modified: trunk/lima-business/src/main/resources/i18n/lima-business_fr_FR.properties
===================================================================
--- trunk/lima-business/src/main/resources/i18n/lima-business_fr_FR.properties 2014-09-19 15:21:43 UTC (rev 3921)
+++ trunk/lima-business/src/main/resources/i18n/lima-business_fr_FR.properties 2014-09-25 15:25:32 UTC (rev 3922)
@@ -1,3 +1,4 @@
+application.version=
lima-Business.defaultaccountingrules.updateentryerror=Impossible de mettre à jour l'entrée \: la période financière de ce journal est bloquée
lima-Business.defaultaccountingrules.updatefinancialtransactionnewperioderror=Impossible de mettre à jour la transaction \: la période financière de ce nouveau journal est bloquée
lima-Business.defaultaccountingrules.updatefinancialtransactionperioderror=Impossible de mettre à jour la transaction \: la période financière de ce journal est bloquée
@@ -134,6 +135,7 @@
lima.reports.account.noaccount=
lima.reports.account.noaccounttitle=
lima.reports.accounts=
+lima.services.application.version=
lima.table.credit=
lima.table.date=
lima.table.debit=
Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/AbstractLimaTest.java
===================================================================
--- trunk/lima-business/src/test/java/org/chorem/lima/business/AbstractLimaTest.java 2014-09-19 15:21:43 UTC (rev 3921)
+++ trunk/lima-business/src/test/java/org/chorem/lima/business/AbstractLimaTest.java 2014-09-25 15:25:32 UTC (rev 3922)
@@ -27,7 +27,6 @@
import com.google.common.collect.Lists;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.chorem.lima.business.accountingrules.TestAccountingRules;
import org.chorem.lima.business.api.AccountService;
import org.chorem.lima.business.api.EntryBookService;
import org.chorem.lima.business.api.EntryService;
@@ -88,6 +87,7 @@
};
protected static DateFormat df = DateFormat.getDateInstance(DateFormat.LONG, Locale.ENGLISH);
+ protected static final String LIMA_TEST_DEFAULT_CONF_FILENAME = "lima-test.properties";
protected AccountService accountService;
protected EntryBookService entryBookService;
@@ -114,9 +114,9 @@
public void initAbstractTest() throws Exception {
setUpLocale();
Properties options = getTestConfiguration();
- LimaConfig config = new LimaTestsConfig("/lima-test.properties", options);
- initServices(config);
- context = getTestContext(options);
+ LimaServiceConfig limaTestConfig = new LimaTestsConfig(LIMA_TEST_DEFAULT_CONF_FILENAME, options);
+ initServices(limaTestConfig);
+ context = createNewTestApplicationContext();
}
protected void setUpLocale() throws Exception {
@@ -127,7 +127,7 @@
* Init services after i18n#init().
* @throws java.io.IOException
*/
- protected void initServices(LimaConfig config) throws IOException {
+ protected void initServices(LimaServiceConfig config) throws IOException {
if(accountService == null) {
LimaServiceFactory.initFactory(config.getConfig());
accountService = LimaServiceFactory.getService(AccountService.class);
@@ -158,21 +158,11 @@
// load file manually (lima.properties)
Properties testProperties = new Properties();
// override somes
- testProperties.setProperty(LimaConfig.ServiceConfigOption.CONFIG_FILE.getKey(), "/lima-test.properties");
String testDir = System.getProperty("java.io.tmpdir") + File.separator + "lima-business-" + UUID.randomUUID().toString();
- testProperties.setProperty(LimaConfig.ServiceConfigOption.DATA_DIR.getKey(), testDir);
- testProperties.setProperty(Environment.HBM2DDL_AUTO, "update");
- testProperties.setProperty(Environment.DIALECT, "org.hibernate.dialect.H2Dialect");
- testProperties.setProperty(Environment.DRIVER, "org.h2.Driver");
-
+ testProperties.setProperty(LimaServiceConfig.ServiceConfigOption.DATA_DIR.getKey(), testDir);
testProperties.setProperty(Environment.URL, "jdbc:h2:file:" + testDir + File.separator + "data");
- testProperties.setProperty(Environment.USER, "sa");
- testProperties.setProperty(Environment.PASS, "");
testProperties.setProperty(Environment.CURRENT_SESSION_CONTEXT_CLASS, "thread");
-
-
testProperties.setProperty("topia.persistence.classes", LimaCallaoEntityEnum.getImplementationClassesAsString());
- testProperties.setProperty(LimaConfig.ServiceConfigOption.RULES_NATIONALTY.getKey(), TestAccountingRules.class.getName());
return testProperties;
}
@@ -181,22 +171,23 @@
//context.dropSchema();
}
+
/**
* Method to use only for class that need a context to be tester.
* Only for DOA for now.
*
* @return a topia context
*/
- protected LimaCallaoTopiaApplicationContext getTestContext(Properties options) {
+ protected LimaCallaoTopiaApplicationContext getTestApplicationContext(Properties options) {
log.info("Opening context to database : " + options.getProperty("hibernate.connection.url"));
LimaCallaoTopiaApplicationContext result = TopiaApplicationContextCache.getContext(options, CREATE_CONTEXT_FUNCTION);
return result;
}
- protected LimaCallaoTopiaApplicationContext createNewTestContext() {
- Properties options = getTestConfiguration();
- LimaCallaoTopiaApplicationContext result = getTestContext(options);
+ protected LimaCallaoTopiaApplicationContext createNewTestApplicationContext() {
+ Properties options = LimaServiceConfig.getInstance().getFlatOptions();
+ LimaCallaoTopiaApplicationContext result = getTestApplicationContext(options);
return result;
}
Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/FinancialPeriodServiceImplTest.java
===================================================================
--- trunk/lima-business/src/test/java/org/chorem/lima/business/FinancialPeriodServiceImplTest.java 2014-09-19 15:21:43 UTC (rev 3921)
+++ trunk/lima-business/src/test/java/org/chorem/lima/business/FinancialPeriodServiceImplTest.java 2014-09-25 15:25:32 UTC (rev 3922)
@@ -32,6 +32,8 @@
import org.junit.Before;
import org.junit.Test;
+import java.util.List;
+
/**
* Tests pour la gestion des timespans
* <p/>
@@ -48,7 +50,7 @@
@Before
public void initTest() throws Exception {
- initTestDatabase();
+ //initTestDatabase();
}
/**
@@ -58,14 +60,14 @@
*/
@Test
public void blockClosedPeriodicEntryBookTest() throws Exception {
-
initTestWithFinancialTransaction();
// find one closed to close
LimaCallaoTopiaPersistenceContext tcontext = context.newPersistenceContext();
ClosedPeriodicEntryBookTopiaDao dao = tcontext.getClosedPeriodicEntryBookDao();
- ClosedPeriodicEntryBook closedPeriodic = dao.findAll().get(0);
+ List<ClosedPeriodicEntryBook> closedPeriodics = dao.findAll();
tcontext.close();
+ ClosedPeriodicEntryBook closedPeriodic = closedPeriodics.get(0);
// block it
Assert.assertFalse(closedPeriodic.isLocked());
Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/LimaMiscTest.java
===================================================================
--- trunk/lima-business/src/test/java/org/chorem/lima/business/LimaMiscTest.java 2014-09-19 15:21:43 UTC (rev 3921)
+++ trunk/lima-business/src/test/java/org/chorem/lima/business/LimaMiscTest.java 2014-09-25 15:25:32 UTC (rev 3922)
@@ -23,10 +23,12 @@
package org.chorem.lima.business;
-import org.chorem.lima.business.accountingrules.FranceAccountingRules;
+import org.chorem.lima.business.accountingrules.DefaultAccountingRules;
import org.junit.Assert;
import org.junit.Test;
+import java.util.Properties;
+
/**
* Lima misc tests.
*
@@ -38,14 +40,19 @@
*/
public class LimaMiscTest extends AbstractLimaTest {
+ protected Properties getTestConfiguration() {
+ Properties config = super.getTestConfiguration();
+ config.setProperty(LimaServiceConfig.ServiceConfigOption.RULES_NATIONALTY.getKey(), DefaultAccountingRules.class.getName());
+ return config;
+ }
/**
* Test que la regles de nationnalité par defaut est Default pour
* la majorité des tests.
*/
@Test
public void testDefaultRule() {
- Assert.assertFalse(LimaConfig.getInstance().getAccountingRules()
- instanceof FranceAccountingRules);
+ Assert.assertTrue(LimaServiceConfig.getInstance().getAccountingRules()
+ instanceof DefaultAccountingRules);
}
}
Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/LimaTestsConfig.java
===================================================================
--- trunk/lima-business/src/test/java/org/chorem/lima/business/LimaTestsConfig.java 2014-09-19 15:21:43 UTC (rev 3921)
+++ trunk/lima-business/src/test/java/org/chorem/lima/business/LimaTestsConfig.java 2014-09-25 15:25:32 UTC (rev 3922)
@@ -22,38 +22,25 @@
* #L%
*/
-import org.apache.commons.lang3.StringUtils;
-import org.chorem.lima.LimaTechnicalException;
import org.nuiton.config.ApplicationConfig;
-import org.nuiton.config.ArgumentsParserException;
+import java.util.Map;
import java.util.Properties;
/**
* Created by davidcosse on 11/06/14.
*/
-public class LimaTestsConfig extends LimaConfig {
+public class LimaTestsConfig extends LimaServiceConfig {
- public LimaTestsConfig(String configFileName, Properties properties) {
- try {
- accountingRules = null;
- ApplicationConfig defaultConfig = new ApplicationConfig(LIMA_DEFAULT_CONF_FILENAME);
- defaultConfig.loadDefaultOptions(ServiceConfigOption.values());
- defaultConfig.parse();
- if (StringUtils.isNotBlank(configFileName)) {
- Properties flatOptions = defaultConfig.getFlatOptions(false);
- flatOptions.putAll(properties);
- config = new ApplicationConfig(flatOptions, configFileName);
- config.parse();
- } else {
- if (log.isWarnEnabled()) {
- log.warn("No specific configuration provided, using the default one");
- }
- config = defaultConfig;
- }
- instance = this;
- } catch (ArgumentsParserException ex) {
- throw new LimaTechnicalException("Can't read configuration", ex);
+ public LimaTestsConfig(String configFileName, Properties limaTestConfig) {
+ super(configFileName);
+ Properties standardLimaConfig = config.getFlatOptions();
+
+ for (Map.Entry<Object, Object> entry : limaTestConfig.entrySet()) {
+ standardLimaConfig.setProperty((String)entry.getKey(),(String)entry.getValue());
}
+ config = new ApplicationConfig(standardLimaConfig);
+ instance = this;
}
+
}
Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/AccountServiceRuleFrTest.java
===================================================================
--- trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/AccountServiceRuleFrTest.java 2014-09-19 15:21:43 UTC (rev 3921)
+++ trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/AccountServiceRuleFrTest.java 2014-09-25 15:25:32 UTC (rev 3922)
@@ -24,7 +24,7 @@
package org.chorem.lima.business.accountingrules;
import org.chorem.lima.business.AccountServiceImplTest;
-import org.chorem.lima.business.LimaConfig;
+import org.chorem.lima.business.LimaServiceConfig;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -46,16 +46,16 @@
@Before
public void installFrenchRule() throws Exception {
- LimaConfig.getInstance().setAccountingRule(FranceAccountingRules.class.getName());
+ LimaServiceConfig.getInstance().setAccountingRule(FranceAccountingRules.class.getName());
}
/**
* Test une fois que la regles est correctement instanciée car
- * elle peut être mise en cache dans {@link LimaConfig}.
+ * elle peut être mise en cache dans {@link org.chorem.lima.business.LimaServiceConfig}.
*/
@Test
public void testRuleInstance() {
- Assert.assertTrue(LimaConfig.getInstance().getAccountingRules() instanceof FranceAccountingRules);
+ Assert.assertTrue(LimaServiceConfig.getInstance().getAccountingRules() instanceof FranceAccountingRules);
}
}
Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/EntryBookServiceRuleFrTest.java
===================================================================
--- trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/EntryBookServiceRuleFrTest.java 2014-09-19 15:21:43 UTC (rev 3921)
+++ trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/EntryBookServiceRuleFrTest.java 2014-09-25 15:25:32 UTC (rev 3922)
@@ -24,7 +24,7 @@
package org.chorem.lima.business.accountingrules;
import org.chorem.lima.business.EntryBookServiceImplTest;
-import org.chorem.lima.business.LimaConfig;
+import org.chorem.lima.business.LimaServiceConfig;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -46,15 +46,15 @@
@Before
public void installFrenchRule() throws Exception {
- LimaConfig.getInstance().setAccountingRule(FranceAccountingRules.class.getName());
+ LimaServiceConfig.getInstance().setAccountingRule(FranceAccountingRules.class.getName());
}
/**
* Test une fois que la regles est correctement instanciée car
- * elle peut être mise en cache dans {@link LimaConfig}.
+ * elle peut être mise en cache dans {@link org.chorem.lima.business.LimaServiceConfig}.
*/
@Test
public void testRuleInstance() {
- Assert.assertTrue(LimaConfig.getInstance().getAccountingRules() instanceof FranceAccountingRules);
+ Assert.assertTrue(LimaServiceConfig.getInstance().getAccountingRules() instanceof FranceAccountingRules);
}
}
Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/FinancialPeriodServiceRuleFrTest.java
===================================================================
--- trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/FinancialPeriodServiceRuleFrTest.java 2014-09-19 15:21:43 UTC (rev 3921)
+++ trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/FinancialPeriodServiceRuleFrTest.java 2014-09-25 15:25:32 UTC (rev 3922)
@@ -24,7 +24,7 @@
package org.chorem.lima.business.accountingrules;
import org.chorem.lima.business.EntryBookServiceImplTest;
-import org.chorem.lima.business.LimaConfig;
+import org.chorem.lima.business.LimaServiceConfig;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -46,15 +46,15 @@
@Before
public void installFrenchRule() throws Exception {
- LimaConfig.getInstance().setAccountingRule(FranceAccountingRules.class.getName());
+ LimaServiceConfig.getInstance().setAccountingRule(FranceAccountingRules.class.getName());
}
/**
* Test une fois que la regles est correctement instanciée car
- * elle peut être mise en cache dans {@link LimaConfig}.
+ * elle peut être mise en cache dans {@link org.chorem.lima.business.LimaServiceConfig}.
*/
@Test
public void testRuleInstance() {
- Assert.assertTrue(LimaConfig.getInstance().getAccountingRules() instanceof FranceAccountingRules);
+ Assert.assertTrue(LimaServiceConfig.getInstance().getAccountingRules() instanceof FranceAccountingRules);
}
}
Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/FinancialTransactionServiceRuleFrTest.java
===================================================================
--- trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/FinancialTransactionServiceRuleFrTest.java 2014-09-19 15:21:43 UTC (rev 3921)
+++ trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/FinancialTransactionServiceRuleFrTest.java 2014-09-25 15:25:32 UTC (rev 3922)
@@ -24,7 +24,7 @@
package org.chorem.lima.business.accountingrules;
import org.chorem.lima.business.FinancialTransactionServiceImplTest;
-import org.chorem.lima.business.LimaConfig;
+import org.chorem.lima.business.LimaServiceConfig;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -46,15 +46,15 @@
@Before
public void installFrenchRule() throws Exception {
- LimaConfig.getInstance().setAccountingRule(FranceAccountingRules.class.getName());
+ LimaServiceConfig.getInstance().setAccountingRule(FranceAccountingRules.class.getName());
}
/**
* Test une fois que la regles est correctement instanciée car
- * elle peut être mise en cache dans {@link LimaConfig}.
+ * elle peut être mise en cache dans {@link org.chorem.lima.business.LimaServiceConfig}.
*/
@Test
public void testRuleInstance() {
- Assert.assertTrue(LimaConfig.getInstance().getAccountingRules() instanceof FranceAccountingRules);
+ Assert.assertTrue(LimaServiceConfig.getInstance().getAccountingRules() instanceof FranceAccountingRules);
}
}
Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/FiscalPeriodServiceRuleFrTest.java
===================================================================
--- trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/FiscalPeriodServiceRuleFrTest.java 2014-09-19 15:21:43 UTC (rev 3921)
+++ trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/FiscalPeriodServiceRuleFrTest.java 2014-09-25 15:25:32 UTC (rev 3922)
@@ -24,7 +24,7 @@
package org.chorem.lima.business.accountingrules;
import org.chorem.lima.business.FiscalPeriodServiceImplTest;
-import org.chorem.lima.business.LimaConfig;
+import org.chorem.lima.business.LimaServiceConfig;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -46,15 +46,15 @@
@Before
public void installFrenchRule() throws Exception {
- LimaConfig.getInstance().setAccountingRule(FranceAccountingRules.class.getName());
+ LimaServiceConfig.getInstance().setAccountingRule(FranceAccountingRules.class.getName());
}
/**
* Test une fois que la regles est correctement instanciée car
- * elle peut être mise en cache dans {@link LimaConfig}.
+ * elle peut être mise en cache dans {@link org.chorem.lima.business.LimaServiceConfig}.
*/
@Test
public void testRuleInstance() {
- Assert.assertTrue(LimaConfig.getInstance().getAccountingRules() instanceof FranceAccountingRules);
+ Assert.assertTrue(LimaServiceConfig.getInstance().getAccountingRules() instanceof FranceAccountingRules);
}
}
Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/ImportServiceRuleFrTest.java
===================================================================
--- trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/ImportServiceRuleFrTest.java 2014-09-19 15:21:43 UTC (rev 3921)
+++ trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/ImportServiceRuleFrTest.java 2014-09-25 15:25:32 UTC (rev 3922)
@@ -23,9 +23,9 @@
package org.chorem.lima.business.accountingrules;
+import org.chorem.lima.business.AbstractLimaTest;
import org.chorem.lima.business.AccountingRules;
-import org.chorem.lima.business.ImportExportServiceTest;
-import org.chorem.lima.business.LimaConfig;
+import org.chorem.lima.business.LimaServiceConfig;
import org.junit.Assert;
import org.junit.Test;
@@ -44,22 +44,21 @@
* Last update : $Date$
* By : $Author$
*/
-public class ImportServiceRuleFrTest extends ImportExportServiceTest {
+public class ImportServiceRuleFrTest extends AbstractLimaTest {
protected Properties getTestConfiguration() {
Properties config = super.getTestConfiguration();
- config.remove(LimaConfig.ServiceConfigOption.RULES_NATIONALTY.getKey());
- config.put(LimaConfig.ServiceConfigOption.RULES_NATIONALTY.getKey(), FranceAccountingRules.class.getName());
+ config.setProperty(LimaServiceConfig.ServiceConfigOption.RULES_NATIONALTY.getKey(), FranceAccountingRules.class.getName());
return config;
}
/**
* Test une fois que la regles est correctement instanciée car
- * elle peut être mise en cache dans {@link LimaConfig}.
+ * elle peut être mise en cache dans {@link org.chorem.lima.business.LimaServiceConfig}.
*/
@Test
public void testRuleInstance() throws Exception {
- AccountingRules accountingRules = LimaConfig.getInstance().getAccountingRules();
+ AccountingRules accountingRules = LimaServiceConfig.getInstance().getAccountingRules();
Assert.assertTrue("accountingRules:" + accountingRules,accountingRules instanceof FranceAccountingRules);
}
}
Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/ReportServiceRuleFrTest.java
===================================================================
--- trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/ReportServiceRuleFrTest.java 2014-09-19 15:21:43 UTC (rev 3921)
+++ trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/ReportServiceRuleFrTest.java 2014-09-25 15:25:32 UTC (rev 3922)
@@ -23,7 +23,7 @@
package org.chorem.lima.business.accountingrules;
-import org.chorem.lima.business.LimaConfig;
+import org.chorem.lima.business.LimaServiceConfig;
import org.chorem.lima.business.ReportServiceImplTest;
import org.junit.Assert;
import org.junit.BeforeClass;
@@ -50,15 +50,15 @@
@BeforeClass
public static void installFrenchRule() throws Exception {
- LimaConfig.getInstance().setAccountingRule(FranceAccountingRules.class.getName());
+ LimaServiceConfig.getInstance().setAccountingRule(FranceAccountingRules.class.getName());
}
/**
* Test une fois que la regles est correctement instanciée car
- * elle peut être mise en cache dans {@link LimaConfig}.
+ * elle peut être mise en cache dans {@link org.chorem.lima.business.LimaServiceConfig}.
*/
@Test
public void testRuleInstance() {
- Assert.assertTrue(LimaConfig.getInstance().getAccountingRules() instanceof FranceAccountingRules);
+ Assert.assertTrue(LimaServiceConfig.getInstance().getAccountingRules() instanceof FranceAccountingRules);
}
}
Modified: trunk/lima-business/src/test/resources/lima-test.properties
===================================================================
--- trunk/lima-business/src/test/resources/lima-test.properties 2014-09-19 15:21:43 UTC (rev 3921)
+++ trunk/lima-business/src/test/resources/lima-test.properties 2014-09-25 15:25:32 UTC (rev 3922)
@@ -31,3 +31,5 @@
hibernate.connection.password=
hibernate.connection.driver_class=org.h2.Driver
hibernate.hbm2ddl.auto=update
+# Topia should not create the schema
+topia.persistence.initSchema=false
Added: trunk/lima-callao/src/main/java/org/chorem/lima/entity/LimaCallaoTopiaApplicationContext.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/entity/LimaCallaoTopiaApplicationContext.java (rev 0)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/entity/LimaCallaoTopiaApplicationContext.java 2014-09-25 15:25:32 UTC (rev 3922)
@@ -0,0 +1,20 @@
+package org.chorem.lima.entity;
+
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+
+public class LimaCallaoTopiaApplicationContext extends AbstractLimaCallaoTopiaApplicationContext {
+
+ public LimaCallaoTopiaApplicationContext(Properties properties) {
+ super(properties);
+ }
+
+ public LimaCallaoTopiaApplicationContext(Map<String, String> configuration) {
+ super(configuration);
+ }
+
+ public Set<org.nuiton.topia.persistence.TopiaPersistenceContext> getPersistenceContexts() {
+ return persistenceContexts;
+ }
+} //LimaCallaoTopiaApplicationContext
Deleted: trunk/lima-swing/src/main/java/org/chorem/lima/LimaContext.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/LimaContext.java 2014-09-19 15:21:43 UTC (rev 3921)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/LimaContext.java 2014-09-25 15:25:32 UTC (rev 3922)
@@ -1,162 +0,0 @@
-/*
- * #%L
- * Lima Swing
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2008 - 2012 CodeLutin, Chatellier Eric
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-package org.chorem.lima;
-
-import jaxx.runtime.JAXXUtil;
-import jaxx.runtime.context.DefaultApplicationContext;
-import jaxx.runtime.context.JAXXContextEntryDef;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.chorem.lima.ui.LimaDecoratorProvider;
-import org.chorem.lima.ui.MainView;
-import org.chorem.lima.ui.MainViewHandler;
-import org.nuiton.decorator.DecoratorProvider;
-import org.nuiton.i18n.I18n;
-import org.nuiton.i18n.init.DefaultI18nInitializer;
-import org.nuiton.i18n.init.I18nInitializer;
-import org.nuiton.util.StringUtil;
-
-import java.util.Locale;
-
-/** @author chemit */
-public class LimaContext extends DefaultApplicationContext {
-
- /** to use log facility, just put in your code: log.info(\"...\"); */
- static private Log log = LogFactory.getLog(LimaContext.class);
-
- /**
- * l'intance partagée accessible après un appel à la méthode
- * {@link #init()}
- */
- protected static LimaContext instance;
-
- public static JAXXContextEntryDef<MainView> MAIN_UI_ENTRY_DEF = JAXXUtil.newContextEntryDef("mainUI", MainView.class);
-
- public static JAXXContextEntryDef<DecoratorProvider> DECORATOR_PROVIDER_DEF = JAXXUtil.newContextEntryDef("decoratorProvider", DecoratorProvider.class);
-
- public static JAXXContextEntryDef<LimaConfig> CONFIG_DEF = JAXXUtil.newContextEntryDef("limaConfig", LimaConfig.class);
-
- /**
- * @return <code>true</code> si le context a été initialisé via la méthode
- * {@link #init()}, <ocde>false</code> autrement.
- */
- public static boolean isInit() {
- return instance != null;
- }
-
- /**
- * Permet l'initialisation du contexte applicatif et positionne
- * l'instance partagée.
- * <p/>
- * Note : Cette méthode ne peut être appelée qu'une seule fois.
- *
- * @return l'instance partagée
- * @throws IllegalStateException si un contexte applicatif a déja été positionné.
- */
- public static LimaContext init() throws IllegalStateException {
- if (isInit()) {
- throw new IllegalStateException("there is already a application context registred.");
- }
- instance = new LimaContext();
- instance.setContextValue(new MainViewHandler());
- CONFIG_DEF.setContextValue(instance, LimaConfig.getInstance());
- DECORATOR_PROVIDER_DEF.setContextValue(instance, new LimaDecoratorProvider());
- return instance;
- }
-
- /**
- * Récupération du contexte applicatif.
- *
- * @return l'instance partagé du contexte.
- * @throws IllegalStateException si le contexte n'a pas été initialisé via
- * la méthode {@link #init()}
- */
- public static LimaContext get() throws IllegalStateException {
- if (!isInit()) {
- throw new IllegalStateException("no application context registred.");
- }
- return instance;
- }
-
- public LimaConfig getConfig() {
- return CONFIG_DEF.getContextValue(this);
- }
-
- public DecoratorProvider getDecoratorProvider() {
- return DECORATOR_PROVIDER_DEF.getContextValue(this);
- }
-
- public void initI18n(LimaConfig config) {
-
- I18n.close();
-
- I18nInitializer i18nInitializer = new DefaultI18nInitializer("lima");
- Locale locale = config.getLocale();
- I18n.init(i18nInitializer, locale);
-
- // Default Locale for DatePicker
- Locale.setDefault(locale);
-
- long t00 = System.nanoTime();
-
- if (log.isDebugEnabled()) {
- log.debug("i18n language : " + locale);
- log.debug("i18n loading time : " +
- StringUtil.convertTime(t00, System.nanoTime()));
- }
- }
-
- public MainView getMainUI() {
- return MAIN_UI_ENTRY_DEF.getContextValue(this);
- }
-
- /**
- * close the application's context.
- *
- * @throws Exception if any pb while closing
- */
- public void close() throws Exception {
- if (log.isDebugEnabled()) {
- log.debug("closing context " + this);
- }
-
- // fermeture du context principal
- MainView mainUI = getMainUI();
- if (mainUI != null && mainUI.isVisible()) {
- mainUI.setVisible(false);
- mainUI.dispose();
- }
-
- if (log.isDebugEnabled()) {
- log.debug("context closed " + this);
- }
- //System.exit(0);
- }
-
- public static LimaContext getContext() {
- return get();
- }
-}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java 2014-09-19 15:21:43 UTC (rev 3921)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java 2014-09-25 15:25:32 UTC (rev 3922)
@@ -72,7 +72,7 @@
}
// init root context
- LimaContext context = init(args);
+ LimaSwingApplicationContext context = init(args);
// do actions
config = context.getConfig();
@@ -98,7 +98,7 @@
* @return le context de l'application
* @throws Exception pour toute erreur pendant l'init
*/
- public static LimaContext init(String... args) throws Exception {
+ public static LimaSwingApplicationContext init(String... args) throws Exception {
// update splash
splash = new LimaSplash();
@@ -111,7 +111,7 @@
Runtime.getRuntime().addShutdownHook(new ShutdownHook());
// init root context
- LimaContext context = LimaContext.init();
+ LimaSwingApplicationContext context = LimaSwingApplicationContext.init();
LimaConfig config = context.getConfig();
config.parse(args);
context.initI18n(config);
@@ -119,7 +119,7 @@
return context;
}
- protected static void launch(LimaContext context) throws Exception {
+ protected static void launch(LimaSwingApplicationContext context) throws Exception {
// prepare ui look&feel and load ui properties
try {
@@ -182,7 +182,7 @@
@Override
public void run() {
try {
- LimaContext.get().close();
+ LimaSwingApplicationContext.get().close();
LimaServiceFactory.destroy();
// force to kill main thread
Copied: trunk/lima-swing/src/main/java/org/chorem/lima/LimaSwingApplicationContext.java (from rev 3921, trunk/lima-swing/src/main/java/org/chorem/lima/LimaContext.java)
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/LimaSwingApplicationContext.java (rev 0)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/LimaSwingApplicationContext.java 2014-09-25 15:25:32 UTC (rev 3922)
@@ -0,0 +1,169 @@
+/*
+ * #%L
+ * Lima Swing
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2008 - 2012 CodeLutin, Chatellier Eric
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+package org.chorem.lima;
+
+import jaxx.runtime.JAXXUtil;
+import jaxx.runtime.context.DefaultApplicationContext;
+import jaxx.runtime.context.JAXXContextEntryDef;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.chorem.lima.business.LimaServiceConfig;
+import org.chorem.lima.ui.LimaDecoratorProvider;
+import org.chorem.lima.ui.MainView;
+import org.chorem.lima.ui.MainViewHandler;
+import org.nuiton.decorator.DecoratorProvider;
+import org.nuiton.i18n.I18n;
+import org.nuiton.i18n.init.DefaultI18nInitializer;
+import org.nuiton.i18n.init.I18nInitializer;
+import org.nuiton.util.StringUtil;
+
+import java.util.Locale;
+
+/** @author chemit */
+public class LimaSwingApplicationContext extends DefaultApplicationContext {
+
+ /** to use log facility, just put in your code: log.info(\"...\"); */
+ static private Log log = LogFactory.getLog(LimaSwingApplicationContext.class);
+
+ /**
+ * l'intance partagée accessible après un appel à la méthode
+ * {@link #init()}
+ */
+ protected static LimaSwingApplicationContext instance;
+
+ public static JAXXContextEntryDef<MainView> MAIN_UI_ENTRY_DEF = JAXXUtil.newContextEntryDef("mainUI", MainView.class);
+
+ public static JAXXContextEntryDef<DecoratorProvider> DECORATOR_PROVIDER_DEF = JAXXUtil.newContextEntryDef("decoratorProvider", DecoratorProvider.class);
+
+ public static JAXXContextEntryDef<LimaConfig> CONFIG_DEF = JAXXUtil.newContextEntryDef("limaConfig", LimaConfig.class);
+
+ /**
+ * @return <code>true</code> si le context a été initialisé via la méthode
+ * {@link #init()}, <ocde>false</code> autrement.
+ */
+ public static boolean isInit() {
+ return instance != null;
+ }
+
+ /**
+ * Permet l'initialisation du contexte applicatif et positionne
+ * l'instance partagée.
+ * <p/>
+ * Note : Cette méthode ne peut être appelée qu'une seule fois.
+ *
+ * @return l'instance partagée
+ * @throws IllegalStateException si un contexte applicatif a déja été positionné.
+ */
+ public static LimaSwingApplicationContext init() throws IllegalStateException {
+ if (isInit()) {
+ throw new IllegalStateException("there is already a application context registred.");
+ }
+ instance = new LimaSwingApplicationContext();
+ instance.setContextValue(new MainViewHandler());
+ CONFIG_DEF.setContextValue(instance, LimaConfig.getInstance());
+ DECORATOR_PROVIDER_DEF.setContextValue(instance, new LimaDecoratorProvider());
+ initApplicationContext();
+ return instance;
+ }
+
+ protected static void initApplicationContext() {
+ // TODO DCossé 25/09/14 revoir cette partie
+ new LimaServiceConfig(null);
+ }
+
+ /**
+ * Récupération du contexte applicatif.
+ *
+ * @return l'instance partagé du contexte.
+ * @throws IllegalStateException si le contexte n'a pas été initialisé via
+ * la méthode {@link #init()}
+ */
+ public static LimaSwingApplicationContext get() throws IllegalStateException {
+ if (!isInit()) {
+ throw new IllegalStateException("no application context registred.");
+ }
+ return instance;
+ }
+
+ public LimaConfig getConfig() {
+ return CONFIG_DEF.getContextValue(this);
+ }
+
+ public DecoratorProvider getDecoratorProvider() {
+ return DECORATOR_PROVIDER_DEF.getContextValue(this);
+ }
+
+ public void initI18n(LimaConfig config) {
+
+ I18n.close();
+
+ I18nInitializer i18nInitializer = new DefaultI18nInitializer("lima");
+ Locale locale = config.getLocale();
+ I18n.init(i18nInitializer, locale);
+
+ // Default Locale for DatePicker
+ Locale.setDefault(locale);
+
+ long t00 = System.nanoTime();
+
+ if (log.isDebugEnabled()) {
+ log.debug("i18n language : " + locale);
+ log.debug("i18n loading time : " +
+ StringUtil.convertTime(t00, System.nanoTime()));
+ }
+ }
+
+ public MainView getMainUI() {
+ return MAIN_UI_ENTRY_DEF.getContextValue(this);
+ }
+
+ /**
+ * close the application's context.
+ *
+ * @throws Exception if any pb while closing
+ */
+ public void close() throws Exception {
+ if (log.isDebugEnabled()) {
+ log.debug("closing context " + this);
+ }
+
+ // fermeture du context principal
+ MainView mainUI = getMainUI();
+ if (mainUI != null && mainUI.isVisible()) {
+ mainUI.setVisible(false);
+ mainUI.dispose();
+ }
+
+ if (log.isDebugEnabled()) {
+ log.debug("context closed " + this);
+ }
+ //System.exit(0);
+ }
+
+ public static LimaSwingApplicationContext getContext() {
+ return get();
+ }
+}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/LimaRendererUtil.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/LimaRendererUtil.java 2014-09-19 15:21:43 UTC (rev 3921)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/LimaRendererUtil.java 2014-09-25 15:25:32 UTC (rev 3922)
@@ -26,7 +26,7 @@
import jaxx.runtime.swing.renderer.DecoratorListCellRenderer;
import jaxx.runtime.swing.renderer.DecoratorProviderListCellRenderer;
-import org.chorem.lima.LimaContext;
+import org.chorem.lima.LimaSwingApplicationContext;
import org.nuiton.decorator.Decorator;
import org.nuiton.decorator.DecoratorProvider;
@@ -41,13 +41,13 @@
public class LimaRendererUtil {
public static ListCellRenderer newDecoratorProviderListCellRenderer() {
- DecoratorProvider decoratorProvider = LimaContext.get().getDecoratorProvider();
+ DecoratorProvider decoratorProvider = LimaSwingApplicationContext.get().getDecoratorProvider();
return new DecoratorProviderListCellRenderer(decoratorProvider);
}
public static ListCellRenderer newDecoratorListCellRenderer(Class<?> type) {
- DecoratorProvider decoratorProvider = LimaContext.get().getDecoratorProvider();
+ DecoratorProvider decoratorProvider = LimaSwingApplicationContext.get().getDecoratorProvider();
Decorator<?> decorator = decoratorProvider.getDecoratorByType(type);
return new DecoratorListCellRenderer(decorator);
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainView.jaxx 2014-09-19 15:21:43 UTC (rev 3921)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainView.jaxx 2014-09-25 15:25:32 UTC (rev 3922)
@@ -32,7 +32,7 @@
javax.swing.JButton
jaxx.runtime.SwingUtil
org.chorem.lima.LimaConfig
- org.chorem.lima.LimaContext
+ org.chorem.lima.LimaSwingApplicationContext
org.chorem.lima.enums.ImportExportEnum
</import>
@@ -43,7 +43,7 @@
}
public LimaConfig getConfig() {
- return LimaContext.CONFIG_DEF.getContextValue(getDelegateContext());
+ return LimaSwingApplicationContext.CONFIG_DEF.getContextValue(getDelegateContext());
}
public MainViewHandler getHandler() {
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java 2014-09-19 15:21:43 UTC (rev 3921)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java 2014-09-25 15:25:32 UTC (rev 3922)
@@ -31,7 +31,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.LimaConfig;
-import org.chorem.lima.LimaContext;
+import org.chorem.lima.LimaSwingApplicationContext;
import org.chorem.lima.business.api.HttpServerService;
import org.chorem.lima.enums.ImportExportEnum;
import org.chorem.lima.service.LimaServiceFactory;
@@ -91,13 +91,13 @@
* @param rootContext le context applicatif
* @return l'ui instancie et initialisee mais non visible encore
*/
- public MainView initUI(LimaContext rootContext) {
+ public MainView initUI(LimaSwingApplicationContext rootContext) {
// show main ui
MainView ui = new MainView(rootContext);
swingSession = new SwingSession(getLimaStateFile(), false);
- LimaContext.MAIN_UI_ENTRY_DEF.setContextValue(rootContext, ui);
+ LimaSwingApplicationContext.MAIN_UI_ENTRY_DEF.setContextValue(rootContext, ui);
return ui;
}
@@ -119,10 +119,10 @@
config.setLocale(newLocale);
// rechargement i18n
- LimaContext.get().initI18n(config);
+ LimaSwingApplicationContext.get().initI18n(config);
// on recharge l'ui
- reloadUI(LimaContext.get());
+ reloadUI(LimaSwingApplicationContext.get());
}
/**
@@ -141,7 +141,7 @@
return;
}
try {
- LimaContext.get().close();
+ LimaSwingApplicationContext.get().close();
Runtime.getRuntime().halt(0);
@@ -301,16 +301,16 @@
*
* @param rootContext le contexte applicatif
*/
- protected void reloadUI(LimaContext rootContext) {
+ protected void reloadUI(LimaSwingApplicationContext rootContext) {
// must remove all properties listener on config
- LimaContext.CONFIG_DEF.getContextValue(rootContext).removeJaxxPropertyChangeListener();
+ LimaSwingApplicationContext.CONFIG_DEF.getContextValue(rootContext).removeJaxxPropertyChangeListener();
// scan main ui
MainView ui = getUI(rootContext);
if (ui != null) {
- LimaContext.MAIN_UI_ENTRY_DEF.removeContextValue(rootContext);
+ LimaSwingApplicationContext.MAIN_UI_ENTRY_DEF.removeContextValue(rootContext);
ui.dispose();
@@ -348,7 +348,7 @@
if (context instanceof MainView) {
return (MainView) context;
}
- MainView ui = LimaContext.MAIN_UI_ENTRY_DEF.getContextValue(context);
+ MainView ui = LimaSwingApplicationContext.MAIN_UI_ENTRY_DEF.getContextValue(context);
return ui;
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellEditor.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellEditor.java 2014-09-19 15:21:43 UTC (rev 3921)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellEditor.java 2014-09-25 15:25:32 UTC (rev 3922)
@@ -27,7 +27,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.LimaConfig;
-import org.chorem.lima.LimaContext;
+import org.chorem.lima.LimaSwingApplicationContext;
import javax.swing.*;
import java.awt.event.KeyEvent;
@@ -81,7 +81,7 @@
BigDecimal cellEditorValue;
int pointIndex = stringValue.indexOf(".");
if (pointIndex != -1) {
- LimaConfig config = LimaContext.getContext().getConfig();
+ LimaConfig config = LimaSwingApplicationContext.getContext().getConfig();
String actualDecimals = stringValue.substring(pointIndex, stringValue.length()-1);
if (config.getScale() > actualDecimals.length()) {
cellEditorValue = new BigDecimal(stringValue);
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellRenderer.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellRenderer.java 2014-09-19 15:21:43 UTC (rev 3921)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellRenderer.java 2014-09-25 15:25:32 UTC (rev 3922)
@@ -25,7 +25,7 @@
package org.chorem.lima.ui.celleditor;
import org.chorem.lima.LimaConfig;
-import org.chorem.lima.LimaContext;
+import org.chorem.lima.LimaSwingApplicationContext;
import javax.swing.*;
import java.awt.*;
@@ -39,7 +39,7 @@
public static String format(BigDecimal value) {
- LimaConfig config = LimaContext.getContext().getConfig();
+ LimaConfig config = LimaSwingApplicationContext.getContext().getConfig();
StringBuilder scale = new StringBuilder();
for (int i = 0; i < config.getScale(); i++) {
scale.append("0");
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/DateTableCellEditor.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/DateTableCellEditor.java 2014-09-19 15:21:43 UTC (rev 3921)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/DateTableCellEditor.java 2014-09-25 15:25:32 UTC (rev 3922)
@@ -29,7 +29,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.LimaConfig;
-import org.chorem.lima.LimaContext;
+import org.chorem.lima.LimaSwingApplicationContext;
import org.jdesktop.swingx.JXDatePicker;
import javax.swing.*;
@@ -61,7 +61,7 @@
/** constructor */
public DateTableCellEditor() {
- datePicker = new JXDatePicker(LimaContext.getContext().getConfig().getLocale());
+ datePicker = new JXDatePicker(LimaSwingApplicationContext.getContext().getConfig().getLocale());
datePicker.getEditor().addFocusListener(this);
datePicker.getEditor().addAncestorListener(this);
datePicker.setFormats(
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/AccountsPane.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/AccountsPane.java 2014-09-19 15:21:43 UTC (rev 3921)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/AccountsPane.java 2014-09-25 15:25:32 UTC (rev 3922)
@@ -27,7 +27,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.chorem.lima.LimaContext;
+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;
@@ -69,7 +69,7 @@
public void hyperlinkUpdate(HyperlinkEvent e) {
if (HyperlinkEvent.EventType.ACTIVATED.equals(e.getEventType())) {
if (e.getDescription().equals("#accountschart")) {
- MainView ui = LimaContext.MAIN_UI_ENTRY_DEF.getContextValue(view);
+ MainView ui = LimaSwingApplicationContext.MAIN_UI_ENTRY_DEF.getContextValue(view);
ui.getHandler().showAccountView(ui);
}
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/EntryBooksPane.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/EntryBooksPane.java 2014-09-19 15:21:43 UTC (rev 3921)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/EntryBooksPane.java 2014-09-25 15:25:32 UTC (rev 3922)
@@ -27,7 +27,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.chorem.lima.LimaContext;
+import org.chorem.lima.LimaSwingApplicationContext;
import org.chorem.lima.business.ServiceListener;
import org.chorem.lima.business.api.EntryBookService;
import org.chorem.lima.business.api.ImportService;
@@ -71,7 +71,7 @@
public void hyperlinkUpdate(HyperlinkEvent e) {
if (HyperlinkEvent.EventType.ACTIVATED.equals(e.getEventType())) {
if (e.getDescription().equals("#entrybookschart")) {
- MainView ui = LimaContext.MAIN_UI_ENTRY_DEF.getContextValue(view);
+ MainView ui = LimaSwingApplicationContext.MAIN_UI_ENTRY_DEF.getContextValue(view);
ui.getHandler().showEntryBookView(ui);
}
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/FinancialTransactionsPane.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/FinancialTransactionsPane.java 2014-09-19 15:21:43 UTC (rev 3921)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/FinancialTransactionsPane.java 2014-09-25 15:25:32 UTC (rev 3922)
@@ -27,7 +27,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.chorem.lima.LimaContext;
+import org.chorem.lima.LimaSwingApplicationContext;
import org.chorem.lima.business.ServiceListener;
import org.chorem.lima.business.api.EntryBookService;
import org.chorem.lima.business.api.FinancialTransactionService;
@@ -83,10 +83,10 @@
if (HyperlinkEvent.EventType.ACTIVATED.equals(e.getEventType())) {
if (e.getDescription().equals("#financialtransactionunbalanced")) {
- MainView ui = LimaContext.MAIN_UI_ENTRY_DEF.getContextValue(view);
+ MainView ui = LimaSwingApplicationContext.MAIN_UI_ENTRY_DEF.getContextValue(view);
ui.getHandler().showTransactionUnbalancedView(ui);
} else if (e.getDescription().equals("#financialtransactionbalanced")) {
- MainView ui = LimaContext.MAIN_UI_ENTRY_DEF.getContextValue(view);
+ MainView ui = LimaSwingApplicationContext.MAIN_UI_ENTRY_DEF.getContextValue(view);
ui.getHandler().showTransactionView(ui);
}
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/FiscalYearsPane.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/FiscalYearsPane.java 2014-09-19 15:21:43 UTC (rev 3921)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/FiscalYearsPane.java 2014-09-25 15:25:32 UTC (rev 3922)
@@ -27,7 +27,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.chorem.lima.LimaContext;
+import org.chorem.lima.LimaSwingApplicationContext;
import org.chorem.lima.business.ServiceListener;
import org.chorem.lima.business.api.FiscalPeriodService;
import org.chorem.lima.business.api.ImportService;
@@ -77,7 +77,7 @@
public void hyperlinkUpdate(HyperlinkEvent e) {
if (HyperlinkEvent.EventType.ACTIVATED.equals(e.getEventType())) {
if (e.getDescription().equals("#fiscalperiodschart")) {
- MainView ui = LimaContext.MAIN_UI_ENTRY_DEF.getContextValue(view);
+ MainView ui = LimaSwingApplicationContext.MAIN_UI_ENTRY_DEF.getContextValue(view);
ui.getHandler().showFiscalPeriodView(ui);
}
}
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2014-09-19 15:21:43 UTC (rev 3921)
+++ trunk/pom.xml 2014-09-25 15:25:32 UTC (rev 3922)
@@ -173,7 +173,7 @@
<!-- customized libs version -->
<jettyPluginVersion>9.2.2.v20140723</jettyPluginVersion>
<nuitonUtilsVersion>3.0-SNAPSHOT</nuitonUtilsVersion>
- <nuitonConfigVersion>3.0-alpha-4</nuitonConfigVersion>
+ <nuitonConfigVersion>3.0-rc-1</nuitonConfigVersion>
<nuitonDecoratorVersion>3.0-alpha-3</nuitonDecoratorVersion>
<nuitonProfilingVersion>3.0</nuitonProfilingVersion>
<nuitonCsvVersion>3.0-rc-4</nuitonCsvVersion>
@@ -191,8 +191,8 @@
<itextVersion>4.2.1</itextVersion>
<nuitonWidgetsVersion>1.1.1</nuitonWidgetsVersion>
- <jaxxVersion>2.9</jaxxVersion>
- <openEjbVersion>4.6.0.2</openEjbVersion>
+ <jaxxVersion>2.10</jaxxVersion>
+ <openEjbVersion>4.7.0</openEjbVersion>
<slf4jVersion>1.7.7</slf4jVersion>
<swingxVersion>1.6.5-1</swingxVersion>
<pdfboxVersion>1.8.6</pdfboxVersion>
@@ -330,9 +330,8 @@
<dependency>
<groupId>org.nuiton.topia</groupId>
- <artifactId>topia-service-migration</artifactId>
+ <artifactId>topia-service-flyway</artifactId>
<version>${topiaVersion}</version>
- <scope>compile</scope>
</dependency>
<dependency>
1
0
r3921 - in trunk/lima-swing/src/main: java/org/chorem/lima/ui/financialtransactionunbalanced resources/i18n
by sbavencoff@users.chorem.org 19 Sep '14
by sbavencoff@users.chorem.org 19 Sep '14
19 Sep '14
Author: sbavencoff
Date: 2014-09-19 17:21:43 +0200 (Fri, 19 Sep 2014)
New Revision: 3921
Url: http://forge.chorem.org/projects/lima/repository/revisions/3921
Log:
refs #875 #1043 : financial transaction unbalanced
Added:
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedView.css
Modified:
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedViewHandler.java
trunk/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties
trunk/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties
Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedView.css
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedView.css (rev 0)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedView.css 2014-09-19 15:21:43 UTC (rev 3921)
@@ -0,0 +1,46 @@
+#toolbar {
+ floatable : false;
+}
+
+#removeTransaction {
+ actionIcon : "delete-financial-transaction";
+ toolTipText : "lima.entries.remove.transaction";
+ enabled : "{isSelectedRow()}";
+}
+
+#addEntry {
+ actionIcon : "add-entry";
+ toolTipText : "lima.entries.addEntry";
+ enabled : "{isSelectedRow()}";
+}
+
+#removeEntry {
+ actionIcon : "delete-entry";
+ toolTipText : "lima.entries.remove.entry";
+ enabled : "{isSelectedRow()}";
+}
+
+#balanceButton {
+ actionIcon : "balance";
+ toolTipText : "lima.entries.balance";
+ enabled : "{!isBalance()}";
+}
+
+#fiscalPeriodLabel {
+ actionIcon : "choose-fiscal-year";
+ labelFor : "{fiscalPeriodComboBox}";
+}
+
+#fiscalPeriodComboBox {
+ toolTipText : "lima.financialTransaction.fiscalYear";
+ renderer : "{new org.chorem.lima.ui.common.FiscalPeriodListRenderer()}";
+}
+
+#refresh {
+ toolTipText : "lima.refresh.shortcut";
+ actionIcon : "refresh";
+}
+
+#financialTransactionUnbalancedTable {
+ rowHeight : "22";
+}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedView.jaxx 2014-09-19 14:50:34 UTC (rev 3920)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedView.jaxx 2014-09-19 15:21:43 UTC (rev 3921)
@@ -23,7 +23,8 @@
#L%
-->
-<Table>
+<JPanel layout="{new BorderLayout()}">
+
<import>
javax.swing.ListSelectionModel
javax.swing.DefaultListSelectionModel
@@ -31,6 +32,7 @@
org.chorem.lima.ui.combobox.FiscalPeriodComboBoxModel
org.chorem.lima.ui.financialtransaction.FinancialTransactionDefaultTable
</import>
+
<FinancialTransactionUnbalancedViewHandler id="handler"
javaBean="new FinancialTransactionUnbalancedViewHandler(this)"/>
@@ -42,7 +44,7 @@
<Boolean id="selectedRow" javaBean="false"/>
<Boolean id="balance" javaBean="true"/>
- <org.chorem.lima.ui.combobox.FiscalPeriodComboBoxModel id="modelFiscalPeriod"/>
+
<script>
<![CDATA[
void $afterCompleteSetup() {
@@ -50,54 +52,49 @@
}
]]>
</script>
- <row>
- <cell fill="horizontal">
- <JToolBar floatable="false">
- <JButton toolTipText="{ t("lima.entries.remove.transaction") + " (Ctrl+Shift+Del)"}"
- actionIcon='delete-financial-transaction'
- enabled="{isSelectedRow()}"
- onActionPerformed="getHandler().deleteSelectedTransaction()" />
- <JButton toolTipText ="{ t("lima.entries.addEntry") + " (Ctrl+N)"}" actionIcon='add-entry'
- enabled="{isSelectedRow()}"
- onActionPerformed="getHandler().addEntry()" />
- <JButton toolTipText="{ t("lima.entries.remove.entry") + " (Ctrl+Del)"}" actionIcon='delete-entry'
- enabled="{isSelectedRow()}"
- onActionPerformed="getHandler().deleteSelectedEntry()" />
- <JToolBar.Separator/>
- <JButton toolTipText="{ t("lima.entries.balance") + " (Ctrl+B)"}" actionIcon='balance'
- enabled="{!isBalance()}"
- onActionPerformed="handler.balanceTransaction()" />
- <JToolBar.Separator/>
- <JLabel id="fiscalPeriodLabel"
- actionIcon='choose-fiscal-year'
- labelFor='{fiscalPeriodComboBox}'/>
- <JComboBox id="fiscalPeriodComboBox" model="{modelFiscalPeriod}"
- toolTipText="lima.financialTransaction.fiscalYear"
- renderer="{new org.chorem.lima.ui.common.FiscalPeriodListRenderer()}"
- onActionPerformed="getFinancialTransactionUnbalancedTableModel().setFiscalPeriod( (FiscalPeriod) fiscalPeriodComboBox.getSelectedItem());
- getHandler().refresh()"
- editable="false"/>
- <JToolBar.Separator/>
- <JButton toolTipText="{ t("lima.refresh") + " (F5)"}" actionIcon='refresh'
- onActionPerformed="getHandler().refresh()"/>
+ <JToolBar id="toolbar"
+ constraints="BorderLayout.PAGE_START">
- </JToolBar>
- </cell>
- </row>
+ <JButton id="removeTransaction"
+ onActionPerformed="handler.deleteSelectedTransaction()" />
- <row>
- <cell fill="both" weightx="1" weighty="1" rows="1" >
- <JScrollPane>
- <FinancialTransactionUnbalancedTableModel
- id="financialTransactionUnbalancedTableModel"/>
- <FinancialTransactionUnbalancedTable
- id="financialTransactionUnbalancedTable"
- constructorParams='handler'
- rowHeight="22"
- selectionModel='{selectionModel}'
- model="{getFinancialTransactionUnbalancedTableModel()}"/>
- </JScrollPane>
- </cell>
- </row>
-</Table>
\ No newline at end of file
+ <JButton id="addEntry"
+ onActionPerformed="handler.addEntry()" />
+
+ <JButton id="removeEntry"
+ onActionPerformed="handler.deleteSelectedEntry()" />
+
+ <JToolBar.Separator/>
+
+ <JButton id="balanceButton"
+ onActionPerformed="handler.balanceTransaction()" />
+
+ <JToolBar.Separator/>
+
+ <JLabel id="fiscalPeriodLabel"/>
+
+ <org.chorem.lima.ui.combobox.FiscalPeriodComboBoxModel id="fiscalPeriodComboBoxModel"/>
+
+ <JComboBox id="fiscalPeriodComboBox"
+ model="{fiscalPeriodComboBoxModel}"
+ onActionPerformed="getFinancialTransactionUnbalancedTableModel().setFiscalPeriod( (FiscalPeriod) fiscalPeriodComboBox.getSelectedItem()); getHandler().refresh()"/>
+
+ <JToolBar.Separator/>
+
+ <JButton id="refresh"
+ onActionPerformed="getHandler().refresh()"/>
+
+ </JToolBar>
+
+ <JScrollPane>
+ <FinancialTransactionUnbalancedTableModel
+ id="financialTransactionUnbalancedTableModel"/>
+ <FinancialTransactionUnbalancedTable
+ id="financialTransactionUnbalancedTable"
+ constructorParams='handler'
+ selectionModel='{selectionModel}'
+ model="{getFinancialTransactionUnbalancedTableModel()}"/>
+ </JScrollPane>
+
+</JPanel>
\ No newline at end of file
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedViewHandler.java 2014-09-19 14:50:34 UTC (rev 3920)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedViewHandler.java 2014-09-19 15:21:43 UTC (rev 3921)
@@ -386,7 +386,7 @@
tableModel.refresh();
table.clearSelection();
- FiscalPeriodComboBoxModel comboBoxModel = view.getModelFiscalPeriod();
+ FiscalPeriodComboBoxModel comboBoxModel = view.getFiscalPeriodComboBoxModel();
comboBoxModel.refresh();
}
}
Modified: trunk/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties
===================================================================
--- trunk/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties 2014-09-19 14:50:34 UTC (rev 3920)
+++ trunk/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties 2014-09-19 15:21:43 UTC (rev 3921)
@@ -614,6 +614,7 @@
lima.preferences=Preferences
lima.quit=Exit
lima.refresh=Refresh
+lima.refresh.shortcut=
lima.remove=Remove
lima.remove.shortcut=
lima.reports=Reports
Modified: trunk/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties
===================================================================
--- trunk/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties 2014-09-19 14:50:34 UTC (rev 3920)
+++ trunk/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties 2014-09-19 15:21:43 UTC (rev 3921)
@@ -525,6 +525,7 @@
lima.preferences=Préférences
lima.quit=Quitter
lima.refresh=Actualiser
+lima.refresh.shortcut=Actualiser (F5)
lima.remove=Supprimer
lima.remove.shortcut="Supprimer (Suppr)
lima.reports=Rapports
1
0
19 Sep '14
Author: sbavencoff
Date: 2014-09-19 16:50:34 +0200 (Fri, 19 Sep 2014)
New Revision: 3920
Url: http://forge.chorem.org/projects/lima/repository/revisions/3920
Log:
refs #875 #1043 : financial transaction view
Added:
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionView.css
Modified:
trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/AccountCondition/AccountConditionView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/BigDecimalCondition/CreditConditionView.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/BigDecimalCondition/DebitConditionView.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/StringCondition/DescriptionConditionView.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/StringCondition/LetteringConditionView.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/StringCondition/VoucherConditionView.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/dateCondition/DateConditionView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/dateIntervalCondition/DateIntervalConditionView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/AccountColumn.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/CreditColumn.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/DateColumn.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/DebitColumn.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/DescriptionColumn.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/VoucherColumn.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedView.jaxx
trunk/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties
trunk/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/AccountCondition/AccountConditionView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/AccountCondition/AccountConditionView.jaxx 2014-09-19 13:27:29 UTC (rev 3919)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/AccountCondition/AccountConditionView.jaxx 2014-09-19 14:50:34 UTC (rev 3920)
@@ -22,7 +22,7 @@
<http://www.gnu.org/licenses/gpl-3.0.html>.
#L%
-->
-<JInternalFrame title="lima.financialtransaction.account"
+<JInternalFrame title="lima.financialTransaction.account"
preferredSize="{new Dimension(400, 100)}"
onInternalFrameClosed="handler.delete()"
layout="{new FlowLayout()}">
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/BigDecimalCondition/CreditConditionView.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/BigDecimalCondition/CreditConditionView.java 2014-09-19 13:27:29 UTC (rev 3919)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/BigDecimalCondition/CreditConditionView.java 2014-09-19 14:50:34 UTC (rev 3920)
@@ -34,7 +34,7 @@
public CreditConditionView() {
super();
setHandler(new CreditConditionHandler(this));
- setTitle(t("lima.financialtransaction.credit"));
+ setTitle(t("lima.financialTransaction.credit"));
getBigDecimaleditor().setBean(handler);
getBigDecimaleditor().init();
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/BigDecimalCondition/DebitConditionView.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/BigDecimalCondition/DebitConditionView.java 2014-09-19 13:27:29 UTC (rev 3919)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/BigDecimalCondition/DebitConditionView.java 2014-09-19 14:50:34 UTC (rev 3920)
@@ -34,7 +34,7 @@
public DebitConditionView() {
super();
setHandler(new DebitConditionHandler(this));
- setTitle(t("lima.financialtransaction.debit"));
+ setTitle(t("lima.financialTransaction.debit"));
getBigDecimaleditor().setBean(handler);
getBigDecimaleditor().init();
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/StringCondition/DescriptionConditionView.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/StringCondition/DescriptionConditionView.java 2014-09-19 13:27:29 UTC (rev 3919)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/StringCondition/DescriptionConditionView.java 2014-09-19 14:50:34 UTC (rev 3920)
@@ -34,6 +34,6 @@
public DescriptionConditionView() {
super();
setHandler(new DescriptionConditionHandler(this));
- setTitle(t("lima.financialtransaction.description"));
+ setTitle(t("lima.financialTransaction.description"));
}
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/StringCondition/LetteringConditionView.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/StringCondition/LetteringConditionView.java 2014-09-19 13:27:29 UTC (rev 3919)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/StringCondition/LetteringConditionView.java 2014-09-19 14:50:34 UTC (rev 3920)
@@ -34,6 +34,6 @@
public LetteringConditionView() {
super();
setHandler(new LetteringConditionHandler(this));
- setTitle(t("lima.financialtransaction.letter"));
+ setTitle(t("lima.financialTransaction.letter"));
}
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/StringCondition/VoucherConditionView.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/StringCondition/VoucherConditionView.java 2014-09-19 13:27:29 UTC (rev 3919)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/StringCondition/VoucherConditionView.java 2014-09-19 14:50:34 UTC (rev 3920)
@@ -34,7 +34,7 @@
public VoucherConditionView() {
super();
setHandler(new VoucherConditionHandler(this));
- setTitle(t("lima.financialtransaction.voucher"));
+ setTitle(t("lima.financialTransaction.voucher"));
}
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/dateCondition/DateConditionView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/dateCondition/DateConditionView.jaxx 2014-09-19 13:27:29 UTC (rev 3919)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/dateCondition/DateConditionView.jaxx 2014-09-19 14:50:34 UTC (rev 3920)
@@ -22,7 +22,7 @@
<http://www.gnu.org/licenses/gpl-3.0.html>.
#L%
-->
-<JInternalFrame title="lima.financialtransaction.date"
+<JInternalFrame title="lima.financialTransaction.date"
preferredSize="{new Dimension(200, 100)}"
minimumSize="{new Dimension(200, 100)}"
onInternalFrameClosed="handler.delete()"
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/dateIntervalCondition/DateIntervalConditionView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/dateIntervalCondition/DateIntervalConditionView.jaxx 2014-09-19 13:27:29 UTC (rev 3919)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/dateIntervalCondition/DateIntervalConditionView.jaxx 2014-09-19 14:50:34 UTC (rev 3920)
@@ -23,7 +23,7 @@
#L%
-->
-<JInternalFrame title="lima.financialtransaction.dateInterval"
+<JInternalFrame title="lima.financialTransaction.dateInterval"
preferredSize="{new Dimension(200, 100)}"
minimumSize="{new Dimension(200, 100)}"
onInternalFrameClosed="handler.delete()">
@@ -39,7 +39,7 @@
<Table>
<row>
<cell>
- <JLabel text="lima.financialtransaction.dateInterval.in"/>
+ <JLabel text="lima.financialTransaction.dateInterval.in"/>
</cell>
<cell>
<JAXXDatePicker id='beginDatePicker'
@@ -50,7 +50,7 @@
</row>
<row>
<cell>
- <JLabel text="lima.financialtransaction.dateInterval.to"/>
+ <JLabel text="lima.financialTransaction.dateInterval.to"/>
</cell>
<cell>
<JAXXDatePicker id='endDatePicker'
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/AccountColumn.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/AccountColumn.java 2014-09-19 13:27:29 UTC (rev 3919)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/AccountColumn.java 2014-09-19 14:50:34 UTC (rev 3920)
@@ -37,7 +37,7 @@
public class AccountColumn extends AbstractColumn<FinancialTransactionTableModel> {
public AccountColumn() {
- super(Account.class, t("lima.financialtransaction.account"), true);
+ super(Account.class, t("lima.financialTransaction.account"), true);
}
@Override
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/CreditColumn.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/CreditColumn.java 2014-09-19 13:27:29 UTC (rev 3919)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/CreditColumn.java 2014-09-19 14:50:34 UTC (rev 3920)
@@ -38,7 +38,7 @@
public class CreditColumn extends AbstractColumn<FinancialTransactionTableModel> {
public CreditColumn() {
- super(BigDecimal.class, t("lima.financialtransaction.credit"), true);
+ super(BigDecimal.class, t("lima.financialTransaction.credit"), true);
}
@Override
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/DateColumn.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/DateColumn.java 2014-09-19 13:27:29 UTC (rev 3919)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/DateColumn.java 2014-09-19 14:50:34 UTC (rev 3920)
@@ -39,7 +39,7 @@
public class DateColumn extends AbstractColumn<FinancialTransactionTableModel> {
public DateColumn(){
- super(Date.class, t("lima.financialtransaction.date"), true);
+ super(Date.class, t("lima.financialTransaction.date"), true);
}
@Override
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/DebitColumn.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/DebitColumn.java 2014-09-19 13:27:29 UTC (rev 3919)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/DebitColumn.java 2014-09-19 14:50:34 UTC (rev 3920)
@@ -38,7 +38,7 @@
public class DebitColumn extends AbstractColumn<FinancialTransactionTableModel> {
public DebitColumn() {
- super(BigDecimal.class, t("lima.financialtransaction.debit"), true);
+ super(BigDecimal.class, t("lima.financialTransaction.debit"), true);
}
@Override
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/DescriptionColumn.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/DescriptionColumn.java 2014-09-19 13:27:29 UTC (rev 3919)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/DescriptionColumn.java 2014-09-19 14:50:34 UTC (rev 3920)
@@ -37,8 +37,8 @@
public class DescriptionColumn<T extends FinancialTransactionTableModel> extends AbstractColumn<T> {
public DescriptionColumn() {
- super(String.class, t("lima.financialtransaction.description"), true);
- setCellEditor(new AutoCompleteTableCellEditor("lima.financialtransaction.description"));
+ super(String.class, t("lima.financialTransaction.description"), true);
+ setCellEditor(new AutoCompleteTableCellEditor("lima.financialTransaction.description"));
}
@Override
public Object getValueAt(int row) {
Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionView.css
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionView.css (rev 0)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionView.css 2014-09-19 14:50:34 UTC (rev 3920)
@@ -0,0 +1,106 @@
+#toolbar {
+ floatable : false;
+}
+
+#addTransaction {
+ actionIcon : "add-financial-transaction";
+ toolTipText : "lima.entries.addTransaction";
+}
+
+#removeTransaction {
+ actionIcon : "delete-financial-transaction";
+ toolTipText : "lima.entries.remove.transaction";
+ enabled : "{isSelectedRow()}";
+}
+
+#copyTransaction {
+ actionIcon : "copy";
+ toolTipText : "lima.entries.copy.transaction";
+ enabled : "{isSelectedRow()}";
+}
+
+#pastTransaction {
+ actionIcon : "paste";
+ toolTipText : "lima.entries.paste.transaction";
+ enabled : "{isTransactionInClipBoard()}";
+}
+
+#addEntry {
+ actionIcon : "add-entry";
+ toolTipText : "lima.entries.addEntry";
+ enabled : "{isSelectedRow()}";
+}
+
+#removeEntry {
+ actionIcon : "delete-entry";
+ toolTipText : "lima.entries.remove.entry";
+ enabled : "{isSelectedRow()}";
+}
+
+#copyEntry {
+ actionIcon : "copy";
+ toolTipText : "lima.entries.copy.entry";
+ enabled : "{isSelectedRow()}";
+}
+
+#pasteEntry {
+ actionIcon : "paste";
+ toolTipText : "lima.entries.paste.entry";
+ enabled : "{isEntryInClipBoard() && isSelectedRow()}";
+}
+
+#assignEntries {
+ actionIcon : "assign-all-entries-in-transaction";
+ toolTipText : "lima.entries.assign.entries";
+ enabled : "{isAssignableInAllEntries() && isSelectedRow()}";
+}
+
+#balanceButton {
+ actionIcon : "balance";
+ toolTipText : "lima.entries.balance";
+ enabled : "{!isBalance()}";
+}
+
+#fiscalPeriodLabel {
+ actionIcon : "choose-fiscal-year";
+ labelFor : "{fiscalPeriodComboBox}";
+}
+
+#fiscalPeriodComboBox {
+ toolTipText : "lima.financialTransaction.fiscalYear";
+ renderer : "{new org.chorem.lima.ui.common.FiscalPeriodListRenderer()}";
+}
+
+#financialPeriodLabel {
+ actionIcon : "choose-fiscal-period";
+ labelFor : "{financialPeriodComboBox}";
+}
+
+#financialPeriodComboBox {
+ toolTipText : "lima.financialTransaction.financialPeriod";
+ renderer : "{new org.chorem.lima.ui.common.FinancialPeriodListRenderer()}";
+}
+
+#back {
+ actionIcon : "previous";
+ toolTipText : "lima.financialTransaction.previousFinancialPeriod";
+}
+
+#next {
+ actionIcon : "next";
+ toolTipText : "lima.financialTransaction.nextFinancialPeriod";
+}
+
+#entryBookLabel {
+ actionIcon : "choose-book";
+ labelFor : "{entryBookComboBox}";
+}
+
+#entryBookComboBox {
+ toolTipText : "lima.financialTransaction.entryBook";
+ renderer : "{new org.chorem.lima.ui.common.EntryBookListRenderer()}"
+}
+
+#financialTransactionTable {
+ rowHeight : 22;
+}
\ No newline at end of file
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionView.jaxx 2014-09-19 13:27:29 UTC (rev 3919)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionView.jaxx 2014-09-19 14:50:34 UTC (rev 3920)
@@ -22,7 +22,7 @@
<http://www.gnu.org/licenses/gpl-3.0.html>.
#L%
-->
-<Table>
+<JPanel layout="{new BorderLayout()}">
<import>
javax.swing.ListSelectionModel
@@ -58,92 +58,84 @@
}
]]>
</script>
- <row>
- <cell fill="horizontal">
- <JToolBar floatable="false">
- <JButton toolTipText="{ t("lima.entries.addTransaction") + " (Ctrl+Shift+N)"}"
- actionIcon='add-financial-transaction'
- onActionPerformed="handler.addFinancialTransaction()" />
- <JButton toolTipText="{ t("lima.entries.remove.transaction") + " (Ctrl+Shift+Del)"}"
- actionIcon='delete-financial-transaction'
- enabled="{isSelectedRow()}"
- onActionPerformed="handler.deleteSelectedTransaction()" />
- <JButton toolTipText="{ t("lima.entries.copy.transaction") + " (Ctrl+Shift+C)"}" actionIcon='copy'
- enabled="{isSelectedRow()}"
- onActionPerformed="handler.copyTransaction()" />
- <JButton toolTipText="{ t("lima.entries.paste.transaction") + " (Ctrl+Shift+V)"}" actionIcon='paste'
- enabled="{isTransactionInClipBoard()}"
- onActionPerformed="handler.pasteTransaction()" />
+ <JToolBar id="toolbar"
+ constraints="BorderLayout.PAGE_START">
- <JToolBar.Separator/>
+ <JButton id="addTransaction"
+ onActionPerformed="handler.addFinancialTransaction()" />
- <JButton toolTipText ="{ t("lima.entries.addEntry") + " (Ctrl+N)"}" actionIcon='add-entry'
- enabled="{isSelectedRow()}"
- onActionPerformed="handler.addEntry()" />
- <JButton toolTipText="{ t("lima.entries.remove.entry") + " (Ctrl+Del)"}" actionIcon='delete-entry'
- enabled="{isSelectedRow()}"
- onActionPerformed="handler.deleteSelectedEntry()" />
- <JButton toolTipText="{ t("lima.entries.copy.entry") + " (Ctrl+Alt+C)"}" actionIcon='copy'
- enabled="{isSelectedRow()}"
- onActionPerformed="handler.copyEntry()" />
- <JButton toolTipText="{ t("lima.entries.paste.entry") + " (Ctrl+Alt+V)"}" actionIcon='paste'
- enabled="{isEntryInClipBoard() && isSelectedRow()}"
- onActionPerformed="handler.pasteEntry()" />
- <JButton toolTipText="{ t("lima.entries.assign.entries") + " (Ctrl+Alt+A)"}" actionIcon='assign-all-entries-in-transaction'
- enabled="{isAssignableInAllEntries() && isSelectedRow()}"
- onActionPerformed="handler.assignAllEntries()" />
- <JToolBar.Separator/>
- <JButton toolTipText="{ t("lima.entries.balance") + " (Ctrl+B)"}" actionIcon='balance'
- enabled="{!isBalance()}"
- onActionPerformed="handler.balanceTransaction()" />
+ <JButton id="removeTransaction"
+ onActionPerformed="handler.deleteSelectedTransaction()" />
- <JToolBar.Separator/>
+ <JButton id="copyTransaction"
+ onActionPerformed="handler.copyTransaction()" />
- <JLabel actionIcon='choose-fiscal-year'
- labelFor='{fiscalPeriodComboBox}'/>
- <org.chorem.lima.ui.common.FiscalPeriodComboBoxModel id="fiscalPeriodComboBoxModel"/>
- <JComboBox id="fiscalPeriodComboBox" model="{fiscalPeriodComboBoxModel}"
- toolTipText="lima.financialtransaction.fiscalyear"
- renderer="{new org.chorem.lima.ui.common.FiscalPeriodListRenderer()}"
- onItemStateChanged="handler.fiscalPeriodSelected(event)"/>
+ <JButton id="pastTransaction"
+ onActionPerformed="handler.pasteTransaction()" />
- <JLabel actionIcon='choose-fiscal-period'
- labelFor='{financialPeriodComboBox}'/>
- <org.chorem.lima.ui.common.FinancialPeriodComboBoxModel id="financialPeriodComboBoxModel"/>
- <JComboBox id="financialPeriodComboBox"
- model="{financialPeriodComboBoxModel}"
- toolTipText="lima.financialtransaction.financialperiod"
- renderer="{new org.chorem.lima.ui.common.FinancialPeriodListRenderer()}"
- onItemStateChanged="handler.financialPeriodSelected(event)"/>
- <JButton id="back" actionIcon="previous"
- toolTipText="lima.financialtransaction.previousfinancialperiod"
- onActionPerformed="handler.back(financialPeriodComboBox)"/>
- <JButton id="next" actionIcon="next"
- toolTipText="lima.financialtransaction.nextfinancialperiod"
- onActionPerformed="handler.next(financialPeriodComboBox)"/>
+ <JToolBar.Separator/>
- <JToolBar.Separator/>
+ <JButton id="addEntry"
+ onActionPerformed="handler.addEntry()" />
- <JLabel actionIcon="choose-book"
- labelFor='{entryBookComboBox}'/>
- <org.chorem.lima.ui.common.EntryBookComboBoxModel id="entryBookComboBoxModel"/>
- <JComboBox id="entryBookComboBox" model="{entryBookComboBoxModel}"
- toolTipText="lima.financialtransaction.entrybook"
- renderer="{new org.chorem.lima.ui.common.EntryBookListRenderer()}"
- onItemStateChanged="handler.entryBookSelected(event)"/>
- </JToolBar>
- </cell>
- </row>
- <row>
- <cell fill="both" weightx="1" weighty="1">
- <JScrollPane>
- <FinancialTransactionTableModel id="financialTransactionTableModel"/>
- <FinancialTransactionTable
- id="financialTransactionTable" rowHeight="22"
- constructorParams='handler'
- selectionModel='{selectionModel}'
- model='{financialTransactionTableModel}'/>
- </JScrollPane>
- </cell>
- </row>
-</Table>
\ No newline at end of file
+ <JButton id="removeEntry"
+ onActionPerformed="handler.deleteSelectedEntry()" />
+
+ <JButton id="copyEntry"
+ onActionPerformed="handler.copyEntry()" />
+
+ <JButton id="pasteEntry"
+ onActionPerformed="handler.pasteEntry()" />
+
+ <JButton id="assignEntries"
+ onActionPerformed="handler.assignAllEntries()" />
+
+ <JToolBar.Separator/>
+
+ <JButton id="balanceButton"
+ onActionPerformed="handler.balanceTransaction()" />
+
+ <JToolBar.Separator/>
+
+ <JLabel id="fiscalPeriodLabel"/>
+
+ <org.chorem.lima.ui.common.FiscalPeriodComboBoxModel id="fiscalPeriodComboBoxModel"/>
+
+ <JComboBox id="fiscalPeriodComboBox"
+ model="{fiscalPeriodComboBoxModel}"
+ onItemStateChanged="handler.fiscalPeriodSelected(event)"/>
+
+ <JLabel id="financialPeriodLabel"/>
+
+ <org.chorem.lima.ui.common.FinancialPeriodComboBoxModel id="financialPeriodComboBoxModel"/>
+
+ <JComboBox id="financialPeriodComboBox"
+ model="{financialPeriodComboBoxModel}"
+ onItemStateChanged="handler.financialPeriodSelected(event)"/>
+
+ <JButton id="back"
+ onActionPerformed="handler.back(financialPeriodComboBox)"/>
+
+ <JButton id="next"
+ onActionPerformed="handler.next(financialPeriodComboBox)"/>
+
+ <JToolBar.Separator/>
+
+ <JLabel id="entryBookLabel" />
+
+ <org.chorem.lima.ui.common.EntryBookComboBoxModel id="entryBookComboBoxModel"/>
+
+ <JComboBox id="entryBookComboBox"
+ model="{entryBookComboBoxModel}"
+ onItemStateChanged="handler.entryBookSelected(event)"/>
+ </JToolBar>
+
+ <JScrollPane constraints="BorderLayout.CENTER">
+ <FinancialTransactionTableModel id="financialTransactionTableModel"/>
+
+ <FinancialTransactionTable id="financialTransactionTable"
+ constructorParams='handler'
+ selectionModel='{selectionModel}'
+ model='{financialTransactionTableModel}'/>
+ </JScrollPane>
+</JPanel>
\ No newline at end of file
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionViewHandler.java 2014-09-19 13:27:29 UTC (rev 3919)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionViewHandler.java 2014-09-19 14:50:34 UTC (rev 3920)
@@ -695,8 +695,8 @@
cellEditor.cancelCellEditing();
}
int response = JOptionPane.showConfirmDialog(
- view, t("lima.financialtransaction.messageremovetransaction"),
- t("lima.financialtransaction.titleremovetransaction"), JOptionPane.YES_NO_OPTION);
+ view, t("lima.financialTransaction.messageremovetransaction"),
+ t("lima.financialTransaction.titleremovetransaction"), JOptionPane.YES_NO_OPTION);
if (response == JOptionPane.YES_OPTION) {
try {
@@ -740,8 +740,8 @@
cellEditor.cancelCellEditing();
}
int response = JOptionPane.showConfirmDialog(
- view, t("lima.financialtransaction.messageremoveentry"),
- t("lima.financialtransaction.titleremoveentry"), JOptionPane.YES_NO_OPTION);
+ view, t("lima.financialTransaction.messageremoveentry"),
+ t("lima.financialTransaction.titleremoveentry"), JOptionPane.YES_NO_OPTION);
if (response == JOptionPane.YES_OPTION) {
try {
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/VoucherColumn.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/VoucherColumn.java 2014-09-19 13:27:29 UTC (rev 3919)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/VoucherColumn.java 2014-09-19 14:50:34 UTC (rev 3920)
@@ -37,8 +37,8 @@
public class VoucherColumn extends AbstractColumn<FinancialTransactionTableModel> {
public VoucherColumn() {
- super(String.class, t("lima.financialtransaction.voucher"), true);
- setCellEditor(new AutoCompleteTableCellEditor("lima.financialtransaction.voucher"));
+ super(String.class, t("lima.financialTransaction.voucher"), true);
+ setCellEditor(new AutoCompleteTableCellEditor("lima.financialTransaction.voucher"));
}
@Override
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedView.jaxx 2014-09-19 13:27:29 UTC (rev 3919)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedView.jaxx 2014-09-19 14:50:34 UTC (rev 3920)
@@ -73,7 +73,7 @@
actionIcon='choose-fiscal-year'
labelFor='{fiscalPeriodComboBox}'/>
<JComboBox id="fiscalPeriodComboBox" model="{modelFiscalPeriod}"
- toolTipText="lima.financialtransaction.fiscalyear"
+ toolTipText="lima.financialTransaction.fiscalYear"
renderer="{new org.chorem.lima.ui.common.FiscalPeriodListRenderer()}"
onActionPerformed="getFinancialTransactionUnbalancedTableModel().setFiscalPeriod( (FiscalPeriod) fiscalPeriodComboBox.getSelectedItem());
getHandler().refresh()"
Modified: trunk/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties
===================================================================
--- trunk/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties 2014-09-19 13:27:29 UTC (rev 3919)
+++ trunk/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties 2014-09-19 14:50:34 UTC (rev 3920)
@@ -330,46 +330,51 @@
lima.financialStatements.check=
lima.financialStatements.check.nothing=
lima.financialStatements.check.warn=
+lima.financialTransaction.account=
lima.financialTransaction.add.error.afterLastFiscalPeriod=
lima.financialTransaction.add.error.beforeFirstFiscalPeriod=
lima.financialTransaction.add.error.lockedEntryBook=
lima.financialTransaction.add.error.lockedFinancialPeriod=
+lima.financialTransaction.balance=
+lima.financialTransaction.buttonback=
+lima.financialTransaction.buttonnext=
+lima.financialTransaction.credit=
+lima.financialTransaction.date=
+lima.financialTransaction.date.in=
+lima.financialTransaction.date.to=
+lima.financialTransaction.dateInterval=
+lima.financialTransaction.dateInterval.in=
+lima.financialTransaction.dateInterval.to=
+lima.financialTransaction.debit=
lima.financialTransaction.delete.error.lockedEntryBook=
lima.financialTransaction.delete.error.lockedFinancialPeriod=
+lima.financialTransaction.description=
+lima.financialTransaction.entryBook=
+lima.financialTransaction.entrybook=
+lima.financialTransaction.financialPeriod=
+lima.financialTransaction.financialperiod=
+lima.financialTransaction.fiscalYear=
+lima.financialTransaction.fiscalyear=
+lima.financialTransaction.letter=
lima.financialTransaction.lockedEntryBookException=Entry can not be added as entry book is locked for period from %1$tm/%1$te/%1$tY to %1$tm/%1$te/%1$tY.\n
lima.financialTransaction.lockedFinancialPeriodException=locked financial transaction
+lima.financialTransaction.messageremoveentry=
+lima.financialTransaction.messageremovetransaction=
+lima.financialTransaction.nextFinancialPeriod=
+lima.financialTransaction.nextfinancialperiod=Next period
lima.financialTransaction.paste.error.afterLastFiscalPeriod=
lima.financialTransaction.paste.error.beforeFirstFiscalPeriod=
lima.financialTransaction.paste.error.lockedEntryBook=
lima.financialTransaction.paste.error.lockedFinancialPeriod=
+lima.financialTransaction.previousFinancialPeriod=
+lima.financialTransaction.previousfinancialperiod=previous period
+lima.financialTransaction.titleremoveentry=
+lima.financialTransaction.titleremovetransaction=
lima.financialTransaction.update.error.afterLastFiscalPeriod=
lima.financialTransaction.update.error.beforeFirstFiscalPeriod=
lima.financialTransaction.update.error.lockedEntryBook=
lima.financialTransaction.update.error.lockedFinancialPeriod=
-lima.financialtransaction.account=
-lima.financialtransaction.balance=
-lima.financialtransaction.buttonback=
-lima.financialtransaction.buttonnext=
-lima.financialtransaction.credit=
-lima.financialtransaction.date=
-lima.financialtransaction.date.in=
-lima.financialtransaction.date.to=
-lima.financialtransaction.dateInterval=
-lima.financialtransaction.dateInterval.in=
-lima.financialtransaction.dateInterval.to=
-lima.financialtransaction.debit=
-lima.financialtransaction.description=
-lima.financialtransaction.entrybook=
-lima.financialtransaction.financialperiod=
-lima.financialtransaction.fiscalyear=
-lima.financialtransaction.letter=
-lima.financialtransaction.messageremoveentry=
-lima.financialtransaction.messageremovetransaction=
-lima.financialtransaction.nextfinancialperiod=Next period
-lima.financialtransaction.previousfinancialperiod=previous period
-lima.financialtransaction.titleremoveentry=
-lima.financialtransaction.titleremovetransaction=
-lima.financialtransaction.voucher=
+lima.financialTransaction.voucher=
lima.fiscalPeriod.add=
lima.fiscalPeriod.add.beginAfterEndFiscalPeriod=
lima.fiscalPeriod.add.error.beginAfterEndFiscalPeriod=
Modified: trunk/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties
===================================================================
--- trunk/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties 2014-09-19 13:27:29 UTC (rev 3919)
+++ trunk/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties 2014-09-19 14:50:34 UTC (rev 3920)
@@ -154,13 +154,13 @@
lima.endDate=Fin
lima.enterEntries=Écritures
lima.entries=Écritures
-lima.entries.addEntry=Créer une entrée dans la transaction
-lima.entries.addTransaction=Créer une transaction
+lima.entries.addEntry=Créer une entrée dans la transaction (Ctrl+N)
+lima.entries.addTransaction=Créer une transaction (Ctrl+Maj+N)
lima.entries.assign.closed.entryBook.error=Impossible d'affecter cette valeur a l'ensemble des entrés de la transaction car le jounal %2$s (%1$s) est cloturé pour la période du %3$te %3$tB %3$tY au %4$te %4$tB %4$tY.
-lima.entries.assign.entries=Assigner cette valeur à toutes les entrées de la transaction
-lima.entries.balance=Équilibrer la transaction avec cette entrée
-lima.entries.copy.entry=Copier l'entrée
-lima.entries.copy.transaction=Copier la transaction
+lima.entries.assign.entries=Assigner cette valeur à toutes les entrées de la transaction (Ctrl+Alt+A)
+lima.entries.balance=Équilibrer la transaction avec cette entrée (Ctrl+B)
+lima.entries.copy.entry=Copier l'entrée (Ctrl+Alt+C)
+lima.entries.copy.transaction=Copier la transaction (Ctrl+Maj+C)
lima.entries.enter=Saisie des écritures
lima.entries.letter.closed.entryBook.error=Impossible de modifier le lettrage des ces entrés car le jounal %2$s (%1$s) est cloturé pour la période du %3$te %3$tB %3$tY au %4$te %4$tB %4$tY.
lima.entries.letter.unbalanced.error=Impossible de lettrer ces écritures car leur solde n'est pas nul.
@@ -170,10 +170,10 @@
lima.entries.lettering.radiobutton.list=Lettres existantes
lima.entries.lettering.radiobutton.new=Nouvelle lettre
lima.entries.lettering.remove=Supprimer une lettre
-lima.entries.paste.entry=Coller l'entrée
-lima.entries.paste.transaction=Coller la transaction
-lima.entries.remove.entry=Supprimer l'entrée
-lima.entries.remove.transaction=Supprimer la transaction
+lima.entries.paste.entry=Coller l'entrée (Ctrl+Alt+V)
+lima.entries.paste.transaction=Coller la transaction (Ctrl+Maj+V)
+lima.entries.remove.entry=Supprimer l'entrée (Suppr)
+lima.entries.remove.transaction=Supprimer la transaction (Ctrl+Suppr)
lima.entries.search=Rechercher des écritures
lima.entries.searchtransaction=
lima.entries.searchunbalancedtransaction=
@@ -296,44 +296,44 @@
lima.financialStatements.check=Vérification des comptes aux postes
lima.financialStatements.check.nothing=Introuvable \: %s - %s \n
lima.financialStatements.check.warn=Attention cette fonctionnalité n'est qu'une aide utilisateur.\n Certains comptes ne doivent pas être présent au bilan et compte de résultat.\n Il est donc normal que des comptes sont marqués comme introuvable.\n\n
+lima.financialTransaction.account=Compte
lima.financialTransaction.add.error.afterLastFiscalPeriod=Impossible d'ajouter une transaction après le %1$te %1$tB %1$tY fin du dernier exercice.
lima.financialTransaction.add.error.beforeFirstFiscalPeriod=Impossible d'ajouter une transaction avant le %1$te %1$tB %1$tY début du premier exercice.
lima.financialTransaction.add.error.lockedEntryBook=Impossible d'ajouter une transaction car le jounal %2$s (%1$s) est cloturé pour la période du %3$te %3$tB %3$tY au %4$te %4$tB %4$tY.
lima.financialTransaction.add.error.lockedFinancialPeriod=Impossible d'ajouter une transaction car la période fiscale du %3$te %3$tB %3$tY au %4$te %4$tB %4$tY est cloturée.
+lima.financialTransaction.balance=Balance
+lima.financialTransaction.buttonback=←
+lima.financialTransaction.buttonnext=→
+lima.financialTransaction.credit=Crédit
+lima.financialTransaction.date=Date
+lima.financialTransaction.dateInterval=Interval de dates
+lima.financialTransaction.dateInterval.in=Du
+lima.financialTransaction.dateInterval.to=au
+lima.financialTransaction.debit=Débit
lima.financialTransaction.delete.error.lockedEntryBook=Impossible de supprimer une transaction car le jounal %2$s (%1$s) est cloturé pour la période du %3$te %3$tB %3$tY au %4$te %4$tB %4$tY.
lima.financialTransaction.delete.error.lockedFinancialPeriod=Impossible de supprimer une transaction car la période fiscale du %3$te %3$tB %3$tY au %4$te %4$tB %4$tY est cloturée.
+lima.financialTransaction.description=Description
+lima.financialTransaction.entryBook=Journal
+lima.financialTransaction.financialPeriod=Périodes comptables
+lima.financialTransaction.fiscalYear=Exercices
+lima.financialTransaction.letter=Lettre
lima.financialTransaction.lockedEntryBookException=Impossible d'ajouter une entré car le jounal %2$s (%1$s) est cloturé pour la période du %3$te %3$tB %3$tY au %4$te %4$tB %4$tY.\n
lima.financialTransaction.lockedFinancialPeriodException=La période financière est bloquée\n
+lima.financialTransaction.messageremoveentry=Voulez-vous supprimer cette ligne de transaction?
+lima.financialTransaction.messageremovetransaction=Voulez-vous supprimer cette transaction?
+lima.financialTransaction.nextFinancialPeriod=Période suivante
lima.financialTransaction.paste.error.afterLastFiscalPeriod=Impossible de copier une transaction après le %1$te %1$tB %1$tY fin du dernier exercice.
lima.financialTransaction.paste.error.beforeFirstFiscalPeriod=Impossible de copier une transaction avant le %1$te %1$tB %1$tY début du premier exercice.
lima.financialTransaction.paste.error.lockedEntryBook=Impossible de copier une transaction car le jounal %2$s (%1$s) est cloturé pour la période du %3$te %3$tB %3$tY au %4$te %4$tB %4$tY.
lima.financialTransaction.paste.error.lockedFinancialPeriod=Impossible de copier une transaction car la période fiscale du %3$te %3$tB %3$tY au %4$te %4$tB %4$tY est cloturée.
+lima.financialTransaction.previousFinancialPeriod=Période précédente
+lima.financialTransaction.titleremoveentry=Suppression
+lima.financialTransaction.titleremovetransaction=Suppression
lima.financialTransaction.update.error.afterLastFiscalPeriod=Impossible de déplacer une transaction après le %1$te %1$tB %1$tY fin du dernier exercice.
lima.financialTransaction.update.error.beforeFirstFiscalPeriod=Impossible de déplacer une transaction avant le %1$te %1$tB %1$tY début du premier exercice.
lima.financialTransaction.update.error.lockedEntryBook=Impossible de déplacer une transaction car le jounal %2$s (%1$s) est cloturé pour la période du %3$te %3$tB %3$tY au %4$te %4$tB %4$tY.
lima.financialTransaction.update.error.lockedFinancialPeriod=Impossible de deplacer une transaction car la période fiscale du %3$te %3$tB %3$tY au %4$te %4$tB %4$tY est cloturée.
-lima.financialtransaction.account=Compte
-lima.financialtransaction.balance=Balance
-lima.financialtransaction.buttonback=←
-lima.financialtransaction.buttonnext=→
-lima.financialtransaction.credit=Crédit
-lima.financialtransaction.date=Date
-lima.financialtransaction.dateInterval=Interval de dates
-lima.financialtransaction.dateInterval.in=Du
-lima.financialtransaction.dateInterval.to=au
-lima.financialtransaction.debit=Débit
-lima.financialtransaction.description=Description
-lima.financialtransaction.entrybook=Journal
-lima.financialtransaction.financialperiod=Périodes comptables
-lima.financialtransaction.fiscalyear=Exercices
-lima.financialtransaction.letter=Lettre
-lima.financialtransaction.messageremoveentry=Voulez-vous supprimer cette ligne de transaction?
-lima.financialtransaction.messageremovetransaction=Voulez-vous supprimer cette transaction?
-lima.financialtransaction.nextfinancialperiod=Période suivante
-lima.financialtransaction.previousfinancialperiod=Période précédente
-lima.financialtransaction.titleremoveentry=Suppression
-lima.financialtransaction.titleremovetransaction=Suppression
-lima.financialtransaction.voucher=Pièce comptable
+lima.financialTransaction.voucher=Pièce comptable
lima.fiscalPeriod.add=Nouvel exercice (Ctrl+A)
lima.fiscalPeriod.add.error.beginAfterEndFiscalPeriod=Le date de fin de l'exercice (%2$te/%2$tm/%2$tY) doit être postérieur à la date de début (%1$te/%1$tm/%1$tY)
lima.fiscalPeriod.add.error.moreOneUnlockFiscalPeriod=Il existe déjà %1s exercices non clôturés.
1
0