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
July 2014
- 3 participants
- 53 discussions
r3867 - in trunk/lima-swing/src/main/java/org/chorem/lima/ui: celleditor common financialtransaction
by sbavencoff@users.chorem.org 25 Jul '14
by sbavencoff@users.chorem.org 25 Jul '14
25 Jul '14
Author: sbavencoff
Date: 2014-07-25 10:47:33 +0200 (Fri, 25 Jul 2014)
New Revision: 3867
Url: http://forge.chorem.org/projects/lima/repository/revisions/3867
Log:
fixes #973 : auto complete
Added:
trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/AutoCompleteTableCellEditor.java
Modified:
trunk/lima-swing/src/main/java/org/chorem/lima/ui/common/AbstractColumn.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/common/AbstractLimaTable.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/common/Column.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/DescriptionColumn.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/VoucherColumn.java
Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/AutoCompleteTableCellEditor.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/AutoCompleteTableCellEditor.java (rev 0)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/AutoCompleteTableCellEditor.java 2014-07-25 08:47:33 UTC (rev 3867)
@@ -0,0 +1,38 @@
+package org.chorem.lima.ui.celleditor;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import org.jdesktop.swingx.autocomplete.AutoCompleteDecorator;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author Sylvain Bavencoff <bavencoff(a)codelutin.com>
+ */
+public class AutoCompleteTableCellEditor extends StringTableCellEditor {
+
+ protected static Map<String, List<String>> precedingValuesById = Maps.newHashMap();
+
+ List<String> precedingValues;
+
+ public AutoCompleteTableCellEditor(String id) {
+ precedingValues = precedingValuesById.get(id);
+
+ if (precedingValues == null) {
+ precedingValues = Lists.newLinkedList();
+ precedingValuesById.put(id, precedingValues);
+ }
+
+ AutoCompleteDecorator.decorate(getComponent(), precedingValues, false);
+ }
+
+ @Override
+ public String getCellEditorValue() {
+ String stringValue = super.getCellEditorValue().toString();
+ if (!precedingValues.contains(stringValue)) {
+ precedingValues.add(stringValue);
+ }
+ return stringValue;
+ }
+}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/common/AbstractColumn.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/common/AbstractColumn.java 2014-07-24 12:48:39 UTC (rev 3866)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/common/AbstractColumn.java 2014-07-25 08:47:33 UTC (rev 3867)
@@ -27,6 +27,8 @@
import org.chorem.lima.LimaConfig;
import org.chorem.lima.util.ErrorHelper;
+import javax.swing.table.TableCellEditor;
+
/**
* @author Sylvain Bavencoff <bavencoff(a)codelutin.com>
*/
@@ -40,6 +42,8 @@
protected boolean editable;
+ protected TableCellEditor cellEditor;
+
protected ErrorHelper errorHelper;
public AbstractColumn(Class<?> columnClass, String columnName, boolean editable) {
@@ -87,4 +91,12 @@
public void setEditable(boolean editable) {
this.editable = editable;
}
+
+ public TableCellEditor getCellEditor() {
+ return cellEditor;
+ }
+
+ public void setCellEditor(TableCellEditor cellEditor) {
+ this.cellEditor = cellEditor;
+ }
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/common/AbstractLimaTable.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/common/AbstractLimaTable.java 2014-07-24 12:48:39 UTC (rev 3866)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/common/AbstractLimaTable.java 2014-07-25 08:47:33 UTC (rev 3867)
@@ -40,9 +40,14 @@
import org.chorem.lima.ui.celleditor.StringTableCellEditor;
import org.jdesktop.swingx.JXTable;
-import javax.swing.*;
+import javax.swing.AbstractAction;
+import javax.swing.ActionMap;
+import javax.swing.InputMap;
+import javax.swing.JComponent;
+import javax.swing.KeyStroke;
import javax.swing.table.TableCellEditor;
-import java.awt.*;
+import javax.swing.table.TableModel;
+import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
@@ -87,6 +92,20 @@
setShowHorizontalLines(false);
}
+ @Override
+ public void setModel(TableModel model) {
+ super.setModel(model);
+ if (model instanceof AbstractLimaTableModel) {
+ for (int columnIndex = 0; columnIndex < getColumnModel().getColumnCount(); columnIndex++) {
+ Column column = ((AbstractLimaTableModel) model).getColumn(columnIndex);
+ TableCellEditor cellEditor = column.getCellEditor();
+ if (cellEditor != null) {
+ getColumnModel().getColumn(columnIndex).setCellEditor(cellEditor);
+ }
+ }
+ }
+ }
+
protected void initNavigation() {
InputMap inputMap= getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
@@ -100,8 +119,6 @@
clearSelection();
}
});
-
-
}
public H getHandler() {
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/common/Column.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/common/Column.java 2014-07-24 12:48:39 UTC (rev 3866)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/common/Column.java 2014-07-25 08:47:33 UTC (rev 3867)
@@ -24,20 +24,24 @@
* #L%
*/
+import javax.swing.table.TableCellEditor;
+
/**
* @author Sylvain Bavencoff <bavencoff(a)codelutin.com>
*/
public interface Column<T extends AbstractLimaTableModel> {
- public Class<?> getColumnClass();
+ Class<?> getColumnClass();
- public String getColumnName();
+ String getColumnName();
- public Object getValueAt(int row);
+ Object getValueAt(int row);
- public boolean isCellEditable(int row);
+ boolean isCellEditable(int row);
- public boolean setValueAt(Object value, int row);
+ boolean setValueAt(Object value, int row);
- public void setTableModel(T tableModel);
+ void setTableModel(T tableModel);
+
+ TableCellEditor getCellEditor();
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/DescriptionColumn.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/DescriptionColumn.java 2014-07-24 12:48:39 UTC (rev 3866)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/DescriptionColumn.java 2014-07-25 08:47:33 UTC (rev 3867)
@@ -25,6 +25,7 @@
*/
import org.chorem.lima.entity.Entry;
+import org.chorem.lima.ui.celleditor.AutoCompleteTableCellEditor;
import org.chorem.lima.ui.common.AbstractColumn;
import org.chorem.lima.ui.common.FinancialTransactionTableModel;
@@ -37,6 +38,7 @@
public DescriptionColumn() {
super(String.class, t("lima.ui.financialtransaction.description"), true);
+ setCellEditor(new AutoCompleteTableCellEditor("lima.ui.financialtransaction.description"));
}
@Override
public Object getValueAt(int row) {
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/VoucherColumn.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/VoucherColumn.java 2014-07-24 12:48:39 UTC (rev 3866)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/VoucherColumn.java 2014-07-25 08:47:33 UTC (rev 3867)
@@ -25,6 +25,7 @@
*/
import org.chorem.lima.entity.Entry;
+import org.chorem.lima.ui.celleditor.AutoCompleteTableCellEditor;
import org.chorem.lima.ui.common.AbstractColumn;
import org.chorem.lima.ui.common.FinancialTransactionTableModel;
@@ -37,6 +38,7 @@
public VoucherColumn() {
super(String.class, t("lima.ui.financialtransaction.voucher"), true);
+ setCellEditor(new AutoCompleteTableCellEditor("lima.ui.financialtransaction.voucher"));
}
@Override
1
0
r3866 - trunk/lima-business/src/main/java/org/chorem/lima/business
by dcosse@users.chorem.org 24 Jul '14
by dcosse@users.chorem.org 24 Jul '14
24 Jul '14
Author: dcosse
Date: 2014-07-24 14:48:39 +0200 (Thu, 24 Jul 2014)
New Revision: 3866
Url: http://forge.chorem.org/projects/lima/repository/revisions/3866
Log:
refs #1049 ajout d'un commentaire sur le pourquoi de la cr?\195?\169ation manuel des sch?\195?\169mas
Modified:
trunk/lima-business/src/main/java/org/chorem/lima/business/LimaInterceptor.java
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/LimaInterceptor.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/LimaInterceptor.java 2014-07-24 12:31:31 UTC (rev 3865)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/LimaInterceptor.java 2014-07-24 12:48:39 UTC (rev 3866)
@@ -104,6 +104,7 @@
LimaCallaoTopiaPersistenceContext tx = rootContext.newPersistenceContext();
+ // TODO DCossé 24/07/14 remove it as soon as migration service is done.
createShemaIfNeeded(rootContext, tx);
DAO_HELPER.set(tx);
1
0
r3865 - trunk/lima-business/src/test/java/org/chorem/lima/business
by dcosse@users.chorem.org 24 Jul '14
by dcosse@users.chorem.org 24 Jul '14
24 Jul '14
Author: dcosse
Date: 2014-07-24 14:31:31 +0200 (Thu, 24 Jul 2014)
New Revision: 3865
Url: http://forge.chorem.org/projects/lima/repository/revisions/3865
Log:
refs #1032 correction sur un test en echec
Modified:
trunk/lima-business/src/test/java/org/chorem/lima/business/NewImportExportServiceTest.java
Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/NewImportExportServiceTest.java
===================================================================
--- trunk/lima-business/src/test/java/org/chorem/lima/business/NewImportExportServiceTest.java 2014-07-24 12:28:03 UTC (rev 3864)
+++ trunk/lima-business/src/test/java/org/chorem/lima/business/NewImportExportServiceTest.java 2014-07-24 12:31:31 UTC (rev 3865)
@@ -302,27 +302,8 @@
IOUtils.closeQuietly(accountsStream);
// TODO DCossé 23/07/14 should be done in one transaction on service side but it doesn't work now
- newImportService.importAllAsCSV(entryBooksStreamString, transactionsStreamString, fiscalPeriodsStreamString, entriesStreamString, accountsStreamString);
-// newImportService.importEntryBooksAsCSV(entryBooksStreamString);
-// if(log.isInfoEnabled()) {
-// log.info("jouranux importés");
-// }
-// newImportService.importFinancialTransactionsAsCSV(transactionsStreamString);
-// if(log.isInfoEnabled()) {
-// log.info("transactions importés");
-// }
-// newImportService.importFiscalPeriodsAsCSV(fiscalPeriodsStreamString);
-// if(log.isInfoEnabled()) {
-// log.info("période ficales importés");
-// }
-// newImportService.importEntriesAsCSV(entriesStreamString);
-// if(log.isInfoEnabled()) {
-// log.info("entrées importés");
-// }
-// newImportService.importAccountAsCSV(accountsStreamString);
-// if(log.isInfoEnabled()) {
-// log.info("comptes importés");
-// }
+ newImportService.importAllAsCSV(entryBooksStreamString, transactionsStreamString, fiscalPeriodsStreamString, accountsStreamString, entriesStreamString);
+
} catch (Exception ex) {
if(log.isInfoEnabled()) {
log.info(ex);
1
0
r3864 - trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod
by dcosse@users.chorem.org 24 Jul '14
by dcosse@users.chorem.org 24 Jul '14
24 Jul '14
Author: dcosse
Date: 2014-07-24 14:28:03 +0200 (Thu, 24 Jul 2014)
New Revision: 3864
Url: http://forge.chorem.org/projects/lima/repository/revisions/3864
Log:
refs #1048 il manquait un import pour que ?\195?\167a compile
Modified:
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodView.jaxx
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodView.jaxx 2014-07-24 12:11:50 UTC (rev 3863)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodView.jaxx 2014-07-24 12:28:03 UTC (rev 3864)
@@ -30,6 +30,7 @@
org.chorem.lima.entity.FinancialPeriod
org.chorem.lima.ui.financialperiod.FinancialPeriodTable
org.chorem.lima.ui.financialperiod.FinancialPeriodTableModel
+ static org.nuiton.i18n.I18n.t
</import>
<FinancialPeriodViewHandler id="handler" constructorParams="this"/>
1
0
r3863 - in trunk: lima-business/src/main/java/org/chorem/lima/business/ejb lima-business/src/main/resources/i18n lima-business-api/src/main/java/org/chorem/lima/business/api lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart
by sbavencoff@users.chorem.org 24 Jul '14
by sbavencoff@users.chorem.org 24 Jul '14
24 Jul '14
Author: sbavencoff
Date: 2014-07-24 14:11:50 +0200 (Thu, 24 Jul 2014)
New Revision: 3863
Url: http://forge.chorem.org/projects/lima/repository/revisions/3863
Log:
refs #1044 : financial statement service
Modified:
trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/FinancialStatementService.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialStatementServiceImpl.java
trunk/lima-business/src/main/resources/i18n/lima-business_fr_FR.properties
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartTreeTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartViewHandler.java
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 2014-07-24 12:04:19 UTC (rev 3862)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialStatementServiceImpl.java 2014-07-24 12:11:50 UTC (rev 3863)
@@ -25,7 +25,6 @@
package org.chorem.lima.business.ejb;
-import com.google.common.collect.Lists;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -52,12 +51,11 @@
import javax.ejb.TransactionAttribute;
import java.math.BigDecimal;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.Date;
import java.util.List;
import java.util.StringTokenizer;
-import static org.nuiton.i18n.I18n.t;
-
@Stateless
@Remote(FinancialStatementService.class)
@TransactionAttribute
@@ -97,29 +95,21 @@
FinancialStatementTopiaDao financialStatementTopiaDao = getDaoHelper().getFinancialStatementDao();
- // remove financialstatement
+ // refresh financialstatement
FinancialStatement financialStatementToDelete =
- financialStatementTopiaDao.findByTopiaId(financialStatement.getTopiaId());
- financialStatementTopiaDao.delete(financialStatementToDelete);
+ financialStatementTopiaDao.forTopiaIdEquals(financialStatement.getTopiaId()).findUnique();
- //get all subFinancialStatement
- List<FinancialStatement> financialStatements =
- getAllChildrenFinancialStatement(financialStatement, new ArrayList<FinancialStatement>());
-
- //if FinancialStatement have subFinancialStatement
- for (FinancialStatement subFinancialStatement : financialStatements) {
- FinancialStatement subFinancialStatementToDelete =
- financialStatementTopiaDao.findByTopiaId(
- subFinancialStatement.getTopiaId());
- financialStatementTopiaDao.delete(subFinancialStatementToDelete);
- }
+ financialStatementTopiaDao.delete(financialStatementToDelete);
}
@Override
public void removeAllFinancialStatement() {
- for (FinancialStatement financialStatement : getChildrenFinancialStatement(null)) {
- removeFinancialStatement(financialStatement);
- }
+
+ FinancialStatementTopiaDao financialStatementDao = getDaoHelper().getFinancialStatementDao();
+
+ List<FinancialStatement> allRoots = getRootFinancialStatements();
+
+ financialStatementDao.deleteAll(allRoots);
}
@Override
@@ -131,24 +121,18 @@
}
@Override
- public List<FinancialStatement> getAllChildrenFinancialStatement(FinancialStatement financialStatement,
- List<FinancialStatement> result) {
- List<FinancialStatement> childFinancialStatements =
- getChildrenFinancialStatement(financialStatement);
- for (FinancialStatement childFinancialStatement : childFinancialStatements) {
- result.add(childFinancialStatement);
- getAllChildrenFinancialStatement(childFinancialStatement, result);
- }
+ public List<FinancialStatement> getRootFinancialStatements() {
+ FinancialStatementTopiaDao financialStatementTopiaDao = getDaoHelper().getFinancialStatementDao();
+
+ List<FinancialStatement> result = financialStatementTopiaDao
+ .forMasterFinancialStatementEquals(null)
+ .setOrderByArguments(FinancialStatement.PROPERTY_TOPIA_CREATE_DATE)
+ .findAll();
+
return result;
}
@Override
- public List<FinancialStatement> getChildrenFinancialStatement(FinancialStatement masterFinancialStatement) {
- return Lists.newArrayList(masterFinancialStatement.getSubFinancialStatements());
- }
-
-
- @Override
public void updateFinancialStatement(FinancialStatement financialStatement) {
// TopiaDao
@@ -187,8 +171,14 @@
Date selectedEndDate,
FinancialStatementDatas result) {
- List<FinancialStatement> financialStatements = getChildrenFinancialStatement(financialStatement);
+ Collection<FinancialStatement> financialStatements;
+ if (financialStatement == null) {
+ financialStatements = getRootFinancialStatements();
+ } else {
+ financialStatements = financialStatement.getSubFinancialStatements();
+ }
+
BigDecimal grossAmount = new BigDecimal(0),
provisionDeprecationAmount = new BigDecimal(0);
List<FinancialStatementAmounts> subResult = new ArrayList<FinancialStatementAmounts>();
@@ -398,8 +388,7 @@
}
@Override
- public String checkFinancialStatementChart() {
- StringBuilder result = new StringBuilder(t("lima-business.financialstatement.check.warn"));
+ public List<Account> checkFinancialStatementChart() {
AccountTopiaDao accountTopiaDao = getDaoHelper().getAccountDao();
FinancialStatementTopiaDao financialStatementTopiaDao = getDaoHelper().getFinancialStatementDao();
@@ -419,13 +408,7 @@
accountsList.removeAll(accountService.stringToListAccounts(financialStatement.getProvisionDeprecationAccounts()));
}
- for (Account account : accountsList) {
-
- result.append(t("lima-business.financialstatement.check.nothing",
- account.getAccountNumber(), account.getLabel()));
- }
-
- return result.toString();
+ return accountsList;
}
@Override
Modified: trunk/lima-business/src/main/resources/i18n/lima-business_fr_FR.properties
===================================================================
--- trunk/lima-business/src/main/resources/i18n/lima-business_fr_FR.properties 2014-07-24 12:04:19 UTC (rev 3862)
+++ trunk/lima-business/src/main/resources/i18n/lima-business_fr_FR.properties 2014-07-24 12:11:50 UTC (rev 3863)
@@ -69,8 +69,6 @@
lima-business.document.voucher=Pièce comptable
lima-business.document.zipcode=Code postal
lima-business.entrybook.entrybookalreadyexist=Un journal existe déjà avec ce code \: %s
-lima-business.financialstatement.check.nothing=Introuvable \: %s - %s \n
-lima-business.financialstatement.check.warn=Attention cette fonctionnalité n'est qu'une aide utilisateur.\n Certains comptes ne doivent pas être présent au bilan et compte de résultat.\n Il est donc normal que des comptes sont marqués comme introuvable.\n\n
lima-business.financialtransaction.retainedearnings.description=Report à nouveau
lima-business.financialtransaction.retainedearnings.voucher=Selon décision AG
lima-business.fiscalperiod.fiscalperiodalreadyblocked=La période fiscale est déjà bloquée
Modified: trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/FinancialStatementService.java
===================================================================
--- trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/FinancialStatementService.java 2014-07-24 12:04:19 UTC (rev 3862)
+++ trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/FinancialStatementService.java 2014-07-24 12:11:50 UTC (rev 3863)
@@ -27,6 +27,7 @@
import org.chorem.lima.beans.FinancialStatementAmounts;
import org.chorem.lima.business.LimaException;
+import org.chorem.lima.entity.Account;
import org.chorem.lima.entity.FinancialStatement;
import java.util.Date;
@@ -46,15 +47,16 @@
List<FinancialStatement> getAllFinancialStatements();
- List<FinancialStatement> getChildrenFinancialStatement(FinancialStatement financialStatement);
+ List<FinancialStatement> getRootFinancialStatements();
- List<FinancialStatement> getAllChildrenFinancialStatement(FinancialStatement financialStatement,
- List<FinancialStatement> financialStatements);
-
List<FinancialStatementAmounts> financialStatementReport(Date selectedBeginDate,
Date selectedEndDate);
- String checkFinancialStatementChart();
+ /**
+ *
+ * @return la liste de compte non utilisés.
+ */
+ List<Account> checkFinancialStatementChart();
/**
* Check if Financial Statement exist according the label given as parameter.
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartTreeTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartTreeTableModel.java 2014-07-24 12:04:19 UTC (rev 3862)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartTreeTableModel.java 2014-07-24 12:11:50 UTC (rev 3863)
@@ -25,6 +25,7 @@
package org.chorem.lima.ui.financialstatementchart;
+import com.google.common.collect.Lists;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.api.FinancialStatementService;
@@ -99,12 +100,11 @@
int result = 0;
if (node == getRoot()) {
result = financialStatementService.
- getChildrenFinancialStatement(null).size();
+ getRootFinancialStatements().size();
} else {
FinancialStatement parentFinancialStatementHeader =
(FinancialStatement) node;
- result = financialStatementService.getChildrenFinancialStatement(
- parentFinancialStatementHeader).size();
+ result = parentFinancialStatementHeader.getSubFinancialStatements().size();
}
return result;
}
@@ -114,13 +114,15 @@
Object result = null;
if (parent == getRoot()) {
List<FinancialStatement> financialStatements =
- financialStatementService.getChildrenFinancialStatement(null);
+ financialStatementService.getRootFinancialStatements();
result = financialStatements.get(index);
} else {
FinancialStatement parentFinancialStatement =
(FinancialStatement) parent;
- List<FinancialStatement> financialStatements = financialStatementService.
- getChildrenFinancialStatement(parentFinancialStatement);
+
+ List<FinancialStatement> financialStatements =
+ Lists.newArrayList(parentFinancialStatement.getSubFinancialStatements());
+
result = financialStatements.get(index);
}
return result;
@@ -132,13 +134,15 @@
if (parent == getRoot()) {
List<FinancialStatement> financialStatements =
- financialStatementService.getChildrenFinancialStatement(null);
+ financialStatementService.getRootFinancialStatements();
result = financialStatements.indexOf(child);
} else {
FinancialStatement parentFinancialStatement =
(FinancialStatement) parent;
- List<FinancialStatement> financialStatements = financialStatementService.
- getChildrenFinancialStatement(parentFinancialStatement);
+
+ List<FinancialStatement> financialStatements =
+ Lists.newArrayList(parentFinancialStatement.getSubFinancialStatements());
+
result = financialStatements.indexOf(child);
}
return result;
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartViewHandler.java 2014-07-24 12:04:19 UTC (rev 3862)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartViewHandler.java 2014-07-24 12:11:50 UTC (rev 3863)
@@ -30,6 +30,7 @@
import org.chorem.lima.business.ServiceListener;
import org.chorem.lima.business.api.FinancialStatementService;
import org.chorem.lima.business.api.ImportService;
+import org.chorem.lima.entity.Account;
import org.chorem.lima.entity.FinancialStatement;
import org.chorem.lima.entity.FinancialStatementImpl;
import org.chorem.lima.enums.FinancialStatementsChartEnum;
@@ -40,9 +41,15 @@
import org.jdesktop.swingx.JXTreeTable;
import org.nuiton.util.Resource;
-import javax.swing.*;
+import javax.swing.AbstractAction;
+import javax.swing.ActionMap;
+import javax.swing.InputMap;
+import javax.swing.JComponent;
+import javax.swing.JOptionPane;
+import javax.swing.JTextArea;
+import javax.swing.KeyStroke;
import javax.swing.tree.TreePath;
-import java.awt.*;
+import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
@@ -376,8 +383,17 @@
public void financialStatementChartCheck() {
- String result = financialStatementService.checkFinancialStatementChart();
- showReportDialog(result, t("lima.financialstatement.check"), view);
+ java.util.List<Account> unusedAccounts = financialStatementService.checkFinancialStatementChart();
+
+ StringBuilder result = new StringBuilder(t("lima.financialStatements.check.warn"));
+
+ for (Account account : unusedAccounts) {
+
+ result.append(t("lima.financialStatements.check.nothing",
+ account.getAccountNumber(), account.getLabel()));
+ }
+
+ showReportDialog(result.toString(), t("lima.financialStatements.check"), view);
}
/**
1
0
r3862 - in trunk/lima-swing/src/main/java/org/chorem/lima/ui: account entrybook financialperiod financialstatementchart financialtransaction financialtransactionunbalanced fiscalperiod home lettering vatchart
by dcosse@users.chorem.org 24 Jul '14
by dcosse@users.chorem.org 24 Jul '14
24 Jul '14
Author: dcosse
Date: 2014-07-24 14:04:19 +0200 (Thu, 24 Jul 2014)
New Revision: 3862
Url: http://forge.chorem.org/projects/lima/repository/revisions/3862
Log:
Utilisation De DesctopUtils de nuiton-utils ?\195?\160 la place de Desktop
Modified:
trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/HomeView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartView.jaxx
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 2014-07-23 16:36:19 UTC (rev 3861)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountView.jaxx 2014-07-24 12:04:19 UTC (rev 3862)
@@ -45,18 +45,18 @@
<JToolBar floatable="false">
<JButton id="addButton"
- toolTipText="{ "lima.ui.account.addaccount" + " (Ctrl+N)"}"
+ toolTipText="{ t("lima.ui.account.addaccount") + " (Ctrl+N)"}"
actionIcon='account-new'
onActionPerformed="handler.addAccount()"/>
<JButton id="updateButton"
- toolTipText="{ "lima.ui.common.update" + " (Ctrl+M)"}"
+ toolTipText="{ t("lima.ui.common.update") + " (Ctrl+M)"}"
actionIcon='account-edit'
onActionPerformed="handler.updateAccount()"
enabled="{isSelectedRow()}"/>
<JButton id="removeButton"
- toolTipText="{ "lima.ui.common.remove" + " (Del)"}"
+ toolTipText="{ t("lima.ui.common.remove") + " (Del)"}"
actionIcon='account-remove'
onActionPerformed="handler.removeAccount()"
enabled="{isSelectedRow()}"/>
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookView.jaxx 2014-07-23 16:36:19 UTC (rev 3861)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookView.jaxx 2014-07-24 12:04:19 UTC (rev 3862)
@@ -45,18 +45,18 @@
<JToolBar floatable="false">
<JButton id="addButton"
- toolTipText="{ "lima.ui.entrybook.add" + " (Ctrl+N)"}"
+ toolTipText="{ t("lima.ui.entrybook.add") + " (Ctrl+N)"}"
actionIcon='entryBook-new'
onActionPerformed="handler.addEntryBook()"/>
<JButton id="updateButton"
- toolTipText="{ "lima.ui.entrybook.update" + " (Ctrl+M)"}"
+ toolTipText="{ t("lima.ui.entrybook.update") + " (Ctrl+M)"}"
actionIcon='entryBook-edit'
onActionPerformed="handler.updateEntryBook()"
enabled="{isSelectedRow()}"/>
<JButton id="removeButton"
- toolTipText="{ "lima.ui.entrybook.remove" + " (Del)"}"
+ toolTipText="{ t("lima.ui.entrybook.remove") + " (Del)"}"
actionIcon='entryBook-remove'
onActionPerformed="handler.deleteEntryBook()"
enabled="{isSelectedRow()}"/>
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodView.jaxx 2014-07-23 16:36:19 UTC (rev 3861)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodView.jaxx 2014-07-24 12:04:19 UTC (rev 3862)
@@ -46,7 +46,7 @@
<JToolBar floatable="false">
<JButton id="blockButton"
- toolTipText="{ "lima.ui.financialperiod.block" + " (Ctrl+C)"}"
+ toolTipText="{ t("lima.ui.financialperiod.block") + " (Ctrl+C)"}"
actionIcon='financialPeriod-close'
onActionPerformed="handler.blockFinancialPeriod()"
enabled="{isSelectedPeriod()}"/>
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartView.jaxx 2014-07-23 16:36:19 UTC (rev 3861)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartView.jaxx 2014-07-24 12:04:19 UTC (rev 3862)
@@ -28,6 +28,7 @@
<import>
javax.swing.ListSelectionModel
org.jdesktop.swingx.decorator.HighlighterFactory
+ static org.nuiton.i18n.I18n.t
</import>
<FinancialStatementChartViewHandler id="handler"
@@ -39,37 +40,37 @@
<JToolBar floatable="false">
<JButton id="addFinancialStatementHeader"
- toolTipText="{ "lima.financialstatement.header.add" + " (Ctrl+Maj+N)"}"
+ toolTipText="{ t("lima.financialstatement.header.add") + " (Ctrl+Maj+N)"}"
actionIcon='financialstatement-add-header'
onActionPerformed="handler.addFinancialStatementHeader()"/>
<JButton id="addFinancialStatementMovement"
- toolTipText="{ "lima.financialstatement.movement.add" + " (Ctrl+N)"}"
+ toolTipText="{ t("lima.financialstatement.movement.add") + " (Ctrl+N)"}"
actionIcon='financialstatement-add-movement'
onActionPerformed="handler.addFinancialStatementMovement()"
enabled="{isSelectedRow()}"/>
<JButton id="updateButton"
- toolTipText="{ "lima.common.update" + " (Ctrl+M)"}"
+ toolTipText="{ t("lima.common.update") + " (Ctrl+M)"}"
actionIcon='financialstatement-edit'
onActionPerformed="handler.updateFinancialStatement()"
enabled="{isSelectedRow()}"/>
<JButton id="removeButton"
- toolTipText="{ "lima.common.remove" + " (Del)"}"
+ toolTipText="{ t("lima.common.remove") + " (Del)"}"
actionIcon='financialstatement-remove'
onActionPerformed="handler.removeFinancialStatement()"
enabled="{isSelectedRow()}"/>
<JButton id="importButton"
- toolTipText="{ "lima.ui.importexport.import" + " (Ctrl+I)"}"
+ toolTipText="{ t("lima.ui.importexport.import") + " (Ctrl+I)"}"
actionIcon='financialstatement-import'
onActionPerformed="handler.importFinancialStatementChart()"/>
<JToolBar.Separator/>
<JButton id="checkButton"
- toolTipText="{ "lima.financialstatement.check" + " (Ctrl+F)"}"
+ toolTipText="{ t("lima.financialstatement.check") + " (Ctrl+F)"}"
actionIcon='financialstatement-check'
onActionPerformed="handler.financialStatementChartCheck()"/>
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionView.jaxx 2014-07-23 16:36:19 UTC (rev 3861)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionView.jaxx 2014-07-24 12:04:19 UTC (rev 3862)
@@ -61,39 +61,39 @@
<row>
<cell fill="horizontal">
<JToolBar floatable="false">
- <JButton toolTipText="{ "lima.entries.addTransaction" + " (Ctrl+Shift+N)"}"
+ <JButton toolTipText="{ t("lima.entries.addTransaction") + " (Ctrl+Shift+N)"}"
actionIcon='add-financial-transaction'
onActionPerformed="handler.addFinancialTransaction()" />
- <JButton toolTipText="{ "lima.entries.remove.transaction" + " (Ctrl+Shift+Del)"}"
+ <JButton toolTipText="{ t("lima.entries.remove.transaction") + " (Ctrl+Shift+Del)"}"
actionIcon='delete-financial-transaction'
enabled="{isSelectedRow()}"
onActionPerformed="handler.deleteSelectedTransaction()" />
- <JButton toolTipText="{ "lima.entries.copy.transaction" + " (Ctrl+Shift+C)"}" actionIcon='copy'
+ <JButton toolTipText="{ t("lima.entries.copy.transaction") + " (Ctrl+Shift+C)"}" actionIcon='copy'
enabled="{isSelectedRow()}"
onActionPerformed="handler.copyTransaction()" />
- <JButton toolTipText="{ "lima.entries.paste.transaction" + " (Ctrl+Shift+V)"}" actionIcon='paste'
+ <JButton toolTipText="{ t("lima.entries.paste.transaction") + " (Ctrl+Shift+V)"}" actionIcon='paste'
enabled="{isTransactionInClipBoard()}"
onActionPerformed="handler.pasteTransaction()" />
<JToolBar.Separator/>
- <JButton toolTipText ="{ "lima.entries.addEntry" + " (Ctrl+N)"}" actionIcon='add-entry'
+ <JButton toolTipText ="{ t("lima.entries.addEntry") + " (Ctrl+N)"}" actionIcon='add-entry'
enabled="{isSelectedRow()}"
onActionPerformed="handler.addEntry()" />
- <JButton toolTipText="{ "lima.entries.remove.entry" + " (Ctrl+Del)"}" actionIcon='delete-entry'
+ <JButton toolTipText="{ t("lima.entries.remove.entry") + " (Ctrl+Del)"}" actionIcon='delete-entry'
enabled="{isSelectedRow()}"
onActionPerformed="handler.deleteSelectedEntry()" />
- <JButton toolTipText="{ "lima.entries.copy.entry" + " (Ctrl+Alt+C)"}" actionIcon='copy'
+ <JButton toolTipText="{ t("lima.entries.copy.entry") + " (Ctrl+Alt+C)"}" actionIcon='copy'
enabled="{isSelectedRow()}"
onActionPerformed="handler.copyEntry()" />
- <JButton toolTipText="{ "lima.entries.paste.entry" + " (Ctrl+Alt+V)"}" actionIcon='paste'
+ <JButton toolTipText="{ t("lima.entries.paste.entry") + " (Ctrl+Alt+V)"}" actionIcon='paste'
enabled="{isEntryInClipBoard() && isSelectedRow()}"
onActionPerformed="handler.pasteEntry()" />
- <JButton toolTipText="{ "lima.entries.assign.entries" + " (Ctrl+Alt+A)"}" actionIcon='assign-all-entries-in-transaction'
+ <JButton toolTipText="{ t("lima.entries.assign.entries") + " (Ctrl+Alt+A)"}" actionIcon='assign-all-entries-in-transaction'
enabled="{isAssignableInAllEntries() && isSelectedRow()}"
onActionPerformed="handler.assignAllEntries()" />
<JToolBar.Separator/>
- <JButton toolTipText="{ "lima.entries.balance" + " (Ctrl+B)"}" actionIcon='balance'
+ <JButton toolTipText="{ t("lima.entries.balance") + " (Ctrl+B)"}" actionIcon='balance'
enabled="{!isBalance()}"
onActionPerformed="handler.balanceTransaction()" />
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedView.jaxx 2014-07-23 16:36:19 UTC (rev 3861)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedView.jaxx 2014-07-24 12:04:19 UTC (rev 3862)
@@ -53,18 +53,18 @@
<row>
<cell fill="horizontal">
<JToolBar floatable="false">
- <JButton toolTipText="{ "lima.entries.remove.transaction" + " (Ctrl+Shift+Del)"}"
+ <JButton toolTipText="{ t("lima.entries.remove.transaction") + " (Ctrl+Shift+Del)"}"
actionIcon='delete-financial-transaction'
enabled="{isSelectedRow()}"
onActionPerformed="getHandler().deleteSelectedTransaction()" />
- <JButton toolTipText ="{ "lima.entries.addEntry" + " (Ctrl+N)"}" actionIcon='add-entry'
+ <JButton toolTipText ="{ t("lima.entries.addEntry") + " (Ctrl+N)"}" actionIcon='add-entry'
enabled="{isSelectedRow()}"
onActionPerformed="getHandler().addEntry()" />
- <JButton toolTipText="{ "lima.entries.remove.entry" + " (Ctrl+Del)"}" actionIcon='delete-entry'
+ <JButton toolTipText="{ t("lima.entries.remove.entry") + " (Ctrl+Del)"}" actionIcon='delete-entry'
enabled="{isSelectedRow()}"
onActionPerformed="getHandler().deleteSelectedEntry()" />
<JToolBar.Separator/>
- <JButton toolTipText="{ "lima.entries.balance" + " (Ctrl+B)"}" actionIcon='balance'
+ <JButton toolTipText="{ t("lima.entries.balance") + " (Ctrl+B)"}" actionIcon='balance'
enabled="{!isBalance()}"
onActionPerformed="handler.balanceTransaction()" />
<JToolBar.Separator/>
@@ -79,7 +79,7 @@
getHandler().refresh()"
editable="false"/>
<JToolBar.Separator/>
- <JButton toolTipText="{ "lima.ui.common.refresh" + " (F5)"}" actionIcon='refresh'
+ <JButton toolTipText="{ t("lima.ui.common.refresh") + " (F5)"}" actionIcon='refresh'
onActionPerformed="getHandler().refresh()"/>
</JToolBar>
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodView.jaxx 2014-07-23 16:36:19 UTC (rev 3861)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodView.jaxx 2014-07-24 12:04:19 UTC (rev 3862)
@@ -28,6 +28,7 @@
<import>
javax.swing.ListSelectionModel
javax.swing.DefaultListSelectionModel
+ static org.nuiton.i18n.I18n.t
</import>
<FiscalPeriodViewHandler id="handler" constructorParams="this"/>
@@ -46,24 +47,24 @@
<JToolBar floatable="false">
<JButton id="addButton"
- toolTipText="{ "lima.charts.fiscalperiod.add" + " (Ctrl+N)"}"
+ toolTipText="{ t("lima.charts.fiscalperiod.add") + " (Ctrl+N)"}"
actionIcon='fiscalPeriod-new'
onActionPerformed="handler.addFiscalPeriod()"/>
<JButton id="updateButton"
- toolTipText="{ "lima.charts.fiscalperiod.update" + " (Ctrl+M)"}"
+ toolTipText="{ t("lima.charts.fiscalperiod.update") + " (Ctrl+M)"}"
actionIcon='fiscalPeriod-edit'
onActionPerformed="handler.updateFiscalPeriod()"
enabled="{isDeleteEnabled()}" />
<JButton id="blockButton"
- toolTipText="{ "lima.charts.fiscalperiod.block" + " (Ctrl+B)"}"
+ toolTipText="{ t("lima.charts.fiscalperiod.block") + " (Ctrl+B)"}"
actionIcon='fiscalPeriod-close'
onActionPerformed="handler.blockFiscalPeriod()"
enabled="{isBlockEnabled()}"/>
<JButton id="deleteButton"
- toolTipText="{ "lima.charts.fiscalperiod.delete" + " (Del)"}"
+ toolTipText="{ t("lima.charts.fiscalperiod.delete") + " (Del)"}"
actionIcon='fiscalPeriod-remove'
onActionPerformed="handler.deleteFiscalPeriod()"
enabled="{isDeleteEnabled()}"/>
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 2014-07-23 16:36:19 UTC (rev 3861)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/HomeView.jaxx 2014-07-24 12:04:19 UTC (rev 3862)
@@ -29,6 +29,7 @@
javax.swing.BoxLayout
javax.swing.border.EtchedBorder
jaxx.runtime.SwingUtil
+ static org.nuiton.i18n.I18n.t
</import>
<Dimension id="fixedSize" javaBean='new Dimension(500,200)'/>
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringView.jaxx 2014-07-23 16:36:19 UTC (rev 3861)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringView.jaxx 2014-07-24 12:04:19 UTC (rev 3862)
@@ -32,6 +32,7 @@
org.chorem.lima.entity.Account
javax.swing.ListSelectionModel
org.jdesktop.swingx.JXDatePicker
+ static org.nuiton.i18n.I18n.t
</import>
<LetteringViewHandler id="handler" constructorParams="this"/>
@@ -54,19 +55,19 @@
<JToolBar floatable="false">
<JButton id="lettered"
- toolTipText="{ "lima.ui.lettering.buttonLettered" + " (Ctrl+L)"}"
+ toolTipText="{ t("lima.ui.lettering.buttonLettered") + " (Ctrl+L)"}"
enabled="{editModel.isLettred()}"
actionIcon='lettering'
onActionPerformed="handler.addLetter()"/>
<JButton id="noLettered"
- toolTipText="{ "lima.ui.lettering.buttonNoLettered" + " (Del)"}"
+ toolTipText="{ t("lima.ui.lettering.buttonNoLettered") + " (Del)"}"
enabled="{editModel.isUnLettred()}"
actionIcon='un-lettering'
onActionPerformed="handler.removeLetter()"/>
<JButton id="round"
- toolTipText="{ "lima.ui.lettering.buttonEqualize" + " (Ctrl+B)"}"
+ toolTipText="{ t("lima.ui.lettering.buttonEqualize") + " (Ctrl+B)"}"
enabled="{editModel.isEqualized()}"
actionIcon='balance'
onActionPerformed="handler.roundAndCreateEntry()"/>
@@ -113,7 +114,7 @@
<JToolBar.Separator/>
<JButton id="refresh"
- toolTipText="{ "lima.ui.lettering.buttonRefresh" + " (F5)"}"
+ toolTipText="{ t("lima.ui.lettering.buttonRefresh") + " (F5)"}"
actionIcon='refresh'
onActionPerformed="handler.updateAllEntries()"/>
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartView.jaxx 2014-07-23 16:36:19 UTC (rev 3861)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartView.jaxx 2014-07-24 12:04:19 UTC (rev 3862)
@@ -42,18 +42,18 @@
<JToolBar floatable="false">
<JButton id="addVatStatementMovement"
- toolTipText="{ "lima.vatstatement.movement.add" + " (Ctrl+N)"}"
+ toolTipText="{ t("lima.vatstatement.movement.add") + " (Ctrl+N)"}"
actionIcon='vatstatement-new'
onActionPerformed="handler.addVatStatementMovement()"/>
<JButton id="updateButton"
- toolTipText="{ "lima.common.update" + " (Ctrl+M)"}"
+ toolTipText="{ t("lima.common.update") + " (Ctrl+M)"}"
actionIcon='vatstatement-edit'
onActionPerformed="handler.updateVatStatement()"
enabled="{isSelectedRow()}"/>
<JButton id="removeButton"
- toolTipText="{ "lima.common.remove" + " (Del)"}"
+ toolTipText="{ t("lima.common.remove") + " (Del)"}"
actionIcon='vatstatement-remove'
onActionPerformed="handler.removeVatStatement()"
enabled="{isSelectedRow()}"/>
1
0
r3861 - in trunk: lima-business/src/main/java/org/chorem/lima/business/ejb lima-business/src/test/java/org/chorem/lima/business lima-business-api/src/main/java/org/chorem/lima/business/api lima-swing/src/main/java/org/chorem/lima/ui/importexport
by dcosse@users.chorem.org 23 Jul '14
by dcosse@users.chorem.org 23 Jul '14
23 Jul '14
Author: dcosse
Date: 2014-07-23 18:36:19 +0200 (Wed, 23 Jul 2014)
New Revision: 3861
Url: http://forge.chorem.org/projects/lima/repository/revisions/3861
Log:
refs #1032 progression migration vers nouveaux services
Modified:
trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/NewExportService.java
trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/NewImportService.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/NewExportServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/NewImportServiceImpl.java
trunk/lima-business/src/test/java/org/chorem/lima/business/NewImportExportServiceTest.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/NewExportServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/NewExportServiceImpl.java 2014-07-23 15:44:45 UTC (rev 3860)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/NewExportServiceImpl.java 2014-07-23 16:36:19 UTC (rev 3861)
@@ -26,6 +26,7 @@
package org.chorem.lima.business.ejb;
import com.google.common.collect.Lists;
+import com.sun.org.apache.xpath.internal.operations.Bool;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
@@ -243,10 +244,10 @@
}
@Override
- public String exportEntriesAsCSV(String charset) {
+ public String exportEntriesAsCSV(String charset, Boolean humanReadable) {
String result;
try {
- File file = exportEntriesFile(charset, true);
+ File file = exportEntriesFile(charset, humanReadable);
FileInputStream inputStream = new FileInputStream(file);
result = IOUtils.toString(inputStream);
} catch (Exception e) {
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/NewImportServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/NewImportServiceImpl.java 2014-07-23 15:44:45 UTC (rev 3860)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/NewImportServiceImpl.java 2014-07-23 16:36:19 UTC (rev 3861)
@@ -23,6 +23,7 @@
*/
import com.google.common.base.Function;
+import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
import org.apache.commons.io.IOUtils;
import org.chorem.lima.business.BeginAfterEndFiscalPeriodException;
@@ -85,8 +86,15 @@
@EJB
private FiscalPeriodService fiscalPeriodService;
+ protected static final Function<TopiaEntity, String> GET_TOPIA_ID = new Function<TopiaEntity, String>() {
+ @Override
+ public String apply(TopiaEntity input) {
+ return input == null ? null : input.getTopiaId();
+ }
+ };
+
@Override
- public void importAccountAsCSV(String contents) {
+ public String importAccountAsCSV(String contents) {
InputStream contentStream = IOUtils.toInputStream(contents);
try {
@@ -106,11 +114,11 @@
} finally {
IOUtils.closeQuietly(contentStream);
}
-
+ return "SUCCES";
}
@Override
- public void importEntryBooksAsCSV(String contents) {
+ public String importEntryBooksAsCSV(String contents) {
InputStream contentStream = IOUtils.toInputStream(contents);
try {
ImportModel<EntryBook> model = new EntryBookModel();
@@ -125,6 +133,7 @@
} finally {
IOUtils.closeQuietly(contentStream);
}
+ return "SUCCES";
}
@Override
@@ -155,29 +164,32 @@
}
@Override
- public void importFinancialTransactionsAsCSV(String contents) {
+ public String importFinancialTransactionsAsCSV(String contents) {
+
+ EntryBookTopiaDao entryBookdao = getDaoHelper().getEntryBookDao();
+ Preconditions.checkArgument(entryBookdao.count() > 0, "Les journaux doivent avoir été importé.");
+
// import and save FinancialTransactions
InputStream contentStream = IOUtils.toInputStream(contents);
try {
ImportModel<FinancialTransaction> model = new FinancialTransactionModel(entryBookService);
-
+
FinancialTransactionTopiaDao dao = getDaoHelper().getFinancialTransactionDao();
Import<FinancialTransaction> result = Import.newImport(model, contentStream);
dao.createAll(result);
} finally {
IOUtils.closeQuietly(contentStream);
}
+ return "SUCCES";
}
- protected static final Function<TopiaEntity, String> GET_TOPIA_ID = new Function<TopiaEntity, String>() {
- @Override
- public String apply(TopiaEntity input) {
- return input == null ? null : input.getTopiaId();
- }
- };
+ @Override
+ public String importEntriesAsCSV(String contents) {
+ AccountTopiaDao accountDao = getDaoHelper().getAccountDao();
+ FinancialTransactionTopiaDao financialTransactionDao = getDaoHelper().getFinancialTransactionDao();
- @Override
- public void importEntriesAsCSV(String contents) {
+ Preconditions.checkArgument(accountDao.count() > 0 && financialTransactionDao.count() > 0, "Les comptes et trasactions financières doivent avoir été importé.");
+
// import and save entries
InputStream contentStream = IOUtils.toInputStream(contents);
try {
@@ -190,14 +202,16 @@
} finally {
IOUtils.closeQuietly(contentStream);
}
+ return "SUCCES";
}
@Override
- public void importAllAsCSV(String entryBooks, String financialTransactions, String fiscalPeriods, String accounts, String entries){
+ public String importAllAsCSV(String entryBooks, String financialTransactions, String fiscalPeriods, String accounts, String entries){
+ importAccountAsCSV(accounts);
importEntryBooksAsCSV(entryBooks);
+ importFiscalPeriodsAsCSV(fiscalPeriods);
importFinancialTransactionsAsCSV(financialTransactions);
- importFiscalPeriodsAsCSV(fiscalPeriods);
- importAccountAsCSV(accounts);
importEntriesAsCSV(entries);
+ return "SUCCES";
}
}
Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/NewImportExportServiceTest.java
===================================================================
--- trunk/lima-business/src/test/java/org/chorem/lima/business/NewImportExportServiceTest.java 2014-07-23 15:44:45 UTC (rev 3860)
+++ trunk/lima-business/src/test/java/org/chorem/lima/business/NewImportExportServiceTest.java 2014-07-23 16:36:19 UTC (rev 3861)
@@ -141,7 +141,7 @@
//test export
String tmpDir = System.getProperty("java.io.tmpdir")+"/";
- String export = newExportService.exportEntriesAsCSV(Charset.defaultCharset().name());
+ String export = newExportService.exportEntriesAsCSV(Charset.defaultCharset().name(), false);
InputStream stream = IOUtils.toInputStream(export);
FileOutputStream res = new FileOutputStream(tmpDir + "export-entries.csv");
IOUtils.copy(stream, res);
Modified: trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/NewExportService.java
===================================================================
--- trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/NewExportService.java 2014-07-23 15:44:45 UTC (rev 3860)
+++ trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/NewExportService.java 2014-07-23 16:36:19 UTC (rev 3861)
@@ -48,5 +48,5 @@
String exportFinancialTransactionsAsCSV(String charset);
- String exportEntriesAsCSV(String charset);
+ String exportEntriesAsCSV(String charset, Boolean humanReadable);
}
Modified: trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/NewImportService.java
===================================================================
--- trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/NewImportService.java 2014-07-23 15:44:45 UTC (rev 3860)
+++ trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/NewImportService.java 2014-07-23 16:36:19 UTC (rev 3861)
@@ -27,15 +27,15 @@
*/
public interface NewImportService {
- void importAccountAsCSV(String contents);
+ String importAccountAsCSV(String contents);
- void importEntryBooksAsCSV(String contents);
+ String importEntryBooksAsCSV(String contents);
String importFiscalPeriodsAsCSV(String contents);
- void importFinancialTransactionsAsCSV(String contents);
+ String importFinancialTransactionsAsCSV(String contents);
- void importEntriesAsCSV(String contents);
+ String importEntriesAsCSV(String contents);
- void importAllAsCSV(String entryBooks, String transactions, String fiscalPeriods, String accounts, String entries);
+ String importAllAsCSV(String entryBooks, String transactions, String fiscalPeriods, String accounts, String entries);
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java 2014-07-23 15:44:45 UTC (rev 3860)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java 2014-07-23 16:36:19 UTC (rev 3861)
@@ -160,7 +160,7 @@
createFile(filePath, charset.name(), datas);
break;
case CSV_ENTRIES_EXPORT:
- datas = newExportService.exportEntriesAsCSV(charset.name());
+ datas = newExportService.exportEntriesAsCSV(charset.name(), true);
createFile(filePath, charset.name(), datas);
break;
case CSV_FINANCIALSTATEMENTS_EXPORT:
@@ -186,24 +186,24 @@
break;
case CSV_ACCOUNTCHARTS_IMPORT:
datas = extractFile(filePath, charset.name());
- result = importService.importAsCSV(datas, ImportExportEntityEnum.ACCOUNT);
+ result = newImportService.importAccountAsCSV(datas);
break;
case CSV_ENTRYBOOKS_IMPORT:
datas = extractFile(filePath, charset.name());
- result = importService.importAsCSV(datas, ImportExportEntityEnum.ENTRYBOOK);
+ result = newImportService.importEntryBooksAsCSV(datas);
break;
case CSV_FINANCIALSTATEMENTS_IMPORT:
datas = extractFile(filePath, charset.name());
result = importService.importAsCSV(datas, ImportExportEntityEnum.FINANCIALSTATEMENT);
break;
+ case CSV_ENTRIES_IMPORT:
+ datas = extractFile(filePath, charset.name());
+ result = newImportService.importEntriesAsCSV(datas);
+ break;
case CSV_VAT_IMPORT:
datas = extractFile(filePath, charset.name());
result = importService.importAsCSV(datas, ImportExportEntityEnum.VATSTATEMENT);
break;
- case CSV_ENTRIES_IMPORT:
- datas = extractFile(filePath, charset.name());
- result = importService.importAsCSV(datas, ImportExportEntityEnum.ENTRY);
- break;
case PDF_VAT_IMPORT:
int response = JOptionPane.showConfirmDialog(waitView,
t("lima.importexport.usevatpdf"),
1
0
23 Jul '14
Author: dcosse
Date: 2014-07-23 17:44:45 +0200 (Wed, 23 Jul 2014)
New Revision: 3860
Url: http://forge.chorem.org/projects/lima/repository/revisions/3860
Log:
refs #1032 export entries as CSV replace financialTransaction id by financialTransaction date
Modified:
trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/NewExportService.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/NewExportServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/NewImportServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/csv/AbstractLimaModel.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/csv/EntryModel.java
trunk/lima-business/src/test/java/org/chorem/lima/business/NewImportExportServiceTest.java
trunk/lima-swing/src/main/java/org/chorem/lima/enums/ImportExportEnum.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/NewExportServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/NewExportServiceImpl.java 2014-07-23 14:52:58 UTC (rev 3859)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/NewExportServiceImpl.java 2014-07-23 15:44:45 UTC (rev 3860)
@@ -99,7 +99,7 @@
files.add(exportEntryBooksFile(charset));
files.add(exportFiscalPeriodFile(charset));
files.add(exportFinancialTransactionsFile(charset));
- files.add(exportEntriesFile(charset));
+ files.add(exportEntriesFile(charset, false));
export = new ZipOutputStream(rstBao);
@@ -139,7 +139,7 @@
}
@Override
- public String exportAccountsStream(String charset) {
+ public String exportAccountsAsCSV(String charset) {
String result;
try {
File file = exportAccountsFile(charset);
@@ -165,7 +165,7 @@
@Override
- public String exportEntryBooksStream(String charset) {
+ public String exportEntryBooksAsCSV(String charset) {
String result;
try {
File file = exportEntryBooksFile(charset);
@@ -191,7 +191,7 @@
}
@Override
- public String exportFiscalPeriodsStream(String charset) {
+ public String exportFiscalPeriodsAsCSV(String charset) {
String result;
try {
File file = exportFiscalPeriodFile(charset);
@@ -219,7 +219,7 @@
}
@Override
- public String exportFinancialTransactionsAsStream(String charset) {
+ public String exportFinancialTransactionsAsCSV(String charset) {
String result;
try {
File file = exportFinancialTransactionsFile(charset);
@@ -231,13 +231,13 @@
return result;
}
- protected File exportEntriesFile(String charset) throws Exception {
+ protected File exportEntriesFile(String charset, Boolean humanReadable) throws Exception {
EntryTopiaDao dao = getDaoHelper().getEntryDao();
List<Entry> entities = dao.findAll();
String tmpDir = System.getProperty("java.io.tmpdir")+"/";
File result = new File(tmpDir + "entries.csv");
- EntryModel model = new EntryModel(accountService, financialTransactionService);
+ EntryModel model = new EntryModel(accountService, financialTransactionService , humanReadable);
Export.exportToFile(model, entities, result, Charset.forName(charset));
return result;
}
@@ -246,7 +246,7 @@
public String exportEntriesAsCSV(String charset) {
String result;
try {
- File file = exportEntriesFile(charset);
+ File file = exportEntriesFile(charset, true);
FileInputStream inputStream = new FileInputStream(file);
result = IOUtils.toString(inputStream);
} catch (Exception e) {
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/NewImportServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/NewImportServiceImpl.java 2014-07-23 14:52:58 UTC (rev 3859)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/NewImportServiceImpl.java 2014-07-23 15:44:45 UTC (rev 3860)
@@ -181,7 +181,7 @@
// import and save entries
InputStream contentStream = IOUtils.toInputStream(contents);
try {
- ImportModel<Entry> model = new EntryModel(accountService, financialTransactionService);
+ ImportModel<Entry> model = new EntryModel(accountService, financialTransactionService, false);
Import<Entry> result = Import.newImport(model, contentStream);
EntryTopiaDao dao = getDaoHelper().getEntryDao();
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/csv/AbstractLimaModel.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/csv/AbstractLimaModel.java 2014-07-23 14:52:58 UTC (rev 3859)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/csv/AbstractLimaModel.java 2014-07-23 15:44:45 UTC (rev 3860)
@@ -52,6 +52,10 @@
protected static AccountService accountService;
+ protected static Boolean humanReadable;
+
+ protected static SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd/MM/yyyy");
+
public AbstractLimaModel(char separator) {
super(separator);
}
@@ -290,12 +294,12 @@
}
};
- protected static final ValueFormatter<FinancialTransaction> FINANCIAL_TRANSACTION_TO_FINANCIAL_TRANSACTION_ID_FORMATTER = new ValueFormatter<FinancialTransaction>() {
+ protected static final ValueFormatter<FinancialTransaction> FINANCIAL_TRANSACTION_TO_FINANCIAL_TRANSACTION_FORMATTER = new ValueFormatter<FinancialTransaction>() {
@Override
public String format(FinancialTransaction value) {
String result;
if (value != null) {
- result = value.getTopiaId();
+ result = humanReadable ? simpleDateFormat.format(value.getTransactionDate()) : value.getTopiaId();
} else {
result = "";
}
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/csv/EntryModel.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/csv/EntryModel.java 2014-07-23 14:52:58 UTC (rev 3859)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/csv/EntryModel.java 2014-07-23 15:44:45 UTC (rev 3860)
@@ -35,10 +35,11 @@
*/
public class EntryModel extends AbstractLimaModel<Entry> implements ExportModel<Entry> {
- public EntryModel(AccountService accountService, FinancialTransactionService financialTransactionService) {
+ public EntryModel(AccountService accountService, FinancialTransactionService financialTransactionService, boolean humanReadable) {
super(';');
AbstractLimaModel.accountService = accountService;
AbstractLimaModel.financialTransactionService = financialTransactionService;
+ AbstractLimaModel.humanReadable = humanReadable;
newMandatoryColumn("account", Entry.PROPERTY_ACCOUNT, ACCOUNT_NUMBER_TO_ACCOUNT_TRANSACTION_PARSER);
newOptionalColumn("amount", Entry.PROPERTY_AMOUNT, BIG_DECIMAL_WITH_NULL_PARSER);
@@ -62,7 +63,7 @@
modelBuilder.newColumnForExport("voucher", Entry.PROPERTY_VOUCHER);
modelBuilder.newColumnForExport("description", Entry.PROPERTY_DESCRIPTION);
modelBuilder.newColumnForExport("lettering", Entry.PROPERTY_LETTERING);
- modelBuilder.newColumnForExport("financialTransaction", Entry.PROPERTY_FINANCIAL_TRANSACTION, FINANCIAL_TRANSACTION_TO_FINANCIAL_TRANSACTION_ID_FORMATTER);
+ modelBuilder.newColumnForExport("financialTransaction", Entry.PROPERTY_FINANCIAL_TRANSACTION, FINANCIAL_TRANSACTION_TO_FINANCIAL_TRANSACTION_FORMATTER);
return (Iterable) modelBuilder.getColumnsForExport();
}
Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/NewImportExportServiceTest.java
===================================================================
--- trunk/lima-business/src/test/java/org/chorem/lima/business/NewImportExportServiceTest.java 2014-07-23 14:52:58 UTC (rev 3859)
+++ trunk/lima-business/src/test/java/org/chorem/lima/business/NewImportExportServiceTest.java 2014-07-23 15:44:45 UTC (rev 3860)
@@ -15,14 +15,11 @@
import java.io.ByteArrayInputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;
-import java.io.FileWriter;
-import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.Charset;
import java.util.List;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
-import java.util.zip.ZipOutputStream;
/**
* Created by davidcosse on 03/06/14.
@@ -39,7 +36,7 @@
// export accounts
String tmpDir = System.getProperty("java.io.tmpdir")+"/";
- String export = newExportService.exportAccountsStream(Charset.defaultCharset().name());
+ String export = newExportService.exportAccountsAsCSV(Charset.defaultCharset().name());
InputStream stream = IOUtils.toInputStream(export);
FileOutputStream res = new FileOutputStream(tmpDir + "export-accounts.csv");
IOUtils.copy(stream, res);
@@ -70,7 +67,7 @@
initTestWithEntryBooks();
String tmpDir = System.getProperty("java.io.tmpdir")+"/";
- String export = newExportService.exportEntryBooksStream(Charset.defaultCharset().name());
+ String export = newExportService.exportEntryBooksAsCSV(Charset.defaultCharset().name());
InputStream stream = IOUtils.toInputStream(export);
FileOutputStream res = new FileOutputStream(tmpDir + "export-EntryBooks.csv");
IOUtils.copy(stream, res);
@@ -102,7 +99,7 @@
initTestWithFinancialTransaction();
String tmpDir = System.getProperty("java.io.tmpdir")+"/";
- String export = newExportService.exportFinancialTransactionsAsStream(Charset.defaultCharset().name());
+ String export = newExportService.exportFinancialTransactionsAsCSV(Charset.defaultCharset().name());
InputStream stream = IOUtils.toInputStream(export);
FileOutputStream res = new FileOutputStream(tmpDir + "export-financial-transactions.csv");
IOUtils.copy(stream, res);
@@ -189,7 +186,7 @@
initTestWithFiscalPeriod();
String tmpDir = System.getProperty("java.io.tmpdir")+"/";
- String export = newExportService.exportFiscalPeriodsStream(Charset.defaultCharset().name());
+ String export = newExportService.exportFiscalPeriodsAsCSV(Charset.defaultCharset().name());
InputStream stream = IOUtils.toInputStream(export);
FileOutputStream res = new FileOutputStream(tmpDir + "export-fiscal-periods.csv");
IOUtils.copy(stream, res);
Modified: trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/NewExportService.java
===================================================================
--- trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/NewExportService.java 2014-07-23 14:52:58 UTC (rev 3859)
+++ trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/NewExportService.java 2014-07-23 15:44:45 UTC (rev 3860)
@@ -40,13 +40,13 @@
String exportAllAsCSV(String charset);
- String exportAccountsStream(String charset);
+ String exportAccountsAsCSV(String charset);
- String exportEntryBooksStream(String charset);
+ String exportEntryBooksAsCSV(String charset);
- String exportFiscalPeriodsStream(String charset);
+ String exportFiscalPeriodsAsCSV(String charset);
- String exportFinancialTransactionsAsStream(String charset);
+ String exportFinancialTransactionsAsCSV(String charset);
String exportEntriesAsCSV(String charset);
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/enums/ImportExportEnum.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/enums/ImportExportEnum.java 2014-07-23 14:52:58 UTC (rev 3859)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/enums/ImportExportEnum.java 2014-07-23 15:44:45 UTC (rev 3860)
@@ -33,9 +33,10 @@
CSV_ALL_EXPORT(false, false), CSV_ALL_IMPORT(true, true),
CSV_ACCOUNTCHARTS_EXPORT(false, true), CSV_ACCOUNTCHARTS_IMPORT(true, true),
CSV_ENTRYBOOKS_EXPORT(false, true), CSV_ENTRYBOOKS_IMPORT(true, true),
+ CSV_ENTRIES_EXPORT(false, true),CSV_ENTRIES_IMPORT(true, true),
CSV_FINANCIALSTATEMENTS_EXPORT(false, true), CSV_FINANCIALSTATEMENTS_IMPORT(true, true),
CSV_VAT_EXPORT(false, true), CSV_VAT_IMPORT(true, true),
- CSV_ENTRIES_IMPORT(true, true),
+
PDF_VAT_EXPORT(false, true), PDF_VAT_IMPORT(true, true),
EBP_ACCOUNTCHARTS_EXPORT(false, false), EBP_ENTRIES_EXPORT(false, false),
EBP_ACCOUNTCHARTS_IMPORT(true, true), EBP_ENTRIES_IMPORT(true, true),
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainView.jaxx 2014-07-23 14:52:58 UTC (rev 3859)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainView.jaxx 2014-07-23 15:44:45 UTC (rev 3860)
@@ -83,6 +83,8 @@
onActionPerformed='getHandler().showImportExportView(this, ImportExportEnum.CSV_ENTRYBOOKS_EXPORT)'/>
<JMenuItem text="lima.ui.importexport.accountcharts"
onActionPerformed='getHandler().showImportExportView(this, ImportExportEnum.CSV_ACCOUNTCHARTS_EXPORT)'/>
+ <JMenuItem text="lima.ui.importexport.financialtransactions"
+ onActionPerformed='getHandler().showImportExportView(this, ImportExportEnum.CSV_ENTRIES_EXPORT)'/>
<JMenuItem text="lima.ui.importexport.financialstatements"
onActionPerformed='getHandler().showImportExportView(this, ImportExportEnum.CSV_FINANCIALSTATEMENTS_EXPORT)'/>
<JMenuItem text="lima.ui.importexport.vatstatements"
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java 2014-07-23 14:52:58 UTC (rev 3859)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java 2014-07-23 15:44:45 UTC (rev 3860)
@@ -152,13 +152,17 @@
createZipFile(filePath, datas);
break;
case CSV_ACCOUNTCHARTS_EXPORT:
- datas = exportService.exportAccountsChartAsCSV();
+ datas = newExportService.exportAccountsAsCSV(charset.name());
createFile(filePath, charset.name(), datas);
break;
case CSV_ENTRYBOOKS_EXPORT:
- datas = exportService.exportEntryBookChartAsCSV();
+ datas = newExportService.exportEntryBooksAsCSV(charset.name());
createFile(filePath, charset.name(), datas);
break;
+ case CSV_ENTRIES_EXPORT:
+ datas = newExportService.exportEntriesAsCSV(charset.name());
+ createFile(filePath, charset.name(), datas);
+ break;
case CSV_FINANCIALSTATEMENTS_EXPORT:
datas = exportService.exportFinancialStatementChartAsCSV();
createFile(filePath, charset.name(), datas);
1
0
r3859 - in trunk: lima-business/src/main/java/org/chorem/lima/business/ejb lima-business-api/src/main/java/org/chorem/lima/business/api lima-swing/src/main/java/org/chorem/lima/ui lima-swing/src/main/java/org/chorem/lima/ui/importexport
by dcosse@users.chorem.org 23 Jul '14
by dcosse@users.chorem.org 23 Jul '14
23 Jul '14
Author: dcosse
Date: 2014-07-23 16:52:58 +0200 (Wed, 23 Jul 2014)
New Revision: 3859
Url: http://forge.chorem.org/projects/lima/repository/revisions/3859
Log:
refs #1032 fix import export for entries
Modified:
trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/NewImportService.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/NewImportServiceImpl.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/NewImportServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/NewImportServiceImpl.java 2014-07-23 14:27:23 UTC (rev 3858)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/NewImportServiceImpl.java 2014-07-23 14:52:58 UTC (rev 3859)
@@ -193,11 +193,11 @@
}
@Override
- public void importAllAsCSV(String entryBooks, String financialTransactions, String fiscalPeriods, String entries, String accounts){
+ public void importAllAsCSV(String entryBooks, String financialTransactions, String fiscalPeriods, String accounts, String entries){
importEntryBooksAsCSV(entryBooks);
importFinancialTransactionsAsCSV(financialTransactions);
importFiscalPeriodsAsCSV(fiscalPeriods);
+ importAccountAsCSV(accounts);
importEntriesAsCSV(entries);
- importAccountAsCSV(accounts);
}
}
Modified: trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/NewImportService.java
===================================================================
--- trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/NewImportService.java 2014-07-23 14:27:23 UTC (rev 3858)
+++ trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/NewImportService.java 2014-07-23 14:52:58 UTC (rev 3859)
@@ -37,5 +37,5 @@
void importEntriesAsCSV(String contents);
- void importAllAsCSV(String entryBooks, String transactions, String fiscalPeriods, String entries, String accounts);
+ void importAllAsCSV(String entryBooks, String transactions, String fiscalPeriods, String accounts, String entries);
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainView.jaxx 2014-07-23 14:27:23 UTC (rev 3858)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainView.jaxx 2014-07-23 14:52:58 UTC (rev 3859)
@@ -65,24 +65,24 @@
<JMenu text="lima.ui.importexport.import" actionIcon='import-element'>
<JMenuItem text="lima.ui.importexport.all"
onActionPerformed='getHandler().showImportExportView(this, ImportExportEnum.CSV_ALL_IMPORT)'/>
+ <JMenuItem text="lima.ui.importexport.entrybooks"
+ onActionPerformed='getHandler().showImportExportView(this, ImportExportEnum.CSV_ENTRYBOOKS_IMPORT)'/>
<JMenuItem text="lima.ui.importexport.accountcharts"
onActionPerformed='getHandler().showImportExportView(this, ImportExportEnum.CSV_ACCOUNTCHARTS_IMPORT)'/>
- <JMenuItem text="lima.ui.importexport.entrybooks"
- onActionPerformed='getHandler().showImportExportView(this, ImportExportEnum.CSV_ENTRYBOOKS_IMPORT)'/>
+ <JMenuItem text="lima.ui.importexport.financialtransactions"
+ onActionPerformed='getHandler().showImportExportView(this, ImportExportEnum.CSV_ENTRIES_IMPORT)'/>
<JMenuItem text="lima.ui.importexport.financialstatements"
onActionPerformed='getHandler().showImportExportView(this, ImportExportEnum.CSV_FINANCIALSTATEMENTS_IMPORT)'/>
<JMenuItem text="lima.ui.importexport.vatstatements"
onActionPerformed='getHandler().showImportExportView(this, ImportExportEnum.CSV_VAT_IMPORT)'/>
- <JMenuItem text="lima.ui.importexport.financialtransactions"
- onActionPerformed='getHandler().showImportExportView(this, ImportExportEnum.CSV_ENTRIES_IMPORT)'/>
</JMenu>
<JMenu text="lima.ui.importexport.export" actionIcon='export-element'>
<JMenuItem text="lima.ui.importexport.all"
onActionPerformed='getHandler().showImportExportView(this, ImportExportEnum.CSV_ALL_EXPORT)'/>
+ <JMenuItem text="lima.ui.importexport.entrybooks"
+ onActionPerformed='getHandler().showImportExportView(this, ImportExportEnum.CSV_ENTRYBOOKS_EXPORT)'/>
<JMenuItem text="lima.ui.importexport.accountcharts"
onActionPerformed='getHandler().showImportExportView(this, ImportExportEnum.CSV_ACCOUNTCHARTS_EXPORT)'/>
- <JMenuItem text="lima.ui.importexport.entrybooks"
- onActionPerformed='getHandler().showImportExportView(this, ImportExportEnum.CSV_ENTRYBOOKS_EXPORT)'/>
<JMenuItem text="lima.ui.importexport.financialstatements"
onActionPerformed='getHandler().showImportExportView(this, ImportExportEnum.CSV_FINANCIALSTATEMENTS_EXPORT)'/>
<JMenuItem text="lima.ui.importexport.vatstatements"
@@ -91,20 +91,20 @@
</JMenu>
<JMenu text="lima.ui.importexport.ebp">
<JMenu text="lima.ui.importexport.import" actionIcon='import-element'>
+ <JMenuItem text="lima.ui.importexport.entrybooks"
+ onActionPerformed='getHandler().showImportExportView(this, ImportExportEnum.EBP_ENTRYBOOKS_IMPORT)'/>
<JMenuItem text="lima.ui.importexport.accountcharts"
onActionPerformed='getHandler().showImportExportView(this, ImportExportEnum.EBP_ACCOUNTCHARTS_IMPORT)'/>
<JMenuItem text="lima.ui.importexport.entries"
onActionPerformed='getHandler().showImportExportView(this, ImportExportEnum.EBP_ENTRIES_IMPORT)'/>
- <JMenuItem text="lima.ui.importexport.entrybooks"
- onActionPerformed='getHandler().showImportExportView(this, ImportExportEnum.EBP_ENTRYBOOKS_IMPORT)'/>
</JMenu>
<JMenu text="lima.ui.importexport.export" actionIcon='export-element'>
+ <JMenuItem text="lima.ui.importexport.entrybooks"
+ onActionPerformed='getHandler().showImportExportView(this, ImportExportEnum.EBP_ENTRYBOOKS_EXPORT)'/>
<JMenuItem text="lima.ui.importexport.accountcharts"
onActionPerformed='getHandler().showImportExportView(this, ImportExportEnum.EBP_ACCOUNTCHARTS_EXPORT)'/>
<JMenuItem text="lima.ui.importexport.entries"
onActionPerformed='getHandler().showImportExportView(this, ImportExportEnum.EBP_ENTRIES_EXPORT)'/>
- <JMenuItem text="lima.ui.importexport.entrybooks"
- onActionPerformed='getHandler().showImportExportView(this, ImportExportEnum.EBP_ENTRYBOOKS_EXPORT)'/>
</JMenu>
</JMenu>
<JSeparator/>
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java 2014-07-23 14:27:23 UTC (rev 3858)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java 2014-07-23 14:52:58 UTC (rev 3859)
@@ -472,16 +472,16 @@
String fiscalPeriodsStreamString = IOUtils.toString(fiscalPeriodsStream);
IOUtils.closeQuietly(fiscalPeriodsStream);
+ accountsStream = new FileInputStream(tmpDir + "accounts.csv");
+ String accountsStreamString = IOUtils.toString(accountsStream);
+ IOUtils.closeQuietly(accountsStream);
+
entriesStream = new FileInputStream(tmpDir + "entries.csv");
String entriesStreamString = IOUtils.toString(entriesStream);
IOUtils.closeQuietly(entriesStream);
- accountsStream = new FileInputStream(tmpDir + "accounts.csv");
- String accountsStreamString = IOUtils.toString(accountsStream);
- IOUtils.closeQuietly(accountsStream);
+ newImportService.importAllAsCSV(entryBooksStreamString, transactionsStreamString, fiscalPeriodsStreamString, accountsStreamString, entriesStreamString);
- newImportService.importAllAsCSV(entryBooksStreamString, transactionsStreamString, fiscalPeriodsStreamString, entriesStreamString, accountsStreamString);
-
} catch (Exception ex) {
if(log.isInfoEnabled()) {
log.info(ex);
1
0
r3858 - in trunk: lima-business/src/main/java/org/chorem/lima/business/ejb lima-business-api/src/main/java/org/chorem/lima/business/api lima-swing/src/main/java/org/chorem/lima/ui/importexport
by dcosse@users.chorem.org 23 Jul '14
by dcosse@users.chorem.org 23 Jul '14
23 Jul '14
Author: dcosse
Date: 2014-07-23 16:27:23 +0200 (Wed, 23 Jul 2014)
New Revision: 3858
Url: http://forge.chorem.org/projects/lima/repository/revisions/3858
Log:
refs #1032 correction sur import EBP
Modified:
trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/ImportService.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java 2014-07-23 13:46:03 UTC (rev 3857)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java 2014-07-23 14:27:23 UTC (rev 3858)
@@ -27,6 +27,7 @@
import com.google.common.base.Predicate;
import com.google.common.collect.Collections2;
+import com.google.common.collect.Lists;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -98,6 +99,10 @@
FinancialTransactionTopiaDao financialtransactionTopiaDao = getDaoHelper().getFinancialTransactionDao();
+ if (financialtransaction.getEntry() == null) {
+ financialtransaction.setEntry(Lists.<Entry>newArrayList());
+ }
+
FinancialTransaction result = financialtransactionTopiaDao.create(financialtransaction);
return result;
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java 2014-07-23 13:46:03 UTC (rev 3857)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java 2014-07-23 14:27:23 UTC (rev 3858)
@@ -551,102 +551,6 @@
// ################ IMPORT ################
- /** Remote methode to call all entities import from UI */
- @Override
- public String importAllAsCSV(String datas) throws ImportEbpException {
- StringBuilder result = new StringBuilder();
-
- Map<String, List<FinancialStatementImport>> financialStatements =
- new LinkedHashMap<String, List<FinancialStatementImport>>();
-
- Map<String, List<VatStatementImport>> vatStatements =
- new LinkedHashMap<String, List<VatStatementImport>>();
-
- List<FiscalPeriod> fiscalPeriods = new ArrayList<FiscalPeriod>();
-
- List<ClosedPeriodicEntryBookImport> closedPeriodicEntryBooks =
- new ArrayList<ClosedPeriodicEntryBookImport>();
-
- Map<Integer, FinancialTransactionImport> financialTransactions =
- new HashMap<Integer, FinancialTransactionImport>();
-
- Map<Integer, List<EntryImport>> entries =
- new HashMap<Integer, List<EntryImport>>();
-
- CSVReader csvReader = null;
- try {
-
- String[] nextLine;
- csvReader = new CSVReader(new StringReader(datas), ';');
-
- while ((nextLine = csvReader.readNext()) != null) {
- ImportExportEntityEnum importExportEntityEnum = ImportExportEntityEnum
- .valueOfLabel(nextLine[0]);
- if (importExportEntityEnum != null) {
- switch (importExportEntityEnum) {
- case ACCOUNT:
- result.append(importAccountsChartsCSV(nextLine));
- break;
- case ENTRYBOOK:
- result.append(importEntryBooksChartCSV(nextLine));
- break;
- case FINANCIALSTATEMENT:
- result.append(importFinancialsStatementChartCSV(nextLine,
- financialStatements));
- break;
- case VATSTATEMENT:
- result.append(importVatStatementChartCSV(nextLine,
- vatStatements));
- break;
- case FISCALPERIOD:
- result.append(importFiscalPeriodCSV(nextLine,
- fiscalPeriods));
- break;
- case CLOSEDPERIODICENTRYBOOK:
- importClosedPeriodicEntryBookCSV(nextLine,
- closedPeriodicEntryBooks);
- break;
- case FINANCIALTRANSACTION:
- importFinancialTransactionsCSV(nextLine,
- financialTransactions);
- break;
- case ENTRY:
- importEntriesCSV(nextLine, entries);
- break;
- case IDENTITY:
- importIdentity(nextLine);
- break;
- }
- }
- }
-
- // create financialStatements
- result.append(createFinancialStatements(financialStatements));
- // create vatStatements
- result.append(createVatStatements(vatStatements));
- // create fiscalperiod
- Collections.sort(fiscalPeriods, new FiscalPeriodComparator());
- result.append(createFiscalPeriod(fiscalPeriods));
- // update closedperiodicentrybooks
- result.append(updateClosedPeriodicEntryBooks(closedPeriodicEntryBooks));
- // create financialtransaction and entries
- result.append(createFinancialTransactionsAndEntries(
- financialTransactions, entries));
-
- } catch (IOException e) {
- throw new ImportEbpException("Can't import", e);
- } finally {
- if (csvReader != null) {
- try {
- csvReader.close();
- } catch (IOException e) {
- // on fait rien
- }
- }
- }
- return result.toString();
- }
-
/**
* Remote methode to call entity import from UI
* This methode let import just on type of entity
Modified: trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/ImportService.java
===================================================================
--- trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/ImportService.java 2014-07-23 13:46:03 UTC (rev 3857)
+++ trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/ImportService.java 2014-07-23 14:27:23 UTC (rev 3858)
@@ -63,17 +63,6 @@
String importEntriesFromEbp(String data) throws ImportEbpException;
/**
- * Import data as lima CSV import.
- * <p/>
- * Read first line to detect file type and call {@link #importAsCSV(String, ImportExportEntityEnum)}.
- *
- * @param data import file content as string (remote service can't take File)
- * @return result log
- * @throws LimaException
- */
- String importAllAsCSV(String data) throws ImportEbpException;
-
- /**
* Import content as CSV depending on import type.
*
* @param data import file content as string (remote service can't take File)
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java 2014-07-23 13:46:03 UTC (rev 3857)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java 2014-07-23 14:27:23 UTC (rev 3858)
@@ -243,10 +243,6 @@
//hidde wait dialog panel
waitView.setVisible(false);
- if(log.isInfoEnabled()) {
- log.info(get());
- }
-
// display result dialog
if (verboseMode) {
String result = get();
1
0