r2995 - in trunk: lima-business/src/main/java/org/chorem/lima/business lima-business/src/main/java/org/chorem/lima/business/ejb lima-business/src/main/java/org/chorem/lima/business/ejbinterface lima-business/src/main/java/org/chorem/lima/business/utils lima-business/src/main/resources lima-business/src/main/resources/i18n lima-business/src/main/resources/images lima-swing lima-swing/src/main/java/org/chorem/lima lima-swing/src/main/java/org/chorem/lima/service lima-swing/src/main/java/org/cho
Author: jpepin Date: 2010-08-04 19:59:27 +0200 (Wed, 04 Aug 2010) New Revision: 2995 Url: http://chorem.org/repositories/revision/lima/2995 Log: Ajout servelet pour acc?\195?\168der aux documents html. Added: trunk/lima-business/src/main/java/org/chorem/lima/business/HttpServerServiceMonitorable.java trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/HttpServerServiceImpl.java trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/HttpServerService.java trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/HttpServerServiceLocal.java trunk/lima-business/src/main/java/org/chorem/lima/business/utils/DocumentsEnum.java trunk/lima-business/src/main/resources/images/ trunk/lima-business/src/main/resources/images/accounts.png trunk/lima-business/src/main/resources/images/entries.png trunk/lima-business/src/main/resources/images/entrybooks.png trunk/lima-business/src/main/resources/images/fiscalperiods.png trunk/lima-business/src/main/resources/images/identity.png trunk/lima-business/src/main/resources/images/logo-codelutin.png trunk/lima-business/src/main/resources/images/splash.png Removed: trunk/lima-swing/:limadb.lock.db trunk/lima-swing/limadb.h2.db trunk/lima-swing/limadb.lock.db trunk/lima-swing/src/main/java/org/chorem/lima/ui/document/ Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/LimaConfig.java trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/DocumentServiceImpl.java trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/IdentityService.java trunk/lima-business/src/main/resources/i18n/lima-business-en_GB.properties trunk/lima-business/src/main/resources/i18n/lima-business-fr_FR.properties trunk/lima-business/src/main/resources/lima.properties trunk/lima-swing/src/main/java/org/chorem/lima/LimaConfig.java trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java trunk/lima-swing/src/main/java/org/chorem/lima/service/ServiceMonitorableHandler.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainView.jaxx trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java trunk/lima-swing/src/main/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/lima-config.properties Added: trunk/lima-business/src/main/java/org/chorem/lima/business/HttpServerServiceMonitorable.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/HttpServerServiceMonitorable.java (rev 0) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/HttpServerServiceMonitorable.java 2010-08-04 17:59:27 UTC (rev 2995) @@ -0,0 +1,26 @@ +/* *##% Lima Business + * Copyright (C) 2008 - 2010 CodeLutin + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * ##%* + */ + +package org.chorem.lima.business; + +import org.chorem.lima.business.ejbinterface.HttpServerService; + +public interface HttpServerServiceMonitorable extends HttpServerService, ServiceMonitorable { + +} Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/LimaConfig.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/LimaConfig.java 2010-08-03 17:23:31 UTC (rev 2994) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/LimaConfig.java 2010-08-04 17:59:27 UTC (rev 2995) @@ -99,6 +99,10 @@ return getOption(Option.REPORTS_DIR.getKey()); } + public String getAddressServer(){ + return getOption(Option.SERVER_ADRESS.getKey()); + } + public int getHttpPort(){ return Integer.valueOf(getOption(Option.HTTP_PORT.getKey())); } @@ -128,8 +132,9 @@ CONFIG_FILE(CONFIG_FILE_NAME, _("lima.config.configFileName.description"), "lima-config.properties", String.class, true, true), RULES_NATIONALTY("lima.rules", _("lima.config.rulesnationality"), "default", String.class, false, false), - REPORTS_DIR("lima.report.dir", _("lima.config.reports-dir"), "", String.class, false, false), - HTTP_PORT("lima.httpport", _("lima.config.http-port"), "5462", String.class, false, false); + REPORTS_DIR("lima.report.dir", _("lima.config.reportsdir"), "", String.class, false, false), + HTTP_PORT("lima.httpport", _("lima.config.httpport"), "5462", String.class, false, false), + SERVER_ADRESS("lima.serveraddress", _("lima.config.serveraddress"), "", String.class, false, false); public final String key; public final String description; Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/DocumentServiceImpl.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/DocumentServiceImpl.java 2010-08-03 17:23:31 UTC (rev 2994) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/DocumentServiceImpl.java 2010-08-04 17:59:27 UTC (rev 2995) @@ -88,9 +88,7 @@ LogFactory.getLog(DocumentServiceImpl.class); private TopiaContext rootContext; - - protected Server server; - + //Services @EJB IdentityService identityService; @@ -140,30 +138,9 @@ } } path = LimaConfig.getInstance().getReportsDir(); - start(); } - /** start the server */ - public void start() { - if (server == null) { - int port = LimaConfig.getInstance().getHttpPort(); - new File(path).mkdir(); - try { - server = new Server(port); - ResourceHandler resourceHandler = new ResourceHandler(); - resourceHandler.setResourceBase(path); - server.setHandler(resourceHandler); - server.start(); - log.info("Web server are running on port: "+port); - - } catch (Exception eee) { - log.error("error while booting http server", eee); - } - } - } - - public Paragraph createHeaderPage(String title, Identity identity, String beginDate, String endDate){ Paragraph paragraphHeaderPage = new Paragraph(); Table t = null; @@ -240,6 +217,7 @@ + hourS, normalFont)); infos.addCell(new Phrase(_("lima-business.document.pagenumber") + nbPages, normalFont)); + paragraphPage.add(infos); return paragraphPage; } Added: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/HttpServerServiceImpl.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/HttpServerServiceImpl.java (rev 0) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/HttpServerServiceImpl.java 2010-08-04 17:59:27 UTC (rev 2995) @@ -0,0 +1,265 @@ +/* *##% Lima Business + * Copyright (C) 2008 - 2010 CodeLutin + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * ##%* + */ + + +package org.chorem.lima.business.ejb; + +import static org.nuiton.i18n.I18n._; + +import java.awt.Image; +import java.awt.image.BufferedImage; +import java.io.BufferedInputStream; +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.net.URL; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; +import javax.ejb.EJB; +import javax.ejb.Stateless; +import javax.imageio.ImageIO; +import javax.servlet.Servlet; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.commons.io.IOUtils; +import org.apache.commons.lang.time.DateUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.chorem.lima.business.LimaConfig; +import org.chorem.lima.business.LimaException; +import org.chorem.lima.business.ejbinterface.DocumentService; +import org.chorem.lima.business.ejbinterface.HttpServerService; +import org.chorem.lima.business.ejbinterface.HttpServerServiceLocal; +import org.chorem.lima.business.utils.DocumentsEnum; +import org.mortbay.jetty.Server; +import org.mortbay.jetty.AbstractGenerator.Output; +import org.mortbay.jetty.servlet.Context; +import org.mortbay.jetty.servlet.ServletHolder; +import org.nuiton.topia.TopiaContext; +import org.nuiton.topia.TopiaContextFactory; +import org.nuiton.topia.TopiaNotFoundException; +import org.nuiton.util.Resource; + + +@Stateless +public class HttpServerServiceImpl extends AbstractLimaService implements HttpServerService, HttpServerServiceLocal { + + private static final Log log = + LogFactory.getLog(HttpServerServiceImpl.class); + + private TopiaContext rootContext; + + @EJB + DocumentService documentService; + + protected Server server; + + protected String path; + + private static SimpleDateFormat dateFormat = + new SimpleDateFormat("yyyy-MM-dd"); + + public HttpServerServiceImpl() { + LimaConfig config = LimaConfig.getInstance(); + try { + rootContext = TopiaContextFactory.getContext(config.getOptions()); + } catch (TopiaNotFoundException ex) { + if (log.isErrorEnabled()) { + log.error("Can't init topia context", ex); + } + } + path = LimaConfig.getInstance().getReportsDir(); + + } + + + + /** start the server */ + public void start() { + if (server == null) { + int port = LimaConfig.getInstance().getHttpPort(); + new File(path).mkdir(); + String imagesPath = getClass().getResource("/images").toExternalForm(); + try { + server = new Server(port); + + Context root = new Context(server, "/", Context.NO_SESSIONS); + root.addServlet(new ServletHolder((Servlet) new MainServlet()), "/"); + + server.start(); + log.info("Web server are running on port: "+port); + + } catch (Exception eee) { + log.error("error while booting http server", eee); + } + } + } + + + /** this servlet send a static html page */ + public class MainServlet extends HttpServlet { + private static final long serialVersionUID = 1L; + String serverAddressConfig = LimaConfig.getInstance().getAddressServer(); + + @Override + protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { + String imageParam = req.getParameter("img"); + log.info(imageParam); + if (imageParam != null){ + URL image = Resource.getURLOrNull("images/"+imageParam); + log.info("image :"+image); + if (image != null){ + resp.setContentType("image/png"); + InputStream in = image.openStream(); + OutputStream out = resp.getOutputStream(); + IOUtils.copy(in, out); + } + } + else { + resp.setContentType("text/html"); + String pageContent = ""; + String serverAdress = "http://"; + + log.info("Page load"); + + /** create server Address : static config if exist or dynamical adress */ + if (serverAddressConfig.equals("")){ + serverAdress += req.getServerName() + ":" + req.getServerPort(); + } + else { + serverAdress += serverAddressConfig + ":" + + LimaConfig.getInstance().getHttpPort(); + } + + String link = req.getParameter("link"); + String beginDate = req.getParameter("beginDate"); + String endDate = req.getParameter("endDate"); + + if (link != null && beginDate != null && endDate != null){ + try { + Date beginDateFormat = dateFormat.parse(beginDate); + Date endDateFormat = dateFormat.parse(endDate); + + switch (DocumentsEnum.valueOfLink(link)) { + case BALANCE: + documentService.createBalanceDocuments(beginDateFormat, endDateFormat); + break; + case ENTRYBOOKS: + documentService.createEntryBooksDocuments(beginDateFormat, endDateFormat); + break; + case FINANCIALSTATEMENT: + documentService.createFinancialStatementsDocuments(beginDateFormat, endDateFormat); + break; + case GENERAL_ENTRYBOOK: + documentService.createGeneralEntryBooksDocuments(beginDateFormat, endDateFormat); + break; + case LEDGER: + documentService.createLedgerDocuments(beginDateFormat, endDateFormat); + break; + } + } catch (LimaException eeeLE) { + log.error("Can't call document service for create html document", eeeLE); + } catch (ParseException eeePE) { + log.error("Can't parse date", eeePE); + } + pageContent = extractFile(path+File.separatorChar+link); + } + else { + + Calendar calendar = Calendar.getInstance(); + Date endDatePicker = calendar.getTime(); + Date beginDatePicker = calendar.getTime(); + beginDatePicker = DateUtils.truncate(beginDatePicker, Calendar.YEAR); + + pageContent = "<!DOCTYPE html>\n" + + "<html lang=\"fr\">\n" + + "<head>\n" + + "<title>LIMA Documents Report</title>\n" + + "<style type=\"text/css\">" + + "body { font: 14px sans-serif; }" + + "h1 { font: 20px sans-serif; text-align: center; }" + + "table.paddingleft td {padding-left:100px;}" + + ".tdright {text-align: right;}" + + "</style>" + + "</head>\n" + + "<body>\n" + + "<table class=\"paddingleft\">\n" + + "<tr><td colspan=2><h1>LIMA Documents Report</h1></td></tr>\n" + + "<tr><td><img src=\"?img=identity.png\"/></td>\n" + + "<td rowspan=3><form method=GET action=" + serverAdress + ">\n" + + _("lima-business.document.date.begin") + "<input value=\""+dateFormat.format(beginDatePicker) + + "\" type=\"date\" name=\"beginDate\">\n" + + _("lima-business.document.date.end") + "<input value=\""+dateFormat.format(endDatePicker) + + "\" type=\"date\" name=\"endDate\">\n<br/><br/>" + + "Documents : <select name=\"link\">"; + + for (DocumentsEnum documentsEnum : DocumentsEnum.values()) { + pageContent += "<option value=\""+documentsEnum.getLink()+"\">" + + documentsEnum.getDescription()+"</OPTION>\n"; + } + + pageContent += "<tr><td><img src=\"?img=entries.png\"/></td></tr>\n" + + "<tr><td><img src=\"?img=accounts.png\"/></td></tr>\n" + + "<tr><td><img src=\"?img=entrybooks.png\"/></td>\n" + + "</select>\n<br/><br/>" + + "<td class=\"tdright\"><input type=\"submit\"></td></tr>" + + "</form>\n" + + "<tr><td><img src=\"?img=fiscalperiods.png\"/></td></tr>\n" + + "</table>\n" + + "</body>\n" + + "</html>"; + } + + resp.getWriter().write(pageContent); + + } + } + @Override + protected void doPost(HttpServletRequest req, HttpServletResponse resp) + throws ServletException, IOException { + doGet(req, resp); + + } + } + + public String extractFile(String filePath){ + char[] datas = new char[(int) new File(filePath).length()]; + try { + BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(filePath))); + in.read(datas); + in.close(); + } + catch (IOException eee) { + if (log.isDebugEnabled()){ + log.debug("Can't read file "+filePath, eee); + } + } + return new String(datas); + } + +} Added: trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/HttpServerService.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/HttpServerService.java (rev 0) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/HttpServerService.java 2010-08-04 17:59:27 UTC (rev 2995) @@ -0,0 +1,30 @@ +/* *##% Lima Business + * Copyright (C) 2008 - 2010 CodeLutin + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * ##%* + */ + + +package org.chorem.lima.business.ejbinterface; + +import javax.ejb.Remote; + +@Remote +public interface HttpServerService { + + public void start(); + +} Added: trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/HttpServerServiceLocal.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/HttpServerServiceLocal.java (rev 0) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/HttpServerServiceLocal.java 2010-08-04 17:59:27 UTC (rev 2995) @@ -0,0 +1,28 @@ +/* *##% Lima Business + * Copyright (C) 2008 - 2010 CodeLutin + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * ##%* + */ + + +package org.chorem.lima.business.ejbinterface; + +import javax.ejb.Local; + +@Local +public interface HttpServerServiceLocal { + +} Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/IdentityService.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/IdentityService.java 2010-08-03 17:23:31 UTC (rev 2994) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/IdentityService.java 2010-08-04 17:59:27 UTC (rev 2995) @@ -23,7 +23,6 @@ import org.chorem.lima.business.LimaException; import org.chorem.lima.entity.Identity; -import org.nuiton.topia.TopiaContext; @Remote public interface IdentityService { Added: trunk/lima-business/src/main/java/org/chorem/lima/business/utils/DocumentsEnum.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/utils/DocumentsEnum.java (rev 0) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/utils/DocumentsEnum.java 2010-08-04 17:59:27 UTC (rev 2995) @@ -0,0 +1,43 @@ +package org.chorem.lima.business.utils; + +import static org.nuiton.i18n.I18n._; + + +public enum DocumentsEnum { + + ENTRYBOOKS(_("lima-business.document.entrybook"),"lima_entrybooks.html"), + GENERAL_ENTRYBOOK(_("lima-business.document.generalentrybook"),"lima_general_entybook.html"), + FINANCIALSTATEMENT(_("lima-business.document.financialstatement"),"lima_financialstatements.html"), + BALANCE(_("lima-business.document.balance"),"lima_balance.html"), + LEDGER(_("lima-business.document.ledger"),"lima_ledger.html"); + + private final String link; + + private final String description; + + private DocumentsEnum(String description, String link) { + this.description = description; + this.link = link; + } + + public String getLink() { + return this.link; + } + + public String getDescription() { + return this.description; + } + + public static DocumentsEnum valueOfLink(String label){ + DocumentsEnum value = null; + + for (DocumentsEnum documentsEnum : DocumentsEnum.values()) { + if (label.equals(documentsEnum.link)){ + value = documentsEnum; + break; + } + } + return value; + } + +} Modified: trunk/lima-business/src/main/resources/i18n/lima-business-en_GB.properties =================================================================== --- trunk/lima-business/src/main/resources/i18n/lima-business-en_GB.properties 2010-08-03 17:23:31 UTC (rev 2994) +++ trunk/lima-business/src/main/resources/i18n/lima-business-en_GB.properties 2010-08-04 17:59:27 UTC (rev 2995) @@ -1,6 +1,7 @@ An\ EntryBook\ already\ exists\ with\ this\ label\ \:\ %s= An\ account\ already\ exists\ with\ this\ number\ \:\ %s= An\ financialStatement\ already\ exists\ with\ this\ label\ \:\ %s= +business.document.financialstatement= lima-business.config.configFileName.description= lima-business.config.rulesnationality= lima-business.document.accountnubmer= @@ -17,9 +18,12 @@ lima-business.document.createdate2= lima-business.document.credit=Credit lima-business.document.date=Date +lima-business.document.date.begin= +lima-business.document.date.end= lima-business.document.debit=Debit lima-business.document.description=Description lima-business.document.entrybook=EntryBook +lima-business.document.financialstatement= lima-business.document.generalentrybook= lima-business.document.grossamount=Gross Amount lima-business.document.label=Label @@ -39,8 +43,11 @@ lima.business.document.date=Date lima.config.configFileName.description= lima.config.http-port= +lima.config.httpport= lima.config.reports-dir= +lima.config.reportsdir= lima.config.rulesnationality= +lima.config.serveraddress= lima.table.grossamount= lima.table.label=Test lima.table.netamount= Modified: trunk/lima-business/src/main/resources/i18n/lima-business-fr_FR.properties =================================================================== --- trunk/lima-business/src/main/resources/i18n/lima-business-fr_FR.properties 2010-08-03 17:23:31 UTC (rev 2994) +++ trunk/lima-business/src/main/resources/i18n/lima-business-fr_FR.properties 2010-08-04 17:59:27 UTC (rev 2995) @@ -1,9 +1,11 @@ An\ EntryBook\ already\ exists\ with\ this\ label\ \:\ %s= An\ account\ already\ exists\ with\ this\ number\ \:\ %s= An\ financialStatement\ already\ exists\ with\ this\ label\ \:\ %s= +business.document.financialstatement= lima-business.document.accountnumber=N\u00B0 Compte lima-business.document.amounts=Totaux lima-business.document.balance=Balance +lima-business.document.beginDate=Date de d\u00E9but \: lima-business.document.businessnumber=N\u00B0 Siret lima-business.document.carryback=Report lima-business.document.carryforward=\u00C0 reporter @@ -12,9 +14,13 @@ lima-business.document.createdate2=\u00E0 lima-business.document.credit=Cr\u00E9dit lima-business.document.date=Date +lima-business.document.date.begin=Date de d\u00E9but \: +lima-business.document.date.end=Date de fin \: lima-business.document.debit=D\u00E9bit lima-business.document.description=Description +lima-business.document.endDate=Date de fin \: lima-business.document.entrybook=Journal +lima-business.document.financialstatement=Bilan et compte de r\u00E9sultat lima-business.document.generalentrybook=Journal G\u00E9n\u00E9ral lima-business.document.grossamount=Brut lima-business.document.label=Libell\u00E9 @@ -33,5 +39,8 @@ lima-business.document.voucher=Pi\u00E8ce comptable lima.config.configFileName.description= lima.config.http-port= +lima.config.httpport= lima.config.reports-dir= +lima.config.reportsdir= lima.config.rulesnationality= +lima.config.serveraddress= Added: trunk/lima-business/src/main/resources/images/accounts.png =================================================================== (Binary files differ) Property changes on: trunk/lima-business/src/main/resources/images/accounts.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/lima-business/src/main/resources/images/entries.png =================================================================== (Binary files differ) Property changes on: trunk/lima-business/src/main/resources/images/entries.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/lima-business/src/main/resources/images/entrybooks.png =================================================================== (Binary files differ) Property changes on: trunk/lima-business/src/main/resources/images/entrybooks.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/lima-business/src/main/resources/images/fiscalperiods.png =================================================================== (Binary files differ) Property changes on: trunk/lima-business/src/main/resources/images/fiscalperiods.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/lima-business/src/main/resources/images/identity.png =================================================================== (Binary files differ) Property changes on: trunk/lima-business/src/main/resources/images/identity.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/lima-business/src/main/resources/images/logo-codelutin.png =================================================================== (Binary files differ) Property changes on: trunk/lima-business/src/main/resources/images/logo-codelutin.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/lima-business/src/main/resources/images/splash.png =================================================================== (Binary files differ) Property changes on: trunk/lima-business/src/main/resources/images/splash.png ___________________________________________________________________ Added: svn:executable + * Added: svn:mime-type + application/octet-stream Modified: trunk/lima-business/src/main/resources/lima.properties =================================================================== --- trunk/lima-business/src/main/resources/lima.properties 2010-08-03 17:23:31 UTC (rev 2994) +++ trunk/lima-business/src/main/resources/lima.properties 2010-08-04 17:59:27 UTC (rev 2995) @@ -3,6 +3,8 @@ lima.dir=${user.home}/.lima/ # http port for reports lima.httpport=5462 +# server address (optional for server behind proxy) +lima.serveraddress= # Local class for accounting rules lima.rules=org.chorem.lima.business.accountingrules.FranceAccountingRules # directory for http server Deleted: trunk/lima-swing/:limadb.lock.db =================================================================== --- trunk/lima-swing/:limadb.lock.db 2010-08-03 17:23:31 UTC (rev 2994) +++ trunk/lima-swing/:limadb.lock.db 2010-08-04 17:59:27 UTC (rev 2995) @@ -1,4 +0,0 @@ -#FileLock -#Tue Aug 03 19:12:33 CEST 2010 -id=12a38f0b67cbf55cf1fb51d173d8db55399628ae048 -method=file Deleted: trunk/lima-swing/limadb.h2.db =================================================================== (Binary files differ) Deleted: trunk/lima-swing/limadb.lock.db =================================================================== --- trunk/lima-swing/limadb.lock.db 2010-08-03 17:23:31 UTC (rev 2994) +++ trunk/lima-swing/limadb.lock.db 2010-08-04 17:59:27 UTC (rev 2995) @@ -1,4 +0,0 @@ -#FileLock -#Tue Aug 03 19:13:22 CEST 2010 -id=12a38f1750004a9a1ddce8ec18615a18acf9c511c71 -method=file Modified: trunk/lima-swing/src/main/java/org/chorem/lima/LimaConfig.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/LimaConfig.java 2010-08-03 17:23:31 UTC (rev 2994) +++ trunk/lima-swing/src/main/java/org/chorem/lima/LimaConfig.java 2010-08-04 17:59:27 UTC (rev 2995) @@ -202,7 +202,12 @@ boolean result = getOptionAsBoolean(Option.OPENEJB_REMOTEMODE.key); return result; } + + public String getHostAdress() { + return getOption(Option.LIMA_HOST_ADDRESS.key); + } + /** * Used in ???? */ @@ -243,8 +248,9 @@ FULL_SCREEN("lima.ui.fullscreen", _("lima.config.ui.fullscreen.description"), "false", Boolean.class, false, false), LAUNCH_UI("lima.ui.launchui", _("lima.config.ui.flaunchui.description"), "true", Boolean.class, true, true), SUPPORT_EMAIL("lima.misc.supportemail", _("lima.misc.supportemail.description"), "", String.class, false, false), - OPENEJB_REMOTEMODE("lima.openejb.remotemode", _("lima.openejb.remotemode.description"), "false", String.class, false, false); - + OPENEJB_REMOTEMODE("lima.openejb.remotemode", _("lima.openejb.remotemode.description"), "false", String.class, false, false), + LIMA_HOST_ADDRESS("lima.host.address", _("lima.config.host.adress"), "", String.class, false, false); + public final String key; public final String description; public String defaultValue; Modified: trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java 2010-08-03 17:23:31 UTC (rev 2994) +++ trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java 2010-08-04 17:59:27 UTC (rev 2995) @@ -31,7 +31,9 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.lima.business.AccountServiceMonitorable; +import org.chorem.lima.business.HttpServerServiceMonitorable; import org.chorem.lima.business.ejbinterface.AccountService; +import org.chorem.lima.business.ejbinterface.HttpServerService; import org.chorem.lima.entity.Account; import org.chorem.lima.service.LimaServiceFactory; import org.chorem.lima.ui.MainView; @@ -172,6 +174,9 @@ // load accounts and test if there is an account plan defined // if not, call #loadDefaultAccount() splash.updateProgression(0.5, _("Loading accounting...")); + + //start servlet + LimaServiceFactory.getInstance().getService(HttpServerServiceMonitorable.class).start(); AccountService accountService = LimaServiceFactory.getInstance().getService( Modified: trunk/lima-swing/src/main/java/org/chorem/lima/service/ServiceMonitorableHandler.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/service/ServiceMonitorableHandler.java 2010-08-03 17:23:31 UTC (rev 2994) +++ trunk/lima-swing/src/main/java/org/chorem/lima/service/ServiceMonitorableHandler.java 2010-08-04 17:59:27 UTC (rev 2995) @@ -19,6 +19,7 @@ package org.chorem.lima.service; import java.lang.reflect.InvocationHandler; +import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.List; @@ -58,7 +59,11 @@ removeServiceListener((ServiceListener) args[0]); } else { + try { result = method.invoke(service, args); + }catch (InvocationTargetException eee){ + throw eee.getCause(); + } if (!method.getName().startsWith("get")){ for (ServiceListener serviceListener : listeners) { serviceListener.notifyMethod(service.toString(), method.getName()); Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainView.jaxx =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainView.jaxx 2010-08-03 17:23:31 UTC (rev 2994) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainView.jaxx 2010-08-04 17:59:27 UTC (rev 2995) @@ -21,25 +21,43 @@ resizable="true" width="800" height="600" extendedState='{this.MAXIMIZED_BOTH}'> - +<java.awt.Desktop id='desktop' javaBean='java.awt.Desktop.getDesktop()'/> <script><![CDATA[ -import java.util.Locale; -import org.chorem.lima.LimaConfig; -import org.chorem.lima.enums.ImportExportEnum; + import java.util.Locale; + import org.chorem.lima.LimaConfig; + import org.chorem.lima.enums.ImportExportEnum; + import java.net.URISyntaxException; + import java.net.URI; -public LimaConfig getConfig() { - return getContextValue(LimaConfig.class); -} + public LimaConfig getConfig() { + return getContextValue(LimaConfig.class); + } -public MainViewHandler getHandler() { - return getContextValue(MainViewHandler.class); -} + public MainViewHandler getHandler() { + return getContextValue(MainViewHandler.class); + } -public boolean acceptLocale(Locale l, String expected) { - return l != null && l.toString().equals(expected); -} + public boolean acceptLocale(Locale l, String expected) { + return l != null && l.toString().equals(expected); + } + URI uri = null; + try { + uri = new URI("http://localhost:5462/"); + } catch (URISyntaxException e) { + e.printStackTrace(); + } + + public void loadURI(){ + try { + desktop.browse(uri); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + /** * Show a new closable tab. * @@ -107,6 +125,9 @@ <JMenuItem text="lima.importexport.entries" onActionPerformed='getHandler().showImportExportView(this, ImportExportEnum.EBP_ENTRIES_EXPORT)'/> </JMenu> </JMenu> + <JSeparator/> + <JMenuItem text="lima.documents.html" + onActionPerformed="loadURI()"/> <JSeparator/> <JMenuItem text="lima.identity" actionIcon="identity" onActionPerformed="getHandler().showIdentity(this)"/> Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java 2010-08-03 17:23:31 UTC (rev 2994) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java 2010-08-04 17:59:27 UTC (rev 2995) @@ -77,7 +77,6 @@ * @return l'ui instancie et initialisee mais non visible encore */ public MainView initUI(LimaContext rootContext, boolean fullscreen) { - // show main ui MainView ui = new MainView(rootContext); Modified: trunk/lima-swing/src/main/resources/i18n/lima-swing-en_GB.properties =================================================================== --- trunk/lima-swing/src/main/resources/i18n/lima-swing-en_GB.properties 2010-08-03 17:23:31 UTC (rev 2994) +++ trunk/lima-swing/src/main/resources/i18n/lima-swing-en_GB.properties 2010-08-04 17:59:27 UTC (rev 2995) @@ -60,6 +60,7 @@ lima.config.category.other= lima.config.category.other.description= lima.config.configFileName.description= +lima.config.host.adress= lima.config.locale.description= lima.config.ui.flaunchui.description= lima.config.ui.fullscreen.description= @@ -70,6 +71,7 @@ lima.debit=Debit lima.description=Description lima.dialogreport= +lima.documents.html= lima.entries=Entries lima.entries.addtransaction= lima.entries.lettering= @@ -164,6 +166,7 @@ lima.opening.accounts= lima.opening.entrybook= lima.opening.welcome= +lima.pdf= lima.period.begindate= lima.period.create= lima.period.enddate= Modified: trunk/lima-swing/src/main/resources/i18n/lima-swing-fr_FR.properties =================================================================== --- trunk/lima-swing/src/main/resources/i18n/lima-swing-fr_FR.properties 2010-08-03 17:23:31 UTC (rev 2994) +++ trunk/lima-swing/src/main/resources/i18n/lima-swing-fr_FR.properties 2010-08-04 17:59:27 UTC (rev 2995) @@ -56,6 +56,7 @@ lima.config.category.other=Autre lima.config.category.other.description=Autre propri\u00E9t\u00E9s de configuration lima.config.configFileName.description= +lima.config.host.adress= lima.config.locale.description=Locale utilis\u00E9e par l'application lima.config.ui.flaunchui.description= lima.config.ui.fullscreen.description= @@ -66,6 +67,7 @@ lima.debit=Debit lima.description=Description lima.dialogreport= +lima.documents.html= lima.entries=Traitement lima.entries.addtransaction=Saisir des \u00E9critures lima.entries.lettering=Ajouter une lettre @@ -155,6 +157,7 @@ lima.opening.accounts=<html><center>Aucun plan comptable charg\u00E9<br/>Veuillez s\u00E9lectionner un plan par d\u00E9fault, <br/>importer un plan personnalis\u00E9<br/> ou annuler pour cr\u00E9er votre propre plan.</center></html> lima.opening.entrybook=<html>Cochez la case pour importer les journaux par d\u00E9faut \:<br/> Achats, Ventes, Tr\u00E9sorerie, Op\u00E9ration diverses</html> lima.opening.welcome=<html><center>Bienvenue dans Lima<br/>Laissez vous guider par cet assistant pour d\u00E9marrer votre comptabilit\u00E9 en quelques instants\u0085</center></html> +lima.pdf= lima.period.begindate=D\u00E9but lima.period.create=Choisissez la date de d\u00E9but et de fin du nouvel exercice lima.period.enddate=Fin Modified: trunk/lima-swing/src/main/resources/lima-config.properties =================================================================== --- trunk/lima-swing/src/main/resources/lima-config.properties 2010-08-03 17:23:31 UTC (rev 2994) +++ trunk/lima-swing/src/main/resources/lima-config.properties 2010-08-04 17:59:27 UTC (rev 2995) @@ -18,6 +18,9 @@ lima.openejb.remotemode=false java.naming.factory.initial=org.openejb.client.LocalInitialContextFactory +#Lima Accounting Host address +lima.host.address=localhost + # Remote mode #lima.openejb.remotemode=true #java.naming.factory.initial=org.apache.openejb.client.RemoteInitialContextFactory
participants (1)
-
jpepin@users.chorem.org