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
- 1853 discussions
r2958 - in trunk: lima-business/src/main/java/org/chorem/lima/business lima-business/src/main/java/org/chorem/lima/business/accountingrules lima-business/src/main/java/org/chorem/lima/business/ejb lima-callao/src/main/xmi lima-swing/src/main/java/org/chorem/lima/ui/account
by jpepin@users.chorem.org 01 Jul '10
by jpepin@users.chorem.org 01 Jul '10
01 Jul '10
Author: jpepin
Date: 2010-07-01 16:23:40 +0200 (Thu, 01 Jul 2010)
New Revision: 2958
Url: http://chorem.org/repositories/revision/lima/2958
Log:
D?\195?\169boguage export du PCG, ajout import PCG.
Modified:
trunk/lima-business/src/main/java/org/chorem/lima/business/AccountService.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ImportExportService.java
trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/FranceAccountingRules.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/ImportExportServiceImpl.java
trunk/lima-callao/src/main/xmi/accounting.zargo
trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountTreeTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/AccountService.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/AccountService.java 2010-07-01 13:16:53 UTC (rev 2957)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/AccountService.java 2010-07-01 14:23:40 UTC (rev 2958)
@@ -56,6 +56,7 @@
void updateAccount(Account account) throws LimaException;
void removeAccount(Account account) throws LimaException;
+ void removeAllAccount() throws LimaException;
List<Account> getAllChildrenAccounts(Account masterAccount, List<Account> accounts) throws LimaException;
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ImportExportService.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ImportExportService.java 2010-07-01 13:16:53 UTC (rev 2957)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ImportExportService.java 2010-07-01 14:23:40 UTC (rev 2958)
@@ -109,6 +109,8 @@
*/
void exportAccountsChartAsCSV(String path) throws LimaException;
+ String importAccountsChartCSV(String path) throws LimaException;
+
/**
* export entrybook chart as CSV.
*
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/FranceAccountingRules.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/FranceAccountingRules.java 2010-07-01 13:16:53 UTC (rev 2957)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/FranceAccountingRules.java 2010-07-01 14:23:40 UTC (rev 2958)
@@ -89,6 +89,20 @@
}
}
+ /**
+ * Rules to check before create subledger
+ */
+ public void createSubLedgerRules(Account masterAccount, Account account) throws LimaException {
+ super.createSubLedgerRules(masterAccount, account);
+
+ // check if the master account number is begin with 4
+ if (!masterAccount.getAccountNumber().startsWith("4")){
+ throw new LimaBusinessException(
+ "Master Account Number is not a thirdpart account"
+ + account.getAccountNumber());
+ }
+ }
+
public void updateSubLedgerRules(Account account) throws LimaException {
super.updateSubLedgerRules(account);
}
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 2010-07-01 13:16:53 UTC (rev 2957)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java 2010-07-01 14:23:40 UTC (rev 2958)
@@ -108,12 +108,18 @@
account.getAccountNumber()));
}
+ //create it
accountDAO.create(account);
+
+ Account masterAccountUpdate = null;
+ if (masterAccount != null){
+ masterAccountUpdate = accountDAO.findByAccountNumber(masterAccount.getAccountNumber());
+ }
// check if parent account exist;
- if (masterAccount != null) {
- masterAccount.addSubAccounts(account);
- accountDAO.update(masterAccount);
+ if (masterAccountUpdate != null) {
+ masterAccountUpdate.addSubAccounts(account);
+ accountDAO.update(masterAccountUpdate);
}
commitTransaction(transaction);
@@ -151,12 +157,18 @@
account.getAccountNumber()));
}
+ //create it
accountDAO.create(account);
+ Account masterAccountUpdate = null;
+ if (masterAccount != null){
+ masterAccountUpdate = accountDAO.findByAccountNumber(masterAccount.getAccountNumber());
+ }
+
// check if the masteraccount exist;
if (masterAccount != null) {
- masterAccount.addSubLedgers(account);
- accountDAO.update(masterAccount);
+ masterAccountUpdate.addSubLedgers(account);
+ accountDAO.update(masterAccountUpdate);
}
commitTransaction(transaction);
@@ -330,6 +342,15 @@
}
}
+ @Override
+ public void removeAllAccount() throws LimaException{
+ List<Account> accounts = getChildrenAccounts(null);
+ for (Account account : accounts) {
+ removeAccount(account);
+ }
+ }
+
+
/**
* Permet de modifier un compte sur son label et son compte père.
*
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportExportServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportExportServiceImpl.java 2010-07-01 13:16:53 UTC (rev 2957)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportExportServiceImpl.java 2010-07-01 14:23:40 UTC (rev 2958)
@@ -21,14 +21,22 @@
import java.io.ByteArrayOutputStream;
import java.io.File;
+import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.OutputStream;
+import java.util.Collection;
+import java.util.Iterator;
import java.util.List;
+import java.util.TreeMap;
+import javax.ejb.EJB;
import javax.ejb.Stateless;
import org.apache.commons.io.IOUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.chorem.lima.beans.AccountImport;
+import org.chorem.lima.beans.AccountImportImpl;
+import org.chorem.lima.business.AccountService;
import org.chorem.lima.business.ImportExportService;
import org.chorem.lima.business.ImportExportServiceLocal;
import org.chorem.lima.business.LimaBusinessException;
@@ -36,12 +44,13 @@
import org.chorem.lima.business.LimaException;
import org.chorem.lima.entity.Account;
import org.chorem.lima.entity.AccountDAO;
+import org.chorem.lima.entity.AccountImpl;
import org.chorem.lima.entity.LimaCallaoDAOHelper;
import org.nuiton.topia.TopiaContext;
import org.nuiton.topia.TopiaContextFactory;
import org.nuiton.topia.TopiaException;
import org.nuiton.topia.TopiaNotFoundException;
-
+import au.com.bytecode.opencsv.CSVReader;
import au.com.bytecode.opencsv.CSVWriter;
/**
@@ -61,6 +70,9 @@
private static final Log log = LogFactory.getLog(ImportExportServiceImpl.class);
private TopiaContext rootContext;
+
+ @EJB
+ AccountService accountService;
public ImportExportServiceImpl() {
LimaConfig config = LimaConfig.getInstance();
@@ -176,12 +188,17 @@
nextLine[2] = account.getThirdParty();
Account masterAccount = account.getMasterAccount();
Account generalLedger = account.getGeneralLedger();
+ String masterAccountString = "";
+ String generalLedgerString = "";
if (masterAccount != null){
- nextLine[3] = masterAccount.getAccountNumber();
+ masterAccountString = masterAccount.getAccountNumber();
}
+ nextLine[3] = masterAccountString;
if (generalLedger != null){
- nextLine[4] = generalLedger.getAccountNumber();
+ generalLedgerString = generalLedger.getAccountNumber();
}
+ nextLine[4] = generalLedgerString;
+
// Ajoute la ligne au fichier
csvWriter.writeNext(nextLine);
}
@@ -200,7 +217,104 @@
}
}
+
@Override
+ public String importAccountsChartCSV(String path) throws LimaException {
+ File f = new File(path);
+ String result = "";
+
+ TopiaContext topiaContext = null;
+ try {
+ topiaContext = beginTransaction();
+
+ String[] nextLine = new String[1];
+ CSVReader csvReader = new CSVReader(new FileReader(f), ';');
+
+ nextLine = csvReader.readNext(); // Date début période
+ log.debug(nextLine[0]);
+ if (!nextLine[0].equals("lima.accountschart")){
+ throw new LimaBusinessException("The file is not an export csv file type accountschart");
+ }
+
+ AccountDAO accountDAO = LimaCallaoDAOHelper.getAccountDAO(topiaContext);
+
+ TreeMap<String, AccountImport> accounts = new TreeMap<String, AccountImport>();
+
+ while ((nextLine = csvReader.readNext()) != null) {
+ String accountNumber = nextLine[0];
+ String label = nextLine[1];
+ String thirdParty = nextLine[2];
+ String masterAccountNumber = nextLine[3];
+ String generalLedgerNumber = nextLine[4];
+
+ //if exist, skip
+ if (accountDAO.findByAccountNumber(accountNumber) != null){
+ result += "FAILED : The account " + accountNumber + " already exists !\n";
+ }
+ else {
+ //create it
+ AccountImport account = new AccountImportImpl();
+ account.setAccountNumber(accountNumber);
+ account.setLabel(label);
+ account.setThirdParty(thirdParty);
+ account.setMasterAccount(masterAccountNumber);
+ account.setGeneralLedger(generalLedgerNumber);
+ // put it in hashset
+ accounts.put(accountNumber, account);
+ }
+ }
+
+ while (accounts.size() > 0){
+
+ log.debug(accounts.size());
+ for (Iterator<AccountImport> itr = accounts.values().iterator(); itr.hasNext();){
+ AccountImport accountImport = itr.next();
+ String masterAccountNumber = accountImport.getMasterAccount();
+ String generalLedgerNumber = accountImport.getGeneralLedger();
+ Account masterAccount = accountDAO.findByAccountNumber(masterAccountNumber);
+ Account generalLedger = accountDAO.findByAccountNumber(generalLedgerNumber);
+
+ if ((masterAccountNumber.equals("") && generalLedgerNumber.equals("")) || masterAccount != null || generalLedger != null){
+ log.debug("create it");
+ log.debug(accountImport.getAccountNumber());
+ //create it
+ Account account = new AccountImpl();
+ account.setAccountNumber(accountImport.getAccountNumber());
+ account.setLabel(accountImport.getLabel());
+ account.setThirdParty(accountImport.getThirdParty());
+ account.setMasterAccount(masterAccount);
+ account.setGeneralLedger(generalLedger);
+
+ if (generalLedger != null){
+ accountService.createSubLedger(generalLedger, account);
+ }
+ else {
+ accountService.createAccount(masterAccount, account);
+ }
+ result += "SUCCESS : The account " + accountImport.getAccountNumber() + " is created ! \n";
+ itr.remove();
+ }
+ else if (!accounts.containsKey(masterAccountNumber) && !accounts.containsKey(generalLedgerNumber) ){
+ result += "FAILED : The account " + accountImport.getAccountNumber() + " have masterAccount : " + masterAccountNumber + "which not exist \n";
+ itr.remove();
+ }
+ }
+ }
+ }
+ catch (TopiaException eeeTE){
+ doCatch(topiaContext, eeeTE, log);
+ }
+ catch (IOException eeeIO) {
+ log.debug("Can't create new CSV Reader with file"+f+eeeIO);
+ }
+ finally {
+ doFinally(topiaContext, log);
+ }
+ return result;
+ }
+
+
+ @Override
public void exportEntryBookChartAsCSV(byte[] data) throws LimaException {
// TODO Auto-generated method stub
Modified: trunk/lima-callao/src/main/xmi/accounting.zargo
===================================================================
(Binary files differ)
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountTreeTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountTreeTableModel.java 2010-07-01 13:16:53 UTC (rev 2957)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountTreeTableModel.java 2010-07-01 14:23:40 UTC (rev 2958)
@@ -235,7 +235,16 @@
}
modelSupport.fireTreeStructureChanged(path);
}
+
+ /**
+ * Refresh accountschart.
+ *
+ */
+ public void refreshTree() throws LimaException {
+ modelSupport.fireNewRoot();
+ }
+
/**
* Remove account.
*
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 2010-07-01 13:16:53 UTC (rev 2957)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java 2010-07-01 14:23:40 UTC (rev 2958)
@@ -24,6 +24,7 @@
import javax.swing.tree.TreePath;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.chorem.lima.business.AccountService;
import org.chorem.lima.business.ImportExportService;
import org.chorem.lima.business.LimaBusinessException;
import org.chorem.lima.business.LimaException;
@@ -54,12 +55,14 @@
protected AccountView view;
+ protected AccountService accountService;
protected ImportExportService importExportService;
protected AccountViewHandler(AccountView view) {
this.view = view;
// Gets factory service
importExportService = LimaServiceFactory.getInstance().getImportExportService();
+ accountService = LimaServiceFactory.getInstance().getAccountService();
}
/**
@@ -246,6 +249,11 @@
};
public void importexportAccount(){
+
+ JXTreeTable accountsTreeTable = view.getAccountsTreeTable();
+ AccountTreeTableModel accountsTreeTableModel =
+ (AccountTreeTableModel)accountsTreeTable.getTreeTableModel();
+
ImportExportForm importExportForm = new ImportExportForm(view);
importExportForm.setLocationRelativeTo(view);
importExportForm.setVisible(true);
@@ -258,24 +266,43 @@
FileChooseView fileChooseView = new FileChooseView(view);
JFileChooser chooser = fileChooseView.getChooser();
- if (mode.equals("import") || mode.equals("update")){
- chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
- }
- else {
- chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
- if (chooser.showOpenDialog(view) == JFileChooser.APPROVE_OPTION) {
- String filePath = chooser.getSelectedFile().getAbsolutePath();
- log.debug(filePath);
- try {
- importExportService.exportAccountsChartAsCSV(filePath);
- } catch (LimaException eee) {
- if (log.isErrorEnabled()){
- log.error("Can't export this file", eee);
- }
- DialogHelper.showMessageDialog(eee.getMessage());
- }
- }
- }
+
+ try {
+ if (mode.equals("import")){
+ chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
+ if (chooser.showOpenDialog(view) == JFileChooser.APPROVE_OPTION) {
+ String filePath = chooser.getSelectedFile().getAbsolutePath();
+ log.debug(filePath);
+ accountService.removeAllAccount();
+ String message = importExportService.importAccountsChartCSV(filePath);
+ DialogHelper.showMessageDialog(message);
+ }
+
+ }
+ else if (mode.equals("update")){
+ chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
+ if (chooser.showOpenDialog(view) == JFileChooser.APPROVE_OPTION) {
+ String filePath = chooser.getSelectedFile().getAbsolutePath();
+ log.debug(filePath);
+ String message = importExportService.importAccountsChartCSV(filePath);
+ accountsTreeTableModel.refreshTree();
+ DialogHelper.showMessageDialog(message);
+ }
+ }
+ else {
+ chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
+ if (chooser.showOpenDialog(view) == JFileChooser.APPROVE_OPTION) {
+ String filePath = chooser.getSelectedFile().getAbsolutePath();
+ log.debug(filePath);
+ importExportService.exportAccountsChartAsCSV(filePath);
+ }
+ }
+ } catch (LimaException eee) {
+ if (log.isErrorEnabled()){
+ log.error("Can't "+ mode +" this file", eee);
+ }
+ DialogHelper.showMessageDialog(eee.getMessage());
+ }
}
1
0
Author: tchemit
Date: 2010-07-01 15:16:53 +0200 (Thu, 01 Jul 2010)
New Revision: 2957
Url: http://chorem.org/repositories/revision/lima/2957
Log:
Utilisation de mavenpom4labs 2.2.2.1
Modified:
trunk/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-07-01 12:32:35 UTC (rev 2956)
+++ trunk/pom.xml 2010-07-01 13:16:53 UTC (rev 2957)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>mavenpom4redmine</artifactId>
- <version>2.2.2</version>
+ <version>2.2.2.1</version>
</parent>
<groupId>org.chorem</groupId>
1
0
Author: tchemit
Date: 2010-07-01 14:32:35 +0200 (Thu, 01 Jul 2010)
New Revision: 2956
Url: http://chorem.org/repositories/revision/lima/2956
Log:
Utilisation de mavenpom4redmine 2.2.2
Modified:
trunk/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-06-30 17:10:09 UTC (rev 2955)
+++ trunk/pom.xml 2010-07-01 12:32:35 UTC (rev 2956)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>mavenpom4redmine</artifactId>
- <version>2.2.2-SNAPSHOT</version>
+ <version>2.2.2</version>
</parent>
<groupId>org.chorem</groupId>
1
0
Author: jpepin
Date: 2010-06-30 19:10:09 +0200 (Wed, 30 Jun 2010)
New Revision: 2955
Url: http://chorem.org/repositories/revision/lima/2955
Log:
Export du plan comptable.
Ajout cl?\195?\169 m?\195?\169tier sur account number.
Added:
trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/ImportExportForm.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/util/FileChooseView.jaxx
Removed:
trunk/lima-swing/src/main/java/org/chorem/lima/ui/FileChooseView.jaxx
Modified:
trunk/lima-business/pom.xml
trunk/lima-business/src/main/java/org/chorem/lima/business/ImportExportService.java
trunk/lima-business/src/main/java/org/chorem/lima/business/LimaConfig.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportExportServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/csv/CSVExport.java
trunk/lima-callao/src/main/xmi/accounting.properties
trunk/lima-swing/src/main/java/org/chorem/lima/LimaConfig.java
trunk/lima-swing/src/main/java/org/chorem/lima/service/LimaServiceFactory.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/AccountTableCellEditor.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
trunk/pom.xml
Modified: trunk/lima-business/pom.xml
===================================================================
--- trunk/lima-business/pom.xml 2010-06-30 09:01:22 UTC (rev 2954)
+++ trunk/lima-business/pom.xml 2010-06-30 17:10:09 UTC (rev 2955)
@@ -25,6 +25,10 @@
<artifactId>jdom</artifactId>
</dependency>
<dependency>
+ <groupId>net.sf.opencsv</groupId>
+ <artifactId>opencsv</artifactId>
+ </dependency>
+ <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ImportExportService.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ImportExportService.java 2010-06-30 09:01:22 UTC (rev 2954)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ImportExportService.java 2010-06-30 17:10:09 UTC (rev 2955)
@@ -84,4 +84,44 @@
* @throws LimaException
*/
void importAsEbpCSV(byte[] data) throws LimaException;
+
+ /**
+ * Import data as Sage Maestria export.
+ *
+ * @param data
+ * @throws LimaException
+ */
+ void importAsSage(byte[] data) throws LimaException;
+
+ /**
+ * Import data as Ciel Compta export.
+ *
+ * @param data
+ * @throws LimaException
+ */
+ void importAsCiel(byte[] data) throws LimaException;
+
+ /**
+ * export accounts chart as CSV.
+ *
+ * @param data
+ * @throws LimaException
+ */
+ void exportAccountsChartAsCSV(String path) throws LimaException;
+
+ /**
+ * export entrybook chart as CSV.
+ *
+ * @param data
+ * @throws LimaException
+ */
+ void exportEntryBookChartAsCSV(byte[] data) throws LimaException;
+
+ /**
+ * export financialstatement chart as CSV.
+ *
+ * @param data
+ * @throws LimaException
+ */
+ void exportFinancialStatementChartAsCSV(byte[] data) throws LimaException;
}
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/LimaConfig.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/LimaConfig.java 2010-06-30 09:01:22 UTC (rev 2954)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/LimaConfig.java 2010-06-30 17:10:09 UTC (rev 2955)
@@ -119,10 +119,10 @@
public final String key;
public final String description;
- public final String defaultValue;
+ public String defaultValue;
public final Class<?> type;
- public final boolean _transient;
- public final boolean _final;
+ public boolean _transient;
+ public boolean _final;
private Option(String key, String description, String defaultValue,
Class<?> type, boolean _transient, boolean _final) {
@@ -138,16 +138,31 @@
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;
+ }
@Override
public String getDescription() {
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportExportServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportExportServiceImpl.java 2010-06-30 09:01:22 UTC (rev 2954)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportExportServiceImpl.java 2010-06-30 17:10:09 UTC (rev 2955)
@@ -20,18 +20,30 @@
package org.chorem.lima.business.ejb;
import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileWriter;
import java.io.IOException;
import java.io.OutputStream;
-
+import java.util.List;
import javax.ejb.Stateless;
-
import org.apache.commons.io.IOUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.ImportExportService;
import org.chorem.lima.business.ImportExportServiceLocal;
+import org.chorem.lima.business.LimaBusinessException;
+import org.chorem.lima.business.LimaConfig;
import org.chorem.lima.business.LimaException;
+import org.chorem.lima.entity.Account;
+import org.chorem.lima.entity.AccountDAO;
+import org.chorem.lima.entity.LimaCallaoDAOHelper;
+import org.nuiton.topia.TopiaContext;
+import org.nuiton.topia.TopiaContextFactory;
+import org.nuiton.topia.TopiaException;
+import org.nuiton.topia.TopiaNotFoundException;
+import au.com.bytecode.opencsv.CSVWriter;
+
/**
* XML and CSV import export service.
*
@@ -44,10 +56,23 @@
* By : $Author$
*/
@Stateless
-public class ImportExportServiceImpl implements ImportExportService, ImportExportServiceLocal {
+public class ImportExportServiceImpl extends AbstractLimaService implements ImportExportService, ImportExportServiceLocal {
private static final Log log = LogFactory.getLog(ImportExportServiceImpl.class);
+
+ private TopiaContext rootContext;
+ public ImportExportServiceImpl() {
+ LimaConfig config = LimaConfig.getInstance();
+ try {
+ rootContext = TopiaContextFactory.getContext(config.getOptions());
+ } catch (TopiaNotFoundException ex) {
+ if (log.isErrorEnabled()) {
+ log.error("Can't init topia context", ex);
+ }
+ }
+ }
+
/*
* @see org.chorem.lima.business.ImportExportService#exportAsXML()
*/
@@ -118,4 +143,82 @@
public void importAsEbpCSV(byte[] data) throws LimaException {
}
+
+ @Override
+ public void importAsCiel(byte[] data) throws LimaException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void importAsSage(byte[] data) throws LimaException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void exportAccountsChartAsCSV(String path) throws LimaException {
+ File f = new File(path);
+ TopiaContext topiaContext = null;
+ try {
+ topiaContext = beginTransaction();
+ CSVWriter csvWriter = new CSVWriter(new FileWriter(f), ';');
+ String[] nextLine = new String[5];
+ // Récupère tous les comptes
+ AccountDAO accountDAO = LimaCallaoDAOHelper.getAccountDAO(topiaContext);
+ List<Account> listAccount = accountDAO.findAll();
+ nextLine[0] = "lima.accountschart";
+ csvWriter.writeNext(nextLine);
+ // Pour tous les comptes
+ for (Account account : listAccount) {
+ nextLine[0] = account.getAccountNumber();
+ nextLine[1] = account.getLabel();
+ nextLine[2] = account.getThirdParty();
+ Account masterAccount = account.getMasterAccount();
+ Account generalLedger = account.getGeneralLedger();
+ if (masterAccount != null){
+ nextLine[3] = masterAccount.getAccountNumber();
+ }
+ if (generalLedger != null){
+ nextLine[4] = generalLedger.getAccountNumber();
+ }
+ // Ajoute la ligne au fichier
+ csvWriter.writeNext(nextLine);
+ }
+ // Write cache in file
+ csvWriter.flush();
+ csvWriter.close();
+ }
+ catch (TopiaException eeeTE){
+ doCatch(topiaContext, eeeTE, log);
+ }
+ catch (IOException eeeIO) {
+ log.debug("Can't create new CSV Writer with file"+f+eeeIO);
+ }
+ finally {
+ doFinally(topiaContext, log);
+ }
+ }
+
+ @Override
+ public void exportEntryBookChartAsCSV(byte[] data) throws LimaException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void exportFinancialStatementChartAsCSV(byte[] data)
+ throws LimaException {
+ // TODO Auto-generated method stub
+
+ }
+
+ protected TopiaContext beginTransaction() throws TopiaException {
+ // basic check done, make check in database
+ // TODO move it into JTA
+ TopiaContext topiaTransaction;
+ topiaTransaction = rootContext.beginTransaction();
+ log.trace("beginTransaction"+topiaTransaction);
+ return topiaTransaction;
+ }
}
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/csv/CSVExport.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/csv/CSVExport.java 2010-06-30 09:01:22 UTC (rev 2954)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/csv/CSVExport.java 2010-06-30 17:10:09 UTC (rev 2955)
@@ -23,11 +23,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.LimaContext;
-import org.chorem.lima.dto.AccountDTO;
-import org.chorem.lima.dto.EntryDTO;
-import org.chorem.lima.dto.JournalDTO;
-import org.chorem.lima.dto.PeriodDTO;
-import org.chorem.lima.dto.TransactionDTO;
+
import org.chorem.lima.util.Util;
import org.chorem.lima.service.util.ServiceHelper;
Modified: trunk/lima-callao/src/main/xmi/accounting.properties
===================================================================
--- trunk/lima-callao/src/main/xmi/accounting.properties 2010-06-30 09:01:22 UTC (rev 2954)
+++ trunk/lima-callao/src/main/xmi/accounting.properties 2010-06-30 17:10:09 UTC (rev 2955)
@@ -1,5 +1,10 @@
# Precise l'entete de l'ensemble des fichiers generes
model.tagvalue.copyright=/*\n Copyright (C) 2009-2010 Lima Callao\n */
+
+org.chorem.lima.entity.Account.class.tagvalue.naturalIdMutable=false
+org.chorem.lima.entity.Account.attribute.accountNumber.tagvalue.naturalId=true
+org.chorem.lima.entity.Account.attribute.accountNumber.tagvalue.notNull=true
+
org.chorem.lima.entity.Account.attribute.subAccounts.tagvalue.lazy=false
org.chorem.lima.entity.Account.attribute.subLedgers.tagvalue.lazy=false
org.chorem.lima.entity.FinancialTransaction.attribute.financialPeriod.tagvalue.lazy=false
@@ -8,6 +13,5 @@
org.chorem.lima.entity.FinancialStatement.attribute.masterFinancialStatement.tagvalue.lazy=false
-
#model.tagvalue.dbSchema=Callao
model.tagvalue.String=text
\ No newline at end of file
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/LimaConfig.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/LimaConfig.java 2010-06-30 09:01:22 UTC (rev 2954)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/LimaConfig.java 2010-06-30 17:10:09 UTC (rev 2955)
@@ -249,10 +249,10 @@
public final String key;
public final String description;
- public final String defaultValue;
+ public String defaultValue;
public final Class<?> type;
- public final boolean _transient;
- public final boolean _final;
+ public boolean _transient;
+ public boolean _final;
private Option(String key, String description, String defaultValue,
Class<?> type, boolean _transient, boolean _final) {
@@ -268,11 +268,21 @@
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() {
@@ -280,6 +290,11 @@
}
@Override
+ public void setDefaultValue(String defaultValue) {
+ this.defaultValue=defaultValue;
+ }
+
+ @Override
public String getDescription() {
return description;
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/service/LimaServiceFactory.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/service/LimaServiceFactory.java 2010-06-30 09:01:22 UTC (rev 2954)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/service/LimaServiceFactory.java 2010-06-30 17:10:09 UTC (rev 2955)
@@ -36,6 +36,7 @@
import org.chorem.lima.business.FinancialPeriodService;
import org.chorem.lima.business.FinancialStatementService;
import org.chorem.lima.business.FiscalPeriodService;
+import org.chorem.lima.business.ImportExportService;
import org.chorem.lima.business.RecordService;
import org.chorem.lima.business.FinancialTransactionService;
import org.chorem.lima.business.ReportService;
@@ -274,6 +275,24 @@
}
/**
+ * Get financial statement service.
+ *
+ */
+ public ImportExportService getImportExportService() {
+
+ String lookupName = "ImportExportServiceImplRemote";
+ ImportExportService ejbHome = null;
+ try {
+ ejbHome = (ImportExportService)ctx.lookup(lookupName);
+ } catch (NamingException eee) {
+ if (log.isErrorEnabled()) {
+ log.error("Can't lookup for service : " + lookupName, eee);
+ }
+ }
+ return ejbHome;
+ }
+
+ /**
* Get record service.
*
* @return record service proxy
Deleted: trunk/lima-swing/src/main/java/org/chorem/lima/ui/FileChooseView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/FileChooseView.jaxx 2010-06-30 09:01:22 UTC (rev 2954)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/FileChooseView.jaxx 2010-06-30 17:10:09 UTC (rev 2955)
@@ -1,3 +0,0 @@
-<JFrame title="lima.export">
- <JFileChooser id="chooser" width="620" height="400"/>
-</JFrame>
\ No newline at end of file
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountView.jaxx 2010-06-30 09:01:22 UTC (rev 2954)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountView.jaxx 2010-06-30 17:10:09 UTC (rev 2955)
@@ -27,7 +27,7 @@
</script>
<row>
- <cell fill="both" weightx="1" weighty="1" rows='4'>
+ <cell fill="both" weightx="1" weighty="1" rows='5'>
<JScrollPane>
<org.jdesktop.swingx.JXTreeTable id="accountsTreeTable"
selectionMode="{ListSelectionModel.SINGLE_SELECTION}"
@@ -64,4 +64,10 @@
enabled="{isSelectedRow()}"/>
</cell>
</row>
+ <row>
+ <cell fill="horizontal">
+ <JButton id="importexportButton" text="lima.common.importexport"
+ onActionPerformed="getHandler().importexportAccount()"/>
+ </cell>
+ </row>
</Table>
\ No newline at end of file
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 2010-06-30 09:01:22 UTC (rev 2954)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java 2010-06-30 17:10:09 UTC (rev 2955)
@@ -19,21 +19,23 @@
package org.chorem.lima.ui.account;
import static org.nuiton.i18n.I18n._;
-
+import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import javax.swing.tree.TreePath;
-
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.chorem.lima.business.ImportExportService;
import org.chorem.lima.business.LimaBusinessException;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.entity.Account;
import org.chorem.lima.entity.AccountImpl;
+import org.chorem.lima.service.LimaServiceFactory;
import org.chorem.lima.ui.account.AccountForm;
import org.chorem.lima.ui.account.AccountView;
import org.chorem.lima.ui.account.SubLedgerForm;
import org.chorem.lima.util.DialogHelper;
import org.chorem.lima.util.ErrorHelper;
+import org.chorem.lima.util.FileChooseView;
import org.jdesktop.swingx.JXTreeTable;
/**
@@ -52,8 +54,12 @@
protected AccountView view;
+ protected ImportExportService importExportService;
+
protected AccountViewHandler(AccountView view) {
this.view = view;
+ // Gets factory service
+ importExportService = LimaServiceFactory.getInstance().getImportExportService();
}
/**
@@ -239,4 +245,40 @@
}
};
+ public void importexportAccount(){
+ ImportExportForm importExportForm = new ImportExportForm(view);
+ importExportForm.setLocationRelativeTo(view);
+ importExportForm.setVisible(true);
+
+ Object value = importExportForm.getRadioButtons().getSelectedValue();
+ log.debug(value);
+ // if action confirmed
+ if (value != null){
+ String mode = (String) value;
+ FileChooseView fileChooseView = new FileChooseView(view);
+
+ JFileChooser chooser = fileChooseView.getChooser();
+ if (mode.equals("import") || mode.equals("update")){
+ chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
+ }
+ else {
+ chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
+ if (chooser.showOpenDialog(view) == JFileChooser.APPROVE_OPTION) {
+ String filePath = chooser.getSelectedFile().getAbsolutePath();
+ log.debug(filePath);
+ try {
+ importExportService.exportAccountsChartAsCSV(filePath);
+ } catch (LimaException eee) {
+ if (log.isErrorEnabled()){
+ log.error("Can't export this file", eee);
+ }
+ DialogHelper.showMessageDialog(eee.getMessage());
+ }
+ }
+ }
+
+ }
+
+ }
+
}
Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/ImportExportForm.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/ImportExportForm.jaxx (rev 0)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/ImportExportForm.jaxx 2010-06-30 17:10:09 UTC (rev 2955)
@@ -0,0 +1,56 @@
+<!-- ##% Lima Swing
+ Copyright (C) 2008 - 2010 CodeLutin
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; either version 2
+ 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, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ ##% -->
+
+<JDialog modal="true">
+
+ <org.chorem.lima.entity.Account id="account" javaBean='null'/>
+ <jaxx.runtime.swing.JAXXButtonGroup id="radioButtons" javaBean='new JAXXButtonGroup()'/>
+ <Boolean id="addState" javaBean='true'/>
+
+ <script>
+ <![CDATA[
+ protected void performCancel() {
+ getRadioButtons().setSelectedValue(null);
+ dispose();
+ }
+ ]]>
+ </script>
+
+ <Table>
+ <row>
+ <cell>
+ <JRadioButton text='lima.importexport.export' value='export' buttonGroup="{getRadioButtons()}"
+ selected='true'/>
+ </cell>
+ <cell>
+ <JRadioButton text='lima.importexport.import' value='import' buttonGroup="{getRadioButtons()}"
+ selected='true'/>
+ </cell>
+ <cell>
+ <JRadioButton text='lima.importexport.update' value='update' buttonGroup="{getRadioButtons()}"
+ selected='true'/>
+ </cell>
+
+ <cell fill="none">
+ <JButton text="lima.common.ok" onActionPerformed="dispose()"/>
+ </cell>
+ <cell fill="none">
+ <JButton text="lima.common.cancel" onActionPerformed="performCancel()"/>
+ </cell>
+ </row>
+ </Table>
+</JDialog>
\ No newline at end of file
Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/ImportExportForm.jaxx
___________________________________________________________________
Added: svn:executable
+ *
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/AccountTableCellEditor.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/AccountTableCellEditor.java 2010-06-30 09:01:22 UTC (rev 2954)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/AccountTableCellEditor.java 2010-06-30 17:10:09 UTC (rev 2955)
@@ -81,6 +81,7 @@
// Validate editing with enter key
if ( e.getKeyChar() == KeyEvent.VK_ENTER )
{
+
stopCellEditing();
}
}
Added: trunk/lima-swing/src/main/java/org/chorem/lima/util/FileChooseView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/util/FileChooseView.jaxx (rev 0)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/util/FileChooseView.jaxx 2010-06-30 17:10:09 UTC (rev 2955)
@@ -0,0 +1,3 @@
+<JFrame title="lima.export">
+ <JFileChooser id="chooser" width="620" height="400"/>
+</JFrame>
\ No newline at end of file
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 2010-06-30 09:01:22 UTC (rev 2954)
+++ trunk/lima-swing/src/main/resources/i18n/lima-swing-en_GB.properties 2010-06-30 17:10:09 UTC (rev 2955)
@@ -4,7 +4,9 @@
Global\ lima\ exception=
LIMA=
Loading\ accounting...=
+export=
hello\ world=
+import=
lima.about.message=
lima.account=Account
lima.account.label=Label
@@ -31,6 +33,7 @@
lima.common.add=
lima.common.addSubLedger=
lima.common.cancel=
+lima.common.importexport=
lima.common.ok=
lima.common.print=
lima.common.quit=
@@ -90,6 +93,9 @@
lima.import.all.csv=Import all datas (CSV)
lima.import.all.csv.ebp=Import all datas (EBP)
lima.import.journal=Import journal
+lima.importexport.export=
+lima.importexport.import=
+lima.importexport.update=
lima.init.closed=Lima closed at %1$s
lima.init.errorclosing=
lima.lettering.add=
@@ -183,3 +189,4 @@
limahome.fiscalperiodopened=
limahome.transactionbalanced=
limahome.transactionunbalanced=
+update=
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 2010-06-30 09:01:22 UTC (rev 2954)
+++ trunk/lima-swing/src/main/resources/i18n/lima-swing-fr_FR.properties 2010-06-30 17:10:09 UTC (rev 2955)
@@ -4,7 +4,9 @@
Global\ lima\ exception=
LIMA=
Loading\ accounting...=
+export=
hello\ world=
+import=
lima.about.message=\u00C0 propos de Lima
lima.account=Compte
lima.account.label=
@@ -31,6 +33,7 @@
lima.common.add=Ajout Compte G\u00E9n\u00E9ral
lima.common.addSubLedger=Ajouter Compte Tiers
lima.common.cancel=Annuler
+lima.common.importexport=
lima.common.ok=OK
lima.common.print=
lima.common.quit=Quitter
@@ -90,6 +93,9 @@
lima.import.all.csv=Importer une nouvelle base (CSV)
lima.import.all.csv.ebp=Importer des donn\u00E9es de EBP
lima.import.journal=Importer le journal
+lima.importexport.export=
+lima.importexport.import=
+lima.importexport.update=
lima.init.closed=Lima ferm\u00E9 \u00E0 %1$s
lima.init.errorclosing=
lima.lettering.add=Ajouter une lettre
@@ -182,3 +188,4 @@
limahome.fiscalperiodopened=exercices ouverts
limahome.transactionbalanced=Toutes les entr\u00E9es sont \u00E9quilibr\u00E9es
limahome.transactionunbalanced=ne sont pas \u00E9quilibr\u00E9e \!
+update=
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-06-30 09:01:22 UTC (rev 2954)
+++ trunk/pom.xml 2010-06-30 17:10:09 UTC (rev 2955)
@@ -249,6 +249,7 @@
<platform>chorem.org</platform>
<projectId>lima</projectId>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<!-- customized libs version -->
<nuiton-utils.version>1.3.2-SNAPSHOT</nuiton-utils.version>
1
0
Author: tchemit
Date: 2010-06-30 11:01:22 +0200 (Wed, 30 Jun 2010)
New Revision: 2954
Url: http://chorem.org/repositories/revision/lima/2954
Log:
fix pom
Modified:
trunk/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-06-29 14:04:36 UTC (rev 2953)
+++ trunk/pom.xml 2010-06-30 09:01:22 UTC (rev 2954)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>mavenpom4redmine</artifactId>
- <version>2.2.1</version>
+ <version>2.2.2-SNAPSHOT</version>
</parent>
<groupId>org.chorem</groupId>
@@ -72,12 +72,12 @@
<version>${nuiton-utils.version}</version>
</dependency>
- <dependency>
+ <!--dependency>
<groupId>org.nuiton.eugene</groupId>
<artifactId>eugene</artifactId>
<version>${eugene.version}</version>
<scope>runtime</scope>
- </dependency>
+ </dependency-->
<!-- librairie Jaxx -->
<dependency>
@@ -205,6 +205,17 @@
<role>Développeur</role>
</roles>
</developer>
+ <developer>
+ <id>tchemit</id>
+ <name>Chatellier Eric</name>
+ <email>chemit(a)codelutin.com</email>
+ <organization>Code Lutin</organization>
+ <organizationUrl>http://www.codelutin.com</organizationUrl>
+ <timezone>+2</timezone>
+ <roles>
+ <role>Développeur</role>
+ </roles>
+ </developer>
</developers>
<contributors>
<contributor>
@@ -240,11 +251,11 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- customized libs version -->
- <nuiton-utils.version>1.2.2</nuiton-utils.version>
- <eugene.version>2.0.3-SNAPSHOT</eugene.version>
+ <nuiton-utils.version>1.3.2-SNAPSHOT</nuiton-utils.version>
+ <eugene.version>2.1-SNAPSHOT</eugene.version>
<topia.version>2.3.5-SNAPSHOT</topia.version>
<jaxx.version>2.0.2</jaxx.version>
- <i18n.version>1.2.2</i18n.version>
+ <i18n.version>1.2.3-SNAPSHOT</i18n.version>
<!--axis.version>1.4.1</axis.version-->
<!-- 1.4 and 1.4.1 breaks jnlp with corrupt jar
@@ -307,7 +318,7 @@
<repositories>
<!-- depot des releases nuiton -->
- <repository>
+ <!--repository>
<id>nuiton.release</id>
<name>NuitonReleaseRepository</name>
<url>http://maven.nuiton.org/release</url>
@@ -318,9 +329,9 @@
<enabled>true</enabled>
<checksumPolicy>warn</checksumPolicy>
</releases>
- </repository>
+ </repository-->
<!-- depot des snapshots nuiton -->
- <repository>
+ <!--repository>
<id>nuiton.snapshot</id>
<name>NuitonSnapshotRepository</name>
<url>http://maven.nuiton.org/snapshot</url>
@@ -331,21 +342,21 @@
<releases>
<enabled>false</enabled>
</releases>
- </repository>
+ </repository-->
<!-- jboss -->
- <repository>
+ <!--repository>
<id>jboss.repo</id>
<url>http://repository.jboss.org/maven2</url>
</repository>
<repository>
<id>apache.snapshot</id>
<url>http://repository.apache.org/snapshots</url>
- </repository>
+ </repository-->
</repositories>
<pluginRepositories>
<!-- depot des releases nuiton -->
- <pluginRepository>
+ <!--pluginRepository>
<id>nuiton.release</id>
<name>NuitonReleaseRepository</name>
<url>http://maven.nuiton.org/release</url>
@@ -356,9 +367,9 @@
<enabled>true</enabled>
<checksumPolicy>warn</checksumPolicy>
</releases>
- </pluginRepository>
+ </pluginRepository-->
<!-- depot des snapshots nuiton -->
- <pluginRepository>
+ <!--pluginRepository>
<id>nuiton.snapshot</id>
<name>NuitonSnapshotRepository</name>
<url>http://maven.nuiton.org/snapshot</url>
@@ -369,6 +380,6 @@
<releases>
<enabled>false</enabled>
</releases>
- </pluginRepository>
+ </pluginRepository-->
</pluginRepositories>
</project>
1
0
r2953 - in trunk: . lima-callao lima-callao/src/main/xmi lima-swing/src/main/java/org/chorem/lima/ui/celleditor lima-swing/src/main/java/org/chorem/lima/ui/combobox lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction lima-swing/src/main/java/org/chorem/lima/util
by jpepin@users.chorem.org 29 Jun '10
by jpepin@users.chorem.org 29 Jun '10
29 Jun '10
Author: jpepin
Date: 2010-06-29 16:04:36 +0200 (Tue, 29 Jun 2010)
New Revision: 2953
Url: http://chorem.org/repositories/revision/lima/2953
Log:
Ajout de l'autocompl?\195?\169tion dans la fonction de saisie d'?\195?\169criture.
Added:
trunk/lima-swing/src/main/java/org/chorem/lima/util/AccountToString.java
trunk/lima-swing/src/main/java/org/chorem/lima/util/EntryBookToString.java
Modified:
trunk/lima-callao/pom.xml
trunk/lima-callao/src/main/xmi/accounting.zargo
trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/AccountTableCellEditor.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/EntryBookTableCellEditor.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/AccountComboBoxModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/EntryBookComboBoxModel.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/pom.xml
Modified: trunk/lima-callao/pom.xml
===================================================================
--- trunk/lima-callao/pom.xml 2010-06-28 15:47:17 UTC (rev 2952)
+++ trunk/lima-callao/pom.xml 2010-06-29 14:04:36 UTC (rev 2953)
@@ -65,7 +65,12 @@
<phase>generate-sources</phase>
<configuration>
<inputs>zargo</inputs>
- <templates>org.nuiton.topia.generator.TopiaMetaTransformer, org.nuiton.eugene.java.JavaBeanTransformer</templates>
+ <templates>org.nuiton.topia.generator.TopiaMetaTransformer, org.nuiton.topia.generator.EntityTransformer, org.nuiton.eugene.java.JavaBeanTransformer, org.nuiton.topia.generator.QueryHelperTransformer</templates>
+ <excludeTemplates>
+ <excludeTemplate>org.nuiton.topia.generator.EntityAbstractTransformer</excludeTemplate>
+ <excludeTemplate>org.nuiton.topia.generator.EntityImplTransformer</excludeTemplate>
+ <excludeTemplate>org.nuiton.topia.generator.EntityInterfaceTransformer</excludeTemplate>
+ </excludeTemplates>
<defaultPackage>org.chorem.lima.entity</defaultPackage>
<fullPackagePath>org.chorem.lima</fullPackagePath>
</configuration>
Modified: trunk/lima-callao/src/main/xmi/accounting.zargo
===================================================================
(Binary files differ)
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/AccountTableCellEditor.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/AccountTableCellEditor.java 2010-06-28 15:47:17 UTC (rev 2952)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/AccountTableCellEditor.java 2010-06-29 14:04:36 UTC (rev 2953)
@@ -20,19 +20,25 @@
package org.chorem.lima.ui.celleditor;
import java.awt.Component;
+import java.awt.event.KeyAdapter;
+import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.util.EventObject;
import javax.swing.AbstractCellEditor;
import javax.swing.JTable;
+import javax.swing.SwingUtilities;
import javax.swing.table.TableCellEditor;
+import javax.swing.text.JTextComponent;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.entity.Account;
import org.chorem.lima.ui.combobox.AccountRenderer;
import org.chorem.lima.ui.combobox.SubAccountComboBoxModel;
+import org.chorem.lima.util.AccountToString;
import org.chorem.lima.widgets.JWideComboBox;
+import org.jdesktop.swingx.autocomplete.AutoCompleteDecorator;
public class AccountTableCellEditor extends AbstractCellEditor implements TableCellEditor {
@@ -40,6 +46,7 @@
private final JWideComboBox comboBox;
private static final long serialVersionUID = 2580476608066111095L;
private static AccountTableCellEditor editor;
+ private static boolean keyPressed = false;
/**
* constructor
@@ -50,6 +57,34 @@
comboBox.setModel(accountComboBoxModel);
AccountRenderer accountRenderer = new AccountRenderer();
comboBox.setRenderer(accountRenderer);
+ AutoCompleteDecorator.decorate(comboBox, AccountToString.getInstance());
+
+
+ /**
+ * Ajout d'un listener pour la frappe au clavier seulement, permettant
+ * de déplacer la sélection (et le caret) du fait que la première touche
+ * n'est pas prise en compte.
+ */
+ comboBox.getEditor().getEditorComponent().addKeyListener(new KeyAdapter() {
+
+ @Override
+ public void keyReleased(KeyEvent e) {
+ // Vérifie si c'est la première frappe au clavier
+ if ( keyPressed == false )
+ {
+ // Récupère l'editor de la comboBox
+ JTextComponent edit = (JTextComponent) comboBox.getEditor().getEditorComponent();
+ // Met en place le curseur et la selection après la première lettre
+ edit.select(1, edit.getText().length());
+ keyPressed = true;
+ }
+ // Validate editing with enter key
+ if ( e.getKeyChar() == KeyEvent.VK_ENTER )
+ {
+ stopCellEditing();
+ }
+ }
+ });
}
@Override
@@ -66,9 +101,37 @@
return comboBox.getSelectedItem();
}
+ /**
+ * Vérifie si la cellule peut être éditable :
+ * seulement si il y a une frappe au clavier ou un double clic.
+ * @param evt
+ * @return
+ */
@Override
public boolean isCellEditable(EventObject evt) {
- return !(evt instanceof MouseEvent) || ((MouseEvent) evt).getClickCount() == 2;
+ // Si il y a une frappe au clavier
+ if (evt instanceof KeyEvent) {
+ final KeyEvent keyEvent = (KeyEvent) evt;
+ // Empèche la touche echap
+ if ( keyEvent.getKeyChar() != KeyEvent.VK_ESCAPE )
+ {
+ // Permet de placer le focus sur l'editor de la comboBox
+ SwingUtilities.invokeLater(new Runnable() {
+ @Override
+ public void run() {
+ comboBox.getEditor().getEditorComponent().requestFocus();
+ JTextComponent edit = (JTextComponent) comboBox.getEditor().getEditorComponent();
+ if (!Character.isIdentifierIgnorable(keyEvent.getKeyChar()))
+ {
+ edit.setText(Character.toString(keyEvent.getKeyChar()));
+ }
+ }
+ });
+ }
+ }
+ // Remet à faux pour la premiere lettre tapée au clavier
+ keyPressed = false;
+ return ( !(evt instanceof MouseEvent) || ((MouseEvent) evt).getClickCount() == 2 );
}
public static AccountTableCellEditor getInstance() {
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/EntryBookTableCellEditor.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/EntryBookTableCellEditor.java 2010-06-28 15:47:17 UTC (rev 2952)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/EntryBookTableCellEditor.java 2010-06-29 14:04:36 UTC (rev 2953)
@@ -20,19 +20,23 @@
package org.chorem.lima.ui.celleditor;
import java.awt.Component;
+import java.awt.event.KeyAdapter;
+import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.util.EventObject;
-
import javax.swing.AbstractCellEditor;
import javax.swing.JTable;
+import javax.swing.SwingUtilities;
import javax.swing.table.TableCellEditor;
-
+import javax.swing.text.JTextComponent;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.entity.EntryBook;
import org.chorem.lima.ui.combobox.EntryBookComboBoxModel;
import org.chorem.lima.ui.combobox.EntryBookRenderer;
+import org.chorem.lima.util.EntryBookToString;
import org.chorem.lima.widgets.JWideComboBox;
+import org.jdesktop.swingx.autocomplete.AutoCompleteDecorator;
public class EntryBookTableCellEditor extends AbstractCellEditor implements TableCellEditor {
@@ -40,6 +44,7 @@
private final JWideComboBox comboBox;
private static final long serialVersionUID = 2580476608066111095L;
private static EntryBookTableCellEditor editor;
+ private static boolean keyPressed = false;
/**
* constructor
@@ -53,16 +58,44 @@
/*// Property Change Listener
LimaContext.getContext().getDataManager().getJournalModel().addPropertyChangeListener(comboBoxModel);
- comboBox.setModel(comboBoxModel);
+ comboBox.setModel(comboBoxModel);*/
+ //LimaContext.getContext().addPropertyChangeListener(entryBookComboBoxModel);
+
// AutoCompletion
- AutoCompleteDecorator.decorate(comboBox, JournalToStringConverter.getInstance());*/
+ AutoCompleteDecorator.decorate(comboBox, EntryBookToString.getInstance());
+
+ /**
+ * Ajout d'un listener pour la frappe au clavier seulement, permettant
+ * de déplacer la sélection (et le caret) du fait que la première touche
+ * n'est pas prise en compte.
+ */
+ comboBox.getEditor().getEditorComponent().addKeyListener(new KeyAdapter() {
+
+ @Override
+ public void keyReleased(KeyEvent e) {
+ // Vérifie si c'est la première frappe au clavier
+ if ( keyPressed == false )
+ {
+ // Récupère l'editor de la comboBox
+ JTextComponent edit = (JTextComponent) comboBox.getEditor().getEditorComponent();
+ // Met en place le curseur et la selection après la première lettre
+ edit.select(1, edit.getText().length());
+ keyPressed = true;
+ }
+ // Validate editing with enter key
+ if ( e.getKeyChar() == KeyEvent.VK_ENTER )
+ {
+ stopCellEditing();
+ }
+ }
+ });
+
}
@Override
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
if (value instanceof EntryBook){
- comboBox.setSelectedItem((EntryBook) value);
-
+ comboBox.setSelectedItem((EntryBook) value);
}
return comboBox;
}
@@ -72,9 +105,38 @@
return comboBox.getSelectedItem();
}
+
+ /**
+ * Vérifie si la cellule peut être éditable :
+ * seulement si il y a une frappe au clavier ou un double clic.
+ * @param evt
+ * @return
+ */
@Override
public boolean isCellEditable(EventObject evt) {
- return !(evt instanceof MouseEvent) || ((MouseEvent) evt).getClickCount() == 2;
+ // Si il y a une frappe au clavier
+ if (evt instanceof KeyEvent) {
+ final KeyEvent keyEvent = (KeyEvent) evt;
+ // Empèche la touche echap
+ if ( keyEvent.getKeyChar() != KeyEvent.VK_ESCAPE )
+ {
+ // Permet de placer le focus sur l'editor de la comboBox
+ SwingUtilities.invokeLater(new Runnable() {
+ @Override
+ public void run() {
+ comboBox.getEditor().getEditorComponent().requestFocus();
+ JTextComponent edit = (JTextComponent) comboBox.getEditor().getEditorComponent();
+ if (!Character.isIdentifierIgnorable(keyEvent.getKeyChar()))
+ {
+ edit.setText(Character.toString(keyEvent.getKeyChar()));
+ }
+ }
+ });
+ }
+ }
+ // Remet à faux pour la premiere lettre tapée au clavier
+ keyPressed = false;
+ return ( !(evt instanceof MouseEvent) || ((MouseEvent) evt).getClickCount() == 2 );
}
public static EntryBookTableCellEditor getInstance() {
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/AccountComboBoxModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/AccountComboBoxModel.java 2010-06-28 15:47:17 UTC (rev 2952)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/AccountComboBoxModel.java 2010-06-29 14:04:36 UTC (rev 2953)
@@ -19,7 +19,6 @@
package org.chorem.lima.ui.combobox;
import java.util.List;
-
import javax.swing.AbstractListModel;
import javax.swing.ComboBoxModel;
import org.apache.commons.logging.Log;
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/EntryBookComboBoxModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/EntryBookComboBoxModel.java 2010-06-28 15:47:17 UTC (rev 2952)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/EntryBookComboBoxModel.java 2010-06-29 14:04:36 UTC (rev 2953)
@@ -17,11 +17,9 @@
* ##%*/
package org.chorem.lima.ui.combobox;
-import java.util.List;
-import javax.swing.AbstractListModel;
-import javax.swing.ComboBoxModel;
-import javax.swing.event.ListDataListener;
+import java.util.List;
+import javax.swing.DefaultComboBoxModel;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.EntryBookService;
@@ -39,7 +37,7 @@
* Last update : $Date$
* By : $Author$
*/
-public class EntryBookComboBoxModel extends AbstractListModel implements ComboBoxModel {
+public class EntryBookComboBoxModel extends DefaultComboBoxModel {
private static final Log log = LogFactory.getLog(FinancialPeriodTableModel.class);
@@ -94,5 +92,4 @@
cacheDatas = getDataList();
fireContentsChanged(this, 0, cacheDatas.size());
}
-
}
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 2010-06-28 15:47:17 UTC (rev 2952)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionView.jaxx 2010-06-29 14:04:36 UTC (rev 2953)
@@ -22,7 +22,6 @@
<org.chorem.lima.ui.combobox.FiscalPeriodComboBoxModel id="modelFiscalPeriod"/>
<script>
<![CDATA[
-
import org.chorem.lima.entity.FiscalPeriod;
import org.chorem.lima.entity.FinancialPeriod;
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 2010-06-28 15:47:17 UTC (rev 2952)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionViewHandler.java 2010-06-29 14:04:36 UTC (rev 2953)
@@ -171,8 +171,7 @@
public void refresh(){
tableModel = view.getFinancialTransactionTableModel();
- tableModel.refresh();
-
+ tableModel.refresh();
fiscalPeriodComboBoxModel = view.getModelFiscalPeriod();
fiscalPeriodComboBoxModel.refresh();
Added: trunk/lima-swing/src/main/java/org/chorem/lima/util/AccountToString.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/util/AccountToString.java (rev 0)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/util/AccountToString.java 2010-06-29 14:04:36 UTC (rev 2953)
@@ -0,0 +1,29 @@
+package org.chorem.lima.util;
+
+import org.chorem.lima.entity.Account;
+import org.jdesktop.swingx.autocomplete.ObjectToStringConverter;
+
+public class AccountToString extends ObjectToStringConverter {
+
+ private static AccountToString converter;
+
+ @Override
+ public String getPreferredStringForItem(Object item) {
+ String result = null;
+ if (item != null){
+ if (item instanceof Account){
+ Account account = (Account) item;
+ result = account.getAccountNumber()+" - "+account.getLabel();
+ }
+ }
+ return result;
+ }
+
+ public static AccountToString getInstance() {
+ if (converter == null) {
+ converter = new AccountToString();
+ }
+ return converter;
+ }
+
+}
Added: trunk/lima-swing/src/main/java/org/chorem/lima/util/EntryBookToString.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/util/EntryBookToString.java (rev 0)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/util/EntryBookToString.java 2010-06-29 14:04:36 UTC (rev 2953)
@@ -0,0 +1,47 @@
+/* *##% Lima Swing
+ * Copyright (C) 2008 - 2010 CodeLutin
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%*/
+
+package org.chorem.lima.util;
+
+import org.chorem.lima.entity.EntryBook;
+import org.jdesktop.swingx.autocomplete.ObjectToStringConverter;
+
+public class EntryBookToString extends ObjectToStringConverter{
+
+ private static EntryBookToString converter;
+
+ @Override
+ public String getPreferredStringForItem(Object item) {
+ String result = null;
+ if (item != null){
+ if (item instanceof EntryBook){
+ EntryBook entryBook = (EntryBook) item;
+ result = entryBook.getCode()+" - "+entryBook.getLabel();
+ }
+ }
+ return result;
+ }
+
+
+ public static EntryBookToString getInstance() {
+ if (converter == null) {
+ converter = new EntryBookToString();
+ }
+ return converter;
+ }
+}
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-06-28 15:47:17 UTC (rev 2952)
+++ trunk/pom.xml 2010-06-29 14:04:36 UTC (rev 2953)
@@ -241,8 +241,8 @@
<!-- customized libs version -->
<nuiton-utils.version>1.2.2</nuiton-utils.version>
- <eugene.version>2.0.2-SNAPSHOT</eugene.version>
- <topia.version>2.3.4</topia.version>
+ <eugene.version>2.0.3-SNAPSHOT</eugene.version>
+ <topia.version>2.3.5-SNAPSHOT</topia.version>
<jaxx.version>2.0.2</jaxx.version>
<i18n.version>1.2.2</i18n.version>
1
0
r2952 - in trunk: lima-business/src/main/java/org/chorem/lima/business/ejb lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart lima-swing/src/main/resources/i18n
by jpepin@users.chorem.org 28 Jun '10
by jpepin@users.chorem.org 28 Jun '10
28 Jun '10
Author: jpepin
Date: 2010-06-28 17:47:17 +0200 (Mon, 28 Jun 2010)
New Revision: 2952
Url: http://chorem.org/repositories/revision/lima/2952
Log:
Ajout d'une option dans le plan BCR pour afficher les totaux d'une cat?\195?\169gorie ou non dans son titre.
Modified:
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialStatementServiceImpl.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementHeaderForm.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-business/src/main/java/org/chorem/lima/business/ejb/FinancialStatementServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialStatementServiceImpl.java 2010-06-28 15:14:33 UTC (rev 2951)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialStatementServiceImpl.java 2010-06-28 15:47:17 UTC (rev 2952)
@@ -321,8 +321,15 @@
}//sinon
else {
- //ajoute head avec amount
- subResult.add(headerfinancialStatementAmounts);
+
+ if (subFinancialStatement.getHeaderAmount()){
+ subResult.add(headerfinancialStatementAmounts);
+ }
+ else {
+ headerfinancialStatementAmounts.setGrossAmount(0);
+ headerfinancialStatementAmounts.setProvisionDeprecationAmount(0);
+ subResult.add(headerfinancialStatementAmounts);
+ }
//ajoute liste
if (financialStatementDatas.getListResult() != null){
subResult.addAll(financialStatementDatas.getListResult());
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementHeaderForm.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementHeaderForm.jaxx 2010-06-28 15:14:33 UTC (rev 2951)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementHeaderForm.jaxx 2010-06-28 15:47:17 UTC (rev 2952)
@@ -49,6 +49,13 @@
</cell>
</row>
<row>
+ <cell>
+ <JCheckBox id='headerAmountCheckBox' text='lima.financialstatement.headeramount'
+ selected="{getFinancialStatement().getHeaderAmount()}"
+ onActionPerformed="getFinancialStatement().setHeaderAmount(headerAmountCheckBox.isSelected())"/>
+ </cell>
+ </row>
+ <row>
<cell fill="none">
<JButton text="lima.common.ok" onActionPerformed="dispose()"/>
</cell>
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 2010-06-28 15:14:33 UTC (rev 2951)
+++ trunk/lima-swing/src/main/resources/i18n/lima-swing-en_GB.properties 2010-06-28 15:47:17 UTC (rev 2952)
@@ -76,6 +76,7 @@
lima.financialstatement.debitaccounts=
lima.financialstatement.formula=
lima.financialstatement.header.add=
+lima.financialstatement.headeramount=
lima.financialstatement.label=
lima.financialstatement.movement.add=
lima.financialstatement.provisiondeprecationaccounts=
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 2010-06-28 15:14:33 UTC (rev 2951)
+++ trunk/lima-swing/src/main/resources/i18n/lima-swing-fr_FR.properties 2010-06-28 15:47:17 UTC (rev 2952)
@@ -76,6 +76,7 @@
lima.financialstatement.debitaccounts=Liste de comptes au d\u00E9bit
lima.financialstatement.formula=Formule de compte, ex \: '7'-'6'+'510-520'
lima.financialstatement.header.add=Ajouter une cat\u00E9gorie
+lima.financialstatement.headeramount=Calculer le total en en-tete
lima.financialstatement.label=Libell\u00E9
lima.financialstatement.movement.add=Ajouter un regrouprement
lima.financialstatement.provisiondeprecationaccounts=Liste de comptes d'amortissement et provisions
1
0
r2951 - in trunk: lima-business/src/main/java/org/chorem/lima/business/ejb lima-callao/src/main/xmi lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart
by jpepin@users.chorem.org 28 Jun '10
by jpepin@users.chorem.org 28 Jun '10
28 Jun '10
Author: jpepin
Date: 2010-06-28 17:14:33 +0200 (Mon, 28 Jun 2010)
New Revision: 2951
Url: http://chorem.org/repositories/revision/lima/2951
Log:
Recherche d'une extension de comptes gr?\195?\162ce ?\195?\160 '..' Dans le plan BCR fusion des champs "credit & debit" et "formule".
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/FinancialStatementServiceImpl.java
trunk/lima-callao/src/main/xmi/accounting.zargo
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementMovementForm.jaxx
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 2010-06-28 11:03:51 UTC (rev 2950)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java 2010-06-28 15:14:33 UTC (rev 2951)
@@ -386,7 +386,7 @@
/**
* Convert string of extends number to list of accounts
- * Example '22, 45-48, 67' -> [22, 45, 46, 47, 48, 67]
+ * Example '22, 45..48, 67' -> [22, 45, 46, 47, 48, 67]
*/
@Override
public List<Account> stringToListAccountsWithTransaction(String selectedAccounts, TopiaContext topiaContext) throws LimaException{
@@ -403,11 +403,13 @@
StringTokenizer stComma = new StringTokenizer(selectedAccounts, ",");
while (stComma.hasMoreTokens()) {
String s = stComma.nextToken();
- if (s.contains("-")){
- //Split hypen
- String stringHypen[] = s.split("-");
- int lowAccount=Integer.parseInt(stringHypen[0]);
- int highAccount=Integer.parseInt(stringHypen[1]);
+ if (s.contains("..")){
+ //Split ..
+ String stringDoubleDot[] = s.split("\\.\\.");
+ log.debug(stringDoubleDot[0]);
+ log.debug(stringDoubleDot[1]);
+ int lowAccount=Integer.parseInt(stringDoubleDot[0]);
+ int highAccount=Integer.parseInt(stringDoubleDot[1]);
for (int i=lowAccount; i <= highAccount; i++) {
accountNumbers.add(String.valueOf(i));
}
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialStatementServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialStatementServiceImpl.java 2010-06-28 11:03:51 UTC (rev 2950)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialStatementServiceImpl.java 2010-06-28 15:14:33 UTC (rev 2951)
@@ -134,16 +134,22 @@
// remove financialstatement
- FinancialStatement financialStatementToDelete = financialStatementDAO.findByTopiaId(financialStatement.getTopiaId());
+ FinancialStatement financialStatementToDelete =
+ financialStatementDAO.findByTopiaId(
+ financialStatement.getTopiaId());
financialStatementDAO.delete(financialStatementToDelete);
//get all subFinancialStatement
- List<FinancialStatement> financialStatements = getAllChildrenFinancialStatement(financialStatement, new ArrayList<FinancialStatement>());
+ List<FinancialStatement> financialStatements =
+ getAllChildrenFinancialStatement(financialStatement,
+ new ArrayList<FinancialStatement>());
//if FinancialStatement have subFinancialStatement
if (financialStatements.size() > 0){
for (FinancialStatement subFinancialStatement : financialStatements) {
- FinancialStatement subFinancialStatementToDelete = financialStatementDAO.findByTopiaId(subFinancialStatement.getTopiaId());
+ FinancialStatement subFinancialStatementToDelete =
+ financialStatementDAO.findByTopiaId(
+ subFinancialStatement.getTopiaId());
financialStatementDAO.delete(subFinancialStatementToDelete);
}
}
@@ -164,7 +170,8 @@
@Override
public List<FinancialStatement> getAllChildrenFinancialStatement(FinancialStatement financialStatement, List<FinancialStatement> result) throws LimaException, LimaBusinessException {
- List<FinancialStatement> childFinancialStatements = getChildrenFinancialStatement(financialStatement);
+ List<FinancialStatement> childFinancialStatements =
+ getChildrenFinancialStatement(financialStatement);
for (FinancialStatement childFinancialStatement: childFinancialStatements) {
result.add(childFinancialStatement);
getAllChildrenFinancialStatement(childFinancialStatement, result);
@@ -236,7 +243,9 @@
try {
transaction = beginTransaction();
//create list form tree
- result = financialStatementReport(null, selectedBeginDate, selectedEndDate, new FinancialStatementDatasImpl(), transaction).getListResult();
+ result = financialStatementReport(null, selectedBeginDate,
+ selectedEndDate, new FinancialStatementDatasImpl(),
+ transaction).getListResult();
}
catch (TopiaException ex) {
@@ -255,25 +264,35 @@
getChildrenFinancialStatement(financialStatement);
try {
Double grossAmount = 0.0, provisionDeprecationAmount = 0.0;
- List<FinancialStatementAmounts> subResult = new ArrayList<FinancialStatementAmounts>();
+ List<FinancialStatementAmounts> subResult =
+ new ArrayList<FinancialStatementAmounts>();
for (FinancialStatement subFinancialStatement : financialStatements) {
- FinancialStatementAmounts financialStatementAmounts = financialStatementAmounts(subFinancialStatement, selectedBeginDate, selectedEndDate, topiaContext);
+ FinancialStatementAmounts financialStatementAmounts =
+ financialStatementAmounts(subFinancialStatement,
+ selectedBeginDate, selectedEndDate, topiaContext);
if (!subFinancialStatement.getHeader()){
//on calcul
grossAmount += financialStatementAmounts.getGrossAmount();
- provisionDeprecationAmount += financialStatementAmounts.getProvisionDeprecationAmount();
+ provisionDeprecationAmount +=
+ financialStatementAmounts.getProvisionDeprecationAmount();
subResult.add(financialStatementAmounts);
}
else {
- FinancialStatementDatas financialStatementDatas = financialStatementReport(subFinancialStatement, selectedBeginDate, selectedEndDate, result, topiaContext);
- grossAmount += financialStatementDatas.getFinancialStatementAmounts().getGrossAmount();
- provisionDeprecationAmount += financialStatementDatas.getFinancialStatementAmounts().getProvisionDeprecationAmount();
+ FinancialStatementDatas financialStatementDatas =
+ financialStatementReport(subFinancialStatement,
+ selectedBeginDate, selectedEndDate, result, topiaContext);
+ grossAmount += financialStatementDatas.
+ getFinancialStatementAmounts().getGrossAmount();
+ provisionDeprecationAmount += financialStatementDatas.
+ getFinancialStatementAmounts().getProvisionDeprecationAmount();
- FinancialStatementAmounts headerfinancialStatementAmounts = financialStatementDatas.getFinancialStatementAmounts();
+ FinancialStatementAmounts headerfinancialStatementAmounts =
+ financialStatementDatas.getFinancialStatementAmounts();
//Si sous-total
if (subFinancialStatement.getSubAmount()){
- FinancialStatementAmounts header = new FinancialStatementAmountsImpl();
+ FinancialStatementAmounts header =
+ new FinancialStatementAmountsImpl();
header.setLabel(headerfinancialStatementAmounts.getLabel());
header.setLevel(headerfinancialStatementAmounts.getLevel());
header.setHeader(true);
@@ -284,14 +303,20 @@
subResult.addAll(financialStatementDatas.getListResult());
}
//ajoute sstotal
- FinancialStatementAmounts subAmount = new FinancialStatementAmountsImpl();
- subAmount.setLabel("TOTAL "+headerfinancialStatementAmounts.getLabel());
- subAmount.setLevel(headerfinancialStatementAmounts.getLevel());
- subAmount.setGrossAmount(headerfinancialStatementAmounts.getGrossAmount());
- subAmount.setProvisionDeprecationAmount(headerfinancialStatementAmounts.getProvisionDeprecationAmount());
+ FinancialStatementAmounts subAmount =
+ new FinancialStatementAmountsImpl();
+ subAmount.setLabel(
+ "TOTAL "+headerfinancialStatementAmounts.getLabel());
+ subAmount.setLevel(
+ headerfinancialStatementAmounts.getLevel());
+ subAmount.setGrossAmount(
+ headerfinancialStatementAmounts.getGrossAmount());
+ subAmount.setProvisionDeprecationAmount(
+ headerfinancialStatementAmounts.
+ getProvisionDeprecationAmount());
subAmount.setSubAmount(true);
subResult.add(subAmount);
- //ajoute ligne vide
+ //ajoute une ligne vide
subResult.add(new FinancialStatementAmountsImpl());
}//sinon
@@ -305,9 +330,11 @@
}
}
}
- FinancialStatementAmounts financialStatementAmounts = new FinancialStatementAmountsImpl();
+ FinancialStatementAmounts financialStatementAmounts =
+ new FinancialStatementAmountsImpl();
financialStatementAmounts.setGrossAmount(grossAmount);
- financialStatementAmounts.setProvisionDeprecationAmount(provisionDeprecationAmount);
+ financialStatementAmounts.setProvisionDeprecationAmount(
+ provisionDeprecationAmount);
if (financialStatement != null){
financialStatementAmounts.setLabel(financialStatement.getLabel());
financialStatementAmounts.setHeader(financialStatement.getHeader());
@@ -334,13 +361,26 @@
String accountsString = financialStatement.getAccounts();
Double amount = 0.0;
if (accountsString != null){
- List<Account> accountsList = accountServiceLocal.
- stringToListAccountsWithTransaction(accountsString, topiaContext);
- for (Account account : accountsList) {
- ReportsDatas reportsDatas = reportServiceLocal.
- generateAccountReportsWithTransaction(account,
- selectedBeginDate, selectedEndDate, topiaContext);
- amount += reportsDatas.getAmountSolde();
+ //Remove Spaces
+ accountsString = StringUtils.deleteWhitespace(accountsString);
+ StringTokenizer stQuote = new StringTokenizer(accountsString, "-");
+ while (stQuote.hasMoreTokens()) {
+ String s = stQuote.nextToken();
+ List<Account> accountsStringList = accountServiceLocal.
+ stringToListAccountsWithTransaction(s, topiaContext);
+ Double resAmount = 0.0;
+ for (Account accountString : accountsStringList) {
+ ReportsDatas reportsDatas = reportServiceLocal.
+ generateAccountReportsWithTransaction(accountString,
+ selectedBeginDate, selectedEndDate, topiaContext);
+ resAmount += reportsDatas.getAmountSolde();
+ }
+ if (amount == 0){
+ amount=resAmount;
+ }
+ else {
+ amount-=resAmount;
+ }
}
}
@@ -379,8 +419,9 @@
financialStatement.getProvisionDeprecationAccounts();
Double provisionDeprecationAmount = 0.0;
if (provisionDeprecationAccountsString != null){
- List<Account> provisionDeprecationAccountsList = accountServiceLocal.
- stringToListAccountsWithTransaction(provisionDeprecationAccountsString, topiaContext);
+ List<Account> provisionDeprecationAccountsList =
+ accountServiceLocal.stringToListAccountsWithTransaction(
+ provisionDeprecationAccountsString, topiaContext);
for (Account account : provisionDeprecationAccountsList) {
ReportsDatas reportsDatas = reportServiceLocal.
generateAccountReportsWithTransaction(account,
@@ -388,69 +429,16 @@
provisionDeprecationAmount += reportsDatas.getAmountSolde();
}
}
-
- // FORMULA
- String formulaString =
- financialStatement.getFormula();
- Double formulaAmount = 0.0;
- if (formulaString != null){
- //Remove Spaces
- formulaString = StringUtils.deleteWhitespace(formulaString);
- log.debug(formulaString);
- //Split simple quote
- StringTokenizer stQuote = new StringTokenizer(formulaString, "'");
- while (stQuote.hasMoreTokens()) {
- String s = stQuote.nextToken();
- log.debug(s);
- if (s.contentEquals("-")){
- s = stQuote.nextToken();
- List<Account> accountsStringList = accountServiceLocal.
- stringToListAccountsWithTransaction(s, topiaContext);
- Double resAmount = 0.0;
- for (Account accountString : accountsStringList) {
- ReportsDatas reportsDatas = reportServiceLocal.
- generateAccountReportsWithTransaction(accountString,
- selectedBeginDate, selectedEndDate, topiaContext);
- resAmount += reportsDatas.getAmountSolde();
- }
- formulaAmount-=resAmount;
- }
- else if (s.contains("-")){
- List<Account> accountsStringList = accountServiceLocal.
- stringToListAccountsWithTransaction(s, topiaContext);
- Double resAmount = 0.0;
- for (Account accountString : accountsStringList) {
- ReportsDatas reportsDatas = reportServiceLocal.
- generateAccountReportsWithTransaction(accountString,
- selectedBeginDate, selectedEndDate, topiaContext);
- resAmount += reportsDatas.getAmountSolde();
- }
- formulaAmount+=resAmount;
- }
- else{
- List<Account> accountsStringList = accountServiceLocal.
- stringToListAccountsWithTransaction(s, topiaContext);
- Double resAmount = 0.0;
- for (Account accountString : accountsStringList) {
- ReportsDatas reportsDatas = reportServiceLocal.
- generateAccountReportsWithTransaction(accountString,
- selectedBeginDate, selectedEndDate, topiaContext);
- resAmount += reportsDatas.getAmountSolde();
- }
- formulaAmount+=resAmount;}
- }
- }
-
-
// set result
- financialStatementAmounts.setGrossAmount(amount+creditAmount+debitAmount+formulaAmount);
+ financialStatementAmounts.setGrossAmount(
+ amount+creditAmount+debitAmount);
financialStatementAmounts.setLabel(financialStatement.getLabel());
- financialStatementAmounts.setProvisionDeprecationAmount(provisionDeprecationAmount);
+ financialStatementAmounts.setProvisionDeprecationAmount(
+ provisionDeprecationAmount);
financialStatementAmounts.setLevel(
financialStatement.getLevel());
-
}
catch (LimaException ex) {
doCatch(topiaContext, ex, log);
Modified: trunk/lima-callao/src/main/xmi/accounting.zargo
===================================================================
(Binary files differ)
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementMovementForm.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementMovementForm.jaxx 2010-06-28 11:03:51 UTC (rev 2950)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementMovementForm.jaxx 2010-06-28 15:14:33 UTC (rev 2951)
@@ -86,17 +86,6 @@
onRemoveUpdate='getFinancialStatement().setProvisionDeprecationAccounts(getProvisionDeprecationAccountsTextField().getText())' />
</cell>
</row>
- <row>
- <cell fill="horizontal">
- <JLabel text="lima.financialstatement.formula"/>
- </cell>
- <cell fill="horizontal">
- <JTextField id="formulaTextField" text="{getFinancialStatement().getFormula()}"/>
- <javax.swing.text.Document javaBean="getFormulaTextField().getDocument()"
- onInsertUpdate='getFinancialStatement().setFormula(getFormulaTextField().getText())'
- onRemoveUpdate='getFinancialStatement().setFormula(getFormulaTextField().getText())' />
- </cell>
- </row>
<row>
<cell fill="none">
<JButton text="lima.common.ok" onActionPerformed="dispose()"/>
1
0
r2950 - in trunk/lima-swing/src/main: java/org/chorem/lima/ui/fiscalperiod java/org/chorem/lima/ui/home java/org/chorem/lima/util resources/i18n
by jpepin@users.chorem.org 28 Jun '10
by jpepin@users.chorem.org 28 Jun '10
28 Jun '10
Author: jpepin
Date: 2010-06-28 13:03:51 +0200 (Mon, 28 Jun 2010)
New Revision: 2950
Url: http://chorem.org/repositories/revision/lima/2950
Log:
Ajout de lien hypertext d'acc?\195?\168s aux diff?\195?\169rentes fonctions dans l'onglet d'accueil.
Modified:
trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/HomeView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/HomeViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/util/DialogHelper.java
trunk/lima-swing/src/main/resources/i18n/lima-swing-en_GB.properties
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 2010-06-27 06:36:49 UTC (rev 2949)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodViewHandler.java 2010-06-28 11:03:51 UTC (rev 2950)
@@ -19,20 +19,16 @@
package org.chorem.lima.ui.fiscalperiod;
import static org.nuiton.i18n.I18n._;
-
import javax.swing.JOptionPane;
-
import org.jdesktop.swingx.JXTable;
import org.nuiton.util.DateUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.LimaException;
-
import org.chorem.lima.entity.FiscalPeriod;
import org.chorem.lima.ui.fiscalperiod.AddPeriod;
import org.chorem.lima.ui.fiscalperiod.FiscalPeriodView;
import org.chorem.lima.util.DialogHelper;
-import org.chorem.lima.util.ErrorHelper;
/**
* TODO add comment here.
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/HomeView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/HomeView.jaxx 2010-06-27 06:36:49 UTC (rev 2949)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/HomeView.jaxx 2010-06-28 11:03:51 UTC (rev 2950)
@@ -5,7 +5,7 @@
<script>
<![CDATA[
import static org.nuiton.i18n.I18n._;
-
+
void $afterCompleteSetup() {
getHandler().refresh();
}
@@ -23,7 +23,7 @@
minimumSize='{getFixedSize()}'
preferredSize='{getFixedSize()}'
layout='{new BoxLayout(limaHomeChartAccount,BoxLayout.X_AXIS)}'>
- <JEditorPane id="textHomeAccount" />
+ <JEditorPane id="textHomeAccount"/>
</JPanel>
</cell>
</row>
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/HomeViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/HomeViewHandler.java 2010-06-27 06:36:49 UTC (rev 2949)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/HomeViewHandler.java 2010-06-28 11:03:51 UTC (rev 2950)
@@ -2,10 +2,17 @@
import static org.nuiton.i18n.I18n._;
import java.awt.Color;
-import java.awt.Component;
+import java.io.IOException;
import java.util.List;
+import javax.swing.JEditorPane;
+import javax.swing.event.HyperlinkEvent;
+import javax.swing.event.HyperlinkListener;
+import javax.swing.text.html.HTMLDocument;
+import javax.swing.text.html.HTMLFrameHyperlinkEvent;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.chorem.lima.LimaContext;
import org.chorem.lima.business.AccountService;
import org.chorem.lima.business.EntryBookService;
import org.chorem.lima.business.FinancialTransactionService;
@@ -16,8 +23,10 @@
import org.chorem.lima.entity.FinancialTransaction;
import org.chorem.lima.entity.FiscalPeriod;
import org.chorem.lima.service.LimaServiceFactory;
+import org.chorem.lima.ui.MainView;
+import org.chorem.lima.util.DialogHelper;
-public class HomeViewHandler {
+public class HomeViewHandler implements HyperlinkListener {
private static final Log log = LogFactory.getLog(HomeViewHandler.class);
@@ -30,13 +39,21 @@
protected FinancialTransactionService financialTransactionService;
protected FiscalPeriodService fiscalPeriodService;
+
+ protected HyperlinkListener accountsListener;
+
+ protected HyperlinkListener entrybookListener;
private Color greenBackground;
private Color redBackground;
protected HomeViewHandler(HomeView view) {
+
+
this.view=view;
+
+
accountService =
LimaServiceFactory.getInstance().getAccountService();
entryBookService =
@@ -48,54 +65,90 @@
greenBackground = new Color(153, 255, 153);
redBackground = new Color(255, 102, 102);
+
+
}
- public void goToAccountChart(){
-
- }
+ public void hyperlinkUpdate(HyperlinkEvent e) {
+
+ if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
+
+ log.debug(e.getDescription());
+
+ if (e.getDescription().equals("#accountschart")) {
+ MainView ui = LimaContext.MAIN_UI_ENTRY_DEF.getContextValue(view);
+ ui.getHandler().showAccountView(ui);
+ }
+ else if (e.getDescription().equals("#entrybookschart")) {
+ MainView ui = LimaContext.MAIN_UI_ENTRY_DEF.getContextValue(view);
+ ui.getHandler().showEntryBookView(ui);
+ }
+ else if (e.getDescription().equals("#fiscalperiodschart")) {
+ MainView ui = LimaContext.MAIN_UI_ENTRY_DEF.getContextValue(view);
+ ui.getHandler().showFiscalPeriodView(ui);
+ }
+ else if (e.getDescription().equals("#financialtransactionunbalanced")) {
+ MainView ui = LimaContext.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);
+ ui.getHandler().showTransactionView(ui);
+ }
+ }
+
+ }
+
+
+
public void refresh(){
try {
//ACCOUNT
List<Account> accounts = accountService.getAllAccounts();
- view.getTextHomeAccount().setUI(new javax.swing.plaf.basic.BasicEditorPaneUI());
- view.getTextHomeAccount().setOpaque(true);
- view.getTextHomeAccount().setContentType("text/html");
- view.getTextHomeAccount().setEditable(false);
+ JEditorPane accountPane = view.getTextHomeAccount();
+ accountPane.setUI(new javax.swing.plaf.basic.BasicEditorPaneUI());
+ accountPane.setOpaque(true);
+ accountPane.setContentType("text/html");
+ accountPane.setEditable(false);
+ accountPane.addHyperlinkListener(this);
if (accounts.size()>0){
String accountsString = _("limahome.chartaccounts1") + " " +
accounts.size() + " " + _("limahome.chartaccounts2");
- view.getTextHomeAccount().setBackground(greenBackground);
- view.getTextHomeAccount().setText("<p style=vertical-align:'bottom', horizontal-align:'center'><a href='lima://accountcharts'>"+accountsString+"</a></p>");
+ accountPane.setBackground(greenBackground);
+ accountPane.setText("<p style=vertical-align:'bottom', horizontal-align:'center'><a href='#accountschart'>"+accountsString+"</a></p>");
}
else {
- view.getTextHomeAccount().setBackground(redBackground);
+ accountPane.setBackground(redBackground);
String accountsString = "<p style=vertical-align:'bottom', horizontal-align:'center'>"+_("limahome.fiscalperiodnoopen") +
- "<br/><a href='lima://accountcharts'>"+_("limahome.createchartaccounts")+"</a>";
- view.getTextHomeAccount().setText(accountsString+"</p>");
+ "<br/><a href='#accountschart'>"+_("limahome.createchartaccounts")+"</a>";
+ accountPane.setText(accountsString+"</p>");
}
//ENTRYBOOK
List<EntryBook> entryBooks = entryBookService.getAllEntryBooks();
- view.getTextHomeEntryBook().setUI(new javax.swing.plaf.basic.BasicEditorPaneUI());
- view.getTextHomeEntryBook().setOpaque(true);
- view.getTextHomeEntryBook().setContentType("text/html");
- view.getTextHomeEntryBook().setEditable(false);
+ JEditorPane entryBookPane = view.getTextHomeEntryBook();
+ entryBookPane.setUI(new javax.swing.plaf.basic.BasicEditorPaneUI());
+ entryBookPane.setOpaque(true);
+ entryBookPane.setContentType("text/html");
+ entryBookPane.setEditable(false);
+ entryBookPane.addHyperlinkListener(this);
+
if (entryBooks.size()>0){
- view.getTextHomeEntryBook().setBackground(greenBackground);
- String entryBooksString = "<p style=vertical-align:'bottom', horizontal-align:'center'><a href='lima://entrybookcharts'>"+_("limahome.entrybooks1") +
+ entryBookPane.setBackground(greenBackground);
+ String entryBooksString = "<p style=vertical-align:'bottom', horizontal-align:'center'><a href='#entrybookschart'>"+_("limahome.entrybooks1") +
" " + entryBooks.size() + " " + _("limahome.entrybooks2") +
"</a><br/><ul>";
for (EntryBook entryBook : entryBooks) {
entryBooksString += "<li>"+entryBook.getCode() +
" - "+entryBook.getLabel()+"</li>";
}
- view.getTextHomeEntryBook().setText(entryBooksString+"</ul>"+"</p>");
+ entryBookPane.setText(entryBooksString+"</ul>"+"</p>");
}
else {
- view.getTextHomeEntryBook().setBackground(redBackground);
- view.getTextHomeEntryBook().setText("<p style=vertical-align:'bottom', horizontal-align:'center'><a href='lima://entrybookcharts'>"+_("limahome.entrybooknoopen")+"</a></p>");
+ entryBookPane.setBackground(redBackground);
+ entryBookPane.setText("<p style=vertical-align:'bottom', horizontal-align:'center'><a href='#entrybookschart'>"+_("limahome.entrybooknoopen")+"</a></p>");
}
//FISCAL PERIOD
@@ -104,52 +157,57 @@
List<FiscalPeriod> unblockedFiscalPeriods =
fiscalPeriodService.getAllUnblockedFiscalPeriods();
- view.getTextHomeFiscalYear().setUI(new javax.swing.plaf.basic.BasicEditorPaneUI());
- view.getTextHomeFiscalYear().setOpaque(true);
- view.getTextHomeFiscalYear().setContentType("text/html");
- view.getTextHomeFiscalYear().setEditable(false);
- view.getTextHomeDaily().setUI(new javax.swing.plaf.basic.BasicEditorPaneUI());
- view.getTextHomeDaily().setOpaque(true);
- view.getTextHomeDaily().setContentType("text/html");
- view.getTextHomeDaily().setEditable(false);
+ JEditorPane fiscalYearPane = view.getTextHomeFiscalYear();
+ fiscalYearPane.setUI(new javax.swing.plaf.basic.BasicEditorPaneUI());
+ fiscalYearPane.setOpaque(true);
+ fiscalYearPane.setContentType("text/html");
+ fiscalYearPane.setEditable(false);
+ fiscalYearPane.addHyperlinkListener(this);
+ JEditorPane dailyPane = view.getTextHomeDaily();
+ dailyPane.setUI(new javax.swing.plaf.basic.BasicEditorPaneUI());
+ dailyPane.setOpaque(true);
+ dailyPane.setContentType("text/html");
+ dailyPane.setEditable(false);
+ dailyPane.addHyperlinkListener(this);
+
if (unblockedFiscalPeriods.size()>0){
- view.getTextHomeFiscalYear().setBackground(greenBackground);
- String fiscalString = "<p style=vertical-align:'bottom', horizontal-align:'center'><a href='lima://fiscalcharts'>"
+ fiscalYearPane.setBackground(greenBackground);
+ String fiscalString = "<p style=vertical-align:'bottom', horizontal-align:'center'><a href='#fiscalperiodschart'>"
+ unblockedFiscalPeriods.size() +
" " + _("limahome.fiscalperiodopened")+"<br/>" +
(fiscalPeriods.size()-unblockedFiscalPeriods.size()) +
" " + _("limahome.fiscalperiodclosed");
- view.getTextHomeFiscalYear().setText(fiscalString+"</a></p>");
+ fiscalYearPane.setText(fiscalString+"</a></p>");
//FINACIAL TRANSACTION
List<FinancialTransaction> financialTransactions =
financialTransactionService.
getAllFinancialTransactionsUnbalanced(fiscalPeriods.get(0));
if (financialTransactions.size()>0){
- view.getTextHomeDaily().setBackground(redBackground);
- String transactionsString = "<p style=vertical-align:'bottom', horizontal-align:'center'><a href='lima://financialtransactionunbalanced'>"
+ dailyPane.setBackground(redBackground);
+ String transactionsString = "<p style=vertical-align:'bottom', horizontal-align:'center'><a href='#financialtransactionunbalanced'>"
+ financialTransactions.size() +
_("limahome.transactionunbalanced")+"</a></p>";
- view.getTextHomeDaily().setText(transactionsString);
+ dailyPane.setText(transactionsString);
}
else {
- view.getTextHomeDaily().setBackground(greenBackground);
- String transactionsString = "<p style=vertical-align:'bottom', horizontal-align:'center'><a href='lima://financialtransactionbalanced'>"
+ dailyPane.setBackground(greenBackground);
+ String transactionsString = "<p style=vertical-align:'bottom', horizontal-align:'center'><a href='#financialtransactionbalanced'>"
+ _("limahome.transactionbalanced");
- view.getTextHomeDaily().setText(transactionsString+"</a></p>");
+ dailyPane.setText(transactionsString+"</a></p>");
}
}
else {
- view.getTextHomeFiscalYear().setBackground(redBackground);
- view.getTextHomeDaily().setBackground(redBackground);
- String fiscalString = "<p style=vertical-align:'bottom', horizontal-align:'center'><a href='lima://fiscalcharts'>" + _("limahome.fiscalperiodnoopen");
+ fiscalYearPane.setBackground(redBackground);
+ dailyPane.setBackground(redBackground);
+ String fiscalString = "<p style=vertical-align:'bottom', horizontal-align:'center'><a href='#fiscalperiodschart'>" + _("limahome.fiscalperiodnoopen");
if (fiscalPeriods.size()>0){
fiscalString += fiscalPeriods.size() +
_("limahome.fiscalperiodclosed");
}
- view.getTextHomeFiscalYear().setText(fiscalString+"</a></p>");
+ fiscalYearPane.setText(fiscalString+"</a></p>");
}
} catch (LimaException eee) {
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/util/DialogHelper.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/util/DialogHelper.java 2010-06-27 06:36:49 UTC (rev 2949)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/util/DialogHelper.java 2010-06-28 11:03:51 UTC (rev 2950)
@@ -1,21 +1,20 @@
-/**
- * *##% Lima Main
- * Copyright (C) 2008 CodeLutin
+/* *##% Lima Swing
+ * Copyright (C) 2008 - 2010 CodeLutin
*
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser 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 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 2
+ * 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 Lesser Public License for more details.
+ * GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*
- */
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%*/
package org.chorem.lima.util;
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 2010-06-27 06:36:49 UTC (rev 2949)
+++ trunk/lima-swing/src/main/resources/i18n/lima-swing-en_GB.properties 2010-06-28 11:03:51 UTC (rev 2950)
@@ -174,6 +174,7 @@
limahome.createchartaccounts=
limahome.createchartaccounts1=
limahome.createchartaccounts2=
+limahome.entrybooknoopen=
limahome.entrybooks1=
limahome.entrybooks2=
limahome.fiscalperiodclosed=
1
0
Author: tchemit
Date: 2010-06-27 08:36:49 +0200 (Sun, 27 Jun 2010)
New Revision: 2949
Url: http://chorem.org/repositories/revision/lima/2949
Log:
Utilisation de mavenpom4redmine 2.2.1
Modified:
trunk/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-06-25 14:59:10 UTC (rev 2948)
+++ trunk/pom.xml 2010-06-27 06:36:49 UTC (rev 2949)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>mavenpom4redmine</artifactId>
- <version>2.2</version>
+ <version>2.2.1</version>
</parent>
<groupId>org.chorem</groupId>
1
0