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 2010
- 3 participants
- 34 discussions
Author: jpepin
Date: 2010-07-21 16:02:18 +0200 (Wed, 21 Jul 2010)
New Revision: 2979
Url: http://chorem.org/repositories/revision/lima/2979
Log:
Impl?\195?\169mentation de ServiceListener dans les mod?\195?\168les de structures et de combobox.
Modified:
trunk/lima-business/src/main/java/org/chorem/lima/business/ImportService.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/FinancialStatementServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java
trunk/lima-swing/src/main/java/org/chorem/lima/service/LimaServiceFactory.java
trunk/lima-swing/src/main/java/org/chorem/lima/service/ServiceMonitorableHandler.java
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
trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/AccountTableCellEditor.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/DateTableCellEditor.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/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/AccountRenderer.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/EntryBookComboBoxModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/EntryBookRenderer.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/EntryBookTypeListModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FinancialPeriodComboBoxModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FinancialPeriodComboBoxRenderer.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FiscalPeriodComboBoxModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FiscalPeriodComboBoxRenderer.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/SubAccountComboBoxModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodTableModel.java
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
trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/HomeViewHandler.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/ImportService.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ImportService.java 2010-07-21 09:58:03 UTC (rev 2978)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ImportService.java 2010-07-21 14:02:18 UTC (rev 2979)
@@ -65,7 +65,7 @@
* import CSV.
* Return result log
*/
- public String importCSV(String path) throws LimaException;
+ public String importAllAsCSV(String path) throws LimaException;
public String importAccountsChartAsCSV(String path) throws LimaException;
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-21 09:58:03 UTC (rev 2978)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/FranceAccountingRules.java 2010-07-21 14:02:18 UTC (rev 2979)
@@ -195,7 +195,7 @@
TopiaQuery query = fiscalPeriodDAO.createQuery();
fiscalPeriodDAO.findAllByQuery(query);
- query.addEquals(FiscalPeriod.LOCKED, Op.EQ, false);
+ query.addWhere(FiscalPeriod.LOCKED, Op.EQ, false);
query.addOrder(FiscalPeriod.END_DATE);
FiscalPeriod oldestUnBlockedFiscalPeriod =
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-07-21 09:58:03 UTC (rev 2978)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialStatementServiceImpl.java 2010-07-21 14:02:18 UTC (rev 2979)
@@ -205,10 +205,7 @@
FinancialStatementDAO financialStatementDAO =
LimaCallaoDAOHelper.getFinancialStatementDAO(transaction);
-
-
-
-
+
TopiaQuery query = financialStatementDAO.createQuery();
query.addEquals("masterFinancialStatement", masterFinancialStatement)
.addOrder(FinancialStatement.LABEL);
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 2010-07-21 09:58:03 UTC (rev 2978)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java 2010-07-21 14:02:18 UTC (rev 2979)
@@ -371,7 +371,7 @@
* Remote methode to call all entities import from UI
*/
@Override
- public String importCSV(String datas) throws LimaException {
+ public String importAllAsCSV(String datas) throws LimaException {
String result = "";
Map<String, AccountImport> accounts = new TreeMap<String, AccountImport>();
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-07-21 09:58:03 UTC (rev 2978)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/service/LimaServiceFactory.java 2010-07-21 14:02:18 UTC (rev 2979)
@@ -100,7 +100,7 @@
}
}
InvocationHandler handler = new ServiceMonitorableHandler(ejbHome);
- M result = (M) Proxy.newProxyInstance(
+ result = (M) Proxy.newProxyInstance(
serviceMonitorableClass.getClassLoader(),
new Class[]{serviceMonitorableClass}, handler);
services.put(serviceMonitorableClass, result);
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/service/ServiceMonitorableHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/service/ServiceMonitorableHandler.java 2010-07-21 09:58:03 UTC (rev 2978)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/service/ServiceMonitorableHandler.java 2010-07-21 14:02:18 UTC (rev 2979)
@@ -51,6 +51,7 @@
Object result = null;
if (method.getName().equals("addListener")){
addServiceListener((ServiceListener) args[0]);
+ log.debug("addListener");
}
else if (method.getName().equals("removeListener")){
removeServiceListener((ServiceListener) args[0]);
@@ -58,10 +59,9 @@
else {
result = method.invoke(service, args);
if (!method.getName().startsWith("get")){
- log.debug("nb listeners : " + listeners.size());
- // previent listeners
+ log.debug(service.toString()+" "+method.getName());
for (ServiceListener serviceListener : listeners) {
- serviceListener.notifyMethod(service.getClass().getSimpleName(), method.getName());
+ serviceListener.notifyMethod(service.toString(), method.getName());
}
}
}
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-21 09:58:03 UTC (rev 2978)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountTreeTableModel.java 2010-07-21 14:02:18 UTC (rev 2979)
@@ -26,7 +26,6 @@
import org.chorem.lima.business.AccountServiceMonitorable;
import org.chorem.lima.business.LimaBusinessException;
import org.chorem.lima.business.LimaException;
-import org.chorem.lima.business.ServiceListener;
import org.chorem.lima.entity.Account;
import org.chorem.lima.entity.AccountImpl;
import org.chorem.lima.service.LimaServiceFactory;
@@ -42,7 +41,7 @@
* Last update : $Date$
* By : $Author$
*/
-public class AccountTreeTableModel extends AbstractTreeTableModel implements ServiceListener {
+public class AccountTreeTableModel extends AbstractTreeTableModel {
/** log. */
private static final Log log = LogFactory.getLog(AccountViewHandler.class);
@@ -262,13 +261,4 @@
accountService.removeAccount(account);
modelSupport.fireChildRemoved(path.getParentPath(), index, account);
}
-
-
- @Override
- public void notifyMethod(String serviceName, String methodName) {
- log.debug("ssalut !");
- // TODO Auto-generated method stub
-
- }
-
}
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-21 09:58:03 UTC (rev 2978)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java 2010-07-21 14:02:18 UTC (rev 2979)
@@ -23,10 +23,11 @@
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.AccountServiceMonitorable;
+import org.chorem.lima.business.ImportServiceMonitorable;
import org.chorem.lima.business.LimaBusinessException;
import org.chorem.lima.business.LimaException;
+import org.chorem.lima.business.ServiceListener;
import org.chorem.lima.entity.Account;
import org.chorem.lima.entity.AccountImpl;
import org.chorem.lima.service.LimaServiceFactory;
@@ -49,14 +50,14 @@
* Last update : $Date$
* By : $Author$
*/
-public class AccountViewHandler {
+public class AccountViewHandler implements ServiceListener {
/** log. */
private static final Log log = LogFactory.getLog(AccountViewHandler.class);
protected AccountView view;
- protected AccountService accountService;
+ protected AccountServiceMonitorable accountService;
protected AccountViewHandler(AccountView view) {
this.view = view;
@@ -64,6 +65,9 @@
accountService =
LimaServiceFactory.getInstance().getService(
AccountServiceMonitorable.class);
+ accountService.addListener(this);
+ LimaServiceFactory.getInstance().getService(
+ ImportServiceMonitorable.class).addListener(this);
}
/**
@@ -249,6 +253,21 @@
}
}
+ public void refresh(){
+ JXTreeTable accountsTreeTable = view.getAccountsTreeTable();
+ AccountTreeTableModel accountsTreeTableModel =
+ (AccountTreeTableModel)accountsTreeTable.getTreeTableModel();
+ try {
+ accountsTreeTableModel.refreshTree();
+ } catch (LimaException eee) {
+ if(log.isDebugEnabled()){
+ log.debug("Can't refresh model", eee);
+ }
+ }
+ //refresh view
+ view.repaint();
+ }
+
public void defaultAccountsChart(MainView mainView){
try {
@@ -275,4 +294,13 @@
}
}
}
+
+ @Override
+ public void notifyMethod(String serviceName, String methodName) {
+
+ if (methodName.contains("importAccounts") || methodName.contains("importAll")){
+ refresh();
+ }
+ }
+
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsViewHandler.java 2010-07-21 09:58:03 UTC (rev 2978)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsViewHandler.java 2010-07-21 14:02:18 UTC (rev 2979)
@@ -48,8 +48,8 @@
tableModel = view.getModelAccountsReportsTable();
tableModel.refresh();
- comboBoxModel = view.getModelAccounts();
- comboBoxModel.refresh();
+ //comboBoxModel = view.getModelAccounts();
+ //comboBoxModel.refresh();
/**
* set text and amounts of labels credit, debit, solde
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-07-21 09:58:03 UTC (rev 2978)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/AccountTableCellEditor.java 2010-07-21 14:02:18 UTC (rev 2979)
@@ -1,4 +1,4 @@
-/**
+/*
* *##% Lima Main
* Copyright (C) 2008 CodeLutin
*
@@ -42,7 +42,7 @@
protected static final Log log = LogFactory.getLog(EntryBookTableCellEditor.class);
private final JWideComboBox comboBox;
- private static final long serialVersionUID = 2580476608066111095L;
+ private static final long serialVersionUID = 1L;
private static AccountTableCellEditor editor;
private static SubAccountComboBoxModel accountComboBoxModel;
private static boolean keyPressed = false;
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/DateTableCellEditor.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/DateTableCellEditor.java 2010-07-21 09:58:03 UTC (rev 2978)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/DateTableCellEditor.java 2010-07-21 14:02:18 UTC (rev 2979)
@@ -1,4 +1,4 @@
-/**
+/*
* *##% Lima Main
* Copyright (C) 2008 CodeLutin
*
@@ -35,7 +35,7 @@
public class DateTableCellEditor extends AbstractCellEditor implements TableCellEditor {
private final JXDatePicker datePicker;
- private static final long serialVersionUID = -8455896587828255307L;
+ private static final long serialVersionUID = 1L;
private static DateTableCellEditor editor;
/**
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-07-21 09:58:03 UTC (rev 2978)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/EntryBookTableCellEditor.java 2010-07-21 14:02:18 UTC (rev 2979)
@@ -1,4 +1,4 @@
-/**
+/*
* *##% Lima Main
* Copyright (C) 2008 CodeLutin
*
@@ -42,7 +42,7 @@
protected static final Log log = LogFactory.getLog(EntryBookTableCellEditor.class);
private final JWideComboBox comboBox;
- private static final long serialVersionUID = 2580476608066111095L;
+ private static final long serialVersionUID = 1L;
private static EntryBookTableCellEditor editor;
private static boolean keyPressed = false;
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-07-21 09:58:03 UTC (rev 2978)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/AccountComboBoxModel.java 2010-07-21 14:02:18 UTC (rev 2979)
@@ -23,9 +23,10 @@
import javax.swing.ComboBoxModel;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.chorem.lima.business.AccountService;
import org.chorem.lima.business.AccountServiceMonitorable;
+import org.chorem.lima.business.ImportServiceMonitorable;
import org.chorem.lima.business.LimaException;
+import org.chorem.lima.business.ServiceListener;
import org.chorem.lima.entity.Account;
import org.chorem.lima.service.LimaServiceFactory;
import org.chorem.lima.ui.financialperiod.FinancialPeriodTableModel;
@@ -34,9 +35,9 @@
* Account combo box model.
*/
-public class AccountComboBoxModel extends AbstractListModel implements ComboBoxModel {
+public class AccountComboBoxModel extends AbstractListModel implements ComboBoxModel, ServiceListener {
- private static final long serialVersionUID = -4513156210596401121L;
+ private static final long serialVersionUID = 1L;
private static final Log log =
LogFactory.getLog(FinancialPeriodTableModel.class);
@@ -45,12 +46,15 @@
protected List<Account> datasCache;
- protected AccountService accountService;
+ protected AccountServiceMonitorable accountService;
public AccountComboBoxModel() {
accountService =
LimaServiceFactory.getInstance().getService(
AccountServiceMonitorable.class);
+ accountService.addListener(this);
+ LimaServiceFactory.getInstance().getService(
+ ImportServiceMonitorable.class).addListener(this);
datasCache = getDataList();
}
@@ -95,5 +99,12 @@
fireContentsChanged(this, 0, datasCache.size());
}
+ @Override
+ public void notifyMethod(String serviceName, String methodeName) {
+ if (serviceName.contains("Account") || methodeName.contains("importAll")){
+ refresh();
+ }
+ }
+
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/AccountRenderer.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/AccountRenderer.java 2010-07-21 09:58:03 UTC (rev 2978)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/AccountRenderer.java 2010-07-21 14:02:18 UTC (rev 2979)
@@ -28,7 +28,7 @@
public class AccountRenderer extends DefaultListCellRenderer {
- private static final long serialVersionUID = -2756100193253351274L;
+ private static final long serialVersionUID = 1L;
@Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
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-07-21 09:58:03 UTC (rev 2978)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/EntryBookComboBoxModel.java 2010-07-21 14:02:18 UTC (rev 2979)
@@ -22,9 +22,10 @@
import javax.swing.DefaultComboBoxModel;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.chorem.lima.business.EntryBookService;
import org.chorem.lima.business.EntryBookServiceMonitorable;
+import org.chorem.lima.business.ImportServiceMonitorable;
import org.chorem.lima.business.LimaException;
+import org.chorem.lima.business.ServiceListener;
import org.chorem.lima.entity.EntryBook;
import org.chorem.lima.service.LimaServiceFactory;
import org.chorem.lima.ui.financialperiod.FinancialPeriodTableModel;
@@ -38,16 +39,16 @@
* Last update : $Date$
* By : $Author$
*/
-public class EntryBookComboBoxModel extends DefaultComboBoxModel {
+public class EntryBookComboBoxModel extends DefaultComboBoxModel implements ServiceListener {
- private static final long serialVersionUID = -2198896334751124051L;
+ private static final long serialVersionUID = 1L;
private static final Log log =
LogFactory.getLog(FinancialPeriodTableModel.class);
protected Object selectedEntryBook;
- protected EntryBookService entryBookService;
+ protected EntryBookServiceMonitorable entryBookService;
protected List<EntryBook> cacheDatas;
@@ -55,6 +56,9 @@
entryBookService =
LimaServiceFactory.getInstance().getService(
EntryBookServiceMonitorable.class);
+ entryBookService.addListener(this);
+ LimaServiceFactory.getInstance().getService(
+ ImportServiceMonitorable.class).addListener(this);
cacheDatas = getDataList();
}
@@ -98,4 +102,11 @@
cacheDatas = getDataList();
fireContentsChanged(this, 0, cacheDatas.size());
}
+
+ @Override
+ public void notifyMethod(String serviceName, String methodeName) {
+ if (serviceName.contains("EntryBook") || methodeName.contains("importAll")){
+ refresh();
+ }
+ }
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/EntryBookRenderer.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/EntryBookRenderer.java 2010-07-21 09:58:03 UTC (rev 2978)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/EntryBookRenderer.java 2010-07-21 14:02:18 UTC (rev 2979)
@@ -12,7 +12,7 @@
public class EntryBookRenderer extends DefaultListCellRenderer {
- private static final long serialVersionUID = 8415102235262629812L;
+ private static final long serialVersionUID = 1L;
@Override
public Component getListCellRendererComponent(JList list,
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/EntryBookTypeListModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/EntryBookTypeListModel.java 2010-07-21 09:58:03 UTC (rev 2978)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/EntryBookTypeListModel.java 2010-07-21 14:02:18 UTC (rev 2979)
@@ -29,7 +29,7 @@
*/
public class EntryBookTypeListModel extends AbstractListModel implements ComboBoxModel {
- private static final long serialVersionUID = 3777447499815020502L;
+ private static final long serialVersionUID = 1L;
protected Object selectedObject;
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FinancialPeriodComboBoxModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FinancialPeriodComboBoxModel.java 2010-07-21 09:58:03 UTC (rev 2978)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FinancialPeriodComboBoxModel.java 2010-07-21 14:02:18 UTC (rev 2979)
@@ -23,9 +23,11 @@
import javax.swing.ComboBoxModel;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.chorem.lima.business.FinancialPeriodService;
import org.chorem.lima.business.FinancialPeriodServiceMonitorable;
+import org.chorem.lima.business.FiscalPeriodServiceMonitorable;
+import org.chorem.lima.business.ImportServiceMonitorable;
import org.chorem.lima.business.LimaException;
+import org.chorem.lima.business.ServiceListener;
import org.chorem.lima.entity.FinancialPeriod;
import org.chorem.lima.entity.FiscalPeriod;
import org.chorem.lima.service.LimaServiceFactory;
@@ -40,9 +42,9 @@
* Last update : $Date$
* By : $Author$
*/
-public class FinancialPeriodComboBoxModel extends AbstractListModel implements ComboBoxModel {
+public class FinancialPeriodComboBoxModel extends AbstractListModel implements ComboBoxModel, ServiceListener {
- private static final long serialVersionUID = 5272891704755358592L;
+ private static final long serialVersionUID = 1L;
private static final Log log =
LogFactory.getLog(FinancialPeriodTableModel.class);
@@ -51,7 +53,7 @@
protected List<FinancialPeriod> datasCache;
- protected FinancialPeriodService financialPeriodService;
+ protected FinancialPeriodServiceMonitorable financialPeriodService;
protected FiscalPeriod selectedFiscalPeriod;
@@ -59,6 +61,11 @@
financialPeriodService =
LimaServiceFactory.getInstance().getService(
FinancialPeriodServiceMonitorable.class);
+ financialPeriodService.addListener(this);
+ LimaServiceFactory.getInstance().getService(
+ FiscalPeriodServiceMonitorable.class).addListener(this);
+ LimaServiceFactory.getInstance().getService(
+ ImportServiceMonitorable.class).addListener(this);
datasCache=getDataList();
}
@@ -110,4 +117,11 @@
datasCache = getDataList();
fireContentsChanged(this, 0, datasCache.size());
}
+
+ @Override
+ public void notifyMethod(String serviceName, String methodeName) {
+ if (serviceName.contains("Period") || methodeName.contains("importAll")){
+ refresh();
+ }
+ }
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FinancialPeriodComboBoxRenderer.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FinancialPeriodComboBoxRenderer.java 2010-07-21 09:58:03 UTC (rev 2978)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FinancialPeriodComboBoxRenderer.java 2010-07-21 14:02:18 UTC (rev 2979)
@@ -28,7 +28,7 @@
public class FinancialPeriodComboBoxRenderer extends DefaultListCellRenderer {
- private static final long serialVersionUID = -6130397429740718196L;
+ private static final long serialVersionUID = 1L;
@Override
public Component getListCellRendererComponent(JList list,
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FiscalPeriodComboBoxModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FiscalPeriodComboBoxModel.java 2010-07-21 09:58:03 UTC (rev 2978)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FiscalPeriodComboBoxModel.java 2010-07-21 14:02:18 UTC (rev 2979)
@@ -19,19 +19,19 @@
package org.chorem.lima.ui.combobox;
import java.util.List;
-
import javax.swing.AbstractListModel;
import javax.swing.ComboBoxModel;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.chorem.lima.business.FiscalPeriodService;
import org.chorem.lima.business.FiscalPeriodServiceMonitorable;
+import org.chorem.lima.business.ImportServiceMonitorable;
import org.chorem.lima.business.LimaException;
+import org.chorem.lima.business.ServiceListener;
import org.chorem.lima.entity.FiscalPeriod;
import org.chorem.lima.service.LimaServiceFactory;
import org.chorem.lima.ui.financialperiod.FinancialPeriodTableModel;
-public class FiscalPeriodComboBoxModel extends AbstractListModel implements ComboBoxModel{
+public class FiscalPeriodComboBoxModel extends AbstractListModel implements ComboBoxModel, ServiceListener{
private static final long serialVersionUID = 1L;
@@ -39,7 +39,7 @@
protected Object selectedFiscalPeriod;
- protected FiscalPeriodService fiscalPeriodService;
+ protected FiscalPeriodServiceMonitorable fiscalPeriodService;
protected List<FiscalPeriod> datasCache;
@@ -48,6 +48,9 @@
fiscalPeriodService =
LimaServiceFactory.getInstance().getService(
FiscalPeriodServiceMonitorable.class);
+ fiscalPeriodService.addListener(this);
+ LimaServiceFactory.getInstance().getService(
+ ImportServiceMonitorable.class).addListener(this);
datasCache = getDataList();
}
@@ -91,4 +94,10 @@
fireContentsChanged(this, 0, datasCache.size());
}
+ @Override
+ public void notifyMethod(String serviceName, String methodeName) {
+ if (serviceName.contains("FiscalPeriod") || methodeName.contains("importAll")){
+ refresh();
+ }
+ }
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FiscalPeriodComboBoxRenderer.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FiscalPeriodComboBoxRenderer.java 2010-07-21 09:58:03 UTC (rev 2978)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FiscalPeriodComboBoxRenderer.java 2010-07-21 14:02:18 UTC (rev 2979)
@@ -27,7 +27,7 @@
public class FiscalPeriodComboBoxRenderer extends DefaultListCellRenderer {
- private static final long serialVersionUID = 7131001128874614788L;
+ private static final long serialVersionUID = 1L;
@Override
public Component getListCellRendererComponent(JList list,
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/SubAccountComboBoxModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/SubAccountComboBoxModel.java 2010-07-21 09:58:03 UTC (rev 2978)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/SubAccountComboBoxModel.java 2010-07-21 14:02:18 UTC (rev 2979)
@@ -20,13 +20,15 @@
import java.util.ArrayList;
import java.util.List;
+import javax.swing.AbstractListModel;
import javax.swing.ComboBoxModel;
import javax.swing.event.ListDataListener;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.chorem.lima.business.AccountService;
import org.chorem.lima.business.AccountServiceMonitorable;
+import org.chorem.lima.business.ImportServiceMonitorable;
import org.chorem.lima.business.LimaException;
+import org.chorem.lima.business.ServiceListener;
import org.chorem.lima.entity.Account;
import org.chorem.lima.service.LimaServiceFactory;
import org.chorem.lima.ui.financialperiod.FinancialPeriodTableModel;
@@ -35,20 +37,28 @@
* Account combo box model.
*/
-public class SubAccountComboBoxModel implements ComboBoxModel {
+public class SubAccountComboBoxModel extends AbstractListModel implements ComboBoxModel, ServiceListener {
- private static final Log log = LogFactory.getLog(FinancialPeriodTableModel.class);
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ private static final Log log = LogFactory.getLog(FinancialPeriodTableModel.class);
protected Object selectedAccount;
protected List<Account> datasCache;
- protected AccountService accountService;
+ protected AccountServiceMonitorable accountService;
public SubAccountComboBoxModel() {
accountService =
LimaServiceFactory.getInstance().getService(
AccountServiceMonitorable.class);
+ accountService.addListener(this);
+ LimaServiceFactory.getInstance().getService(
+ ImportServiceMonitorable.class).addListener(this);
datasCache = getDataList();
}
@@ -97,6 +107,18 @@
return result;
}
+
+ public void refresh(){
+ datasCache = getDataList();
+ fireContentsChanged(this, 0, datasCache.size());
+ }
+ @Override
+ public void notifyMethod(String serviceName, String methodeName) {
+ if (serviceName.contains("Account") || methodeName.contains("importAll")){
+ refresh();
+ }
+ }
+
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookTableModel.java 2010-07-21 09:58:03 UTC (rev 2978)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookTableModel.java 2010-07-21 14:02:18 UTC (rev 2979)
@@ -23,9 +23,10 @@
import javax.swing.table.AbstractTableModel;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.chorem.lima.business.EntryBookService;
import org.chorem.lima.business.EntryBookServiceMonitorable;
+import org.chorem.lima.business.ImportServiceMonitorable;
import org.chorem.lima.business.LimaException;
+import org.chorem.lima.business.ServiceListener;
import org.chorem.lima.entity.EntryBook;
import org.chorem.lima.service.LimaServiceFactory;
@@ -39,7 +40,7 @@
* Last update : $Date$
* By : $Author$
*/
-public class EntryBookTableModel extends AbstractTableModel {
+public class EntryBookTableModel extends AbstractTableModel implements ServiceListener {
/** serialVersionUID. */
private static final long serialVersionUID = 7578692417919755647L;
@@ -48,7 +49,7 @@
private static final Log log = LogFactory.getLog(EntryBookTableModel.class);
/** Services. */
- protected EntryBookService entryBookService;
+ protected EntryBookServiceMonitorable entryBookService;
/**
* Constructor.
@@ -57,6 +58,8 @@
entryBookService =
LimaServiceFactory.getInstance().getService(
EntryBookServiceMonitorable.class);
+ entryBookService.addListener(this);
+ LimaServiceFactory.getInstance().getService(ImportServiceMonitorable.class).addListener(this);
}
@Override
@@ -135,11 +138,6 @@
return false;
}
-
- public void refreshTable(){
- fireTableDataChanged();
- }
-
/**
* @param entryBook
* @throws LimaException
@@ -174,4 +172,13 @@
entryBookService.removeEntryBook(entryBook);
fireTableRowsDeleted(row, row);
}
+
+ @Override
+ public void notifyMethod(String serviceName, String methodName) {
+
+ //refresh on import datas
+ if (methodName.contains("importEntryBooks") || methodName.contains("importAll")){
+ fireTableDataChanged();
+ }
+ }
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsViewHandler.java 2010-07-21 09:58:03 UTC (rev 2978)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsViewHandler.java 2010-07-21 14:02:18 UTC (rev 2979)
@@ -50,8 +50,8 @@
tableModel = view.getModelTable();
tableModel.refresh();
- comboBoxModel = view.getModelEntryBook();
- comboBoxModel.refresh();
+ // comboBoxModel = view.getModelEntryBook();
+ // comboBoxModel.refresh();
/**
* set text and amounts of labels credit, debit, solde
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodTableModel.java 2010-07-21 09:58:03 UTC (rev 2978)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodTableModel.java 2010-07-21 14:02:18 UTC (rev 2979)
@@ -19,16 +19,17 @@
package org.chorem.lima.ui.financialperiod;
import static org.nuiton.i18n.I18n._;
-
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
import javax.swing.table.AbstractTableModel;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.chorem.lima.business.FinancialPeriodService;
import org.chorem.lima.business.FinancialPeriodServiceMonitorable;
+import org.chorem.lima.business.FiscalPeriodServiceMonitorable;
+import org.chorem.lima.business.ImportServiceMonitorable;
import org.chorem.lima.business.LimaException;
+import org.chorem.lima.business.ServiceListener;
import org.chorem.lima.entity.ClosedPeriodicEntryBook;
import org.chorem.lima.entity.EntryBook;
import org.chorem.lima.entity.FinancialPeriod;
@@ -43,7 +44,7 @@
* Last update : $Date: 2010-05-06 11:57:19 +0200 (jeu. 06 mai 2010) $
* By : $Author: jpepin $
*/
-public class FinancialPeriodTableModel extends AbstractTableModel {
+public class FinancialPeriodTableModel extends AbstractTableModel implements ServiceListener {
/** serialVersionUID. */
private static final long serialVersionUID = 77027335135838258L;
@@ -52,7 +53,7 @@
LogFactory.getLog(FinancialPeriodTableModel.class);
/** service */
- protected FinancialPeriodService financialPeriodService;
+ protected FinancialPeriodServiceMonitorable financialPeriodService;
/** Datas cache */
protected List<ClosedPeriodicEntryBook> cacheDataList;
@@ -61,12 +62,16 @@
financialPeriodService =
LimaServiceFactory.getInstance().getService(
FinancialPeriodServiceMonitorable.class);
+ financialPeriodService.addListener(this);
+ LimaServiceFactory.getInstance().getService(
+ ImportServiceMonitorable.class).addListener(this);
+ LimaServiceFactory.getInstance().getService(
+ FiscalPeriodServiceMonitorable.class).addListener(this);
}
@Override
public int getRowCount() {
- //cacheDataList=getDataList();
return cacheDataList.size();
}
@@ -177,4 +182,13 @@
blockClosedPeriodicEntryBook(closedPeriodicEntryBook);
fireTableDataChanged();
}
+
+
+ @Override
+ public void notifyMethod(String serviceName, String methodeName) {
+ if (methodeName.contains("FiscalPeriod") || methodeName.contains("importAll")){
+ getDataList();
+ fireTableDataChanged();
+ }
+ }
}
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 2010-07-21 09:58:03 UTC (rev 2978)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartTreeTableModel.java 2010-07-21 14:02:18 UTC (rev 2979)
@@ -23,10 +23,8 @@
import javax.swing.tree.TreePath;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.chorem.lima.business.FinancialStatementService;
import org.chorem.lima.business.FinancialStatementServiceMonitorable;
import org.chorem.lima.business.LimaException;
-import org.chorem.lima.business.ServiceListener;
import org.chorem.lima.entity.FinancialStatement;
import org.chorem.lima.entity.FinancialStatementImpl;
import org.chorem.lima.service.LimaServiceFactory;
@@ -42,12 +40,12 @@
* Last update : $Date: 2010-06-08 11:55:04 +0200 (mar., 08 juin 2010) $
* By : $Author: jpepin $
*/
-public class FinancialStatementChartTreeTableModel extends AbstractTreeTableModel implements ServiceListener {
+public class FinancialStatementChartTreeTableModel extends AbstractTreeTableModel {
/** log. */
private static final Log log = LogFactory.getLog(FinancialStatementChartViewHandler.class);
- /** Account service. */
+ /** Services. */
protected final FinancialStatementServiceMonitorable financialStatementService;
/**
@@ -60,7 +58,6 @@
financialStatementService =
LimaServiceFactory.getInstance().getService(
FinancialStatementServiceMonitorable.class);
- financialStatementService.addListener(this);
}
@@ -186,7 +183,7 @@
*/
public void refreshTree() throws LimaException {
- modelSupport.fireNewRoot();
+ modelSupport.fireNewRoot();
}
@@ -224,7 +221,6 @@
}
-
/**
* Remove financialStatement
*
@@ -239,20 +235,4 @@
financialStatementService.removeFinancialStatement(financialStatement);
modelSupport.fireChildRemoved(path.getParentPath(), index, financialStatement);
}
-
-
- @Override
- public void notifyMethod(String serviceName, String methodName) {
-
-
- try {
- refreshTree();
- log.debug(serviceName + " " + methodName);
- } catch (LimaException eee) {
- if (log.isDebugEnabled()){
- log.debug("Can't refresh model", eee);
- }
- }
- }
-
}
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 2010-07-21 09:58:03 UTC (rev 2978)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartViewHandler.java 2010-07-21 14:02:18 UTC (rev 2979)
@@ -23,10 +23,11 @@
import javax.swing.tree.TreePath;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.chorem.lima.business.FinancialStatementService;
import org.chorem.lima.business.FinancialStatementServiceMonitorable;
+import org.chorem.lima.business.ImportServiceMonitorable;
import org.chorem.lima.business.LimaBusinessException;
import org.chorem.lima.business.LimaException;
+import org.chorem.lima.business.ServiceListener;
import org.chorem.lima.entity.FinancialStatement;
import org.chorem.lima.entity.FinancialStatementImpl;
import org.chorem.lima.service.LimaServiceFactory;
@@ -48,12 +49,12 @@
* Last update : $Date: 2010-06-08 11:55:04 +0200 (mar., 08 juin 2010) $
* By : $Author: jpepin $
*/
-public class FinancialStatementChartViewHandler {
+public class FinancialStatementChartViewHandler implements ServiceListener {
/** log. */
private static final Log log = LogFactory.getLog(FinancialStatementChartViewHandler.class);
- protected FinancialStatementService financialStatementService;
+ protected FinancialStatementServiceMonitorable financialStatementService;
protected FinancialStatementChartView view;
@@ -63,6 +64,9 @@
financialStatementService =
LimaServiceFactory.getInstance().getService(
FinancialStatementServiceMonitorable.class);
+ financialStatementService.addListener(this);
+ LimaServiceFactory.getInstance().getService(
+ ImportServiceMonitorable.class).addListener(this);
}
/**
@@ -256,9 +260,22 @@
}
}
+ public void refresh(){
+ JXTreeTable treeTable = view.getTreeTable();
+ FinancialStatementChartTreeTableModel treeTableModel =
+ (FinancialStatementChartTreeTableModel) treeTable.getTreeTableModel();
+ try {
+ treeTableModel.refreshTree();
+ } catch (LimaException eee) {
+ if(log.isDebugEnabled()){
+ log.debug("Can't refresh model", eee);
+ }
+ }
+ //refresh view
+ view.repaint();
+ }
public void defaultFinancialStatementChart(MainView mainView){
-
try {
if (financialStatementService.getAllFinancialStatements().size() == 0){
DefaultFinancialStatementChartForm form =
@@ -283,4 +300,12 @@
}
}
+ @Override
+ public void notifyMethod(String serviceName, String methodName) {
+
+ if (methodName.contains("importFinancialStatements") || methodName.contains("importAll")){
+ refresh();
+ }
+ }
+
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodTableModel.java 2010-07-21 09:58:03 UTC (rev 2978)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodTableModel.java 2010-07-21 14:02:18 UTC (rev 2979)
@@ -19,15 +19,15 @@
package org.chorem.lima.ui.fiscalperiod;
import static org.nuiton.i18n.I18n._;
-
import java.text.SimpleDateFormat;
import java.util.List;
import javax.swing.table.AbstractTableModel;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.chorem.lima.business.FiscalPeriodService;
import org.chorem.lima.business.FiscalPeriodServiceMonitorable;
+import org.chorem.lima.business.ImportServiceMonitorable;
import org.chorem.lima.business.LimaException;
+import org.chorem.lima.business.ServiceListener;
import org.chorem.lima.entity.FiscalPeriod;
import org.chorem.lima.service.LimaServiceFactory;
@@ -40,19 +40,22 @@
* Last update : $Date$
* By : $Author$
*/
-public class FiscalPeriodTableModel extends AbstractTableModel {
+public class FiscalPeriodTableModel extends AbstractTableModel implements ServiceListener{
/** serialVersionUID. */
private static final long serialVersionUID = 77027335135838258L;
private static final Log log = LogFactory.getLog(FiscalPeriodTableModel.class);
- protected FiscalPeriodService fiscalPeriodService;
+ protected FiscalPeriodServiceMonitorable fiscalPeriodService;
public FiscalPeriodTableModel() {
fiscalPeriodService =
LimaServiceFactory.getInstance().getService(
FiscalPeriodServiceMonitorable.class);
+ fiscalPeriodService.addListener(this);
+ LimaServiceFactory.getInstance().getService(
+ ImportServiceMonitorable.class).addListener(this);
}
@Override
@@ -166,7 +169,6 @@
return fiscalPeriod;
}
-
/**
* @param period
*/
@@ -189,4 +191,12 @@
fiscalPeriodService.blockFiscalPeriod(fiscalPeriod);
fireTableDataChanged();
}
+
+ @Override
+ public void notifyMethod(String serviceName, String methodeName) {
+ //refresh on import datas
+ if (methodeName.contains("importAll")){
+ fireTableDataChanged();
+ }
+ }
}
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-07-21 09:58:03 UTC (rev 2978)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/HomeViewHandler.java 2010-07-21 14:02:18 UTC (rev 2979)
@@ -14,7 +14,6 @@
import org.chorem.lima.business.FinancialTransactionServiceMonitorable;
import org.chorem.lima.business.FiscalPeriodServiceMonitorable;
import org.chorem.lima.business.LimaException;
-import org.chorem.lima.business.ServiceListener;
import org.chorem.lima.entity.Account;
import org.chorem.lima.entity.EntryBook;
import org.chorem.lima.entity.FinancialTransaction;
@@ -23,7 +22,7 @@
import org.chorem.lima.ui.MainView;
-public class HomeViewHandler implements HyperlinkListener, ServiceListener {
+public class HomeViewHandler implements HyperlinkListener {
private static final Log log = LogFactory.getLog(HomeViewHandler.class);
@@ -224,10 +223,4 @@
log.debug("Can't get datas home", eee);
}
}
-
- @Override
- public void notifyMethod(String serviceName, String methodName) {
- log.debug("salut");
- }
-
}
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 2010-07-21 09:58:03 UTC (rev 2978)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java 2010-07-21 14:02:18 UTC (rev 2979)
@@ -45,7 +45,7 @@
import org.chorem.lima.util.FileChooseView;
import org.jdesktop.swingx.painter.BusyPainter;
-public class ImportExport implements ServiceListener {
+public class ImportExport {
private static ImportExport exchanger;
@@ -125,7 +125,7 @@
break;
case LIMA_ALL_IMPORT:
datas = extractFile(filePath, charset);
- result = importService.importCSV(datas);
+ result = importService.importAllAsCSV(datas);
break;
case LIMA_ACCOUNTCHARTS_IMPORT:
datas = extractFile(filePath, charset);
@@ -248,13 +248,6 @@
return new String(datas);
}
- @Override
- public void notifyMethod(String serviceName, String methodName) {
- log.debug("listener : "+serviceName+" "+methodName);
- // TODO Auto-generated method stub
-
- }
-
public static ImportExport getInstance(Component view) {
if (exchanger == null) {
exchanger = new ImportExport(view);
1
0
r2978 - trunk/lima-swing/src/main/java/org/chorem/lima/service
by bpoussin@users.chorem.org 21 Jul '10
by bpoussin@users.chorem.org 21 Jul '10
21 Jul '10
Author: bpoussin
Date: 2010-07-21 11:58:03 +0200 (Wed, 21 Jul 2010)
New Revision: 2978
Url: http://chorem.org/repositories/revision/lima/2978
Log:
service use lazy loading, and use only one instance by service
Modified:
trunk/lima-swing/src/main/java/org/chorem/lima/service/LimaServiceFactory.java
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-07-20 17:14:24 UTC (rev 2977)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/service/LimaServiceFactory.java 2010-07-21 09:58:03 UTC (rev 2978)
@@ -21,6 +21,7 @@
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Proxy;
import java.util.Properties;
+import java.util.HashMap;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
@@ -42,6 +43,7 @@
/** Single instance. */
protected static LimaServiceFactory instance;
+ protected HashMap<Class, Object> services = new HashMap<Class, Object>();
/** JNDI context used to look for EJB. */
protected static InitialContext ctx;
@@ -86,19 +88,23 @@
}
public <M> M getService(Class<M> serviceMonitorableClass){
- Object ejbHome = null;
- String serviceName = serviceMonitorableClass.getSimpleName().replace("Monitorable", "ImplRemote");
- try {
+ M result = (M)services.get(serviceMonitorableClass);
+ if (result == null) {
+ Object ejbHome = null;
+ String serviceName = serviceMonitorableClass.getSimpleName().replace("Monitorable", "ImplRemote");
+ try {
ejbHome = ctx.lookup(serviceName);
- } catch (NamingException eee) {
- if (log.isErrorEnabled()) {
- log.error("Can't lookup for service : " + serviceName, eee);
+ } catch (NamingException eee) {
+ if (log.isErrorEnabled()) {
+ log.error("Can't lookup for service : " + serviceName, eee);
+ }
}
- }
- InvocationHandler handler = new ServiceMonitorableHandler(ejbHome);
- M result = (M) Proxy.newProxyInstance(
+ InvocationHandler handler = new ServiceMonitorableHandler(ejbHome);
+ M result = (M) Proxy.newProxyInstance(
serviceMonitorableClass.getClassLoader(),
new Class[]{serviceMonitorableClass}, handler);
+ services.put(serviceMonitorableClass, result);
+ }
return result;
}
1
0
Author: jpepin
Date: 2010-07-20 19:14:24 +0200 (Tue, 20 Jul 2010)
New Revision: 2977
Url: http://chorem.org/repositories/revision/lima/2977
Log:
Ajout d'un service listener.
Added:
trunk/lima-business/src/main/java/org/chorem/lima/business/AccountServiceMonitorable.java
trunk/lima-business/src/main/java/org/chorem/lima/business/EntryBookServiceMonitorable.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ExportServiceMonitorable.java
trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialPeriodServiceMonitorable.java
trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialStatementServiceMonitorable.java
trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialTransactionServiceMonitorable.java
trunk/lima-business/src/main/java/org/chorem/lima/business/FiscalPeriodServiceMonitorable.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ImportServiceMonitorable.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ReportServiceMonitorable.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ServiceListener.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ServiceMonitorable.java
trunk/lima-swing/src/main/java/org/chorem/lima/service/ServiceMonitorableHandler.java
Modified:
trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java
trunk/lima-swing/src/main/java/org/chorem/lima/service/LimaServiceFactory.java
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
trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceViewHandler.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/combobox/FinancialPeriodComboBoxModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FiscalPeriodComboBoxModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/SubAccountComboBoxModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodTable.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodTableModel.java
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
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementDocument.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTable.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/AddPeriod.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodTable.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/HomeViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerTableModel.java
trunk/pom.xml
Added: trunk/lima-business/src/main/java/org/chorem/lima/business/AccountServiceMonitorable.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/AccountServiceMonitorable.java (rev 0)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/AccountServiceMonitorable.java 2010-07-20 17:14:24 UTC (rev 2977)
@@ -0,0 +1,5 @@
+package org.chorem.lima.business;
+
+public interface AccountServiceMonitorable extends AccountService, ServiceMonitorable {
+
+}
Added: trunk/lima-business/src/main/java/org/chorem/lima/business/EntryBookServiceMonitorable.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/EntryBookServiceMonitorable.java (rev 0)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/EntryBookServiceMonitorable.java 2010-07-20 17:14:24 UTC (rev 2977)
@@ -0,0 +1,5 @@
+package org.chorem.lima.business;
+
+public interface EntryBookServiceMonitorable extends EntryBookService, ServiceMonitorable {
+
+}
Added: trunk/lima-business/src/main/java/org/chorem/lima/business/ExportServiceMonitorable.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ExportServiceMonitorable.java (rev 0)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ExportServiceMonitorable.java 2010-07-20 17:14:24 UTC (rev 2977)
@@ -0,0 +1,5 @@
+package org.chorem.lima.business;
+
+public interface ExportServiceMonitorable extends ExportService, ServiceMonitorable {
+
+}
Added: trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialPeriodServiceMonitorable.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialPeriodServiceMonitorable.java (rev 0)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialPeriodServiceMonitorable.java 2010-07-20 17:14:24 UTC (rev 2977)
@@ -0,0 +1,5 @@
+package org.chorem.lima.business;
+
+public interface FinancialPeriodServiceMonitorable extends FinancialPeriodService, ServiceMonitorable {
+
+}
Added: trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialStatementServiceMonitorable.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialStatementServiceMonitorable.java (rev 0)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialStatementServiceMonitorable.java 2010-07-20 17:14:24 UTC (rev 2977)
@@ -0,0 +1,5 @@
+package org.chorem.lima.business;
+
+public interface FinancialStatementServiceMonitorable extends FinancialStatementService, ServiceMonitorable {
+
+}
Added: trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialTransactionServiceMonitorable.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialTransactionServiceMonitorable.java (rev 0)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialTransactionServiceMonitorable.java 2010-07-20 17:14:24 UTC (rev 2977)
@@ -0,0 +1,5 @@
+package org.chorem.lima.business;
+
+public interface FinancialTransactionServiceMonitorable extends FinancialTransactionService, ServiceMonitorable {
+
+}
Added: trunk/lima-business/src/main/java/org/chorem/lima/business/FiscalPeriodServiceMonitorable.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/FiscalPeriodServiceMonitorable.java (rev 0)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/FiscalPeriodServiceMonitorable.java 2010-07-20 17:14:24 UTC (rev 2977)
@@ -0,0 +1,5 @@
+package org.chorem.lima.business;
+
+public interface FiscalPeriodServiceMonitorable extends FiscalPeriodService, ServiceMonitorable {
+
+}
Added: trunk/lima-business/src/main/java/org/chorem/lima/business/ImportServiceMonitorable.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ImportServiceMonitorable.java (rev 0)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ImportServiceMonitorable.java 2010-07-20 17:14:24 UTC (rev 2977)
@@ -0,0 +1,5 @@
+package org.chorem.lima.business;
+
+public interface ImportServiceMonitorable extends ImportService, ServiceMonitorable {
+
+}
Added: trunk/lima-business/src/main/java/org/chorem/lima/business/ReportServiceMonitorable.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ReportServiceMonitorable.java (rev 0)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ReportServiceMonitorable.java 2010-07-20 17:14:24 UTC (rev 2977)
@@ -0,0 +1,5 @@
+package org.chorem.lima.business;
+
+public interface ReportServiceMonitorable extends ReportService, ServiceMonitorable {
+
+}
Added: trunk/lima-business/src/main/java/org/chorem/lima/business/ServiceListener.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ServiceListener.java (rev 0)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ServiceListener.java 2010-07-20 17:14:24 UTC (rev 2977)
@@ -0,0 +1,7 @@
+package org.chorem.lima.business;
+
+public interface ServiceListener {
+
+ void notifyMethod(String serviceName, String methodeName);
+
+}
Added: trunk/lima-business/src/main/java/org/chorem/lima/business/ServiceMonitorable.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ServiceMonitorable.java (rev 0)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ServiceMonitorable.java 2010-07-20 17:14:24 UTC (rev 2977)
@@ -0,0 +1,6 @@
+package org.chorem.lima.business;
+
+public interface ServiceMonitorable {
+ public void addListener(ServiceListener l);
+ public void removeListener(ServiceListener l);
+}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java 2010-07-20 10:29:28 UTC (rev 2976)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java 2010-07-20 17:14:24 UTC (rev 2977)
@@ -31,6 +31,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.AccountService;
+import org.chorem.lima.business.AccountServiceMonitorable;
import org.chorem.lima.entity.Account;
import org.chorem.lima.service.LimaServiceFactory;
import org.chorem.lima.ui.MainView;
@@ -174,7 +175,10 @@
// if not, call #loadDefaultAccount()
splash.updateProgression(0.5, _("Loading accounting..."));
- AccountService accountService = LimaServiceFactory.getInstance().getAccountService();
+ //AccountService accountService = LimaServiceFactory.getInstance().getAccountService();
+ AccountService accountService =
+ LimaServiceFactory.getInstance().getService(
+ AccountServiceMonitorable.class);
List<Account> account = accountService.getChildrenAccounts(null);
if (CollectionUtils.isEmpty(account)) {
if (log.isInfoEnabled()) {
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-07-20 10:29:28 UTC (rev 2976)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/service/LimaServiceFactory.java 2010-07-20 17:14:24 UTC (rev 2977)
@@ -18,12 +18,12 @@
package org.chorem.lima.service;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Proxy;
import java.util.Properties;
-
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
-
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.openejb.OpenEJB;
@@ -31,55 +31,9 @@
import org.apache.openejb.assembler.classic.Assembler;
import org.apache.openejb.loader.SystemInstance;
import org.chorem.lima.LimaMain;
-import org.chorem.lima.business.AccountService;
-import org.chorem.lima.business.EntryBookService;
-import org.chorem.lima.business.ExportService;
-import org.chorem.lima.business.FinancialPeriodService;
-import org.chorem.lima.business.FinancialStatementService;
-import org.chorem.lima.business.FiscalPeriodService;
-import org.chorem.lima.business.ImportService;
-import org.chorem.lima.business.RecordService;
-import org.chorem.lima.business.FinancialTransactionService;
-import org.chorem.lima.business.ReportService;
/**
- * Is class is a service factory based on embedded openejb container.
- *
- * More information:
- * <ul>
- * <li>http://openejb.apache.org/embedding-openejb.html</li>
- * </ul>
- *
- * Elle est pour l'instant statique en attendant mieux.
- *
- * Toutes les méthodes utilisent, <ServiceName>ImplLocal comme nom local
- * (convention openejb) c'est donc plus factorisable que le code actuel.
- * Mais il vaudrait mieux essayer en distant pour verifier si
- * la factorisation est similaire.
- *
- * Attention, en mode distant, les jar "javaee-api" et "openejbclient"
- * doivent etre les mêmes (avec une snapshot ca fesait une NPE)
- *
- *
- * <h3>Lookup EJB methods</h3>
- *
- * <ul>
- * <li>first way is :
- * <pre>FooHome ejbHome = (FooHome)new InitialContext().lookup("java:openejb/ejb/my/bean/Foo");</pre></li>
- * <li>second way is (spec compliant)
- * <pre>Object obj = ctx.lookup("my/bean/Foo");
- * FooHome ejbHome = (FooHome)
- * PortableRemoteObject.narrow(obj, FooHome.class);</pre><li>
- *
- * <h3>TODO</h3>
- *
- * <p>All services are hardcoded in local mode for now</p>
- *
- * @author chatellier
- * @version $Revision$
- *
- * Last update : $Date$
- * By : $Author$
+ * This class is a service factory based on embedded openejb container.
*/
public class LimaServiceFactory {
@@ -130,13 +84,31 @@
}
return instance;
}
-
+
+ public <M> M getService(Class<M> serviceMonitorableClass){
+ Object ejbHome = null;
+ String serviceName = serviceMonitorableClass.getSimpleName().replace("Monitorable", "ImplRemote");
+ try {
+ ejbHome = ctx.lookup(serviceName);
+ } catch (NamingException eee) {
+ if (log.isErrorEnabled()) {
+ log.error("Can't lookup for service : " + serviceName, eee);
+ }
+ }
+ InvocationHandler handler = new ServiceMonitorableHandler(ejbHome);
+ M result = (M) Proxy.newProxyInstance(
+ serviceMonitorableClass.getClassLoader(),
+ new Class[]{serviceMonitorableClass}, handler);
+ return result;
+ }
+
+
/**
* Get Account service.
*
* @return account service proxy
*/
- public AccountService getAccountService() {
+ /*public AccountServiceMonitorable getAccountService() {
// TODO EC-20100410 put lookup name in configuration
// name should be fully configurable due to custom implementation used
@@ -149,14 +121,18 @@
log.error("Can't lookup for service : " + lookupName, eee);
}
}
- return ejbHome;
- }
+ InvocationHandler handler = new ServiceMonitorableHandler(ejbHome);
+ AccountServiceMonitorable result = (AccountServiceMonitorable)Proxy.newProxyInstance(
+ AccountServiceMonitorable.class.getClassLoader(),
+ new Class[]{AccountServiceMonitorable.class}, handler);
+ return result;
+ }
/**
* Get FiscalPeriod service.
*
* @return fiscalPeriod service proxy
- */
+ *
public FiscalPeriodService getFiscalPeriodService() {
// TODO EC-20100410 put lookup name in configuration
@@ -177,7 +153,7 @@
* Get FinancialPeriod service.
*
* @return Financial Period service proxy
- */
+ *
public FinancialPeriodService getFinancialPeriodService() {
// TODO EC-20100410 put lookup name in configuration
@@ -198,7 +174,7 @@
* Get transaction service.
*
* @return transaction service proxy
- */
+ *
public FinancialTransactionService getTransactionService() {
// TODO EC-20100410 put lookup name in configuration
@@ -219,7 +195,7 @@
* Get entrybook service.
*
* @return entrybook service proxy
- */
+ *
public EntryBookService getEntryBookService() {
// TODO EC-20100410 put lookup name in configuration
@@ -240,7 +216,7 @@
/**
* Get report service.
*
- */
+ *
public ReportService getReportService() {
// TODO EC-20100410 put lookup name in configuration
@@ -260,7 +236,7 @@
/**
* Get financial statement service.
*
- */
+ *
public FinancialStatementService getFinancialStatementService() {
String lookupName = "FinancialStatementServiceImplRemote";
@@ -278,7 +254,7 @@
/**
* Get import service.
*
- */
+ *
public ImportService getImportService() {
String lookupName = "ImportServiceImplRemote";
@@ -297,7 +273,7 @@
/**
* Get export service.
*
- */
+ *
public ExportService getExportService() {
String lookupName = "ExportServiceImplRemote";
@@ -316,7 +292,7 @@
* Get record service.
*
* @return record service proxy
- */
+ *
public RecordService getRecordService() {
// TODO EC-20100410 put lookup name in configuration
@@ -331,7 +307,7 @@
}
}
return ejbHome;
- }
+ }*/
/**
* Destroy openejb jndi context.
Added: trunk/lima-swing/src/main/java/org/chorem/lima/service/ServiceMonitorableHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/service/ServiceMonitorableHandler.java (rev 0)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/service/ServiceMonitorableHandler.java 2010-07-20 17:14:24 UTC (rev 2977)
@@ -0,0 +1,71 @@
+/* *##% 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.service;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.chorem.lima.business.ServiceListener;
+
+public class ServiceMonitorableHandler implements InvocationHandler {
+
+ private static final Log log = LogFactory.getLog(ServiceMonitorableHandler.class);
+
+ private Object service;
+ private List<ServiceListener> listeners;
+
+ public ServiceMonitorableHandler(Object service){
+ this.service = service;
+ listeners = new ArrayList<ServiceListener>();
+ }
+
+ public void addServiceListener(ServiceListener serviceListener){
+ listeners.add(serviceListener);
+ }
+
+ public void removeServiceListener(ServiceListener serviceListener){
+ listeners.remove(serviceListener);
+ }
+
+ @Override
+ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
+ Object result = null;
+ if (method.getName().equals("addListener")){
+ addServiceListener((ServiceListener) args[0]);
+ }
+ else if (method.getName().equals("removeListener")){
+ removeServiceListener((ServiceListener) args[0]);
+ }
+ else {
+ result = method.invoke(service, args);
+ if (!method.getName().startsWith("get")){
+ log.debug("nb listeners : " + listeners.size());
+ // previent listeners
+ for (ServiceListener serviceListener : listeners) {
+ serviceListener.notifyMethod(service.getClass().getSimpleName(), method.getName());
+ }
+ }
+ }
+ return result;
+ }
+
+}
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-20 10:29:28 UTC (rev 2976)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountTreeTableModel.java 2010-07-20 17:14:24 UTC (rev 2977)
@@ -23,9 +23,10 @@
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.AccountServiceMonitorable;
import org.chorem.lima.business.LimaBusinessException;
import org.chorem.lima.business.LimaException;
+import org.chorem.lima.business.ServiceListener;
import org.chorem.lima.entity.Account;
import org.chorem.lima.entity.AccountImpl;
import org.chorem.lima.service.LimaServiceFactory;
@@ -41,13 +42,13 @@
* Last update : $Date$
* By : $Author$
*/
-public class AccountTreeTableModel extends AbstractTreeTableModel {
+public class AccountTreeTableModel extends AbstractTreeTableModel implements ServiceListener {
/** log. */
private static final Log log = LogFactory.getLog(AccountViewHandler.class);
/** Account service. */
- protected final AccountService accountService;
+ protected final AccountServiceMonitorable accountService;
/**
* Model constructor. Init account service used here.
@@ -56,8 +57,10 @@
// root
super(new AccountImpl());
// Gets factory service
- accountService = LimaServiceFactory.getInstance().getAccountService();
- }
+ accountService =
+ LimaServiceFactory.getInstance().getService(
+ AccountServiceMonitorable.class);
+ }
@Override
@@ -259,5 +262,13 @@
accountService.removeAccount(account);
modelSupport.fireChildRemoved(path.getParentPath(), index, account);
}
+
+
+ @Override
+ public void notifyMethod(String serviceName, String methodName) {
+ log.debug("ssalut !");
+ // TODO Auto-generated method stub
+
+ }
}
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-20 10:29:28 UTC (rev 2976)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java 2010-07-20 17:14:24 UTC (rev 2977)
@@ -24,6 +24,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.AccountService;
+import org.chorem.lima.business.AccountServiceMonitorable;
import org.chorem.lima.business.LimaBusinessException;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.entity.Account;
@@ -60,7 +61,9 @@
protected AccountViewHandler(AccountView view) {
this.view = view;
// Gets factory service
- accountService = LimaServiceFactory.getInstance().getAccountService();
+ accountService =
+ LimaServiceFactory.getInstance().getService(
+ AccountServiceMonitorable.class);
}
/**
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsTableModel.java 2010-07-20 10:29:28 UTC (rev 2976)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsTableModel.java 2010-07-20 17:14:24 UTC (rev 2977)
@@ -28,6 +28,7 @@
import org.chorem.lima.beans.ReportsDatas;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.business.ReportService;
+import org.chorem.lima.business.ReportServiceMonitorable;
import org.chorem.lima.entity.Account;
import org.chorem.lima.entity.Entry;
import org.chorem.lima.service.LimaServiceFactory;
@@ -71,7 +72,9 @@
*/
public AccountsReportsTableModel() {
- reportService = LimaServiceFactory.getInstance().getReportService();
+ reportService =
+ LimaServiceFactory.getInstance().getService(
+ ReportServiceMonitorable.class);
}
@Override
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceTableModel.java 2010-07-20 10:29:28 UTC (rev 2976)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceTableModel.java 2010-07-20 17:14:24 UTC (rev 2977)
@@ -29,6 +29,7 @@
import org.chorem.lima.beans.ReportsDatas;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.business.ReportService;
+import org.chorem.lima.business.ReportServiceMonitorable;
import org.chorem.lima.service.LimaServiceFactory;
import org.chorem.lima.util.ErrorHelper;
@@ -69,8 +70,10 @@
* Constructor.
*/
public BalanceTableModel() {
- reportService = LimaServiceFactory.getInstance().getReportService();
- }
+ reportService =
+ LimaServiceFactory.getInstance().getService(
+ ReportServiceMonitorable.class);
+ }
@Override
public int getRowCount() {
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceViewHandler.java 2010-07-20 10:29:28 UTC (rev 2976)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceViewHandler.java 2010-07-20 17:14:24 UTC (rev 2977)
@@ -21,6 +21,7 @@
import static org.nuiton.i18n.I18n._;
import org.chorem.lima.beans.BalanceTrial;
import org.chorem.lima.business.FinancialTransactionService;
+import org.chorem.lima.business.FinancialTransactionServiceMonitorable;
import org.chorem.lima.service.LimaServiceFactory;
@@ -45,7 +46,8 @@
protected BalanceViewHandler(BalanceView view) {
this.view = view;
financialTransactionService =
- LimaServiceFactory.getInstance().getTransactionService();
+ LimaServiceFactory.getInstance().getService(
+ FinancialTransactionServiceMonitorable.class);
}
public void refresh(){
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-07-20 10:29:28 UTC (rev 2976)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/AccountComboBoxModel.java 2010-07-20 17:14:24 UTC (rev 2977)
@@ -24,6 +24,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.AccountService;
+import org.chorem.lima.business.AccountServiceMonitorable;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.entity.Account;
import org.chorem.lima.service.LimaServiceFactory;
@@ -47,7 +48,9 @@
protected AccountService accountService;
public AccountComboBoxModel() {
- accountService = LimaServiceFactory.getInstance().getAccountService();
+ accountService =
+ LimaServiceFactory.getInstance().getService(
+ AccountServiceMonitorable.class);
datasCache = getDataList();
}
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-07-20 10:29:28 UTC (rev 2976)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/EntryBookComboBoxModel.java 2010-07-20 17:14:24 UTC (rev 2977)
@@ -23,6 +23,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.EntryBookService;
+import org.chorem.lima.business.EntryBookServiceMonitorable;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.entity.EntryBook;
import org.chorem.lima.service.LimaServiceFactory;
@@ -52,7 +53,8 @@
public EntryBookComboBoxModel() {
entryBookService =
- LimaServiceFactory.getInstance().getEntryBookService();
+ LimaServiceFactory.getInstance().getService(
+ EntryBookServiceMonitorable.class);
cacheDatas = getDataList();
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FinancialPeriodComboBoxModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FinancialPeriodComboBoxModel.java 2010-07-20 10:29:28 UTC (rev 2976)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FinancialPeriodComboBoxModel.java 2010-07-20 17:14:24 UTC (rev 2977)
@@ -24,6 +24,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.FinancialPeriodService;
+import org.chorem.lima.business.FinancialPeriodServiceMonitorable;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.entity.FinancialPeriod;
import org.chorem.lima.entity.FiscalPeriod;
@@ -56,7 +57,8 @@
public FinancialPeriodComboBoxModel() {
financialPeriodService =
- LimaServiceFactory.getInstance().getFinancialPeriodService();
+ LimaServiceFactory.getInstance().getService(
+ FinancialPeriodServiceMonitorable.class);
datasCache=getDataList();
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FiscalPeriodComboBoxModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FiscalPeriodComboBoxModel.java 2010-07-20 10:29:28 UTC (rev 2976)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FiscalPeriodComboBoxModel.java 2010-07-20 17:14:24 UTC (rev 2977)
@@ -25,6 +25,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.FiscalPeriodService;
+import org.chorem.lima.business.FiscalPeriodServiceMonitorable;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.entity.FiscalPeriod;
import org.chorem.lima.service.LimaServiceFactory;
@@ -44,8 +45,10 @@
public FiscalPeriodComboBoxModel(){
- fiscalPeriodService = LimaServiceFactory.getInstance().getFiscalPeriodService();
- datasCache = getDataList();
+ fiscalPeriodService =
+ LimaServiceFactory.getInstance().getService(
+ FiscalPeriodServiceMonitorable.class);
+ datasCache = getDataList();
}
@Override
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/SubAccountComboBoxModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/SubAccountComboBoxModel.java 2010-07-20 10:29:28 UTC (rev 2976)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/SubAccountComboBoxModel.java 2010-07-20 17:14:24 UTC (rev 2977)
@@ -25,6 +25,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.AccountService;
+import org.chorem.lima.business.AccountServiceMonitorable;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.entity.Account;
import org.chorem.lima.service.LimaServiceFactory;
@@ -45,7 +46,9 @@
protected AccountService accountService;
public SubAccountComboBoxModel() {
- accountService = LimaServiceFactory.getInstance().getAccountService();
+ accountService =
+ LimaServiceFactory.getInstance().getService(
+ AccountServiceMonitorable.class);
datasCache = getDataList();
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookTableModel.java 2010-07-20 10:29:28 UTC (rev 2976)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookTableModel.java 2010-07-20 17:14:24 UTC (rev 2977)
@@ -24,6 +24,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.EntryBookService;
+import org.chorem.lima.business.EntryBookServiceMonitorable;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.entity.EntryBook;
import org.chorem.lima.service.LimaServiceFactory;
@@ -53,8 +54,10 @@
* Constructor.
*/
public EntryBookTableModel() {
- entryBookService = LimaServiceFactory.getInstance().getEntryBookService();
- }
+ entryBookService =
+ LimaServiceFactory.getInstance().getService(
+ EntryBookServiceMonitorable.class);
+ }
@Override
public int getRowCount() {
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookViewHandler.java 2010-07-20 10:29:28 UTC (rev 2976)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookViewHandler.java 2010-07-20 17:14:24 UTC (rev 2977)
@@ -23,6 +23,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.EntryBookService;
+import org.chorem.lima.business.EntryBookServiceMonitorable;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.entity.EntryBook;
import org.chorem.lima.entity.EntryBookImpl;
@@ -52,8 +53,10 @@
public EntryBookViewHandler(EntryBookView view) {
this.view = view;
- entryBookService = LimaServiceFactory.getInstance().getEntryBookService();
- }
+ entryBookService =
+ LimaServiceFactory.getInstance().getService(
+ EntryBookServiceMonitorable.class);
+ }
public void addEntryBook() {
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsTableModel.java 2010-07-20 10:29:28 UTC (rev 2976)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsTableModel.java 2010-07-20 17:14:24 UTC (rev 2977)
@@ -29,6 +29,7 @@
import org.chorem.lima.beans.ReportsDatasImpl;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.business.ReportService;
+import org.chorem.lima.business.ReportServiceMonitorable;
import org.chorem.lima.entity.Entry;
import org.chorem.lima.entity.EntryBook;
import org.chorem.lima.service.LimaServiceFactory;
@@ -72,7 +73,8 @@
*/
public EntryBooksReportsTableModel() {
reportService =
- LimaServiceFactory.getInstance().getReportService();
+ LimaServiceFactory.getInstance().getService(
+ ReportServiceMonitorable.class);
}
@Override
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodTable.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodTable.java 2010-07-20 10:29:28 UTC (rev 2976)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodTable.java 2010-07-20 17:14:24 UTC (rev 2977)
@@ -25,6 +25,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.FinancialPeriodService;
+import org.chorem.lima.business.FinancialPeriodServiceMonitorable;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.entity.ClosedPeriodicEntryBook;
import org.chorem.lima.entity.ClosedPeriodicEntryBookImpl;
@@ -58,7 +59,8 @@
this.handler = handler;
model = this.handler.getView().modelFinancialPeriodTable;
financialPeriodService =
- LimaServiceFactory.getInstance().getFinancialPeriodService();
+ LimaServiceFactory.getInstance().getService(
+ FinancialPeriodServiceMonitorable.class);
//highlight financial financial transactions
addMonthColor();
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodTableModel.java 2010-07-20 10:29:28 UTC (rev 2976)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodTableModel.java 2010-07-20 17:14:24 UTC (rev 2977)
@@ -27,6 +27,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.FinancialPeriodService;
+import org.chorem.lima.business.FinancialPeriodServiceMonitorable;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.entity.ClosedPeriodicEntryBook;
import org.chorem.lima.entity.EntryBook;
@@ -58,7 +59,8 @@
public FinancialPeriodTableModel() {
financialPeriodService =
- LimaServiceFactory.getInstance().getFinancialPeriodService();
+ LimaServiceFactory.getInstance().getService(
+ FinancialPeriodServiceMonitorable.class);
}
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 2010-07-20 10:29:28 UTC (rev 2976)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartTreeTableModel.java 2010-07-20 17:14:24 UTC (rev 2977)
@@ -24,7 +24,9 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.FinancialStatementService;
+import org.chorem.lima.business.FinancialStatementServiceMonitorable;
import org.chorem.lima.business.LimaException;
+import org.chorem.lima.business.ServiceListener;
import org.chorem.lima.entity.FinancialStatement;
import org.chorem.lima.entity.FinancialStatementImpl;
import org.chorem.lima.service.LimaServiceFactory;
@@ -40,13 +42,13 @@
* Last update : $Date: 2010-06-08 11:55:04 +0200 (mar., 08 juin 2010) $
* By : $Author: jpepin $
*/
-public class FinancialStatementChartTreeTableModel extends AbstractTreeTableModel {
+public class FinancialStatementChartTreeTableModel extends AbstractTreeTableModel implements ServiceListener {
/** log. */
private static final Log log = LogFactory.getLog(FinancialStatementChartViewHandler.class);
/** Account service. */
- protected final FinancialStatementService financialStatementService;
+ protected final FinancialStatementServiceMonitorable financialStatementService;
/**
* Model constructor. Init account service used here.
@@ -55,8 +57,11 @@
//create root for the tree
super(new FinancialStatementImpl());
// Gets factory service
- financialStatementService = LimaServiceFactory.getInstance().getFinancialStatementService();
- }
+ financialStatementService =
+ LimaServiceFactory.getInstance().getService(
+ FinancialStatementServiceMonitorable.class);
+ financialStatementService.addListener(this);
+ }
@Override
@@ -234,5 +239,20 @@
financialStatementService.removeFinancialStatement(financialStatement);
modelSupport.fireChildRemoved(path.getParentPath(), index, financialStatement);
}
+
+
+ @Override
+ public void notifyMethod(String serviceName, String methodName) {
+
+
+ try {
+ refreshTree();
+ log.debug(serviceName + " " + methodName);
+ } catch (LimaException eee) {
+ if (log.isDebugEnabled()){
+ log.debug("Can't refresh model", eee);
+ }
+ }
+ }
}
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 2010-07-20 10:29:28 UTC (rev 2976)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartViewHandler.java 2010-07-20 17:14:24 UTC (rev 2977)
@@ -24,6 +24,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.FinancialStatementService;
+import org.chorem.lima.business.FinancialStatementServiceMonitorable;
import org.chorem.lima.business.LimaBusinessException;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.entity.FinancialStatement;
@@ -58,7 +59,10 @@
protected FinancialStatementChartViewHandler(FinancialStatementChartView view) {
this.view = view;
- financialStatementService = LimaServiceFactory.getInstance().getFinancialStatementService();
+
+ financialStatementService =
+ LimaServiceFactory.getInstance().getService(
+ FinancialStatementServiceMonitorable.class);
}
/**
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementDocument.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementDocument.java 2010-07-20 10:29:28 UTC (rev 2976)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementDocument.java 2010-07-20 17:14:24 UTC (rev 2977)
@@ -73,12 +73,12 @@
first=false;
}
else{
- listList.add(financialStatementAmounts.subList(min, i-1));
+ listList.add(financialStatementAmounts.subList(min+1, i-1));
}
min=i;
}
}
- listList.add(financialStatementAmounts.subList(min, size));
+ listList.add(financialStatementAmounts.subList(min+1, size));
//create pages
for (List<FinancialStatementAmounts> list : listList) {
@@ -230,14 +230,20 @@
else {
//cell1
String tab = "";
- for (int i = 0; i <= level; i++) {
+ for (int i = 0; i < level; i++) {
tab += "\t";
}
- Phrase phrase = new Phrase(tab+label, tabFont);
+ Phrase phrase = null;
+ if (financialStatementAmount.getHeader()){
+ phrase = new Phrase(tab+label, headerFont);
+ }
+ else {
+ phrase = new Phrase(tab+label, tabFont);
+ }
t.addCell(phrase);
//cell2
if (grossAmount != 0.0){
- phrase = new Phrase(String.valueOf(grossAmount), tabFont);
+ phrase = new Phrase(String.valueOf(grossAmount), tabFont);
}
else {
phrase = new Phrase("");
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTable.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTable.java 2010-07-20 10:29:28 UTC (rev 2976)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTable.java 2010-07-20 17:14:24 UTC (rev 2977)
@@ -21,8 +21,6 @@
import java.awt.Color;
import java.awt.Component;
import org.chorem.lima.beans.FinancialStatementAmounts;
-import org.chorem.lima.business.FinancialPeriodService;
-import org.chorem.lima.service.LimaServiceFactory;
import org.jdesktop.swingx.JXTable;
import org.jdesktop.swingx.decorator.ColorHighlighter;
import org.jdesktop.swingx.decorator.ComponentAdapter;
@@ -37,9 +35,7 @@
protected FinancialStatementReportViewHandler handler;
protected FinancialStatementReportTableModel model;
-
- protected FinancialPeriodService financialPeriodService;
-
+
private Highlighter colorTransaction;
/*
@@ -49,8 +45,6 @@
super(handler.getView().modelTable);
this.handler = handler;
model = this.handler.getView().modelTable;
- financialPeriodService =
- LimaServiceFactory.getInstance().getFinancialPeriodService();
//highlight financial financial transactions
colorTitle1();
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableModel.java 2010-07-20 10:29:28 UTC (rev 2976)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableModel.java 2010-07-20 17:14:24 UTC (rev 2977)
@@ -27,6 +27,7 @@
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.beans.FinancialStatementAmounts;
import org.chorem.lima.business.FinancialStatementService;
+import org.chorem.lima.business.FinancialStatementServiceMonitorable;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.service.LimaServiceFactory;
import org.chorem.lima.util.ErrorHelper;
@@ -65,7 +66,9 @@
* Constructor.
*/
public FinancialStatementReportTableModel() {
- financialStatementService = LimaServiceFactory.getInstance().getFinancialStatementService();
+ financialStatementService =
+ LimaServiceFactory.getInstance().getService(
+ FinancialStatementServiceMonitorable.class);
}
@Override
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportViewHandler.java 2010-07-20 10:29:28 UTC (rev 2976)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportViewHandler.java 2010-07-20 17:14:24 UTC (rev 2977)
@@ -18,8 +18,6 @@
package org.chorem.lima.ui.financialstatementreport;
-import org.chorem.lima.business.FinancialTransactionService;
-import org.chorem.lima.service.LimaServiceFactory;
/**
@@ -35,15 +33,10 @@
protected FinancialStatementReportView view;
- /** service **/
- protected FinancialTransactionService financialTransactionService;
-
protected FinancialStatementReportTableModel model;
protected FinancialStatementReportViewHandler(FinancialStatementReportView view) {
this.view = view;
- financialTransactionService =
- LimaServiceFactory.getInstance().getTransactionService();
}
public void refresh(){
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTableModel.java 2010-07-20 10:29:28 UTC (rev 2976)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTableModel.java 2010-07-20 17:14:24 UTC (rev 2977)
@@ -30,7 +30,10 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.EntryBookService;
+import org.chorem.lima.business.EntryBookServiceMonitorable;
import org.chorem.lima.business.FinancialPeriodService;
+import org.chorem.lima.business.FinancialPeriodServiceMonitorable;
+import org.chorem.lima.business.FinancialTransactionServiceMonitorable;
import org.chorem.lima.business.LimaBusinessException;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.business.FinancialTransactionService;
@@ -94,12 +97,15 @@
*/
public FinancialTransactionTableModel() {
/* Services */
- financialTransactionService = LimaServiceFactory.getInstance()
- .getTransactionService();
- entryBookService = LimaServiceFactory.getInstance().
- getEntryBookService();
- financialPeriodService = LimaServiceFactory.getInstance().
- getFinancialPeriodService();
+ financialTransactionService =
+ LimaServiceFactory.getInstance().getService(
+ FinancialTransactionServiceMonitorable.class);
+ entryBookService =
+ LimaServiceFactory.getInstance().getService(
+ EntryBookServiceMonitorable.class);
+ financialPeriodService =
+ LimaServiceFactory.getInstance().getService(
+ FinancialPeriodServiceMonitorable.class);
}
/**
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTableModel.java 2010-07-20 10:29:28 UTC (rev 2976)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTableModel.java 2010-07-20 17:14:24 UTC (rev 2977)
@@ -26,6 +26,7 @@
import javax.swing.table.AbstractTableModel;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.chorem.lima.business.FinancialTransactionServiceMonitorable;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.business.FinancialTransactionService;
import org.chorem.lima.business.utils.EntryComparator;
@@ -80,7 +81,9 @@
*/
public FinancialTransactionUnbalancedTableModel() {
/* Services */
- financialTransactionService = LimaServiceFactory.getInstance().getTransactionService();
+ financialTransactionService =
+ LimaServiceFactory.getInstance().getService(
+ FinancialTransactionServiceMonitorable.class);
}
/**
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/AddPeriod.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/AddPeriod.jaxx 2010-07-20 10:29:28 UTC (rev 2976)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/AddPeriod.jaxx 2010-07-20 17:14:24 UTC (rev 2977)
@@ -20,13 +20,16 @@
<![CDATA[
import org.chorem.lima.entity.FiscalPeriod;
import org.chorem.lima.business.FiscalPeriodService;
+ import org.chorem.lima.business.FiscalPeriodServiceMonitorable;
import org.chorem.lima.service.LimaServiceFactory;
import org.chorem.lima.business.LimaException;
import org.apache.commons.lang.time.DateUtils;
import org.chorem.lima.entity.FiscalPeriodImpl;
- protected FiscalPeriodService fiscalPeriodService = LimaServiceFactory.getInstance().getFiscalPeriodService();
-
+ protected FiscalPeriodService fiscalPeriodService =
+ LimaServiceFactory.getInstance().getService(
+ FiscalPeriodServiceMonitorable.class);
+
// set begin date picker
Date endDate = null;
Calendar calendarBegin = Calendar.getInstance();
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodTable.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodTable.java 2010-07-20 10:29:28 UTC (rev 2976)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodTable.java 2010-07-20 17:14:24 UTC (rev 2977)
@@ -20,15 +20,12 @@
import java.awt.Color;
import java.awt.Component;
-import org.chorem.lima.business.FiscalPeriodService;
import org.chorem.lima.entity.FiscalPeriod;
-import org.chorem.lima.service.LimaServiceFactory;
import org.jdesktop.swingx.JXTable;
import org.jdesktop.swingx.decorator.ColorHighlighter;
import org.jdesktop.swingx.decorator.ComponentAdapter;
import org.jdesktop.swingx.decorator.HighlightPredicate;
import org.jdesktop.swingx.decorator.Highlighter;
-import org.jdesktop.swingx.decorator.HighlighterFactory;
public class FiscalPeriodTable extends JXTable {
@@ -37,17 +34,14 @@
protected FiscalPeriodViewHandler handler;
protected FiscalPeriodTableModel model;
-
- protected FiscalPeriodService financialPeriodService;
-
+
private Highlighter colorTransaction;
public FiscalPeriodTable(FiscalPeriodViewHandler handler) {
this.handler = handler;
model = this.handler.getView().getModelFiscalPeriodTable();
- financialPeriodService = LimaServiceFactory.getInstance().getFiscalPeriodService();
- addHighlighter(HighlighterFactory.createSimpleStriping(new java.awt.Color(222,222,222)));
+
//highlight financial financial transactions
addBlockColor();
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodTableModel.java 2010-07-20 10:29:28 UTC (rev 2976)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodTableModel.java 2010-07-20 17:14:24 UTC (rev 2977)
@@ -26,6 +26,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.FiscalPeriodService;
+import org.chorem.lima.business.FiscalPeriodServiceMonitorable;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.entity.FiscalPeriod;
import org.chorem.lima.service.LimaServiceFactory;
@@ -49,8 +50,10 @@
protected FiscalPeriodService fiscalPeriodService;
public FiscalPeriodTableModel() {
- fiscalPeriodService = LimaServiceFactory.getInstance().getFiscalPeriodService();
- }
+ fiscalPeriodService =
+ LimaServiceFactory.getInstance().getService(
+ FiscalPeriodServiceMonitorable.class);
+ }
@Override
public int getRowCount() {
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-07-20 10:29:28 UTC (rev 2976)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/HomeViewHandler.java 2010-07-20 17:14:24 UTC (rev 2977)
@@ -6,15 +6,15 @@
import javax.swing.JEditorPane;
import javax.swing.event.HyperlinkEvent;
import javax.swing.event.HyperlinkListener;
-
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;
-import org.chorem.lima.business.FiscalPeriodService;
+import org.chorem.lima.business.AccountServiceMonitorable;
+import org.chorem.lima.business.EntryBookServiceMonitorable;
+import org.chorem.lima.business.FinancialTransactionServiceMonitorable;
+import org.chorem.lima.business.FiscalPeriodServiceMonitorable;
import org.chorem.lima.business.LimaException;
+import org.chorem.lima.business.ServiceListener;
import org.chorem.lima.entity.Account;
import org.chorem.lima.entity.EntryBook;
import org.chorem.lima.entity.FinancialTransaction;
@@ -23,17 +23,17 @@
import org.chorem.lima.ui.MainView;
-public class HomeViewHandler implements HyperlinkListener {
+public class HomeViewHandler implements HyperlinkListener, ServiceListener {
private static final Log log = LogFactory.getLog(HomeViewHandler.class);
protected HomeView view;
/* Services */
- protected AccountService accountService;
- protected EntryBookService entryBookService;
- protected FinancialTransactionService financialTransactionService;
- protected FiscalPeriodService fiscalPeriodService;
+ protected AccountServiceMonitorable accountService;
+ protected EntryBookServiceMonitorable entryBookService;
+ protected FinancialTransactionServiceMonitorable financialTransactionService;
+ protected FiscalPeriodServiceMonitorable fiscalPeriodService;
/* Editorpane*/
protected JEditorPane accountPane;
@@ -47,13 +47,13 @@
this.view=view;
accountService =
- LimaServiceFactory.getInstance().getAccountService();
+ LimaServiceFactory.getInstance().getService(AccountServiceMonitorable.class);
entryBookService =
- LimaServiceFactory.getInstance().getEntryBookService();
+ LimaServiceFactory.getInstance().getService(EntryBookServiceMonitorable.class);
financialTransactionService =
- LimaServiceFactory.getInstance().getTransactionService();
+ LimaServiceFactory.getInstance().getService(FinancialTransactionServiceMonitorable.class);
fiscalPeriodService =
- LimaServiceFactory.getInstance().getFiscalPeriodService();
+ LimaServiceFactory.getInstance().getService(FiscalPeriodServiceMonitorable.class);
}
@@ -224,5 +224,10 @@
log.debug("Can't get datas home", eee);
}
}
+
+ @Override
+ public void notifyMethod(String serviceName, String methodName) {
+ log.debug("salut");
+ }
}
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 2010-07-20 10:29:28 UTC (rev 2976)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java 2010-07-20 17:14:24 UTC (rev 2977)
@@ -35,16 +35,17 @@
import javax.swing.SwingWorker;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.chorem.lima.business.ExportService;
-import org.chorem.lima.business.ImportService;
+import org.chorem.lima.business.ExportServiceMonitorable;
+import org.chorem.lima.business.ImportServiceMonitorable;
import org.chorem.lima.business.LimaException;
+import org.chorem.lima.business.ServiceListener;
import org.chorem.lima.service.LimaServiceFactory;
import org.chorem.lima.ui.account.AccountViewHandler;
import org.chorem.lima.util.DialogHelper;
import org.chorem.lima.util.FileChooseView;
import org.jdesktop.swingx.painter.BusyPainter;
-public class ImportExport {
+public class ImportExport implements ServiceListener {
private static ImportExport exchanger;
@@ -52,16 +53,23 @@
protected static Component viewComponent;
- protected ImportService importService;
+ protected ImportServiceMonitorable importService;
- protected ExportService exportService;
+ protected ExportServiceMonitorable exportService;
private ImportExportWaitView waitView;
public ImportExport(Component view) {
viewComponent=view;
- importService = LimaServiceFactory.getInstance().getImportService();
- exportService = LimaServiceFactory.getInstance().getExportService();
+
+ //services
+ importService =
+ LimaServiceFactory.getInstance().getService(
+ ImportServiceMonitorable.class);
+ exportService =
+ LimaServiceFactory.getInstance().getService(
+ ExportServiceMonitorable.class);
+
//create the wait dialog panel
waitView = new ImportExportWaitView();
waitView.waitDialog.setSize(400, 200);
@@ -240,6 +248,12 @@
return new String(datas);
}
+ @Override
+ public void notifyMethod(String serviceName, String methodName) {
+ log.debug("listener : "+serviceName+" "+methodName);
+ // TODO Auto-generated method stub
+
+ }
public static ImportExport getInstance(Component view) {
if (exchanger == null) {
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerTableModel.java 2010-07-20 10:29:28 UTC (rev 2976)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerTableModel.java 2010-07-20 17:14:24 UTC (rev 2977)
@@ -32,6 +32,7 @@
import org.chorem.lima.beans.ReportsDatas;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.business.ReportService;
+import org.chorem.lima.business.ReportServiceMonitorable;
import org.chorem.lima.business.utils.EntryComparator;
import org.chorem.lima.entity.Entry;
import org.chorem.lima.entity.EntryBook;
@@ -77,7 +78,8 @@
*/
public LedgerTableModel() {
reportService =
- LimaServiceFactory.getInstance().getReportService();
+ LimaServiceFactory.getInstance().getService(
+ ReportServiceMonitorable.class);
}
@Override
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-07-20 10:29:28 UTC (rev 2976)
+++ trunk/pom.xml 2010-07-20 17:14:24 UTC (rev 2977)
@@ -165,6 +165,14 @@
<scope>compile</scope>
</dependency>
+ <!-- itext pdf to create document -->
+
+ <dependency>
+ <groupId>com.lowagie</groupId>
+ <artifactId>itext</artifactId>
+ <version>2.1.7</version>
+ </dependency>
+
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
1
0
r2976 - trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport
by jpepin@users.chorem.org 20 Jul '10
by jpepin@users.chorem.org 20 Jul '10
20 Jul '10
Author: jpepin
Date: 2010-07-20 12:29:28 +0200 (Tue, 20 Jul 2010)
New Revision: 2976
Url: http://chorem.org/repositories/revision/lima/2976
Log:
Cr?\195?\169ation document PDF et HTML pour le bilan et compte de r?\195?\169sultat.
Added:
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementDocument.java
Modified:
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTable.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportViewHandler.java
Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementDocument.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementDocument.java (rev 0)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementDocument.java 2010-07-20 10:29:28 UTC (rev 2976)
@@ -0,0 +1,317 @@
+/*
+ * *##% Lima Main
+ * 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 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.
+ *
+ * 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>. ##%*
+ */
+
+package org.chorem.lima.ui.financialstatementreport;
+
+import static org.nuiton.i18n.I18n._;
+import java.awt.Color;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.chorem.lima.beans.FinancialStatementAmounts;
+import com.lowagie.text.BadElementException;
+import com.lowagie.text.Cell;
+import com.lowagie.text.Chapter;
+import com.lowagie.text.Document;
+import com.lowagie.text.DocumentException;
+import com.lowagie.text.Element;
+import com.lowagie.text.Font;
+import com.lowagie.text.PageSize;
+import com.lowagie.text.Paragraph;
+import com.lowagie.text.Phrase;
+import com.lowagie.text.Rectangle;
+import com.lowagie.text.Table;
+import com.lowagie.text.html.HtmlWriter;
+import com.lowagie.text.pdf.PdfWriter;
+
+public class FinancialStatementDocument {
+
+ private static final Log log =
+ LogFactory.getLog(FinancialStatementReportTable.class);
+
+ public void createDocuments(List<FinancialStatementAmounts> financialStatementAmounts) {
+ Document document = new Document(PageSize.A4, 5, 5, 5, 5);
+
+ try {
+
+ PdfWriter pdfWriter = PdfWriter.getInstance(document,
+ new FileOutputStream("/test_lima.pdf"));
+ HtmlWriter htmlWriter = HtmlWriter.getInstance(document,
+ new FileOutputStream("/test_lima.html"));
+ Font numpageFont = new Font(Font.HELVETICA, 9, Font.BOLD, Color.BLACK);
+ document.open();
+ int nbpages = 1;
+
+
+ //Split list by financialstatement type
+ List<List<FinancialStatementAmounts>> listList = new ArrayList<List<FinancialStatementAmounts>>();
+ Boolean first = true;
+ int min=0;
+ int size = financialStatementAmounts.size();
+ for (int i=0;i<size;i++) {
+ if (financialStatementAmounts.get(i).getLevel()==1){
+ if (first){
+ first=false;
+ }
+ else{
+ listList.add(financialStatementAmounts.subList(min, i-1));
+ }
+ min=i;
+ }
+ }
+ listList.add(financialStatementAmounts.subList(min, size));
+
+ //create pages
+ for (List<FinancialStatementAmounts> list : listList) {
+ String title = list.get(0).getLabel();
+ int i=0;
+ int n=list.size();
+ while (i<n){
+ int j=i+40;
+ if (j>n){
+ j = n;
+ }
+ List <FinancialStatementAmounts> subFinancialStatementAmounts =
+ list.subList(i, j);
+ //create page : header + table + footer
+ Table header = createHeader(title, "01/01/2010", "31/12/2010");
+ Table table = createTable(subFinancialStatementAmounts);
+ //new page
+ Chapter chapter = new Chapter(0);
+ //n° page
+ Paragraph paragraphPage = new Paragraph();
+ paragraphPage.setAlignment(Element.ALIGN_RIGHT);
+ paragraphPage.add(new Phrase("Page n° "+nbpages, numpageFont));
+ chapter.add(paragraphPage);
+ //header
+ Paragraph paragraphHeader = new Paragraph();
+ paragraphHeader.add(header);
+ chapter.add(paragraphHeader);
+ //table
+ Paragraph paragraphTable = new Paragraph();
+ paragraphTable.add(table);
+ chapter.add(paragraphTable);
+ //add page
+ document.add(chapter);
+ i=i+40;
+ nbpages++;
+ }
+ }
+
+ document.close();
+
+ } catch (FileNotFoundException eeFNFE) {
+ log.error("Can't create pdf file", eeFNFE);
+ } catch (DocumentException eeDE) {
+ log.error("Can't create document", eeDE);
+ }
+ }
+
+ public Table createHeader(String title, String beginDate, String endDate){
+ Table t = null;
+ try {
+ //define table
+ t = new Table(4, 5);
+ float[] widths = {0.25f, 0.45f, 0.12f, 0.18f};
+ t.setWidths(widths);
+ t.setPadding(3);
+ //define font
+ Font headerFont = new Font(Font.HELVETICA, 9, Font.ITALIC, Color.BLACK);
+ Font headerFontB = new Font(Font.HELVETICA, 9, Font.BOLDITALIC, Color.BLACK);
+ //defaut cell
+ Cell cell = new Cell();
+ cell.setBorder(Rectangle.NO_BORDER);
+ t.setDefaultCell(cell);
+
+ //line 1
+ t.addCell(new Phrase("Code Lutin SA", headerFontB));
+ Cell titleCell = new Cell(new Phrase(title, new Font(Font.HELVETICA, 14, Font.BOLD, Color.BLACK)));
+ titleCell.setVerticalAlignment(Element.ALIGN_MIDDLE);
+ titleCell.setHorizontalAlignment(Element.ALIGN_CENTER);
+ titleCell.setRowspan(2);
+ t.addCell(titleCell);
+ t.addCell(new Phrase("N° Siret", headerFontB));
+ t.addCell(new Phrase("442116703", headerFont));
+ //line 2
+ t.addCell(new Phrase("SSL", headerFont));
+ t.addCell(new Phrase("NAF :", headerFontB));
+ t.addCell(new Phrase("6201Z", headerFont));
+ //line 3
+ t.addCell(new Phrase("44 bd des Pas Enchantés", headerFont));
+ t.addCell("");
+ t.addCell(new Phrase("n°TVA", headerFontB));
+ t.addCell(new Phrase("FR 57 442116703", headerFont));
+ //line 4
+ t.addCell(new Phrase("44230 St Séb/Loire", headerFont));
+ t.addCell("");
+ t.addCell(new Phrase("Période du", headerFontB));
+ t.addCell(new Phrase(beginDate, headerFont));
+ //line 5
+ t.addCell("");
+ t.addCell("");
+ t.addCell(new Phrase("au", headerFontB));
+ t.addCell(new Phrase(endDate, headerFont));
+ } catch (BadElementException eeBEE) {
+ log.error("Can't create table", eeBEE);
+ }
+ return t;
+ }
+
+ public Table createTable(List<FinancialStatementAmounts> financialStatementAmounts){
+ int nbrow = financialStatementAmounts.size();
+ Table t = null;
+ try {
+ //define table
+ t = new Table(4,nbrow);
+ float[] widths = {0.4f, 0.2f, 0.2f, 0.2f};
+ t.setWidths(widths);
+ t.setPadding(0.5f);
+ t.setSpacing(0);
+ t.setBorderWidth(1);
+ t.setBorder(Rectangle.BOTTOM);
+ //define default cell
+ Cell cell = new Cell();
+ cell.setBorder(Rectangle.LEFT);
+ t.setDefaultCell(cell);
+
+ Font headerFont = new Font(Font.HELVETICA, 9, Font.BOLD, Color.BLACK);
+ Font tabFont = new Font(Font.HELVETICA, 9, Font.NORMAL, Color.BLACK);
+
+ Cell headerCell = new Cell(new Phrase(_("lima.table.label"), headerFont));
+ headerCell.setBorderWidth(1);
+ headerCell.setHeader(true);
+ t.addCell(headerCell);
+ headerCell = new Cell(new Phrase(_("lima.table.grossamount"), headerFont));
+ t.addCell(headerCell);
+ headerCell = new Cell(new Phrase(_("lima.table.provisiondeprecationamount"), headerFont));
+ t.addCell(headerCell);
+ headerCell = new Cell(new Phrase(_("lima.table.netamount"), headerFont));
+ t.addCell(headerCell);
+
+ for (FinancialStatementAmounts financialStatementAmount : financialStatementAmounts) {
+
+ String label = financialStatementAmount.getLabel();
+ int level = financialStatementAmount.getLevel();
+ Double grossAmount = financialStatementAmount.getGrossAmount();
+ Double provisionDeprecationAmount = financialStatementAmount.getProvisionDeprecationAmount();
+
+ if (financialStatementAmount.getSubAmount()){
+ cell.setGrayFill(0.9f);
+ }
+ else {
+ cell.setGrayFill(1f);
+ }
+
+ if (label == null){
+ t.addCell("");
+ t.addCell("");
+ t.addCell("");
+ t.addCell("");
+ }
+ else {
+ //cell1
+ String tab = "";
+ for (int i = 0; i <= level; i++) {
+ tab += "\t";
+ }
+ Phrase phrase = new Phrase(tab+label, tabFont);
+ t.addCell(phrase);
+ //cell2
+ if (grossAmount != 0.0){
+ phrase = new Phrase(String.valueOf(grossAmount), tabFont);
+ }
+ else {
+ phrase = new Phrase("");
+ }
+ t.addCell(phrase);
+ //cell 3
+ if (provisionDeprecationAmount != 0.0){
+ phrase = new Phrase(String.valueOf(provisionDeprecationAmount), tabFont);
+ }
+ else {
+ phrase = new Phrase("");
+ }
+ t.addCell(phrase);
+ //cell 4
+ if (grossAmount-provisionDeprecationAmount != 0.0){
+ phrase = new Phrase(String.valueOf(grossAmount-provisionDeprecationAmount), tabFont);
+ }
+ else {
+ phrase = new Phrase("");
+ }
+ t.addCell(phrase);
+ }
+ }
+
+ } catch (BadElementException eeBEE) {
+ log.error("Can't create table", eeBEE);
+ }
+ return t;
+ }
+
+ public void example (){
+ //FIRST PAGE
+ /*document.add(new Paragraph("First page of the document."));
+ document.add(new Paragraph("Some more text on the \n"
+ + "first page with different color and font type.",
+ FontFactory.getFont(FontFactory.COURIER, 14, Font.BOLD,
+ new Color(255, 150, 200))));
+
+ //SECOND PAGE
+ Paragraph title1 = new Paragraph("Chapter 1",
+ FontFactory.getFont(FontFactory.HELVETICA, 18,
+ Font.BOLDITALIC, new Color(0, 0, 255)));
+ Chapter chapter1 = new Chapter(title1, 1);
+ chapter1.setNumberDepth(0);
+ //SECTION 1
+ Paragraph title11 = new Paragraph("This is Section 1 in Chapter 1",
+ FontFactory.getFont(FontFactory.HELVETICA, 16,
+ Font.BOLD, new Color(255, 0, 0)));
+ Section section1 = chapter1.addSection(title11);
+ Paragraph someSectionText = new Paragraph("This text comes as part of section 1 of chapter 1.");
+ section1.add(someSectionText);
+ someSectionText = new Paragraph("Following is a 3 X 2 table.");
+ section1.add(someSectionText);
+ //TABLE
+ Table t = new Table(3,2);
+ t.setBorderColor(new Color(220, 255, 100));
+ t.setPadding(5);
+ t.setSpacing(5);
+ t.setBorderWidth(1);
+ Cell c1 = new Cell("header1");
+ c1.setHeader(true);
+ t.addCell(c1);
+ c1 = new Cell("Header2");
+ t.addCell(c1);
+ c1 = new Cell("Header3");
+ t.addCell(c1);
+ t.endHeaders();
+ t.addCell("1.1");
+ t.addCell("1.2");
+ t.addCell("1.3");
+
+ section1.add(t);
+
+ document.add(chapter1);*/
+ }
+
+}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTable.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTable.java 2010-07-19 13:53:24 UTC (rev 2975)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTable.java 2010-07-20 10:29:28 UTC (rev 2976)
@@ -29,8 +29,9 @@
import org.jdesktop.swingx.decorator.HighlightPredicate;
import org.jdesktop.swingx.decorator.Highlighter;
+
public class FinancialStatementReportTable extends JXTable {
-
+
private static final long serialVersionUID = 154211277688304679L;
protected FinancialStatementReportViewHandler handler;
@@ -60,7 +61,6 @@
for (int i = 0; i < getColumnModel().getColumnCount(); i++) {
getColumnModel().getColumn(i).setCellRenderer(renderer);
}
-
}
/*
@@ -110,5 +110,5 @@
new ColorHighlighter(predicate, new Color(244,244,244), null);
addHighlighter(colorTransaction);
}
-
+
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableModel.java 2010-07-19 13:53:24 UTC (rev 2975)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableModel.java 2010-07-20 10:29:28 UTC (rev 2976)
@@ -196,4 +196,9 @@
fireTableDataChanged();
}
+ public void createDocuments(){
+ FinancialStatementDocument financialStatementDocument = new FinancialStatementDocument();
+ financialStatementDocument.createDocuments(cacheDataList);
+ }
+
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportView.jaxx 2010-07-19 13:53:24 UTC (rev 2975)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportView.jaxx 2010-07-20 10:29:28 UTC (rev 2976)
@@ -68,9 +68,12 @@
onActionPerformed="getModelTable().setEndDate(endDatePicker.getDate());
getHandler().refresh()"/>
</cell>
+ <cell>
+ <JButton text="lima.createPDF" onActionPerformed="getHandler().createPdf()"/>
+ </cell>
</row>
<row>
- <cell fill="both" weightx="1" weighty="1" columns="7">
+ <cell fill="both" weightx="1" weighty="1" columns="8">
<JScrollPane>
<org.chorem.lima.ui.financialstatementreport.FinancialStatementReportTable id="table" rowHeight="24"
constructorParams="getHandler()"
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportViewHandler.java 2010-07-19 13:53:24 UTC (rev 2975)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportViewHandler.java 2010-07-20 10:29:28 UTC (rev 2976)
@@ -83,4 +83,7 @@
return view;
}
+ public void createPdf() {
+ model.createDocuments();
+ }
}
1
0
r2975 - in trunk: 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 lima-swing/src/main/resources/i18n
by jpepin@users.chorem.org 19 Jul '10
by jpepin@users.chorem.org 19 Jul '10
19 Jul '10
Author: jpepin
Date: 2010-07-19 15:53:24 +0200 (Mon, 19 Jul 2010)
New Revision: 2975
Url: http://chorem.org/repositories/revision/lima/2975
Log:
Suite passage ?\195?\160 topia 2.4.1. : Remplacement de m?\195?\169thodes supprim?\195?\169es des DAOs par des Topia query.
Modified:
trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/DefaultAccountingRules.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-callao/src/main/xmi/accounting.zargo
trunk/lima-swing/pom.xml
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/accountingrules/DefaultAccountingRules.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/DefaultAccountingRules.java 2010-07-19 10:19:51 UTC (rev 2974)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/DefaultAccountingRules.java 2010-07-19 13:53:24 UTC (rev 2975)
@@ -327,9 +327,13 @@
//7. check if date are on fiscal period
FiscalPeriodDAO fiscalPeriodDAO =
LimaCallaoDAOHelper.getFiscalPeriodDAO(topiaContext);
- FiscalPeriod fiscalPeriod =
- fiscalPeriodDAO.findContainsFinancialPeriod(
- financialTransaction.getFinancialPeriod());
+
+ //search fiscalperiod have financialperiod in params
+ TopiaQuery query = fiscalPeriodDAO.createQuery()
+ .addInElements(":financialPeriod", "financialPeriod")
+ .addParam("financialPeriod", financialPeriod);
+ FiscalPeriod fiscalPeriod = fiscalPeriodDAO.findByQuery(query);
+
Date beginDateFiscalPeriod = fiscalPeriod.getBeginDate();
Date endDateFiscalPeriod = fiscalPeriod.getEndDate();
Date financialTransactionDate =
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-19 10:19:51 UTC (rev 2974)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/FranceAccountingRules.java 2010-07-19 13:53:24 UTC (rev 2975)
@@ -136,7 +136,8 @@
//check the new fiscal period adjoining the last
Date dateLastFiscalPeriod = lastFiscalPeriod.getEndDate();
dateLastFiscalPeriod = DateUtils.
- addMilliseconds(dateLastFiscalPeriod, 1);
+ addDays(dateLastFiscalPeriod, 1);
+ dateLastFiscalPeriod = DateUtils.truncate(dateLastFiscalPeriod, Calendar.DATE);
Date dateFiscalPeriod=fiscalPeriod.getBeginDate();
if(dateLastFiscalPeriod.compareTo(dateFiscalPeriod)!=0){
throw new LimaBusinessException(
@@ -226,7 +227,7 @@
super.blockClosedPeriodicEntryBookRules(
closedPeriodicEntryBook, topiaTransaction);
- closedPeriodicEntryBook.getFinancialPeriod();
+ FinancialPeriod financialPeriod = closedPeriodicEntryBook.getFinancialPeriod();
List<ClosedPeriodicEntryBook> closedPeriodicEntryBooks =
new ArrayList<ClosedPeriodicEntryBook>();
@@ -239,9 +240,13 @@
FiscalPeriodDAO fiscalPeriodDAO =
LimaCallaoDAOHelper.getFiscalPeriodDAO(topiaTransaction);
- FiscalPeriod fiscalPeriod =
- fiscalPeriodDAO.findContainsFinancialPeriod(
- closedPeriodicEntryBook.getFinancialPeriod());
+
+ //search fiscalperiod have financialperiod in params
+ TopiaQuery query1 = fiscalPeriodDAO.createQuery()
+ .addInElements(":financialPeriod", "financialPeriod")
+ .addParam("financialPeriod", financialPeriod);
+ FiscalPeriod fiscalPeriod = fiscalPeriodDAO.findByQuery(query1);
+
Date beginDate = fiscalPeriod.getBeginDate();
EntryBook entryBook = closedPeriodicEntryBook.getEntryBook();
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-19 10:19:51 UTC (rev 2974)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java 2010-07-19 13:53:24 UTC (rev 2975)
@@ -25,9 +25,7 @@
import java.util.HashSet;
import java.util.List;
import java.util.StringTokenizer;
-
import javax.ejb.Stateless;
-
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -376,7 +374,14 @@
Account subAccount = accountDAO.findByTopiaId(account.getTopiaId());
//check rules account if ledger or account
if (account.getGeneralLedger() == null){
- Account master = accountDAO.findContainsSubAccounts(subAccount);
+
+ //get masteraccount, search account have account in params in all subaccounts collection
+ TopiaQuery query = accountDAO.createQuery()
+ .addInElements(":account", "subAccounts")
+ .addParam("account", account);
+ Account master = accountDAO.findByQuery(query);
+
+ log.debug(master);
accountingRules.updateAccountRules(master, account);
subAccount.setMasterAccount(account.getMasterAccount());
subAccount.setSubAccounts(account.getSubAccounts());
@@ -426,8 +431,6 @@
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++) {
Modified: trunk/lima-callao/src/main/xmi/accounting.zargo
===================================================================
(Binary files differ)
Modified: trunk/lima-swing/pom.xml
===================================================================
--- trunk/lima-swing/pom.xml 2010-07-19 10:19:51 UTC (rev 2974)
+++ trunk/lima-swing/pom.xml 2010-07-19 13:53:24 UTC (rev 2975)
@@ -48,6 +48,11 @@
<groupId>net.sf.opencsv</groupId>
<artifactId>opencsv</artifactId>
</dependency>
+
+ <dependency>
+ <groupId>com.lowagie</groupId>
+ <artifactId>itext</artifactId>
+ </dependency>
<dependency>
<groupId>org.swinglabs</groupId>
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-07-19 10:19:51 UTC (rev 2974)
+++ trunk/lima-swing/src/main/resources/i18n/lima-swing-en_GB.properties 2010-07-19 13:53:24 UTC (rev 2975)
@@ -57,6 +57,7 @@
lima.config.locale.description=
lima.config.ui.flaunchui.description=
lima.config.ui.fullscreen.description=
+lima.createPDF=
lima.credit=Credit
lima.daily=Daily
lima.date=Date
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-07-19 10:19:51 UTC (rev 2974)
+++ trunk/lima-swing/src/main/resources/i18n/lima-swing-fr_FR.properties 2010-07-19 13:53:24 UTC (rev 2975)
@@ -57,6 +57,7 @@
lima.config.locale.description=Locale utilis\u00E9e par l'application
lima.config.ui.flaunchui.description=
lima.config.ui.fullscreen.description=
+lima.createPDF=
lima.credit=Credit
lima.daily=Quotidien
lima.date=Date
1
0
Author: tchemit
Date: 2010-07-19 12:19:51 +0200 (Mon, 19 Jul 2010)
New Revision: 2974
Url: http://chorem.org/repositories/revision/lima/2974
Log:
use last stable of jaxx
Modified:
trunk/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-07-19 10:08:01 UTC (rev 2973)
+++ trunk/pom.xml 2010-07-19 10:19:51 UTC (rev 2974)
@@ -253,7 +253,7 @@
<nuiton-utils.version>1.3.2-SNAPSHOT</nuiton-utils.version>
<eugene.version>2.1.1</eugene.version>
<topia.version>2.4.1-SNAPSHOT</topia.version>
- <jaxx.version>2.0.2</jaxx.version>
+ <jaxx.version>2.1</jaxx.version>
<i18n.version>1.2.2</i18n.version>
<!--axis.version>1.4.1</axis.version-->
1
0
Author: tchemit
Date: 2010-07-19 12:08:01 +0200 (Mon, 19 Jul 2010)
New Revision: 2973
Url: http://chorem.org/repositories/revision/lima/2973
Log:
fix svn:ignore
Modified:
trunk/lima-business/
trunk/lima-callao/
Property changes on: trunk/lima-business
___________________________________________________________________
Modified: svn:ignore
- .classpath
.project
.settings
target
+ .classpath
.project
.settings
target
*.iml
*.ipr
*.iws
Deleted: svn:ingore
- target
*.iml
*.ipr
*.iws
.project
.classpath
Property changes on: trunk/lima-callao
___________________________________________________________________
Modified: svn:ignore
- .settings
target
.classpath
.project
+ .settings
target
.classpath
.project
*.iml
*.ipr
*.iws
Deleted: svn:ingore
- target
*.iml
*.ipr
*.iws
.project
.classpath
1
0
Author: tchemit
Date: 2010-07-19 12:05:15 +0200 (Mon, 19 Jul 2010)
New Revision: 2972
Url: http://chorem.org/repositories/revision/lima/2972
Log:
use last stable of eugene + snapshot of topia
Modified:
trunk/lima-business/
trunk/lima-callao/
trunk/pom.xml
Property changes on: trunk/lima-business
___________________________________________________________________
Added: svn:ingore
+ target
*.iml
*.ipr
*.iws
.project
.classpath
Property changes on: trunk/lima-callao
___________________________________________________________________
Added: svn:ingore
+ target
*.iml
*.ipr
*.iws
.project
.classpath
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-07-16 16:05:21 UTC (rev 2971)
+++ trunk/pom.xml 2010-07-19 10:05:15 UTC (rev 2972)
@@ -251,8 +251,8 @@
<!-- customized libs version -->
<nuiton-utils.version>1.3.2-SNAPSHOT</nuiton-utils.version>
- <eugene.version>2.0.2</eugene.version>
- <topia.version>2.3.4</topia.version>
+ <eugene.version>2.1.1</eugene.version>
+ <topia.version>2.4.1-SNAPSHOT</topia.version>
<jaxx.version>2.0.2</jaxx.version>
<i18n.version>1.2.2</i18n.version>
1
0
Author: jpepin
Date: 2010-07-16 18:05:21 +0200 (Fri, 16 Jul 2010)
New Revision: 2971
Url: http://chorem.org/repositories/revision/lima/2971
Log:
Am?\195?\169lioration UI : plan comptable, journaux, et BCR par d?\195?\169faut.
Added:
trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/DefaultAccountsChartEnum.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/DefaultAccountsChartForm.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/DefaultEntryBooksEnum.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/DefaultEntryBooksForm.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/DefaultFinancialStatementChartForm.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/DefaultFinancialStatementsEnum.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExportWaitView.jaxx
Removed:
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FilesServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/csv/
trunk/lima-business/src/test/java/org/chorem/lima/business/FilesServiceImplTest.java
trunk/lima-swing/src/main/resources/import/default_pcg.xml
trunk/lima-swing/src/main/resources/import/ebp_code-lutin-test.csv
Modified:
trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialStatementService.java
trunk/lima-business/src/main/java/org/chorem/lima/business/FiscalPeriodServiceLocal.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/FinancialStatementServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java
trunk/lima-callao/src/main/xmi/accounting.zargo
trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.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/entrybook/EntryBookView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/HomeViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExportEnum.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
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialStatementService.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialStatementService.java 2010-07-15 10:27:28 UTC (rev 2970)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialStatementService.java 2010-07-16 16:05:21 UTC (rev 2971)
@@ -35,6 +35,7 @@
public void updateFinancialStatement(FinancialStatement financialStatement) throws LimaException, LimaBusinessException;
public void removeFinancialStatement(FinancialStatement financialStatement) throws LimaException, LimaBusinessException;
+ public List<FinancialStatement> getAllFinancialStatements() throws LimaException;
public List<FinancialStatement> getChildrenFinancialStatement(FinancialStatement financialStatement) throws LimaException;
public List<FinancialStatement> getAllChildrenFinancialStatement(FinancialStatement financialStatement, List<FinancialStatement> financialStatements) throws LimaException, LimaBusinessException;
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/FiscalPeriodServiceLocal.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/FiscalPeriodServiceLocal.java 2010-07-15 10:27:28 UTC (rev 2970)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/FiscalPeriodServiceLocal.java 2010-07-16 16:05:21 UTC (rev 2971)
@@ -20,7 +20,6 @@
package org.chorem.lima.business;
import javax.ejb.Local;
-import org.chorem.lima.entity.FiscalPeriod;
/**
* Fiscal period service.
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-15 10:27:28 UTC (rev 2970)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/FranceAccountingRules.java 2010-07-16 16:05:21 UTC (rev 2971)
@@ -61,9 +61,8 @@
}
public void updateAccountRules(Account masterAccount, Account account) throws LimaException {
- log.debug("masterAccount"+masterAccount);
- log.debug("acccount"+account);
super.updateAccountRules(masterAccount, account);
+
// Check if the number account is type numeric
if (!StringUtils.isNumeric(account.getAccountNumber())){
throw new LimaBusinessException("AccountNumber is not numeric : "
@@ -195,7 +194,7 @@
TopiaQuery query = fiscalPeriodDAO.createQuery();
fiscalPeriodDAO.findAllByQuery(query);
- query.add(FiscalPeriod.LOCKED, Op.EQ, false);
+ query.addEquals(FiscalPeriod.LOCKED, Op.EQ, false);
query.addOrder(FiscalPeriod.END_DATE);
FiscalPeriod oldestUnBlockedFiscalPeriod =
@@ -232,8 +231,6 @@
new ArrayList<ClosedPeriodicEntryBook>();
try {
-
- log.debug("france check");
// Get all closedperiod between for the period and entrybook
Date endDate = closedPeriodicEntryBook.
Deleted: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FilesServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FilesServiceImpl.java 2010-07-15 10:27:28 UTC (rev 2970)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FilesServiceImpl.java 2010-07-16 16:05:21 UTC (rev 2971)
@@ -1,644 +0,0 @@
-/* *##% Lima Business
- * Copyright (C) 2008 - 2010 CodeLutin
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 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.business.ejb;
-
-import java.util.List;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.chorem.lima.entity.Account;
-import org.jdom.Document;
-import org.jdom.Element;
-
-/**
- * Cette classe permet d'importer et exporter des données comptables. Ces données
- * sont au format xml.
- *
- * @author Rémi Chapelet
- */
-public class FilesServiceImpl { // implements FilesService {
-
- /**
- * log
- */
- private static final Log log = LogFactory.getLog(FilesServiceImpl.class);
-
- static Element racine = new Element("Callao");
-
- static org.jdom.Document document = new Document(racine);
-
- private AccountServiceImpl accountServiceImpl = new AccountServiceImpl();
-
- private EntryBookServiceImpl journalServiceImpl = new EntryBookServiceImpl();
-
- private FiscalPeriodServiceImpl periodServiceImpl = new FiscalPeriodServiceImpl();
-
- private FinancialPeriodServiceImpl timeSpanServiceImpl = new FinancialPeriodServiceImpl();
-
- private FinancialTransactionServiceImpl transactionServiceImpl = new FinancialTransactionServiceImpl();
-
- /**
- * Cete méthode permet d'exporter des données de Callao vers un fichier au
- * format xml.
- *
- * @param nameFile
- */
- public void exportDatas(String nameFile) {
- /*if (log.isDebugEnabled()) {
- log.debug("Save file XML : ");
- }
-
- // Partie Informations
- Element info = new Element("informations");
- racine.addContent(info);
- Attribute date = new Attribute("date", new Date().toString());
- info.setAttribute(date);
- Attribute user = new Attribute("user", "Name user");
- info.setAttribute(user);
- Attribute company = new Attribute("company", "Name company");
- info.setAttribute(company);
-
- // Partie Save
-
- // Création Element save
- Element save = new Element("save");
- racine.addContent(save);
-
- // Period
-
- // Création élément liste de périods
- Element periods = new Element("periods");
- // Création élément liste de timespans
- Element timeSpans = new Element("timespans");
- save.addContent(periods);
- save.addContent(timeSpans);
- // Recherche de la liste de toutes les périodes et leurs timeSpans en DTO
- List<PeriodDTO> listPeriodDTO = periodServiceImpl.getAllPeriod();
- // Pour chaque période
- for (PeriodDTO periodDTO : listPeriodDTO) {
- // Création élément périod
- Element period = new Element("period");
- periods.addContent(period);
- // Identifiant période
- Attribute id = new Attribute("id", periodDTO.getId());
- period.setAttribute(id);
- // BeginPeriod
- // Découpage date
- String dateTab[] = dateUtil.arrayDate(periodDTO.getBeginPeriod());
- Attribute beginYear = new Attribute("beginYear", dateTab[0]);
- period.setAttribute(beginYear);
- Attribute beginMonth = new Attribute("beginMonth", dateTab[1]);
- period.setAttribute(beginMonth);
- Attribute beginDay = new Attribute("beginDay", dateTab[2]);
- period.setAttribute(beginDay);
- // EndPeriod
- dateTab = dateUtil.arrayDate(periodDTO.getEndPeriod());
- Attribute endYear = new Attribute("endYear", dateTab[0]);
- period.setAttribute(endYear);
- Attribute endMonth = new Attribute("endMonth", dateTab[1]);
- period.setAttribute(endMonth);
- Attribute endDay = new Attribute("endDay", dateTab[2]);
- period.setAttribute(endDay);
- // Locked Period
- if (periodDTO.isLocked()) {
- Attribute locked = new Attribute("locked", "true");
- period.setAttribute(locked);
- } else {
- Attribute locked = new Attribute("locked", "false");
- period.setAttribute(locked);
- }
-
- // TimeSpan
-
- // Recherche des timeSpans de la période
- List<TimeSpanDTO> listTimeSpanDTO = periodDTO.getListTimeSpan();
- // Pour chaque timeSpan
- for (TimeSpanDTO timeSpanDTO : listTimeSpanDTO) {
- Element timeSpan = new Element("timespan");
- timeSpans.addContent(timeSpan);
- // Identifiant timeSpan
- Attribute idTimeSpan = new Attribute("id", timeSpanDTO.getId());
- timeSpan.setAttribute(idTimeSpan);
- Attribute idPeriod = new Attribute("idPeriod", periodDTO
- .getId());
- timeSpan.setAttribute(idPeriod);
- // Begin TimeSpan
- // Découpage date
- dateTab = dateUtil.arrayDate(timeSpanDTO.getBeginTimeSpan());
- Attribute beginYearTimeSpan = new Attribute("beginYear",
- dateTab[0]);
- timeSpan.setAttribute(beginYearTimeSpan);
- Attribute beginMonthTimeSpan = new Attribute("beginMonth",
- dateTab[1]);
- timeSpan.setAttribute(beginMonthTimeSpan);
- Attribute beginDayTimeSpan = new Attribute("beginDay",
- dateTab[2]);
- timeSpan.setAttribute(beginDayTimeSpan);
- // End TimeSpan
- dateTab = dateUtil.arrayDate(timeSpanDTO.getEndTimeSpan());
- Attribute endYearTimeSpan = new Attribute("endYear", dateTab[0]);
- timeSpan.setAttribute(endYearTimeSpan);
- Attribute endMonthTimeSpan = new Attribute("endMonth",
- dateTab[1]);
- timeSpan.setAttribute(endMonthTimeSpan);
- Attribute endDayTimeSpan = new Attribute("endDay", dateTab[2]);
- timeSpan.setAttribute(endDayTimeSpan);
- // Lock timeSpan
- if (timeSpanDTO.isLocked()) {
- Attribute locked = new Attribute("locked", "true");
- timeSpan.setAttribute(locked);
- } else {
- Attribute locked = new Attribute("locked", "false");
- timeSpan.setAttribute(locked);
- }
- }
- }
-
- // Journal
-
- Element journals = new Element("journals");
- save.addContent(journals);
- List<JournalDTO> listJournalDTO = journalServiceImpl.getAllJournal();
- for (JournalDTO journalDTO : listJournalDTO) {
- Element journal = new Element("journal");
- journals.addContent(journal);
- // Identification du journal
- Attribute idJournal = new Attribute("id", journalDTO.getId());
- journal.setAttribute(idJournal);
- // Label
- Attribute label = new Attribute("label", journalDTO.getLabel());
- journal.setAttribute(label);
- // Prefix
- Attribute prefix = new Attribute("prefix", journalDTO.getPrefix());
- journal.setAttribute(prefix);
- // Description
- Attribute description = new Attribute("description", journalDTO
- .getDescription());
- journal.setAttribute(description);
- }
-
- // Account
-
- Element accounts = new Element("accounts");
- save.addContent(accounts);
- List<AccountDTO> listAccountDTO = accountServiceImpl.getAllAccount();
- // Appel une fonction récursive pour parcourir l'arborescence des comptes
- accountXML(listAccountDTO, accounts);
-
- // Transaction
- Element transactions = new Element("transactions");
- save.addContent(transactions);
- Element entries = new Element("entries");
- save.addContent(entries);
- // Recherche de toutes les transactions
- List<TransactionDTO> listTransactionDTO = transactionServiceImpl
- .getAllTransactionDTO();
- // Pour chaque transaction
- for (TransactionDTO transactionDTO : listTransactionDTO) {
- Element transaction = new Element("transaction");
- transactions.addContent(transaction);
- // Identification de la transaction
- Attribute idTransaction = new Attribute("id", transactionDTO
- .getId());
- transaction.setAttribute(idTransaction);
- // EntryDate
- String dateTab[] = dateUtil
- .arrayDate(transactionDTO.getEntryDate());
- Attribute entryDateYear = new Attribute("entryDateYear", dateTab[0]);
- transaction.setAttribute(entryDateYear);
- Attribute entryDateMonth = new Attribute("entryDateMonth",
- dateTab[1]);
- transaction.setAttribute(entryDateMonth);
- Attribute entryDateDay = new Attribute("entryDateDay", dateTab[2]);
- transaction.setAttribute(entryDateDay);
- // VoucherRef
- Attribute voucherRef = new Attribute("voucherRef", transactionDTO
- .getVoucherRef());
- transaction.setAttribute(voucherRef);
- // Description
- Attribute description = new Attribute("description", transactionDTO
- .getDescription());
- transaction.setAttribute(description);
- // Id journal
- Attribute IdJournal = new Attribute("idJournal", transactionDTO
- .getJournalDTO().getId());
- transaction.setAttribute(IdJournal);
- // Id timeSpan
- Attribute IdTimeSpan = new Attribute("idTimeSpan", transactionDTO
- .getTimeSpanDTO().getId());
- transaction.setAttribute(IdTimeSpan);
-
- // Entry
- List<EntryDTO> listEntryDTO = entryServiceImpl
- .searchEntryDTOWithTransaction(transactionDTO);
- for (EntryDTO entryDTO : listEntryDTO) {
- Element entry = new Element("entry");
- entries.addContent(entry);
- // Identification du entry
- Attribute idEntry = new Attribute("id", entryDTO.getId());
- entry.setAttribute(idEntry);
- // Description
- Attribute descriptionEntry = new Attribute("description",
- entryDTO.getDescription());
- entry.setAttribute(descriptionEntry);
- // Amount
- Attribute amount = new Attribute("amount", entryDTO.getAmount());
- entry.setAttribute(amount);
- // Lettering
- Attribute lettering = new Attribute("lettering", entryDTO
- .getLettering());
- entry.setAttribute(lettering);
- // Detail
- Attribute detail = new Attribute("detail", entryDTO.getDetail());
- entry.setAttribute(detail);
- // Debit / crédit
- if (entryDTO.isDebit()) {
- Attribute debit = new Attribute("debit", "true");
- entry.setAttribute(debit);
- } else {
- Attribute debit = new Attribute("debit", "false");
- entry.setAttribute(debit);
- }
- // Transaction
- Attribute idrefTransaction = new Attribute("idTransaction",
- transactionDTO.getId());
- entry.setAttribute(idrefTransaction);
- // Account
- Attribute idAccount = new Attribute("idAccount", entryDTO
- .getAccountDTO().getId());
- entry.setAttribute(idAccount);
- }
- }
- //affiche();
- enregistre(nameFile);
- return ServiceHelper.RESPOND_SUCCESS;*/
- }
-
- /**
- * Converti la liste des comptes pour être ajouté au document xml.
- * @param listAccountDTO
- * @param accounts
- */
- protected void accountXML(List<Account> listAccount, Element accounts) {
- /*for (AccountDTO accountDTO : listAccountDTO) {
- Element account = new Element("account");
- accounts.addContent(account);
- // Identification du account
- Attribute idAccount = new Attribute("id", accountDTO.getId());
- account.setAttribute(idAccount);
- // Label
- Attribute label = new Attribute("label", accountDTO.getLabel());
- account.setAttribute(label);
- // Type
- Attribute type = new Attribute("type", accountDTO.getType());
- account.setAttribute(type);
- // AccountNumber
- Attribute accountNumber = new Attribute("accountNumber", accountDTO
- .getAccountNumber());
- account.setAttribute(accountNumber);
- // MasterAccountNumber
- Attribute masterAccountNumber = new Attribute("masterAccount",
- accountDTO.getMasterAccount());
- account.setAttribute(masterAccountNumber);
- // Ajoute les comptes enfants à la liste
- accountXML(accountDTO.getAccountChildDTO(), accounts);
- }*/
- }
-
- // Affiche le fichier xml
- /*static void affiche() {
- try {
- XMLOutputter sortie = new XMLOutputter(Format.getPrettyFormat());
- sortie.output(document, System.out);
- } catch (java.io.IOException e) {
- }
- }*/
-
- /**
- * Permet d'enregistrer le fichier xml.
- * @param fichier
- */
- /*static void enregistre(String fichier) {
- try {
- XMLOutputter sortie = new XMLOutputter(Format.getPrettyFormat());
- sortie.output(document, new FileOutputStream(fichier));
- } catch (java.io.IOException e) {
- }
- }*/
-
- /**
- * Permet d'importer un fichier de données au format xml dans Callao. Si le
- * fichier n'est pas disponible, il est alors renvoyé un message d'erreur.
- * @param file
- * @return
- */
- public void importDatas(String file) {
- /*if (log.isDebugEnabled()) {
- log.debug("Load file XML : ");
- }
- String result = ServiceHelper.RESPOND_ERROR;
- boolean existError = false;
-
-
- // Chargement du fichier et construction du Dom
- try {
- // On crée une instance de SAXBuilder
- SAXBuilder sxb = new SAXBuilder();
- document = sxb.build(file);
- } catch (IOException e) {
- log.error("Erreur lors de la lecture du fichier " + e.getMessage());
- e.printStackTrace();
- } catch (JDOMException e) {
- log.error("Erreur lors de la construction du fichier JDOM "
- + e.getMessage());
- e.printStackTrace();
- }
-
-
- // Ecriture dans la base de données
- try {
- // Recherche de la racine
- Element racine = document.getRootElement();
-
- // Journal
- XPath requeteXpath = XPath.newInstance("//journal");
- List results = requeteXpath.selectNodes(racine);
-
- Iterator iter = results.iterator();
- // Pour tous les journaux
- while (iter.hasNext()) {
- Element noeudCourant = (Element) iter.next();
- // Recherche attributs
- String label = noeudCourant.getAttribute("label").getValue();
- String prefix = noeudCourant.getAttribute("prefix").getValue();
- String description = noeudCourant.getAttribute("description")
- .getValue();
- // Création bdd
- result = journalServiceImpl.createJournal(label, prefix,
- description);
- // Control erreur
- if (result.equals(ServiceHelper.RESPOND_ERROR)) {
- existError = true;
- }
- }
-
- // Account
- requeteXpath = XPath.newInstance("//account");
- results = requeteXpath.selectNodes(racine);
-
- iter = results.iterator();
- // Pour tous les accounts
- while (iter.hasNext()) {
- Element noeudCourant = (Element) iter.next();
- // Recherche attributs
- String label = noeudCourant.getAttribute("label").getValue();
- String accountNumber = noeudCourant.getAttribute(
- "accountNumber").getValue();
- String masterAccount = noeudCourant.getAttribute(
- "masterAccount").getValue();
- String typeAccount = noeudCourant.getAttribute("type")
- .getValue();
- // Création bdd
- result = accountServiceImpl.createAccount(accountNumber, label,
- masterAccount, typeAccount);
- // Control erreur
- if (result.equals(ServiceHelper.RESPOND_ERROR)) {
- existError = true;
- }
- }
-
- // Period
- requeteXpath = XPath.newInstance("//period");
- results = requeteXpath.selectNodes(racine);
-
- iter = results.iterator();
- // Pour tous les periods
- while (iter.hasNext()) {
- Element noeudCourant = (Element) iter.next();
- // Recherche attributs
- String idPeriod = noeudCourant.getAttribute("id").getValue();
- int year = Integer.parseInt(noeudCourant.getAttribute(
- "beginYear").getValue());
- int month = Integer.parseInt(noeudCourant.getAttribute(
- "beginMonth").getValue());
- int day = Integer.parseInt(noeudCourant
- .getAttribute("beginDay").getValue());
- Date beginPeriod = new Date(year - 1900, month, day);
- year = Integer.parseInt(noeudCourant.getAttribute("endYear")
- .getValue());
- month = Integer.parseInt(noeudCourant.getAttribute("endMonth")
- .getValue());
- day = Integer.parseInt(noeudCourant.getAttribute("endDay")
- .getValue());
- Date endPeriod = new Date(year - 1900, month, day);
- // Création bdd
- result = periodServiceImpl.createPeriod(beginPeriod, endPeriod,
- false);
- // Control erreur
- if (result.equals(ServiceHelper.RESPOND_ERROR)) {
- existError = true;
- }
-
- // Transaction
- requeteXpath = XPath
- .newInstance("//transaction[@idTimeSpan=//timespan[@idPeriod='"
- + idPeriod + "']/@id]");
- List resultsTransaction = requeteXpath.selectNodes(racine);
- Iterator iterTrans = resultsTransaction.iterator();
- // Pour tous les transactions
- while (iterTrans.hasNext()) {
- Element noeudCourantTrans = (Element) iterTrans.next();
-
- // Recherche attributs
-
- // Id transaction XMl
- String idTransactionXML = noeudCourantTrans.getAttribute(
- "id").getValue();
- // Recherche du journal en DTO
- String idJournal = noeudCourantTrans.getAttribute(
- "idJournal").getValue();
- requeteXpath = XPath.newInstance("//journal[@id='"
- + idJournal + "']/@label");
- String label = requeteXpath.valueOf(racine);
- JournalDTO journalDTO = journalServiceImpl
- .searchJournalDTOWithLabel(label);
- // Recherche du timeSpan en DTO
- String idtimeSpan = noeudCourantTrans.getAttribute(
- "idTimeSpan").getValue();
- requeteXpath = XPath.newInstance("//timespan[@id='"
- + idtimeSpan + "']/@beginYear");
- year = Integer.parseInt(requeteXpath.valueOf(racine));
- requeteXpath = XPath.newInstance("//timespan[@id='"
- + idtimeSpan + "']/@beginMonth");
- month = Integer.parseInt(requeteXpath.valueOf(racine));
- requeteXpath = XPath.newInstance("//timespan[@id='"
- + idtimeSpan + "']/@beginDay");
- day = Integer.parseInt(requeteXpath.valueOf(racine));
- Date beginTimeSpan = new Date(year - 1900, month, day);
- TimeSpanDTO timeSpanDTO = timeSpanServiceImpl
- .searchTimeSpanDTOByDate(beginTimeSpan);
-
- // Création de transaction DTO
- TransactionDTO transactionDTO = new TransactionDTO();
- transactionDTO.setJournalDTO(journalDTO);
- transactionDTO.setTimeSpanDTO(timeSpanDTO);
- // entryDate
- year = Integer.parseInt(noeudCourantTrans.getAttribute(
- "entryDateYear").getValue());
- month = Integer.parseInt(noeudCourantTrans.getAttribute(
- "entryDateMonth").getValue());
- day = Integer.parseInt(noeudCourantTrans.getAttribute(
- "entryDateDay").getValue());
- Date entryDate = new Date(year - 1900, month, day);
- transactionDTO.setEntryDate(entryDate);
- // voucherRef
- String voucherRef = noeudCourantTrans.getAttribute(
- "voucherRef").getValue();
- transactionDTO.setVoucherRef(voucherRef);
- // description
- String description = noeudCourantTrans.getAttribute(
- "description").getValue();
- transactionDTO.setDescription(description);
-
- // Création bdd
- String idTransactionCallao = transactionServiceImpl
- .createTransaction(transactionDTO);
-
- // Entry
- requeteXpath = XPath.newInstance("//entry[@idTransaction='"
- + idTransactionXML + "']");
- List resultsEntry = requeteXpath.selectNodes(racine);
-
- Iterator iterEntry = resultsEntry.iterator();
- // Pour tous les entries
- while (iterEntry.hasNext()) {
- Element noeudEntry = (Element) iterEntry.next();
-
- // Recherche attributs
-
- // Transaction DTO
- transactionDTO = transactionServiceImpl
- .searchTransactionDTO(idTransactionCallao);
- // Account DTO
- String idAccount = noeudEntry.getAttribute("idAccount")
- .getValue();
- requeteXpath = XPath.newInstance("//account[@id='"
- + idAccount + "']/@accountNumber");
- String accountNumber = requeteXpath.valueOf(racine);
- AccountDTO accountDTO = accountServiceImpl
- .searchAccountDTO(accountNumber);
- // Entry DTO
- EntryDTO entryDTO = new EntryDTO();
- entryDTO.setAccountDTO(accountDTO);
- entryDTO.setTransactionDTO(transactionDTO);
- // Description
- description = noeudEntry.getAttribute("description")
- .getValue();
- entryDTO.setDescription(description);
- // Amount
- String amount = noeudEntry.getAttribute("amount")
- .getValue();
- entryDTO.setAmount(amount);
- // Debit
- boolean debit = noeudEntry.getAttribute("debit")
- .getValue().equals("true");
- entryDTO.setDebit(debit);
- // Lettering
- String lettering = noeudEntry.getAttribute("lettering")
- .getValue();
- entryDTO.setLettering(lettering);
- // Detail
- String detail = noeudEntry.getAttribute("detail")
- .getValue();
- entryDTO.setDetail(detail);
- // Création bdd
- result = transactionServiceImpl.addEntry(entryDTO);
- // Control erreur
- if (result.equals(ServiceHelper.RESPOND_ERROR)) {
- existError = true;
- }
- }
- }
-
-
- // Bloquer Period
- boolean lock = noeudCourant.getAttribute("locked").getValue()
- .equals("true");
- // Si la période est bloquée
- if (lock) {
- // Bloque tous ses timeSpans
- result = periodServiceImpl
- .blockAllTimeSpanOfPeriod(periodServiceImpl
- .searchPeriodWithDate(beginPeriod));
- // Control erreur
- if (result.equals(ServiceHelper.RESPOND_ERROR)) {
- existError = true;
- }
- // bloque la période
- result = periodServiceImpl.blockPeriod(periodServiceImpl
- .searchPeriodWithDate(beginPeriod));
-
- } else {
- // On regarde si il y a besoin de bloquer les timeSpans
- requeteXpath = XPath.newInstance("//timespan[@idPeriod = '"
- + idPeriod + "']");
- List resultsTimeSpan = requeteXpath.selectNodes(racine);
- Iterator iterTimeSpan = resultsTimeSpan.iterator();
- // Pour tous les timeSpans
- while (iterTimeSpan.hasNext()) {
- Element noeudCourantTimeSpan = (Element) iterTimeSpan
- .next();
- // Recherche attributs
- year = Integer.parseInt(noeudCourantTimeSpan
- .getAttribute("beginYear").getValue());
- month = Integer.parseInt(noeudCourantTimeSpan
- .getAttribute("beginMonth").getValue());
- day = Integer.parseInt(noeudCourantTimeSpan
- .getAttribute("beginDay").getValue());
- Date beginTimeSpan = new Date(year - 1900, month, day);
- lock = noeudCourantTimeSpan.getAttribute("locked")
- .getValue().equals("true");
- // Bloque le timeSpan
- if (lock) {
- timeSpanServiceImpl
- .blockTimeSpan(timeSpanServiceImpl
- .searchTimeSpanByDate(beginTimeSpan));
- }
- // Control erreur
- if (result.equals(ServiceHelper.RESPOND_ERROR)) {
- existError = true;
- }
- }
- }
-
- }
-
- } catch (JDOMException e) {
- log.error("Erreur JDOM " + e.getMessage());
- e.printStackTrace();
- }
-
- // Détection des erreurs
- if (!existError) {
- result = ServiceHelper.RESPOND_SUCCESS;
- }
- return result;*/
- }
-
-}
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-07-15 10:27:28 UTC (rev 2970)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialStatementServiceImpl.java 2010-07-16 16:05:21 UTC (rev 2971)
@@ -22,13 +22,10 @@
import static org.nuiton.i18n.I18n._;
import java.util.ArrayList;
import java.util.Date;
-import java.util.HashSet;
import java.util.List;
import java.util.StringTokenizer;
-
import javax.ejb.EJB;
import javax.ejb.Stateless;
-
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -169,9 +166,22 @@
finally {
doFinally(transaction, log);
}
-
}
+ @Override
+ public List<FinancialStatement> getAllFinancialStatements() throws LimaException {
+ TopiaContext transaction = null;
+ List<FinancialStatement> financialStatements = null;
+ try {
+ transaction = beginTransaction();
+ FinancialStatementDAO financialStatementDAO =
+ LimaCallaoDAOHelper.getFinancialStatementDAO(transaction);
+ financialStatements = financialStatementDAO.findAll();
+ } catch (TopiaException ex) {
+ doCatch(transaction, ex, log);
+ }
+ return financialStatements;
+ }
@Override
public List<FinancialStatement> getAllChildrenFinancialStatement(FinancialStatement financialStatement, List<FinancialStatement> result) throws LimaException, LimaBusinessException {
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 2010-07-15 10:27:28 UTC (rev 2970)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java 2010-07-16 16:05:21 UTC (rev 2971)
@@ -24,6 +24,7 @@
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
@@ -33,8 +34,6 @@
import java.util.TreeMap;
import javax.ejb.EJB;
import javax.ejb.Stateless;
-
-import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.beans.AccountEBP;
@@ -163,6 +162,21 @@
strat.setType(EntryEBPImpl.class);
//read header to set strategy mapping
strat.setColumnMapping(csvReader.readNext());
+
+ //check if file have a good header
+ List<String> headAccount = new ArrayList<String>();
+ headAccount.add("Journal");
+ headAccount.add("Compte");
+ headAccount.add("DatEcr");
+ headAccount.add("Piece");
+ headAccount.add("Libelle");
+ headAccount.add("Debit");
+ headAccount.add("Credit");
+ headAccount.add("Lettre");
+ if (!Arrays.asList(strat.getColumnMapping()).containsAll(headAccount)){
+ throw new LimaBusinessException("ERROR : This file contains no entries");
+ }
+
CsvToBean<EntryEBPImpl> csv = new CsvToBean<EntryEBPImpl>();
List<EntryEBPImpl> list = csv.parse(strat, csvReader);
@@ -277,9 +291,18 @@
strat.setType(AccountEBPImpl.class);
//read header to set strategy mapping
strat.setColumnMapping(csvReader.readNext());
+
+ //check if file have a good header
+ List<String> headAccount = new ArrayList<String>();
+ headAccount.add("Numero");
+ headAccount.add("Intitule");
+ if (!Arrays.asList(strat.getColumnMapping()).containsAll(headAccount)){
+ throw new LimaBusinessException("ERROR : This file contains no account");
+ }
+
CsvToBean<AccountEBPImpl> csv = new CsvToBean<AccountEBPImpl>();
List<AccountEBPImpl> list = csv.parse(strat, csvReader);
- Collections.sort(list, new AccountEBPComparator());
+ Collections.sort(list, new AccountEBPComparator());
AccountDAO accountDAO = LimaCallaoDAOHelper.getAccountDAO(topiaContext);
for (AccountEBP accountEBP : list) {
@@ -371,33 +394,33 @@
String[] nextLine = new String[1];
CSVReader csvReader = new CSVReader(new StringReader(datas), ';');
-
while ((nextLine = csvReader.readNext()) != null) {
ImportExportEntityEnum importExportEntityEnum = ImportExportEntityEnum.valueOfLabel(nextLine[0]);
-
- switch (importExportEntityEnum) {
- case ACCOUNT:
- result += importAccountsChartsCSV(nextLine, accounts, topiaContext);
- break;
- case ENTRYBOOK:
- result += importEntryBooksChartCSV(nextLine, topiaContext);
- break;
- case FINANCIALSTATEMENT:
- result += importFinancialsStatementChartCSV(nextLine, financialStatements, topiaContext);
- break;
- case FISCALPERIOD:
- result += importFiscalPeriodCSV(nextLine, fiscalPeriods, topiaContext);
- break;
- case CLOSEDPERIODICENTRYBOOK:
- importClosedPeriodicEntryBookCSV(nextLine, closedPeriodicEntryBooks, topiaContext);
- break;
- case FINANCIALTRANSACTION:
- importFinancialTransactionsCSV(nextLine, financialTransactions, topiaContext);
- break;
- case ENTRY:
- importEntriesCSV(nextLine, entries, topiaContext);
- break;
- }
+ if (importExportEntityEnum != null){
+ switch (importExportEntityEnum) {
+ case ACCOUNT:
+ result += importAccountsChartsCSV(nextLine, accounts, topiaContext);
+ break;
+ case ENTRYBOOK:
+ result += importEntryBooksChartCSV(nextLine, topiaContext);
+ break;
+ case FINANCIALSTATEMENT:
+ result += importFinancialsStatementChartCSV(nextLine, financialStatements, topiaContext);
+ break;
+ case FISCALPERIOD:
+ result += importFiscalPeriodCSV(nextLine, fiscalPeriods, topiaContext);
+ break;
+ case CLOSEDPERIODICENTRYBOOK:
+ importClosedPeriodicEntryBookCSV(nextLine, closedPeriodicEntryBooks, topiaContext);
+ break;
+ case FINANCIALTRANSACTION:
+ importFinancialTransactionsCSV(nextLine, financialTransactions, topiaContext);
+ break;
+ case ENTRY:
+ importEntriesCSV(nextLine, entries, topiaContext);
+ break;
+ }
+ }
}
//create accounts
Deleted: trunk/lima-business/src/test/java/org/chorem/lima/business/FilesServiceImplTest.java
===================================================================
--- trunk/lima-business/src/test/java/org/chorem/lima/business/FilesServiceImplTest.java 2010-07-15 10:27:28 UTC (rev 2970)
+++ trunk/lima-business/src/test/java/org/chorem/lima/business/FilesServiceImplTest.java 2010-07-16 16:05:21 UTC (rev 2971)
@@ -1,63 +0,0 @@
-package org.chorem.lima.business;
-
-import org.apache.commons.logging.LogFactory;
-import org.chorem.lima.business.ejb.FilesServiceImpl;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-/**
- * Tests pour la gestion des comptes dans le plan comptable
- *
- * Vérification sur l'ajout, la modification et suppression d'un compte.
- * Il existe également des tests sur des actions à partir de DTO. La classe
- * AccountServiceImplTest possède une méthode upload qui, à partir d'un DTO,
- * va mettre à jour automatiquement dans la base de données.
- *
- * @author Rémi Chapelet
- */
-public class FilesServiceImplTest {
-
- /** log. */
- private static final org.apache.commons.logging.Log log = LogFactory
- .getLog(FilesServiceImplTest.class);
-
- private static FilesServiceImpl instance;
-
- @BeforeClass
- public static void setUpClass() throws Exception {
- LimaConfig.getInstance();
- }
-
- /**
- * On nettoie la base de données
- * @throws java.lang.Exception
- */
- @AfterClass
- public static void tearDownClass() throws Exception {
-
- }
-
- @Before
- public void setUp() {
- //instance = new FilesServiceImpl();
- }
-
- public FilesServiceImplTest() {
- }
-
- /**
- * Permet de tester la sauvegarde en document xml.
- * Il existe un fichier dtd externe :
- * 'callao-service/src/main/resources/save-callao.dtd'
- */
- @Test
- public void fileTest() {
- /* Création sauvegarde
- String result = instance.exportDatas("/tmp/callao_save.xml");
- Assert.assertEquals(ServiceHelper.RESPOND_SUCCESS,result);
- Chargement sauvegarde
- instance.importDatas("/home/bombjack/save_big_lima");*/
- }
-
-}
\ No newline at end of file
Modified: trunk/lima-callao/src/main/xmi/accounting.zargo
===================================================================
(Binary files differ)
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java 2010-07-15 10:27:28 UTC (rev 2970)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java 2010-07-16 16:05:21 UTC (rev 2971)
@@ -291,6 +291,7 @@
MainView mainView = getUI(rootContext);
AccountView accountView = new AccountView(mainView);
mainView.showTab(_("lima.charts.account"), accountView);
+ accountView.getHandler().defaultAccountsChart(mainView);
}
/**
* Show account tree table view to create or modify accounts
@@ -303,6 +304,7 @@
MainView mainView = getUI(rootContext);
EntryBookView entryBookView= new EntryBookView(mainView);
mainView.showTab(_("lima.charts.entrybook"), entryBookView);
+ entryBookView.getHandler().defaultEntryBooks(mainView);
}
/**
@@ -321,7 +323,8 @@
*/
public void showFinancialPeriodView(JAXXContext rootContext) {
MainView mainView = getUI(rootContext);
- FinancialPeriodView financialPeriodView = new FinancialPeriodView(mainView);
+ FinancialPeriodView financialPeriodView =
+ new FinancialPeriodView(mainView);
mainView.showTab(_("lima.charts.financialperiod"), financialPeriodView);
}
@@ -331,8 +334,10 @@
*/
public void showFinancialStatementView(JAXXContext rootContext) {
MainView mainView = getUI(rootContext);
- FinancialStatementChartView financialStatementView = new FinancialStatementChartView(mainView);
+ FinancialStatementChartView financialStatementView =
+ new FinancialStatementChartView(mainView);
mainView.showTab(_("lima.charts.financialstatement"), financialStatementView);
+ financialStatementView.getHandler().defaultFinancialStatementChart(mainView);
}
/**
@@ -341,7 +346,8 @@
*/
public void showAccountReports(JAXXContext rootContext) {
MainView mainView = getUI(rootContext);
- AccountsReportsView accountsReportsView = new AccountsReportsView(mainView);
+ AccountsReportsView accountsReportsView =
+ new AccountsReportsView(mainView);
mainView.showTab(_("lima.reports.accounts"), accountsReportsView);
}
@@ -393,7 +399,7 @@
public void showImportExportView(JAXXContext rootContext, ImportExportEnum type) {
MainView mainView = getUI(rootContext);
ImportExport importExport = ImportExport.getInstance(mainView);
- importExport.importExport(type);
+ importExport.importExport(type, "");
}
public void showExportView(String type) {
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-07-15 10:27:28 UTC (rev 2970)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountView.jaxx 2010-07-16 16:05:21 UTC (rev 2971)
@@ -22,7 +22,7 @@
<script>
<![CDATA[
- //getHandler().init();
+
]]>
</script>
@@ -64,10 +64,4 @@
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-07-15 10:27:28 UTC (rev 2970)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java 2010-07-16 16:05:21 UTC (rev 2971)
@@ -29,12 +29,12 @@
import org.chorem.lima.entity.Account;
import org.chorem.lima.entity.AccountImpl;
import org.chorem.lima.service.LimaServiceFactory;
+import org.chorem.lima.ui.MainView;
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.ui.importexport.ImportExport;
import org.chorem.lima.ui.importexport.ImportExportEnum;
-import org.chorem.lima.ui.importexport.ImportExportForm;
import org.chorem.lima.util.DialogHelper;
import org.chorem.lima.util.ErrorHelper;
import org.jdesktop.swingx.JXTreeTable;
@@ -244,38 +244,32 @@
}
}
}
- };
+ }
- public void importexportAccount(){
+ public void defaultAccountsChart(MainView mainView){
- JXTreeTable accountsTreeTable = view.getAccountsTreeTable();
- AccountTreeTableModel accountsTreeTableModel =
- (AccountTreeTableModel)accountsTreeTable.getTreeTableModel();
-
- ImportExportForm importExportForm = new ImportExportForm(view);
- importExportForm.setLocationRelativeTo(view);
- importExportForm.setVisible(true);
+ try {
+ if (accountService.getAllAccounts().size() == 0){
+ DefaultAccountsChartForm form = new DefaultAccountsChartForm();
+ //
+ form.setLocationRelativeTo(mainView);
+ form.setVisible(true);
- Object value = importExportForm.getRadioButtons().getSelectedValue();
- // if action confirmed
- if (value != null){
- String mode = (String) value;
- ImportExport importExport = ImportExport.getInstance(view);
-
- try {
- if (mode.equals("import")){
- importExport.importExport(ImportExportEnum.LIMA_ACCOUNTCHARTS_IMPORT);
- accountsTreeTableModel.refreshTree();
- }
- else {
- importExport.importExport(ImportExportEnum.LIMA_ACCOUNTCHARTS_EXPORT);
- }
- } catch (LimaException eee) {
- if (log.isErrorEnabled()){
- log.error("Can't refresh tree", eee);
+ Object value = form.getRadioButtons().getSelectedValue();
+ // if action confirmed
+ if (value != null){
+
+ DefaultAccountsChartEnum defaultAccountsChartEnum =
+ (DefaultAccountsChartEnum) value;
+ ImportExport importExport = ImportExport.getInstance(view);
+ importExport.importExport(ImportExportEnum.LIMA_ACCOUNTCHARTS_IMPORT,
+ defaultAccountsChartEnum.getFilePath());
}
- DialogHelper.showMessageDialog(eee.getMessage());
}
- }
+ } catch (LimaException eee) {
+ if (log.isErrorEnabled()) {
+ log.error("Can't get default accounts chart", eee);
+ }
+ }
}
}
Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/DefaultAccountsChartEnum.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/DefaultAccountsChartEnum.java (rev 0)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/DefaultAccountsChartEnum.java 2010-07-16 16:05:21 UTC (rev 2971)
@@ -0,0 +1,16 @@
+package org.chorem.lima.ui.account;
+
+public enum DefaultAccountsChartEnum {
+
+ IMPORT(""), SHORTENED(""), BASE(""), DEVELOPED("");
+
+ private final String filePath;
+
+ private DefaultAccountsChartEnum(String filePath) {
+ this.filePath = filePath;
+ }
+
+ public String getFilePath() {
+ return this.filePath;
+ }
+}
Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/DefaultAccountsChartForm.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/DefaultAccountsChartForm.jaxx (rev 0)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/DefaultAccountsChartForm.jaxx 2010-07-16 16:05:21 UTC (rev 2971)
@@ -0,0 +1,72 @@
+<!-- ##% 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">
+
+ <jaxx.runtime.swing.JAXXButtonGroup id="radioButtons" javaBean='new JAXXButtonGroup()'/>
+ <Boolean id="addState" javaBean='true'/>
+
+ <script>
+ <![CDATA[
+ import org.chorem.lima.ui.account.DefaultAccountsChartEnum;
+ protected void performCancel() {
+ getRadioButtons().setSelectedValue(null);
+ dispose();
+ }
+ ]]>
+ </script>
+
+ <Table>
+ <row>
+ <cell><JLabel text='lima.charts.account.nothing' /></cell>
+ </row>
+ <row>
+ <cell>
+ <JRadioButton text='lima.charts.account.shortened' value='{DefaultAccountsChartEnum.SHORTENED}' buttonGroup="{getRadioButtons()}"
+ selected='true'/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JRadioButton text='lima.charts.account.base' value='{DefaultAccountsChartEnum.BASE}' buttonGroup="{getRadioButtons()}"
+ selected='true'/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JRadioButton text='lima.charts.account.developed' value='{DefaultAccountsChartEnum.DEVELOPED}' buttonGroup="{getRadioButtons()}"
+ selected='true'/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JRadioButton text='lima.importexport.import' value='{DefaultAccountsChartEnum.IMPORT}' buttonGroup="{getRadioButtons()}"
+ selected='true'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill="none">
+ <JButton text="lima.common.ok" onActionPerformed="dispose()"/>
+ </cell>
+ </row>
+ <row>
+ <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/DefaultAccountsChartForm.jaxx
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/DefaultEntryBooksEnum.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/DefaultEntryBooksEnum.java (rev 0)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/DefaultEntryBooksEnum.java 2010-07-16 16:05:21 UTC (rev 2971)
@@ -0,0 +1,16 @@
+package org.chorem.lima.ui.entrybook;
+
+public enum DefaultEntryBooksEnum {
+
+ IMPORT(""), DEFAULT("");
+
+ private final String filePath;
+
+ private DefaultEntryBooksEnum(String filePath) {
+ this.filePath = filePath;
+ }
+
+ public String getFilePath() {
+ return this.filePath;
+ }
+}
Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/DefaultEntryBooksForm.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/DefaultEntryBooksForm.jaxx (rev 0)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/DefaultEntryBooksForm.jaxx 2010-07-16 16:05:21 UTC (rev 2971)
@@ -0,0 +1,51 @@
+<!-- ##% 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">
+
+ <jaxx.runtime.swing.JAXXButtonGroup id="radioButtons" javaBean='new JAXXButtonGroup()'/>
+ <Boolean id="addState" javaBean='true'/>
+
+ <script>
+ <![CDATA[
+ import org.chorem.lima.ui.entrybook.DefaultEntryBooksEnum;
+ protected void performCancel() {
+ getRadioButtons().setSelectedValue(null);
+ dispose();
+ }
+ ]]>
+ </script>
+
+ <Table>
+ <row>
+ <cell>
+ <JRadioButton text='lima.charts.entrybook.default' value='{DefaultEntryBooksEnum.DEFAULT}' buttonGroup="{getRadioButtons()}"
+ selected='true'/>
+ </cell>
+ <cell>
+ <JRadioButton text='lima.charts.entrybook.import' value='{DefaultEntryBooksEnum.IMPORT}' 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/entrybook/DefaultEntryBooksForm.jaxx
___________________________________________________________________
Added: svn:executable
+ *
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 2010-07-15 10:27:28 UTC (rev 2970)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookView.jaxx 2010-07-16 16:05:21 UTC (rev 2971)
@@ -23,6 +23,7 @@
<script>
<![CDATA[
+ import java.awt.Dimension;
]]>
</script>
@@ -57,10 +58,4 @@
onActionPerformed="getHandler().deleteEntryBook()"/>
</cell>
</row>
- <row>
- <cell fill="horizontal">
- <JButton id="importexportButton" text="lima.common.importexport"
- onActionPerformed="getHandler().importexportEntryBook()"/>
- </cell>
- </row>
</Table>
\ No newline at end of file
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookViewHandler.java 2010-07-15 10:27:28 UTC (rev 2970)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookViewHandler.java 2010-07-16 16:05:21 UTC (rev 2971)
@@ -22,12 +22,14 @@
import javax.swing.JOptionPane;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.chorem.lima.business.EntryBookService;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.entity.EntryBook;
import org.chorem.lima.entity.EntryBookImpl;
+import org.chorem.lima.service.LimaServiceFactory;
+import org.chorem.lima.ui.MainView;
import org.chorem.lima.ui.importexport.ImportExport;
import org.chorem.lima.ui.importexport.ImportExportEnum;
-import org.chorem.lima.ui.importexport.ImportExportForm;
import org.chorem.lima.util.DialogHelper;
import org.jdesktop.swingx.JXTable;
@@ -45,9 +47,12 @@
private static final Log log = LogFactory.getLog(EntryBookViewHandler.class);
protected EntryBookView view;
+
+ protected EntryBookService entryBookService;
public EntryBookViewHandler(EntryBookView view) {
this.view = view;
+ entryBookService = LimaServiceFactory.getInstance().getEntryBookService();
}
public void addEntryBook() {
@@ -139,29 +144,32 @@
}
-public void importexportEntryBook(){
-
- JXTable entryBookTable = view.getEntryBooksTable();
- EntryBookTableModel entryBookTableModel =
- (EntryBookTableModel)entryBookTable.getModel();
-
- ImportExportForm importExportForm = new ImportExportForm(view);
- importExportForm.setLocationRelativeTo(view);
- importExportForm.setVisible(true);
+ public void defaultEntryBooks(MainView mainView){
+
+ try {
+ if (entryBookService.getAllEntryBooks().size() == 0){
+
+ DefaultEntryBooksForm form =
+ new DefaultEntryBooksForm();
+ form.setLocationRelativeTo(mainView);
+ form.setVisible(true);
- Object value = importExportForm.getRadioButtons().getSelectedValue();
- // if action confirmed
- if (value != null){
- String mode = (String) value;
- ImportExport importExport = ImportExport.getInstance(view);
-
- if (mode.equals("import")){
- importExport.importExport(ImportExportEnum.LIMA_ENTRYBOOKS_IMPORT);
- entryBookTableModel.refreshTable();
- }
- else {
- importExport.importExport(ImportExportEnum.LIMA_ENTRYBOOKS_EXPORT);
+ Object value = form.getRadioButtons().getSelectedValue();
+ // if action confirmed
+ if (value != null){
+ DefaultEntryBooksEnum defaultEntryBooksEnum =
+ (DefaultEntryBooksEnum) value;
+ ImportExport importExport = ImportExport.getInstance(view);
+ importExport.importExport(ImportExportEnum.LIMA_ENTRYBOOKS_IMPORT,
+ defaultEntryBooksEnum.getFilePath());
+ }
+ }
+ } catch (LimaException eee) {
+ if (log.isErrorEnabled()) {
+ log.error("Can't get default accounts chart", eee);
}
}
- }
+ }
+
}
+
Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/DefaultFinancialStatementChartForm.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/DefaultFinancialStatementChartForm.jaxx (rev 0)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/DefaultFinancialStatementChartForm.jaxx 2010-07-16 16:05:21 UTC (rev 2971)
@@ -0,0 +1,72 @@
+<!-- ##% 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">
+
+ <jaxx.runtime.swing.JAXXButtonGroup id="radioButtons" javaBean='new JAXXButtonGroup()'/>
+ <Boolean id="addState" javaBean='true'/>
+
+ <script>
+ <![CDATA[
+ import org.chorem.lima.ui.financialstatementchart.DefaultFinancialStatementsEnum;
+ protected void performCancel() {
+ getRadioButtons().setSelectedValue(null);
+ dispose();
+ }
+ ]]>
+ </script>
+
+ <Table>
+ <row>
+ <cell><JLabel text='lima.charts.financialstatement.nothing' /></cell>
+ </row>
+ <row>
+ <cell>
+ <JRadioButton text='lima.charts.financialstatement.shortened' value='{DefaultFinancialStatementsEnum.SHORTENED}' buttonGroup="{getRadioButtons()}"
+ selected='true'/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JRadioButton text='lima.charts.financialstatement.base' value='{DefaultFinancialStatementsEnum.BASE}' buttonGroup="{getRadioButtons()}"
+ selected='true'/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JRadioButton text='lima.charts.financialstatement.developed' value='{DefaultFinancialStatementsEnum.DEVELOPED}' buttonGroup="{getRadioButtons()}"
+ selected='true'/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JRadioButton text='lima.importexport.import' value='{DefaultFinancialStatementsEnum.IMPORT}' buttonGroup="{getRadioButtons()}"
+ selected='true'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill="none">
+ <JButton text="lima.common.ok" onActionPerformed="dispose()"/>
+ </cell>
+ </row>
+ <row>
+ <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/financialstatementchart/DefaultFinancialStatementChartForm.jaxx
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/DefaultFinancialStatementsEnum.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/DefaultFinancialStatementsEnum.java (rev 0)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/DefaultFinancialStatementsEnum.java 2010-07-16 16:05:21 UTC (rev 2971)
@@ -0,0 +1,16 @@
+package org.chorem.lima.ui.financialstatementchart;
+
+public enum DefaultFinancialStatementsEnum {
+
+ IMPORT(""), SHORTENED(""), BASE(""), DEVELOPED("");
+
+ private final String filePath;
+
+ private DefaultFinancialStatementsEnum(String filePath) {
+ this.filePath = filePath;
+ }
+
+ public String getFilePath() {
+ return this.filePath;
+ }
+}
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 2010-07-15 10:27:28 UTC (rev 2970)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartView.jaxx 2010-07-16 16:05:21 UTC (rev 2971)
@@ -64,10 +64,4 @@
enabled="{isSelectedRow()}"/>
</cell>
</row>
- <row>
- <cell fill="horizontal">
- <JButton id="importexportButton" text="lima.common.importexport"
- onActionPerformed="getHandler().importexportFinancialStatement()"/>
- </cell>
- </row>
</Table>
\ No newline at end of file
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 2010-07-15 10:27:28 UTC (rev 2970)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartViewHandler.java 2010-07-16 16:05:21 UTC (rev 2971)
@@ -23,15 +23,17 @@
import javax.swing.tree.TreePath;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.chorem.lima.business.FinancialStatementService;
import org.chorem.lima.business.LimaBusinessException;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.entity.FinancialStatement;
import org.chorem.lima.entity.FinancialStatementImpl;
+import org.chorem.lima.service.LimaServiceFactory;
+import org.chorem.lima.ui.MainView;
import org.chorem.lima.ui.financialstatementchart.FinancialStatementHeaderForm;
import org.chorem.lima.ui.financialstatementchart.FinancialStatementMovementForm;
import org.chorem.lima.ui.importexport.ImportExport;
import org.chorem.lima.ui.importexport.ImportExportEnum;
-import org.chorem.lima.ui.importexport.ImportExportForm;
import org.chorem.lima.util.DialogHelper;
import org.chorem.lima.util.ErrorHelper;
import org.jdesktop.swingx.JXTreeTable;
@@ -50,10 +52,13 @@
/** log. */
private static final Log log = LogFactory.getLog(FinancialStatementChartViewHandler.class);
+ protected FinancialStatementService financialStatementService;
+
protected FinancialStatementChartView view;
protected FinancialStatementChartViewHandler(FinancialStatementChartView view) {
this.view = view;
+ financialStatementService = LimaServiceFactory.getInstance().getFinancialStatementService();
}
/**
@@ -247,24 +252,31 @@
}
}
- public void importexportFinancialStatement(){
-
- ImportExportForm importExportForm = new ImportExportForm(view);
- importExportForm.setLocationRelativeTo(view);
- importExportForm.setVisible(true);
+
+ public void defaultFinancialStatementChart(MainView mainView){
+
+ try {
+ if (financialStatementService.getAllFinancialStatements().size() == 0){
+ DefaultFinancialStatementChartForm form =
+ new DefaultFinancialStatementChartForm();
+ form.setLocationRelativeTo(mainView);
+ form.setVisible(true);
- Object value = importExportForm.getRadioButtons().getSelectedValue();
- // if action confirmed
- if (value != null){
- String mode = (String) value;
- ImportExport importExport = ImportExport.getInstance(view);
- if (mode.equals("import")){
- importExport.importExport(ImportExportEnum.LIMA_FINANCIALSTATEMENTS_IMPORT);
- }
- else {
- importExport.importExport(ImportExportEnum.LIMA_FINANCIALSTATEMENTS_EXPORT);
- }
- }
+ Object value = form.getRadioButtons().getSelectedValue();
+ // if action confirmed
+ if (value != null){
+ DefaultFinancialStatementsEnum defaultFinancialStatementsEnum =
+ (DefaultFinancialStatementsEnum) value;
+ ImportExport importExport = ImportExport.getInstance(view);
+ importExport.importExport(ImportExportEnum.LIMA_FINANCIALSTATEMENTS_IMPORT,
+ defaultFinancialStatementsEnum.getFilePath());
+ }
+ }
+ } catch (LimaException eee) {
+ if (log.isErrorEnabled()) {
+ log.error("Can't get default accounts chart", eee);
+ }
+ }
}
}
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-07-15 10:27:28 UTC (rev 2970)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/HomeViewHandler.java 2010-07-16 16:05:21 UTC (rev 2971)
@@ -6,6 +6,7 @@
import javax.swing.JEditorPane;
import javax.swing.event.HyperlinkEvent;
import javax.swing.event.HyperlinkListener;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.LimaContext;
@@ -21,32 +22,30 @@
import org.chorem.lima.service.LimaServiceFactory;
import org.chorem.lima.ui.MainView;
+
public class HomeViewHandler implements HyperlinkListener {
private static final Log log = LogFactory.getLog(HomeViewHandler.class);
- private HomeView view;
-
+ protected HomeView view;
+
+ /* Services */
protected AccountService accountService;
-
protected EntryBookService entryBookService;
-
protected FinancialTransactionService financialTransactionService;
-
protected FiscalPeriodService fiscalPeriodService;
- protected HyperlinkListener accountsListener;
+ /* Editorpane*/
+ protected JEditorPane accountPane;
+ protected JEditorPane entryBookPane;
+ protected JEditorPane fiscalYearPane;
+ protected JEditorPane dailyPane;
- protected HyperlinkListener entrybookListener;
-
private static Color redBackground = new Color(0xff, 0xee, 0xee);
- protected HomeViewHandler(HomeView view) {
-
-
+ protected HomeViewHandler(HomeView view) {
this.view=view;
-
accountService =
LimaServiceFactory.getInstance().getAccountService();
entryBookService =
@@ -59,11 +58,25 @@
}
+ public void setEditorPanes() {
+ //Get all editorpanes
+ accountPane = view.getTextHomeAccount();
+ entryBookPane = view.getTextHomeEntryBook();
+ fiscalYearPane = view.getTextHomeFiscalYear();
+ dailyPane = view.getTextHomeDaily();
+
+ //add hyperlink listener
+ accountPane.addHyperlinkListener(this);
+ entryBookPane.addHyperlinkListener(this);
+ fiscalYearPane.addHyperlinkListener(this);
+ dailyPane.addHyperlinkListener(this);
+ }
+
+
+ @Override
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);
@@ -90,19 +103,12 @@
}
-
public void refresh(){
- //Get all editorpanes
- JEditorPane accountPane = view.getTextHomeAccount();
- JEditorPane entryBookPane = view.getTextHomeEntryBook();
- JEditorPane fiscalYearPane = view.getTextHomeFiscalYear();
- JEditorPane dailyPane = view.getTextHomeDaily();
-
- //add hyperlink listener
- accountPane.addHyperlinkListener(this);
- entryBookPane.addHyperlinkListener(this);
- fiscalYearPane.addHyperlinkListener(this);
- dailyPane.addHyperlinkListener(this);
+
+ if (accountPane ==null){
+ setEditorPanes();
+ }
+
String htmlBegin = "<font face='sans-serif' size=3>"
+ "<p style=vertical-align:'bottom', horizontal-align:'center'>";
String htmlEnd = "</p></font>";
@@ -128,7 +134,6 @@
accountPane.setText(htmlBegin + accountsString + htmlEnd);
}
-
//ENTRYBOOKS
List<EntryBook> entryBooks = entryBookService.getAllEntryBooks();
int ebSize = entryBooks.size();
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 2010-07-15 10:27:28 UTC (rev 2970)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java 2010-07-16 16:05:21 UTC (rev 2971)
@@ -20,8 +20,8 @@
package org.chorem.lima.ui.importexport;
import static org.nuiton.i18n.I18n._;
+import java.awt.Color;
import java.awt.Component;
-import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
@@ -30,7 +30,9 @@
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
+import java.util.concurrent.ExecutionException;
import javax.swing.JFileChooser;
+import javax.swing.SwingWorker;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.ExportService;
@@ -40,6 +42,7 @@
import org.chorem.lima.ui.account.AccountViewHandler;
import org.chorem.lima.util.DialogHelper;
import org.chorem.lima.util.FileChooseView;
+import org.jdesktop.swingx.painter.BusyPainter;
public class ImportExport {
@@ -52,109 +55,131 @@
protected ImportService importService;
protected ExportService exportService;
+
+ private ImportExportWaitView waitView;
public ImportExport(Component view) {
viewComponent=view;
importService = LimaServiceFactory.getInstance().getImportService();
exportService = LimaServiceFactory.getInstance().getExportService();
+ //create the wait dialog panel
+ waitView = new ImportExportWaitView();
+ waitView.waitDialog.setSize(400, 200);
+ waitView.setLocationRelativeTo(view);
+ BusyPainter busyPainter = waitView.getBusylabel().getBusyPainter();
+ busyPainter.setHighlightColor(new Color(44, 61, 146).darker());
+ busyPainter.setBaseColor(new Color(168, 204, 241).brighter());
}
-
-
- public void importExport(ImportExportEnum importExportMethode){
- String result = "";
- String datas = "";
- String filePath = "";
- String charset = "UTF-8";
- try {
- switch (importExportMethode) {
- case LIMA_ALL_EXPORT:
- filePath = chooseFile(false);
- datas = exportService.exportAsCSV();
- createFile(filePath, charset, datas);
- break;
- case LIMA_ACCOUNTCHARTS_EXPORT:
- filePath = chooseFile(false);
- datas = exportService.exportAccountsChartAsCSV();
- createFile(filePath, charset, datas);
- break;
- case LIMA_ENTRYBOOKS_EXPORT:
- filePath = chooseFile(false);
- datas = exportService.exportEntryBookChartAsCSV();
- createFile(filePath, charset, datas);
- break;
- case LIMA_FINANCIALSTATEMENTS_EXPORT:
- filePath = chooseFile(false);
- datas = exportService.exportFinancialStatementChartAsCSV();
- createFile(filePath, charset, datas);
- break;
- case EBP_ACCOUNTCHARTS_EXPORT:
- //For windows ebp
- filePath = chooseFile(false);
- charset = "ISO-8859-1";
- datas = exportService.exportAccountsAsEBP();
- createFile(filePath, charset, datas);
- break;
- case EBP_ENTRIES_EXPORT:
- //For windows ebp
- charset = "ISO-8859-1";
- filePath = chooseFile(false);
- datas = exportService.exportEntriesAsEBP();
- createFile(filePath, charset, datas);
- break;
- case LIMA_ALL_IMPORT:
- filePath = chooseFile(true);
- datas = extractFile(filePath, charset);
- result = importService.importCSV(datas);
- break;
- case LIMA_ACCOUNTCHARTS_IMPORT:
- filePath = chooseFile(true);
- datas = extractFile(filePath, charset);
- result = importService.importAccountsChartAsCSV(datas);
- break;
- case LIMA_ENTRYBOOKS_IMPORT:
- filePath = chooseFile(true);
- datas = extractFile(filePath, charset);
- result = importService.importEntryBooksChartAsCSV(datas);
- break;
- case LIMA_FINANCIALSTATEMENTS_IMPORT:
- filePath = chooseFile(true);
- datas = extractFile(filePath, charset);
- result = importService.importFinancialStatementsChartAsCSV(datas);
- break;
- case EBP_ACCOUNTCHARTS_IMPORT:
- //For windows ebp
- charset = "ISO-8859-1";
- filePath = chooseFile(true);
- datas = extractFile(filePath, charset);
- result = importService.importAccountsChartFromEbp(datas);
- break;
- case EBP_ENTRIES_IMPORT:
- //For windows ebp
- charset = "ISO-8859-1";
- filePath = chooseFile(true);
- datas = extractFile(filePath, charset);
- result = importService.importEntriesFromEbp(datas);
- break;
- }
- if (!result.equals("")){
- DialogHelper.showReportDialog(result, _("lima.importexport.import"), viewComponent);
- }
- else {
- DialogHelper.showMessageDialog(_("lima.importexport.import.terminated"));
- }
- }
- catch (LimaException eee) {
- if (log.isDebugEnabled()){
- log.debug("Can't call export import service ", eee);
- DialogHelper.showMessageDialog(eee.getMessage());
- }
- }
-
-
+
+ /**
+ * Call the appropriate methode in business service
+ * @param importExportMethode
+ */
+ public void importExport(ImportExportEnum importExportMethode, String file){
+ final ImportExportEnum importExportMethodeF = importExportMethode;
+ if (file.equals("")){
+ file = chooseFile(importExportMethode.getImportMode());
+ }
+ final String filePath = file;
+ new SwingWorker<String,Void>() {
+ @Override protected String doInBackground() throws LimaException {
+ String charset = "UTF-8";
+ String datas = "";
+ String result = "";
+ switch (importExportMethodeF) {
+ case LIMA_ALL_EXPORT:
+ datas = exportService.exportAsCSV();
+ createFile(filePath, charset, datas);
+ break;
+ case LIMA_ACCOUNTCHARTS_EXPORT:
+ datas = exportService.exportAccountsChartAsCSV();
+ createFile(filePath, charset, datas);
+ break;
+ case LIMA_ENTRYBOOKS_EXPORT:
+ datas = exportService.exportEntryBookChartAsCSV();
+ createFile(filePath, charset, datas);
+ break;
+ case LIMA_FINANCIALSTATEMENTS_EXPORT:
+ datas = exportService.exportFinancialStatementChartAsCSV();
+ createFile(filePath, charset, datas);
+ break;
+ case EBP_ACCOUNTCHARTS_EXPORT:
+ //For windows ebp
+ charset = "ISO-8859-1";
+ datas = exportService.exportAccountsAsEBP();
+ createFile(filePath, charset, datas);
+ break;
+ case EBP_ENTRIES_EXPORT:
+ //For windows ebp
+ charset = "ISO-8859-1";
+ datas = exportService.exportEntriesAsEBP();
+ createFile(filePath, charset, datas);
+ break;
+ case LIMA_ALL_IMPORT:
+ datas = extractFile(filePath, charset);
+ result = importService.importCSV(datas);
+ break;
+ case LIMA_ACCOUNTCHARTS_IMPORT:
+ datas = extractFile(filePath, charset);
+ result = importService.importAccountsChartAsCSV(datas);
+ break;
+ case LIMA_ENTRYBOOKS_IMPORT:
+ datas = extractFile(filePath, charset);
+ result = importService.importEntryBooksChartAsCSV(datas);
+ break;
+ case LIMA_FINANCIALSTATEMENTS_IMPORT:
+ datas = extractFile(filePath, charset);
+ result = importService.importFinancialStatementsChartAsCSV(datas);
+ break;
+ case EBP_ACCOUNTCHARTS_IMPORT:
+ //For windows ebp
+ charset = "ISO-8859-1";
+ datas = extractFile(filePath, charset);
+ result = importService.importAccountsChartFromEbp(datas);
+ break;
+ case EBP_ENTRIES_IMPORT:
+ //For windows ebp
+ charset = "ISO-8859-1";
+ datas = extractFile(filePath, charset);
+ result = importService.importEntriesFromEbp(datas);
+ break;
+ }
+ return result;
+ }
+ @Override protected void done() {
+ try {
+ //hidde wait dialog panel
+ waitView.setVisible(false);
+ // display result dialog
+ String result = get();
+ if (!result.equals("")){
+ DialogHelper.showReportDialog(result, _("lima.importexport.import"), viewComponent);
+ }
+ else {
+ DialogHelper.showMessageDialog(_("lima.importexport.import.terminated"));
+ }
+ } catch (InterruptedException eeeIE) {
+ if (log.isDebugEnabled()){
+ log.debug("Can't get result message", eeeIE);
+ }
+ } catch (ExecutionException eeeEE) {
+ if (log.isDebugEnabled()){
+ log.debug("Can't get result message", eeeEE);
+ }
+ }
+ }
+ }.execute();
+ waitView.setVisible(true);
+ //TODO refresh the view
}
-
+ /**
+ * open choose file dialog with appropriate file mode view
+ * folders for export or folders+files for import
+ * @param importMode
+ * @return
+ */
public String chooseFile(Boolean importMode){
String filePath = "";
FileChooseView fileChooseView = new FileChooseView();
@@ -176,7 +201,6 @@
}
-
/**
* Get csv datas in string and write file
*
@@ -197,7 +221,6 @@
}
-
/**
* Open csv file and get his datas on a string
*
@@ -218,7 +241,6 @@
}
-
public static ImportExport getInstance(Component view) {
if (exchanger == null) {
exchanger = new ImportExport(view);
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExportEnum.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExportEnum.java 2010-07-15 10:27:28 UTC (rev 2970)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExportEnum.java 2010-07-16 16:05:21 UTC (rev 2971)
@@ -1,9 +1,24 @@
package org.chorem.lima.ui.importexport;
+
+/**
+ * Boolean importMode define if it's a import (true) or an export (false)
+ *
+ */
public enum ImportExportEnum {
- LIMA_ALL_EXPORT, LIMA_ALL_IMPORT,
- LIMA_ACCOUNTCHARTS_EXPORT, LIMA_ENTRYBOOKS_EXPORT, LIMA_FINANCIALSTATEMENTS_EXPORT,
- LIMA_ACCOUNTCHARTS_IMPORT, LIMA_ENTRYBOOKS_IMPORT, LIMA_FINANCIALSTATEMENTS_IMPORT,
- EBP_ACCOUNTCHARTS_EXPORT, EBP_ENTRIES_EXPORT,
- EBP_ACCOUNTCHARTS_IMPORT, EBP_ENTRIES_IMPORT;
+ LIMA_ALL_EXPORT(false), LIMA_ALL_IMPORT(true),
+ LIMA_ACCOUNTCHARTS_EXPORT(false), LIMA_ENTRYBOOKS_EXPORT(false), LIMA_FINANCIALSTATEMENTS_EXPORT(false),
+ LIMA_ACCOUNTCHARTS_IMPORT(true), LIMA_ENTRYBOOKS_IMPORT(true), LIMA_FINANCIALSTATEMENTS_IMPORT(true),
+ EBP_ACCOUNTCHARTS_EXPORT(false), EBP_ENTRIES_EXPORT(false),
+ EBP_ACCOUNTCHARTS_IMPORT(true), EBP_ENTRIES_IMPORT(true);
+
+ private final Boolean importMode;
+
+ private ImportExportEnum(Boolean importMode) {
+ this.importMode = importMode;
+ }
+
+ public Boolean getImportMode() {
+ return this.importMode;
+ }
}
Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExportWaitView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExportWaitView.jaxx (rev 0)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExportWaitView.jaxx 2010-07-16 16:05:21 UTC (rev 2971)
@@ -0,0 +1,36 @@
+<!-- ##% 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 id="waitDialog">
+
+ <script>
+ <![CDATA[
+
+ ]]>
+ </script>
+
+ <Table>
+ <row>
+ <cell>
+ <org.jdesktop.swingx.JXBusyLabel id='busylabel' busy='true'/>
+ </cell>
+ <cell>
+ <JLabel text='lima.importexport.wait'/>
+ </cell>
+ </row>
+ </Table>
+</JDialog>
\ No newline at end of file
Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExportWaitView.jaxx
___________________________________________________________________
Added: svn:executable
+ *
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-07-15 10:27:28 UTC (rev 2970)
+++ trunk/lima-swing/src/main/resources/i18n/lima-swing-en_GB.properties 2010-07-16 16:05:21 UTC (rev 2971)
@@ -25,9 +25,19 @@
lima.amountcredit=
lima.amountdebit=
lima.charts.account=Accounts chart
+lima.charts.account.base=
+lima.charts.account.developed=
+lima.charts.account.nothing=
+lima.charts.account.shortened=
lima.charts.entrybook=EntryBooks chart
+lima.charts.entrybook.default=
+lima.charts.entrybook.import=
lima.charts.financialperiod=Financial Periods
lima.charts.financialstatement=
+lima.charts.financialstatement.base=
+lima.charts.financialstatement.developed=
+lima.charts.financialstatement.nothing=
+lima.charts.financialstatement.shortened=
lima.charts.fiscalyear=Fiscal Years
lima.close=Closed
lima.common.add=
@@ -104,6 +114,7 @@
lima.importexport.import=Import
lima.importexport.import.terminated=
lima.importexport.lima=
+lima.importexport.wait=
lima.init.closed=Lima closed at %1$s
lima.init.errorclosing=
lima.lettering.add=
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-07-15 10:27:28 UTC (rev 2970)
+++ trunk/lima-swing/src/main/resources/i18n/lima-swing-fr_FR.properties 2010-07-16 16:05:21 UTC (rev 2971)
@@ -25,9 +25,19 @@
lima.amountcredit=Total Cr\u00E9dit
lima.amountdebit=Total D\u00E9bit
lima.charts.account=Plan comptable
+lima.charts.account.base=Plan comptable de base
+lima.charts.account.developed=Plan comptable d\u00E9velopp\u00E9
+lima.charts.account.nothing=<html><center>Aucun plan comptable charg\u00E9<br/>Veuillez s\u00E9lectionner un plan par d\u00E9fault, <br/>importer un plan personnalis\u00E9<br/> ou annuler pour cr\u00E9er votre propre plan.</center></html>
+lima.charts.account.shortened=Plan comptable abr\u00E9g\u00E9
lima.charts.entrybook=Journaux
+lima.charts.entrybook.default=Journaux par d\u00E9fault
+lima.charts.entrybook.import=Importer des journaux
lima.charts.financialperiod=P\u00E9riodes comptables
lima.charts.financialstatement=Plan BCR
+lima.charts.financialstatement.base=Plan BCR de base
+lima.charts.financialstatement.developed=Plan BCR d\u00E9velopp\u00E9
+lima.charts.financialstatement.nothing=<html><center>Aucun plan BCR charg\u00E9<br/>Veuillez s\u00E9lectionner un plan par d\u00E9fault, <br/>importer un plan personnalis\u00E9<br/> ou annuler pour cr\u00E9er votre propre plan.</center></html>
+lima.charts.financialstatement.shortened=Plan BCR abr\u00E9g\u00E9
lima.charts.fiscalyear=Exercices
lima.close=Ferm\u00E9
lima.common.add=Ajout Compte G\u00E9n\u00E9ral
@@ -104,6 +114,7 @@
lima.importexport.import=Import
lima.importexport.import.terminated=Import termin\u00E9
lima.importexport.lima=Import/Export Lima
+lima.importexport.wait=Traitement en cours \u2026
lima.init.closed=Lima ferm\u00E9 \u00E0 %1$s
lima.init.errorclosing=
lima.lettering.add=Ajouter une lettre
Deleted: trunk/lima-swing/src/main/resources/import/default_pcg.xml
===================================================================
--- trunk/lima-swing/src/main/resources/import/default_pcg.xml 2010-07-15 10:27:28 UTC (rev 2970)
+++ trunk/lima-swing/src/main/resources/import/default_pcg.xml 2010-07-16 16:05:21 UTC (rev 2971)
@@ -1,45 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<Callao>
- <informations date="Fri Aug 07 11:35:27 CEST 2009" user="Name user" company="Name company" />
- <save>
- <accounts>
- <account id="org.chorem.callao.entity.Account#1249555347959#0.9019304796412684" label="COMPTES D'IMMOBILISATIONS" type="actif" accountNumber="2" masterAccount="0" />
- <account id="org.chorem.callao.entity.Account#1249555348338#0.04260276658110562" label="Frais d'établissement" type="Actif" accountNumber="201" masterAccount="2" />
- <account id="org.chorem.callao.entity.Account#1249555348347#0.18726180615226806" label="Droit au bail" type="Actif" accountNumber="206" masterAccount="2" />
- <account id="org.chorem.callao.entity.Account#1249555497020#0.6505535213374983" label="Immobilisations corporelles" type="Actif" accountNumber="21" masterAccount="2" />
- <account id="org.chorem.callao.entity.Account#1249555618637#0.47602527280737383" label="Autres immobilisations corporelles" type="Actif" accountNumber="218" masterAccount="21" />
- <account id="org.chorem.callao.entity.Account#1249555347984#0.4908833205081513" label="COMPTES DE STOCKS ET EN-COURS" type="actif" accountNumber="3" masterAccount="0" />
- <account id="org.chorem.callao.entity.Account#1249555347993#0.01567348299581306" label="COMPTES DE TIERS" type="actif" accountNumber="4" masterAccount="0" />
- <account id="org.chorem.callao.entity.Account#1249555822435#0.06041671027235429" label="Fournisseurs" type="Passif" accountNumber="401" masterAccount="4" />
- <account id="org.chorem.callao.entity.Account#1249555583700#0.6265947943023162" label="Clients" type="Actif" accountNumber="411" masterAccount="4" />
- <account id="org.chorem.callao.entity.Account#1249555348000#0.6004750737819512" label="COMPTES FINANCIERS" type="actif" accountNumber="5" masterAccount="0" />
- <account id="org.chorem.callao.entity.Account#1249555511423#0.011319837765867757" label="Caisse" type="Actif" accountNumber="53" masterAccount="5" />
- <account id="org.chorem.callao.entity.Account#1249555348022#0.930622399756405" label="COMPTES DE CHARGES" type="actif" accountNumber="6" masterAccount="0" />
- <account id="org.chorem.callao.entity.Account#1249555348378#0.8374727763221947" label="ACHATS" type="Charge" accountNumber="60" masterAccount="6" />
- <account id="org.chorem.callao.entity.Account#1249555548999#0.018490025064101023" label="Achas de marchandises" type="Charge" accountNumber="607" masterAccount="60" />
- <account id="org.chorem.callao.entity.Account#1249555636400#0.5473094310405552" label="Impôts, taxes et versements assimilés" type="Charge" accountNumber="63" masterAccount="6" />
- <account id="org.chorem.callao.entity.Account#1249555657935#0.35366073929481334" label="Charges de personnel" type="Charge" accountNumber="64" masterAccount="6" />
- <account id="org.chorem.callao.entity.Account#1249555348027#0.6782322672056709" label="COMPTES DE PRODUITS" type="actif" accountNumber="7" masterAccount="0" />
- <account id="org.chorem.callao.entity.Account#1249555599917#0.5953808167367928" label="Ventes de marchandises" type="Produit" accountNumber="707" masterAccount="7" />
- <account id="org.chorem.callao.entity.Account#1249555348076#0.6190508684748437" label="COMPTES SPECIAUX" type="actif" accountNumber="8" masterAccount="0" />
- <account id="org.chorem.callao.entity.Account#1249555347952#0.9924023380704713" label="COMPTES DE CAPITAUX" type="Passif" accountNumber="1" masterAccount="0" />
- <account id="org.chorem.callao.entity.Account#1249555348157#0.3681372547493901" label="Ecarts de réévaluation" type="Passif" accountNumber="105" masterAccount="1" />
- <account id="org.chorem.callao.entity.Account#1249555348211#0.8970560365362152" label="Ecarts de réévaluation" type="actif" accountNumber="10500000" masterAccount="105" />
- <account id="org.chorem.callao.entity.Account#1249555348169#0.21975217717147555" label="Réserves" type="Passif" accountNumber="106" masterAccount="1" />
- <account id="org.chorem.callao.entity.Account#1249555348221#0.20073728197870266" label="Réserve légale" type="actif" accountNumber="1061" masterAccount="106" />
- <account id="org.chorem.callao.entity.Account#1249555348269#0.3388466646762297" label="Réserve légale" type="actif" accountNumber="10610000" masterAccount="1061" />
- <account id="org.chorem.callao.entity.Account#1249555348301#0.09087057997481063" label="réserve légale" type="actif" accountNumber="10611000" masterAccount="1061" />
- <account id="org.chorem.callao.entity.Account#1249555348230#0.6918799658776698" label="Réserves indisponibles" type="actif" accountNumber="1062" masterAccount="106" />
- <account id="org.chorem.callao.entity.Account#1249555348308#0.6217734109884933" label="Réserves indisponibles" type="actif" accountNumber="10620000" masterAccount="1062" />
- <account id="org.chorem.callao.entity.Account#1249555348244#0.009767392197928992" label="Réserves statutaires ou contractuelles" type="actif" accountNumber="1063" masterAccount="106" />
- <account id="org.chorem.callao.entity.Account#1249555348315#0.8177617600611057" label="Réserves statutaires ou contractuelles" type="actif" accountNumber="10630000" masterAccount="1063" />
- <account id="org.chorem.callao.entity.Account#1249555348253#0.7582011362212686" label="Réserves réglementes" type="actif" accountNumber="1064" masterAccount="106" />
- <account id="org.chorem.callao.entity.Account#1249555348329#0.8489995807518893" label="Réserves réglementes" type="acif" accountNumber="10640000" masterAccount="1064" />
- <account id="org.chorem.callao.entity.Account#1249555348262#0.4019019740691401" label="Autres réserves" type="actif" accountNumber="1068" masterAccount="106" />
- <account id="org.chorem.callao.entity.Account#1249555348140#0.7846696113518526" label="Capital" type="Passif" accountNumber="101" masterAccount="1" />
- <account id="org.chorem.callao.entity.Account#1249555348184#0.7230203499285881" label="Capital" type="actif" accountNumber="10100000" masterAccount="101" />
- <account id="org.chorem.callao.entity.Account#1249555348200#0.3427497656667253" label="Capital non amorti" type="actif" accountNumber="10131000" masterAccount="101" />
- </accounts>
- </save>
-</Callao>
-
Deleted: trunk/lima-swing/src/main/resources/import/ebp_code-lutin-test.csv
===================================================================
--- trunk/lima-swing/src/main/resources/import/ebp_code-lutin-test.csv 2010-07-15 10:27:28 UTC (rev 2970)
+++ trunk/lima-swing/src/main/resources/import/ebp_code-lutin-test.csv 2010-07-16 16:05:21 UTC (rev 2971)
@@ -1,8 +0,0 @@
-Journal;Compte;Debit;Libelle;Credit;DatSai;Piece
-AC;44566210;1.82;ch 270 720 libelle 1;0;29/08/2003;24
-AC;44566210;2.13;ch 28 909 libelle 2;0;29/08/2003;52
-AC;44566210;10.17;ch 28 915 libelle 3;0;29/08/2003;59
-AC;44566130;0.31;ch 220 974 libelle 4;0;01/09/2003;107
-AC;44566210;0.68;ch 123 813 libelle 5;0;01/09/2003;15
-AC;44566210;5.4;ch 123 824 libelle 6;0;01/09/2003;30
-AC;44566130;1.23;ch 187 456 libelle 7;0;01/09/2003;44
\ No newline at end of file
1
0
r2970 - in trunk/lima-swing/src/main/java/org/chorem/lima: . ui ui/home
by jpepin@users.chorem.org 15 Jul '10
by jpepin@users.chorem.org 15 Jul '10
15 Jul '10
Author: jpepin
Date: 2010-07-15 12:27:28 +0200 (Thu, 15 Jul 2010)
New Revision: 2970
Url: http://chorem.org/repositories/revision/lima/2970
Log:
Ajout d'un listener sur la page d'accueil pour le rafraichissement.
Added:
trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/HomeViewListener.java
Modified:
trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java 2010-07-15 09:47:22 UTC (rev 2969)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java 2010-07-15 10:27:28 UTC (rev 2970)
@@ -150,6 +150,7 @@
}
return context;
}
+
protected static void launch(LimaContext context) throws Exception {
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java 2010-07-15 09:47:22 UTC (rev 2969)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java 2010-07-15 10:27:28 UTC (rev 2970)
@@ -44,6 +44,7 @@
import org.chorem.lima.ui.financialtransaction.LetteringView;
import org.chorem.lima.ui.financialtransactionunbalanced.FinancialTransactionUnbalancedView;
import org.chorem.lima.ui.home.HomeView;
+import org.chorem.lima.ui.home.HomeViewListener;
import org.chorem.lima.ui.importexport.ImportExport;
import org.chorem.lima.ui.importexport.ImportExportEnum;
import org.chorem.lima.ui.ledger.LedgerView;
@@ -279,6 +280,7 @@
public void showHomeView(JAXXContext rootContext) {
MainView mainView = getUI(rootContext);
HomeView homeView = new HomeView(mainView);
+ homeView.addComponentListener(new HomeViewListener(homeView));
mainView.showTab(_("lima.tab.home"), homeView, false);
}
/**
@@ -294,6 +296,9 @@
* Show account tree table view to create or modify accounts
* @param rootContext
*/
+
+
+
public void showEntryBookView(JAXXContext rootContext) {
MainView mainView = getUI(rootContext);
EntryBookView entryBookView= new EntryBookView(mainView);
Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/HomeViewListener.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/HomeViewListener.java (rev 0)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/HomeViewListener.java 2010-07-15 10:27:28 UTC (rev 2970)
@@ -0,0 +1,60 @@
+/* *##% 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.ui.home;
+
+import java.awt.event.ComponentEvent;
+import java.awt.event.ComponentListener;
+
+/**
+ * Listener refresh home datas when tab home is on front
+ */
+public class HomeViewListener implements ComponentListener {
+
+
+ private HomeView view;
+
+ public HomeViewListener(HomeView view) {
+ this.view = view;
+ // TODO Auto-generated constructor stub
+ }
+
+ @Override
+ public void componentHidden(ComponentEvent e) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void componentMoved(ComponentEvent e) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void componentResized(ComponentEvent e) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void componentShown(ComponentEvent e) {
+ view.getHandler().refresh();
+ }
+
+}
1
0