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
April 2012
- 2 participants
- 49 discussions
r3357 - trunk/lima-business/src/main/java/org/chorem/lima/service
by echatellier@users.chorem.org 11 Apr '12
by echatellier@users.chorem.org 11 Apr '12
11 Apr '12
Author: echatellier
Date: 2012-04-11 15:25:39 +0200 (Wed, 11 Apr 2012)
New Revision: 3357
Url: http://chorem.org/repositories/revision/lima/3357
Log:
Move to jee 6 api to init ejb container.
Modified:
trunk/lima-business/src/main/java/org/chorem/lima/service/LimaServiceFactory.java
Modified: trunk/lima-business/src/main/java/org/chorem/lima/service/LimaServiceFactory.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/service/LimaServiceFactory.java 2012-04-06 14:32:57 UTC (rev 3356)
+++ trunk/lima-business/src/main/java/org/chorem/lima/service/LimaServiceFactory.java 2012-04-11 13:25:39 UTC (rev 3357)
@@ -33,8 +33,7 @@
import java.util.Map;
import java.util.Properties;
-import javax.naming.Context;
-import javax.naming.InitialContext;
+import javax.ejb.embeddable.EJBContainer;
import javax.naming.NamingException;
import org.apache.commons.io.IOUtils;
@@ -53,17 +52,26 @@
/** Single instance. */
private static LimaServiceFactory instance;
- protected Map<Class<?>, Object> services = new HashMap<Class<?>, Object>();
+ /** Service cache. */
+ protected Map<Class, Object> services = new HashMap<Class, Object>();
- /** JNDI context used to look for EJB. */
- protected static InitialContext ctx;
+ /** EJB container. */
+ protected static EJBContainer container;
- /** Init openejb jndi context. */
+ /** EJB service namespace. */
+ protected static final String NAMESPACE = "java:global/lima-business/";
+
+ /**
+ * Init openejb container.
+ *
+ * @param config configuration
+ */
public static void initFactory(ApplicationConfig config) {
// TODO EC-20100407 maybe put all options in LimaConfig and allow user to configure it (remove getFlatOptions use)
// TODO EC-20120113 i don't understand this comment anymore :(
- Properties props = config.getFlatOptions();
+ //Properties props = config.getFlatOptions();
+ Properties props = config.getOptions();
// transmission des options de logging a openejb
// sinon, il utilise son propre pattern interne
@@ -81,31 +89,18 @@
IOUtils.closeQuietly(log4jFile);
}
- // Context.INITIAL_CONTEXT_FACTORY is a mandatory option
- // containsKey() does'nt work :(
- if (!props.containsKey(Context.INITIAL_CONTEXT_FACTORY)) {
- throw new IllegalStateException(
- "Application configuration is missing mandatory property "
- + Context.INITIAL_CONTEXT_FACTORY);
- }
-
- try {
- ctx = new InitialContext(props);
- } catch (NamingException eee) {
- if (log.isErrorEnabled()) {
- log.error("Can't initialize initial context", eee);
- }
- }
-
+ // see http://openejb.apache.org/embedded-configuration.html
+ // http://openejb.apache.org/properties-listing.html
+ // for embedded configuration
+ container = EJBContainer.createEJBContainer(props);
}
public static <M> M getService(Class<M> serviceMonitorableClass) {
LimaServiceFactory factory = getInstance();
- Map<Class<?>, Object> services = factory.getServices();
+ Map<Class, Object> services = factory.getServices();
M result = (M) services.get(serviceMonitorableClass);
if (result == null) {
result = factory.newService(serviceMonitorableClass);
-
services.put(serviceMonitorableClass, result);
}
return result;
@@ -131,22 +126,10 @@
}
/**
- * Destroy openejb jndi context.
- * <p/>
- * Code taken from openEJB faq :
- * http://openejb.apache.org/faq.html
- *
- * @throws Exception when trying to destroy a non existent application
+ * Close openejb container.
*/
- public static void destroy() throws Exception {
-
- /* not available in openejb 4
- destroy code (only in embedded mode)
- Assembler assembler = SystemInstance.get().getComponent(Assembler.class);
- for (AppInfo appInfo : assembler.getDeployedApplications()) {
- assembler.destroyApplication(appInfo.jarPath);
- }
- OpenEJB.destroy();*/
+ public static void destroy() {
+ container.close();
}
/**
@@ -163,16 +146,16 @@
return instance;
}
- protected Map<Class<?>, Object> getServices() {
- return getInstance().services;
+ protected Map<Class, Object> getServices() {
+ return services;
}
protected <M> M newService(Class<M> serviceMonitorableClass) {
M result;
Object ejbHome;
- String serviceName = serviceMonitorableClass.getSimpleName().replace("Monitorable", "ImplRemote");
+ String serviceName = serviceMonitorableClass.getSimpleName().replace("Monitorable", "Impl");
try {
- ejbHome = ctx.lookup(serviceName);
+ ejbHome = container.getContext().lookup(NAMESPACE + serviceName);
} catch (NamingException eee) {
throw new RuntimeException(
"Can't lookup for service : " + serviceName, eee);
1
0
r3356 - in trunk: lima-business/src/main/java/org/chorem/lima/business/ejb lima-business/src/main/java/org/chorem/lima/business/ejbinterface lima-swing/src/main/java/org/chorem/lima/ui lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod lima-swing/src/main/java/org/chorem/lima/ui/home lima-swing/src/main/java/org/chorem/lima/ui/opening lima-swing/src/main/resources/i18n
by echatellier@users.chorem.org 06 Apr '12
by echatellier@users.chorem.org 06 Apr '12
06 Apr '12
Author: echatellier
Date: 2012-04-06 16:32:57 +0200 (Fri, 06 Apr 2012)
New Revision: 3356
Url: http://chorem.org/repositories/revision/lima/3356
Log:
Mise ?\195?\160 jour home view et opening.
Added:
trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/AbstractHomePane.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/package-info.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/package-info.java
Modified:
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/FiscalPeriodService.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/FiscalPeriodServiceLocal.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/EntryBookListRenderer.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodTable.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/AccountsPane.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/EntryBooksPane.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/FinancialTransactionsPane.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/FiscalPeriodsPane.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/HomeView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateAccountsPanel.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateEntryBookPanel.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateFiscalPeriodPanel.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateIdentityPanel.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/OpeningView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/OpeningViewHandler.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/ejb/FiscalPeriodServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java 2012-04-06 10:07:48 UTC (rev 3355)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java 2012-04-06 14:32:57 UTC (rev 3356)
@@ -100,10 +100,11 @@
}
@Override
- public void createFiscalPeriodWithTransaction(FiscalPeriod fiscalPeriod,
+ public FiscalPeriod createFiscalPeriodWithTransaction(FiscalPeriod fiscalPeriod,
TopiaContext topiaContext) throws LimaException {
AccountingRules accountingRules = LimaConfig.getInstance().getAccountingRules();
+ FiscalPeriod result = null;
try {
@@ -127,12 +128,14 @@
LimaCallaoDAOHelper.getFiscalPeriodDAO(topiaContext);
//create
- fiscalPeriodDAO.create(fiscalPeriod);
+ result = fiscalPeriodDAO.create(fiscalPeriod);
commitTransaction(topiaContext);
} catch (TopiaException ex) {
doCatch(topiaContext, ex);
}
+
+ return result;
}
/**
@@ -140,17 +143,19 @@
* Check localized rules before create
*/
@Override
- public void createFiscalPeriod(FiscalPeriod fiscalPeriod) throws LimaException {
+ public FiscalPeriod createFiscalPeriod(FiscalPeriod fiscalPeriod) throws LimaException {
TopiaContext transaction = beginTransaction(rootContext);
+ FiscalPeriod result = null;
try {
-
- createFiscalPeriodWithTransaction(fiscalPeriod, transaction);
+ result = createFiscalPeriodWithTransaction(fiscalPeriod, transaction);
} catch (Exception ex) {
doCatch(transaction, ex);
} finally {
doFinally(transaction);
}
+
+ return result;
}
/** return all fiscal period */
@@ -247,12 +252,13 @@
* check localized rules before block it
*/
@Override
- public void blockFiscalPeriod(FiscalPeriod fiscalPeriod) throws LimaException {
+ public FiscalPeriod blockFiscalPeriod(FiscalPeriod fiscalPeriod) throws LimaException {
//open transaction for update
TopiaContext transaction = beginTransaction(rootContext);
AccountingRules accountingRules = LimaConfig.getInstance().getAccountingRules();
+ FiscalPeriod result = null;
try {
if (fiscalPeriod.getLocked()) {
@@ -275,7 +281,7 @@
financialPeriod.setLocked(true);
}
- fiscalPeriodDAO.update(oldFiscalPeriod);
+ result = fiscalPeriodDAO.update(oldFiscalPeriod);
commitTransaction(transaction);
@@ -284,6 +290,8 @@
} finally {
doFinally(transaction);
}
+
+ return result;
}
@Override
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/FiscalPeriodService.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/FiscalPeriodService.java 2012-04-06 10:07:48 UTC (rev 3355)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/FiscalPeriodService.java 2012-04-06 14:32:57 UTC (rev 3356)
@@ -52,9 +52,9 @@
FiscalPeriod getLastFiscalPeriod() throws LimaException;
- void createFiscalPeriod(FiscalPeriod fiscalPeriod) throws LimaException;
+ FiscalPeriod createFiscalPeriod(FiscalPeriod fiscalPeriod) throws LimaException;
- void blockFiscalPeriod(FiscalPeriod fiscalPeriod) throws LimaException;
+ FiscalPeriod blockFiscalPeriod(FiscalPeriod fiscalPeriod) throws LimaException;
void addRetainedEarnings(FiscalPeriod fiscalPeriod,
boolean newyear,
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/FiscalPeriodServiceLocal.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/FiscalPeriodServiceLocal.java 2012-04-06 10:07:48 UTC (rev 3355)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/FiscalPeriodServiceLocal.java 2012-04-06 14:32:57 UTC (rev 3356)
@@ -43,7 +43,7 @@
@Local
public interface FiscalPeriodServiceLocal extends FiscalPeriodService {
- void createFiscalPeriodWithTransaction(FiscalPeriod fiscalPeriod,
+ FiscalPeriod createFiscalPeriodWithTransaction(FiscalPeriod fiscalPeriod,
TopiaContext topiaContext) throws LimaException;
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 2012-04-06 10:07:48 UTC (rev 3355)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java 2012-04-06 14:32:57 UTC (rev 3356)
@@ -56,6 +56,8 @@
import org.chorem.lima.ui.vatchart.VatChartView;
import org.chorem.lima.ui.vatreports.VatReportView;
import org.chorem.lima.util.ErrorHelper;
+import org.nuiton.profiling.NuitonTrace;
+import org.nuiton.util.DesktopUtil;
import javax.swing.JButton;
import javax.swing.JTabbedPane;
@@ -185,40 +187,19 @@
helper.displayUI(ui, false);
}
-// public void showHelp(JAXXContext context, String helpId) {
-//
-// }
-//
-// public void closeHelp(JAXXContext context) {
-//
-// }
-
public void gotoSite(JAXXContext context) {
LimaConfig config = getUI(context).getConfig();
URL siteURL = config.getOptionAsURL("application.site.url");
- String url = siteURL.toString();
try {
- SwingUtil.openLink(url);
+ DesktopUtil.browse(siteURL.toURI());
} catch (Exception e) {
- ErrorHelper.showErrorDialog("Can't open lima website at " + url, e);
+ ErrorHelper.showErrorDialog("Can't open lima website at " + siteURL, e);
}
-// log.info("goto " + siteURL);
-// if (Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) {
-// try {
-// Desktop.getDesktop().browse(siteURL.toURI());
-// } catch (Exception ex) {
-// if (log.isErrorEnabled()) {
-// log.error("Can't open lima website", ex);
-// }
-// ErrorHelper.showErrorDialog("Can't open lima website", ex);
-// }
-// }
}
public void showAbout(JAXXContext context) {
-
MainView ui = getUI(context);
AboutPanel about = new AboutPanel();
about.setTitle(_("lima.title.about"));
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/EntryBookListRenderer.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/EntryBookListRenderer.java 2012-04-06 10:07:48 UTC (rev 3355)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/EntryBookListRenderer.java 2012-04-06 14:32:57 UTC (rev 3356)
@@ -55,8 +55,7 @@
if (entryBook != null) {
newValue = entryBook.getCode() + " - " + entryBook.getLabel();
}
- return super.getListCellRendererComponent(list, value, index, isSelected,
+ return super.getListCellRendererComponent(list, newValue, index, isSelected,
cellHasFocus);
}
-
}
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 2012-04-06 10:07:48 UTC (rev 3355)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodTable.java 2012-04-06 14:32:57 UTC (rev 3356)
@@ -39,8 +39,6 @@
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
-import javax.swing.table.TableModel;
-
/**
* Fiscal period table add support for JXTable.
*
Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/AbstractHomePane.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/AbstractHomePane.java (rev 0)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/AbstractHomePane.java 2012-04-06 14:32:57 UTC (rev 3356)
@@ -0,0 +1,64 @@
+/*
+ * #%L
+ *
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Codelutin, Chatellier Eric
+ * %%
+ * 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>.
+ * #L%
+ */
+
+package org.chorem.lima.ui.home;
+
+import java.awt.Color;
+
+import javax.swing.JEditorPane;
+import javax.swing.event.HyperlinkListener;
+import javax.swing.plaf.basic.BasicEditorPaneUI;
+
+/**
+ * Common code for all home page panel.
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * By : $Author$
+ */
+public abstract class AbstractHomePane extends JEditorPane implements HyperlinkListener {
+
+ /** serialVersionUID. */
+ private static final long serialVersionUID = -7820679841428370136L;
+
+ protected static final Color RED_BACKGROUND = new Color(0xff, 0xee, 0xee);
+
+ protected static final Color GREEN_BACKGROUND = new Color(0xee, 0xff, 0xee);
+
+ protected HomeView view;
+
+ protected AbstractHomePane(HomeView view) {
+ this.view = view;
+
+ //init
+ setOpaque(true);
+ setContentType("text/html");
+ setEditable(false);
+ setUI(new BasicEditorPaneUI());
+ addHyperlinkListener(this);
+ }
+}
Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/AbstractHomePane.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/AccountsPane.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/AccountsPane.java 2012-04-06 10:07:48 UTC (rev 3355)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/AccountsPane.java 2012-04-06 14:32:57 UTC (rev 3356)
@@ -25,6 +25,10 @@
package org.chorem.lima.ui.home;
+import static org.nuiton.i18n.I18n._;
+
+import javax.swing.event.HyperlinkEvent;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.LimaContext;
@@ -32,57 +36,39 @@
import org.chorem.lima.business.ServiceListener;
import org.chorem.lima.business.monitorable.AccountServiceMonitorable;
import org.chorem.lima.business.monitorable.ImportServiceMonitorable;
-import org.chorem.lima.entity.Account;
import org.chorem.lima.service.LimaServiceFactory;
import org.chorem.lima.ui.MainView;
-import javax.swing.JEditorPane;
-import javax.swing.event.HyperlinkEvent;
-import javax.swing.event.HyperlinkListener;
-import javax.swing.plaf.basic.BasicEditorPaneUI;
-import java.awt.Color;
-import java.util.List;
+/**
+ * Home view pane that display account plan statistics.
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * By : $Author$
+ */
+public class AccountsPane extends AbstractHomePane implements ServiceListener {
-import static org.nuiton.i18n.I18n._;
-
-public class AccountsPane extends JEditorPane implements HyperlinkListener, ServiceListener {
-
private static final long serialVersionUID = 1L;
private static final Log log = LogFactory.getLog(AccountsPane.class);
- protected HomeView view;
-
protected AccountServiceMonitorable accountService;
- private static Color redBackground = new Color(0xff, 0xee, 0xee);
-
- private static Color greenBackground = new Color(0xee, 0xff, 0xee);
-
-
public AccountsPane(HomeView view) {
- this.view = view;
- accountService =
- LimaServiceFactory.getService(
- AccountServiceMonitorable.class);
- LimaServiceFactory.addServiceListener(
- AccountServiceMonitorable.class, this);
- LimaServiceFactory.addServiceListener(
- ImportServiceMonitorable.class, this);
+ super(view);
- //init
- setOpaque(true);
- setContentType("text/html");
- setEditable(false);
- setUI(new BasicEditorPaneUI());
- addHyperlinkListener(this);
+ accountService = LimaServiceFactory.getService(AccountServiceMonitorable.class);
+ LimaServiceFactory.addServiceListener(AccountServiceMonitorable.class, this);
+ LimaServiceFactory.addServiceListener(ImportServiceMonitorable.class, this);
+
refresh();
}
@Override
public void hyperlinkUpdate(HyperlinkEvent e) {
if (HyperlinkEvent.EventType.ACTIVATED.equals(e.getEventType())) {
-
if (e.getDescription().equals("#accountschart")) {
MainView ui = LimaContext.MAIN_UI_ENTRY_DEF.getContextValue(view);
ui.getHandler().showAccountView(ui);
@@ -100,23 +86,25 @@
long accountCount = accountService.getAccountCount();
if (accountCount > 0) {
- setBackground(greenBackground);
- String accountsString = _("lima.home.chartaccounts.state1_2") + " "
- + accountCount + " " + _("lima.home.chartaccounts.state2_2")
+ setBackground(GREEN_BACKGROUND);
+ String accountsString = _("lima.ui.home.chartaccounts.state1_2") + " "
+ + accountCount + " " + _("lima.ui.home.chartaccounts.state2_2")
+ "<br/><br/><a href='#accountschart'>"
- + _("lima.home.chartaccounts.modify") + "</a>";
+ + _("lima.ui.home.chartaccounts.modify") + "</a>";
//set Text
setText(htmlBegin + accountsString + htmlEnd);
} else {
- setBackground(redBackground);
- String accountsString = _("lima.home.chartaccounts.nothing")
+ setBackground(RED_BACKGROUND);
+ String accountsString = _("lima.ui.home.chartaccounts.nothing")
+ "<br/><br/><a href='#accountschart'>"
- + _("lima.home.chartaccounts.create") + "</a>";
+ + _("lima.ui.home.chartaccounts.create") + "</a>";
//set Text
setText(htmlBegin + accountsString + htmlEnd);
}
- } catch (LimaException eee) {
- log.debug("Can't get datas account editor pane home", eee);
+ } catch (LimaException ex) {
+ if (log.isErrorEnabled()) {
+ log.error("Can't get datas account editor pane home", ex);
+ }
}
}
@@ -126,5 +114,4 @@
refresh();
}
}
-
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/EntryBooksPane.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/EntryBooksPane.java 2012-04-06 10:07:48 UTC (rev 3355)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/EntryBooksPane.java 2012-04-06 14:32:57 UTC (rev 3356)
@@ -25,6 +25,12 @@
package org.chorem.lima.ui.home;
+import static org.nuiton.i18n.I18n._;
+
+import java.util.List;
+
+import javax.swing.event.HyperlinkEvent;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.LimaContext;
@@ -37,52 +43,36 @@
import org.chorem.lima.service.LimaServiceFactory;
import org.chorem.lima.ui.MainView;
-import javax.swing.JEditorPane;
-import javax.swing.event.HyperlinkEvent;
-import javax.swing.event.HyperlinkListener;
-import javax.swing.plaf.basic.BasicEditorPaneUI;
-import java.awt.Color;
-import java.util.List;
+/**
+ * Home view pane that display entry books statistics.
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * By : $Author$
+ */
+public class EntryBooksPane extends AbstractHomePane implements ServiceListener {
-import static org.nuiton.i18n.I18n._;
-
-public class EntryBooksPane extends JEditorPane implements HyperlinkListener, ServiceListener {
-
private static final long serialVersionUID = 1L;
private static final Log log = LogFactory.getLog(EntryBooksPane.class);
- protected HomeView view;
-
protected EntryBookService entryBookService;
- private static Color redBackground = new Color(0xff, 0xee, 0xee);
-
- private static Color greenBackground = new Color(0xee, 0xff, 0xee);
-
public EntryBooksPane(HomeView view) {
- this.view = view;
+ super(view);
- entryBookService =
- LimaServiceFactory.getService(
- EntryBookServiceMonitorable.class);
- LimaServiceFactory.addServiceListener(entryBookService, this);
+ entryBookService = LimaServiceFactory.getService(EntryBookServiceMonitorable.class);
+ LimaServiceFactory.addServiceListener(EntryBookServiceMonitorable.class, this);
LimaServiceFactory.addServiceListener(ImportServiceMonitorable.class, this);
- //init
- setOpaque(true);
- setContentType("text/html");
- setEditable(false);
- setUI(new BasicEditorPaneUI());
- addHyperlinkListener(this);
refresh();
}
@Override
public void hyperlinkUpdate(HyperlinkEvent e) {
-
if (HyperlinkEvent.EventType.ACTIVATED.equals(e.getEventType())) {
-
if (e.getDescription().equals("#entrybookschart")) {
MainView ui = LimaContext.MAIN_UI_ENTRY_DEF.getContextValue(view);
ui.getHandler().showEntryBookView(ui);
@@ -101,18 +91,18 @@
List<EntryBook> entryBooks = entryBookService.getAllEntryBooks();
int ebSize = entryBooks.size();
if (ebSize > 0) {
- setBackground(greenBackground);
+ setBackground(GREEN_BACKGROUND);
String entryBooksString;
if (ebSize == 1) {
- entryBooksString = _("lima.home.entrybooks.state.single")
+ entryBooksString = _("lima.ui.home.entrybooks.state.single")
+ "<br/>" + entryBooks.get(0).getLabel()
+ "<br/><br/><a href='#entrybookschart'>"
- + _("lima.home.entrybooks.modify") + "</a>";
+ + _("lima.ui.home.entrybooks.modify") + "</a>";
} else {
- entryBooksString = _("lima.home.entrybooks.state1_2.plural")
+ entryBooksString = _("lima.ui.home.entrybooks.state1_2.plural")
+ " " + entryBooks.size() + " "
- + _("lima.home.entrybooks.state2_2.plural") + "<ul>";
+ + _("lima.ui.home.entrybooks.state2_2.plural") + "<ul>";
for (int i = 0; i < ebSize && i < 3; i++) {
// for (EntryBook entryBook : entryBooks) {
EntryBook entryBook = entryBooks.get(i);
@@ -124,17 +114,17 @@
}
entryBooksString += "</ul></p><p horizontal-align:'center'>"
+ "<a href='#entrybookschart'>"
- + _("lima.home.entrybooks.modify") + "</a>";
+ + _("lima.ui.home.entrybooks.modify") + "</a>";
}
//set Text
setText(htmlBegin + entryBooksString + htmlEnd);
} else {
- setBackground(redBackground);
+ setBackground(RED_BACKGROUND);
//set Text
setText(htmlBegin
- + _("lima.home.entrybooks.nothing")
+ + _("lima.ui.home.entrybooks.nothing")
+ "<br/><br/><a href='#entrybookschart'>"
- + _("lima.home.entrybooks.create") + "</a>" + htmlEnd);
+ + _("lima.ui.home.entrybooks.create") + "</a>" + htmlEnd);
}
} catch (LimaException eee) {
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/FinancialTransactionsPane.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/FinancialTransactionsPane.java 2012-04-06 10:07:48 UTC (rev 3355)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/FinancialTransactionsPane.java 2012-04-06 14:32:57 UTC (rev 3356)
@@ -25,6 +25,12 @@
package org.chorem.lima.ui.home;
+import static org.nuiton.i18n.I18n._;
+
+import java.util.List;
+
+import javax.swing.event.HyperlinkEvent;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.LimaContext;
@@ -40,48 +46,34 @@
import org.chorem.lima.service.LimaServiceFactory;
import org.chorem.lima.ui.MainView;
-import javax.swing.JEditorPane;
-import javax.swing.event.HyperlinkEvent;
-import javax.swing.event.HyperlinkListener;
-import javax.swing.plaf.basic.BasicEditorPaneUI;
-import java.awt.Color;
-import java.util.List;
+/**
+ * Home view pane that display statistics about unbalanced transactions.
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * By : $Author$
+ */
+public class FinancialTransactionsPane extends AbstractHomePane implements ServiceListener {
-import static org.nuiton.i18n.I18n._;
-
-public class FinancialTransactionsPane extends JEditorPane implements HyperlinkListener, ServiceListener {
-
private static final long serialVersionUID = 1L;
private static final Log log = LogFactory.getLog(FinancialTransactionsPane.class);
- protected HomeView view;
-
protected FinancialTransactionService financialTransactionService;
protected FiscalPeriodService fiscalPeriodService;
- private static Color redBackground = new Color(0xff, 0xee, 0xee);
-
- private static Color greenBackground = new Color(0xee, 0xff, 0xee);
-
public FinancialTransactionsPane(HomeView view) {
- this.view = view;
+ super(view);
- financialTransactionService =
- LimaServiceFactory.getService(FinancialTransactionServiceMonitorable.class);
- LimaServiceFactory.addServiceListener(financialTransactionService, this);
- fiscalPeriodService =
- LimaServiceFactory.getService(FiscalPeriodServiceMonitorable.class);
- LimaServiceFactory.addServiceListener(fiscalPeriodService, this);
+ financialTransactionService = LimaServiceFactory.getService(FinancialTransactionServiceMonitorable.class);
+ fiscalPeriodService = LimaServiceFactory.getService(FiscalPeriodServiceMonitorable.class);
+ LimaServiceFactory.addServiceListener(FinancialTransactionServiceMonitorable.class, this);
+ LimaServiceFactory.addServiceListener(FiscalPeriodServiceMonitorable.class, this);
LimaServiceFactory.addServiceListener(ImportServiceMonitorable.class, this);
- //init
- setOpaque(true);
- setContentType("text/html");
- setEditable(false);
- setUI(new BasicEditorPaneUI());
- addHyperlinkListener(this);
refresh();
}
@@ -114,11 +106,11 @@
financialTransactionService.
getAllInexactFinancialTransactions(unblockedFiscalPeriods.get(0));
if (financialTransactionsUnbal.size() > 0) {
- setBackground(redBackground);
+ setBackground(RED_BACKGROUND);
String transactionsString = financialTransactionsUnbal.size()
- + " " + _("lima.home.transaction.unbalanced")
+ + " " + _("lima.ui.home.transaction.unbalanced")
+ "<br/><br/><a href='#financialtransactionunbalanced'>"
- + _("lima.home.transaction.modifiy.unbalanced") + "</a>";
+ + _("lima.ui.home.transaction.modifiy.unbalanced") + "</a>";
//set Text
setText(htmlBegin + transactionsString + htmlEnd);
} else {
@@ -126,25 +118,25 @@
financialTransactionService.getAllFinancialTransactionsBalanced(unblockedFiscalPeriods.get(0));
if (financialTransactionsBal.size() > 0) {
- setBackground(greenBackground);
+ setBackground(GREEN_BACKGROUND);
String transactionsString = financialTransactionsBal.size()
- + " " + _("lima.home.transaction.balanced")
+ + " " + _("lima.ui.home.transaction.balanced")
+ "<br/><br/><a href='#financialtransactionbalanced'>"
- + _("lima.home.transaction.modifiy.balanced") + "</a>";
+ + _("lima.ui.home.transaction.modifiy.balanced") + "</a>";
//set Text
setText(htmlBegin + transactionsString + htmlEnd);
} else {
- setBackground(redBackground);
- String transactionsString = _("lima.home.transaction.nothing")
+ setBackground(RED_BACKGROUND);
+ String transactionsString = _("lima.ui.home.transaction.nothing")
+ "<br/><br/><a href='#financialtransactionbalanced'>"
- + _("lima.home.transaction.create") + "</a>";
+ + _("lima.ui.home.transaction.create") + "</a>";
//set Text
setText(htmlBegin + transactionsString + htmlEnd);
}
}
} else {
- setBackground(redBackground);
+ setBackground(RED_BACKGROUND);
}
} catch (LimaException eee) {
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/FiscalPeriodsPane.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/FiscalPeriodsPane.java 2012-04-06 10:07:48 UTC (rev 3355)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/FiscalPeriodsPane.java 2012-04-06 14:32:57 UTC (rev 3356)
@@ -25,6 +25,12 @@
package org.chorem.lima.ui.home;
+import static org.nuiton.i18n.I18n._;
+
+import java.util.List;
+
+import javax.swing.event.HyperlinkEvent;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.LimaContext;
@@ -37,50 +43,42 @@
import org.chorem.lima.service.LimaServiceFactory;
import org.chorem.lima.ui.MainView;
-import javax.swing.JEditorPane;
-import javax.swing.event.HyperlinkEvent;
-import javax.swing.event.HyperlinkListener;
-import javax.swing.plaf.basic.BasicEditorPaneUI;
-import java.awt.Color;
-import java.util.List;
+/**
+ * Panenl de la home view de lima qui affiche les statistiques de
+ * l'exercice en cours.
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * By : $Author$
+ */
+public class FiscalPeriodsPane extends AbstractHomePane implements ServiceListener {
-import static org.nuiton.i18n.I18n._;
-
-public class FiscalPeriodsPane extends JEditorPane implements HyperlinkListener, ServiceListener {
-
private static final long serialVersionUID = 1L;
private static final Log log = LogFactory.getLog(FiscalPeriodsPane.class);
- protected HomeView view;
-
protected FiscalPeriodService fiscalPeriodService;
- private static Color redBackground = new Color(0xff, 0xee, 0xee);
-
- private static Color greenBackground = new Color(0xee, 0xff, 0xee);
-
+ /**
+ * Constructors (init services).
+ *
+ * @param view home view
+ */
public FiscalPeriodsPane(HomeView view) {
- this.view = view;
+ super(view);
- fiscalPeriodService =
- LimaServiceFactory.getService(FiscalPeriodServiceMonitorable.class);
- LimaServiceFactory.addServiceListener(fiscalPeriodService, this);
+ fiscalPeriodService = LimaServiceFactory.getService(FiscalPeriodServiceMonitorable.class);
+ LimaServiceFactory.addServiceListener(FiscalPeriodServiceMonitorable.class, this);
LimaServiceFactory.addServiceListener(ImportServiceMonitorable.class, this);
- //init
- setOpaque(true);
- setContentType("text/html");
- setEditable(false);
- setUI(new BasicEditorPaneUI());
- addHyperlinkListener(this);
refresh();
}
@Override
public void hyperlinkUpdate(HyperlinkEvent e) {
if (HyperlinkEvent.EventType.ACTIVATED.equals(e.getEventType())) {
-
if (e.getDescription().equals("#fiscalperiodschart")) {
MainView ui = LimaContext.MAIN_UI_ENTRY_DEF.getContextValue(view);
ui.getHandler().showFiscalPeriodView(ui);
@@ -102,26 +100,26 @@
List<FiscalPeriod> unblockedFiscalPeriods =
fiscalPeriodService.getAllUnblockedFiscalPeriods();
if (unblockedFiscalPeriods.size() > 0) {
- setBackground(greenBackground);
+ setBackground(GREEN_BACKGROUND);
String fiscalString = unblockedFiscalPeriods.size() + " "
- + _("lima.home.fiscalperiod.opened") + "<br/>"
+ + _("lima.ui.home.fiscalperiod.opened") + "<br/>"
+ (fiscalPeriods.size() - unblockedFiscalPeriods.size())
- + " " + _("lima.home.fiscalperiod.closed")
+ + " " + _("lima.ui.home.fiscalperiod.closed")
+ "<br/><br/><a href='#fiscalperiodschart'>"
- + _("lima.home.fiscalperiod.modify") + "</a>";
+ + _("lima.ui.home.fiscalperiod.modify") + "</a>";
//set Text
setText(htmlBegin + fiscalString + htmlEnd);
} else {
- setBackground(redBackground);
- String fiscalString = _("lima.home.fiscalperiod.noopen");
+ setBackground(RED_BACKGROUND);
+ String fiscalString = _("lima.ui.home.fiscalperiod.noopen");
if (fiscalPeriods.size() > 0) {
fiscalString += "<br/>" + fiscalPeriods.size() + " "
- + _("lima.home.fiscalperiod.closed");
+ + _("lima.ui.home.fiscalperiod.closed");
}
fiscalString += "<br/><br/><a href='#fiscalperiodschart'>"
- + _("lima.home.fiscalperiod.create") + "</a>";
+ + _("lima.ui.home.fiscalperiod.create") + "</a>";
//set Text
setText(htmlBegin + fiscalString + htmlEnd);
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/HomeView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/HomeView.jaxx 2012-04-06 10:07:48 UTC (rev 3355)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/HomeView.jaxx 2012-04-06 14:32:57 UTC (rev 3356)
@@ -5,7 +5,7 @@
$Id$
$HeadURL$
%%
- Copyright (C) 2008 - 2010 CodeLutin
+ Copyright (C) 2008 - 2012 CodeLutin, Chatellier Eric
%%
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as
@@ -22,7 +22,6 @@
<http://www.gnu.org/licenses/gpl-3.0.html>.
#L%
-->
-
<Table>
<import>
java.awt.Color
@@ -38,8 +37,7 @@
<row>
<cell anchor="southeast">
- <JPanel
- id='accountPanel'
+ <JPanel id='accountPanel'
border='{BorderFactory.createEtchedBorder(EtchedBorder.LOWERED)}'
minimumSize='{getMiniSize()}'
preferredSize='{getFixedSize()}'
@@ -47,27 +45,24 @@
<Table>
<row>
<cell weightx="0" weighty="0.1" anchor="northwest">
- <JLabel
- icon='accounts.png'/>
+ <JLabel icon='accounts.png'/>
</cell>
<cell weightx="1" weighty="0.1" anchor="center">
<JLabel foreground='{Color.DARK_GRAY}'
font='{new Font("sans-serif", Font.BOLD, 16)}'
- text='lima.charts.account'/>
+ text='lima.ui.home.account'/>
</cell>
</row>
<row fill="both">
<cell columns="2" weightx="1" weighty="0.9">
- <JEditorPane
- javaBean='new AccountsPane(this)'/>
+ <JEditorPane initializer='new AccountsPane(this)'/>
</cell>
</row>
</Table>
</JPanel>
</cell>
<cell anchor="southwest">
- <JPanel
- id='entryBookPanel'
+ <JPanel id='entryBookPanel'
border='{BorderFactory.createEtchedBorder(EtchedBorder.LOWERED)}'
minimumSize='{getMiniSize()}'
preferredSize='{getFixedSize()}'
@@ -75,19 +70,17 @@
<Table>
<row>
<cell weightx="0" weighty="0.1" anchor="northwest">
- <JLabel
- icon='entrybooks.png'/>
+ <JLabel icon='entrybooks.png'/>
</cell>
<cell weightx="1" weighty="0.1" anchor="center">
<JLabel foreground='{Color.DARK_GRAY}'
font='{new Font("sans-serif", Font.BOLD, 16)}'
- text='lima.common.entrybooks'/>
+ text='lima.ui.home.entrybooks'/>
</cell>
</row>
<row fill="both">
<cell columns="2" weightx="1" weighty="0.9">
- <JEditorPane
- javaBean='new EntryBooksPane(this)'/>
+ <JEditorPane initializer='new EntryBooksPane(this)'/>
</cell>
</row>
</Table>
@@ -96,8 +89,7 @@
</row>
<row>
<cell anchor="northeast">
- <JPanel
- id='fiscalPeriodPanel'
+ <JPanel id='fiscalPeriodPanel'
border='{BorderFactory.createEtchedBorder(EtchedBorder.LOWERED)}'
minimumSize='{getMiniSize()}'
preferredSize='{getFixedSize()}'
@@ -105,27 +97,24 @@
<Table>
<row>
<cell weightx="0" weighty="0.1" anchor="northwest">
- <JLabel
- icon='fiscalperiods.png'/>
+ <JLabel icon='fiscalperiods.png'/>
</cell>
<cell weightx="1" weighty="0.1" anchor="center">
<JLabel foreground='{Color.DARK_GRAY}'
font='{new Font("sans-serif", Font.BOLD, 16)}'
- text='lima.charts.fiscalyear'/>
+ text='lima.ui.home.fiscalyear'/>
</cell>
</row>
<row fill="both">
<cell columns="2" weightx="1" weighty="0.9">
- <JEditorPane
- javaBean='new FiscalPeriodsPane(this)'/>
+ <JEditorPane initializer='new FiscalPeriodsPane(this)'/>
</cell>
</row>
</Table>
</JPanel>
</cell>
<cell anchor="northwest">
- <JPanel
- id='financialTransactionPanel'
+ <JPanel id='financialTransactionPanel'
border='{BorderFactory.createEtchedBorder(EtchedBorder.LOWERED)}'
minimumSize='{getMiniSize()}'
preferredSize='{getFixedSize()}'
@@ -133,13 +122,12 @@
<Table>
<row>
<cell weightx="0" weighty="0.1" anchor="northwest">
- <JLabel
- icon='entries.png'/>
+ <JLabel icon='entries.png'/>
</cell>
<cell weightx="1" weighty="0.1" anchor="center">
<JLabel foreground='{Color.DARK_GRAY}'
font='{new Font("sans-serif", Font.BOLD, 16)}'
- text='lima.daily'/>
+ text='lima.ui.home.daily'/>
</cell>
</row>
<row fill="both">
Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/package-info.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/package-info.java (rev 0)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/package-info.java 2012-04-06 14:32:57 UTC (rev 3356)
@@ -0,0 +1,29 @@
+/*
+ * #%L
+ *
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Codelutin, Chatellier Eric
+ * %%
+ * 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>.
+ * #L%
+ */
+/**
+ * Contient l'onglet d'acceuil de lima avec les statistiques de la
+ * comptabilite.
+ */
+package org.chorem.lima.ui.home;
Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/package-info.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateAccountsPanel.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateAccountsPanel.jaxx 2012-04-06 10:07:48 UTC (rev 3355)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateAccountsPanel.jaxx 2012-04-06 14:32:57 UTC (rev 3356)
@@ -5,7 +5,7 @@
$Id$
$HeadURL$
%%
- Copyright (C) 2008 - 2010 CodeLutin
+ Copyright (C) 2008 - 2012 CodeLutin, Chatellier Eric
%%
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as
@@ -22,14 +22,12 @@
<http://www.gnu.org/licenses/gpl-3.0.html>.
#L%
-->
-
<JPanel>
<import>
- jaxx.runtime.swing.JAXXButtonGroup
org.chorem.lima.enums.AccountsChartEnum
</import>
- <JAXXButtonGroup id="radioButtons"/>
+ <javax.swing.ButtonGroup id="buttonGroup"/>
<Table>
<row>
@@ -41,7 +39,7 @@
<cell>
<JRadioButton text='lima.charts.account.shortened'
value='{AccountsChartEnum.SHORTENED}'
- buttonGroup="{getRadioButtons()}"
+ buttonGroup="{buttonGroup}"
selected='true'/>
</cell>
</row>
@@ -49,33 +47,29 @@
<cell>
<JRadioButton text='lima.charts.account.base'
value='{AccountsChartEnum.BASE}'
- buttonGroup="{getRadioButtons()}"
- selected='true'/>
+ buttonGroup="{buttonGroup}"/>
</cell>
</row>
<row>
<cell>
<JRadioButton text='lima.charts.account.developed'
value='{AccountsChartEnum.DEVELOPED}'
- buttonGroup="{getRadioButtons()}"
- selected='true'/>
+ buttonGroup="{buttonGroup}"/>
</cell>
</row>
<row>
<cell>
<JRadioButton text='lima.importexport.importcsv'
value='{AccountsChartEnum.IMPORT}'
- buttonGroup="{getRadioButtons()}"
- selected='true'/>
+ buttonGroup="{buttonGroup}"/>
</cell>
</row>
<row>
<cell>
<JRadioButton text='lima.importexport.importebp'
value='{AccountsChartEnum.IMPORTEBP}'
- buttonGroup="{getRadioButtons()}"
- selected='true'/>
+ buttonGroup="{buttonGroup}"/>
</cell>
</row>
</Table>
-</JPanel>
\ No newline at end of file
+</JPanel>
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateEntryBookPanel.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateEntryBookPanel.jaxx 2012-04-06 10:07:48 UTC (rev 3355)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateEntryBookPanel.jaxx 2012-04-06 14:32:57 UTC (rev 3356)
@@ -5,7 +5,7 @@
$Id$
$HeadURL$
%%
- Copyright (C) 2008 - 2010 CodeLutin
+ Copyright (C) 2008 - 2012 CodeLutin, Chatellier Eric
%%
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as
@@ -22,7 +22,6 @@
<http://www.gnu.org/licenses/gpl-3.0.html>.
#L%
-->
-
<JPanel>
<Table>
<row>
@@ -37,4 +36,4 @@
</cell>
</row>
</Table>
-</JPanel>
\ No newline at end of file
+</JPanel>
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateFiscalPeriodPanel.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateFiscalPeriodPanel.jaxx 2012-04-06 10:07:48 UTC (rev 3355)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateFiscalPeriodPanel.jaxx 2012-04-06 14:32:57 UTC (rev 3356)
@@ -90,4 +90,4 @@
</cell>
</row>
</Table>
-</JPanel>
\ No newline at end of file
+</JPanel>
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateIdentityPanel.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateIdentityPanel.jaxx 2012-04-06 10:07:48 UTC (rev 3355)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateIdentityPanel.jaxx 2012-04-06 14:32:57 UTC (rev 3356)
@@ -5,7 +5,7 @@
$Id$
$HeadURL$
%%
- Copyright (C) 2008 - 2010 CodeLutin
+ Copyright (C) 2008 - 2012 CodeLutin, Chatellier Eric
%%
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as
@@ -22,7 +22,6 @@
<http://www.gnu.org/licenses/gpl-3.0.html>.
#L%
-->
-
<JPanel>
<import>
javax.swing.text.Document
@@ -30,14 +29,9 @@
org.chorem.lima.ui.identity.IdentityHandler
</import>
- <IdentityHandler id="handler"
- javaBean="new org.chorem.lima.ui.identity.IdentityHandler()"/>
+ <IdentityHandler id="handler" javaBean="new IdentityHandler()"/>
<Identity id="identity" javaBean='handler.getIdentity()'/>
- <script>
- <![CDATA[
- ]]>
- </script>
<Table>
<row>
<cell fill="horizontal">
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/OpeningView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/OpeningView.jaxx 2012-04-06 10:07:48 UTC (rev 3355)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/OpeningView.jaxx 2012-04-06 14:32:57 UTC (rev 3356)
@@ -5,7 +5,7 @@
$Id$
$HeadURL$
%%
- Copyright (C) 2008 - 2010 CodeLutin
+ Copyright (C) 2008 - 2012 CodeLutin, Chatellier Eric
%%
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/OpeningViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/OpeningViewHandler.java 2012-04-06 10:07:48 UTC (rev 3355)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/OpeningViewHandler.java 2012-04-06 14:32:57 UTC (rev 3356)
@@ -111,7 +111,7 @@
break;
case 2:
- Object value = caPanel.getRadioButtons().getSelectedValue();
+ Object value = caPanel.getButtonGroup().getSelectedValue();
// if action confirmed
if (value != null) {
AccountsChartEnum defaultAccountsChartEnum =
Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/package-info.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/package-info.java (rev 0)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/package-info.java 2012-04-06 14:32:57 UTC (rev 3356)
@@ -0,0 +1,30 @@
+/*
+ * #%L
+ *
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Codelutin, Chatellier Eric
+ * %%
+ * 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>.
+ * #L%
+ */
+/**
+ * Contient l'assisant d'importation de comptabilité
+ * au premier lancement de lima.
+ * Creation d'identité, etc...
+ */
+package org.chorem.lima.ui.opening;
Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/package-info.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
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 2012-04-06 10:07:48 UTC (rev 3355)
+++ trunk/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties 2012-04-06 14:32:57 UTC (rev 3356)
@@ -305,6 +305,32 @@
lima.ui.fiscalperiod.closure=
lima.ui.fiscalperiod.fiscalperiod=
lima.ui.fiscalperiod.open=
+lima.ui.home.account=
+lima.ui.home.chartaccounts.create=
+lima.ui.home.chartaccounts.modify=
+lima.ui.home.chartaccounts.nothing=
+lima.ui.home.chartaccounts.state1_2=
+lima.ui.home.chartaccounts.state2_2=
+lima.ui.home.daily=
+lima.ui.home.entrybooks=
+lima.ui.home.entrybooks.create=
+lima.ui.home.entrybooks.modify=
+lima.ui.home.entrybooks.nothing=
+lima.ui.home.entrybooks.state.single=
+lima.ui.home.entrybooks.state1_2.plural=
+lima.ui.home.entrybooks.state2_2.plural=
+lima.ui.home.fiscalperiod.closed=
+lima.ui.home.fiscalperiod.create=
+lima.ui.home.fiscalperiod.modify=
+lima.ui.home.fiscalperiod.noopen=
+lima.ui.home.fiscalperiod.opened=
+lima.ui.home.fiscalyear=
+lima.ui.home.transaction.balanced=
+lima.ui.home.transaction.create=
+lima.ui.home.transaction.modifiy.balanced=
+lima.ui.home.transaction.modifiy.unbalanced=
+lima.ui.home.transaction.nothing=
+lima.ui.home.transaction.unbalanced=
lima.ui.importexport.importcsv=
lima.ui.importexport.importebp=
lima.vatreport.listerror=Can't get entries list
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 2012-04-06 10:07:48 UTC (rev 3355)
+++ trunk/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties 2012-04-06 14:32:57 UTC (rev 3356)
@@ -149,28 +149,8 @@
lima.fiscalperiod.creationerror=Erreur lors de la création de la période fiscale
lima.fiscalperiod.listerror=Erreur lors de la récupération des données de la liste
lima.fiscalperiod.unbalancedtransactions=La période fiscale contient des transactions non équilibrées
-lima.home.chartaccounts.create=Créer le plan des comptes
-lima.home.chartaccounts.modify=Modifier le plan des comptes
-lima.home.chartaccounts.nothing=Aucun compte \!
-lima.home.chartaccounts.state1_2=Le plan comptable possede
-lima.home.chartaccounts.state2_2=comptes
-lima.home.entrybooks.create=Créer les journaux
-lima.home.entrybooks.modify=Modifier les journaux
-lima.home.entrybooks.nothing=Aucun journal ouvert \!
-lima.home.entrybooks.state.single=Le journal est \:
-lima.home.entrybooks.state1_2.plural=Les
-lima.home.entrybooks.state2_2.plural=journaux sont \:
-lima.home.fiscalperiod.closed=exercices cloturés
-lima.home.fiscalperiod.create=Créer un exercice
-lima.home.fiscalperiod.modify=Modifier les exercices
-lima.home.fiscalperiod.noopen=Aucun exercice ouvert \!
-lima.home.fiscalperiod.opened=exercices ouverts
-lima.home.transaction.balanced=transactions, toutes sont équilibrées
-lima.home.transaction.create=Ajouter des écritures
-lima.home.transaction.modifiy.balanced=Modifier les écritures
-lima.home.transaction.modifiy.unbalanced=Modifier les écritures incorrectes
-lima.home.transaction.nothing=Aucune écriture
-lima.home.transaction.unbalanced=transactions ne sont pas équilibrées \!
+lima.home.chartaccounts.state2_2=
+lima.home.entrybooks.create=
lima.identity=Identité
lima.identity.address=Adresse
lima.identity.address2=Adresse (suite)
@@ -304,6 +284,32 @@
lima.ui.fiscalperiod.closure=Cloture
lima.ui.fiscalperiod.fiscalperiod=Exercice
lima.ui.fiscalperiod.open=Ouvert
+lima.ui.home.account=Plan comptable
+lima.ui.home.chartaccounts.create=Créer le plan des comptes
+lima.ui.home.chartaccounts.modify=Modifier le plan des comptes
+lima.ui.home.chartaccounts.nothing=Aucun compte \!
+lima.ui.home.chartaccounts.state1_2=Le plan comptable possede
+lima.ui.home.chartaccounts.state2_2=comptes
+lima.ui.home.daily=Quotidien
+lima.ui.home.entrybooks=Journaux
+lima.ui.home.entrybooks.create=Créer les journaux
+lima.ui.home.entrybooks.modify=Modifier les journaux
+lima.ui.home.entrybooks.nothing=Aucun journal ouvert \!
+lima.ui.home.entrybooks.state.single=Le journal est \:
+lima.ui.home.entrybooks.state1_2.plural=Les
+lima.ui.home.entrybooks.state2_2.plural=journaux sont \:
+lima.ui.home.fiscalperiod.closed=exercices cloturés
+lima.ui.home.fiscalperiod.create=Créer un exercice
+lima.ui.home.fiscalperiod.modify=Modifier les exercices
+lima.ui.home.fiscalperiod.noopen=Aucun exercice ouvert \!
+lima.ui.home.fiscalperiod.opened=exercices ouverts
+lima.ui.home.fiscalyear=Exercices
+lima.ui.home.transaction.balanced=transactions, toutes sont équilibrées
+lima.ui.home.transaction.create=Ajouter des écritures
+lima.ui.home.transaction.modifiy.balanced=Modifier les écritures
+lima.ui.home.transaction.modifiy.unbalanced=Modifier les écritures incorrectes
+lima.ui.home.transaction.nothing=Aucune écriture
+lima.ui.home.transaction.unbalanced=transactions ne sont pas équilibrées \!
lima.ui.importexport.importcsv=Import/Export CSV
lima.ui.importexport.importebp=Import/Export EBP
lima.vatreport.listerror=Erreur lors de la récupération des données de la liste
1
0
r3355 - in trunk/lima-swing/src/main: java/org/chorem/lima/ui/fiscalperiod resources/i18n
by echatellier@users.chorem.org 06 Apr '12
by echatellier@users.chorem.org 06 Apr '12
06 Apr '12
Author: echatellier
Date: 2012-04-06 12:07:48 +0200 (Fri, 06 Apr 2012)
New Revision: 3355
Url: http://chorem.org/repositories/revision/lima/3355
Log:
Debut du refactoring de gestion des exercices (le report ?\195?\160 nouveau est encore a gerer et ?\195?\160 d?\195?\169placer dans les services).
Added:
trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/EntryBookListRenderer.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/package-info.java
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/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/fiscalperiod/FiscalPeriodView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/RetainedEarningsEntryBookForm.jaxx
trunk/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties
trunk/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/AddPeriod.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/AddPeriod.jaxx 2012-04-05 14:09:35 UTC (rev 3354)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/AddPeriod.jaxx 2012-04-06 10:07:48 UTC (rev 3355)
@@ -22,84 +22,44 @@
<http://www.gnu.org/licenses/gpl-3.0.html>.
#L%
-->
-<JDialog modal="true"
+<JDialog title="lima.ui.fiscalperiod.addfiscalperiodtitle" modal="true"
defaultCloseOperation="{JDialog.DO_NOTHING_ON_CLOSE}"
onWindowClosing="performCancel();">
<import>
- java.util.Date
- java.util.Calendar
- org.apache.commons.lang3.time.DateUtils
- org.jdesktop.swingx.JXDatePicker
- org.chorem.lima.entity.FiscalPeriodImpl
org.chorem.lima.entity.FiscalPeriod
- org.chorem.lima.business.LimaException
- org.chorem.lima.business.monitorable.FiscalPeriodServiceMonitorable
- org.chorem.lima.service.LimaServiceFactory
- org.chorem.lima.ui.fiscalperiod.FiscalPeriodTableModel
</import>
+
+ <FiscalPeriodViewHandler id='handler' initializer='getContextValue(FiscalPeriodView.class,JAXXUtil.PARENT).getHandler()'/>
+
<FiscalPeriodTableModel id="modelFiscalPeriodTable"/>
+
+ <FiscalPeriod id="period" javaBean="new org.chorem.lima.entity.FiscalPeriodImpl()"/>
+
<script>
<![CDATA[
-
- getRootPane().setDefaultButton(okButton);
-
- protected FiscalPeriodServiceMonitorable fiscalPeriodService =
- LimaServiceFactory.getService(
- FiscalPeriodServiceMonitorable.class);
-
- // set begin date picker
- Date endDate = null;
- Calendar calendarBegin = Calendar.getInstance();
- // set begindate to JAN 1 - 0:00.000 of this years
- Date beginDate = calendarBegin.getTime();
- beginDate = DateUtils.truncate(beginDate, Calendar.DATE);
- try {
- FiscalPeriod result = fiscalPeriodService.getLastFiscalPeriod();
- if (result != null){
- beginDate = result.getEndDate();
- }
+ public void $afterCompleteSetup() {
+ getHandler().init(this);
}
- catch (LimaException eee){
- if(log.isDebugEnabled()){
- log.debug("Can't get last fiscal period", eee);
- }
- }
- beginDate = DateUtils.addDays(beginDate, 1);
- getBeginDatePicker().setDate(beginDate);
-
- // get end date
- Calendar calendarEnd = Calendar.getInstance();
- endDate = DateUtils.addYears(beginDate, 1);
- endDate = DateUtils.addDays(endDate, -1);
- getEndDatePicker().setDate(endDate);
-
protected void performOk() {
- if (period == null) {
- // FIXME never ever use IMPL !!!
- setPeriod(new FiscalPeriodImpl());
- }
getPeriod().setBeginDate(beginDatePicker.getDate());
getPeriod().setEndDate(endDatePicker.getDate());
dispose();
}
-
+
protected void performCancel() {
setPeriod(null);
dispose();
}
- ]]>
- </script>
+ ]]></script>
- <FiscalPeriod id="period" javaBean="null"/>
-
<Table fill="both">
<row>
<cell>
<JLabel text="lima.common.begindate"/>
</cell>
<cell>
- <JXDatePicker id="beginDatePicker"/>
+ <org.jdesktop.swingx.JXDatePicker id="beginDatePicker"/>
</cell>
</row>
<row>
@@ -107,7 +67,7 @@
<JLabel text="lima.common.enddate"/>
</cell>
<cell>
- <JXDatePicker id="endDatePicker"/>
+ <org.jdesktop.swingx.JXDatePicker id="endDatePicker"/>
</cell>
</row>
<row>
Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/EntryBookListRenderer.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/EntryBookListRenderer.java (rev 0)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/EntryBookListRenderer.java 2012-04-06 10:07:48 UTC (rev 3355)
@@ -0,0 +1,62 @@
+/*
+ * #%L
+ *
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Codelutin, Chatellier Eric
+ * %%
+ * 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>.
+ * #L%
+ */
+
+package org.chorem.lima.ui.fiscalperiod;
+
+import java.awt.Component;
+
+import javax.swing.DefaultListCellRenderer;
+import javax.swing.JList;
+
+import org.chorem.lima.entity.EntryBook;
+
+/**
+ * EntryBook renderer for fiscal period retaining earning list.
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * By : $Author$
+ */
+public class EntryBookListRenderer extends DefaultListCellRenderer {
+
+ /** serialVersionUID. */
+ private static final long serialVersionUID = -9089182547408397051L;
+
+ @Override
+ public Component getListCellRendererComponent(JList list, Object value,
+ int index, boolean isSelected, boolean cellHasFocus) {
+
+ EntryBook entryBook = (EntryBook)value;
+ Object newValue = entryBook;
+ if (entryBook != null) {
+ newValue = entryBook.getCode() + " - " + entryBook.getLabel();
+ }
+ return super.getListCellRendererComponent(list, value, index, isSelected,
+ cellHasFocus);
+ }
+
+}
Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/EntryBookListRenderer.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
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 2012-04-05 14:09:35 UTC (rev 3354)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodTable.java 2012-04-06 10:07:48 UTC (rev 3355)
@@ -5,7 +5,7 @@
* $Id$
* $HeadURL$
* %%
- * Copyright (C) 2008 - 2010 CodeLutin
+ * Copyright (C) 2008 - 2012 CodeLutin, Chatellier Eric
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
@@ -39,6 +39,23 @@
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
+import javax.swing.table.TableModel;
+
+/**
+ * Fiscal period table add support for JXTable.
+ *
+ * Including:
+ * <ul>
+ * <li>Locked period red highlight
+ * <li>
+ * </ul>
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * By : $Author$
+ */
public class FiscalPeriodTable extends JXTable
implements KeyListener, MouseListener {
@@ -50,26 +67,28 @@
private Highlighter colorTransaction;
- public FiscalPeriodTable(FiscalPeriodViewHandler handler) {
-
+ public FiscalPeriodTable(FiscalPeriodTableModel model) {
+ super(model);
+ this.model = model;
this.handler = handler;
addKeyListener(this);
addMouseListener(this);
- model = this.handler.getView().getModelFiscalPeriodTable();
-
- //highlight financial financial transactions
+ // highlight financial financial transactions
addBlockColor();
}
+ /**
+ * Highlight locked period in RED.
+ */
protected void addBlockColor() {
+
HighlightPredicate predicate = new HighlightPredicate() {
@Override
public boolean isHighlighted(Component renderer,
ComponentAdapter adapter) {
- FiscalPeriod fiscalPeriod = (FiscalPeriod) model.getElementAt(adapter.row);
- // true if locked
+ FiscalPeriod fiscalPeriod = model.getFiscalPeriodAt(adapter.row);
return fiscalPeriod.getLocked();
}
};
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 2012-04-05 14:09:35 UTC (rev 3354)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodTableModel.java 2012-04-06 10:07:48 UTC (rev 3355)
@@ -25,34 +25,18 @@
package org.chorem.lima.ui.fiscalperiod;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.chorem.lima.business.LimaException;
-import org.chorem.lima.business.ServiceListener;
-import org.chorem.lima.business.ejbinterface.FinancialTransactionService;
-import org.chorem.lima.business.ejbinterface.FiscalPeriodService;
-import org.chorem.lima.business.monitorable.FinancialTransactionServiceMonitorable;
-import org.chorem.lima.business.monitorable.FiscalPeriodServiceMonitorable;
-import org.chorem.lima.business.monitorable.ImportServiceMonitorable;
-import org.chorem.lima.business.utils.FiscalPeriodComparator;
-import org.chorem.lima.entity.FinancialTransaction;
-import org.chorem.lima.entity.FiscalPeriod;
-import org.chorem.lima.service.LimaServiceFactory;
-import org.chorem.lima.util.ErrorHelper;
-import org.nuiton.util.Resource;
+import static org.nuiton.i18n.I18n._;
-import javax.swing.JFrame;
-import javax.swing.JOptionPane;
-import javax.swing.table.AbstractTableModel;
import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Collections;
import java.util.List;
-import static org.nuiton.i18n.I18n._;
+import javax.swing.table.AbstractTableModel;
+import org.chorem.lima.business.LimaException;
+import org.chorem.lima.entity.FiscalPeriod;
+
/**
- * TODO add comment here.
+ * Modele de Fiscal period (rendu de list)
*
* @author chatellier
* @version $Revision$
@@ -60,62 +44,24 @@
* Last update : $Date$
* By : $Author$
*/
-public class FiscalPeriodTableModel extends AbstractTableModel implements ServiceListener {
+public class FiscalPeriodTableModel extends AbstractTableModel {
/** serialVersionUID. */
private static final long serialVersionUID = 77027335135838258L;
- private static final Log log = LogFactory.getLog(FiscalPeriodTableModel.class);
+ protected List<FiscalPeriod> fiscalPeriods;
- protected FiscalPeriodService fiscalPeriodService;
-
- protected FinancialTransactionService financialTransactionService;
-
- /** data cache */
- protected List<?> cacheDataList;
-
- public FiscalPeriodTableModel() {
- fiscalPeriodService =
- LimaServiceFactory.getService(
- FiscalPeriodServiceMonitorable.class);
- LimaServiceFactory.addServiceListener(fiscalPeriodService, this);
- LimaServiceFactory.addServiceListener(ImportServiceMonitorable.class, this);
- financialTransactionService =
- LimaServiceFactory.getService(
- FinancialTransactionServiceMonitorable.class);
- LimaServiceFactory.addServiceListener(financialTransactionService, this);
- cacheDataList = null;
- }
-
- protected List<Object> getDataList() {
- List<Object> results = new ArrayList<Object>();
- try {
- List<FiscalPeriod> fiscalPeriod =
- fiscalPeriodService.getAllFiscalPeriods();
- Collections.sort(fiscalPeriod, new FiscalPeriodComparator());
- results.addAll(fiscalPeriod);
- } catch (LimaException eee) {
- if (log.isErrorEnabled()) {
- log.error("Can't update model", eee);
- }
- ErrorHelper.showErrorDialog(_("lima.fiscalperiod.listerror"), eee);
- }
- return results;
- }
-
- public void refresh() {
- cacheDataList = getDataList();
+ public void setFiscalPeriods(List<FiscalPeriod> fiscalPeriods) {
+ this.fiscalPeriods = fiscalPeriods;
fireTableDataChanged();
}
@Override
public int getRowCount() {
int result = 0;
-
- if (cacheDataList != null) {
- result = cacheDataList.size();
+ if (fiscalPeriods != null) {
+ result = fiscalPeriods.size();
}
-
return result;
}
@@ -124,16 +70,9 @@
return 2;
}
-
- public Object getElementAt(int row) {
-
- Object currentRow = null;
-
- if (cacheDataList != null) {
- currentRow = cacheDataList.get(row);
- }
-
- return currentRow;
+ public FiscalPeriod getFiscalPeriodAt(int row) {
+ FiscalPeriod result = fiscalPeriods.get(row);
+ return result;
}
@Override
@@ -143,10 +82,10 @@
switch (columnIndex) {
case 0:
- result = _("lima.table.fiscalperiod");
+ result = _("lima.ui.fiscalperiod.fiscalperiod");
break;
case 1:
- result = _("lima.table.closure");
+ result = _("lima.ui.fiscalperiod.closure");
break;
}
@@ -154,27 +93,14 @@
}
@Override
- public Class<?> getColumnClass(int columnIndex) {
- // both String
- return String.class;
- }
-
-
- @Override
- public boolean isCellEditable(int rowIndex, int columnIndex) {
- return false;
- }
-
- @Override
public Object getValueAt(int rowIndex, int columnIndex) {
Object result = "n/a";
- List<?> periods;
- periods = cacheDataList;
- FiscalPeriod fiscalPeriod = (FiscalPeriod) periods.get(rowIndex);
+ FiscalPeriod fiscalPeriod = getFiscalPeriodAt(rowIndex);
if (fiscalPeriod != null) {
+ // FIXME echatellier 20120405 i18n problem (hard coded)
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd MMM yyyy");
switch (columnIndex) {
@@ -186,9 +112,9 @@
break;
case 1:
if (fiscalPeriod.getLocked()) {
- result = _("lima.common.closed");
+ result = _("lima.ui.fiscalperiod.closed");
} else {
- result = _("lima.common.open");
+ result = _("lima.ui.fiscalperiod.open");
}
break;
}
@@ -197,35 +123,14 @@
return result;
}
- public FiscalPeriod getFiscalPeriodAtRow(int row) throws LimaException {
- FiscalPeriod fiscalPeriod;
- fiscalPeriod = (FiscalPeriod) cacheDataList.get(row);
- return fiscalPeriod;
+ public void addFiscalPeriod(FiscalPeriod fiscalPeriod) {
+ fiscalPeriods.add(fiscalPeriod);
+ int row = fiscalPeriods.indexOf(fiscalPeriod);
+ fireTableRowsInserted(row, row);
}
- /**
- * @param period
- * @throws LimaException
- */
- public void addFiscalPeriod(FiscalPeriod period) throws LimaException {
-
- try {
- // Calling fiscal period service
- fiscalPeriodService.createFiscalPeriod(period);
- //on recharge la liste
- cacheDataList = getDataList();
- int row = getDataList().indexOf(period);
- fireTableRowsInserted(row, row);
- } catch (LimaException eee) {
- if (log.isErrorEnabled()) {
- log.error("Can't create FiscalPeriod", eee);
- }
- ErrorHelper.showErrorDialog(_("lima.fiscalperiod.creationerror"), eee);
- }
- }
-
- public void blockFiscalPeriod(FiscalPeriod fiscalPeriod) throws LimaException {
- List<FinancialTransaction> financialTransactionsUnbal =
+ public void updateFiscalPeriod(FiscalPeriod fiscalPeriod) throws LimaException {
+ /*List<FinancialTransaction> financialTransactionsUnbal =
financialTransactionService.getAllInexactFinancialTransactions(fiscalPeriod);
if (financialTransactionsUnbal.size() > 0) {
JFrame f = new JFrame();
@@ -239,14 +144,8 @@
} else {
fiscalPeriodService.blockFiscalPeriod(fiscalPeriod);
refresh();
- }
+ }*/
+ int row = fiscalPeriods.indexOf(fiscalPeriod);
+ fireTableRowsInserted(row, row);
}
-
- @Override
- public void notifyMethod(String serviceName, String methodeName) {
- //refresh on import datas
- if (methodeName.contains("importAll")) {
- refresh();
- }
- }
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodView.jaxx 2012-04-05 14:09:35 UTC (rev 3354)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodView.jaxx 2012-04-06 10:07:48 UTC (rev 3355)
@@ -5,7 +5,7 @@
$Id$
$HeadURL$
%%
- Copyright (C) 2008 - 2010 CodeLutin
+ Copyright (C) 2008 - 2012 CodeLutin, Chatellier Eric
%%
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as
@@ -29,29 +29,24 @@
javax.swing.ListSelectionModel
org.chorem.lima.entity.FiscalPeriod
org.chorem.lima.entity.FinancialPeriod
- org.chorem.lima.ui.fiscalperiod.FiscalPeriodTable
- org.chorem.lima.ui.fiscalperiod.FiscalPeriodTableModel
</import>
- <FiscalPeriodViewHandler id="handler"
- javaBean="new FiscalPeriodViewHandler(this)"/>
+
+ <FiscalPeriodViewHandler id="handler" constructorParams="this"/>
<Boolean id="selectedPeriod" javaBean="false"/>
- <script>
- <![CDATA[
+ <script><![CDATA[
void $afterCompleteSetup() {
- getHandler().refresh();
+ getHandler().init();
}
-
- ]]>
- </script>
+ ]]></script>
+
<row>
<cell fill="both" weightx="1" weighty="1" rows="5">
<JScrollPane>
- <FiscalPeriodTableModel
- id="modelFiscalPeriodTable"/>
+ <FiscalPeriodTableModel id="fiscalPeriodTableModel" />
<FiscalPeriodTable
id="fiscalPeriodTable" sortable="false" rowHeight="24"
- constructorParams="getHandler()" model="{getModelFiscalPeriodTable()}"
+ constructorParams="getFiscalPeriodTableModel()"
selectionMode="{ListSelectionModel.SINGLE_INTERVAL_SELECTION}"
columnControlVisible="true"/>
<ListSelectionModel
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodViewHandler.java 2012-04-05 14:09:35 UTC (rev 3354)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodViewHandler.java 2012-04-06 10:07:48 UTC (rev 3355)
@@ -25,9 +25,24 @@
package org.chorem.lima.ui.fiscalperiod;
+import static org.nuiton.i18n.I18n._;
+
+import java.math.BigDecimal;
+import java.util.Calendar;
+import java.util.Collection;
+import java.util.Date;
+import java.util.List;
+
+import javax.swing.JOptionPane;
+
+import org.apache.commons.lang3.time.DateUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.LimaException;
+import org.chorem.lima.business.LimaRuntimeException;
+import org.chorem.lima.business.ServiceListener;
+import org.chorem.lima.business.ejbinterface.FinancialTransactionService;
+import org.chorem.lima.business.ejbinterface.FiscalPeriodService;
import org.chorem.lima.business.monitorable.FinancialTransactionServiceMonitorable;
import org.chorem.lima.business.monitorable.FiscalPeriodServiceMonitorable;
import org.chorem.lima.entity.Entry;
@@ -40,15 +55,8 @@
import org.jdesktop.swingx.JXTable;
import org.nuiton.util.DateUtil;
-import javax.swing.JOptionPane;
-import java.math.BigDecimal;
-import java.util.Collection;
-import java.util.List;
-
-import static org.nuiton.i18n.I18n._;
-
/**
- * TODO add comment here.
+ * Handler pour la gestion des exercices (creation/fermeture).
*
* @author chatellier
* @version $Revision$
@@ -56,86 +64,133 @@
* Last update : $Date$
* By : $Author$
*/
-public class FiscalPeriodViewHandler {
+public class FiscalPeriodViewHandler implements ServiceListener {
private static final Log log = LogFactory.getLog(FiscalPeriodViewHandler.class);
private FiscalPeriodView view;
- protected FiscalPeriodTable table;
-
- protected FiscalPeriodTableModel tableModel;
-
/** Service. */
- protected FiscalPeriodServiceMonitorable fiscalPeriodService;
+ protected FiscalPeriodService fiscalPeriodService;
- protected FinancialTransactionServiceMonitorable financialTransactionService;
+ protected FinancialTransactionService financialTransactionService;
- protected FiscalPeriodViewHandler(FiscalPeriodView view) {
+ /**
+ * Constructor.
+ *
+ * @param view managed view
+ */
+ public FiscalPeriodViewHandler(FiscalPeriodView view) {
this.view = view;
- fiscalPeriodService =
- LimaServiceFactory.getService(
- FiscalPeriodServiceMonitorable.class);
+ fiscalPeriodService = LimaServiceFactory.getService(FiscalPeriodServiceMonitorable.class);
+ financialTransactionService = LimaServiceFactory.getService(FinancialTransactionServiceMonitorable.class);
- financialTransactionService =
- LimaServiceFactory.getService(
- FinancialTransactionServiceMonitorable.class);
+ LimaServiceFactory.addServiceListener(FiscalPeriodServiceMonitorable.class, this);
}
+ public void init() {
+ loadAllFiscalPeriod();
+ }
+
+ /**
+ * Reload fiscal period list from service and update ui.
+ */
+ public void loadAllFiscalPeriod() {
+ try {
+ List<FiscalPeriod> periods = fiscalPeriodService.getAllFiscalPeriods();
+ view.getFiscalPeriodTableModel().setFiscalPeriods(periods);
+ } catch (LimaException ex) {
+ throw new LimaRuntimeException("Cant get fiscal perdiods", ex);
+ }
+ }
+
+ /**
+ * Display add period form and perform add.
+ */
public void addFiscalPeriod() {
- FiscalPeriodTableModel model =
- (FiscalPeriodTableModel) getView().getFiscalPeriodTable().getModel();
+ FiscalPeriodTableModel model = (FiscalPeriodTableModel) view.getFiscalPeriodTable().getModel();
- AddPeriod addPeriodDialog = new AddPeriod(getView());
- // jaxx don't call super() ?
- addPeriodDialog.setLocationRelativeTo(getView());
+ AddPeriod addPeriodDialog = new AddPeriod(view);
+ addPeriodDialog.setLocationRelativeTo(view);
addPeriodDialog.setVisible(true);
FiscalPeriod fiscalPeriod = addPeriodDialog.getPeriod();
// null = cancel
if (fiscalPeriod != null) {
//check if fiscalperiod have 12 months, ask a confirmation
- int nbMonth =
- DateUtil.getDifferenceInMonths(fiscalPeriod.getBeginDate(),
- fiscalPeriod.getEndDate());
- int n = 0;
+ int nbMonth = DateUtil.getDifferenceInMonths(fiscalPeriod.getBeginDate(),
+ fiscalPeriod.getEndDate());
+ int response = JOptionPane.NO_OPTION;
if (nbMonth != 12) {
- n = JOptionPane.showConfirmDialog(getView(),
- _("lima.charts.fiscalperiod.question.morethan12"),
- _("lima.common.question"),
- JOptionPane.YES_NO_OPTION,
- JOptionPane.QUESTION_MESSAGE);
+ response = JOptionPane.showConfirmDialog(view,
+ _("lima.ui.fiscalperiod.addfiscalperiod.morethan12"),
+ _("lima.ui.fiscalperiod.addfiscalperiodtitle"),
+ JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
}
- if (n == JOptionPane.YES_OPTION || nbMonth == 11) {
+ // FIXME echatellier 20120405 je ne comprend pas le "|| nbMonth == 11"
+ if (response == JOptionPane.YES_OPTION || nbMonth == 11) {
try {
+ fiscalPeriod = fiscalPeriodService.createFiscalPeriod(fiscalPeriod);
model.addFiscalPeriod(fiscalPeriod);
- } catch (LimaException eee) {
- if (log.isErrorEnabled()) {
- log.error("Can't add fiscal period", eee);
- }
- DialogHelper.showErrorMessageDialog(view, eee);
+ } catch (LimaException ex) {
+ throw new LimaRuntimeException("Can't add fiscal period", ex);
}
}
}
}
+ /**
+ * Init add period view.
+ *
+ * @param addPeriod view to init
+ */
+ public void init(AddPeriod addPeriod) {
+ addPeriod.getRootPane().setDefaultButton(addPeriod.getOkButton());
+
+ // set begin date picker
+ Date endDate = null;
+ Calendar calendarBegin = Calendar.getInstance();
+ // set begindate to JAN 1 - 0:00.000 of this years
+ Date beginDate = calendarBegin.getTime();
+ beginDate = DateUtils.truncate(beginDate, Calendar.DATE);
+ try {
+ FiscalPeriod result = fiscalPeriodService.getLastFiscalPeriod();
+ if (result != null){
+ beginDate = result.getEndDate();
+ }
+ }
+ catch (LimaException eee){
+ if(log.isDebugEnabled()){
+ log.debug("Can't get last fiscal period", eee);
+ }
+ }
+ beginDate = DateUtils.addDays(beginDate, 1);
+ addPeriod.getBeginDatePicker().setDate(beginDate);
+
+ // get end date
+ endDate = DateUtils.addYears(beginDate, 1);
+ endDate = DateUtils.addDays(endDate, -1);
+ addPeriod.getEndDatePicker().setDate(endDate);
+ }
+
+ /**
+ * Block selected fiscal period after user confirmation.
+ */
public void blockFiscalPeriod() {
- JXTable fiscalPeriodeTable = getView().getFiscalPeriodTable();
+ JXTable fiscalPeriodeTable = view.getFiscalPeriodTable();
int selectedRow = fiscalPeriodeTable.getSelectedRow();
- FiscalPeriodTableModel model =
- (FiscalPeriodTableModel) getView().getFiscalPeriodTable().getModel();
- // blocked it
+ FiscalPeriodTableModel model = view.getFiscalPeriodTableModel();
+ FiscalPeriod selectedFiscalPeriod = model.getFiscalPeriodAt(selectedRow);
+
try {
- FiscalPeriod selectedFiscalPeriod =
- model.getFiscalPeriodAtRow(selectedRow);
+
//check if the user want to block the fiscal year
- int response =
- JOptionPane.showConfirmDialog(getView(),
- _("lima.charts.fiscalperiod.question.blocked"),
- _("lima.common.question"), JOptionPane.YES_NO_OPTION,
- JOptionPane.QUESTION_MESSAGE);
+ int response = JOptionPane.showConfirmDialog(view,
+ _("lima.ui.fiscalperiod.block.confirmation"),
+ _("lima.ui.fiscalperiod.block.title"), JOptionPane.YES_NO_OPTION,
+ JOptionPane.WARNING_MESSAGE);
if (response == JOptionPane.YES_OPTION) {
//use to tell if the user wants to create a new fiscal year
boolean newyear = false;
@@ -144,19 +199,22 @@
newyear = true; //two are open
} else {
//check if the user wants to create a new fiscal year
- response =
- JOptionPane.showConfirmDialog(getView(),
- _("lima.charts.fiscalperiod.question.newyear"),
- _("lima.common.question"), JOptionPane.YES_NO_OPTION,
- JOptionPane.QUESTION_MESSAGE);
- //create a new fiscal year
+ response = JOptionPane.showConfirmDialog(view,
+ _("lima.ui.fiscalperiod.block.newyear"),
+ _("lima.ui.fiscalperiod.block.title"), JOptionPane.YES_NO_OPTION,
+ JOptionPane.QUESTION_MESSAGE);
+ // create a new fiscal year
if (response == JOptionPane.YES_OPTION) {
addFiscalPeriod();
newyear = true;
}
}
+
+ // FIXME report a nouveau et bloquage en une seule opération
+ // transactionnelle
addRetainedEarnings(selectedFiscalPeriod, newyear);
- model.blockFiscalPeriod(selectedFiscalPeriod);
+ selectedFiscalPeriod = fiscalPeriodService.blockFiscalPeriod(selectedFiscalPeriod);
+ model.updateFiscalPeriod(selectedFiscalPeriod);
}
} catch (LimaException eee) {
if (log.isErrorEnabled()) {
@@ -167,16 +225,15 @@
}
/**
- * Sets EntryBook and Date to use
+ * Report à nouveau.
*
+ * @deprecated a déplacer en partie en metier
* @param selectedFiscalPeriod
* @param newyear
*/
+ @Deprecated
public void addRetainedEarnings(FiscalPeriod selectedFiscalPeriod, boolean newyear) {
-// JXTable fiscalPeriodeTable = getView().getFiscalPeriodTable();
-// int selectedRow = fiscalPeriodeTable.getSelectedRow();
-// FiscalPeriodTableModel model =
-// (FiscalPeriodTableModel)getView().getFiscalPeriodTable().getModel();
+
try {
boolean found = false;
List<FinancialTransaction> financialTransactionsList =
@@ -199,11 +256,10 @@
//report if they are at least one transaction to be report
if (found) {
//check if the user wants to report datas
- int response =
- JOptionPane.showConfirmDialog(getView(),
- _("lima.charts.fiscalperiod.question.addretainedearnings"),
- _("lima.common.question"), JOptionPane.YES_NO_OPTION,
- JOptionPane.QUESTION_MESSAGE);
+ int response = JOptionPane.showConfirmDialog(view,
+ _("lima.ui.fiscalperiod.block.addretainedearnings"),
+ _("lima.ui.fiscalperiod.block.title"), JOptionPane.YES_NO_OPTION,
+ JOptionPane.QUESTION_MESSAGE);
//ask user for the entrybook to use for retained earnings
if (response == JOptionPane.YES_OPTION) {
//Sets EntryBook
@@ -230,13 +286,12 @@
}
}
-
- public FiscalPeriodView getView() {
- return view;
+
+ @Override
+ public void notifyMethod(String serviceName, String methodeName) {
+ //refresh on import datas
+ if (methodeName.contains("importAll")) {
+ loadAllFiscalPeriod();
+ }
}
-
- public void refresh() {
- tableModel = (FiscalPeriodTableModel) getView().getFiscalPeriodTable().getModel();
- tableModel.refresh();
- }
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/RetainedEarningsEntryBookForm.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/RetainedEarningsEntryBookForm.jaxx 2012-04-05 14:09:35 UTC (rev 3354)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/RetainedEarningsEntryBookForm.jaxx 2012-04-06 10:07:48 UTC (rev 3355)
@@ -5,7 +5,7 @@
$Id$
$HeadURL$
%%
- Copyright (C) 2008 - 2011 CodeLutin
+ Copyright (C) 2008 - 2012 CodeLutin, Chatellier Eric
%%
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as
@@ -22,22 +22,21 @@
<http://www.gnu.org/licenses/gpl-3.0.html>.
#L%
-->
-<JDialog modal="true"
+<JDialog title="lima.ui.fiscalperiod.block.retainedearningstitle" modal="true"
defaultCloseOperation="{JDialog.DO_NOTHING_ON_CLOSE}"
onWindowClosing="performCancel();">
<import>
javax.swing.text.Document
org.chorem.lima.entity.EntryBook
- org.chorem.lima.ui.LimaRendererUtil
org.chorem.lima.ui.combobox.EntryBookComboBoxModel
</import>
+
<EntryBook id="entryBook" javaBean="null"/>
<Boolean id="addState" javaBean='true'/>
<script>
<![CDATA[
-
getRootPane().setDefaultButton(okButton);
/**
@@ -96,7 +95,7 @@
<EntryBookComboBoxModel id="modelEntryBookComboBox"/>
<JComboBox id="entryBookComboBox"
model="{getModelEntryBookComboBox()}"
- renderer="{LimaRendererUtil.newDecoratorListCellRenderer(EntryBook.class)}"
+ renderer="{new EntryBookListRenderer()}"
editable="false"
onItemStateChanged="getEntryBook().setCode(((EntryBook)getEntryBookComboBox().getSelectedItem()).getCode()); getEntryBook().setLabel(((EntryBook)getEntryBookComboBox().getSelectedItem()).getLabel())"/>
</cell>
Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/package-info.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/package-info.java (rev 0)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/package-info.java 2012-04-06 10:07:48 UTC (rev 3355)
@@ -0,0 +1,31 @@
+/*
+ * #%L
+ *
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Codelutin, Chatellier Eric
+ * %%
+ * 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>.
+ * #L%
+ */
+/**
+ * Gestion des exercices.
+ *
+ * Onglet presentant la liste des exercices, avec option de création et de
+ * cloture avec option de report à nouveau.
+ */
+package org.chorem.lima.ui.fiscalperiod;
Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/package-info.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
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 2012-04-05 14:09:35 UTC (rev 3354)
+++ trunk/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties 2012-04-06 10:07:48 UTC (rev 3355)
@@ -293,6 +293,18 @@
lima.ui.entrybook.label=
lima.ui.entrybook.remove=
lima.ui.entrybook.update=
+lima.ui.fiscalperiod.addfiscalperiod.morethan12=
+lima.ui.fiscalperiod.addfiscalperiodtitle=
+lima.ui.fiscalperiod.addperiodtitle=
+lima.ui.fiscalperiod.block.addretainedearnings=
+lima.ui.fiscalperiod.block.confirmation=
+lima.ui.fiscalperiod.block.newyear=
+lima.ui.fiscalperiod.block.retainedearningstitle=
+lima.ui.fiscalperiod.block.title=
+lima.ui.fiscalperiod.closed=
+lima.ui.fiscalperiod.closure=
+lima.ui.fiscalperiod.fiscalperiod=
+lima.ui.fiscalperiod.open=
lima.ui.importexport.importcsv=
lima.ui.importexport.importebp=
lima.vatreport.listerror=Can't get entries list
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 2012-04-05 14:09:35 UTC (rev 3354)
+++ trunk/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties 2012-04-06 10:07:48 UTC (rev 3355)
@@ -292,6 +292,18 @@
lima.ui.entrybook.label=Libellé
lima.ui.entrybook.remove=Supprimer
lima.ui.entrybook.update=Modifier
+lima.ui.fiscalperiod.addfiscalperiod.morethan12=La période sélectionnée n'est pas de 12 mois, voulez-vous continuer ?
+lima.ui.fiscalperiod.addfiscalperiodtitle=Nouvel exercice
+lima.ui.fiscalperiod.addperiodtitle=
+lima.ui.fiscalperiod.block.addretainedearnings=Reporter à nouveau?
+lima.ui.fiscalperiod.block.confirmation=Ètes vous sûre de vouloir clôturer cette période ? Cette action est irréversible \!
+lima.ui.fiscalperiod.block.newyear=Voulez vous créer un nouvel exercice?
+lima.ui.fiscalperiod.block.retainedearningstitle=Report à nouveau
+lima.ui.fiscalperiod.block.title=Cloture de l'excercice
+lima.ui.fiscalperiod.closed=Cloturé
+lima.ui.fiscalperiod.closure=Cloture
+lima.ui.fiscalperiod.fiscalperiod=Exercice
+lima.ui.fiscalperiod.open=Ouvert
lima.ui.importexport.importcsv=Import/Export CSV
lima.ui.importexport.importebp=Import/Export EBP
lima.vatreport.listerror=Erreur lors de la récupération des données de la liste
1
0
05 Apr '12
Author: echatellier
Date: 2012-04-05 16:09:35 +0200 (Thu, 05 Apr 2012)
New Revision: 3354
Url: http://chorem.org/repositories/revision/lima/3354
Log:
Modification (modele/service) de la gestion des journaux.
Added:
trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialTransactionDAO.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/package-info.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/package-info.java
Modified:
trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/DefaultAccountingRules.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/EntryBookServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/EntryBookService.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/EntryBookServiceLocal.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountForm.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountImportForm.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/UpdateAccountForm.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookForm.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookImportForm.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookTableModel.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/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 2012-04-05 10:58:58 UTC (rev 3353)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/DefaultAccountingRules.java 2012-04-05 14:09:35 UTC (rev 3354)
@@ -130,7 +130,7 @@
try {
FinancialTransactionDAO financialTransactionDAO = LimaCallaoDAOHelper.getFinancialTransactionDAO(topiaTransaction);
// Check if entrybook have entries
- int nbfinancialtransaction = financialTransactionDAO.findAllByEntryBook(entryBook).size();
+ long nbfinancialtransaction = financialTransactionDAO.getCountByEntryBook(entryBook);
if (nbfinancialtransaction != 0) {
throw new LimaBusinessException(_("lima-business.defaultaccountingrules.deleteentrybookerror"));
}
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/EntryBookServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/EntryBookServiceImpl.java 2012-04-05 10:58:58 UTC (rev 3353)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/EntryBookServiceImpl.java 2012-04-05 14:09:35 UTC (rev 3354)
@@ -25,6 +25,13 @@
package org.chorem.lima.business.ejb;
+import static org.nuiton.i18n.I18n._;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.ejb.Stateless;
+
import org.chorem.lima.business.AccountingRules;
import org.chorem.lima.business.LimaBusinessException;
import org.chorem.lima.business.LimaConfig;
@@ -42,12 +49,6 @@
import org.nuiton.topia.TopiaContext;
import org.nuiton.topia.TopiaException;
-import javax.ejb.Stateless;
-import java.util.ArrayList;
-import java.util.List;
-
-import static org.nuiton.i18n.I18n._;
-
/**
* Implémente la fonction multi-EntryBook. Il est possible de créer ici le
* EntryBook des ventes, le EntryBook des achats, etc.
@@ -64,10 +65,11 @@
}
@Override
- public void createEntryBookWithTransaction(EntryBook entryBook,
+ public EntryBook createEntryBookWithTransaction(EntryBook entryBook,
TopiaContext topiaContext)
throws LimaException {
+ EntryBook result = null;
try {
// check if entrybook with is name already exist
@@ -82,7 +84,7 @@
}
// creation du EntryBook
- entryBookDAO.create(entryBook);
+ result = entryBookDAO.create(entryBook);
//create ClosedPeriodicEntryBook for all unblocked financial period
ClosedPeriodicEntryBookDAO closedPeriodicEntryBookDAO =
@@ -107,22 +109,25 @@
} catch (TopiaException ex) {
doCatch(topiaContext, ex);
}
-
+ return result;
}
@Override
- public void createEntryBook(EntryBook entryBook) throws LimaException {
+ public EntryBook createEntryBook(EntryBook entryBook) throws LimaException {
TopiaContext transaction = beginTransaction(rootContext);
+ EntryBook result = null;
try {
- createEntryBookWithTransaction(entryBook, transaction);
+ result = createEntryBookWithTransaction(entryBook, transaction);
} catch (Exception ex) {
doCatch(transaction, ex);
} finally {
doFinally(transaction);
}
+
+ return result;
}
@Override
@@ -147,16 +152,17 @@
}
@Override
- public void updateEntryBook(EntryBook entryBook) throws LimaException {
+ public EntryBook updateEntryBook(EntryBook entryBook) throws LimaException {
TopiaContext transaction = beginTransaction(rootContext);
+ EntryBook result = null;
try {
EntryBookDAO entryBookDAO =
LimaCallaoDAOHelper.getEntryBookDAO(transaction);
// creation du EntryBook
- entryBookDAO.update(entryBook);
+ result = entryBookDAO.update(entryBook);
commitTransaction(transaction);
} catch (Exception ex) {
@@ -164,6 +170,8 @@
} finally {
doFinally(transaction);
}
+
+ return result;
}
@Override
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/EntryBookService.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/EntryBookService.java 2012-04-05 10:58:58 UTC (rev 3353)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/EntryBookService.java 2012-04-05 14:09:35 UTC (rev 3354)
@@ -66,7 +66,7 @@
* @param entryBook
* @throws LimaException
*/
- void createEntryBook(EntryBook entryBook) throws LimaException;
+ EntryBook createEntryBook(EntryBook entryBook) throws LimaException;
/**
* Permet de modifier un journal.
@@ -74,7 +74,7 @@
* @param entryBook journal
* @throws LimaException
*/
- void updateEntryBook(EntryBook entryBook) throws LimaException;
+ EntryBook updateEntryBook(EntryBook entryBook) throws LimaException;
/**
* Permet d'effacer un EntryBook dans la base de données.
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/EntryBookServiceLocal.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/EntryBookServiceLocal.java 2012-04-05 10:58:58 UTC (rev 3353)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/EntryBookServiceLocal.java 2012-04-05 14:09:35 UTC (rev 3354)
@@ -45,6 +45,6 @@
@Local
public interface EntryBookServiceLocal extends EntryBookService {
- void createEntryBookWithTransaction(EntryBook entryBook, TopiaContext topiaContext) throws LimaException;
+ EntryBook createEntryBookWithTransaction(EntryBook entryBook, TopiaContext topiaContext) throws LimaException;
}
Added: trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialTransactionDAO.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialTransactionDAO.java (rev 0)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialTransactionDAO.java 2012-04-05 14:09:35 UTC (rev 3354)
@@ -0,0 +1,54 @@
+/*
+ * #%L
+ * Lima callao
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 CodeLutin, Chatellier Eric
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+package org.chorem.lima.entity;
+
+import org.nuiton.topia.TopiaException;
+
+/**
+ * Ajout de requetes specifiques aux financial transaction sur le DAO.
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * By : $Author$
+ */
+public class FinancialTransactionDAO extends FinancialTransactionDAOImpl<FinancialTransaction> {
+
+ /**
+ * Return how many transaction are found with specified entryBook.
+ *
+ * @param entryBook entry book
+ * @return transaction referencing entry book
+ * @throws TopiaException
+ */
+ public long getCountByEntryBook(EntryBook entryBook) throws TopiaException {
+ String query = "SELECT count(*) FROM " + FinancialTransaction.class.getName() + " t WHERE t.entryBook = :entryBook";
+ Number count = (Number)context.find(query, "entryBook", entryBook).get(0);
+ return count.longValue();
+ }
+
+} //FinancialTransactionDAO
Property changes on: trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialTransactionDAO.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountForm.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountForm.jaxx 2012-04-05 10:58:58 UTC (rev 3353)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountForm.jaxx 2012-04-05 14:09:35 UTC (rev 3354)
@@ -76,4 +76,4 @@
</cell>
</row>
</Table>
-</JDialog>
\ No newline at end of file
+</JDialog>
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountImportForm.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountImportForm.jaxx 2012-04-05 10:58:58 UTC (rev 3353)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountImportForm.jaxx 2012-04-05 14:09:35 UTC (rev 3354)
@@ -22,8 +22,7 @@
<http://www.gnu.org/licenses/gpl-3.0.html>.
#L%
-->
-
-<JDialog modal="true"
+<JDialog title="lima.ui.account.importtitle" modal="true"
defaultCloseOperation="{JDialog.DO_NOTHING_ON_CLOSE}"
onWindowClosing="performCancel();">
@@ -51,7 +50,7 @@
</cell>
</row>
<row>
- <cell>
+ <cell anchor="west">
<JRadioButton text='lima.ui.account.shortened'
value='{AccountsChartEnum.SHORTENED}'
buttonGroup="{buttonGroup}"
@@ -59,35 +58,31 @@
</cell>
</row>
<row>
- <cell>
+ <cell anchor="west">
<JRadioButton text='lima.ui.account.base'
value='{AccountsChartEnum.BASE}'
- buttonGroup="{buttonGroup}"
- selected='true'/>
+ buttonGroup="{buttonGroup}"/>
</cell>
</row>
<row>
- <cell>
+ <cell anchor="west">
<JRadioButton text='lima.ui.account.developed'
value='{AccountsChartEnum.DEVELOPED}'
- buttonGroup="{buttonGroup}"
- selected='true'/>
+ buttonGroup="{buttonGroup}"/>
</cell>
</row>
<row>
- <cell>
+ <cell anchor="west">
<JRadioButton text='lima.ui.importexport.importcsv'
value='{AccountsChartEnum.IMPORT}'
- buttonGroup="{buttonGroup}"
- selected='true'/>
+ buttonGroup="{buttonGroup}"/>
</cell>
</row>
<row>
- <cell>
+ <cell anchor="west">
<JRadioButton text='lima.ui.importexport.importebp'
value='{AccountsChartEnum.IMPORTEBP}'
- buttonGroup="{buttonGroup}"
- selected='true'/>
+ buttonGroup="{buttonGroup}"/>
</cell>
</row>
<row>
@@ -107,4 +102,4 @@
</cell>
</row>
</Table>
-</JDialog>
\ No newline at end of file
+</JDialog>
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 2012-04-05 10:58:58 UTC (rev 3353)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountView.jaxx 2012-04-05 14:09:35 UTC (rev 3354)
@@ -41,7 +41,7 @@
]]></script>
<row>
- <cell fill="both" weightx="1" weighty="1" rows='5'>
+ <cell fill="both" weightx="1" weighty="1" rows='4'>
<JScrollPane>
<JXTreeTable id="accountsTreeTable"
selectionMode="{ListSelectionModel.SINGLE_SELECTION}"
@@ -52,7 +52,7 @@
</JScrollPane>
</cell>
<cell fill="horizontal">
- <JButton id="addButton" text="lima.ui.account.addAccount"
+ <JButton id="addButton" text="lima.ui.account.addaccount"
onActionPerformed="handler.addAccount()"/>
</cell>
</row>
@@ -71,9 +71,9 @@
</cell>
</row>
<row>
- <cell fill="horizontal">
+ <cell fill="horizontal" anchor="north" weighty="1">
<JButton id="importButton" text="lima.iu.importexport.import"
onActionPerformed="handler.importAccountsChart()"/>
</cell>
</row>
-</Table>
\ No newline at end of file
+</Table>
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/UpdateAccountForm.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/UpdateAccountForm.jaxx 2012-04-05 10:58:58 UTC (rev 3353)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/UpdateAccountForm.jaxx 2012-04-05 14:09:35 UTC (rev 3354)
@@ -73,4 +73,4 @@
</cell>
</row>
</Table>
-</JDialog>
\ No newline at end of file
+</JDialog>
Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/package-info.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/package-info.java (rev 0)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/package-info.java 2012-04-05 14:09:35 UTC (rev 3354)
@@ -0,0 +1,31 @@
+/*
+ * #%L
+ *
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Codelutin, Chatellier Eric
+ * %%
+ * 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>.
+ * #L%
+ */
+/**
+ * Gestion des creations.
+ *
+ * Onglet presentant la liste des comptes en arbre, avec action de creation,
+ * modification, suppression...
+ */
+package org.chorem.lima.ui.account;
Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/package-info.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookForm.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookForm.jaxx 2012-04-05 10:58:58 UTC (rev 3353)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookForm.jaxx 2012-04-05 14:09:35 UTC (rev 3354)
@@ -5,7 +5,7 @@
$Id$
$HeadURL$
%%
- Copyright (C) 2008 - 2010 CodeLutin
+ Copyright (C) 2008 - 2012 CodeLutin, Chatellier Eric
%%
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as
@@ -22,7 +22,7 @@
<http://www.gnu.org/licenses/gpl-3.0.html>.
#L%
-->
-<JDialog modal="true"
+<JDialog title="lima.ui.entrybook.entrybooktile" modal="true"
defaultCloseOperation="{JDialog.DO_NOTHING_ON_CLOSE}"
onWindowClosing="performCancel();">
@@ -46,10 +46,10 @@
<Table>
<row>
<cell>
- <JLabel text="lima.common.code"/>
+ <JLabel text="lima.ui.entrybook.code"/>
</cell>
<cell>
- <JTextField id="entryBookCodeField" text="{getEntryBook().getCode()}"/>
+ <JTextField id="entryBookCodeField" text="{getEntryBook().getCode()}" editable='{isAddState()}' />
<Document javaBean="getEntryBookCodeField().getDocument()"
onInsertUpdate='getEntryBook().setCode(getEntryBookCodeField().getText())'
onRemoveUpdate='getEntryBook().setCode(getEntryBookCodeField().getText())'/>
@@ -57,10 +57,10 @@
</row>
<row>
<cell>
- <JLabel text="lima.common.label"/>
+ <JLabel text="lima.ui.entrybook.label"/>
</cell>
<cell>
- <JTextField id="entryBookLabelField" editable='{isAddState()}'
+ <JTextField id="entryBookLabelField"
text="{getEntryBook().getLabel()}"/>
<Document javaBean="getEntryBookLabelField().getDocument()"
onInsertUpdate='getEntryBook().setLabel(getEntryBookLabelField().getText())'
@@ -69,14 +69,13 @@
</row>
<row>
<cell>
- <JButton id="cancelButton" text="lima.common.cancel"
+ <JButton id="cancelButton" text="lima.ui.common.cancel"
onActionPerformed="performCancel()"/>
</cell>
<cell>
- <JButton id="okButton" text="lima.common.ok"
+ <JButton id="okButton" text="lima.ui.common.ok"
onActionPerformed="dispose()"/>
</cell>
-
</row>
</Table>
-</JDialog>
\ No newline at end of file
+</JDialog>
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookImportForm.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookImportForm.jaxx 2012-04-05 10:58:58 UTC (rev 3353)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookImportForm.jaxx 2012-04-05 14:09:35 UTC (rev 3354)
@@ -22,23 +22,22 @@
<http://www.gnu.org/licenses/gpl-3.0.html>.
#L%
-->
-
-<JDialog modal="true"
+<JDialog title="lima.ui.entrybook.importtitle" modal="true"
defaultCloseOperation="{JDialog.DO_NOTHING_ON_CLOSE}"
onWindowClosing="performCancel();">
<import>
- jaxx.runtime.swing.JAXXButtonGroup
org.chorem.lima.enums.EntryBooksChartEnum
</import>
- <JAXXButtonGroup id="radioButtons" javaBean='new JAXXButtonGroup()'/>
- <Boolean id="addState" javaBean='true'/>
+ <javax.swing.ButtonGroup id="buttonGroup" />
+ <Boolean id="addState" javaBean='true' />
+
<script>
<![CDATA[
- getRootPane().setDefaultButton(ok);
+ getRootPane().setDefaultButton(okButton);
protected void performCancel() {
- getRadioButtons().setSelectedValue(null);
+ buttonGroup.setSelectedValue(null);
dispose();
}
]]>
@@ -47,16 +46,15 @@
<Table>
<row>
<cell>
- <JRadioButton text='lima.charts.entrybook.default'
+ <JRadioButton text='lima.ui.entrybook.default'
value='{EntryBooksChartEnum.DEFAULT}'
- buttonGroup="{getRadioButtons()}"
+ buttonGroup="{buttonGroup}"
selected='true'/>
</cell>
<cell>
- <JRadioButton text='lima.charts.entrybook.import'
+ <JRadioButton text='lima.ui.entrybook.import'
value='{EntryBooksChartEnum.IMPORT}'
- buttonGroup="{getRadioButtons()}"
- selected='true'/>
+ buttonGroup="{buttonGroup}"/>
</cell>
</row>
<row>
@@ -64,11 +62,11 @@
<Table>
<row>
<cell fill="none">
- <JButton text="lima.common.cancel"
+ <JButton text="lima.ui.common.cancel"
onActionPerformed="performCancel()"/>
</cell>
<cell fill="none">
- <JButton id="ok" text="lima.common.ok"
+ <JButton id="okButton" text="lima.ui.common.ok"
onActionPerformed="dispose()"/>
</cell>
</row>
@@ -76,4 +74,4 @@
</cell>
</row>
</Table>
-</JDialog>
\ No newline at end of file
+</JDialog>
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 2012-04-05 10:58:58 UTC (rev 3353)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookTableModel.java 2012-04-05 14:09:35 UTC (rev 3354)
@@ -25,21 +25,16 @@
package org.chorem.lima.ui.entrybook;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.chorem.lima.business.LimaException;
-import org.chorem.lima.business.ServiceListener;
-import org.chorem.lima.business.monitorable.EntryBookServiceMonitorable;
-import org.chorem.lima.business.monitorable.ImportServiceMonitorable;
-import org.chorem.lima.entity.EntryBook;
-import org.chorem.lima.service.LimaServiceFactory;
+import static org.nuiton.i18n.I18n._;
+import java.util.List;
+
import javax.swing.table.AbstractTableModel;
-import static org.nuiton.i18n.I18n._;
+import org.chorem.lima.entity.EntryBook;
/**
- * Entry book table model.
+ * Entry book table model only rendering entry book list.
*
* @author ore
* @author chatellier
@@ -48,37 +43,20 @@
* Last update : $Date$
* By : $Author$
*/
-public class EntryBookTableModel extends AbstractTableModel implements ServiceListener {
+public class EntryBookTableModel extends AbstractTableModel {
/** serialVersionUID. */
private static final long serialVersionUID = 7578692417919755647L;
- /** log. */
- private static final Log log = LogFactory.getLog(EntryBookTableModel.class);
+ protected List<EntryBook> entryBooks;
- /** Services. */
- protected EntryBookServiceMonitorable entryBookService;
-
- /** Constructor. */
- public EntryBookTableModel() {
- entryBookService =
- LimaServiceFactory.getService(
- EntryBookServiceMonitorable.class);
- LimaServiceFactory.addServiceListener(ImportServiceMonitorable.class, this);
+ public EntryBookTableModel(List<EntryBook> entryBooks) {
+ this.entryBooks = entryBooks;
}
@Override
public int getRowCount() {
- int result = 0;
-
- try {
- result = entryBookService.getAllEntryBooks().size();
- } catch (LimaException e) {
- if (log.isDebugEnabled()) {
- log.debug("Can't get all entrybooks", e);
- }
- }
-
+ int result = entryBooks.size();
return result;
}
@@ -92,19 +70,17 @@
String res = "n/a";
switch (column) {
case 0:
- res = _("lima.table.code");
+ res = _("lima.ui.entrybook.code");
break;
case 1:
- res = _("lima.table.label");
+ res = _("lima.ui.entrybook.label");
break;
}
return res;
}
- public EntryBook getEntryBookAtRow(int row) throws LimaException {
- EntryBook entryBook;
- entryBook = entryBookService.getAllEntryBooks().get(row);
-
+ public EntryBook getEntryBookAtRow(int row) {
+ EntryBook entryBook = entryBooks.get(row);
return entryBook;
}
@@ -112,21 +88,15 @@
public Object getValueAt(int row, int column) {
Object result = null;
- try {
- EntryBook entryBook = getEntryBookAtRow(row);
+ EntryBook entryBook = getEntryBookAtRow(row);
- switch (column) {
- case 0:
- result = entryBook.getCode();
- break;
- case 1:
- result = entryBook.getLabel();
- break;
- }
- } catch (LimaException eee) {
- if (log.isDebugEnabled()) {
- log.debug("Can't get EntryBook", eee);
- }
+ switch (column) {
+ case 0:
+ result = entryBook.getCode();
+ break;
+ case 1:
+ result = entryBook.getLabel();
+ break;
}
return result;
@@ -134,51 +104,23 @@
@Override
public boolean isCellEditable(int rowIndex, int columnIndex) {
- // Ne cells editable
return false;
}
- /**
- * @param entryBook
- * @throws LimaException
- */
- public void addEntryBook(EntryBook entryBook) throws LimaException {
- /* Calling journal service */
- entryBookService.createEntryBook(entryBook);
- int row = entryBookService.getAllEntryBooks().indexOf(entryBook);
+ public void addEntryBook(EntryBook entryBook) {
+ entryBooks.add(entryBook);
+ int row = entryBooks.indexOf(entryBook);
fireTableRowsInserted(row, row);
}
- /**
- * @param entryBook
- * @throws LimaException
- */
- public void updateEntryBook(EntryBook entryBook) throws LimaException {
- /* Calling journal service */
- entryBookService.updateEntryBook(entryBook);
- int row = entryBookService.getAllEntryBooks().indexOf(entryBook);
+ public void updateEntryBook(EntryBook entryBook) {
+ int row = entryBooks.indexOf(entryBook);
fireTableRowsUpdated(row, row);
}
- /**
- * @param entryBook
- * @throws LimaException
- */
- public void removeEntryBook(EntryBook entryBook) throws LimaException {
- /* Calling journal service */
- int row = entryBookService.getAllEntryBooks().indexOf(entryBook);
- entryBookService.removeEntryBook(entryBook);
+ public void removeEntryBook(EntryBook entryBook) {
+ int row = entryBooks.indexOf(entryBook);
+ entryBooks.remove(entryBook);
fireTableRowsDeleted(row, row);
}
-
- @Override
- public void notifyMethod(String serviceName, String methodeName) {
-
- //refresh on import datas
- if (methodeName.contains("importEntryBooks")
- || methodeName.contains("importAll")
- || methodeName.contains("importAs")) {
- fireTableDataChanged();
- }
- }
}
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 2012-04-05 10:58:58 UTC (rev 3353)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookView.jaxx 2012-04-05 14:09:35 UTC (rev 3354)
@@ -5,7 +5,7 @@
$Id$
$HeadURL$
%%
- Copyright (C) 2008 - 2010 CodeLutin
+ Copyright (C) 2008 - 2012 CodeLutin, Chatellier Eric
%%
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as
@@ -34,44 +34,47 @@
<!-- Selected row bindings -->
<Boolean id="selectedRow" javaBean="false"/>
+ <script><![CDATA[
+ void $afterCompleteSetup() {
+ handler.init();
+ }
+ ]]></script>
+
<row>
- <cell fill="both" weightx="1" weighty="1" rows='5'>
+ <cell fill="both" weightx="1" weighty="1" rows='4'>
<JScrollPane>
<EntryBookTable id="entryBooksTable" rowHeight="24"
constructorParams="getHandler()"
- model="{new org.chorem.lima.ui.entrybook.EntryBookTableModel()}"
- highlighters="{org.jdesktop.swingx.decorator.HighlighterFactory.createSimpleStriping(new java.awt.Color(222,222,222))}"
+ highlighters="{org.jdesktop.swingx.decorator.HighlighterFactory.createSimpleStriping(new java.awt.Color(233,233,233))}"
selectionMode="{ListSelectionModel.SINGLE_SELECTION}"
columnControlVisible="true"/>
<ListSelectionModel javaBean="getEntryBooksTable().getSelectionModel()"
onValueChanged="setSelectedRow(entryBooksTable.getSelectedRow() != -1)"/>
</JScrollPane>
</cell>
- </row>
- <row>
<cell fill="horizontal">
- <JButton id="addButton" text="lima.charts.entrybook.add"
+ <JButton id="addButton" text="lima.ui.entrybook.add"
onActionPerformed="getHandler().addEntryBook()"/>
</cell>
</row>
<row>
<cell fill="horizontal">
- <JButton id="updateButton" text="lima.common.update"
+ <JButton id="updateButton" text="lima.ui.entrybook.update"
enabled="{isSelectedRow()}"
onActionPerformed="getHandler().updateEntryBook()"/>
</cell>
</row>
<row>
<cell fill="horizontal">
- <JButton id="removeButton" text="lima.common.remove"
+ <JButton id="removeButton" text="lima.ui.entrybook.remove"
enabled="{isSelectedRow()}"
onActionPerformed="getHandler().deleteEntryBook()"/>
</cell>
</row>
<row>
- <cell fill="horizontal">
+ <cell fill="horizontal" anchor="north" weighty="1">
<JButton id="importButton" text="lima.importexport.import"
onActionPerformed="getHandler().importEntryBooks()"/>
</cell>
</row>
-</Table>
\ No newline at end of file
+</Table>
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 2012-04-05 10:58:58 UTC (rev 3353)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookViewHandler.java 2012-04-05 14:09:35 UTC (rev 3354)
@@ -25,24 +25,28 @@
package org.chorem.lima.ui.entrybook;
+import static org.nuiton.i18n.I18n._;
+
+import java.util.List;
+
+import javax.swing.JOptionPane;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.LimaException;
+import org.chorem.lima.business.LimaRuntimeException;
+import org.chorem.lima.business.ServiceListener;
import org.chorem.lima.business.ejbinterface.EntryBookService;
import org.chorem.lima.business.monitorable.EntryBookServiceMonitorable;
+import org.chorem.lima.business.monitorable.ImportServiceMonitorable;
import org.chorem.lima.entity.EntryBook;
import org.chorem.lima.entity.EntryBookImpl;
import org.chorem.lima.enums.EntryBooksChartEnum;
import org.chorem.lima.enums.ImportExportEnum;
import org.chorem.lima.service.LimaServiceFactory;
import org.chorem.lima.ui.importexport.ImportExport;
-import org.chorem.lima.util.DialogHelper;
import org.jdesktop.swingx.JXTable;
-import javax.swing.JOptionPane;
-
-import static org.nuiton.i18n.I18n._;
-
/**
* Handler for entry book view.
*
@@ -52,7 +56,7 @@
* Last update : $Date$
* By : $Author$
*/
-public class EntryBookViewHandler {
+public class EntryBookViewHandler implements ServiceListener {
private static final Log log = LogFactory.getLog(EntryBookViewHandler.class);
@@ -65,114 +69,149 @@
entryBookService =
LimaServiceFactory.getService(
EntryBookServiceMonitorable.class);
+ LimaServiceFactory.addServiceListener(ImportServiceMonitorable.class, this);
}
+ public void init() {
+ loadAllEntryBooks();
+ }
+
+ /**
+ * Load all available entry book into table.
+ */
+ protected void loadAllEntryBooks() {
+
+ try {
+ List<EntryBook> entryBooks = entryBookService.getAllEntryBooks();
+ if (log.isDebugEnabled()) {
+ log.debug(String.format("Loaded %d entry books from service", entryBooks.size()));
+ }
+
+ EntryBookTableModel model = new EntryBookTableModel(entryBooks);
+ EntryBookTable table = view.getEntryBooksTable();
+ table.setModel(model);
+ } catch (LimaException ex) {
+ throw new LimaRuntimeException("Can't load entry books", ex);
+ }
+ }
+
+ /**
+ * Add new entry book (display blocking dialog and perform add).
+ */
public void addEntryBook() {
- JXTable entryBookTable = view.getEntryBooksTable();
- EntryBookTableModel entryBookTableModel =
- (EntryBookTableModel) entryBookTable.getModel();
-
EntryBook newEntryBook = new EntryBookImpl();
EntryBookForm entryBookForm = new EntryBookForm(view);
entryBookForm.setEntryBook(newEntryBook);
- // jaxx constructor don't call super() ?
entryBookForm.setLocationRelativeTo(view);
entryBookForm.setVisible(true);
+ newEntryBook = entryBookForm.getEntryBook();
// null == cancel action
- newEntryBook = entryBookForm.getEntryBook();
if (newEntryBook != null) {
- // add it
try {
+ // service call
+ newEntryBook = entryBookService.createEntryBook(newEntryBook);
+
+ // ui refresh
+ JXTable entryBookTable = view.getEntryBooksTable();
+ EntryBookTableModel entryBookTableModel = (EntryBookTableModel) entryBookTable.getModel();
entryBookTableModel.addEntryBook(newEntryBook);
- } catch (LimaException eee) {
- if (log.isErrorEnabled()) {
- log.error("Can't add entry book", eee);
- }
- DialogHelper.showErrorMessageDialog(view, eee);
+ } catch (LimaException ex) {
+ throw new LimaRuntimeException("Can't add entry book", ex);
}
}
}
+ /**
+ * Update existing entry book.
+ */
public void updateEntryBook() {
JXTable entryBookTable = view.getEntryBooksTable();
+ EntryBookTableModel entryBookTableModel = (EntryBookTableModel) entryBookTable.getModel();
int selectedRow = entryBookTable.getSelectedRow();
- EntryBookTableModel entryBookTableModel =
- (EntryBookTableModel) entryBookTable.getModel();
- // add it
- try {
- EntryBook selectedEntryBook =
- entryBookTableModel.getEntryBookAtRow(selectedRow);
- EntryBookForm entryBookForm = new EntryBookForm(view);
- entryBookForm.setEntryBook(selectedEntryBook);
- // jaxx constructor don't call super() ?
- entryBookForm.setLocationRelativeTo(view);
- entryBookForm.setVisible(true);
+ EntryBook selectedEntryBook = entryBookTableModel.getEntryBookAtRow(selectedRow);
+ EntryBookForm entryBookForm = new EntryBookForm(view);
+ entryBookForm.setAddState(false);
+ entryBookForm.setEntryBook(selectedEntryBook);
+ entryBookForm.setLocationRelativeTo(view);
+ entryBookForm.setVisible(true);
- // null == cancel action
- selectedEntryBook = entryBookForm.getEntryBook();
- if (selectedEntryBook != null) {
+ // null == cancel action
+ selectedEntryBook = entryBookForm.getEntryBook();
+ if (selectedEntryBook != null) {
+ try {
+ // service call
+ selectedEntryBook = entryBookService.updateEntryBook(selectedEntryBook);
+
+ // ui refresh
entryBookTableModel.updateEntryBook(selectedEntryBook);
+ } catch (LimaException ex) {
+ throw new LimaRuntimeException("Can't update entry book", ex);
}
- } catch (LimaException eee) {
- if (log.isErrorEnabled()) {
- log.error("Can't add update book", eee);
- }
- DialogHelper.showErrorMessageDialog(view, eee);
}
}
+ /**
+ * Delete selected entry book.
+ */
public void deleteEntryBook() {
JXTable entryBookTable = view.getEntryBooksTable();
int selectedRow = entryBookTable.getSelectedRow();
- EntryBookTableModel entryBookTableModel =
- (EntryBookTableModel) entryBookTable.getModel();
+ EntryBookTableModel entryBookTableModel = (EntryBookTableModel) entryBookTable.getModel();
- // add it
- try {
- EntryBook selectedEntryBook =
- entryBookTableModel.getEntryBookAtRow(selectedRow);
+ EntryBook selectedEntryBook = entryBookTableModel.getEntryBookAtRow(selectedRow);
- int response =
- JOptionPane.showConfirmDialog(view,
- _("lima.charts.entrybook.confirmation",
- selectedEntryBook.getLabel()),
- _("lima.common.confirmation"), JOptionPane.YES_NO_OPTION,
- JOptionPane.QUESTION_MESSAGE);
+ int response = JOptionPane.showConfirmDialog(view,
+ _("lima.ui.entrybook.deletemessage", selectedEntryBook.getLabel()),
+ _("lima.ui.entrybook.deletetitle"), JOptionPane.YES_NO_OPTION,
+ JOptionPane.QUESTION_MESSAGE);
- if (response == JOptionPane.YES_OPTION) {
+ if (response == JOptionPane.YES_OPTION) {
+
+ try {
+ entryBookService.removeEntryBook(selectedEntryBook);
entryBookTableModel.removeEntryBook(selectedEntryBook);
+ } catch (LimaException ex) {
+ throw new LimaRuntimeException("Can't delete entry book", ex);
}
- } catch (LimaException eee) {
- if (log.isErrorEnabled()) {
- log.error("Can't delete update book", eee);
- }
- DialogHelper.showErrorMessageDialog(view, eee);
}
+
}
-
+ /**
+ * Import entry book.
+ *
+ * UI will be refreshed by {@link #notifyMethod(String, String)} called
+ * by service listener.
+ */
public void importEntryBooks() {
- EntryBookImportForm form =
- new EntryBookImportForm();
+ EntryBookImportForm form = new EntryBookImportForm(view);
form.setLocationRelativeTo(view);
form.setVisible(true);
- Object value = form.getRadioButtons().getSelectedValue();
+ Object value = form.getButtonGroup().getSelectedValue();
// if action confirmed
if (value != null) {
- EntryBooksChartEnum defaultEntryBooksEnum =
- (EntryBooksChartEnum) value;
+ EntryBooksChartEnum defaultEntryBooksEnum = (EntryBooksChartEnum) value;
ImportExport importExport = new ImportExport(view);
importExport.importExport(ImportExportEnum.CSV_ENTRYBOOKS_IMPORT,
defaultEntryBooksEnum.getFilePath(), true);
}
}
+ @Override
+ public void notifyMethod(String serviceName, String methodeName) {
+
+ //refresh on import datas
+ if (methodeName.contains("importEntryBooks")
+ || methodeName.contains("importAll")
+ || methodeName.contains("importAs")) {
+ loadAllEntryBooks();
+ }
+ }
}
-
Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/package-info.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/package-info.java (rev 0)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/package-info.java 2012-04-05 14:09:35 UTC (rev 3354)
@@ -0,0 +1,31 @@
+/*
+ * #%L
+ *
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Codelutin, Chatellier Eric
+ * %%
+ * 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>.
+ * #L%
+ */
+/**
+ * Gestion des journaux.
+ *
+ * Onglet presentant la liste des journaux en table avec action de creation,
+ * modification, suppression...
+ */
+package org.chorem.lima.ui.entrybook;
Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/package-info.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
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 2012-04-05 10:58:58 UTC (rev 3353)
+++ trunk/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties 2012-04-05 14:09:35 UTC (rev 3354)
@@ -267,9 +267,11 @@
lima.tooltip.filter=<html>Regular expression \:<br/>- accounts interval i..j <br/>- accounts list i,j,k <br/>- Exclude an account -i</html>
lima.tooltip.lettering=<html>Add a letter on many entries <br/>Select many rows with combination ctrl + click</html>
lima.ui.account.addAccount=
+lima.ui.account.addaccount=
lima.ui.account.addaccounttitle=
lima.ui.account.base=
lima.ui.account.developed=
+lima.ui.account.importtitle=
lima.ui.account.label=
lima.ui.account.number=
lima.ui.account.removeaccountconfirm=
@@ -280,6 +282,17 @@
lima.ui.common.ok=
lima.ui.common.remove=
lima.ui.common.update=
+lima.ui.entrybook.add=
+lima.ui.entrybook.code=
+lima.ui.entrybook.default=
+lima.ui.entrybook.deletemessage=
+lima.ui.entrybook.deletetitle=
+lima.ui.entrybook.entrybooktile=
+lima.ui.entrybook.import=
+lima.ui.entrybook.importtitle=
+lima.ui.entrybook.label=
+lima.ui.entrybook.remove=
+lima.ui.entrybook.update=
lima.ui.importexport.importcsv=
lima.ui.importexport.importebp=
lima.vatreport.listerror=Can't get entries list
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 2012-04-05 10:58:58 UTC (rev 3353)
+++ trunk/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties 2012-04-05 14:09:35 UTC (rev 3354)
@@ -266,10 +266,11 @@
lima.title.about.description=Logiciel de comptabilité Libre
lima.tooltip.filter=<html>Expression régulière \:<br/>- intervalle de compte i..j <br/>- liste de compte i,j,k <br/>- Exclure un compte -i</html>
lima.tooltip.lettering=<html>Pour ajouter une lettre à plusieurs écritures <br/>Sélectionner plusieurs lignes avec la combinaison ctrl + click</html>
-lima.ui.account.addAccount=Nouveau compte
+lima.ui.account.addaccount=Nouveau compte
lima.ui.account.addaccounttitle=Ajout d'un compte
lima.ui.account.base=Plan comptable de base
lima.ui.account.developed=Plan comptable développé
+lima.ui.account.importtitle=Importer
lima.ui.account.label=Libellé
lima.ui.account.number=Numéro de compte
lima.ui.account.removeaccountconfirm=Voulez-vous supprimer le compte %s ?
@@ -280,6 +281,17 @@
lima.ui.common.ok=Ok
lima.ui.common.remove=Supprimer
lima.ui.common.update=Modifier
+lima.ui.entrybook.add=Ajout de journal
+lima.ui.entrybook.code=Code
+lima.ui.entrybook.default=Journaux par défault
+lima.ui.entrybook.deletemessage=Êtes vous sûr de vouloir supprimer le journal %s ?
+lima.ui.entrybook.deletetitle=Suppression de journal
+lima.ui.entrybook.entrybooktile=Journal
+lima.ui.entrybook.import=Importer
+lima.ui.entrybook.importtitle=Import
+lima.ui.entrybook.label=Libellé
+lima.ui.entrybook.remove=Supprimer
+lima.ui.entrybook.update=Modifier
lima.ui.importexport.importcsv=Import/Export CSV
lima.ui.importexport.importebp=Import/Export EBP
lima.vatreport.listerror=Erreur lors de la récupération des données de la liste
1
0
Author: echatellier
Date: 2012-04-05 12:58:58 +0200 (Thu, 05 Apr 2012)
New Revision: 3353
Url: http://chorem.org/repositories/revision/lima/3353
Log:
Add add/update/delete account code
Added:
trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountTreeTableModel.java
Removed:
trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountTreeTable.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/SubLedgerForm.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/UpdateSubLedgerForm.jaxx
Modified:
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/AccountService.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/AccountServiceLocal.java
trunk/lima-swing/src/main/java/org/chorem/lima/LimaContext.java
trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountForm.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountImportForm.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountTreeTableRenderer.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/account/UpdateAccountForm.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/FinancialStatementChartViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/OpeningViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartViewHandler.java
trunk/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties
trunk/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties
trunk/lima-swing/src/main/resources/log4j.properties
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 2012-04-05 10:10:32 UTC (rev 3352)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java 2012-04-05 10:58:58 UTC (rev 3353)
@@ -84,9 +84,11 @@
* Create new account with existing transaction.
*/
@Override
- public void createAccountWithTransaction(Account account,
+ public Account createAccountWithTransaction(Account account,
TopiaContext topiaContext) throws LimaException {
+ Account result = null;
+
try {
// force uppercase account number
account.setAccountNumber(account.getAccountNumber().toUpperCase());
@@ -104,12 +106,14 @@
}
//create it
- accountDAO.create(account);
+ result = accountDAO.create(account);
commitTransaction(topiaContext);
} catch (TopiaException ex) {
doCatch(topiaContext, ex);
}
+
+ return result;
}
@@ -123,12 +127,13 @@
* @throws LimaException
*/
@Override
- public void createAccount(Account account) throws LimaException {
+ public Account createAccount(Account account) throws LimaException {
// check rules before create the account
AccountingRules accountingRules = LimaConfig.getInstance().getAccountingRules();
accountingRules.createAccountRules(account);
+ Account result = null;
TopiaContext transaction = beginTransaction(rootContext);
try {
@@ -142,12 +147,13 @@
account.getAccountNumber()));
}
- createAccountWithTransaction(account, transaction);
+ result = createAccountWithTransaction(account, transaction);
} catch (Exception ex) {
doCatch(transaction, ex);
} finally {
doFinally(transaction);
}
+ return result;
}
/** Permer d'obtenir la liste des comptes à partir d'une de ses propriétés */
@@ -309,15 +315,9 @@
/** Get list of all subaccount and ledger of an account */
@Override
- public List<Account> getAllChildrenAccounts(Account masterAccount,
- List<Account> accounts) throws LimaException {
+ public List<Account> getAllChildrenAccounts(Account masterAccount) throws LimaException {
- List<Account> childAccounts = getChildrenAccounts(masterAccount);
- accounts.addAll(childAccounts);
- for (Account account : childAccounts) {
- getAllChildrenAccounts(account, accounts);
- }
- return accounts;
+ return null;
}
/**
@@ -335,32 +335,16 @@
AccountingRules accountingRules = LimaConfig.getInstance().getAccountingRules();
try {
- AccountDAO accountDAO =
- LimaCallaoDAOHelper.getAccountDAO(transaction);
// Check rules for account if have entries
accountingRules.removeAccountRules(account, transaction);
// remove account
+ AccountDAO accountDAO = LimaCallaoDAOHelper.getAccountDAO(transaction);
Account accountToDelete = accountDAO.findByTopiaId(account.getTopiaId());
-
- //get all subaccounts
- List<Account> accounts =
- getAllChildrenAccounts(accountToDelete, new ArrayList<Account>());
- //if account have sub accounts
- if (accounts.size() > 0) {
- for (Account subAccount : accounts) {
- // Check rules for subaccount if have entries
- accountingRules.removeAccountRules(subAccount, transaction);
- Account subAccountToDelete =
- accountDAO.findByTopiaId(subAccount.getTopiaId());
- accountDAO.delete(subAccountToDelete);
- }
- }
-
accountDAO.delete(accountToDelete);
- //commit
commitTransaction(transaction);
+
} catch (Exception ex) {
doCatch(transaction, ex);
} finally {
@@ -378,7 +362,7 @@
/**
- * Permet de modifier un compte sur son label et son compte père.
+ * Permet de modifier un compte sur son label.
* <p/>
* Il n'est pas possible de modifier un numéro de compte.
* Si le compte n'existe pas, il envoie alors un message d'avertissement.
@@ -387,23 +371,25 @@
* @throws LimaException
*/
@Override
- public void updateAccount(Account account) throws LimaException {
+ public Account updateAccount(Account account) throws LimaException {
TopiaContext transaction = beginTransaction(rootContext);
AccountingRules accountingRules = LimaConfig.getInstance().getAccountingRules();
+ Account result = null;
try {
// DAO
AccountDAO accountDAO =
LimaCallaoDAOHelper.getAccountDAO(transaction);
- Account subAccount = accountDAO.findByTopiaId(account.getTopiaId());
accountingRules.updateAccountRules(account);
- accountDAO.update(subAccount);
+ result = accountDAO.update(account);
commitTransaction(transaction);
} catch (Exception ex) {
doCatch(transaction, ex);
} finally {
doFinally(transaction);
}
+
+ return result;
}
}
\ No newline at end of file
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/AccountService.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/AccountService.java 2012-04-05 10:10:32 UTC (rev 3352)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/AccountService.java 2012-04-05 10:58:58 UTC (rev 3353)
@@ -83,20 +83,18 @@
* Create new account. If {@code masterAccount} is not null, {@code account}
* is added in {@code masterAccount}'s subAccounts.
*
- * @param masterAccount master account (can be null)
* @param account account
* @throws LimaException
*/
- void createAccount(Account account) throws LimaException;
+ Account createAccount(Account account) throws LimaException;
- void updateAccount(Account account) throws LimaException;
+ Account updateAccount(Account account) throws LimaException;
void removeAccount(Account account) throws LimaException;
void removeAllAccount() throws LimaException;
- List<Account> getAllChildrenAccounts(Account masterAccount,
- List<Account> accounts) throws LimaException;
+ List<Account> getAllChildrenAccounts(Account masterAccount) throws LimaException;
List<Account> getChildrenAccounts(Account masterAccount) throws LimaException;
}
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/AccountServiceLocal.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/AccountServiceLocal.java 2012-04-05 10:10:32 UTC (rev 3352)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/AccountServiceLocal.java 2012-04-05 10:58:58 UTC (rev 3353)
@@ -43,6 +43,6 @@
@Local
public interface AccountServiceLocal extends AccountService {
- void createAccountWithTransaction(Account account, TopiaContext topiaContext) throws LimaException;
+ Account createAccountWithTransaction(Account account, TopiaContext topiaContext) throws LimaException;
}
\ No newline at end of file
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/LimaContext.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/LimaContext.java 2012-04-05 10:10:32 UTC (rev 3352)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/LimaContext.java 2012-04-05 10:58:58 UTC (rev 3353)
@@ -5,7 +5,7 @@
* $Id$
* $HeadURL$
* %%
- * Copyright (C) 2008 - 2010 CodeLutin
+ * Copyright (C) 2008 - 2012 CodeLutin, Chatellier Eric
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
@@ -25,9 +25,12 @@
package org.chorem.lima;
+import java.util.Locale;
+
import jaxx.runtime.JAXXUtil;
import jaxx.runtime.context.DefaultApplicationContext;
import jaxx.runtime.context.JAXXContextEntryDef;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.ui.LimaDecoratorProvider;
@@ -35,15 +38,10 @@
import org.chorem.lima.ui.MainViewHandler;
import org.nuiton.i18n.I18n;
import org.nuiton.i18n.init.DefaultI18nInitializer;
-import org.nuiton.i18n.init.UserI18nInitializer;
-import org.nuiton.util.FileUtil;
+import org.nuiton.i18n.init.I18nInitializer;
import org.nuiton.util.StringUtil;
import org.nuiton.util.decorator.DecoratorProvider;
-import java.io.File;
-import java.io.IOException;
-import java.util.Locale;
-
/** @author chemit */
public class LimaContext extends DefaultApplicationContext {
@@ -116,34 +114,13 @@
I18n.close();
- File i18nDirectory = config.getI18nDirectory();
-
- if (log.isInfoEnabled()) {
- log.info("I18n directory : " + i18nDirectory);
- }
- try {
- //create directory to store i18n files
- FileUtil.createDirectoryIfNecessary(i18nDirectory);
- } catch (IOException eee) {
- throw new RuntimeException(
- "Could not create directory " +
- i18nDirectory.getParentFile(), eee);
- }
- UserI18nInitializer i18nInitializer =
- new UserI18nInitializer(
- i18nDirectory,
- new DefaultI18nInitializer("lima")
- );
-
+ I18nInitializer i18nInitializer = new DefaultI18nInitializer("lima");
Locale locale = config.getLocale();
-
I18n.init(i18nInitializer, locale);
// Default Locale for DatePicker
Locale.setDefault(locale);
- getDecoratorProvider().reload();
-
long t00 = System.nanoTime();
if (log.isDebugEnabled()) {
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java 2012-04-05 10:10:32 UTC (rev 3352)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java 2012-04-05 10:58:58 UTC (rev 3353)
@@ -31,7 +31,6 @@
import org.chorem.lima.business.ejbinterface.AccountService;
import org.chorem.lima.business.monitorable.AccountServiceMonitorable;
import org.chorem.lima.business.monitorable.HttpServerServiceMonitorable;
-import org.chorem.lima.entity.Account;
import org.chorem.lima.service.LimaServiceFactory;
import org.chorem.lima.ui.MainView;
import org.chorem.lima.ui.MainViewHandler;
@@ -41,7 +40,6 @@
import javax.swing.SwingUtilities;
import java.util.Arrays;
import java.util.Date;
-import java.util.List;
import static org.nuiton.i18n.I18n._;
@@ -115,17 +113,19 @@
// see if this can be dangerous (should not be since jnlp is signed ?)
// moreover it speeds up the loading :)
System.setSecurityManager(null);
-
Runtime.getRuntime().addShutdownHook(new ShutdownHook());
// init root context
LimaContext context = LimaContext.init();
LimaConfig config = context.getConfig();
config.parse(args);
-
- LimaServiceFactory.initFactory(config);
context.initI18n(config);
+ return context;
+ }
+
+ protected static void launch(LimaContext context) throws Exception {
+
// prepare ui look&feel and load ui properties
try {
SwingUtil.initNimbusLoookAndFeel();
@@ -135,13 +135,10 @@
log.warn(_("lima.warning.nimbus.landf"));
}
}
- return context;
- }
- protected static void launch(LimaContext context) throws Exception {
-
splash.drawVersion(config.getVersion());
splash.updateProgression(0.1, _("lima.splash.1"));
+ LimaServiceFactory.initFactory(config);
// do init ui
MainViewHandler uiHandler = context.getContextValue(MainViewHandler.class);
@@ -182,17 +179,6 @@
});
}
- /*protected static void saveTraces(File file) {
- String stats = NuitonTrace.getStatisticsCSVAndClear();
- try {
- FileUtil.writeString(file, stats, "utf-8");
- } catch (IOException e) {
- if (log.isErrorEnabled()) {
- log.error("Could not save traces to file " + file, e);
- }
- }
- }*/
-
public static class ShutdownHook extends Thread {
public ShutdownHook() {
@@ -202,14 +188,6 @@
@Override
public void run() {
try {
- super.run();
- /*File file = new File("lima-trace.csv");
- saveTraces(file);
- String stats = NuitonTrace.getStatisticsCSVAndClear();
- if (log.isInfoEnabled()) {
- log.info(stats);
- }*/
-
LimaContext.get().close();
LimaServiceFactory.destroy();
// force to kill main thread
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 2012-04-05 10:10:32 UTC (rev 3352)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java 2012-04-05 10:58:58 UTC (rev 3353)
@@ -458,7 +458,7 @@
public void showImportExportView(JAXXContext rootContext,
ImportExportEnum type) {
MainView mainView = getUI(rootContext);
- ImportExport importExport = ImportExport.getInstance(mainView);
+ ImportExport importExport = new ImportExport(mainView);
importExport.importExport(type, "", true);
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountForm.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountForm.jaxx 2012-04-05 10:10:32 UTC (rev 3352)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountForm.jaxx 2012-04-05 10:58:58 UTC (rev 3353)
@@ -5,7 +5,7 @@
$Id$
$HeadURL$
%%
- Copyright (C) 2008 - 2010 CodeLutin
+ Copyright (C) 2008 - 2012 CodeLutin, Chatellier Eric
%%
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as
@@ -23,28 +23,21 @@
#L%
-->
-<JDialog modal="true" defaultCloseOperation="{JDialog.DO_NOTHING_ON_CLOSE}"
- onWindowClosing="dispose()">
+<JDialog title="lima.ui.account.addaccounttitle" modal="true"
+ defaultCloseOperation="{JDialog.DO_NOTHING_ON_CLOSE}" onWindowClosing="dispose()">
<import>
javax.swing.text.Document
org.chorem.lima.entity.Account
</import>
- <AccountViewHandler id='handler'
- initializer='getContextValue(AccountView.class,JAXXUtil.PARENT).getHandler()'/>
+ <AccountViewHandler id='handler' initializer='getContextValue(AccountView.class,JAXXUtil.PARENT).getHandler()'/>
- <Account id="account" javaBean='null'/>
+ <Account id="account" javaBean='new org.chorem.lima.entity.AccountImpl()'/>
<script>
<![CDATA[
getRootPane().setDefaultButton(ok);
-
- @Override
- public void dispose() {
- setAccount(null);
- super.dispose();
- }
]]>
</script>
@@ -78,7 +71,7 @@
<JPanel layout='{new GridLayout(1,0)}'>
<JButton text="lima.common.cancel" onActionPerformed="dispose()"/>
<JButton id="ok" text="lima.common.ok"
- onActionPerformed="handler.doAddAccount(this)"/>
+ onActionPerformed="handler.addAccount(this)"/>
</JPanel>
</cell>
</row>
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountImportForm.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountImportForm.jaxx 2012-04-05 10:10:32 UTC (rev 3352)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountImportForm.jaxx 2012-04-05 10:58:58 UTC (rev 3353)
@@ -5,7 +5,7 @@
$Id$
$HeadURL$
%%
- Copyright (C) 2008 - 2010 CodeLutin
+ Copyright (C) 2008 - 2012 CodeLutin, Chatellier Eric
%%
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as
@@ -28,18 +28,17 @@
onWindowClosing="performCancel();">
<import>
- jaxx.runtime.swing.JAXXButtonGroup
org.chorem.lima.enums.AccountsChartEnum
</import>
- <JAXXButtonGroup id="radioButtons" javaBean='new JAXXButtonGroup()'/>
- <Boolean id="addState" javaBean='true'/>
+ <javax.swing.ButtonGroup id="buttonGroup" />
+ <Boolean id="addState" javaBean='true' />
<script>
<![CDATA[
getRootPane().setDefaultButton(ok);
protected void performCancel() {
- getRadioButtons().setSelectedValue(null);
+ buttonGroup.setSelectedValue(null);
dispose();
}
]]>
@@ -53,41 +52,41 @@
</row>
<row>
<cell>
- <JRadioButton text='lima.charts.account.shortened'
+ <JRadioButton text='lima.ui.account.shortened'
value='{AccountsChartEnum.SHORTENED}'
- buttonGroup="{getRadioButtons()}"
+ buttonGroup="{buttonGroup}"
selected='true'/>
</cell>
</row>
<row>
<cell>
- <JRadioButton text='lima.charts.account.base'
+ <JRadioButton text='lima.ui.account.base'
value='{AccountsChartEnum.BASE}'
- buttonGroup="{getRadioButtons()}"
+ buttonGroup="{buttonGroup}"
selected='true'/>
</cell>
</row>
<row>
<cell>
- <JRadioButton text='lima.charts.account.developed'
+ <JRadioButton text='lima.ui.account.developed'
value='{AccountsChartEnum.DEVELOPED}'
- buttonGroup="{getRadioButtons()}"
+ buttonGroup="{buttonGroup}"
selected='true'/>
</cell>
</row>
<row>
<cell>
- <JRadioButton text='lima.importexport.importcsv'
+ <JRadioButton text='lima.ui.importexport.importcsv'
value='{AccountsChartEnum.IMPORT}'
- buttonGroup="{getRadioButtons()}"
+ buttonGroup="{buttonGroup}"
selected='true'/>
</cell>
</row>
<row>
<cell>
- <JRadioButton text='lima.importexport.importebp'
+ <JRadioButton text='lima.ui.importexport.importebp'
value='{AccountsChartEnum.IMPORTEBP}'
- buttonGroup="{getRadioButtons()}"
+ buttonGroup="{buttonGroup}"
selected='true'/>
</cell>
</row>
@@ -96,11 +95,11 @@
<Table>
<row>
<cell fill="none">
- <JButton text="lima.common.cancel"
+ <JButton text="lima.ui.common.cancel"
onActionPerformed="performCancel()"/>
</cell>
<cell fill="none">
- <JButton id="ok" text="lima.common.ok"
+ <JButton id="ok" text="lima.ui.common.ok"
onActionPerformed="dispose()"/>
</cell>
</row>
Deleted: trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountTreeTable.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountTreeTable.java 2012-04-05 10:10:32 UTC (rev 3352)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountTreeTable.java 2012-04-05 10:58:58 UTC (rev 3353)
@@ -1,103 +0,0 @@
-/*
- * #%L
- * Lima :: Swing
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2008 - 2011 CodeLutin
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-package org.chorem.lima.ui.account;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jdesktop.swingx.JXTreeTable;
-
-import java.awt.event.KeyEvent;
-import java.awt.event.KeyListener;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-
-@Deprecated
-public class AccountTreeTable extends JXTreeTable
- implements KeyListener, MouseListener {
-
- /** serialVersionUID. */
- private static final long serialVersionUID = 1092873442245932784L;
-
- /** log. */
- private static final Log log = LogFactory
- .getLog(AccountTreeTable.class);
-
- protected AccountViewHandler handler;
-
- public AccountTreeTable(AccountViewHandler handler) {
-
- this.handler = handler;
-
- addKeyListener(this);
- addMouseListener(this);
-
- }
-
- @Override
- public void mouseClicked(MouseEvent e) {
- }
-
- @Override
- public void mousePressed(MouseEvent e) {
- if (rowAtPoint(e.getPoint()) == -1) {
- clearSelection();
- }
- }
-
- @Override
- public void mouseReleased(MouseEvent e) {
- }
-
- @Override
- public void mouseEntered(MouseEvent e) {
- }
-
- @Override
- public void mouseExited(MouseEvent e) {
- }
-
- @Override
- public void keyTyped(KeyEvent e) {
- }
-
- /**
- * for each action combination key are think
- * for extend keyboard and laptop keyboard
- */
- @Override
- public void keyPressed(KeyEvent e) {
- // clear row selection with the key: escape
- if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
- if (!isEditing()) {
- clearSelection();
- }
- }
- }
-
- @Override
- public void keyReleased(KeyEvent e) {
- }
-
-}
Added: 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 (rev 0)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountTreeTableModel.java 2012-04-05 10:58:58 UTC (rev 3353)
@@ -0,0 +1,67 @@
+/*
+ * #%L
+ *
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Codelutin, Chatellier Eric
+ * %%
+ * 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>.
+ * #L%
+ */
+
+package org.chorem.lima.ui.account;
+
+import org.chorem.lima.entity.Account;
+import org.jdesktop.swingx.treetable.DefaultTreeTableModel;
+import org.jdesktop.swingx.treetable.MutableTreeTableNode;
+import org.jdesktop.swingx.treetable.TreeTableNode;
+
+/**
+ * Account tree table model redefining get value at for column.
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * By : $Author$
+ */
+public class AccountTreeTableModel extends DefaultTreeTableModel {
+
+ /**
+ * Creates a new {@code DefaultTreeTableModel} with the specified
+ * {@code root}.
+ *
+ * @param root the root node of the tree
+ */
+ public AccountTreeTableModel(TreeTableNode root) {
+ super(root);
+ }
+
+ @Override
+ public Object getValueAt(Object node, int column) {
+ MutableTreeTableNode treenode = (MutableTreeTableNode)node;
+ Account account = (Account)treenode.getUserObject();
+
+ Object result = null;
+ if (account != null && column == 1) {
+ result = account.getLabel();
+ }
+
+ return result;
+ }
+
+}
Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountTreeTableModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountTreeTableRenderer.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountTreeTableRenderer.java 2012-04-05 10:10:32 UTC (rev 3352)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountTreeTableRenderer.java 2012-04-05 10:58:58 UTC (rev 3353)
@@ -28,9 +28,9 @@
import java.awt.Component;
import javax.swing.JTree;
+import javax.swing.tree.DefaultTreeCellRenderer;
import org.chorem.lima.entity.Account;
-import org.jdesktop.swingx.renderer.DefaultTreeRenderer;
import org.jdesktop.swingx.treetable.MutableTreeTableNode;
/**
@@ -42,7 +42,7 @@
* Last update : $Date$
* By : $Author$
*/
-public class AccountTreeTableRenderer extends DefaultTreeRenderer {
+public class AccountTreeTableRenderer extends DefaultTreeCellRenderer {
/** serialVersionUID. */
private static final long serialVersionUID = -3249368726501873583L;
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 2012-04-05 10:10:32 UTC (rev 3352)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountView.jaxx 2012-04-05 10:58:58 UTC (rev 3353)
@@ -46,40 +46,34 @@
<JXTreeTable id="accountsTreeTable"
selectionMode="{ListSelectionModel.SINGLE_SELECTION}"
treeCellRenderer="{new AccountTreeTableRenderer()}"
- highlighters="{HighlighterFactory.createSimpleStriping(new java.awt.Color(222,222,222))}"/>
+ highlighters="{HighlighterFactory.createSimpleStriping(new java.awt.Color(233,233,233))}"/>
<ListSelectionModel initializer='accountsTreeTable.getSelectionModel()'
onValueChanged="setSelectedRow(accountsTreeTable.getSelectedRow() != -1)"/>
</JScrollPane>
</cell>
<cell fill="horizontal">
- <JButton id="addButton" text="lima.charts.account.addAccount"
- onActionPerformed="handler.launchAddAccountForm()"/>
+ <JButton id="addButton" text="lima.ui.account.addAccount"
+ onActionPerformed="handler.addAccount()"/>
</cell>
</row>
<row>
<cell fill="horizontal">
- <JButton id="addSubLedger" text="lima.charts.account.addSubLedger"
- onActionPerformed="/*handler.launchAddSubLedgerForm()*/"/>
- </cell>
- </row>
- <row>
- <cell fill="horizontal">
- <JButton id="updateButton" text="lima.common.update"
- onActionPerformed="handler.launchUpdateAccountForm()"
+ <JButton id="updateButton" text="lima.ui.common.update"
+ onActionPerformed="handler.updateAccount()"
enabled="{isSelectedRow()}"/>
</cell>
</row>
<row>
<cell fill="horizontal">
- <JButton id="removeButton" text="lima.common.remove"
- onActionPerformed="handler.doRemoveAccount()"
+ <JButton id="removeButton" text="lima.ui.common.remove"
+ onActionPerformed="handler.removeAccount()"
enabled="{isSelectedRow()}"/>
</cell>
</row>
<row>
<cell fill="horizontal">
- <JButton id="importButton" text="lima.importexport.import"
- onActionPerformed="handler.doImportAccountsChart()"/>
+ <JButton id="importButton" text="lima.iu.importexport.import"
+ onActionPerformed="handler.importAccountsChart()"/>
</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 2012-04-05 10:10:32 UTC (rev 3352)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java 2012-04-05 10:58:58 UTC (rev 3353)
@@ -31,6 +31,7 @@
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
@@ -52,15 +53,14 @@
import org.chorem.lima.business.monitorable.AccountServiceMonitorable;
import org.chorem.lima.business.monitorable.ImportServiceMonitorable;
import org.chorem.lima.entity.Account;
-import org.chorem.lima.entity.AccountImpl;
import org.chorem.lima.enums.AccountsChartEnum;
import org.chorem.lima.enums.ImportExportEnum;
import org.chorem.lima.service.LimaServiceFactory;
import org.chorem.lima.ui.importexport.ImportExport;
-import org.chorem.lima.util.ErrorHelper;
import org.jdesktop.swingx.JXTreeTable;
import org.jdesktop.swingx.treetable.DefaultMutableTreeTableNode;
import org.jdesktop.swingx.treetable.DefaultTreeTableModel;
+import org.jdesktop.swingx.treetable.MutableTreeTableNode;
import org.jdesktop.swingx.treetable.TreeTableNode;
/**
@@ -94,6 +94,9 @@
return result;
}
};
+ /**
+ * Sort Account number by lenght in reverse order.
+ */
protected static Comparator<String> reverseAccountLengthComparator = new Comparator<String>() {
@Override
public int compare(String o1, String o2) {
@@ -104,7 +107,7 @@
return result;
}
};
-
+
public AccountViewHandler(AccountView view) {
this.view = view;
// Gets factory service
@@ -112,6 +115,9 @@
accountService = LimaServiceFactory.getService(AccountServiceMonitorable.class);
}
+ /**
+ * Init initialized view by loading account data from service.
+ */
public void init() {
JXTreeTable table = view.getAccountsTreeTable();
table.addKeyListener(new KeyAdapter() {
@@ -151,6 +157,9 @@
// default data load
List<Account> accounts = accountService.getAllAccounts();
Collections.sort(accounts, accountLengthComparator);
+ if (log.isDebugEnabled()) {
+ log.debug(String.format("Loaded %d accounts from service", accounts.size()));
+ }
// render in tree node hierarchy for DefaultTreeTableModel
SortedMap<String, DefaultMutableTreeTableNode> nodeCache = new TreeMap<String, DefaultMutableTreeTableNode>(reverseAccountLengthComparator);
@@ -174,9 +183,10 @@
nodeCache.put(account.getAccountNumber(), node);
}
- DefaultTreeTableModel model = new DefaultTreeTableModel(root);
- model.setColumnIdentifiers(Arrays.asList(_("lima.table.number"),
- _("lima.table.label")));
+
+ // refreshing tree's model
+ DefaultTreeTableModel model = new AccountTreeTableModel(root);
+ model.setColumnIdentifiers(Arrays.asList(_("lima.table.number"), _("lima.table.label")));
JXTreeTable table = view.getAccountsTreeTable();
table.setTreeTableModel(model);
} catch (LimaException ex) {
@@ -184,25 +194,11 @@
}
}
- public void launchAddAccountForm() {
- Account newAccount = new AccountImpl();
- AccountForm accountForm = new AccountForm(view);
- accountForm.setAccount(newAccount);
- // jaxx constructor don't call super() ?
- accountForm.setLocationRelativeTo(view);
- accountForm.setVisible(true);
- }
-
/**
- * Open update account (or subledger) form with selected account
- * from the tree.
+ * Display add account view
*/
- public void launchUpdateAccountForm() {
- Account selectedObject = getSelectedAccount();
-
- UpdateAccountForm accountForm = new UpdateAccountForm(view);
- accountForm.setAccount(selectedObject);
- // jaxx constructor don't call super() ?
+ public void addAccount() {
+ AccountForm accountForm = new AccountForm(view);
accountForm.setLocationRelativeTo(view);
accountForm.setVisible(true);
}
@@ -212,115 +208,121 @@
*
* @param dialog the account form
*/
- public void doAddAccount(AccountForm dialog) {
+ public void addAccount(AccountForm dialog) {
try {
+
Account newAccount = dialog.getAccount();
+ newAccount = accountService.createAccount(newAccount);
- Account masterAccount = null;
+ // update tree
+ JXTreeTable treeTable = view.getAccountsTreeTable();
+ DefaultTreeTableModel model = (DefaultTreeTableModel)treeTable.getTreeTableModel();
+ DefaultMutableTreeTableNode node = (DefaultMutableTreeTableNode)findParentNode(model.getRoot(), newAccount.getAccountNumber());
+ DefaultMutableTreeTableNode newNode = new DefaultMutableTreeTableNode(newAccount);
- if (newAccount.getAccountNumber().length() > 1) {
-
- // a master account is required
- masterAccount = getMasterAccount(newAccount);
-
- if (masterAccount == null) {
-
- // bye-bye :(
- return;
- }
+ List<MutableTreeTableNode> nodesToMove = findSubNodes(node, newAccount.getAccountNumber());
+ for (MutableTreeTableNode nodeToMove : nodesToMove) {
+ model.removeNodeFromParent((MutableTreeTableNode)nodeToMove);
+ newNode.add(nodeToMove);
}
- // add it
- /*try {
- getTreeTableModel().addAccount(masterAccount, newAccount);
- } catch (LimaException ex) {
- if (log.isErrorEnabled()) {
- log.error("Can't add account", ex);
- }
- ErrorHelper.showErrorDialog(view, _("lima.account.addaccounterror"), ex);
- }*/
+ model.insertNodeInto(newNode, node, node.getChildCount());
+ treeTable.expandPath(new TreePath(model.getPathToRoot(node)));
+ } catch (LimaException ex) {
+ throw new LimaRuntimeException("Can't add account", ex);
} finally {
dialog.dispose();
}
}
- /*public void doAddSubLedger(SubLedgerForm dialog) {
+ /**
+ * Find potential parent node for account number.
+ *
+ * @param currentNode node
+ * @param accountNumber node label to search parent
+ * @return found parent (can't be null)
+ */
+ protected TreeTableNode findParentNode(TreeTableNode currentNode,
+ String accountNumber) {
- try {
- Account newAccount = dialog.getAccount();
+ TreeTableNode result = null;
+ Account account = (Account)currentNode.getUserObject();
- Account masterAccount = null;
-
- if (newAccount.getAccountNumber().length() > 1) {
-
- // a master account is required
- masterAccount = getMasterAccount(newAccount);
-
- if (masterAccount == null) {
-
- // bye-bye :(
- return;
- }
+ if (account == null || accountNumber.startsWith(account.getAccountNumber())) {
+ for (int childIndex = 0; childIndex < currentNode.getChildCount() && result == null; childIndex++) {
+ TreeTableNode child = currentNode.getChildAt(childIndex);
+ result = findParentNode(child, accountNumber);
}
- // add it
- try {
- getTreeTableModel().addSubLedger(masterAccount, newAccount);
- } catch (LimaException eee) {
- if (log.isErrorEnabled()) {
- log.error("Can't add subledger", eee);
- }
- ErrorHelper.showErrorDialog(view, "Can't add subledger", eee);
+ if (result == null) {
+ result = currentNode;
}
- } finally {
- dialog.dispose();
}
- }*/
- public void doUpdateAccount(UpdateAccountForm dialog) {
+ return result;
+ }
- Account account = dialog.getAccount();
-
- /*String newMasterAccountNumber =
- dialog.getMasterAccountTextField().getText();
- String newLabel = dialog.getDescriptionTextField().getText();
-
- boolean hasChanged =
- updateMasterAccount(account, newMasterAccountNumber);
- hasChanged |= updateLabel(account, newLabel);*/
-
- try {
- //if (hasChanged) {
-
- // can update account
- updateAccount(account);
- //}
-
- } finally {
-
- // close dialog
- dialog.dispose();
+ /**
+ * Find all subnodes in currentNode with account label starting with accountNumber.
+ *
+ * @param currentNode currentNode to search into
+ * @param accountNumber accountNumber number to search
+ * @return node list
+ */
+ protected List<MutableTreeTableNode> findSubNodes(TreeTableNode currentNode, String accountNumber) {
+ List<MutableTreeTableNode> nodes = new ArrayList<MutableTreeTableNode>();
+ for (int childIndex = 0; childIndex < currentNode.getChildCount(); childIndex++) {
+ MutableTreeTableNode child = (MutableTreeTableNode)currentNode.getChildAt(childIndex);
+ Account account = (Account)child.getUserObject();
+ if (account.getAccountNumber().startsWith(accountNumber)) {
+ nodes.add(child);
+ }
}
+ return nodes;
}
- public void doUpdateSubLedger(UpdateSubLedgerForm dialog) {
+ /**
+ * Open update account (or subledger) form with selected account
+ * from the tree.
+ */
+ public void updateAccount() {
+ JXTreeTable treeTable = view.getAccountsTreeTable();
- Account account = dialog.getAccount();
+ // get selected account
+ int selectedRow = treeTable.getSelectedRow();
+ TreePath treePath = treeTable.getPathForRow(selectedRow);
+ TreeTableNode lastPathComponent = (TreeTableNode) treePath.getLastPathComponent();
+ Account selectedAccount = (Account)lastPathComponent.getUserObject();
- /*String newMasterAccountNumber =
- dialog.getMasterAccountTextField().getText();
- String newLabel = dialog.getDescriptionTextField().getText();
- String newThirdParty = dialog.getThirdPartyTextField().getText();
+ // display edit form
+ UpdateAccountForm accountForm = new UpdateAccountForm(view);
+ accountForm.setAccount(selectedAccount);
+ accountForm.setLocationRelativeTo(view);
+ accountForm.setVisible(true);
+ }
- boolean hasChanged = updateMasterAccount(account,
- newMasterAccountNumber);
- hasChanged |= updateLabel(account, newLabel);
- hasChanged |= updateThirdParty(account, newThirdParty);*/
+ /**
+ * Perform update account to service.
+ *
+ * @param dialog dialog containing account
+ */
+ public void updateAccount(UpdateAccountForm dialog) {
try {
- // can update subLedger
- updateAccount(account);
+ Account account = dialog.getAccount();
+ account = accountService.updateAccount(account);
+
+ // update tree
+ JXTreeTable treeTable = view.getAccountsTreeTable();
+ DefaultTreeTableModel model = (DefaultTreeTableModel)treeTable.getTreeTableModel();
+ int selectedRow = treeTable.getSelectedRow();
+ TreePath treePath = treeTable.getPathForRow(selectedRow);
+ //TreeTableNode lastPathComponent = (TreeTableNode) treePath.getLastPathComponent();
+ //lastPathComponent.setUserObject(account);
+ model.valueForPathChanged(treePath, account);
+ } catch (LimaException ex) {
+ throw new LimaRuntimeException("Can't update account", ex);
} finally {
// close dialog
@@ -328,47 +330,52 @@
}
}
- /** Ask for user to remove for selected account, and remove it if confirmed. */
- public void doRemoveAccount() {
+ /**
+ * Ask for user to remove for selected account, and remove it if confirmed.
+ */
+ public void removeAccount() {
// maybe this code can be factorised
JXTreeTable treeTable = view.getAccountsTreeTable();
-
- // Any row selected
int selectedRow = treeTable.getSelectedRow();
- if (selectedRow != -1) {
- int n = JOptionPane.showConfirmDialog(view,
- _("lima.charts.account.question.remove"),
- _("lima.common.question"),
- JOptionPane.YES_NO_OPTION,
- JOptionPane.QUESTION_MESSAGE);
- if (n == JOptionPane.YES_OPTION) {
- // update view of treetable
- TreePath treePath =
- treeTable.getPathForRow(selectedRow);
+ TreePath treePath = treeTable.getPathForRow(selectedRow);
+ MutableTreeTableNode lastNode = (MutableTreeTableNode)treePath.getLastPathComponent();
+ Account account = (Account)lastNode.getUserObject();
- /*try {
- getTreeTableModel().removeAccount(treePath);
- } catch (LimaException eee) {
- if (log.isErrorEnabled()) {
- log.error("Can't delete account", eee);
- }
- DialogHelper.showErrorMessageDialog(view, eee);
- }*/
+ int response = JOptionPane.showConfirmDialog(view,
+ _("lima.ui.account.removeaccountconfirm", account.getAccountNumber()),
+ _("lima.ui.account.removeaccounttitle"),
+ JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
+
+ if (response == JOptionPane.YES_OPTION) {
+ try {
+ accountService.removeAccount(account);
+
+ // add all sub accounts to parent
+ DefaultTreeTableModel model = (DefaultTreeTableModel)treeTable.getTreeTableModel();
+ MutableTreeTableNode parent = (MutableTreeTableNode)lastNode.getParent();
+ for (int childIndex = lastNode.getChildCount() -1 ; childIndex >= 0 ; childIndex--) {
+ MutableTreeTableNode child = (MutableTreeTableNode)lastNode.getChildAt(childIndex);
+ model.insertNodeInto(child, parent, parent.getChildCount());
+ }
+
+ // remove node
+ model.removeNodeFromParent(lastNode);
+ } catch (LimaException ex) {
+ throw new LimaRuntimeException("Can't remove account", ex);
}
}
}
- public void doImportAccountsChart() {
+ public void importAccountsChart() {
- AccountImportForm form = new AccountImportForm();
- //
+ AccountImportForm form = new AccountImportForm(view);
form.setLocationRelativeTo(view);
form.setVisible(true);
- ImportExport importExport = ImportExport.getInstance(view);
+ ImportExport importExport = new ImportExport(view);
- Object value = form.getRadioButtons().getSelectedValue();
+ Object value = form.getButtonGroup().getSelectedValue();
// if action confirmed
if (value != null) {
AccountsChartEnum defaultAccountsChartEnum =
@@ -388,127 +395,25 @@
}
}
+ /**
+ * Called when import methods are called on services.
+ */
@Override
- public void notifyMethod(String serviceName, String methodeName) {
+ public void notifyMethod(String serviceName, String methodName) {
- if (methodeName.contains("importAccounts") ||
- methodeName.contains("importAll") ||
- methodeName.contains("importAsCSV")) {
-
- // refresh model
- //getTreeTableModel().refreshTree();
-
- //FIXME tchemit-2011-09-23 Should never do this... refresh view
- view.repaint();
- }
- }
-
- /*protected boolean updateMasterAccount(Account account,
- String newMasterAccountNumber) {
- boolean hasChanged = false;
- String oldMasterAccountNumber = account.getMasterAccount() == null ?
- "" :
- account.getMasterAccount().getAccountNumber();
-
- if (ObjectUtils.notEqual(oldMasterAccountNumber, newMasterAccountNumber)) {
-
- // master account has changed
- hasChanged = true;
-
- // obtain new master account
- try {
- if (log.isInfoEnabled()) {
- log.info("setMaster : "
- + newMasterAccountNumber + " to : "
- + account.getAccountNumber());
- }
- Account masterAccount = accountService
- .getAccountByNumber(newMasterAccountNumber);
- account.setMasterAccount(masterAccount);
- } catch (LimaException eee) {
- log.debug("Can't search account for update : "
- + newMasterAccountNumber, eee);
+ if (methodName.contains("importAccounts") ||
+ methodName.contains("importAll") ||
+ methodName.contains("importAsCSV")) {
+
+ if (log.isInfoEnabled()) {
+ log.info(String.format("Service notification %s, reloading accounts", methodName));
}
- }
- return hasChanged;
- }
- protected boolean updateLabel(Account account, String newLabel) {
- boolean hasChanged = false;
- String oldLabel = account.getLabel();
- if (ObjectUtils.notEqual(oldLabel, newLabel)) {
-
- // label has changed
- hasChanged = true;
- account.setLabel(newLabel);
- }
- return hasChanged;
- }
-
- protected boolean updateThirdParty(Account account, String newThirdParty) {
- boolean hasChanged = false;
- String oldThirdParty = account.getThirdParty();
- if (ObjectUtils.notEqual(oldThirdParty, newThirdParty)) {
-
- // thirdparty has changed
- hasChanged = true;
- account.setThirdParty(newThirdParty);
- }
-
- return hasChanged;
- }*/
-
- protected void updateAccount(Account selectedObject) {
- /*try {
- getTreeTableModel().updateAccount(selectedObject);
- } catch (LimaException eee) {
- if (log.isErrorEnabled()) {
- log.error("Can't add update", eee);
+ loadAllAccounts();
+ } else {
+ if (log.isDebugEnabled()) {
+ log.debug("Ignoring service notification " + serviceName + ":" + methodName);
}
- DialogHelper.showErrorMessageDialog(view, eee);
- }*/
- }
-
- protected Account getMasterAccount(Account account) {
-
- String number = account.getAccountNumber();
-
- Account masterAccount;
-
-
- //search for the nearest account from the one been created
- //e.g.: for 41019 search for 4, 41, 410, 4101
- //and stop when the account doesn't exist, use last account found instead
- try {
-
- masterAccount = accountService.getMasterAccount(number);
-
- } catch (LimaException eee) {
- if (log.isErrorEnabled()) {
- log.error("Can't obtain master account for account number " + number, eee);
- }
- ErrorHelper.showErrorDialog(view, "Can't obtain master account for account number " + number, eee);
- return null;
}
-
- if (masterAccount == null) {
- ErrorHelper.showErrorDialog(_("lima.error.no.masteraccount", number));
- return null;
- }
- return masterAccount;
}
-
- protected Account getSelectedAccount() {
-
- JXTreeTable table = view.getAccountsTreeTable();
-
- Account selectedObject = null;
- int selectedRow = table.getSelectedRow();
- if (selectedRow > -1) {
- TreePath treePath = table.getPathForRow(selectedRow);
- TreeTableNode lastPathComponent = (TreeTableNode) treePath.getLastPathComponent();
- selectedObject = (Account)lastPathComponent.getUserObject();
- }
- return selectedObject;
- }
}
Deleted: trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/SubLedgerForm.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/SubLedgerForm.jaxx 2012-04-05 10:10:32 UTC (rev 3352)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/SubLedgerForm.jaxx 2012-04-05 10:58:58 UTC (rev 3353)
@@ -1,98 +0,0 @@
-<!--
- #%L
- Lima Swing
-
- $Id$
- $HeadURL$
- %%
- Copyright (C) 2008 - 2010 CodeLutin
- %%
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as
- published by the Free Software Foundation, either version 3 of the
- License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public
- License along with this program. If not, see
- <http://www.gnu.org/licenses/gpl-3.0.html>.
- #L%
- -->
-
-<JDialog modal="true" defaultCloseOperation="{JDialog.DO_NOTHING_ON_CLOSE}"
- onWindowClosing="dispose()">
-
- <import>
- javax.swing.text.Document
- org.chorem.lima.entity.Account
- </import>
-
- <AccountViewHandler id='handler'
- initializer='getContextValue(AccountView.class,JAXXUtil.PARENT).getHandler()'/>
-
- <Account id="account" javaBean='null'/>
-
- <script>
- <![CDATA[
- getRootPane().setDefaultButton(ok);
-
- @Override
- public void dispose() {
- setAccount(null);
- super.dispose();
- }
- ]]>
- </script>
-
- <Table>
- <row>
- <cell fill="horizontal">
- <JLabel text="lima.common.code" labelFor='{numberTextField}'/>
- </cell>
- <cell fill="horizontal">
- <JTextField id="numberTextField"
- text="{account.getAccountNumber()}"/>
- <Document initializer="numberTextField.getDocument()"
- onInsertUpdate='account.setAccountNumber(numberTextField.getText())'
- onRemoveUpdate='account.setAccountNumber(numberTextField.getText())'/>
- </cell>
- </row>
- <row>
- <cell fill="horizontal">
- <JLabel text="lima.common.label" labelFor='{descriptionTextField}'/>
- </cell>
- <cell fill="horizontal">
- <JTextField id="descriptionTextField" text="{account.getLabel()}"/>
- <Document initializer="descriptionTextField.getDocument()"
- onInsertUpdate='account.setLabel(descriptionTextField.getText())'
- onRemoveUpdate='account.setLabel(descriptionTextField.getText())'/>
- </cell>
- </row>
- <row>
- <cell fill="horizontal">
- <JLabel text="lima.identity.contact" labelFor='{thirdPartyTextField}'/>
- </cell>
- <cell fill="horizontal">
- <JTextField id="thirdPartyTextField"
- text="{account.getThirdParty()}"/>
- <Document
- javaBean="thirdPartyTextField.getDocument()"
- onInsertUpdate='account.setThirdParty(thirdPartyTextField.getText())'
- onRemoveUpdate='account.setThirdParty(thirdPartyTextField.getText())'/>
- </cell>
- </row>
- <row>
- <cell columns="2">
- <JPanel layout='{new GridLayout(1,0)}'>
- <JButton text="lima.common.cancel" onActionPerformed="dispose()"/>
- <JButton id="ok" text="lima.common.ok"
- onActionPerformed="/*handler.doAddSubLedger(this)*/"/>
- </JPanel>
- </cell>
- </row>
- </Table>
-</JDialog>
\ No newline at end of file
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/UpdateAccountForm.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/UpdateAccountForm.jaxx 2012-04-05 10:10:32 UTC (rev 3352)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/UpdateAccountForm.jaxx 2012-04-05 10:58:58 UTC (rev 3353)
@@ -5,7 +5,7 @@
$Id$
$HeadURL$
%%
- Copyright (C) 2008 - 2011 CodeLutin
+ Copyright (C) 2008 - 2012 CodeLutin, Chatellier Eric
%%
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as
@@ -22,26 +22,22 @@
<http://www.gnu.org/licenses/gpl-3.0.html>.
#L%
-->
-<JDialog modal="true" defaultCloseOperation="{JDialog.DO_NOTHING_ON_CLOSE}"
- onWindowClosing="dispose()">
+<JDialog title="lima.ui.account.updateaccounttitle" modal="true"
+ defaultCloseOperation="{JDialog.DO_NOTHING_ON_CLOSE}" onWindowClosing="dispose()">
<import>
+ javax.swing.text.Document
org.chorem.lima.entity.Account
</import>
- <Account id="account" javaBean='null'/>
-
<AccountViewHandler id='handler'
initializer='getContextValue(AccountView.class,JAXXUtil.PARENT).getHandler()'/>
+
+ <Account id="account" javaBean='null'/>
+
<script>
<![CDATA[
- getRootPane().setDefaultButton(ok);
-
- @Override
- public void dispose() {
- setAccount(null);
- super.dispose();
- }
+ getRootPane().setDefaultButton(okButton);
]]>
</script>
@@ -49,7 +45,7 @@
<row>
<cell fill="horizontal">
- <JLabel text="lima.charts.account.number" labelFor='{numberTextField}'/>
+ <JLabel text="lima.ui.account.number" labelFor='{numberTextField}'/>
</cell>
<cell fill="horizontal">
<JTextField id="numberTextField" editable='{false}'
@@ -58,28 +54,21 @@
</row>
<row>
<cell fill="horizontal">
- <JLabel text="lima.common.label" labelFor='{descriptionTextField}'/>
+ <JLabel text="lima.ui.account.label" labelFor='{descriptionTextField}'/>
</cell>
<cell fill="horizontal">
<JTextField id="descriptionTextField" text="{getAccount().getLabel()}"/>
+ <Document initializer="descriptionTextField.getDocument()"
+ onInsertUpdate='account.setLabel(descriptionTextField.getText())'
+ onRemoveUpdate='account.setLabel(descriptionTextField.getText())'/>
</cell>
</row>
- <!-- <row>
- <cell fill="horizontal">
- <JLabel text="lima.common.masteraccount"
- labelFor='{masterAccountTextField}'/>
- </cell>
- <cell fill="horizontal">
- <JTextField id="masterAccountTextField"
- text="{getAccount().getMasterAccount().getAccountNumber()}"/>
- </cell>
- </row> -->
<row>
<cell columns="2">
<JPanel layout='{new GridLayout(1,0)}'>
- <JButton text="lima.common.cancel" onActionPerformed="dispose()"/>
- <JButton id="ok" text="lima.common.ok"
- onActionPerformed="handler.doUpdateAccount(this)"/>
+ <JButton text="lima.ui.common.cancel" onActionPerformed="dispose()"/>
+ <JButton id="okButton" text="lima.ui.common.ok"
+ onActionPerformed="handler.updateAccount(this)"/>
</JPanel>
</cell>
</row>
Deleted: trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/UpdateSubLedgerForm.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/UpdateSubLedgerForm.jaxx 2012-04-05 10:10:32 UTC (rev 3352)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/UpdateSubLedgerForm.jaxx 2012-04-05 10:58:58 UTC (rev 3353)
@@ -1,96 +0,0 @@
-<!--
- #%L
- Lima :: Swing
-
- $Id$
- $HeadURL$
- %%
- Copyright (C) 2008 - 2011 CodeLutin
- %%
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as
- published by the Free Software Foundation, either version 3 of the
- License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public
- License along with this program. If not, see
- <http://www.gnu.org/licenses/gpl-3.0.html>.
- #L%
- -->
-<JDialog modal="true" defaultCloseOperation="{JDialog.DO_NOTHING_ON_CLOSE}"
- onWindowClosing="dispose()">
-
- <import>
- org.chorem.lima.entity.Account
- </import>
-
- <Account id="account" javaBean='null'/>
-
- <AccountViewHandler id='handler'
- initializer='getContextValue(AccountView.class,JAXXUtil.PARENT).getHandler()'/>
-
- <script>
- <![CDATA[
- getRootPane().setDefaultButton(ok);
-
- @Override
- public void dispose() {
- setAccount(null);
- super.dispose();
- }
- ]]>
- </script>
-
- <Table>
- <row>
- <cell fill="horizontal">
- <JLabel text="lima.common.code" labelFor='{numberTextField}'/>
- </cell>
- <cell fill="horizontal">
- <JTextField id="numberTextField" editable='{false}'
- text="{account.getAccountNumber()}"/>
- </cell>
- </row>
- <row>
- <cell fill="horizontal">
- <JLabel text="lima.common.label" labelFor='{descriptionTextField}'/>
- </cell>
- <cell fill="horizontal">
- <JTextField id="descriptionTextField" text="{getAccount().getLabel()}"/>
- </cell>
- </row>
- <!-- Lien Fiche contact-->
- <row>
- <cell fill="horizontal">
- <JLabel text="lima.identity.contact" labelFor='{thirdPartyTextField}'/>
- </cell>
- <cell fill="horizontal">
- <JTextField id="thirdPartyTextField" text="{getAccount().getThirdParty()}"/>
- </cell>
- </row>
- <!-- <row>
- <cell fill="horizontal">
- <JLabel text="lima.common.masteraccount"
- labelFor='{masterAccountTextField}'/>
- </cell>
- <cell fill="horizontal">
- <JTextField id="masterAccountTextField"
- text="{getAccount().getMasterAccount().getAccountNumber()}"/>
- </cell>
- </row> -->
- <row>
- <cell columns="2">
- <JPanel layout='{new GridLayout(1,0)}'>
- <JButton text="lima.common.cancel" onActionPerformed="dispose()"/>
- <JButton id="ok" text="lima.common.ok"
- onActionPerformed="handler.doUpdateSubLedger(this)"/>
- </JPanel>
- </cell>
- </row>
- </Table>
-</JDialog>
\ 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 2012-04-05 10:10:32 UTC (rev 3352)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookViewHandler.java 2012-04-05 10:58:58 UTC (rev 3353)
@@ -168,7 +168,7 @@
if (value != null) {
EntryBooksChartEnum defaultEntryBooksEnum =
(EntryBooksChartEnum) value;
- ImportExport importExport = ImportExport.getInstance(view);
+ ImportExport importExport = new ImportExport(view);
importExport.importExport(ImportExportEnum.CSV_ENTRYBOOKS_IMPORT,
defaultEntryBooksEnum.getFilePath(), true);
}
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 2012-04-05 10:10:32 UTC (rev 3352)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartViewHandler.java 2012-04-05 10:58:58 UTC (rev 3353)
@@ -293,7 +293,7 @@
}
FinancialStatementsChartEnum defaultFinancialStatementsEnum =
(FinancialStatementsChartEnum) value;
- ImportExport importExport = ImportExport.getInstance(view);
+ ImportExport importExport = new ImportExport(view);
importExport.importExport(ImportExportEnum.CSV_FINANCIALSTATEMENTS_IMPORT,
defaultFinancialStatementsEnum.getFilePath(), true);
}
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 2012-04-05 10:10:32 UTC (rev 3352)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java 2012-04-05 10:58:58 UTC (rev 3353)
@@ -65,11 +65,9 @@
public class ImportExport {
- private static ImportExport exchanger;
-
private static final Log log = LogFactory.getLog(AccountViewHandler.class);
- protected static Component viewComponent;
+ protected Component viewComponent;
protected EncodingEnum encodingEnum;
@@ -343,14 +341,4 @@
return sw.toString();
}
-
- public static ImportExport getInstance(Component view) {
- if (exchanger == null) {
- exchanger = new ImportExport(view);
- } else {
- viewComponent = view;
- }
- return exchanger;
- }
-
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/OpeningViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/OpeningViewHandler.java 2012-04-05 10:10:32 UTC (rev 3352)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/OpeningViewHandler.java 2012-04-05 10:58:58 UTC (rev 3353)
@@ -86,7 +86,7 @@
}
public void next() {
- ImportExport importExport = ImportExport.getInstance(view);
+ ImportExport importExport = new ImportExport(view);
JPanel panel = view.getPanel();
panel.removeAll();
switch (step) {
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartViewHandler.java 2012-04-05 10:10:32 UTC (rev 3352)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartViewHandler.java 2012-04-05 10:58:58 UTC (rev 3353)
@@ -193,7 +193,7 @@
}
VatStatementsChartEnum defaultVatStatementsEnum =
(VatStatementsChartEnum) value;
- ImportExport importExport = ImportExport.getInstance(view);
+ ImportExport importExport = new ImportExport(view);
importExport.importExport(ImportExportEnum.CSV_VAT_IMPORT,
defaultVatStatementsEnum.getFilePath(), true);
refresh();
Modified: trunk/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties
===================================================================
--- trunk/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties 2012-04-05 10:10:32 UTC (rev 3352)
+++ trunk/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties 2012-04-05 10:58:58 UTC (rev 3353)
@@ -1,5 +1,4 @@
=
-lima.account.addaccounterror=Can't add account
lima.accountsreports.listerror=Can't get entries list
lima.action.commandline.help=Show help in console
lima.action.fullscreen=Full screen
@@ -11,7 +10,6 @@
lima.balance.listerror=Can't get entries list
lima.charts.account=Accounts chart
lima.charts.account.addAccount=Add account
-lima.charts.account.addSubLedger=Add thirdpart account
lima.charts.account.base=Base accountchart
lima.charts.account.developed=Developped accountchart
lima.charts.account.number=Account Number
@@ -70,7 +68,6 @@
lima.common.globalexception=Global lima exception
lima.common.info=Information
lima.common.label=Label
-lima.common.masteraccount=Master account
lima.common.movmentedfilter=Accounts filtered
lima.common.next=Next
lima.common.ok=OK
@@ -95,16 +92,13 @@
lima.config.decimalseparator.description=
lima.config.host.adress=Host adress
lima.config.i18n.dir.description=
-lima.config.i18ndir=Directory used for i18n files
lima.config.locale.description=Localization used by LIMA
lima.config.resources.dir.description=
-lima.config.resourcesdir=Directory used for Lima resources
lima.config.scale.description=
lima.config.ui.flaunchui.description=
lima.config.ui.fullscreen.description=FullScreen
lima.daily=Daily
lima.documents=Documents…
-lima.documents.error=Can't create document on an open fiscal year
lima.entries=Entries
lima.entries.addEntry=Add entry
lima.entries.addTransaction=Add transaction
@@ -123,9 +117,6 @@
lima.enum.comboboxaccount.account=Account
lima.enum.comboboxaccount.accountlist=Account list
lima.enum.comboboxaccount.allaccount=All accounts
-lima.enum.comboboxamount.both=Both
-lima.enum.comboboxamount.credit=Credit
-lima.enum.comboboxamount.debit=Debit
lima.enum.comboboxentrybook.all=All entrybooks
lima.enum.comboboxentrybook.select_one=EntryBook
lima.enum.comboboxletter.all=All letters
@@ -142,7 +133,6 @@
lima.enum.comboboxperiod.fiscalperiod=Fiscal period
lima.enum.comboboxperiod.period=Period
lima.error.errorpane.htmlmessage=<html><body><b>An application error happened</b>\:<br/>%s</body></html>
-lima.error.no.masteraccount=there is no master account for account with number %s
lima.financialstatement.accounts=Account list on debit and on credit
lima.financialstatement.addfinancialStatementHeadererror=Can't add financialStatementHeader
lima.financialstatement.check=Check accounts passing to movement
@@ -187,7 +177,6 @@
lima.identity.businessNumber=Business number
lima.identity.city=City
lima.identity.classificationCode=Classification code
-lima.identity.contact=Contact
lima.identity.description=Description
lima.identity.email=Email
lima.identity.name=Name
@@ -214,12 +203,12 @@
lima.importexport.wait=Job in progress…
lima.init.closed=Lima closed at %1$s
lima.init.errorclosing=Error during Lima close
+lima.iu.importexport.import=
lima.ledger.documentcreationerror=Enable to create document
lima.lettering.listerror=Can't get entries list
lima.menu.file=File
lima.menu.help=Help
lima.menu.help.about=About
-lima.menu.help.help=Help
lima.menu.help.i18n=Language
lima.menu.help.i18n.fr=French
lima.menu.help.i18n.uk=English
@@ -250,16 +239,12 @@
lima.tab.home=Home
lima.table.account=Account
lima.table.balance=Balance
-lima.table.begin.credit=Beginning Balance Credit
-lima.table.begin.debit=Beginning Balance Debit
lima.table.closure=Closed
lima.table.code=Code
-lima.table.collectedvat=Collected VAT
lima.table.credit=Credit
lima.table.date=Date
lima.table.debit=Debit
lima.table.debitcredit=Debit and credit
-lima.table.deductiblevat=Deductible VAT
lima.table.description=Description
lima.table.entrybook=EntryBook
lima.table.fiscalperiod=Fiscalperiod
@@ -272,21 +257,31 @@
lima.table.number=Account Number
lima.table.period=Period
lima.table.provisiondeprecationamount=Provision & Deprecation
-lima.table.remainingcredit=Remaining credit
-lima.table.repayments=Repayments
lima.table.solde=Solder
lima.table.solde.credit=Credit solde
lima.table.solde.debit=Debit solde
-lima.table.vatcredit=VAT credit
-lima.table.vatdue=Due VAT
-lima.table.vatpaid=VAT paid
-lima.table.vatpayable=VAT payable
lima.table.voucher=Voucher
lima.title=Lutin Invoice Monitoring and Accounting
lima.title.about=About Lima...
lima.title.about.description=Open sources accounting software
lima.tooltip.filter=<html>Regular expression \:<br/>- accounts interval i..j <br/>- accounts list i,j,k <br/>- Exclude an account -i</html>
lima.tooltip.lettering=<html>Add a letter on many entries <br/>Select many rows with combination ctrl + click</html>
+lima.ui.account.addAccount=
+lima.ui.account.addaccounttitle=
+lima.ui.account.base=
+lima.ui.account.developed=
+lima.ui.account.label=
+lima.ui.account.number=
+lima.ui.account.removeaccountconfirm=
+lima.ui.account.removeaccounttitle=
+lima.ui.account.shortened=
+lima.ui.account.updateaccounttitle=
+lima.ui.common.cancel=
+lima.ui.common.ok=
+lima.ui.common.remove=
+lima.ui.common.update=
+lima.ui.importexport.importcsv=
+lima.ui.importexport.importebp=
lima.vatreport.listerror=Can't get entries list
lima.vatstatement.accounts=List of accounts
lima.vatstatement.boxname=PDF BoxName
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 2012-04-05 10:10:32 UTC (rev 3352)
+++ trunk/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties 2012-04-05 10:58:58 UTC (rev 3353)
@@ -1,5 +1,4 @@
=
-lima.account.addaccounterror=Erreur lors de l'ajout d'un compte
lima.accountsreports.listerror=Erreur lors de la récupération des données de la liste
lima.action.commandline.help=Afficher l'aide en console
lima.action.fullscreen=Plein Ecran
@@ -11,7 +10,6 @@
lima.balance.listerror=Erreur lors de la récupération des données de la liste
lima.charts.account=Plan comptable
lima.charts.account.addAccount=Ajout Compte Général
-lima.charts.account.addSubLedger=Ajouter Compte Tiers
lima.charts.account.base=Plan comptable de base
lima.charts.account.developed=Plan comptable développé
lima.charts.account.number=Numéro de compte
@@ -70,7 +68,6 @@
lima.common.globalexception=Global lima exception
lima.common.info=Information
lima.common.label=Libellé
-lima.common.masteraccount=Compte parent
lima.common.movmentedfilter=Comptes mouvementés
lima.common.next=Suivant
lima.common.ok=OK
@@ -95,16 +92,13 @@
lima.config.decimalseparator.description=
lima.config.host.adress=Adresse du serveur distant
lima.config.i18n.dir.description=
-lima.config.i18ndir=Répertoire utilisée pour stocker les fichiers i18n
lima.config.locale.description=Locale utilisée par l'application
lima.config.resources.dir.description=
-lima.config.resourcesdir=Répertoire utilisée pour stocker les ressources
lima.config.scale.description=
lima.config.ui.flaunchui.description=
lima.config.ui.fullscreen.description=Plein écran
lima.daily=Quotidien
lima.documents=Documents…
-lima.documents.error=Impossible de créer un document lorsque l'exercice est ouvert
lima.entries=Traitement
lima.entries.addEntry=Ajouter entrée
lima.entries.addTransaction=Ajouter transaction
@@ -123,9 +117,6 @@
lima.enum.comboboxaccount.account=Compte
lima.enum.comboboxaccount.accountlist=Liste de comptes
lima.enum.comboboxaccount.allaccount=Tous les comptes
-lima.enum.comboboxamount.both=Les deux
-lima.enum.comboboxamount.credit=Crédit
-lima.enum.comboboxamount.debit=Débit
lima.enum.comboboxentrybook.all=Tous les journaux
lima.enum.comboboxentrybook.select_one=Journal
lima.enum.comboboxletter.all=Toutes les lettres
@@ -142,7 +133,6 @@
lima.enum.comboboxperiod.fiscalperiod=Exercice
lima.enum.comboboxperiod.period=Période
lima.error.errorpane.htmlmessage=<html><body><b>Une erreur s'est produite</b>\:<br/>%s</body></html>
-lima.error.no.masteraccount=Il n'existe pas de compte parent pour le numéro de compte %s
lima.financialstatement.accounts=Liste de comptes au crédit et au débit
lima.financialstatement.addfinancialStatementHeadererror=Erreur lors de l'ajout de l'entête sur la déclaration financière
lima.financialstatement.check=Vérification des comptes aux postes
@@ -187,7 +177,6 @@
lima.identity.businessNumber=SIRET
lima.identity.city=Ville
lima.identity.classificationCode=Code NAF
-lima.identity.contact=Contact
lima.identity.description=Description
lima.identity.email=Courriel
lima.identity.name=Nom
@@ -214,12 +203,12 @@
lima.importexport.wait=Traitement en cours …
lima.init.closed=Lima fermé à %1$s
lima.init.errorclosing=Erreur lors de la fermeture
+lima.iu.importexport.import=
lima.ledger.documentcreationerror=Erreur lors de la création du document
lima.lettering.listerror=Erreur lors de la récupération des données de la liste
lima.menu.file=Fichier
lima.menu.help=Aide
lima.menu.help.about=À Propos
-lima.menu.help.help=Afficher l'aide
lima.menu.help.i18n=Langue
lima.menu.help.i18n.fr=Français
lima.menu.help.i18n.uk=Anglais
@@ -243,23 +232,19 @@
lima.reports.vat=Edition TVA
lima.response.no=Non
lima.response.yes=Oui
-lima.splash.1=Chargement des services...
+lima.splash.1=Chargement des services
lima.splash.2=Chargement de la comptabilité
lima.splash.3=Application prête \!
lima.structure=Structure
lima.tab.home=Accueil
lima.table.account=Compte
lima.table.balance=Balance
-lima.table.begin.credit=Reprise crèdit
-lima.table.begin.debit=Reprise débit
lima.table.closure=Cloture
lima.table.code=Code
-lima.table.collectedvat=TVA collectée
lima.table.credit=Crédit
lima.table.date=Date
lima.table.debit=Débit
lima.table.debitcredit=Débit et Crédit
-lima.table.deductiblevat=TVA déductible
lima.table.description=Description
lima.table.entrybook=Journal
lima.table.fiscalperiod=Exercice
@@ -272,26 +257,35 @@
lima.table.number=Numéro de compte
lima.table.period=Période
lima.table.provisiondeprecationamount=Amortissements et provisions
-lima.table.remainingcredit=Crédit de TVA
-lima.table.repayments=Remboursements
lima.table.solde=Solde
lima.table.solde.credit=Solde crédit
lima.table.solde.debit=Solde débit
-lima.table.vatcredit=Crédit de TVA
-lima.table.vatdue=TVA due
-lima.table.vatpaid=TVA payée
-lima.table.vatpayable=TVA à payer
lima.table.voucher=Pièce comptable
lima.title=Lutin Invoice Monitoring and Accounting
lima.title.about=À propos de Lima...
lima.title.about.description=Logiciel de comptabilité Libre
lima.tooltip.filter=<html>Expression régulière \:<br/>- intervalle de compte i..j <br/>- liste de compte i,j,k <br/>- Exclure un compte -i</html>
lima.tooltip.lettering=<html>Pour ajouter une lettre à plusieurs écritures <br/>Sélectionner plusieurs lignes avec la combinaison ctrl + click</html>
+lima.ui.account.addAccount=Nouveau compte
+lima.ui.account.addaccounttitle=Ajout d'un compte
+lima.ui.account.base=Plan comptable de base
+lima.ui.account.developed=Plan comptable développé
+lima.ui.account.label=Libellé
+lima.ui.account.number=Numéro de compte
+lima.ui.account.removeaccountconfirm=Voulez-vous supprimer le compte %s ?
+lima.ui.account.removeaccounttitle=Suppression d'un compte
+lima.ui.account.shortened=Plan comptable abrégé
+lima.ui.account.updateaccounttitle=Modification d'un compte
+lima.ui.common.cancel=Annuler
+lima.ui.common.ok=Ok
+lima.ui.common.remove=Supprimer
+lima.ui.common.update=Modifier
+lima.ui.importexport.importcsv=Import/Export CSV
+lima.ui.importexport.importebp=Import/Export EBP
lima.vatreport.listerror=Erreur lors de la récupération des données de la liste
lima.vatstatement.accounts=Liste des comptes
lima.vatstatement.boxname=PDF BoxName
lima.vatstatement.delete=Supprimer le plan TVA actuel avant d'importer
-lima.vatstatement.header=
lima.vatstatement.label=Libellé
lima.vatstatement.mastervatstatement=
lima.vatstatement.movement.add=Ajouter un regrouprement
Modified: trunk/lima-swing/src/main/resources/log4j.properties
===================================================================
--- trunk/lima-swing/src/main/resources/log4j.properties 2012-04-05 10:10:32 UTC (rev 3352)
+++ trunk/lima-swing/src/main/resources/log4j.properties 2012-04-05 10:58:58 UTC (rev 3353)
@@ -38,3 +38,4 @@
# package level
log4j.logger.org.chorem.lima=INFO
+log4j.logger.org.chorem.lima.ui.account=DEBUG
\ No newline at end of file
1
0
05 Apr '12
Author: echatellier
Date: 2012-04-05 12:10:32 +0200 (Thu, 05 Apr 2012)
New Revision: 3352
Url: http://chorem.org/repositories/revision/lima/3352
Log:
Remove code pasted form appConfig
Modified:
trunk/lima-swing/src/main/java/org/chorem/lima/LimaConfig.java
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/LimaConfig.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/LimaConfig.java 2012-04-04 13:25:23 UTC (rev 3351)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/LimaConfig.java 2012-04-05 10:10:32 UTC (rev 3352)
@@ -25,7 +25,17 @@
package org.chorem.lima;
+import static org.nuiton.i18n.I18n._;
+import static org.nuiton.i18n.I18n.n_;
+
+import java.beans.PropertyChangeListener;
+import java.io.File;
+import java.io.IOException;
+import java.util.Locale;
+
import jaxx.runtime.JAXXUtil;
+
+import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.actions.MiscAction;
@@ -35,24 +45,10 @@
import org.nuiton.topia.TopiaContextFactory;
import org.nuiton.util.ApplicationConfig;
import org.nuiton.util.ArgumentsParserException;
-import org.nuiton.util.FileUtil;
-import org.nuiton.util.SortedProperties;
import org.nuiton.util.Version;
import org.nuiton.util.VersionUtil;
import org.nuiton.util.converter.ConverterUtil;
-import java.beans.PropertyChangeListener;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.Date;
-import java.util.Locale;
-import java.util.Properties;
-
-import static org.nuiton.i18n.I18n._;
-import static org.nuiton.i18n.I18n.n_;
-
/**
* La configuration de l'application.
*
@@ -498,96 +494,22 @@
}
/**
- * Save configuration, in user home directory using the
- * {@link #getConfigFileName}. Default, env and commande line note saved
- *
- * @param excludeKeys optional list of keys to exclude from
+ * Override save action to propagate some option to server.
*/
- public void saveForUser(String... excludeKeys) {
-
- File file = getUserConfigFile();
- if (log.isDebugEnabled()) {
- log.debug("will save user configuration in " + file);
- }
- try {
- save(file, false, excludeKeys);
- } catch (IOException eee) {
- if (log.isWarnEnabled()) {
- log.warn(_("nuitonutil.error.applicationconfig.save", file),
- eee);
- }
- }
- }
-
- /**
- * Save configuration, in specified file.
- *
- * @param file file where config will be writen
- * @param forceAll if true save all config option
- * (with defaults, classpath, env, command line)
- * @param excludeKeys optional list of keys to exclude from
- * @throws IOException if IO pb
- */
+ @Override
public void save(File file,
boolean forceAll,
String... excludeKeys) throws IOException {
- //
- String[] serverProperties = {"scale"};
+ super.save(file, forceAll, excludeKeys);
- // store sorted in file
- Properties prop = new SortedProperties();
+ // propagate scale option to serveur option
+ optionsService = LimaServiceFactory.getService(OptionsServiceMonitorable.class);
- // store server properties in file
- Properties serverProp = new SortedProperties();
-
- if (forceAll) {
- prop.putAll(defaults);
- prop.putAll(classpath);
+ // scale server option
+ String scaleOption = getOption("scale");
+ if (StringUtils.isNotBlank(scaleOption)) {
+ optionsService.setScale(scaleOption);
}
- prop.putAll(etcfile);
- prop.putAll(homefile);
- prop.putAll(curfile);
- if (forceAll) {
- prop.putAll(jvm);
- prop.putAll(env);
- prop.putAll(line);
- }
- prop.putAll(options);
-
- for (String excludeKey : excludeKeys) {
- prop.remove(excludeKey);
- }
-
- for (String serverPropertie : serverProperties) {
- if (prop.containsKey(serverPropertie)) {
- serverProp.put(serverPropertie, prop.get(serverPropertie));
- }
- }
-
- // Ano #687 : create parentFile before using it in FileWriter
- boolean dirCreated = FileUtil.createDirectoryIfNecessary(file.getParentFile());
- if (dirCreated && log.isDebugEnabled()) {
- log.debug("Creation of config directory " + file.getParent());
- }
-
- OutputStream stream = new FileOutputStream(file);
- try {
- prop.store(stream, "Last saved " + new Date());
- } finally {
- stream.close();
- }
-
- optionsService =
- LimaServiceFactory.getService(
- OptionsServiceMonitorable.class);
-
- if (!serverProp.isEmpty()) {
- if (serverProp.containsKey("scale")) {
- if (!serverProp.getProperty("scale").isEmpty()) {
- optionsService.setScale(serverProp.getProperty("scale"));
- }
- }
- }
}
}
1
0
Author: echatellier
Date: 2012-04-04 15:25:23 +0200 (Wed, 04 Apr 2012)
New Revision: 3351
Url: http://chorem.org/repositories/revision/lima/3351
Log:
Remove subAcount and ledgerAccount loop association.
Account tree is now renderer by account number association.
Added:
trunk/lima-business/src/main/java/org/chorem/lima/business/LimaRuntimeException.java
trunk/lima-business/src/test/java/org/chorem/lima/entity/
trunk/lima-business/src/test/java/org/chorem/lima/entity/AccountDAOTest.java
trunk/lima-callao/src/main/java/org/chorem/lima/entity/AccountDAO.java
trunk/lima-callao/src/main/java/org/chorem/lima/entity/ClosedPeriodicEntryBookDAO.java
trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialPeriodDAO.java
trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialStatementImpl.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountTreeTableRenderer.java
Removed:
trunk/lima-callao/src/main/java/org/chorem/lima/entity/AccountDAOImpl.java
trunk/lima-callao/src/main/java/org/chorem/lima/entity/ClosedPeriodicEntryBookDAOImpl.java
trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialPeriodDAOImpl.java
trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialStatementImpl.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountTreeTableModel.java
Modified:
trunk/lima-business/src/main/java/org/chorem/lima/business/AccountingRules.java
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-business/src/main/java/org/chorem/lima/business/ejb/ExportServiceImpl.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/FiscalPeriodServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ReportServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/AccountService.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/AccountServiceLocal.java
trunk/lima-business/src/main/java/org/chorem/lima/business/migration/MigrationV0_6.java
trunk/lima-business/src/main/java/org/chorem/lima/service/LimaServiceFactory.java
trunk/lima-business/src/test/java/org/chorem/lima/business/AbstractLimaTest.java
trunk/lima-business/src/test/java/org/chorem/lima/business/AccountServiceImplTest.java
trunk/lima-business/src/test/java/org/chorem/lima/business/ImportServiceImplTest.java
trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/AccountServiceRuleFrTest.java
trunk/lima-callao/src/main/xmi/accounting.properties
trunk/lima-callao/src/main/xmi/accounting.zargo
trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.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/account/SubLedgerForm.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/UpdateAccountForm.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/UpdateSubLedgerForm.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/SubAccountComboBoxModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/AccountsPane.java
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/AccountingRules.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/AccountingRules.java 2012-04-04 09:03:41 UTC (rev 3350)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/AccountingRules.java 2012-04-04 13:25:23 UTC (rev 3351)
@@ -46,22 +46,17 @@
/**
* Account rule : check create account.
*
- * @param masterAccount parent account
* @param account new account
* @throws LimaException if rule validation fails
*/
- void createAccountRules(Account masterAccount, Account account) throws LimaException;
+ void createAccountRules(Account account) throws LimaException;
- void createSubLedgerRules(Account masterAccount, Account account) throws LimaException;
+ void updateAccountRules(Account account) throws LimaException;
- void updateAccountRules(Account masterAccount, Account account) throws LimaException;
-
- void updateSubLedgerRules(Account account) throws LimaException;
-
void removeAccountRules(Account account, TopiaContext transaction) throws LimaException;
/**
- * Entrybook rules
+ * Entrybook rules.
*
* @param entryBook
* @param topiaTransaction
Added: trunk/lima-business/src/main/java/org/chorem/lima/business/LimaRuntimeException.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/LimaRuntimeException.java (rev 0)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/LimaRuntimeException.java 2012-04-04 13:25:23 UTC (rev 3351)
@@ -0,0 +1,60 @@
+/*
+ * #%L
+ * Lima business
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 CodeLutin, Chatellier Eric
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+package org.chorem.lima.business;
+
+/**
+ * Lima runtime exception.
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * By : $Author$
+ */
+public class LimaRuntimeException extends RuntimeException {
+
+ /** serialVersionUID. */
+ private static final long serialVersionUID = -6876236663940184462L;
+
+ /**
+ * Constructs a new exception with the specified detail message.
+ *
+ * @param message message
+ */
+ public LimaRuntimeException(String message) {
+ super(message);
+ }
+
+ /**
+ * Constructs a new exception with the specified detail message and cause.
+ *
+ * @param message message
+ * @param cause cause
+ */
+ public LimaRuntimeException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
Property changes on: trunk/lima-business/src/main/java/org/chorem/lima/business/LimaRuntimeException.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
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 2012-04-04 09:03:41 UTC (rev 3350)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/DefaultAccountingRules.java 2012-04-04 13:25:23 UTC (rev 3351)
@@ -71,7 +71,7 @@
* Rules to check before create accounts.
*/
@Override
- public void createAccountRules(Account masterAccount, Account account) throws LimaException {
+ public void createAccountRules(Account account) throws LimaException {
// Check if the numberaccount is not blank
if (StringUtils.isBlank(account.getAccountNumber())) {
@@ -80,19 +80,13 @@
}
}
- /** Rules to check before create subledger */
@Override
- public void createSubLedgerRules(Account masterAccount, Account account)
- throws LimaException {
- // check the number account is not empty
+ public void updateAccountRules(Account account) throws LimaException {
+ // Check if the numberaccount is not blank
if (StringUtils.isBlank(account.getAccountNumber())) {
throw new LimaBusinessException(_("lima-business.defaultaccountingrules.invalidaccountnumber",
account.getAccountNumber()));
}
- // check if parentaccount have no subaccount
- if (masterAccount.getSubAccounts().isEmpty()) {
- throw new LimaBusinessException(_("lima-business.defaultaccountingrules.subledgererror"));
- }
}
/** Rules to check before create fiscals periods */
@@ -455,23 +449,4 @@
}
throw new LimaException(_("lima-business.common.queryerror"), cause);
}
-
- @Override
- public void updateAccountRules(Account masterAccount, Account account) throws LimaException {
- // Check if the numberaccount is not blank
- if (StringUtils.isBlank(account.getAccountNumber())) {
- throw new LimaBusinessException(_("lima-business.defaultaccountingrules.invalidaccountnumber",
- account.getAccountNumber()));
- }
- }
-
- @Override
- public void updateSubLedgerRules(Account account) throws LimaException {
- // check the number account is not empty
- if (StringUtils.isBlank(account.getAccountNumber())) {
- throw new LimaBusinessException(_("lima-business.defaultaccountingrules.invalidaccountnumber",
- account.getAccountNumber()));
- }
- }
-
}
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 2012-04-04 09:03:41 UTC (rev 3350)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/FranceAccountingRules.java 2012-04-04 13:25:23 UTC (rev 3351)
@@ -56,69 +56,48 @@
protected static final Log log = LogFactory.getLog(FranceAccountingRules.class);
- /** Règles de vérification de la création du PCG, appliquées à la comptabilité française */
+ /**
+ * Règles de vérification de la création du PCG, appliquées à la comptabilité française.
+ */
@Override
- public void createAccountRules(Account masterAccount, Account account) throws LimaException {
- super.createAccountRules(masterAccount, account);
+ public void createAccountRules(Account account) throws LimaException {
+ super.createAccountRules(account);
- // Check if the number account is type numeric
- if (!StringUtils.isNumeric(account.getAccountNumber())) {
+ String accountNumber = account.getAccountNumber();
+
+ // ledger account must be located in 411 account
+ if (!StringUtils.isNumeric(accountNumber) && accountNumber.startsWith("4")) {
throw new LimaBusinessException(_("lima-business.franceaccountingrules.accountnumbernotnumeric",
account.getAccountNumber()));
}
- // Check if the number account start with the number of the master account
- if (masterAccount != null && !account.getAccountNumber().startsWith(
- masterAccount.getAccountNumber())) {
- throw new LimaBusinessException(_("lima-business.franceaccountingrules.accountnumbernotmaster",
- account.getAccountNumber()));
- }
-
- // Check if master account have a number between 1 to 8
- if (masterAccount == null && !account.getAccountNumber().matches("[1-8]")) {
+ // Check root account starts with 1 to 8
+ if (accountNumber.length() == 1 && accountNumber.matches("[1-8]")) {
throw new LimaBusinessException(_("lima-business.franceaccountingrules.accountstartnumbererror",
account.getAccountNumber()));
}
-
}
@Override
- public void updateAccountRules(Account masterAccount, Account account) throws LimaException {
- super.updateAccountRules(masterAccount, account);
+ public void updateAccountRules(Account account) throws LimaException {
+ super.updateAccountRules(account);
+ String accountNumber = account.getAccountNumber();
+
// Check if the number account is type numeric
if (!StringUtils.isNumeric(account.getAccountNumber())) {
throw new LimaBusinessException(_("lima-business.franceaccountingrules.accountnumbernotnumeric",
account.getAccountNumber()));
}
- // Check if the number account start with the number of the master account
- if (masterAccount != null && !account.getAccountNumber().startsWith(
- masterAccount.getAccountNumber())) {
- throw new LimaBusinessException(_("lima-business.franceaccountingrules.accountnumbernotmaster",
- account.getAccountNumber()));
- }
-
- // Check if master account have a number between 1 to 8
- if (masterAccount == null && !account.getAccountNumber().matches("[1-8]")) {
+ // Check root account starts with 1 to 8
+ if (accountNumber.length() == 1 && accountNumber.matches("[1-8]")) {
throw new LimaBusinessException(_("lima-business.franceaccountingrules.accountstartnumbererror",
account.getAccountNumber()));
}
}
- /** Rules to check before create subledger */
- @Override
- public void createSubLedgerRules(Account masterAccount, Account account) throws LimaException {
- super.createSubLedgerRules(masterAccount, account);
-
- // check if the master account number is begin with 4
- if (!masterAccount.getAccountNumber().startsWith("4")) {
- throw new LimaBusinessException(_("lima-business.franceaccountingrules.masteraccountnumbererror",
- account.getAccountNumber()));
- }
- }
-
/**
* Règles de vérification d'ouverture d'un exercice, appliquées à la comptabilité française
* <p/>
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 2012-04-04 09:03:41 UTC (rev 3350)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java 2012-04-04 13:25:23 UTC (rev 3351)
@@ -37,7 +37,6 @@
import org.chorem.lima.entity.LimaCallaoDAOHelper;
import org.nuiton.topia.TopiaContext;
import org.nuiton.topia.TopiaException;
-import org.nuiton.topia.framework.TopiaQuery;
import javax.ejb.Stateless;
import java.util.ArrayList;
@@ -64,8 +63,28 @@
}
@Override
- public void createAccountWithTransaction(Account masterAccount,
- Account account,
+ public long getAccountCount() throws LimaException {
+ long result = 0;
+ TopiaContext transaction = beginTransaction(rootContext);
+ try {
+
+ // check if the accountnumber already exist
+ AccountDAO accountDAO = LimaCallaoDAOHelper.getAccountDAO(transaction);
+
+ result = accountDAO.count();
+ } catch (Exception ex) {
+ doCatch(transaction, ex);
+ } finally {
+ doFinally(transaction);
+ }
+ return result;
+ }
+
+ /**
+ * Create new account with existing transaction.
+ */
+ @Override
+ public void createAccountWithTransaction(Account account,
TopiaContext topiaContext) throws LimaException {
try {
@@ -87,18 +106,6 @@
//create it
accountDAO.create(account);
- Account masterAccountUpdate = null;
- if (masterAccount != null) {
- masterAccountUpdate = accountDAO.findByAccountNumber(
- masterAccount.getAccountNumber());
- }
-
- // check if parent account exist;
- if (masterAccountUpdate != null) {
- masterAccountUpdate.addSubAccounts(account);
- accountDAO.update(masterAccountUpdate);
- }
-
commitTransaction(topiaContext);
} catch (TopiaException ex) {
doCatch(topiaContext, ex);
@@ -116,37 +123,17 @@
* @throws LimaException
*/
@Override
- public void createAccount(Account masterAccount,
- Account account) throws LimaException {
+ public void createAccount(Account account) throws LimaException {
- //check rules before create the account
+ // check rules before create the account
AccountingRules accountingRules = LimaConfig.getInstance().getAccountingRules();
- accountingRules.createAccountRules(masterAccount, account);
+ accountingRules.createAccountRules(account);
TopiaContext transaction = beginTransaction(rootContext);
try {
- createAccountWithTransaction(masterAccount, account, transaction);
- } catch (Exception ex) {
- doCatch(transaction, ex);
- } finally {
- doFinally(transaction);
- }
- }
-
- @Override
- public void createSubLedgerWithTransaction(Account masterAccount,
- Account account,
- TopiaContext topiaContext) throws LimaException {
-
- try {
-
- // force upppercase account number
- account.setAccountNumber(account.getAccountNumber().toUpperCase());
-
// check if the accountnumber already exist
- AccountDAO accountDAO =
- LimaCallaoDAOHelper.getAccountDAO(topiaContext);
+ AccountDAO accountDAO = LimaCallaoDAOHelper.getAccountDAO(transaction);
Account existAccount =
accountDAO.findByAccountNumber(account.getAccountNumber());
if (existAccount != null) {
@@ -155,45 +142,12 @@
account.getAccountNumber()));
}
- //create it
- accountDAO.create(account);
-
- Account masterAccountUpdate = null;
- if (masterAccount != null) {
- masterAccountUpdate = accountDAO.findByAccountNumber(
- masterAccount.getAccountNumber());
- }
-
- // check if the masteraccount exist;
- if (masterAccount != null) {
- masterAccountUpdate.addSubLedgers(account);
- accountDAO.update(masterAccountUpdate);
- }
-
- commitTransaction(topiaContext);
- } catch (TopiaException ex) {
- doCatch(topiaContext, ex);
- }
- }
-
- /** Permet de créer des comptes tiers */
- @Override
- public void createSubLedger(Account masterAccount,
- Account account) throws LimaException {
-
- //check rules before create the account
- AccountingRules accountingRules = LimaConfig.getInstance().getAccountingRules();
- accountingRules.createSubLedgerRules(masterAccount, account);
-
- TopiaContext transaction = beginTransaction(rootContext);
- try {
- createSubLedgerWithTransaction(masterAccount, account, transaction);
+ createAccountWithTransaction(account, transaction);
} catch (Exception ex) {
doCatch(transaction, ex);
} finally {
doFinally(transaction);
}
-
}
/** Permer d'obtenir la liste des comptes à partir d'une de ses propriétés */
@@ -263,8 +217,7 @@
TopiaContext transaction = beginTransaction(rootContext);
try {
- AccountDAO accountDAO =
- LimaCallaoDAOHelper.getAccountDAO(transaction);
+ AccountDAO accountDAO = LimaCallaoDAOHelper.getAccountDAO(transaction);
accountsList = accountDAO.findAll();
Collections.sort(accountsList, new AccountComparator());
@@ -280,7 +233,7 @@
/** Permet d'obtenir tout les comptes feuilles */
@Override
- public List<Account> getAllSubAccounts() throws LimaException {
+ public List<Account> getAllLeafAccounts() throws LimaException {
List<Account> accountsList = null;
@@ -288,7 +241,7 @@
try {
AccountDAO accountDAO =
LimaCallaoDAOHelper.getAccountDAO(transaction);
- accountsList = accountDAO.findAllSubAccounts();
+ accountsList = accountDAO.findAllLeafAccounts();
} catch (Exception ex) {
doCatch(transaction, ex);
} finally {
@@ -308,17 +261,17 @@
@Override
public List<Account> getChildrenAccounts(Account masterAccount) throws LimaException {
- List<Account> accountsList = new ArrayList<Account>();
+ List<Account> accountsList = null;
TopiaContext transaction = beginTransaction(rootContext);
try {
AccountDAO accountDAO =
LimaCallaoDAOHelper.getAccountDAO(transaction);
- TopiaQuery query = accountDAO.createQuery();
+ //TopiaQuery query = accountDAO.createQuery();
//tchemit 2011-09-21 Only consider account childs from the master account
// link otherwise account can be found from different masterAccount
- query.addEquals(Account.PROPERTY_MASTER_ACCOUNT, masterAccount);
+ //query.addEquals(Account.PROPERTY_MASTER_ACCOUNT, masterAccount);
// if (masterAccount == null) {
// query.addEquals(Account.PROPERTY_MASTER_ACCOUNT, masterAccount);
// query.addWhere(Account.PROPERTY_GENERAL_LEDGER, TopiaQuery.Op.EQ, null);
@@ -328,20 +281,22 @@
// Account.PROPERTY_GENERAL_LEDGER + " = :value")
// .addParam("value", masterAccount);
// }
- accountsList.addAll(accountDAO.findAllByQuery(query));
- Collections.sort(accountsList, new AccountComparator());
+ //accountsList.addAll(accountDAO.findAllByQuery(query));
+ //Collections.sort(accountsList, new AccountComparator());
// sort of bug fix 2011.09.10 vsalaun (+ bleny)
// do NOT delete these lines unless you find a better way to
// prevent lazy exception when updating account from the account chart
- for (Account t : accountsList) {
+ /*for (Account t : accountsList) {
if (t.getMasterAccount() != null) {
t.getMasterAccount().getTopiaId();
}
t.sizeSubAccounts();
t.sizeSubLedgers();
t.getGeneralLedger();
- }
+ }*/
+
+ accountsList = accountDAO.getSubAccounts(masterAccount);
} catch (Exception ex) {
doCatch(transaction, ex);
@@ -442,25 +397,7 @@
AccountDAO accountDAO =
LimaCallaoDAOHelper.getAccountDAO(transaction);
Account subAccount = accountDAO.findByTopiaId(account.getTopiaId());
- //check rules account if ledger or account
- if (account.getGeneralLedger() == null) { // is an account
-
- Account master = account.getMasterAccount();
-
- accountingRules.updateAccountRules(master, account);
- subAccount.setMasterAccount(account.getMasterAccount());
- subAccount.setSubAccounts(account.getSubAccounts());
- } else { // is a ledger
- accountingRules.updateSubLedgerRules(account);
- subAccount.setGeneralLedger(account.getGeneralLedger());
- subAccount.setSubLedgers(account.getSubLedgers());
- subAccount.setThirdParty(account.getThirdParty());
- }
-
- // update account
- subAccount.setAccountNumber(account.getAccountNumber());
- subAccount.setLabel(account.getLabel());
-
+ accountingRules.updateAccountRules(account);
accountDAO.update(subAccount);
commitTransaction(transaction);
} catch (Exception ex) {
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ExportServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ExportServiceImpl.java 2012-04-04 09:03:41 UTC (rev 3350)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ExportServiceImpl.java 2012-04-04 13:25:23 UTC (rev 3351)
@@ -484,18 +484,6 @@
nextLine[1] = account.getAccountNumber();
nextLine[2] = account.getLabel();
nextLine[3] = account.getThirdParty();
- Account masterAccount = account.getMasterAccount();
- Account generalLedger = account.getGeneralLedger();
- String masterAccountString = "";
- String generalLedgerString = "";
- if (masterAccount != null) {
- masterAccountString = masterAccount.getAccountNumber();
- }
- nextLine[4] = masterAccountString;
- if (generalLedger != null) {
- generalLedgerString = generalLedger.getAccountNumber();
- }
- nextLine[5] = generalLedgerString;
// Ajoute la ligne au fichier
csvWriter.writeNext(nextLine);
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 2012-04-04 09:03:41 UTC (rev 3350)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialStatementServiceImpl.java 2012-04-04 13:25:23 UTC (rev 3351)
@@ -521,7 +521,7 @@
FinancialStatementDAO financialStatementDAO =
LimaCallaoDAOHelper.getFinancialStatementDAO(transaction);
- List<Account> accountsList = accountDAO.findAllSubAccounts();
+ List<Account> accountsList = accountDAO.findAllLeafAccounts();
List<FinancialStatement> financialStatementsList =
financialStatementDAO.findAll();
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java 2012-04-04 09:03:41 UTC (rev 3350)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java 2012-04-04 13:25:23 UTC (rev 3351)
@@ -333,10 +333,10 @@
//89 BILAN
Account accountMaster = accountService.getAccountByNumber("89");
if (accountMaster == null) {
- Account accountSuperMaster = accountService.getAccountByNumber("8");
+ accountMaster = new AccountImpl();
accountMaster.setAccountNumber("89");
accountMaster.setLabel("BILAN");
- accountService.createAccount(accountSuperMaster, accountMaster);
+ accountService.createAccount(accountMaster);
accountMaster = accountService.getAccountByNumber("89");
}
@@ -346,7 +346,7 @@
beginRetainedAccount = new AccountImpl();
beginRetainedAccount.setAccountNumber("890");
beginRetainedAccount.setLabel("Bilan d'ouverture");
- accountService.createAccount(accountMaster, beginRetainedAccount);
+ accountService.createAccount(beginRetainedAccount);
beginRetainedAccount = accountService.getAccountByNumber("890");
}
@@ -356,7 +356,7 @@
endRetainedAccount = new AccountImpl();
endRetainedAccount.setAccountNumber("891");
endRetainedAccount.setLabel("Bilan de clôture");
- accountService.createAccount(accountMaster, endRetainedAccount);
+ accountService.createAccount(endRetainedAccount);
endRetainedAccount = accountService.getAccountByNumber("891");
}
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 2012-04-04 09:03:41 UTC (rev 3350)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java 2012-04-04 13:25:23 UTC (rev 3351)
@@ -366,8 +366,7 @@
.findByAccountNumber(masterAccountNumber);
i++;
}
- accountService.createSubLedgerWithTransaction(
- masterAccount, account, topiaContext);
+ accountService.createAccountWithTransaction(account, topiaContext);
result.append(_("lima-business.import.accountadded", accountNumber, label));
}
// else if account and exclude account start with 0 (fix from error on EBP)
@@ -375,8 +374,7 @@
// if account is class account : 1, 2, 3, 4, 5, 6, 7,…
int nbCharAccountNumber = accountNumber.length();
if (nbCharAccountNumber == 1) {
- accountService.createAccountWithTransaction(null,
- account, topiaContext);
+ accountService.createAccountWithTransaction(account, topiaContext);
result.append(_("lima-business.import.accountadded", accountNumber, label));
} else {
Account masterAccount = null;
@@ -388,8 +386,7 @@
.findByAccountNumber(masterAccountNumber);
i++;
}
- accountService.createAccountWithTransaction(
- masterAccount, account, topiaContext);
+ accountService.createAccountWithTransaction(account, topiaContext);
result.append(_("lima-business.import.accountadded", accountNumber, label));
}
}
@@ -1239,13 +1236,8 @@
account.setLabel(accountImport.getLabel());
account.setThirdParty(accountImport.getThirdParty());
- if (generalLedger != null) {
- accountService.createSubLedgerWithTransaction(
- generalLedger, account, topiaContext);
- } else {
- accountService.createAccountWithTransaction(
- masterAccount, account, topiaContext);
- }
+ accountService.createAccountWithTransaction(account, topiaContext);
+
result.append(_("lima-business.import.accountadded",
accountImport.getAccountNumber(),
accountImport.getLabel()));
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ReportServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ReportServiceImpl.java 2012-04-04 09:03:41 UTC (rev 3350)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ReportServiceImpl.java 2012-04-04 13:25:23 UTC (rev 3351)
@@ -114,9 +114,9 @@
if (account != null) {
//Get allsubaccounts and thirdParts accounts
- List<Account> accounts = (List<Account>) account.getSubAccounts();
+ List<Account> accounts = null; // FIXME review code (List<Account>) account.getSubAccounts();
if (thirdPartAccountsMode) {
- List<Account> thirdPartAccount = (List<Account>) account.getSubLedgers();
+ List<Account> thirdPartAccount = null; // FIXME review code (List<Account>) account.getSubLedgers();
if (thirdPartAccount != null) {
ReportsDatas subReportsDatas = generateSubAccountReportsWithTransaction(account,
beginDate, endDate, topiaContext);
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/AccountService.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/AccountService.java 2012-04-04 09:03:41 UTC (rev 3350)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/AccountService.java 2012-04-04 13:25:23 UTC (rev 3351)
@@ -43,6 +43,14 @@
@Remote
public interface AccountService {
+ /**
+ * Return account count.
+ *
+ * @return account count
+ * @throws LimaException technical exception
+ */
+ long getAccountCount() throws LimaException;
+
List<Account> getAllAccountByProperty(String propertyName,
String value) throws LimaException;
@@ -61,9 +69,15 @@
Account getAccountByNumber(String number) throws LimaException;
+ /**
+ * Return all account ordered by account name.
+ *
+ * @return all account
+ * @throws LimaException
+ */
List<Account> getAllAccounts() throws LimaException;
- List<Account> getAllSubAccounts() throws LimaException;
+ List<Account> getAllLeafAccounts() throws LimaException;
/**
* Create new account. If {@code masterAccount} is not null, {@code account}
@@ -73,12 +87,8 @@
* @param account account
* @throws LimaException
*/
- void createAccount(Account masterAccount,
- Account account) throws LimaException;
+ void createAccount(Account account) throws LimaException;
- void createSubLedger(Account masterAccount,
- Account account) throws LimaException;
-
void updateAccount(Account account) throws LimaException;
void removeAccount(Account account) throws LimaException;
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/AccountServiceLocal.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/AccountServiceLocal.java 2012-04-04 09:03:41 UTC (rev 3350)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/AccountServiceLocal.java 2012-04-04 13:25:23 UTC (rev 3351)
@@ -5,7 +5,7 @@
* $Id$
* $HeadURL$
* %%
- * Copyright (C) 2008 - 2010 CodeLutin
+ * Copyright (C) 2008 - 2012 CodeLutin, Chatellier Eric
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
@@ -40,12 +40,9 @@
* Last update : $Date$
* By : $Author$
*/
-
@Local
public interface AccountServiceLocal extends AccountService {
- void createAccountWithTransaction(Account masterAccount, Account account, TopiaContext topiaContext) throws LimaException;
+ void createAccountWithTransaction(Account account, TopiaContext topiaContext) throws LimaException;
- void createSubLedgerWithTransaction(Account masterAccount, Account account, TopiaContext topiaContext) throws LimaException;
-
}
\ No newline at end of file
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/migration/MigrationV0_6.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/migration/MigrationV0_6.java 2012-04-04 09:03:41 UTC (rev 3350)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/migration/MigrationV0_6.java 2012-04-04 13:25:23 UTC (rev 3351)
@@ -27,9 +27,6 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.chorem.lima.entity.Account;
-import org.chorem.lima.entity.AccountDAO;
-import org.chorem.lima.entity.LimaCallaoDAOHelper;
import org.nuiton.topia.TopiaException;
import org.nuiton.topia.framework.TopiaContextImplementor;
import org.nuiton.topia.migration.TopiaMigrationCallbackByClass;
@@ -63,74 +60,14 @@
log.info("Migrates to version 0.6");
}
- // find all account with no master account and attach them to a master
- // if master does not exists let's create it also
- AccountDAO accountDAO = LimaCallaoDAOHelper.getAccountDAO(tx);
- List<Account> accounts = accountDAO.findAll();
- for (Account account : accounts) {
- fillMasterAccountNumber(accountDAO, account);
- }
-
// delete computed fields
queries.add("Alter table FINANCIALTRANSACTION drop column AMOUNTDEBIT");
queries.add("Alter table FINANCIALTRANSACTION drop column AMOUNTCREDIT");
+
+ // modele refactoring
+ queries.add("drop table record");
+ queries.add("alter table account drop column masteraccount");
+ queries.add("alter table account drop column generalledger");
}
- protected void fillMasterAccountNumber(AccountDAO accountDAO, Account account) throws TopiaException {
- if (account.getMasterAccount() != null) {
- // have already a master account
- return;
- }
-
- String accountNumber = account.getAccountNumber();
-
- if (log.isInfoEnabled()) {
- log.info("Account " + accountNumber + " does not have a masterAccount, will fill one.");
- }
- int length = accountNumber.length();
- if (length == 1) {
-
- // this is a master account, nothing to do
- return;
- }
- String masterAccountNumber = null;
-
- if (length > 3) {
- // fill with master account with 3 digits
- masterAccountNumber = accountNumber.substring(0, 3);
- } else if (length == 3) {
- // fill with master account with 2 digits
- masterAccountNumber = accountNumber.substring(0, 2);
- } else if (length == 2) {
- // fill with master account with 1 digits
- masterAccountNumber = accountNumber.substring(0, 1);
- }
-
- if (masterAccountNumber != null) {
-
- Account masterAccount = getMasterAccount(accountDAO, account, masterAccountNumber);
-
- if (log.isInfoEnabled()) {
- log.info("Set masterAccount [" + masterAccountNumber + "] to account [" + accountNumber + "]");
- }
- account.setMasterAccount(masterAccount);
-
- // let's fill master account
- fillMasterAccountNumber(accountDAO, masterAccount);
- }
- }
-
- protected Account getMasterAccount(AccountDAO accountDAO,
- Account subAccount,
- String accountNumber) throws TopiaException {
- Account masterAccount =
- accountDAO.findByAccountNumber(accountNumber);
- if (masterAccount == null) {
-
- // creates it
- masterAccount = accountDAO.create(Account.PROPERTY_ACCOUNT_NUMBER, accountNumber);
- }
- masterAccount.addSubAccounts(subAccount);
- return masterAccount;
- }
}
Modified: trunk/lima-business/src/main/java/org/chorem/lima/service/LimaServiceFactory.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/service/LimaServiceFactory.java 2012-04-04 09:03:41 UTC (rev 3350)
+++ trunk/lima-business/src/main/java/org/chorem/lima/service/LimaServiceFactory.java 2012-04-04 13:25:23 UTC (rev 3351)
@@ -40,10 +40,6 @@
import org.apache.commons.io.IOUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.openejb.OpenEJB;
-import org.apache.openejb.assembler.classic.AppInfo;
-import org.apache.openejb.assembler.classic.Assembler;
-import org.apache.openejb.loader.SystemInstance;
import org.chorem.lima.business.ServiceListener;
import org.chorem.lima.business.ServiceMonitorable;
import org.nuiton.util.ApplicationConfig;
Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/AbstractLimaTest.java
===================================================================
--- trunk/lima-business/src/test/java/org/chorem/lima/business/AbstractLimaTest.java 2012-04-04 09:03:41 UTC (rev 3350)
+++ trunk/lima-business/src/test/java/org/chorem/lima/business/AbstractLimaTest.java 2012-04-04 13:25:23 UTC (rev 3351)
@@ -71,6 +71,10 @@
import org.junit.BeforeClass;
import org.nuiton.i18n.I18n;
import org.nuiton.i18n.init.ClassPathI18nInitializer;
+import org.nuiton.topia.TopiaContext;
+import org.nuiton.topia.TopiaContextFactory;
+import org.nuiton.topia.TopiaNotFoundException;
+import org.nuiton.topia.TopiaRuntimeException;
/**
* Common initialization code for all lima tests.
@@ -227,37 +231,37 @@
Account classFinancier = new AccountImpl();
classFinancier.setAccountNumber("5");
classFinancier.setLabel("Comptes financiers");
- accountService.createAccount(null, classFinancier);
+ accountService.createAccount(classFinancier);
Account accountVmp = new AccountImpl();
accountVmp.setAccountNumber("50");
accountVmp.setLabel("Valeurs mobilières de placement");
- accountService.createAccount(classFinancier, accountVmp);
+ accountService.createAccount(accountVmp);
Account accountPel = new AccountImpl();
accountPel.setAccountNumber("501");
accountPel.setLabel("Parts dans des entreprises liées");
- accountService.createAccount(accountVmp, accountPel);
+ accountService.createAccount(accountPel);
Account accountAP = new AccountImpl();
accountAP.setAccountNumber("502");
accountAP.setLabel("Actions propres");
- accountService.createAccount(accountVmp, accountAP);
+ accountService.createAccount(accountAP);
Account accountBefa = new AccountImpl();
accountBefa.setAccountNumber("51");
accountBefa.setLabel("Banques établissements financiers et assimilés");
- accountService.createAccount(classFinancier, accountBefa);
+ accountService.createAccount(accountBefa);
Account accountVmpVae = new AccountImpl();
accountVmpVae.setAccountNumber("511");
accountVmpVae.setLabel("Valeurs à l'encaissement");
- accountService.createAccount(accountBefa, accountVmpVae);
+ accountService.createAccount(accountVmpVae);
Account accountBanques = new AccountImpl();
accountBanques.setAccountNumber("512");
accountBanques.setLabel("Banques");
- accountService.createAccount(accountBefa, accountBanques);
+ accountService.createAccount(accountBanques);
// creation d'un journal
EntryBook journalDesVentes = new EntryBookImpl();
@@ -310,4 +314,24 @@
tr1Entry2.setVoucher("voucher");
tr1Entry2 = financialTransactionService.createEntry(tr1Entry2);
}
+
+ /**
+ * Method to use only for class that need a context to be tester.
+ * Only for DOA for now.
+ *
+ * @return a topia context
+ */
+ protected static TopiaContext getTestContext() {
+ try {
+ LimaConfig config = LimaConfig.getInstance();
+ Properties options = config.getFlatOptions();
+
+ if (log.isDebugEnabled()) {
+ log.debug("Opening context to database : " + options.getProperty("hibernate.connection.url"));
+ }
+ return TopiaContextFactory.getContext(options);
+ } catch (TopiaNotFoundException ex) {
+ throw new TopiaRuntimeException("Could not acquire root context", ex);
+ }
+ }
}
Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/AccountServiceImplTest.java
===================================================================
--- trunk/lima-business/src/test/java/org/chorem/lima/business/AccountServiceImplTest.java 2012-04-04 09:03:41 UTC (rev 3350)
+++ trunk/lima-business/src/test/java/org/chorem/lima/business/AccountServiceImplTest.java 2012-04-04 13:25:23 UTC (rev 3351)
@@ -60,7 +60,7 @@
Account myAccount = new AccountImpl();
myAccount.setAccountNumber("2");
myAccount.setLabel("Comptes d'immobilisations");
- accountService.createAccount(null, myAccount);
+ accountService.createAccount(myAccount);
}
/**
@@ -73,7 +73,7 @@
Account myAccount = new AccountImpl();
myAccount.setAccountNumber("5");
myAccount.setLabel("Comptes de capitaux");
- accountService.createAccount(null, myAccount);
+ accountService.createAccount(myAccount);
}
/**
@@ -89,7 +89,7 @@
Account myAccount = new AccountImpl();
myAccount.setAccountNumber("42"); // erreur de compte (4)
myAccount.setLabel("Comptes de tiers");
- accountService.createAccount(null, myAccount);
+ accountService.createAccount(myAccount);
}
/**
@@ -104,22 +104,22 @@
Account classCharges = new AccountImpl();
classCharges.setAccountNumber("6");
classCharges.setLabel("Comptes de charges");
- accountService.createAccount(null, classCharges);
+ accountService.createAccount(classCharges);
Account accountAchat = new AccountImpl();
accountAchat.setAccountNumber("60");
accountAchat.setLabel("Achats (sauf 603)");
- accountService.createAccount(classCharges, accountAchat);
+ accountService.createAccount(accountAchat);
Account accountSe = new AccountImpl();
accountSe.setAccountNumber("61");
accountSe.setLabel("Services extérieurs");
- accountService.createAccount(classCharges, accountSe);
+ accountService.createAccount(accountSe);
Account accountVs = new AccountImpl();
accountVs.setAccountNumber("603");
accountVs.setLabel("Variations des stocks (approvisionnements et marchandises)");
- accountService.createAccount(accountAchat, accountVs);
+ accountService.createAccount(accountVs);
}
/**
@@ -134,12 +134,12 @@
Account classFinancier = new AccountImpl();
classFinancier.setAccountNumber("5");
classFinancier.setLabel("Comptes financiers");
- accountService.createAccount(null, classFinancier);
+ accountService.createAccount(classFinancier);
Account accountVmp = new AccountImpl();
accountVmp.setAccountNumber("40");
accountVmp.setLabel("Fournisseurs et comptes rattachés");
- accountService.createAccount(classFinancier, accountVmp);
+ accountService.createAccount(accountVmp);
}
/**
@@ -178,6 +178,17 @@
}
/**
+ * Find all leaf account.
+ *
+ * @throws LimaException
+ */
+ @Test
+ public void getAllLeafAccountTest() throws LimaException {
+ List<Account> listAccount = accountService.getAllLeafAccounts();
+ Assert.assertEquals(4, listAccount.size());
+ }
+
+ /**
* Permet de tester si un compte est bien effacé.
*
* @throws LimaException
Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/ImportServiceImplTest.java
===================================================================
--- trunk/lima-business/src/test/java/org/chorem/lima/business/ImportServiceImplTest.java 2012-04-04 09:03:41 UTC (rev 3350)
+++ trunk/lima-business/src/test/java/org/chorem/lima/business/ImportServiceImplTest.java 2012-04-04 13:25:23 UTC (rev 3351)
@@ -116,12 +116,13 @@
* @throws Exception
*/
@Test
- public void testImportAccountLedgerAccount() throws Exception {
+ public void testImportCreateIntermediaiteAccount() throws Exception {
importEBPData();
Account compteTiers = accountService.getAccountByNumber("4");
Account employeAccount = accountService.getAccountByNumber("401TEEMP");
- Assert.assertEquals(compteTiers, employeAccount.getGeneralLedger());
+ Assert.assertNotNull(compteTiers);
+ Assert.assertNotNull(employeAccount);
}
/**
Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/AccountServiceRuleFrTest.java
===================================================================
--- trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/AccountServiceRuleFrTest.java 2012-04-04 09:03:41 UTC (rev 3350)
+++ trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/AccountServiceRuleFrTest.java 2012-04-04 13:25:23 UTC (rev 3351)
@@ -71,6 +71,6 @@
public void testCreateAccountWrongNumber() throws LimaException {
Account myAccount = new AccountImpl();
myAccount.setAccountNumber("42");
- accountService.createAccount(null, myAccount);
+ accountService.createAccount(myAccount);
}
}
Added: trunk/lima-business/src/test/java/org/chorem/lima/entity/AccountDAOTest.java
===================================================================
--- trunk/lima-business/src/test/java/org/chorem/lima/entity/AccountDAOTest.java (rev 0)
+++ trunk/lima-business/src/test/java/org/chorem/lima/entity/AccountDAOTest.java 2012-04-04 13:25:23 UTC (rev 3351)
@@ -0,0 +1,60 @@
+/*
+ * #%L
+ *
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Codelutin, Chatellier Eric
+ * %%
+ * 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>.
+ * #L%
+ */
+
+package org.chorem.lima.entity;
+
+import java.util.List;
+
+import org.chorem.lima.business.AbstractLimaTest;
+import org.junit.Assert;
+import org.junit.Test;
+import org.nuiton.topia.TopiaException;
+
+/**
+ * Test for AccountDAO class.
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * By : $Author$
+ */
+public class AccountDAOTest extends AbstractLimaTest {
+
+ /**
+ * Test la recherche de compte par interval.
+ * @throws TopiaException
+ */
+ @Test
+ public void testStringToListAccounts() throws TopiaException {
+ AccountDAO accountDAO = LimaCallaoDAOHelper.getAccountDAO(getTestContext());
+
+ List<Account> accounts = accountDAO.stringToListAccounts("50..511", false);
+ Assert.assertEquals(3, accounts.size());
+
+ accounts = accountDAO.stringToListAccounts("60..99", false);
+ Assert.assertEquals(0, accounts.size());
+ }
+}
Property changes on: trunk/lima-business/src/test/java/org/chorem/lima/entity/AccountDAOTest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Copied: trunk/lima-callao/src/main/java/org/chorem/lima/entity/AccountDAO.java (from rev 3340, trunk/lima-callao/src/main/java/org/chorem/lima/entity/AccountDAOImpl.java)
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/entity/AccountDAO.java (rev 0)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/entity/AccountDAO.java 2012-04-04 13:25:23 UTC (rev 3351)
@@ -0,0 +1,198 @@
+/*
+ * #%L
+ * Lima callao
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2008 - 2012 CodeLutin, Chatellier Eric
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+package org.chorem.lima.entity;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.StringTokenizer;
+
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuiton.topia.TopiaException;
+
+public class AccountDAO extends AccountDAOAbstract<Account> {
+
+ private static final Log log = LogFactory.getLog(AccountDAO.class);
+
+ /**
+ * Retourne tous les comptes qui n'ont pas eux meme de sous compte.
+ */
+ public List<Account> findAllLeafAccounts() throws TopiaException {
+ String query = "FROM " + Account.class.getName() + " a WHERE a NOT IN (" +
+ "FROM " + Account.class.getName() + " b where b.accountNumber like concat(a.accountNumber,'%'))";
+ List<Account> accounts = context.find(query);
+ return accounts;
+ }
+
+ /**
+ * TODO pas compris l'interet de la methode, si on veut un compte feuille
+ * par son numero, cela revient a avoir un compte par son numero.
+ */
+ @Deprecated
+ public Account findLeafAccountByNumber(String number) throws TopiaException {
+ return findByAccountNumber(number);
+ }
+
+ /**
+ * Find account contained into account number interval.
+ *
+ * @param accountNumberLow min account number
+ * @param accountNumberHigh max account number
+ * @return account list
+ * @throws TopiaException
+ */
+ protected List<Account> findIntervalAccountByNumber(String accountNumberLow,
+ String accountNumberHigh) throws TopiaException {
+ String query = "FROM " + Account.class.getName() + " WHERE ? < accountNumber AND accountNumber > ?";
+ return (List<Account>) context.find(query, accountNumberLow, accountNumberHigh);
+ }
+
+ /**
+ * @deprecated since 0.6, business method, need to be moved out of dao
+ */
+ @Deprecated
+ public List<Account> stringToListAccounts(String selectedAccounts,
+ Boolean leafAccountsMode) throws TopiaException {
+ Set<Account> accounts = new HashSet<Account>();
+ if (selectedAccounts != null) {
+ //Remove Spaces
+ String result = StringUtils.deleteWhitespace(selectedAccounts);
+
+ Boolean first = true;
+ StringTokenizer stStar = new StringTokenizer(result, "-");
+ while (stStar.hasMoreTokens()) {
+ String subString = stStar.nextToken();
+
+ //Split comma
+ StringTokenizer stComma = new StringTokenizer(subString, ",");
+ while (stComma.hasMoreTokens()) {
+ String s = stComma.nextToken();
+ //if intervall account
+ if (s.contains("..") && !s.endsWith("..")) {
+ //Split ..
+ String stringDoubleDot[] = s.split("\\.\\.");
+
+ List<Account> resultIntervall =
+ findIntervalAccountByNumber(stringDoubleDot[0], stringDoubleDot[1]);
+
+ //if first add accounts, else remove
+ if (first) {
+ accounts.addAll(resultIntervall);
+ } else {
+ accounts.removeAll(resultIntervall);
+ }
+ }
+ //else one account
+ else {
+ Account account = null;
+ if (leafAccountsMode) {
+ account = findLeafAccountByNumber(s);
+ } else {
+ account = findByAccountNumber(s);
+ }
+ //if exist
+ if (account != null) {
+ //if first
+ if (first) {
+ accounts.add(account);
+ } else {
+ accounts.remove(account);
+ }
+ }
+ //search all account start with accountnumber
+ else {
+ /*TopiaQuery query = createQuery();
+ String subAccountsProperty = TopiaQuery.getProperty(Account.PROPERTY_SUB_ACCOUNTS);
+ query.addWhere("not exists elements (" + subAccountsProperty + ")")
+ .addWhere(Account.PROPERTY_ACCOUNT_NUMBER, Op.LIKE, s + "%");
+ List<Account> accountsResult = (List<Account>) findAllByQuery(query);*/
+
+ String query = "FROM " + Account.class.getName() + " a WHERE NOT IN (" +
+ "FROM " + Account.class.getName() + " b where b.accountNumber like a.accountNumber+'%')" +
+ " AND a.accountNumber LIKE ?";
+ List<Account> accountsResult = getContext().find(query, s);
+ if (accountsResult != null) {
+ //if first
+ if (first) {
+ accounts.addAll(accountsResult);
+ } else {
+ accounts.removeAll(accountsResult);
+ }
+ }
+ }
+ }
+ }
+ first = false;
+ }
+ }
+ return new ArrayList(accounts);
+ }
+
+ /*
+ * @see org.chorem.lima.entity.AccountDAOAbstract#getSubAccounts(org.chorem.lima.entity.Account)
+ */
+ public List<Account> getSubAccounts(Account account) throws TopiaException {
+
+ List<Account> accountsResult = null;
+
+ /*String query = "FROM " + Account.class.getName() + " a WHERE a.accountNumber LIKE :like" +
+ " ORDER BY a.accountNumber";
+
+
+ // FIXME echatellier 20120321 remove hard coded 8 here
+ // usefull for efficient tree loading but not beautiful code
+ String likeSuffix = "";
+ while (CollectionUtils.isEmpty(accountsResult) && likeSuffix.length() < 8) {
+ likeSuffix += "_";
+ if (account != null) {
+ accountsResult = getContext().find(query, "like", account.getAccountNumber() + likeSuffix);
+ } else {
+ accountsResult = getContext().find(query, "like", likeSuffix);
+ }
+ }*/
+
+ // on recherche les sous comptes de account
+ // qui ne sont pas eux meme des sous comptes intermediaire
+ // autrement dir, les fils directs
+ /*String query = "FROM " + Account.class.getName() + " a" +
+ " WHERE a.accountNumber LIKE :like" +
+ " AND a not in (FROM " + Account.class.getName() + " b" +
+ " WHERE b.accountNumber like concat(a.accountNumber,'%'))" +
+ " ORDER BY a.accountNumber";
+
+ if (account != null) {
+ accountsResult = getContext().find(query, "like", account.getAccountNumber() + "%");
+ } else {
+ accountsResult = getContext().find(query, "like", "%");
+ }*/
+
+ return accountsResult;
+ }
+}
Deleted: trunk/lima-callao/src/main/java/org/chorem/lima/entity/AccountDAOImpl.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/entity/AccountDAOImpl.java 2012-04-04 09:03:41 UTC (rev 3350)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/entity/AccountDAOImpl.java 2012-04-04 13:25:23 UTC (rev 3351)
@@ -1,148 +0,0 @@
-/*
- * #%L
- * Lima callao
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2008 - 2010 CodeLutin
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-package org.chorem.lima.entity;
-
-import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.nuiton.topia.TopiaException;
-import org.nuiton.topia.framework.TopiaQuery;
-import org.nuiton.topia.framework.TopiaQuery.Op;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.StringTokenizer;
-
-public class AccountDAOImpl<E extends Account> extends AccountDAOAbstract<E> {
-
- private static final Log log = LogFactory.getLog(AccountDAOImpl.class);
-
- /**
- * List all subaccounts (no folderaccounts, exclude accounts contains thirdpart accounts)
- * Sort by accout number in lexicographical order
- */
- @Override
- public List<Account> findAllSubAccounts() throws TopiaException {
- TopiaQuery query = createQuery();
- String subAccountsProperty = TopiaQuery.getProperty(Account.PROPERTY_SUB_ACCOUNTS);
- query.addWhere("not exists elements (" + subAccountsProperty + ")")
- .addOrder(Account.PROPERTY_ACCOUNT_NUMBER);
- return (List<Account>) findAllByQuery(query);
- }
-
- @Override
- public Account findSubAccountByNumber(String number) throws TopiaException {
- TopiaQuery query = createQuery();
- String subAccountsProperty = TopiaQuery.getProperty(Account.PROPERTY_SUB_ACCOUNTS);
- String subLedgersProperty = TopiaQuery.getProperty(Account.PROPERTY_SUB_LEDGERS);
- query.addWhere("not exists elements (" + subAccountsProperty + ")")
- .addWhere("not exists elements (" + subLedgersProperty + ")")
- .addEquals(Account.PROPERTY_ACCOUNT_NUMBER, number);
- return findByQuery(query);
- }
-
- public List<Account> findIntervalAccountByNumber(String accountNumberLow,
- String accountNumberHigh) throws TopiaException {
- TopiaQuery query = createQuery();
- query.addBetween(Account.PROPERTY_ACCOUNT_NUMBER,
- accountNumberLow, accountNumberHigh);
- return (List<Account>) findAllByQuery(query);
- }
-
- @Override
- public List<Account> stringToListAccounts(String selectedAccounts,
- Boolean subAccountsMode) throws TopiaException {
- HashSet<Account> accounts = new HashSet<Account>();
- if (selectedAccounts != null) {
- //Remove Spaces
- String result = StringUtils.deleteWhitespace(selectedAccounts);
-
- Boolean first = true;
- StringTokenizer stStar = new StringTokenizer(result, "-");
- while (stStar.hasMoreTokens()) {
- String subString = stStar.nextToken();
-
- //Split comma
- StringTokenizer stComma = new StringTokenizer(subString, ",");
- while (stComma.hasMoreTokens()) {
- String s = stComma.nextToken();
- //if intervall account
- if (s.contains("..") && !s.endsWith("..")) {
- //Split ..
- String stringDoubleDot[] = s.split("\\.\\.");
-
- List<Account> resultIntervall =
- findIntervalAccountByNumber(stringDoubleDot[0], stringDoubleDot[1]);
-
- //if first add accounts, else remove
- if (first) {
- accounts.addAll(resultIntervall);
- } else {
- accounts.removeAll(resultIntervall);
- }
- }
- //else one account
- else {
- Account account = null;
- if (subAccountsMode) {
- account = findSubAccountByNumber(s);
- } else {
- account = findByAccountNumber(s);
- }
- //if exist
- if (account != null) {
- //if first
- if (first) {
- accounts.add(account);
- } else {
- accounts.remove(account);
- }
- }
- //search all account start with accountnumber
- else {
- TopiaQuery query = createQuery();
- String subAccountsProperty = TopiaQuery.getProperty(Account.PROPERTY_SUB_ACCOUNTS);
- query.addWhere("not exists elements (" + subAccountsProperty + ")")
- .addWhere(Account.PROPERTY_ACCOUNT_NUMBER, Op.LIKE, s + "%");
- List<Account> accountsResult = (List<Account>) findAllByQuery(query);
- if (accountsResult != null) {
- //if first
- if (first) {
- accounts.addAll(accountsResult);
- } else {
- accounts.removeAll(accountsResult);
- }
- }
- }
- }
- }
- first = false;
- }
- }
- return new ArrayList(accounts);
- }
-}
Copied: trunk/lima-callao/src/main/java/org/chorem/lima/entity/ClosedPeriodicEntryBookDAO.java (from rev 3322, trunk/lima-callao/src/main/java/org/chorem/lima/entity/ClosedPeriodicEntryBookDAOImpl.java)
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/entity/ClosedPeriodicEntryBookDAO.java (rev 0)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/entity/ClosedPeriodicEntryBookDAO.java 2012-04-04 13:25:23 UTC (rev 3351)
@@ -0,0 +1,71 @@
+/*
+ * #%L
+ * Lima callao
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2008 - 2010 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+package org.chorem.lima.entity;
+
+import java.util.Date;
+import java.util.List;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuiton.topia.TopiaException;
+import org.nuiton.topia.framework.TopiaQuery;
+import org.nuiton.topia.framework.TopiaQuery.Op;
+
+public class ClosedPeriodicEntryBookDAO extends ClosedPeriodicEntryBookDAOImpl<ClosedPeriodicEntryBook> {
+
+ private static final Log log = LogFactory.getLog(ClosedPeriodicEntryBookDAO.class);
+
+
+ /** Return ClosedPeriodicEntryBook by EntryBook and FinancialPeriod */
+ public ClosedPeriodicEntryBook findByEntryBookAndFinancialPeriod(
+ EntryBook entryBook, FinancialPeriod financialPeriod)
+ throws TopiaException {
+
+ TopiaQuery query = createQuery();
+ if (entryBook != null) {
+ query.addEquals(ClosedPeriodicEntryBook.PROPERTY_ENTRY_BOOK, entryBook);
+ }
+ if (financialPeriod != null) {
+ query.addEquals(ClosedPeriodicEntryBook.PROPERTY_FINANCIAL_PERIOD, financialPeriod);
+ }
+ return findByQuery(query);
+ }
+
+ public List<ClosedPeriodicEntryBook> findAllByDates(Date beginDate,
+ Date endDate) throws TopiaException {
+ TopiaQuery query = createQuery();
+ if (beginDate != null && endDate != null) {
+ String beginDateProperty = TopiaQuery.getProperty(ClosedPeriodicEntryBook.PROPERTY_FINANCIAL_PERIOD, FinancialPeriod.PROPERTY_BEGIN_DATE);
+ String endDateProperty = TopiaQuery.getProperty(ClosedPeriodicEntryBook.PROPERTY_FINANCIAL_PERIOD, FinancialPeriod.PROPERTY_BEGIN_DATE);
+ String entrybookProperty = TopiaQuery.getProperty(ClosedPeriodicEntryBook.PROPERTY_ENTRY_BOOK, EntryBook.PROPERTY_CODE);
+ query.addWhere(beginDateProperty, Op.GE, beginDate)
+ .addWhere(endDateProperty, Op.LE, endDate)
+ .addOrder(beginDateProperty, entrybookProperty);
+ }
+ return (List<ClosedPeriodicEntryBook>) findAllByQuery(query);
+ }
+
+}
Deleted: trunk/lima-callao/src/main/java/org/chorem/lima/entity/ClosedPeriodicEntryBookDAOImpl.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/entity/ClosedPeriodicEntryBookDAOImpl.java 2012-04-04 09:03:41 UTC (rev 3350)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/entity/ClosedPeriodicEntryBookDAOImpl.java 2012-04-04 13:25:23 UTC (rev 3351)
@@ -1,73 +0,0 @@
-/*
- * #%L
- * Lima callao
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2008 - 2010 CodeLutin
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-package org.chorem.lima.entity;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.nuiton.topia.TopiaException;
-import org.nuiton.topia.framework.TopiaQuery;
-import org.nuiton.topia.framework.TopiaQuery.Op;
-
-import java.util.Date;
-import java.util.List;
-
-public class ClosedPeriodicEntryBookDAOImpl<E extends ClosedPeriodicEntryBook> extends ClosedPeriodicEntryBookDAOAbstract<E> {
-
- private static final Log log = LogFactory.getLog(ClosedPeriodicEntryBookDAOImpl.class);
-
-
- /** Return ClosedPeriodicEntryBook by EntryBook and FinancialPeriod */
- @Override
- public ClosedPeriodicEntryBook findByEntryBookAndFinancialPeriod(
- EntryBook entryBook, FinancialPeriod financialPeriod)
- throws TopiaException {
-
- TopiaQuery query = createQuery();
- if (entryBook != null) {
- query.addEquals(ClosedPeriodicEntryBook.PROPERTY_ENTRY_BOOK, entryBook);
- }
- if (financialPeriod != null) {
- query.addEquals(ClosedPeriodicEntryBook.PROPERTY_FINANCIAL_PERIOD, financialPeriod);
- }
- return findByQuery(query);
- }
-
- @Override
- public List<ClosedPeriodicEntryBook> findAllByDates(Date beginDate,
- Date endDate) throws TopiaException {
- TopiaQuery query = createQuery();
- if (beginDate != null && endDate != null) {
- String beginDateProperty = TopiaQuery.getProperty(ClosedPeriodicEntryBook.PROPERTY_FINANCIAL_PERIOD, FinancialPeriod.PROPERTY_BEGIN_DATE);
- String endDateProperty = TopiaQuery.getProperty(ClosedPeriodicEntryBook.PROPERTY_FINANCIAL_PERIOD, FinancialPeriod.PROPERTY_BEGIN_DATE);
- String entrybookProperty = TopiaQuery.getProperty(ClosedPeriodicEntryBook.PROPERTY_ENTRY_BOOK, EntryBook.PROPERTY_CODE);
- query.addWhere(beginDateProperty, Op.GE, beginDate)
- .addWhere(endDateProperty, Op.LE, endDate)
- .addOrder(beginDateProperty, entrybookProperty);
- }
- return (List<ClosedPeriodicEntryBook>) findAllByQuery(query);
- }
-
-}
Copied: trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialPeriodDAO.java (from rev 3322, trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialPeriodDAOImpl.java)
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialPeriodDAO.java (rev 0)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialPeriodDAO.java 2012-04-04 13:25:23 UTC (rev 3351)
@@ -0,0 +1,50 @@
+/*
+ * #%L
+ * Lima callao
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2008 - 2010 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+package org.chorem.lima.entity;
+
+import org.nuiton.topia.TopiaException;
+import org.nuiton.topia.framework.TopiaQuery;
+
+import java.util.Date;
+
+public class FinancialPeriodDAO extends FinancialPeriodDAOImpl<FinancialPeriod> {
+
+ /**
+ * Return FinancialPeriod by Date
+ * Date is include between financialperiod begin and end date
+ */
+ public FinancialPeriod findByDate(Date date) throws TopiaException {
+
+ TopiaQuery query = createQuery();
+ if (date != null) {
+ query.addWhere(FinancialPeriod.PROPERTY_BEGIN_DATE + " <= :value")
+ .addWhere(FinancialPeriod.PROPERTY_END_DATE + " >= :value")
+ .addParam("value", date);
+ }
+ return findByQuery(query);
+ }
+
+}
Deleted: trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialPeriodDAOImpl.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialPeriodDAOImpl.java 2012-04-04 09:03:41 UTC (rev 3350)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialPeriodDAOImpl.java 2012-04-04 13:25:23 UTC (rev 3351)
@@ -1,51 +0,0 @@
-/*
- * #%L
- * Lima callao
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2008 - 2010 CodeLutin
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-package org.chorem.lima.entity;
-
-import org.nuiton.topia.TopiaException;
-import org.nuiton.topia.framework.TopiaQuery;
-
-import java.util.Date;
-
-public class FinancialPeriodDAOImpl<E extends FinancialPeriod> extends FinancialPeriodDAOAbstract<E> {
-
- /**
- * Return FinancialPeriod by Date
- * Date is include between financialperiod begin and end date
- */
- @Override
- public FinancialPeriod findByDate(Date date) throws TopiaException {
-
- TopiaQuery query = createQuery();
- if (date != null) {
- query.addWhere(FinancialPeriod.PROPERTY_BEGIN_DATE + " <= :value")
- .addWhere(FinancialPeriod.PROPERTY_END_DATE + " >= :value")
- .addParam("value", date);
- }
- return findByQuery(query);
- }
-
-}
Deleted: trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialStatementImpl.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialStatementImpl.java 2012-04-04 09:03:41 UTC (rev 3350)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialStatementImpl.java 2012-04-04 13:25:23 UTC (rev 3351)
@@ -1,45 +0,0 @@
-/*
- * #%L
- * Lima callao
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2008 - 2010 CodeLutin
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-package org.chorem.lima.entity;
-
-public class FinancialStatementImpl extends FinancialStatementAbstract {
-
- private static final long serialVersionUID = 1L;
-
- protected Integer level;
-
- @Override
- public int getLevel() {
- if (level == null) {
- if (masterFinancialStatement != null) {
- level = masterFinancialStatement.getLevel() + 1;
- } else {
- level = 1;
- }
- }
- return level;
- }
-}
Copied: trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialStatementImpl.java (from rev 3322, trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialStatementImpl.java)
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialStatementImpl.java (rev 0)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialStatementImpl.java 2012-04-04 13:25:23 UTC (rev 3351)
@@ -0,0 +1,45 @@
+/*
+ * #%L
+ * Lima callao
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2008 - 2010 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+package org.chorem.lima.entity;
+
+public class FinancialStatementImpl extends FinancialStatementAbstract {
+
+ private static final long serialVersionUID = 1L;
+
+ protected Integer level;
+
+ @Override
+ public int getLevel() {
+ if (level == null) {
+ if (masterFinancialStatement != null) {
+ level = masterFinancialStatement.getLevel() + 1;
+ } else {
+ level = 1;
+ }
+ }
+ return level;
+ }
+}
Modified: trunk/lima-callao/src/main/xmi/accounting.properties
===================================================================
--- trunk/lima-callao/src/main/xmi/accounting.properties 2012-04-04 09:03:41 UTC (rev 3350)
+++ trunk/lima-callao/src/main/xmi/accounting.properties 2012-04-04 13:25:23 UTC (rev 3351)
@@ -27,6 +27,7 @@
model.tagvalue.version=0.6
model.tagvalue.constantPrefix=PROPERTY_
model.tagValue.notGenerateToString=true
+model.tagvalue.String=text
# natural id
org.chorem.lima.entity.Account.class.tagvalue.naturalIdMutable=false
@@ -46,14 +47,8 @@
org.chorem.lima.entity.FiscalPeriod.attribute.endDate.tagvalue.notNull=true
# lazy
-org.chorem.lima.entity.Account.attribute.subAccounts.tagvalue.lazy=false
-org.chorem.lima.entity.Account.attribute.subLedgers.tagvalue.lazy=false
org.chorem.lima.entity.FiscalPeriod.attribute.financialPeriod.tagvalue.lazy=false
org.chorem.lima.entity.FinancialStatement.attribute.subFinancialStatements.tagvalue.lazy=false
org.chorem.lima.entity.FinancialStatement.attribute.masterFinancialStatement.tagvalue.lazy=false
org.chorem.lima.entity.VatStatement.attribute.subVatStatements.tagvalue.lazy=false
org.chorem.lima.entity.VatStatement.attribute.masterVatStatement.tagvalue.lazy=false
-
-
-#model.tagvalue.dbSchema=Callao
-model.tagvalue.String=text
\ 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/LimaMain.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java 2012-04-04 09:03:41 UTC (rev 3350)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java 2012-04-04 13:25:23 UTC (rev 3351)
@@ -161,10 +161,10 @@
AccountService accountService =
LimaServiceFactory.getService(AccountServiceMonitorable.class);
- List<Account> accounts = accountService.getChildrenAccounts(null);
- if (accounts.isEmpty()) {
+ long accountCount = accountService.getAccountCount();
+ if (accountCount == 0) {
if (log.isInfoEnabled()) {
- log.info("Propose for defaut account loading");
+ log.info("Propose for default account loading");
}
OpeningView openingView = new OpeningView();
openingView.setSize(800, 400);
Deleted: 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 2012-04-04 09:03:41 UTC (rev 3350)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountTreeTableModel.java 2012-04-04 13:25:23 UTC (rev 3351)
@@ -1,374 +0,0 @@
-/*
- * #%L
- * Lima Swing
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2008 - 2012 CodeLutin, Chatellier Eric
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-package org.chorem.lima.ui.account;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.chorem.lima.business.LimaBusinessException;
-import org.chorem.lima.business.LimaException;
-import org.chorem.lima.business.ejbinterface.AccountService;
-import org.chorem.lima.business.monitorable.AccountServiceMonitorable;
-import org.chorem.lima.entity.Account;
-import org.chorem.lima.service.LimaServiceFactory;
-import org.chorem.lima.util.ErrorHelper;
-import org.jdesktop.swingx.treetable.DefaultMutableTreeTableNode;
-import org.jdesktop.swingx.treetable.DefaultTreeTableModel;
-import org.jdesktop.swingx.treetable.MutableTreeTableNode;
-import org.jdesktop.swingx.treetable.TreeTableNode;
-
-import javax.swing.tree.TreePath;
-import java.util.Arrays;
-import java.util.Enumeration;
-import java.util.List;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * Tree table model for account edition.
- *
- * @author ore
- * @author chatellier
- * @version $Revision$
- * <p/>
- * Last update : $Date$
- * By : $Author$
- */
-public class AccountTreeTableModel extends DefaultTreeTableModel {
-
- /** log. */
- private static final Log log = LogFactory.getLog(AccountViewHandler.class);
-
- /** Account service. */
- protected final AccountService accountService;
-
- public class AccountTreeTableNode extends DefaultMutableTreeTableNode {
-
- protected boolean loaded;
-
- AccountTreeTableNode(Account userObject) {
- super(userObject);
- }
-
- @Override
- public Account getUserObject() {
- return (Account) super.getUserObject();
- }
-
- @Override
- public int getChildCount() {
- loadChildrenIfRequired();
- return super.getChildCount();
- }
-
- private void loadChildrenIfRequired() {
- if (!loaded) {
- loaded = true;
- loadChilds(getUserObject());
- }
- }
-
- @Override
- public void setParent(MutableTreeTableNode newParent) {
- parent = newParent;
- }
-
- private void loadChilds(Account account) {
- try {
- if (log.isInfoEnabled()) {
- log.info("Loading childs for account " + (account == null ? "Root node" : account.getAccountNumber()));
- }
- List<Account> childs =
- accountService.getChildrenAccounts(account);
- for (Account child : childs) {
- add(new AccountTreeTableNode(child));
- }
- } catch (LimaException e) {
- ErrorHelper.showErrorDialog(
- "Could not load child of account " + account, e);
- } finally {
- loaded = true;
- }
- }
-
- @Override
- public Enumeration<? extends MutableTreeTableNode> children() {
- loadChildrenIfRequired();
- return super.children();
- }
-
- @Override
- public TreeTableNode getChildAt(int childIndex) {
- loadChildrenIfRequired();
- return super.getChildAt(childIndex);
- }
-
- @Override
- public boolean isEditable(int column) {
- return false;
- }
-
- @Override
- public Object getValueAt(int column) {
- Account account = getUserObject();
-
- Object result = null;
- if (account != null) {
- switch (column) {
- case 0:
- result = account.getAccountNumber();
- break;
- case 1:
- result = account.getLabel();
- break;
- }
- }
- return result;
- }
-
- @Override
- public int getColumnCount() {
- return 2;
- }
- }
-
- /** Model constructor. Init account service used here. */
- public AccountTreeTableModel() {
-
- setColumnIdentifiers(Arrays.asList(_("lima.table.number"),
- _("lima.table.label")));
-
- setRoot(new AccountTreeTableNode(null));
-
- // Gets factory service
- accountService =
- LimaServiceFactory.getService(AccountServiceMonitorable.class);
- }
-
-// @Override
-// public int getColumnCount() {
-// return 2;
-// }
-
-// @Override
-// public String getColumnName(int column) {
-// String res = null;
-// switch (column) {
-// case 0:
-// res = _("lima.table.number");
-// break;
-// case 1:
-// res = _("lima.table.label");
-// break;
-// }
-// return res;
-// }
-
-// @Override
-// public int getChildCount(Object node) {
-// int result = 0;
-// if (node == getRoot()) {
-// try {
-// result = accountService.getChildrenAccounts(null).size();
-// } catch (LimaException eee) {
-// log.debug("Can't count child", eee);
-// }
-// } else {
-// Account parentAccount = (Account) node;
-// try {
-// result = accountService.getChildrenAccounts(parentAccount).size();
-// } catch (LimaException eee) {
-// log.debug("Can't count child", eee);
-// }
-// }
-// return result;
-// }
-
-// @Override
-// public Object getChild(Object parent, int index) {
-// Object result = null;
-// if (parent == getRoot()) {
-// try {
-// List<Account> allAccounts =
-// accountService.getChildrenAccounts(null);
-// result = allAccounts.get(index);
-// } catch (LimaException eee) {
-// log.debug("Can't get child", eee);
-// }
-// } else {
-// Account parentAccount = (Account) parent;
-//
-// // FIXME sub account is a collection ?
-// try {
-// List<Account> subaccounts =
-// accountService.getChildrenAccounts(parentAccount);
-// result = subaccounts.get(index);
-// } catch (LimaException eee) {
-// log.debug("Can't get child", eee);
-// }
-// }
-// return result;
-// }
-
-// @Override
-// public int getIndexOfChild(Object parent, Object child) {
-// int result = 0;
-// Account parentAccount = (Account) parent;
-// Account childAccount = (Account) child;
-//
-// if (parent == getRoot()) {
-// try {
-// List<Account> allAccounts =
-// accountService.getChildrenAccounts(null);
-// result = allAccounts.indexOf(child);
-// } catch (LimaException eee) {
-// log.debug("Can't get index child", eee);
-// }
-// } else {
-// // FIXME sub account is a collection ?
-// try {
-// List<Account> subaccounts =
-// accountService.getChildrenAccounts(parentAccount);
-// result = subaccounts.indexOf(childAccount);
-// } catch (LimaException eee) {
-// log.debug("Can't get index child", eee);
-// }
-// }
-// return result;
-// }
-
-// @Override
-// public Object getValueAt(Object node, int column) {
-// Object result = "n/a";
-// if (node instanceof Account) {
-// Account account = (Account) node;
-// switch (column) {
-// case 0:
-// result = account.getAccountNumber();
-// break;
-// case 1:
-// result = account.getLabel();
-// break;
-// }
-// }
-// return result;
-// }
-
-// @Override
-// public boolean isCellEditable(Object node, int column) {
-// return false;
-// }
-
-// @Override
-// public boolean isLeaf(Object node) {
-// return getChildCount(node) == 0;
-// }
-
- /**
- * Add account
- *
- * @param parentAccount
- * @param account
- * @throws LimaException
- */
- public void addAccount(Account parentAccount,
- Account account) throws LimaException {
- accountService.createAccount(parentAccount, account);
- //FIXME 2011.08.09 vsalaun quick tree refresh, it should refresh only the path changed
- //modelSupport.fireTreeStructureChanged(path);
- modelSupport.fireNewRoot();
- }
-
- /**
- * Add account
- *
- * @param parentAccount
- * @param account
- * @throws LimaException
- */
- public void addSubLedger(Account parentAccount,
- Account account) throws LimaException {
- accountService.createSubLedger(parentAccount, account);
- //FIXME 2011.08.09 vsalaun quick tree refresh, it should refresh only the path changed
- //modelSupport.fireTreeStructureChanged(path);
- modelSupport.fireNewRoot();
- }
-
- /**
- * Update account.
- *
- * @param account
- * @throws LimaException
- */
- public void updateAccount(Account account) throws LimaException {
- // Calling account service
- //FIXME Force fire for no update if error. Where is the cache ?
- try {
- accountService.updateAccount(account);
- } catch (LimaException eee) {
- //modelSupport.fireTreeStructureChanged(path);
- throw new LimaBusinessException("Can't update account : "
- + account.getAccountNumber(), eee);
- }
- //FIXME 2011.08.10 vsalaun quick tree refresh, it should only refresh the path where
- //the account were, and the path where it has been moved
- //modelSupport.fireTreeStructureChanged(path);
- modelSupport.fireNewRoot();
- }
-
- /** Refresh accountschart. */
- public void refreshTree() {
-
- modelSupport.fireNewRoot();
- }
-
- /**
- * Remove account.
- *
- * @param path
- * @throws LimaException
- */
- public void removeAccount(TreePath path) throws LimaException {
-
- // Calling account service
- AccountTreeTableNode node = getLastPathComponent(path);
- Account account = node.getUserObject();
- int index = getIndexOfChild(
- path.getParentPath().getLastPathComponent(), node);
- accountService.removeAccount(account);
- modelSupport.fireChildRemoved(path.getParentPath(), index, node);
- }
-
- public Account getAccount(TreePath path) {
- AccountTreeTableNode lastPathComponent = getLastPathComponent(path);
- Account account = lastPathComponent.getUserObject();
- return account;
- }
-
- public AccountTreeTableNode getLastPathComponent(TreePath path) {
- AccountTreeTableNode lastPathComponent = (AccountTreeTableNode) path.getLastPathComponent();
- return lastPathComponent;
- }
-}
Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountTreeTableRenderer.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountTreeTableRenderer.java (rev 0)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountTreeTableRenderer.java 2012-04-04 13:25:23 UTC (rev 3351)
@@ -0,0 +1,65 @@
+/*
+ * #%L
+ *
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Codelutin, Chatellier Eric
+ * %%
+ * 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>.
+ * #L%
+ */
+
+package org.chorem.lima.ui.account;
+
+import java.awt.Component;
+
+import javax.swing.JTree;
+
+import org.chorem.lima.entity.Account;
+import org.jdesktop.swingx.renderer.DefaultTreeRenderer;
+import org.jdesktop.swingx.treetable.MutableTreeTableNode;
+
+/**
+ * Account renderer in account tree.
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * By : $Author$
+ */
+public class AccountTreeTableRenderer extends DefaultTreeRenderer {
+
+ /** serialVersionUID. */
+ private static final long serialVersionUID = -3249368726501873583L;
+
+ @Override
+ public Component getTreeCellRendererComponent(JTree tree, Object value,
+ boolean selected, boolean expanded, boolean leaf, int row,
+ boolean hasFocus) {
+
+ MutableTreeTableNode node = (MutableTreeTableNode)value;
+ Account account = (Account)node.getUserObject();
+ Object localValue = value;
+ if (account != null) {
+ localValue = account.getAccountNumber();
+ }
+ return super.getTreeCellRendererComponent(tree, localValue, selected, expanded,
+ leaf, row, hasFocus);
+ }
+
+}
Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountTreeTableRenderer.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
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 2012-04-04 09:03:41 UTC (rev 3350)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountView.jaxx 2012-04-04 13:25:23 UTC (rev 3351)
@@ -5,7 +5,7 @@
$Id$
$HeadURL$
%%
- Copyright (C) 2008 - 2010 CodeLutin
+ Copyright (C) 2008 - 2012 CodeLutin, Chatellier Eric
%%
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as
@@ -34,20 +34,18 @@
<Boolean id="selectedRow" javaBean="false"/>
- <script>
- <![CDATA[
+ <script><![CDATA[
void $afterCompleteSetup() {
handler.init();
}
- ]]>
- </script>
+ ]]></script>
<row>
<cell fill="both" weightx="1" weighty="1" rows='5'>
<JScrollPane>
<JXTreeTable id="accountsTreeTable"
selectionMode="{ListSelectionModel.SINGLE_SELECTION}"
- treeTableModel="{new AccountTreeTableModel()}"
+ treeCellRenderer="{new AccountTreeTableRenderer()}"
highlighters="{HighlighterFactory.createSimpleStriping(new java.awt.Color(222,222,222))}"/>
<ListSelectionModel initializer='accountsTreeTable.getSelectionModel()'
onValueChanged="setSelectedRow(accountsTreeTable.getSelectedRow() != -1)"/>
@@ -61,7 +59,7 @@
<row>
<cell fill="horizontal">
<JButton id="addSubLedger" text="lima.charts.account.addSubLedger"
- onActionPerformed="handler.launchAddSubLedgerForm()"/>
+ onActionPerformed="/*handler.launchAddSubLedgerForm()*/"/>
</cell>
</row>
<row>
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 2012-04-04 09:03:41 UTC (rev 3350)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java 2012-04-04 13:25:23 UTC (rev 3351)
@@ -25,10 +25,28 @@
package org.chorem.lima.ui.account;
-import org.apache.commons.lang3.ObjectUtils;
+import static org.nuiton.i18n.I18n._;
+
+import java.awt.event.KeyAdapter;
+import java.awt.event.KeyEvent;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.SortedMap;
+import java.util.TreeMap;
+
+import javax.swing.JOptionPane;
+import javax.swing.tree.TreePath;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.LimaException;
+import org.chorem.lima.business.LimaRuntimeException;
import org.chorem.lima.business.ServiceListener;
import org.chorem.lima.business.ejbinterface.AccountService;
import org.chorem.lima.business.monitorable.AccountServiceMonitorable;
@@ -39,19 +57,12 @@
import org.chorem.lima.enums.ImportExportEnum;
import org.chorem.lima.service.LimaServiceFactory;
import org.chorem.lima.ui.importexport.ImportExport;
-import org.chorem.lima.util.DialogHelper;
import org.chorem.lima.util.ErrorHelper;
import org.jdesktop.swingx.JXTreeTable;
+import org.jdesktop.swingx.treetable.DefaultMutableTreeTableNode;
+import org.jdesktop.swingx.treetable.DefaultTreeTableModel;
+import org.jdesktop.swingx.treetable.TreeTableNode;
-import javax.swing.JOptionPane;
-import javax.swing.tree.TreePath;
-import java.awt.event.KeyAdapter;
-import java.awt.event.KeyEvent;
-import java.awt.event.MouseAdapter;
-import java.awt.event.MouseEvent;
-
-import static org.nuiton.i18n.I18n._;
-
/**
* Handler associated with account view.
*
@@ -66,20 +77,43 @@
/** log. */
private static final Log log = LogFactory.getLog(AccountViewHandler.class);
- protected final AccountView view;
-
protected AccountService accountService;
- protected AccountViewHandler(AccountView view) {
+ protected AccountView view;
+
+ /**
+ * Sort account with label length.
+ */
+ protected static Comparator<Account> accountLengthComparator = new Comparator<Account>() {
+ @Override
+ public int compare(Account o1, Account o2) {
+ int result = o1.getAccountNumber().length() - o2.getAccountNumber().length();
+ if (result == 0) {
+ result = -1;
+ }
+ return result;
+ }
+ };
+ protected static Comparator<String> reverseAccountLengthComparator = new Comparator<String>() {
+ @Override
+ public int compare(String o1, String o2) {
+ int result = o2.length() - o1.length();
+ if (result == 0) {
+ result = -1;
+ }
+ return result;
+ }
+ };
+
+ public AccountViewHandler(AccountView view) {
this.view = view;
// Gets factory service
LimaServiceFactory.addServiceListener(ImportServiceMonitorable.class, this);
- accountService =
- LimaServiceFactory.getService(AccountServiceMonitorable.class);
+ accountService = LimaServiceFactory.getService(AccountServiceMonitorable.class);
}
public void init() {
- JXTreeTable table = getTreeTable();
+ JXTreeTable table = view.getAccountsTreeTable();
table.addKeyListener(new KeyAdapter() {
/**
* for each action combination key are think
@@ -105,10 +139,52 @@
}
}
});
+
+ loadAllAccounts();
}
+ /**
+ * Load all accounts from service and display it into tree table.
+ */
+ protected void loadAllAccounts() {
+ try {
+ // default data load
+ List<Account> accounts = accountService.getAllAccounts();
+ Collections.sort(accounts, accountLengthComparator);
+
+ // render in tree node hierarchy for DefaultTreeTableModel
+ SortedMap<String, DefaultMutableTreeTableNode> nodeCache = new TreeMap<String, DefaultMutableTreeTableNode>(reverseAccountLengthComparator);
+ DefaultMutableTreeTableNode root = new DefaultMutableTreeTableNode(null);
+ for (Account account : accounts) {
+ // find parent
+ DefaultMutableTreeTableNode parentNode = root;
+ Iterator<Map.Entry<String, DefaultMutableTreeTableNode>> itNodes = nodeCache.entrySet().iterator();
+ while (itNodes.hasNext()) {
+ Map.Entry<String, DefaultMutableTreeTableNode> entry = itNodes.next();
+ String accountNumber = entry.getKey();
+ if (account.getAccountNumber().startsWith(accountNumber)) {
+ parentNode = entry.getValue();
+ break;
+ }
+ }
+
+ // make current node
+ DefaultMutableTreeTableNode node = new DefaultMutableTreeTableNode(account);
+ parentNode.add(node);
+
+ nodeCache.put(account.getAccountNumber(), node);
+ }
+ DefaultTreeTableModel model = new DefaultTreeTableModel(root);
+ model.setColumnIdentifiers(Arrays.asList(_("lima.table.number"),
+ _("lima.table.label")));
+ JXTreeTable table = view.getAccountsTreeTable();
+ table.setTreeTableModel(model);
+ } catch (LimaException ex) {
+ throw new LimaRuntimeException("Can't load accounts from service");
+ }
+ }
+
public void launchAddAccountForm() {
-
Account newAccount = new AccountImpl();
AccountForm accountForm = new AccountForm(view);
accountForm.setAccount(newAccount);
@@ -117,40 +193,18 @@
accountForm.setVisible(true);
}
- public void launchAddSubLedgerForm() {
-
- Account newAccount = new AccountImpl();
- SubLedgerForm subledgerForm = new SubLedgerForm(view);
- subledgerForm.setAccount(newAccount);
- // jaxx constructor don't call super() ?
- subledgerForm.setLocationRelativeTo(view);
- subledgerForm.setVisible(true);
- }
-
/**
* Open update account (or subledger) form with selected account
* from the tree.
*/
public void launchUpdateAccountForm() {
-
Account selectedObject = getSelectedAccount();
- if (selectedObject != null) {
-
- if (selectedObject.getGeneralLedger() == null) {
- UpdateAccountForm accountForm = new UpdateAccountForm(view);
- accountForm.setAccount(selectedObject);
- // jaxx constructor don't call super() ?
- accountForm.setLocationRelativeTo(view);
- accountForm.setVisible(true);
- } else {
- UpdateSubLedgerForm subLedgerForm = new UpdateSubLedgerForm(view);
- subLedgerForm.setAccount(selectedObject);
- // jaxx constructor don't call super() ?
- subLedgerForm.setLocationRelativeTo(view);
- subLedgerForm.setVisible(true);
- }
- }
+ UpdateAccountForm accountForm = new UpdateAccountForm(view);
+ accountForm.setAccount(selectedObject);
+ // jaxx constructor don't call super() ?
+ accountForm.setLocationRelativeTo(view);
+ accountForm.setVisible(true);
}
/**
@@ -177,20 +231,20 @@
}
// add it
- try {
+ /*try {
getTreeTableModel().addAccount(masterAccount, newAccount);
} catch (LimaException ex) {
if (log.isErrorEnabled()) {
log.error("Can't add account", ex);
}
ErrorHelper.showErrorDialog(view, _("lima.account.addaccounterror"), ex);
- }
+ }*/
} finally {
dialog.dispose();
}
}
- public void doAddSubLedger(SubLedgerForm dialog) {
+ /*public void doAddSubLedger(SubLedgerForm dialog) {
try {
Account newAccount = dialog.getAccount();
@@ -221,26 +275,26 @@
} finally {
dialog.dispose();
}
- }
+ }*/
public void doUpdateAccount(UpdateAccountForm dialog) {
Account account = dialog.getAccount();
- String newMasterAccountNumber =
+ /*String newMasterAccountNumber =
dialog.getMasterAccountTextField().getText();
String newLabel = dialog.getDescriptionTextField().getText();
boolean hasChanged =
updateMasterAccount(account, newMasterAccountNumber);
- hasChanged |= updateLabel(account, newLabel);
+ hasChanged |= updateLabel(account, newLabel);*/
try {
- if (hasChanged) {
+ //if (hasChanged) {
// can update account
updateAccount(account);
- }
+ //}
} finally {
@@ -253,7 +307,7 @@
Account account = dialog.getAccount();
- String newMasterAccountNumber =
+ /*String newMasterAccountNumber =
dialog.getMasterAccountTextField().getText();
String newLabel = dialog.getDescriptionTextField().getText();
String newThirdParty = dialog.getThirdPartyTextField().getText();
@@ -261,15 +315,12 @@
boolean hasChanged = updateMasterAccount(account,
newMasterAccountNumber);
hasChanged |= updateLabel(account, newLabel);
- hasChanged |= updateThirdParty(account, newThirdParty);
+ hasChanged |= updateThirdParty(account, newThirdParty);*/
try {
- if (hasChanged) {
+ // can update subLedger
+ updateAccount(account);
- // can update subLedger
- updateAccount(account);
- }
-
} finally {
// close dialog
@@ -281,7 +332,7 @@
public void doRemoveAccount() {
// maybe this code can be factorised
- JXTreeTable treeTable = getTreeTable();
+ JXTreeTable treeTable = view.getAccountsTreeTable();
// Any row selected
int selectedRow = treeTable.getSelectedRow();
@@ -296,14 +347,14 @@
TreePath treePath =
treeTable.getPathForRow(selectedRow);
- try {
+ /*try {
getTreeTableModel().removeAccount(treePath);
} catch (LimaException eee) {
if (log.isErrorEnabled()) {
log.error("Can't delete account", eee);
}
DialogHelper.showErrorMessageDialog(view, eee);
- }
+ }*/
}
}
}
@@ -345,14 +396,14 @@
methodeName.contains("importAsCSV")) {
// refresh model
- getTreeTableModel().refreshTree();
+ //getTreeTableModel().refreshTree();
//FIXME tchemit-2011-09-23 Should never do this... refresh view
view.repaint();
}
}
- protected boolean updateMasterAccount(Account account,
+ /*protected boolean updateMasterAccount(Account account,
String newMasterAccountNumber) {
boolean hasChanged = false;
String oldMasterAccountNumber = account.getMasterAccount() == null ?
@@ -405,29 +456,19 @@
}
return hasChanged;
- }
+ }*/
protected void updateAccount(Account selectedObject) {
- try {
+ /*try {
getTreeTableModel().updateAccount(selectedObject);
} catch (LimaException eee) {
if (log.isErrorEnabled()) {
log.error("Can't add update", eee);
}
DialogHelper.showErrorMessageDialog(view, eee);
- }
+ }*/
}
- protected JXTreeTable getTreeTable() {
- return view.getAccountsTreeTable();
- }
-
- protected AccountTreeTableModel getTreeTableModel() {
- AccountTreeTableModel model =
- (AccountTreeTableModel) getTreeTable().getTreeTableModel();
- return model;
- }
-
protected Account getMasterAccount(Account account) {
String number = account.getAccountNumber();
@@ -459,15 +500,14 @@
protected Account getSelectedAccount() {
- JXTreeTable table = getTreeTable();
+ JXTreeTable table = view.getAccountsTreeTable();
Account selectedObject = null;
int selectedRow = table.getSelectedRow();
if (selectedRow > -1) {
TreePath treePath = table.getPathForRow(selectedRow);
- AccountTreeTableModel.AccountTreeTableNode lastPathComponent =
- (AccountTreeTableModel.AccountTreeTableNode) treePath.getLastPathComponent();
- selectedObject = lastPathComponent.getUserObject();
+ TreeTableNode lastPathComponent = (TreeTableNode) treePath.getLastPathComponent();
+ selectedObject = (Account)lastPathComponent.getUserObject();
}
return selectedObject;
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/SubLedgerForm.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/SubLedgerForm.jaxx 2012-04-04 09:03:41 UTC (rev 3350)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/SubLedgerForm.jaxx 2012-04-04 13:25:23 UTC (rev 3351)
@@ -90,7 +90,7 @@
<JPanel layout='{new GridLayout(1,0)}'>
<JButton text="lima.common.cancel" onActionPerformed="dispose()"/>
<JButton id="ok" text="lima.common.ok"
- onActionPerformed="handler.doAddSubLedger(this)"/>
+ onActionPerformed="/*handler.doAddSubLedger(this)*/"/>
</JPanel>
</cell>
</row>
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/UpdateAccountForm.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/UpdateAccountForm.jaxx 2012-04-04 09:03:41 UTC (rev 3350)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/UpdateAccountForm.jaxx 2012-04-04 13:25:23 UTC (rev 3351)
@@ -64,7 +64,7 @@
<JTextField id="descriptionTextField" text="{getAccount().getLabel()}"/>
</cell>
</row>
- <row>
+ <!-- <row>
<cell fill="horizontal">
<JLabel text="lima.common.masteraccount"
labelFor='{masterAccountTextField}'/>
@@ -73,7 +73,7 @@
<JTextField id="masterAccountTextField"
text="{getAccount().getMasterAccount().getAccountNumber()}"/>
</cell>
- </row>
+ </row> -->
<row>
<cell columns="2">
<JPanel layout='{new GridLayout(1,0)}'>
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/UpdateSubLedgerForm.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/UpdateSubLedgerForm.jaxx 2012-04-04 09:03:41 UTC (rev 3350)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/UpdateSubLedgerForm.jaxx 2012-04-04 13:25:23 UTC (rev 3351)
@@ -73,7 +73,7 @@
<JTextField id="thirdPartyTextField" text="{getAccount().getThirdParty()}"/>
</cell>
</row>
- <row>
+ <!-- <row>
<cell fill="horizontal">
<JLabel text="lima.common.masteraccount"
labelFor='{masterAccountTextField}'/>
@@ -82,7 +82,7 @@
<JTextField id="masterAccountTextField"
text="{getAccount().getMasterAccount().getAccountNumber()}"/>
</cell>
- </row>
+ </row> -->
<row>
<cell columns="2">
<JPanel layout='{new GridLayout(1,0)}'>
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 2012-04-04 09:03:41 UTC (rev 3350)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/SubAccountComboBoxModel.java 2012-04-04 13:25:23 UTC (rev 3351)
@@ -86,7 +86,7 @@
public List<Account> getDataList() {
List<Account> result = new ArrayList<Account>();
try {
- result = accountService.getAllSubAccounts();
+ result = accountService.getAllLeafAccounts();
} catch (LimaException eee) {
if (log.isDebugEnabled()) {
log.debug("Can't get list subaccounts", eee);
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/AccountsPane.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/AccountsPane.java 2012-04-04 09:03:41 UTC (rev 3350)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/AccountsPane.java 2012-04-04 13:25:23 UTC (rev 3351)
@@ -98,11 +98,11 @@
try {
- List<Account> accounts = accountService.getAllAccounts();
- if (accounts.size() > 0) {
+ long accountCount = accountService.getAccountCount();
+ if (accountCount > 0) {
setBackground(greenBackground);
String accountsString = _("lima.home.chartaccounts.state1_2") + " "
- + accounts.size() + " " + _("lima.home.chartaccounts.state2_2")
+ + accountCount + " " + _("lima.home.chartaccounts.state2_2")
+ "<br/><br/><a href='#accountschart'>"
+ _("lima.home.chartaccounts.modify") + "</a>";
//set Text
1
0
r3350 - in trunk: lima-business/src/main/java/org/chorem/lima lima-swing/src/main/resources
by echatellier@users.chorem.org 04 Apr '12
by echatellier@users.chorem.org 04 Apr '12
04 Apr '12
Author: echatellier
Date: 2012-04-04 11:03:41 +0200 (Wed, 04 Apr 2012)
New Revision: 3350
Url: http://chorem.org/repositories/revision/lima/3350
Log:
Use openejb non deprecated classes.
Modified:
trunk/lima-business/src/main/java/org/chorem/lima/LimaServer.java
trunk/lima-swing/src/main/resources/lima-config.properties
Modified: trunk/lima-business/src/main/java/org/chorem/lima/LimaServer.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/LimaServer.java 2012-04-04 08:28:03 UTC (rev 3349)
+++ trunk/lima-business/src/main/java/org/chorem/lima/LimaServer.java 2012-04-04 09:03:41 UTC (rev 3350)
@@ -23,7 +23,7 @@
package org.chorem.lima;
-import org.apache.openejb.client.LocalInitialContextFactory;
+import org.apache.openejb.core.LocalInitialContextFactory;
import javax.naming.Context;
import javax.naming.InitialContext;
Modified: trunk/lima-swing/src/main/resources/lima-config.properties
===================================================================
--- trunk/lima-swing/src/main/resources/lima-config.properties 2012-04-04 08:28:03 UTC (rev 3349)
+++ trunk/lima-swing/src/main/resources/lima-config.properties 2012-04-04 09:03:41 UTC (rev 3350)
@@ -5,7 +5,7 @@
# $Id$
# $HeadURL$
# %%
-# Copyright (C) 2008 - 2010 CodeLutin
+# Copyright (C) 2008 - 2012 CodeLutin, Chatellier Eric
# %%
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as
@@ -46,7 +46,7 @@
# Embedded mode
#lima.openejb.remotemode=false
-java.naming.factory.initial=org.openejb.client.LocalInitialContextFactory
+java.naming.factory.initial=org.apache.openejb.core.LocalInitialContextFactory
#Lima Accounting Host
#lima.host.address=localhost
1
0
Author: echatellier
Date: 2012-04-04 10:28:03 +0200 (Wed, 04 Apr 2012)
New Revision: 3349
Url: http://chorem.org/repositories/revision/lima/3349
Log:
Update nuiton-utils / topia
Modified:
trunk/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2012-03-20 10:05:09 UTC (rev 3348)
+++ trunk/pom.xml 2012-04-04 08:28:03 UTC (rev 3349)
@@ -311,9 +311,9 @@
<projectId>lima</projectId>
<!-- customized libs version -->
- <nuitonUtilsVersion>2.4.5</nuitonUtilsVersion>
+ <nuitonUtilsVersion>2.4.7</nuitonUtilsVersion>
<eugenePluginVersion>2.4.2</eugenePluginVersion>
- <topiaVersion>2.6.8</topiaVersion>
+ <topiaVersion>2.6.9</topiaVersion>
<jaxxVersion>2.5-SNAPSHOT</jaxxVersion>
<nuitonI18nVersion>2.4.1</nuitonI18nVersion>
<openEjbVersion>4.0.0-beta-2</openEjbVersion>
1
0