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
September 2011
- 2 participants
- 20 discussions
Author: tchemit
Date: 2011-09-20 19:49:06 +0200 (Tue, 20 Sep 2011)
New Revision: 3296
Url: http://chorem.org/repositories/revision/lima/3296
Log:
add svn properties
Evolution #445: [Plan comptable] Cr?\195?\169ation des num?\195?\169ros de compte interm?\195?\169diaires lors d'un import
Added:
trunk/lima-business/src/main/java/org/chorem/lima/business/migration/MigrationV0_5_2.java
Modified:
trunk/lima-business/src/main/java/org/chorem/lima/business/migration/DatabaseMigrationClass.java
trunk/lima-business/src/main/java/org/chorem/lima/business/migration/MigrationV0V0_5.java
trunk/lima-business/src/main/java/org/chorem/lima/business/utils/FinancialPeriodComparator.java
trunk/lima-callao/src/main/xmi/accounting.properties
trunk/lima-swing/src/main/java/org/chorem/lima/ui/LimaDecoratorProvider.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/LimaModelUtil.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/LimaRendererUtil.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountTreeTable.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsTable.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceTable.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellEditor.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellRenderer.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/EmptyCellRenderer.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookTable.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartTreeTable.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/RetainedEarningsEntryBookForm.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringPeriodSearchPanel.java
trunk/lima-swing/src/main/java/org/chorem/lima/widgets/ScrollBasicComboPopup.java
trunk/lima-swing/src/main/java/org/chorem/lima/widgets/ScrollMetalComboUI.java
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/migration/DatabaseMigrationClass.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/migration/DatabaseMigrationClass.java 2011-09-20 14:51:40 UTC (rev 3295)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/migration/DatabaseMigrationClass.java 2011-09-20 17:49:06 UTC (rev 3296)
@@ -1,72 +1,74 @@
-/*
- * #%L
- * Lima :: business
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2011 CodeLutin, Victor Salaun
- * %%
- * 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.migration;
-
-import org.chorem.lima.entity.LimaCallaoDAOHelper;
-import org.nuiton.topia.migration.TopiaMigrationCallbackByClass;
-import org.nuiton.util.Version;
-
-import java.util.List;
-
-public class DatabaseMigrationClass extends TopiaMigrationCallbackByClass {
-
- protected static final Version VERSION_0_5 = new Version("0.5");
-
-
- public DatabaseMigrationClass() {
- super(new MigrationResolver());
- }
-
- protected static class MigrationResolver implements MigrationCallBackForVersionResolver {
-
- @Override
- public Class<? extends MigrationCallBackForVersion> getCallBack(Version version) {
- Class<? extends MigrationCallBackForVersion> result = null;
-
- if (version.equals(VERSION_0_5)) {
- result = MigrationV0V0_5.class;
- }
- return result;
- }
-
- }
-
- @Override
- public Version[] getAvailableVersions() {
- Version[] result = new Version[]{VERSION_0_5};
- return result;
- }
-
- @Override
- public Version getApplicationVersion() {
- Version appVersion = new Version(LimaCallaoDAOHelper.getModelVersion());
- return appVersion;
- }
-
- @Override
- public boolean askUser(Version dbVersion, List<Version> versions) {
- return true;
- }
-}
+/*
+ * #%L
+ * Lima :: business
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2011 CodeLutin, Victor Salaun
+ * %%
+ * 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.migration;
+
+import org.chorem.lima.entity.LimaCallaoDAOHelper;
+import org.nuiton.topia.migration.TopiaMigrationCallbackByClass;
+import org.nuiton.util.Version;
+
+import java.util.List;
+
+public class DatabaseMigrationClass extends TopiaMigrationCallbackByClass {
+
+ protected static final Version VERSION_0_5 = new Version("0.5");
+ protected static final Version VERSION_0_5_2 = new Version("0.5.2");
+
+ public DatabaseMigrationClass() {
+ super(new MigrationResolver());
+ }
+
+ protected static class MigrationResolver implements MigrationCallBackForVersionResolver {
+
+ @Override
+ public Class<? extends MigrationCallBackForVersion> getCallBack(Version version) {
+ Class<? extends MigrationCallBackForVersion> result = null;
+
+ if (version.equals(VERSION_0_5)) {
+ result = MigrationV0V0_5.class;
+ } else if (version.equals(VERSION_0_5_2)) {
+ result = MigrationV0_5_2.class;
+ }
+ return result;
+ }
+
+ }
+
+ @Override
+ public Version[] getAvailableVersions() {
+ Version[] result = new Version[]{VERSION_0_5, VERSION_0_5_2};
+ return result;
+ }
+
+ @Override
+ public Version getApplicationVersion() {
+ Version appVersion = new Version(LimaCallaoDAOHelper.getModelVersion());
+ return appVersion;
+ }
+
+ @Override
+ public boolean askUser(Version dbVersion, List<Version> versions) {
+ return true;
+ }
+}
Property changes on: trunk/lima-business/src/main/java/org/chorem/lima/business/migration/DatabaseMigrationClass.java
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: trunk/lima-business/src/main/java/org/chorem/lima/business/migration/MigrationV0V0_5.java
___________________________________________________________________
Added: svn:eol-style
+ native
Added: trunk/lima-business/src/main/java/org/chorem/lima/business/migration/MigrationV0_5_2.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/migration/MigrationV0_5_2.java (rev 0)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/migration/MigrationV0_5_2.java 2011-09-20 17:49:06 UTC (rev 3296)
@@ -0,0 +1,122 @@
+package org.chorem.lima.business.migration;
+
+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;
+import org.nuiton.util.Version;
+
+import java.util.List;
+
+/**
+ * TODO
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.6
+ */
+public class MigrationV0_5_2 extends TopiaMigrationCallbackByClass.MigrationCallBackForVersion {
+
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(MigrationV0_5_2.class);
+
+ public MigrationV0_5_2(Version version, TopiaMigrationCallbackByClass callBack) {
+ super(version, callBack);
+ }
+
+ @Override
+ protected void prepareMigrationScript(TopiaContextImplementor tx,
+ List<String> queries,
+ boolean showSql,
+ boolean showProgression)
+ throws TopiaException {
+ if (log.isInfoEnabled()) {
+ 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);
+ }
+ }
+
+ 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;
+ }
+ if (length > 3) {
+
+ // fill with master account with 3 digits
+ String masterAccountNumber = accountNumber.substring(0, 3);
+ Account masterAccount = getMasterAccount(accountDAO, account, masterAccountNumber);
+ account.setMasterAccount(masterAccount);
+
+ // let's fill master account
+ fillMasterAccountNumber(accountDAO, masterAccount);
+ return;
+ }
+
+ if (length == 3) {
+
+ // fill with master account with 3 digits
+ String masterAccountNumber = accountNumber.substring(0, 2);
+ Account masterAccount = getMasterAccount(accountDAO, account, masterAccountNumber);
+ account.setMasterAccount(masterAccount);
+
+ // let's fill master account
+ fillMasterAccountNumber(accountDAO, masterAccount);
+ return;
+ }
+
+
+ if (length == 2) {
+
+ // fill with master account with 3 digits
+ String masterAccountNumber = accountNumber.substring(0, 1);
+ Account masterAccount = getMasterAccount(accountDAO, account, masterAccountNumber);
+ account.setMasterAccount(masterAccount);
+
+ // let's fill master account
+ fillMasterAccountNumber(accountDAO, masterAccount);
+ return;
+ }
+
+
+ }
+
+ protected Account getMasterAccount(AccountDAO accountDAO,
+ Account subAccount,
+ String masterAccountNumber) throws TopiaException {
+ Account masterAccount =
+ accountDAO.findByAccountNumber(masterAccountNumber);
+ if (masterAccount == null) {
+
+ // creates it
+ masterAccount = accountDAO.create(Account.PROPERTY_ACCOUNT_NUMBER, masterAccountNumber);
+ }
+ masterAccount.addSubAccounts(subAccount);
+ return masterAccount;
+ }
+}
Property changes on: trunk/lima-business/src/main/java/org/chorem/lima/business/migration/MigrationV0_5_2.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/utils/FinancialPeriodComparator.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/utils/FinancialPeriodComparator.java 2011-09-20 14:51:40 UTC (rev 3295)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/utils/FinancialPeriodComparator.java 2011-09-20 17:49:06 UTC (rev 3296)
@@ -1,54 +1,54 @@
-/*
- * #%L
- * Lima :: business
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2011 CodeLutin, Victor Salaun
- * %%
- * 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.utils;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.chorem.lima.entity.ClosedPeriodicEntryBook;
-
-import java.io.Serializable;
-import java.util.Comparator;
-
-public class FinancialPeriodComparator implements Serializable, Comparator<ClosedPeriodicEntryBook> {
-
- private static final long serialVersionUID = 1L;
-
- private static final Log log =
- LogFactory.getLog(FinancialPeriodComparator.class);
-
- @Override
- public int compare(ClosedPeriodicEntryBook o1, ClosedPeriodicEntryBook o2) {
- if (o1.getFinancialPeriod().getBeginDate().compareTo(o2.getFinancialPeriod().getBeginDate()) == 0) {
- if (o1.getEntryBook().getLabel().compareToIgnoreCase(o2.getEntryBook().getLabel()) == 0) {
- return o1.getTopiaCreateDate().compareTo(o2.getTopiaCreateDate());
- } else {
- return o1.getEntryBook().getCode().compareToIgnoreCase(o2.getEntryBook().getCode());
- }
- } else {
- return o1.getFinancialPeriod().getBeginDate().compareTo(o2.getFinancialPeriod().getBeginDate());
- }
- }
-
-}
+/*
+ * #%L
+ * Lima :: business
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2011 CodeLutin, Victor Salaun
+ * %%
+ * 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.utils;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.chorem.lima.entity.ClosedPeriodicEntryBook;
+
+import java.io.Serializable;
+import java.util.Comparator;
+
+public class FinancialPeriodComparator implements Serializable, Comparator<ClosedPeriodicEntryBook> {
+
+ private static final long serialVersionUID = 1L;
+
+ private static final Log log =
+ LogFactory.getLog(FinancialPeriodComparator.class);
+
+ @Override
+ public int compare(ClosedPeriodicEntryBook o1, ClosedPeriodicEntryBook o2) {
+ if (o1.getFinancialPeriod().getBeginDate().compareTo(o2.getFinancialPeriod().getBeginDate()) == 0) {
+ if (o1.getEntryBook().getLabel().compareToIgnoreCase(o2.getEntryBook().getLabel()) == 0) {
+ return o1.getTopiaCreateDate().compareTo(o2.getTopiaCreateDate());
+ } else {
+ return o1.getEntryBook().getCode().compareToIgnoreCase(o2.getEntryBook().getCode());
+ }
+ } else {
+ return o1.getFinancialPeriod().getBeginDate().compareTo(o2.getFinancialPeriod().getBeginDate());
+ }
+ }
+
+}
Property changes on: trunk/lima-business/src/main/java/org/chorem/lima/business/utils/FinancialPeriodComparator.java
___________________________________________________________________
Added: svn:eol-style
+ native
Modified: trunk/lima-callao/src/main/xmi/accounting.properties
===================================================================
--- trunk/lima-callao/src/main/xmi/accounting.properties 2011-09-20 14:51:40 UTC (rev 3295)
+++ trunk/lima-callao/src/main/xmi/accounting.properties 2011-09-20 17:49:06 UTC (rev 3296)
@@ -24,6 +24,7 @@
###
# Precise l'entete de l'ensemble des fichiers generes
model.tagvalue.copyright=/*\n Copyright (C) 2009-2010 Lima Callao\n */
+model.tagvalue.version=0.5.2
model.tagvalue.constantPrefix=PROPERTY_
model.tagValue.notGenerateToString=true
Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/LimaDecoratorProvider.java
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/LimaModelUtil.java
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/LimaRendererUtil.java
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
Modified: 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 2011-09-20 14:51:40 UTC (rev 3295)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountTreeTable.java 2011-09-20 17:49:06 UTC (rev 3296)
@@ -1,102 +1,102 @@
-/*
- * #%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;
-
-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) {
- }
-
-}
+/*
+ * #%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;
+
+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) {
+ }
+
+}
Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountTreeTable.java
___________________________________________________________________
Added: svn:eol-style
+ native
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsTable.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsTable.java 2011-09-20 14:51:40 UTC (rev 3295)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsTable.java 2011-09-20 17:49:06 UTC (rev 3296)
@@ -1,107 +1,107 @@
-/*
- * #%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.accountsreports;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.chorem.lima.ui.celleditor.BigDecimalTableCellRenderer;
-import org.jdesktop.swingx.JXTable;
-
-import java.awt.event.KeyEvent;
-import java.awt.event.KeyListener;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-import java.math.BigDecimal;
-
-public class AccountsReportsTable extends JXTable
- implements KeyListener, MouseListener {
-
- /** serialVersionUID. */
- private static final long serialVersionUID = 6093850347322834480L;
-
- /** log. */
- private static final Log log = LogFactory
- .getLog(AccountsReportsTable.class);
-
- protected AccountsReportsViewHandler handler;
-
- public AccountsReportsTable(AccountsReportsViewHandler handler) {
-
- this.handler = handler;
-
- addKeyListener(this);
- addMouseListener(this);
-
- //Get new BigDecimal renderer
- setDefaultRenderer(BigDecimal.class, new BigDecimalTableCellRenderer());
-
- }
-
- @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) {
- }
-
-}
+/*
+ * #%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.accountsreports;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.chorem.lima.ui.celleditor.BigDecimalTableCellRenderer;
+import org.jdesktop.swingx.JXTable;
+
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.math.BigDecimal;
+
+public class AccountsReportsTable extends JXTable
+ implements KeyListener, MouseListener {
+
+ /** serialVersionUID. */
+ private static final long serialVersionUID = 6093850347322834480L;
+
+ /** log. */
+ private static final Log log = LogFactory
+ .getLog(AccountsReportsTable.class);
+
+ protected AccountsReportsViewHandler handler;
+
+ public AccountsReportsTable(AccountsReportsViewHandler handler) {
+
+ this.handler = handler;
+
+ addKeyListener(this);
+ addMouseListener(this);
+
+ //Get new BigDecimal renderer
+ setDefaultRenderer(BigDecimal.class, new BigDecimalTableCellRenderer());
+
+ }
+
+ @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) {
+ }
+
+}
Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsTable.java
___________________________________________________________________
Added: svn:eol-style
+ native
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceTable.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceTable.java 2011-09-20 14:51:40 UTC (rev 3295)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceTable.java 2011-09-20 17:49:06 UTC (rev 3296)
@@ -1,106 +1,106 @@
-/*
- * #%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.balance;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.chorem.lima.ui.celleditor.BigDecimalTableCellRenderer;
-import org.jdesktop.swingx.JXTable;
-
-import java.awt.event.KeyEvent;
-import java.awt.event.KeyListener;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-import java.math.BigDecimal;
-
-public class BalanceTable extends JXTable implements KeyListener, MouseListener {
-
- /** serialVersionUID. */
- private static final long serialVersionUID = 6093850347322834480L;
-
- /** log. */
- private static final Log log = LogFactory
- .getLog(BalanceTable.class);
-
- protected BalanceViewHandler handler;
-
- public BalanceTable(BalanceViewHandler handler) {
-
- this.handler = handler;
-
- addKeyListener(this);
- addMouseListener(this);
-
- //Get new BigDecimal renderer
- setDefaultRenderer(BigDecimal.class, new BigDecimalTableCellRenderer());
-
- }
-
- @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) {
- }
-
-}
+/*
+ * #%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.balance;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.chorem.lima.ui.celleditor.BigDecimalTableCellRenderer;
+import org.jdesktop.swingx.JXTable;
+
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.math.BigDecimal;
+
+public class BalanceTable extends JXTable implements KeyListener, MouseListener {
+
+ /** serialVersionUID. */
+ private static final long serialVersionUID = 6093850347322834480L;
+
+ /** log. */
+ private static final Log log = LogFactory
+ .getLog(BalanceTable.class);
+
+ protected BalanceViewHandler handler;
+
+ public BalanceTable(BalanceViewHandler handler) {
+
+ this.handler = handler;
+
+ addKeyListener(this);
+ addMouseListener(this);
+
+ //Get new BigDecimal renderer
+ setDefaultRenderer(BigDecimal.class, new BigDecimalTableCellRenderer());
+
+ }
+
+ @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) {
+ }
+
+}
Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceTable.java
___________________________________________________________________
Added: svn:eol-style
+ native
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellEditor.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellEditor.java 2011-09-20 14:51:40 UTC (rev 3295)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellEditor.java 2011-09-20 17:49:06 UTC (rev 3296)
@@ -1,165 +1,165 @@
-/*
- * #%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.celleditor;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.chorem.lima.LimaContext;
-
-import javax.swing.AbstractCellEditor;
-import javax.swing.JTable;
-import javax.swing.JTextField;
-import javax.swing.SwingConstants;
-import javax.swing.SwingUtilities;
-import javax.swing.event.AncestorEvent;
-import javax.swing.event.AncestorListener;
-import javax.swing.table.TableCellEditor;
-import java.awt.Component;
-import java.awt.event.FocusEvent;
-import java.awt.event.FocusListener;
-import java.awt.event.KeyEvent;
-import java.awt.event.KeyListener;
-import java.awt.event.MouseEvent;
-import java.math.BigDecimal;
-import java.util.EventObject;
-
-public class BigDecimalTableCellEditor extends AbstractCellEditor
- implements TableCellEditor, FocusListener, AncestorListener, KeyListener {
-
- private static final Log log = LogFactory.getLog(BigDecimalTableCellEditor.class);
-
- private static final long serialVersionUID = 1L;
-
- protected final JTextField textField;
-
- private boolean keyPressed;
-
- /** constructor */
- public BigDecimalTableCellEditor() {
- textField = new JTextField();
- textField.setEditable(true);
- textField.setHorizontalAlignment(SwingConstants.RIGHT);
- textField.addFocusListener(this);
- textField.addAncestorListener(this);
- textField.addKeyListener(this);
- keyPressed = false;
- }
-
- @Override
- public Component getTableCellEditorComponent(JTable table, Object value,
- boolean isSelected, int row, int column) {
- textField.setText(value.toString());
- return textField;
- }
-
- // the editor should return a BigDecimal
- public Object getCellEditorValue() {
- String textValue = textField.getText().trim();
- //replace all comma by full stop
- textValue = textValue.replaceAll(",", ".");
- if (textValue.equals("")) {
- return BigDecimal.ZERO;
- } else {
- //set 0 in case the user type in a non number format
- BigDecimal bdValue = BigDecimal.ZERO;
- try {
- bdValue = new BigDecimal(textValue);
- } catch (NumberFormatException eee) {
- if (log.isErrorEnabled()) {
- log.error("Can't set " + textValue + " to a BigDecimal", eee);
- }
- }
- //round half up the number using the scale given by the configuration
- bdValue = bdValue.setScale(LimaContext.getContext().getConfig().getScale(),
- BigDecimal.ROUND_HALF_UP);
- return bdValue;
- }
- }
-
- @Override
- public boolean isCellEditable(EventObject evt) {
- return !(evt instanceof MouseEvent) || ((MouseEvent) evt).getClickCount() == 2;
- }
-
- /** Listeners */
- @Override
- public void focusGained(FocusEvent e) {
- SwingUtilities.invokeLater(new Runnable() {
- public void run() {
- textField.selectAll();
- }
- });
- }
-
- @Override
- public void focusLost(FocusEvent e) {
- keyPressed = false;
- }
-
- @Override
- public void ancestorAdded(AncestorEvent e) {
- SwingUtilities.invokeLater(new Runnable() {
- public void run() {
- textField.requestFocus();
- }
- });
- }
-
- @Override
- public void ancestorRemoved(AncestorEvent e) {
- }
-
- @Override
- public void ancestorMoved(AncestorEvent e) {
- }
-
- @Override
- public void keyTyped(KeyEvent e) {
-
- }
-
- @Override
- public void keyPressed(KeyEvent e) {
- }
-
- @Override
- public void keyReleased(KeyEvent e) {
- // replace all the cell content only if all the text has been selected
- if (!keyPressed
- && textField.getSelectionStart() == 0
- && textField.getSelectionEnd() == textField.getText().length()) {
- // delete the the cell content
- if (e.getKeyChar() == KeyEvent.VK_BACK_SPACE) {
- textField.setText("");
- keyPressed = true;
- // replace the content by the char typed in
- } else if (String.valueOf(e.getKeyChar()).matches("[a-zA-z0-9]")) {
- textField.setText(String.valueOf(e.getKeyChar()));
- keyPressed = true;
- }
- }
- }
-
-}
+/*
+ * #%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.celleditor;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.chorem.lima.LimaContext;
+
+import javax.swing.AbstractCellEditor;
+import javax.swing.JTable;
+import javax.swing.JTextField;
+import javax.swing.SwingConstants;
+import javax.swing.SwingUtilities;
+import javax.swing.event.AncestorEvent;
+import javax.swing.event.AncestorListener;
+import javax.swing.table.TableCellEditor;
+import java.awt.Component;
+import java.awt.event.FocusEvent;
+import java.awt.event.FocusListener;
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
+import java.awt.event.MouseEvent;
+import java.math.BigDecimal;
+import java.util.EventObject;
+
+public class BigDecimalTableCellEditor extends AbstractCellEditor
+ implements TableCellEditor, FocusListener, AncestorListener, KeyListener {
+
+ private static final Log log = LogFactory.getLog(BigDecimalTableCellEditor.class);
+
+ private static final long serialVersionUID = 1L;
+
+ protected final JTextField textField;
+
+ private boolean keyPressed;
+
+ /** constructor */
+ public BigDecimalTableCellEditor() {
+ textField = new JTextField();
+ textField.setEditable(true);
+ textField.setHorizontalAlignment(SwingConstants.RIGHT);
+ textField.addFocusListener(this);
+ textField.addAncestorListener(this);
+ textField.addKeyListener(this);
+ keyPressed = false;
+ }
+
+ @Override
+ public Component getTableCellEditorComponent(JTable table, Object value,
+ boolean isSelected, int row, int column) {
+ textField.setText(value.toString());
+ return textField;
+ }
+
+ // the editor should return a BigDecimal
+ public Object getCellEditorValue() {
+ String textValue = textField.getText().trim();
+ //replace all comma by full stop
+ textValue = textValue.replaceAll(",", ".");
+ if (textValue.equals("")) {
+ return BigDecimal.ZERO;
+ } else {
+ //set 0 in case the user type in a non number format
+ BigDecimal bdValue = BigDecimal.ZERO;
+ try {
+ bdValue = new BigDecimal(textValue);
+ } catch (NumberFormatException eee) {
+ if (log.isErrorEnabled()) {
+ log.error("Can't set " + textValue + " to a BigDecimal", eee);
+ }
+ }
+ //round half up the number using the scale given by the configuration
+ bdValue = bdValue.setScale(LimaContext.getContext().getConfig().getScale(),
+ BigDecimal.ROUND_HALF_UP);
+ return bdValue;
+ }
+ }
+
+ @Override
+ public boolean isCellEditable(EventObject evt) {
+ return !(evt instanceof MouseEvent) || ((MouseEvent) evt).getClickCount() == 2;
+ }
+
+ /** Listeners */
+ @Override
+ public void focusGained(FocusEvent e) {
+ SwingUtilities.invokeLater(new Runnable() {
+ public void run() {
+ textField.selectAll();
+ }
+ });
+ }
+
+ @Override
+ public void focusLost(FocusEvent e) {
+ keyPressed = false;
+ }
+
+ @Override
+ public void ancestorAdded(AncestorEvent e) {
+ SwingUtilities.invokeLater(new Runnable() {
+ public void run() {
+ textField.requestFocus();
+ }
+ });
+ }
+
+ @Override
+ public void ancestorRemoved(AncestorEvent e) {
+ }
+
+ @Override
+ public void ancestorMoved(AncestorEvent e) {
+ }
+
+ @Override
+ public void keyTyped(KeyEvent e) {
+
+ }
+
+ @Override
+ public void keyPressed(KeyEvent e) {
+ }
+
+ @Override
+ public void keyReleased(KeyEvent e) {
+ // replace all the cell content only if all the text has been selected
+ if (!keyPressed
+ && textField.getSelectionStart() == 0
+ && textField.getSelectionEnd() == textField.getText().length()) {
+ // delete the the cell content
+ if (e.getKeyChar() == KeyEvent.VK_BACK_SPACE) {
+ textField.setText("");
+ keyPressed = true;
+ // replace the content by the char typed in
+ } else if (String.valueOf(e.getKeyChar()).matches("[a-zA-z0-9]")) {
+ textField.setText(String.valueOf(e.getKeyChar()));
+ keyPressed = true;
+ }
+ }
+ }
+
+}
Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellEditor.java
___________________________________________________________________
Added: svn:eol-style
+ native
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellRenderer.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellRenderer.java 2011-09-20 14:51:40 UTC (rev 3295)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellRenderer.java 2011-09-20 17:49:06 UTC (rev 3296)
@@ -1,78 +1,78 @@
-/*
- * #%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.celleditor;
-
-import org.chorem.lima.LimaConfig;
-import org.chorem.lima.LimaContext;
-
-import javax.swing.JTable;
-import javax.swing.SwingConstants;
-import javax.swing.table.DefaultTableCellRenderer;
-import java.awt.Component;
-import java.math.BigDecimal;
-import java.text.DecimalFormat;
-import java.text.DecimalFormatSymbols;
-
-public class BigDecimalTableCellRenderer extends DefaultTableCellRenderer {
-
- private static final long serialVersionUID = -2499433026151065390L;
-
- public BigDecimalTableCellRenderer() {
- //
- }
-
- public Component getTableCellRendererComponent(JTable table, Object value,
- boolean isSelected, boolean hasFocus, int row, int column) {
-
- super.getTableCellRendererComponent(
- table, value, isSelected, hasFocus, row, column);
- setHorizontalAlignment(SwingConstants.RIGHT);
- setValue(value);
- return this;
- }
-
- public void setValue(Object aValue) {
- Object result = aValue;
- if (aValue != null && aValue instanceof BigDecimal) {
- LimaConfig config = LimaContext.getContext().getConfig();
- String scale = "";
- for (int i = 0; i < config.getScale(); i++) {
- scale += "0";
- }
- DecimalFormat formatter = new DecimalFormat("##0." + scale);
- DecimalFormatSymbols symbol = new DecimalFormatSymbols();
- //set decimalSeparator and thousandSeparator preferences
- symbol.setDecimalSeparator(config.getDecimalSeparator());
- symbol.setGroupingSeparator(config.getThousandSeparator());
- formatter.setDecimalFormatSymbols(symbol);
- //always set grouping
- formatter.setGroupingUsed(true);
- formatter.setGroupingSize(3);
- result = formatter.format(result);
- }
- super.setValue(result);
- }
-
-}
+/*
+ * #%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.celleditor;
+
+import org.chorem.lima.LimaConfig;
+import org.chorem.lima.LimaContext;
+
+import javax.swing.JTable;
+import javax.swing.SwingConstants;
+import javax.swing.table.DefaultTableCellRenderer;
+import java.awt.Component;
+import java.math.BigDecimal;
+import java.text.DecimalFormat;
+import java.text.DecimalFormatSymbols;
+
+public class BigDecimalTableCellRenderer extends DefaultTableCellRenderer {
+
+ private static final long serialVersionUID = -2499433026151065390L;
+
+ public BigDecimalTableCellRenderer() {
+ //
+ }
+
+ public Component getTableCellRendererComponent(JTable table, Object value,
+ boolean isSelected, boolean hasFocus, int row, int column) {
+
+ super.getTableCellRendererComponent(
+ table, value, isSelected, hasFocus, row, column);
+ setHorizontalAlignment(SwingConstants.RIGHT);
+ setValue(value);
+ return this;
+ }
+
+ public void setValue(Object aValue) {
+ Object result = aValue;
+ if (aValue != null && aValue instanceof BigDecimal) {
+ LimaConfig config = LimaContext.getContext().getConfig();
+ String scale = "";
+ for (int i = 0; i < config.getScale(); i++) {
+ scale += "0";
+ }
+ DecimalFormat formatter = new DecimalFormat("##0." + scale);
+ DecimalFormatSymbols symbol = new DecimalFormatSymbols();
+ //set decimalSeparator and thousandSeparator preferences
+ symbol.setDecimalSeparator(config.getDecimalSeparator());
+ symbol.setGroupingSeparator(config.getThousandSeparator());
+ formatter.setDecimalFormatSymbols(symbol);
+ //always set grouping
+ formatter.setGroupingUsed(true);
+ formatter.setGroupingSize(3);
+ result = formatter.format(result);
+ }
+ super.setValue(result);
+ }
+
+}
Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellRenderer.java
___________________________________________________________________
Added: svn:eol-style
+ native
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/EmptyCellRenderer.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/EmptyCellRenderer.java 2011-09-20 14:51:40 UTC (rev 3295)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/EmptyCellRenderer.java 2011-09-20 17:49:06 UTC (rev 3296)
@@ -1,85 +1,85 @@
-/*
- * #%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.celleditor;
-
-import sun.swing.DefaultLookup;
-
-import javax.swing.JLabel;
-import javax.swing.JTable;
-import javax.swing.border.Border;
-import javax.swing.border.EmptyBorder;
-import javax.swing.table.DefaultTableCellRenderer;
-import java.awt.Color;
-import java.awt.Component;
-
-@SuppressWarnings("restriction")
-public class EmptyCellRenderer extends DefaultTableCellRenderer {
-
- private static final long serialVersionUID = -7834417406160620726L;
-
- public Component getTableCellRendererComponent(JTable table, Object value,
- boolean isSelected, boolean hasFocus, int row, int column) {
- //Create a new JLabel to avoid colouring only when row is selected
- JLabel mycell = new JLabel();
- mycell.setOpaque(true);
- setBorder(new EmptyBorder(1, 1, 1, 1));
- setName("Table.cellRenderer");
- mycell.setBackground(Color.WHITE);
- mycell.setForeground(Color.BLACK);
- //Setting default foreGround and backGround colours when isSelected
- if (isSelected) {
- mycell.setForeground(table.getSelectionForeground());
- mycell.setBackground(table.getSelectionBackground());
- }
- //Setting default foreGround and backGround colours when hasFocus
- if (hasFocus) {
- Border border = null;
- if (isSelected) {
- border = DefaultLookup.getBorder(this, ui, "Table.focusSelectedCellHighlightBorder");
- }
- if (border == null) {
- border = DefaultLookup.getBorder(this, ui, "Table.focusCellHighlightBorder");
- }
- mycell.setBorder(border);
- }
- if (table.isCellEditable(row, column)) {
- // true for voucher and description
- // false for Account Class
- // if empty or null, colour background in red
- // else setText
- if (value instanceof String) {
- if (String.valueOf(value).isEmpty() || String.valueOf(value) == null) {
- mycell.setBackground(new Color(255, 198, 209));
- } else {
- mycell.setText(value.toString());
- }
- } else {
- mycell.setBackground(new Color(255, 198, 209));
- }
- }
- return mycell;
- }
-
-}
+/*
+ * #%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.celleditor;
+
+import sun.swing.DefaultLookup;
+
+import javax.swing.JLabel;
+import javax.swing.JTable;
+import javax.swing.border.Border;
+import javax.swing.border.EmptyBorder;
+import javax.swing.table.DefaultTableCellRenderer;
+import java.awt.Color;
+import java.awt.Component;
+
+@SuppressWarnings("restriction")
+public class EmptyCellRenderer extends DefaultTableCellRenderer {
+
+ private static final long serialVersionUID = -7834417406160620726L;
+
+ public Component getTableCellRendererComponent(JTable table, Object value,
+ boolean isSelected, boolean hasFocus, int row, int column) {
+ //Create a new JLabel to avoid colouring only when row is selected
+ JLabel mycell = new JLabel();
+ mycell.setOpaque(true);
+ setBorder(new EmptyBorder(1, 1, 1, 1));
+ setName("Table.cellRenderer");
+ mycell.setBackground(Color.WHITE);
+ mycell.setForeground(Color.BLACK);
+ //Setting default foreGround and backGround colours when isSelected
+ if (isSelected) {
+ mycell.setForeground(table.getSelectionForeground());
+ mycell.setBackground(table.getSelectionBackground());
+ }
+ //Setting default foreGround and backGround colours when hasFocus
+ if (hasFocus) {
+ Border border = null;
+ if (isSelected) {
+ border = DefaultLookup.getBorder(this, ui, "Table.focusSelectedCellHighlightBorder");
+ }
+ if (border == null) {
+ border = DefaultLookup.getBorder(this, ui, "Table.focusCellHighlightBorder");
+ }
+ mycell.setBorder(border);
+ }
+ if (table.isCellEditable(row, column)) {
+ // true for voucher and description
+ // false for Account Class
+ // if empty or null, colour background in red
+ // else setText
+ if (value instanceof String) {
+ if (String.valueOf(value).isEmpty() || String.valueOf(value) == null) {
+ mycell.setBackground(new Color(255, 198, 209));
+ } else {
+ mycell.setText(value.toString());
+ }
+ } else {
+ mycell.setBackground(new Color(255, 198, 209));
+ }
+ }
+ return mycell;
+ }
+
+}
Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/EmptyCellRenderer.java
___________________________________________________________________
Added: svn:eol-style
+ native
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookTable.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookTable.java 2011-09-20 14:51:40 UTC (rev 3295)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookTable.java 2011-09-20 17:49:06 UTC (rev 3296)
@@ -1,102 +1,102 @@
-/*
- * #%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.entrybook;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jdesktop.swingx.JXTable;
-
-import java.awt.event.KeyEvent;
-import java.awt.event.KeyListener;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-
-public class EntryBookTable extends JXTable
- implements KeyListener, MouseListener {
-
- /** serialVersionUID. */
- private static final long serialVersionUID = 6228396251512013262L;
-
- /** log. */
- private static final Log log = LogFactory
- .getLog(EntryBookTable.class);
-
- protected EntryBookViewHandler handler;
-
- public EntryBookTable(EntryBookViewHandler 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) {
- }
-
-}
+/*
+ * #%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.entrybook;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jdesktop.swingx.JXTable;
+
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+
+public class EntryBookTable extends JXTable
+ implements KeyListener, MouseListener {
+
+ /** serialVersionUID. */
+ private static final long serialVersionUID = 6228396251512013262L;
+
+ /** log. */
+ private static final Log log = LogFactory
+ .getLog(EntryBookTable.class);
+
+ protected EntryBookViewHandler handler;
+
+ public EntryBookTable(EntryBookViewHandler 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) {
+ }
+
+}
Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookTable.java
___________________________________________________________________
Added: svn:eol-style
+ native
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartTreeTable.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartTreeTable.java 2011-09-20 14:51:40 UTC (rev 3295)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartTreeTable.java 2011-09-20 17:49:06 UTC (rev 3296)
@@ -1,101 +1,101 @@
-/*
- * #%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.financialstatementchart;
-
-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;
-
-public class FinancialStatementChartTreeTable extends JXTreeTable
- implements KeyListener, MouseListener {
-
- /** serialVersionUID. */
- private static final long serialVersionUID = 3221024449873737253L;
-
- /** log. */
- private static final Log log = LogFactory
- .getLog(FinancialStatementChartTreeTable.class);
-
- protected FinancialStatementChartViewHandler handler;
-
- public FinancialStatementChartTreeTable(FinancialStatementChartViewHandler 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) {
- }
-
-}
+/*
+ * #%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.financialstatementchart;
+
+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;
+
+public class FinancialStatementChartTreeTable extends JXTreeTable
+ implements KeyListener, MouseListener {
+
+ /** serialVersionUID. */
+ private static final long serialVersionUID = 3221024449873737253L;
+
+ /** log. */
+ private static final Log log = LogFactory
+ .getLog(FinancialStatementChartTreeTable.class);
+
+ protected FinancialStatementChartViewHandler handler;
+
+ public FinancialStatementChartTreeTable(FinancialStatementChartViewHandler 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) {
+ }
+
+}
Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartTreeTable.java
___________________________________________________________________
Added: svn:eol-style
+ native
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 2011-09-20 14:51:40 UTC (rev 3295)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/RetainedEarningsEntryBookForm.jaxx 2011-09-20 17:49:06 UTC (rev 3296)
@@ -1,149 +1,149 @@
-<!--
- #%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="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);
-
- /**
- * Sets null to EntryBook and closes JDialog
- */
- protected void performCancel() {
- setEntryBook(null);
- dispose();
- }
-
- /**
- * Sets the right EntryBook to use and its values
- */
- protected void performNew() {
- if (selectedEntryBook.isSelected()) {
- entryBookComboBox.setEnabled(true);
- entryBookLabelField.setEditable(false);
- entryBookCodeField.setEditable(false);
- if (getEntryBookComboBox().getSelectedItem() != null) {
- getEntryBook().setCode(((EntryBook)getEntryBookComboBox().getSelectedItem()).getCode().trim());
- getEntryBook().setLabel(((EntryBook)getEntryBookComboBox().getSelectedItem()).getLabel().trim());
- } else {
- setEntryBook(null);
- }
- } else {
- entryBookComboBox.setEnabled(false);
- entryBookLabelField.setEditable(true);
- entryBookCodeField.setEditable(true);
- getEntryBook().setCode(getEntryBookCodeField().getText());
- getEntryBook().setLabel(getEntryBookLabelField().getText());
- }
- }
-
- void $afterCompleteSetup() {
- performNew();
- }
- ]]>
- </script>
-
- <Table>
- <row>
- <cell anchor="west">
- <JRadioButton
- id="selectedEntryBook"
- text="lima.common.entrybook"
- selected="true"
- buttonGroup="EntryBookGroup"
- onActionPerformed="performNew()"/>
- </cell>
- </row>
- <row>
- <cell>
- <JLabel id="entryBookSelectorLabel" text="lima.common.entrybook"/>
- </cell>
- <cell>
- <EntryBookComboBoxModel id="modelEntryBookComboBox"/>
- <JComboBox id="entryBookComboBox"
- model="{getModelEntryBookComboBox()}"
- renderer="{LimaRendererUtil.newDecoratorListCellRenderer(EntryBook.class)}"
- editable="false"
- onItemStateChanged="getEntryBook().setCode(((EntryBook)getEntryBookComboBox().getSelectedItem()).getCode()); getEntryBook().setLabel(((EntryBook)getEntryBookComboBox().getSelectedItem()).getLabel())"/>
- </cell>
- </row>
- <row>
- <cell anchor="west">
- <JRadioButton
- id="newEntryBook"
- text="lima.home.entrybooks.create"
- selected="false"
- buttonGroup="EntryBookGroup"
- onActionPerformed="performNew()"/>
- </cell>
- </row>
- <row>
- <cell>
- <JLabel text="lima.common.code"/>
- </cell>
- <cell>
- <JTextField id="entryBookCodeField" text="{getEntryBook().getCode()}"/>
- <Document javaBean="getEntryBookCodeField().getDocument()"
- onInsertUpdate='getEntryBook().setCode(getEntryBookCodeField().getText())'
- onRemoveUpdate='getEntryBook().setCode(getEntryBookCodeField().getText())'/>
- </cell>
- </row>
- <row>
- <cell>
- <JLabel text="lima.common.label"/>
- </cell>
- <cell>
- <JTextField id="entryBookLabelField" editable='{isAddState()}'
- text="{getEntryBook().getLabel()}"/>
- <Document javaBean="getEntryBookLabelField().getDocument()"
- onInsertUpdate='getEntryBook().setLabel(getEntryBookLabelField().getText())'
- onRemoveUpdate='getEntryBook().setLabel(getEntryBookLabelField().getText())'/>
- </cell>
- </row>
- <row>
- <cell>
- <JButton id="cancelButton" text="lima.common.cancel"
- onActionPerformed="performCancel()"/>
- </cell>
- <cell>
- <JButton id="okButton" text="lima.common.ok"
- onActionPerformed="dispose()"/>
- </cell>
-
- </row>
- </Table>
+<!--
+ #%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="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);
+
+ /**
+ * Sets null to EntryBook and closes JDialog
+ */
+ protected void performCancel() {
+ setEntryBook(null);
+ dispose();
+ }
+
+ /**
+ * Sets the right EntryBook to use and its values
+ */
+ protected void performNew() {
+ if (selectedEntryBook.isSelected()) {
+ entryBookComboBox.setEnabled(true);
+ entryBookLabelField.setEditable(false);
+ entryBookCodeField.setEditable(false);
+ if (getEntryBookComboBox().getSelectedItem() != null) {
+ getEntryBook().setCode(((EntryBook)getEntryBookComboBox().getSelectedItem()).getCode().trim());
+ getEntryBook().setLabel(((EntryBook)getEntryBookComboBox().getSelectedItem()).getLabel().trim());
+ } else {
+ setEntryBook(null);
+ }
+ } else {
+ entryBookComboBox.setEnabled(false);
+ entryBookLabelField.setEditable(true);
+ entryBookCodeField.setEditable(true);
+ getEntryBook().setCode(getEntryBookCodeField().getText());
+ getEntryBook().setLabel(getEntryBookLabelField().getText());
+ }
+ }
+
+ void $afterCompleteSetup() {
+ performNew();
+ }
+ ]]>
+ </script>
+
+ <Table>
+ <row>
+ <cell anchor="west">
+ <JRadioButton
+ id="selectedEntryBook"
+ text="lima.common.entrybook"
+ selected="true"
+ buttonGroup="EntryBookGroup"
+ onActionPerformed="performNew()"/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JLabel id="entryBookSelectorLabel" text="lima.common.entrybook"/>
+ </cell>
+ <cell>
+ <EntryBookComboBoxModel id="modelEntryBookComboBox"/>
+ <JComboBox id="entryBookComboBox"
+ model="{getModelEntryBookComboBox()}"
+ renderer="{LimaRendererUtil.newDecoratorListCellRenderer(EntryBook.class)}"
+ editable="false"
+ onItemStateChanged="getEntryBook().setCode(((EntryBook)getEntryBookComboBox().getSelectedItem()).getCode()); getEntryBook().setLabel(((EntryBook)getEntryBookComboBox().getSelectedItem()).getLabel())"/>
+ </cell>
+ </row>
+ <row>
+ <cell anchor="west">
+ <JRadioButton
+ id="newEntryBook"
+ text="lima.home.entrybooks.create"
+ selected="false"
+ buttonGroup="EntryBookGroup"
+ onActionPerformed="performNew()"/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JLabel text="lima.common.code"/>
+ </cell>
+ <cell>
+ <JTextField id="entryBookCodeField" text="{getEntryBook().getCode()}"/>
+ <Document javaBean="getEntryBookCodeField().getDocument()"
+ onInsertUpdate='getEntryBook().setCode(getEntryBookCodeField().getText())'
+ onRemoveUpdate='getEntryBook().setCode(getEntryBookCodeField().getText())'/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JLabel text="lima.common.label"/>
+ </cell>
+ <cell>
+ <JTextField id="entryBookLabelField" editable='{isAddState()}'
+ text="{getEntryBook().getLabel()}"/>
+ <Document javaBean="getEntryBookLabelField().getDocument()"
+ onInsertUpdate='getEntryBook().setLabel(getEntryBookLabelField().getText())'
+ onRemoveUpdate='getEntryBook().setLabel(getEntryBookLabelField().getText())'/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JButton id="cancelButton" text="lima.common.cancel"
+ onActionPerformed="performCancel()"/>
+ </cell>
+ <cell>
+ <JButton id="okButton" text="lima.common.ok"
+ onActionPerformed="dispose()"/>
+ </cell>
+
+ </row>
+ </Table>
</JDialog>
\ No newline at end of file
Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/RetainedEarningsEntryBookForm.jaxx
___________________________________________________________________
Added: svn:eol-style
+ native
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringPeriodSearchPanel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringPeriodSearchPanel.java 2011-09-20 14:51:40 UTC (rev 3295)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringPeriodSearchPanel.java 2011-09-20 17:49:06 UTC (rev 3296)
@@ -1,160 +1,160 @@
-/*
- * #%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.lettering;
-
-import org.apache.commons.lang.time.DateUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.chorem.lima.entity.FinancialPeriod;
-import org.chorem.lima.entity.FiscalPeriod;
-import org.chorem.lima.enums.ComboBoxDatesEnum;
-import org.chorem.lima.ui.LimaRendererUtil;
-import org.chorem.lima.ui.combobox.FinancialPeriodComboBoxModel;
-import org.chorem.lima.ui.combobox.FiscalPeriodComboBoxModel;
-import org.jdesktop.swingx.JXDatePicker;
-
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.ListCellRenderer;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.util.Calendar;
-import java.util.Date;
-
-import static org.nuiton.i18n.I18n._;
-
-public class LetteringPeriodSearchPanel extends JPanel {
-
- private static final Log log =
- LogFactory.getLog(LetteringPeriodSearchPanel.class);
-
- protected LetteringViewHandler handler;
-
- public LetteringPeriodSearchPanel(LetteringViewHandler handler) {
- this.handler = handler;
-
- //init date
- refresh(ComboBoxDatesEnum.FISCAL_PERIOD);
- }
-
- public void refresh(ComboBoxDatesEnum comboBoxPeriodEnum) {
-
- switch (comboBoxPeriodEnum) {
- case PERIOD:
- // get begin date
- Calendar calendarBegin = Calendar.getInstance();
- // set begindate to JAN 1 - 0:00.000 of this years
- Date beginDate = calendarBegin.getTime();
- beginDate = DateUtils.truncate(beginDate, Calendar.YEAR);
- //handler().setBeginDate(beginDate);
-
- // get end date
- Calendar calendarEnd = Calendar.getInstance();
- Date endDate = calendarEnd.getTime();
- //handler().setEndDate(endDate);
- JLabel beginDateLabel = new JLabel(_("lima.common.begindate"));
- final JXDatePicker beginDatePicker = new JXDatePicker(beginDate);
- ActionListener beginDateActionListener = new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- handler.setBeginDate(beginDatePicker.getDate());
- handler.refresh();
- }
- };
- handler.setBeginDate(beginDatePicker.getDate());
- beginDatePicker.addActionListener(beginDateActionListener);
-
- JLabel endDateLabel = new JLabel(_("lima.common.enddate"));
- final JXDatePicker endDatePicker = new JXDatePicker(endDate);
- ActionListener endDateActionListener = new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- handler.setEndDate(endDatePicker.getDate());
- handler.refresh();
- }
- };
- handler.setEndDate(endDatePicker.getDate());
- endDatePicker.addActionListener(endDateActionListener);
- handler.refresh();
-
- removeAll();
- add(beginDateLabel);
- add(beginDatePicker);
- add(endDateLabel);
- add(endDatePicker);
- break;
-
- case FISCAL_PERIOD:
- FiscalPeriodComboBoxModel fiscalModel = new FiscalPeriodComboBoxModel(true);
- ListCellRenderer renderer =
- LimaRendererUtil.newDecoratorListCellRenderer(FiscalPeriod.class);
- final JComboBox fiscalPeriod = new JComboBox(fiscalModel);
- fiscalPeriod.setRenderer(renderer);
- fiscalPeriod.setEditable(false);
- ActionListener fiscalPeriodActionListener = new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- FiscalPeriod fPeriod = (FiscalPeriod) fiscalPeriod.getSelectedItem();
- if (fPeriod != null) {
- handler.setBeginDate(fPeriod.getBeginDate());
- handler.setEndDate(fPeriod.getEndDate());
- handler.refresh();
- }
- }
- };
- fiscalPeriod.addActionListener(fiscalPeriodActionListener);
-
- removeAll();
- add(fiscalPeriod);
- break;
-
- case FINANCIAL_PERIOD:
- FinancialPeriodComboBoxModel financialModel = new FinancialPeriodComboBoxModel(true);
- renderer =
- LimaRendererUtil.newDecoratorListCellRenderer(FinancialPeriod.class);
- final JComboBox financialPeriod = new JComboBox(financialModel);
- financialPeriod.setRenderer(renderer);
- financialPeriod.setEditable(false);
- ActionListener financialPeriodActionListener = new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- FinancialPeriod fPeriod = (FinancialPeriod) financialPeriod.getSelectedItem();
- if (fPeriod != null) {
- handler.setBeginDate(fPeriod.getBeginDate());
- handler.setEndDate(fPeriod.getEndDate());
- handler.refresh();
- }
- }
- };
- financialPeriod.addActionListener(financialPeriodActionListener);
- removeAll();
- add(financialPeriod);
- break;
- }
-
- }
-
-}
+/*
+ * #%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.lettering;
+
+import org.apache.commons.lang.time.DateUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.chorem.lima.entity.FinancialPeriod;
+import org.chorem.lima.entity.FiscalPeriod;
+import org.chorem.lima.enums.ComboBoxDatesEnum;
+import org.chorem.lima.ui.LimaRendererUtil;
+import org.chorem.lima.ui.combobox.FinancialPeriodComboBoxModel;
+import org.chorem.lima.ui.combobox.FiscalPeriodComboBoxModel;
+import org.jdesktop.swingx.JXDatePicker;
+
+import javax.swing.JComboBox;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.ListCellRenderer;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.Calendar;
+import java.util.Date;
+
+import static org.nuiton.i18n.I18n._;
+
+public class LetteringPeriodSearchPanel extends JPanel {
+
+ private static final Log log =
+ LogFactory.getLog(LetteringPeriodSearchPanel.class);
+
+ protected LetteringViewHandler handler;
+
+ public LetteringPeriodSearchPanel(LetteringViewHandler handler) {
+ this.handler = handler;
+
+ //init date
+ refresh(ComboBoxDatesEnum.FISCAL_PERIOD);
+ }
+
+ public void refresh(ComboBoxDatesEnum comboBoxPeriodEnum) {
+
+ switch (comboBoxPeriodEnum) {
+ case PERIOD:
+ // get begin date
+ Calendar calendarBegin = Calendar.getInstance();
+ // set begindate to JAN 1 - 0:00.000 of this years
+ Date beginDate = calendarBegin.getTime();
+ beginDate = DateUtils.truncate(beginDate, Calendar.YEAR);
+ //handler().setBeginDate(beginDate);
+
+ // get end date
+ Calendar calendarEnd = Calendar.getInstance();
+ Date endDate = calendarEnd.getTime();
+ //handler().setEndDate(endDate);
+ JLabel beginDateLabel = new JLabel(_("lima.common.begindate"));
+ final JXDatePicker beginDatePicker = new JXDatePicker(beginDate);
+ ActionListener beginDateActionListener = new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ handler.setBeginDate(beginDatePicker.getDate());
+ handler.refresh();
+ }
+ };
+ handler.setBeginDate(beginDatePicker.getDate());
+ beginDatePicker.addActionListener(beginDateActionListener);
+
+ JLabel endDateLabel = new JLabel(_("lima.common.enddate"));
+ final JXDatePicker endDatePicker = new JXDatePicker(endDate);
+ ActionListener endDateActionListener = new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ handler.setEndDate(endDatePicker.getDate());
+ handler.refresh();
+ }
+ };
+ handler.setEndDate(endDatePicker.getDate());
+ endDatePicker.addActionListener(endDateActionListener);
+ handler.refresh();
+
+ removeAll();
+ add(beginDateLabel);
+ add(beginDatePicker);
+ add(endDateLabel);
+ add(endDatePicker);
+ break;
+
+ case FISCAL_PERIOD:
+ FiscalPeriodComboBoxModel fiscalModel = new FiscalPeriodComboBoxModel(true);
+ ListCellRenderer renderer =
+ LimaRendererUtil.newDecoratorListCellRenderer(FiscalPeriod.class);
+ final JComboBox fiscalPeriod = new JComboBox(fiscalModel);
+ fiscalPeriod.setRenderer(renderer);
+ fiscalPeriod.setEditable(false);
+ ActionListener fiscalPeriodActionListener = new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ FiscalPeriod fPeriod = (FiscalPeriod) fiscalPeriod.getSelectedItem();
+ if (fPeriod != null) {
+ handler.setBeginDate(fPeriod.getBeginDate());
+ handler.setEndDate(fPeriod.getEndDate());
+ handler.refresh();
+ }
+ }
+ };
+ fiscalPeriod.addActionListener(fiscalPeriodActionListener);
+
+ removeAll();
+ add(fiscalPeriod);
+ break;
+
+ case FINANCIAL_PERIOD:
+ FinancialPeriodComboBoxModel financialModel = new FinancialPeriodComboBoxModel(true);
+ renderer =
+ LimaRendererUtil.newDecoratorListCellRenderer(FinancialPeriod.class);
+ final JComboBox financialPeriod = new JComboBox(financialModel);
+ financialPeriod.setRenderer(renderer);
+ financialPeriod.setEditable(false);
+ ActionListener financialPeriodActionListener = new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ FinancialPeriod fPeriod = (FinancialPeriod) financialPeriod.getSelectedItem();
+ if (fPeriod != null) {
+ handler.setBeginDate(fPeriod.getBeginDate());
+ handler.setEndDate(fPeriod.getEndDate());
+ handler.refresh();
+ }
+ }
+ };
+ financialPeriod.addActionListener(financialPeriodActionListener);
+ removeAll();
+ add(financialPeriod);
+ break;
+ }
+
+ }
+
+}
Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringPeriodSearchPanel.java
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/widgets/ScrollBasicComboPopup.java
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/widgets/ScrollMetalComboUI.java
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
1
0
Author: tchemit
Date: 2011-09-20 16:51:40 +0200 (Tue, 20 Sep 2011)
New Revision: 3295
Url: http://chorem.org/repositories/revision/lima/3295
Log:
- Improve images usages (JAXX is your friend)
- Continue cleaning ui stuff (should be able to remove ServiceMonitorable stuff soon...)
- Evolution #444: [Saisie ?\195?\169criture] Saisie d'une transaction lourde
- Evolution #442: [Saisie ?\195?\169criture] Utiliser la description du compte client
- Anomalie #443: [Saisie ?\195?\169criture] Non prise en compte de la modification de la description d'une transaction
Added:
trunk/lima-swing/src/main/java/org/chorem/lima/ui/LimaModelUtil.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/LimaRendererUtil.java
trunk/lima-swing/src/main/resources/icons/accounts.png
trunk/lima-swing/src/main/resources/icons/entries.png
trunk/lima-swing/src/main/resources/icons/entrybooks.png
trunk/lima-swing/src/main/resources/icons/fiscalperiods.png
trunk/lima-swing/src/main/resources/icons/identity.png
trunk/lima-swing/src/main/resources/icons/puzzle_icon.png
trunk/lima-swing/src/main/resources/icons/puzzle_splash.png
Removed:
trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/EntryBookRenderer.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FinancialPeriodComboBoxRenderer.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FiscalPeriodComboBoxRenderer.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/LetterRenderer.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialPeriodComboBox.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/renderers/RendererUtil.java
trunk/lima-swing/src/main/resources/images/accounts.png
trunk/lima-swing/src/main/resources/images/entries.png
trunk/lima-swing/src/main/resources/images/entrybooks.png
trunk/lima-swing/src/main/resources/images/fiscalperiods.png
trunk/lima-swing/src/main/resources/images/identity.png
trunk/lima-swing/src/main/resources/images/puzzle_icon.png
trunk/lima-swing/src/main/resources/images/puzzle_splash.png
Modified:
trunk/lima-swing/pom.xml
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/LimaServiceFactory.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/java/org/chorem/lima/ui/account/AccountTreeTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/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/accountsreports/AccountsReportsPeriodSearchPanel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalancePeriodSearchPanel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/EntryBookTableCellEditor.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/LetterTableCellEditor.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/AccountComboBoxModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/EntryBookComboBoxModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FinancialPeriodComboBoxModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FiscalPeriodComboBoxModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/LetterComboBoxModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/SubAccountComboBoxModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBookComboBox.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsPeriodSearchPanel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodTable.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartTreeTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportPeriodSearchPanel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTable.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/EntryBookSearchComboBox.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionPeriodSearchPanel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchTable.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/LetterSearchComboBox.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/AddPeriod.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodTableModel.java
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/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/identity/IdentityHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerPeriodSearchPanel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetterComboBox.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringPeriodSearchPanel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateFiscalPeriodPanel.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/java/org/chorem/lima/ui/vatchart/VatChartTreeTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportPeriodSearchPanel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportTable.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/util/DialogHelper.java
trunk/lima-swing/src/main/resources/log4j.properties
Modified: trunk/lima-swing/pom.xml
===================================================================
--- trunk/lima-swing/pom.xml 2011-09-20 14:47:53 UTC (rev 3294)
+++ trunk/lima-swing/pom.xml 2011-09-20 14:51:40 UTC (rev 3295)
@@ -222,7 +222,7 @@
<classpathPrefix>./lib/</classpathPrefix>
</manifest>
<manifestEntries>
- <SplashScreen-Image>images/puzzle_splash.png</SplashScreen-Image>
+ <SplashScreen-Image>icons/puzzle_splash.png</SplashScreen-Image>
</manifestEntries>
</archive>
</configuration>
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/LimaConfig.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/LimaConfig.java 2011-09-20 14:47:53 UTC (rev 3294)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/LimaConfig.java 2011-09-20 14:51:40 UTC (rev 3295)
@@ -574,7 +574,7 @@
}
optionsService =
- LimaServiceFactory.getInstance().getService(
+ LimaServiceFactory.getService(
OptionsServiceMonitorable.class);
if (!serverProp.isEmpty()) {
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java 2011-09-20 14:47:53 UTC (rev 3294)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java 2011-09-20 14:51:40 UTC (rev 3295)
@@ -135,18 +135,6 @@
}
}
- /* init date converter
- Converter converter = ConverterUtil.getConverter(java.util.Date.class);
- if (converter != null) {
- ConvertUtils.deregister(java.util.Date.class);
- DateConverter dateConverter = new DateConverter();
- dateConverter.setUseLocaleFormat(true);
- ConvertUtils.register(dateConverter, java.util.Date.class);
- }
-
- if (log.isDebugEnabled()) {
- log.debug("Context init done in " + (StringUtil.convertTime(t0, System.nanoTime())));
- }*/
return context;
}
@@ -169,11 +157,10 @@
splash.updateProgression(0.7, _("lima.splash.2"));
//start http server
- LimaServiceFactory.getInstance().getService(HttpServerServiceMonitorable.class).start();
+ LimaServiceFactory.getService(HttpServerServiceMonitorable.class).start();
AccountService accountService =
- LimaServiceFactory.getInstance().getService(
- AccountServiceMonitorable.class);
+ LimaServiceFactory.getService(AccountServiceMonitorable.class);
List<Account> accounts = accountService.getChildrenAccounts(null);
if (accounts.isEmpty()) {
@@ -209,7 +196,7 @@
super.run();
LimaContext.get().close();
- LimaServiceFactory.getInstance().destroy();
+ LimaServiceFactory.destroy();
// force to kill main thread
if (log.isInfoEnabled()) {
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/service/LimaServiceFactory.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/service/LimaServiceFactory.java 2011-09-20 14:47:53 UTC (rev 3294)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/service/LimaServiceFactory.java 2011-09-20 14:51:40 UTC (rev 3295)
@@ -33,6 +33,8 @@
import org.apache.openejb.assembler.classic.Assembler;
import org.apache.openejb.loader.SystemInstance;
import org.chorem.lima.LimaMain;
+import org.chorem.lima.business.ServiceListener;
+import org.chorem.lima.business.ServiceMonitorable;
import javax.naming.Context;
import javax.naming.InitialContext;
@@ -99,30 +101,37 @@
}
- /**
- * Return service factory singleton instance.
- * <p/>
- * Init it at first call.
- *
- * @return singleton instance
- */
- public static LimaServiceFactory getInstance() {
- if (instance == null) {
- instance = new LimaServiceFactory();
- }
- return instance;
- }
-
- public <M> M getService(Class<M> serviceMonitorableClass) {
+ public static <M> M getService(Class<M> serviceMonitorableClass) {
+ LimaServiceFactory factory = getInstance();
+ Map<Class<?>, Object> services = factory.getServices();
M result = (M) services.get(serviceMonitorableClass);
if (result == null) {
- result = newService(serviceMonitorableClass);
+ result = factory.newService(serviceMonitorableClass);
services.put(serviceMonitorableClass, result);
}
return result;
}
+ public static <M> void addServiceListener(Class<M> serviceClass, ServiceListener listener) {
+ M service = getService(serviceClass);
+ addServiceListener(service, listener);
+ }
+
+ public static <M> void addServiceListener(M service, ServiceListener listener) {
+ if (!(service instanceof ServiceMonitorable)) {
+ throw new IllegalArgumentException(
+ "service " + service + " does not implement " + ServiceMonitorable.class);
+ }
+ ((ServiceMonitorable) service).addServiceListener(listener);
+ }
+
+
+ public static <M> void removeServiceListener(Class<M> serviceClass, ServiceListener listener) {
+ ServiceMonitorable service = (ServiceMonitorable) getService(serviceClass);
+ service.removeServiceListener(listener);
+ }
+
/**
* Destroy openejb jndi context.
* <p/>
@@ -131,7 +140,7 @@
*
* @throws Exception when trying to destroy a non existent application
*/
- public void destroy() throws Exception {
+ public static void destroy() throws Exception {
// destroy code (only in embedded mode)
Assembler assembler = SystemInstance.get().getComponent(Assembler.class);
@@ -141,6 +150,24 @@
OpenEJB.destroy();
}
+ /**
+ * Return service factory singleton instance.
+ * <p/>
+ * Init it at first call.
+ *
+ * @return singleton instance
+ */
+ protected static LimaServiceFactory getInstance() {
+ if (instance == null) {
+ instance = new LimaServiceFactory();
+ }
+ return instance;
+ }
+
+ protected Map<Class<?>, Object> getServices() {
+ return getInstance().services;
+ }
+
protected <M> M newService(Class<M> serviceMonitorableClass) {
M result;
Object ejbHome;
@@ -156,7 +183,7 @@
ClassLoader classLoader = serviceMonitorableClass.getClassLoader();
result = (M) Proxy.newProxyInstance(
classLoader,
- new Class[]{serviceMonitorableClass},
+ new Class[]{ServiceMonitorable.class, serviceMonitorableClass},
handler
);
return result;
Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/LimaModelUtil.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/LimaModelUtil.java (rev 0)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/LimaModelUtil.java 2011-09-20 14:51:40 UTC (rev 3295)
@@ -0,0 +1,12 @@
+package org.chorem.lima.ui;
+
+/**
+ * Util to create ui models.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.5.2
+ */
+public class LimaModelUtil {
+
+
+}
Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/LimaModelUtil.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Copied: trunk/lima-swing/src/main/java/org/chorem/lima/ui/LimaRendererUtil.java (from rev 3291, trunk/lima-swing/src/main/java/org/chorem/lima/ui/renderers/RendererUtil.java)
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/LimaRendererUtil.java (rev 0)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/LimaRendererUtil.java 2011-09-20 14:51:40 UTC (rev 3295)
@@ -0,0 +1,31 @@
+package org.chorem.lima.ui;
+
+import jaxx.runtime.swing.renderer.DecoratorListCellRenderer;
+import jaxx.runtime.swing.renderer.DecoratorProviderListCellRenderer;
+import org.chorem.lima.LimaContext;
+import org.nuiton.util.decorator.Decorator;
+import org.nuiton.util.decorator.DecoratorProvider;
+
+import javax.swing.ListCellRenderer;
+
+/**
+ * Helper class to deal with renderers.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.5.2
+ */
+public class LimaRendererUtil {
+
+ public static ListCellRenderer newDecoratorProviderListCellRenderer() {
+ DecoratorProvider decoratorProvider = LimaContext.get().getDecoratorProvider();
+ return new DecoratorProviderListCellRenderer(decoratorProvider);
+ }
+
+ public static ListCellRenderer newDecoratorListCellRenderer(Class<?> type) {
+
+ DecoratorProvider decoratorProvider = LimaContext.get().getDecoratorProvider();
+ Decorator<?> decorator = decoratorProvider.getDecoratorByType(type);
+ return new DecoratorListCellRenderer(decorator);
+ }
+
+}
Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/LimaRendererUtil.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
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 2011-09-20 14:47:53 UTC (rev 3294)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainView.jaxx 2011-09-20 14:51:40 UTC (rev 3295)
@@ -28,31 +28,21 @@
undecorated='{getConfig().isFullScreen()}'
resizable="true" width="800" height="600"
extendedState='{this.MAXIMIZED_BOTH}'
- iconImage='{new ImageIcon(getClass().getResource("/images/puzzle_icon.png")).getImage()}'>
+ iconImage='puzzle_icon.png'>
<import>
- java.awt.Component
- java.awt.Desktop
- java.io.IOException
- java.net.URI
- java.net.URISyntaxException
java.util.Locale
- javax.swing.BoxLayout
- javax.swing.border.EtchedBorder
- javax.swing.ImageIcon
javax.swing.JButton
+ jaxx.runtime.SwingUtil
org.chorem.lima.LimaConfig
- org.chorem.lima.business.HttpServerServiceMonitorable
+ org.chorem.lima.LimaContext
org.chorem.lima.enums.ImportExportEnum
- org.chorem.lima.service.LimaServiceFactory
</import>
- <Desktop id='desktop' javaBean='Desktop.getDesktop()'/>
-
<script><![CDATA[
public LimaConfig getConfig() {
- return getContextValue(LimaConfig.class);
+ return LimaContext.CONFIG_DEF.getContextValue(getDelegateContext());
}
public MainViewHandler getHandler() {
@@ -62,61 +52,6 @@
public boolean acceptLocale(Locale l, String expected) {
return l != null && l.toString().equals(expected);
}
-
- public void loadURI(){
- try {
- int port = LimaServiceFactory.getInstance().getService(
- HttpServerServiceMonitorable.class).getHttpPort();
- String address = LimaConfig.getInstance().getHostAdress();
- String url = "http://"+address+":"+port+"/";
- desktop.browse(new URI(url));
- } catch (IOException e) {
- log.error("Can't open browser",e);
- } catch (URISyntaxException e) {
- log.error("Can't create URI",e);
- }
- }
-
-/**
- * Show a new closable tab.
- *
- * @param name name of tab to show
- * @param container the tab container
- * @param canClose {@code false} if tab can't be closed
- */
-protected void showTab(String name, Component container, boolean canClose) {
- // if contentTabbedPane doesnot yet contains tab
- if (contentTabbedPane.indexOfTab(name) == -1) {
- ClosableTabHeader closableHeader = new ClosableTabHeader();
- closableHeader.setTitle(name);
- closableHeader.setCanClose(canClose);
- contentTabbedPane.addTab(name, container);
- contentTabbedPane.setSelectedComponent(container);
- contentTabbedPane.setTabComponentAt(contentTabbedPane.indexOfTab(name), closableHeader);
- closableHeader.getCloseTab().addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- JButton button = (JButton) e.getSource();
- ClosableTabHeader closableTab = (ClosableTabHeader) button.getParent();
- String name = closableTab.getTitle();
- contentTabbedPane.remove(contentTabbedPane.indexOfTab(name));
- }
- });
- // if contentTabbedPane contains tab
- } else {
- contentTabbedPane.setSelectedIndex(contentTabbedPane.indexOfTab(name));
- }
-}
-
-/**
- * Show a new closable tab.
- *
- * @param name name of tab to show
- * @param container the tab container
- */
-protected void showTab(String name, Component container) {
- showTab(name, container, true);
-}
]]>
</script>
@@ -165,7 +100,7 @@
</JMenu>
<JSeparator/>
<JMenuItem actionIcon='documents' text="lima.documents"
- onActionPerformed="loadURI()"/>
+ onActionPerformed="getHandler().loadURI(this)"/>
<JSeparator/>
<JMenuItem text="lima.identity"
actionIcon="identity"
@@ -261,8 +196,8 @@
<JMenu text="lima.menu.help" mnemonic="{'H'}">
- <JMenuItem id="help" text='lima.menu.help.help' actionIcon="help"
- onActionPerformed="getHandler().showHelp(this, null)"/>
+ <!--<JMenuItem id="help" text='lima.menu.help.help' actionIcon="help"-->
+ <!--onActionPerformed="getHandler().showHelp(this, null)"/>-->
<JMenuItem id="site" text='lima.menu.help.site' actionIcon="site"
onActionPerformed="getHandler().gotoSite(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 2011-09-20 14:47:53 UTC (rev 3294)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java 2011-09-20 14:51:40 UTC (rev 3295)
@@ -26,13 +26,16 @@
package org.chorem.lima.ui;
import jaxx.runtime.JAXXContext;
+import jaxx.runtime.SwingUtil;
import jaxx.runtime.swing.AboutPanel;
import jaxx.runtime.swing.editor.config.ConfigUIHelper;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.LimaConfig;
import org.chorem.lima.LimaContext;
+import org.chorem.lima.business.HttpServerServiceMonitorable;
import org.chorem.lima.enums.ImportExportEnum;
+import org.chorem.lima.service.LimaServiceFactory;
import org.chorem.lima.ui.account.AccountView;
import org.chorem.lima.ui.accountsreports.AccountsReportsView;
import org.chorem.lima.ui.balance.BalanceView;
@@ -54,7 +57,11 @@
import org.chorem.lima.ui.vatreports.VatReportView;
import org.chorem.lima.util.ErrorHelper;
-import java.awt.Desktop;
+import javax.swing.JButton;
+import javax.swing.JTabbedPane;
+import java.awt.Component;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
import java.net.URL;
import java.util.Locale;
@@ -158,7 +165,7 @@
public void showConfig(JAXXContext context) {
MainView ui = getUI(context);
- LimaConfig config = context.getContextValue(LimaConfig.class);
+ LimaConfig config = ui.getConfig();
//TODO pepin 2010-08-20 add all options
@@ -178,35 +185,41 @@
helper.displayUI(ui, false);
}
- public void showHelp(JAXXContext context, String helpId) {
+// public void showHelp(JAXXContext context, String helpId) {
+//
+// }
+//
+// public void closeHelp(JAXXContext context) {
+//
+// }
- }
+ public void gotoSite(JAXXContext context) {
- public void closeHelp(JAXXContext context) {
+ LimaConfig config = getUI(context).getConfig();
- }
-
- public void gotoSite(JAXXContext rootContext) {
-
- LimaConfig config = rootContext.getContextValue(LimaConfig.class);
-
URL siteURL = config.getOptionAsURL("application.site.url");
-
- log.info("goto " + siteURL);
- if (Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) {
- try {
- Desktop.getDesktop().browse(siteURL.toURI());
- } catch (Exception ex) {
- if (log.isDebugEnabled()) {
- log.error("Can't open lima website", ex);
- }
- ErrorHelper.showErrorDialog("Can't open lima website", ex);
- }
+ String url = siteURL.toString();
+ try {
+ SwingUtil.openLink(url);
+ } catch (Exception e) {
+ ErrorHelper.showErrorDialog("Can't open lima website at " + url, 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(MainView ui) {
+ public void showAbout(JAXXContext context) {
+ MainView ui = getUI(context);
AboutPanel about = new AboutPanel();
about.setTitle(_("lima.title.about"));
about.setAboutText(_("lima.title.about.description"));
@@ -227,7 +240,7 @@
protected void reloadUI(LimaContext rootContext, boolean fullscreen) {
// must remove all properties listener on config
- rootContext.getContextValue(LimaConfig.class).removeJaxxPropertyChangeListener();
+ LimaContext.CONFIG_DEF.getContextValue(rootContext).removeJaxxPropertyChangeListener();
// scan main ui
MainView ui = getUI(rootContext);
@@ -278,7 +291,7 @@
public void showHomeView(JAXXContext rootContext) {
MainView mainView = getUI(rootContext);
HomeView homeView = new HomeView(mainView);
- mainView.showTab(_("lima.tab.home"), homeView, false);
+ showTab(mainView, _("lima.tab.home"), homeView, false);
}
public void showIdentity(JAXXContext rootContext) {
@@ -291,152 +304,224 @@
/**
* Show account tree table view to create or modify accounts
*
- * @param rootContext
+ * @param rootContext the root application context
*/
public void showAccountView(JAXXContext rootContext) {
MainView mainView = getUI(rootContext);
AccountView accountView = new AccountView(mainView);
- mainView.showTab(_("lima.charts.account"), accountView);
+ showTab(mainView, _("lima.charts.account"), accountView);
}
/**
* Show account tree table view to create or modify accounts
*
- * @param rootContext
+ * @param rootContext the root application context
*/
public void showEntryBookView(JAXXContext rootContext) {
MainView mainView = getUI(rootContext);
EntryBookView entryBookView = new EntryBookView(mainView);
- mainView.showTab(_("lima.common.entrybooks"), entryBookView);
+ showTab(mainView, _("lima.common.entrybooks"), entryBookView);
}
/**
* Show fiscal period view to create or block a period
*
- * @param rootContext
+ * @param rootContext the root application context
*/
public void showFiscalPeriodView(JAXXContext rootContext) {
MainView mainView = getUI(rootContext);
FiscalPeriodView fiscalPeriodView = new FiscalPeriodView(mainView);
- mainView.showTab(_("lima.charts.fiscalyear"), fiscalPeriodView);
+ showTab(mainView, _("lima.charts.fiscalyear"), fiscalPeriodView);
}
/**
* Show financial period view to create or block a period
*
- * @param rootContext
+ * @param rootContext the root application context
*/
public void showFinancialPeriodView(JAXXContext rootContext) {
MainView mainView = getUI(rootContext);
FinancialPeriodView financialPeriodView =
new FinancialPeriodView(mainView);
- mainView.showTab(_("lima.charts.financialperiod"), financialPeriodView);
+ showTab(mainView, _("lima.charts.financialperiod"), financialPeriodView);
}
/**
* Show financial statement view to generate balance sheet and income statement
*
- * @param rootContext
+ * @param rootContext the root application context
*/
public void showFinancialStatementView(JAXXContext rootContext) {
MainView mainView = getUI(rootContext);
FinancialStatementChartView financialStatementView =
new FinancialStatementChartView(mainView);
- mainView.showTab(_("lima.charts.financialstatement"), financialStatementView);
+ showTab(mainView, _("lima.charts.financialstatement"), financialStatementView);
}
/**
* Show vat chart to generate vat document
*
- * @param rootContext
+ * @param rootContext the root application context
*/
public void showVatChartView(JAXXContext rootContext) {
MainView mainView = getUI(rootContext);
VatChartView vatChartView = new VatChartView(mainView);
- mainView.showTab(_("lima.charts.vatstatement"), vatChartView);
+ showTab(mainView, _("lima.charts.vatstatement"), vatChartView);
}
/**
* Show account table report to view an account on a period
*
- * @param rootContext
+ * @param rootContext the root application context
*/
public void showAccountReports(JAXXContext rootContext) {
MainView mainView = getUI(rootContext);
AccountsReportsView accountsReportsView =
new AccountsReportsView(mainView);
- mainView.showTab(_("lima.reports.accounts"), accountsReportsView);
+ showTab(mainView, _("lima.reports.accounts"), accountsReportsView);
}
/**
* Show entry book table report to view an account on a period
*
- * @param rootContext
+ * @param rootContext the root application context
*/
public void showEntryBookReports(JAXXContext rootContext) {
MainView mainView = getUI(rootContext);
- EntryBooksReportsView entryBooksReportsView = new EntryBooksReportsView(mainView);
- mainView.showTab(_("lima.reports.entrybooks"), entryBooksReportsView);
+ EntryBooksReportsView entryBooksReportsView =
+ new EntryBooksReportsView(mainView);
+ showTab(mainView, _("lima.reports.entrybooks"), entryBooksReportsView);
}
/**
* Show financial transactions view to create entries
*
- * @param rootContext
+ * @param rootContext the root application context
*/
public void showTransactionView(JAXXContext rootContext) {
MainView mainView = getUI(rootContext);
- FinancialTransactionView transactionView = new FinancialTransactionView(mainView);
- mainView.showTab(_("lima.entries.writetransaction"), transactionView);
+ FinancialTransactionView transactionView =
+ new FinancialTransactionView(mainView);
+ showTab(mainView, _("lima.entries.writetransaction"),
+ transactionView);
}
public void showTransactionUnbalancedView(JAXXContext rootContext) {
MainView mainView = getUI(rootContext);
- FinancialTransactionUnbalancedView searchResultView = new FinancialTransactionUnbalancedView(mainView);
- mainView.showTab(_("lima.entries.searchunbalancedtransaction"), searchResultView);
+ FinancialTransactionUnbalancedView searchResultView =
+ new FinancialTransactionUnbalancedView(mainView);
+ showTab(mainView, _("lima.entries.searchunbalancedtransaction"),
+ searchResultView);
}
public void showTransactionSearchView(JAXXContext rootContext) {
MainView mainView = getUI(rootContext);
- FinancialTransactionSearchView searchView = new FinancialTransactionSearchView(mainView);
- mainView.showTab(_("lima.entries.searchtransaction"), searchView);
+ FinancialTransactionSearchView searchView =
+ new FinancialTransactionSearchView(mainView);
+ showTab(mainView, _("lima.entries.searchtransaction"), searchView);
}
public void showLetteringView(JAXXContext rootContext) {
MainView mainView = getUI(rootContext);
LetteringView letteringView = new LetteringView(mainView);
- mainView.showTab(_("lima.entries.lettering"), letteringView);
+ showTab(mainView, _("lima.entries.lettering"), letteringView);
}
public void showBalanceView(JAXXContext rootContext) {
MainView mainView = getUI(rootContext);
BalanceView balanceView = new BalanceView(mainView);
- mainView.showTab(_("lima.reports.balance"), balanceView);
+ showTab(mainView, _("lima.reports.balance"), balanceView);
}
public void showLedgerView(JAXXContext rootContext) {
MainView mainView = getUI(rootContext);
LedgerView ledgerView = new LedgerView(mainView);
- mainView.showTab(_("lima.reports.ledger"), ledgerView);
+ showTab(mainView, _("lima.reports.ledger"), ledgerView);
}
public void showFinancialStatementReportsView(JAXXContext rootContext) {
MainView mainView = getUI(rootContext);
- FinancialStatementReportView financialStatementReportView = new FinancialStatementReportView(mainView);
- mainView.showTab(_("lima.reports.financialstatement"), financialStatementReportView);
+ FinancialStatementReportView financialStatementReportView =
+ new FinancialStatementReportView(mainView);
+ showTab(mainView, _("lima.reports.financialstatement"),
+ financialStatementReportView);
}
public void showVatReportView(JAXXContext rootContext) {
MainView mainView = getUI(rootContext);
VatReportView vatReportView = new VatReportView(mainView);
- mainView.showTab(_("lima.reports.vat"), vatReportView);
+ showTab(mainView, _("lima.reports.vat"), vatReportView);
}
- public void showImportExportView(JAXXContext rootContext, ImportExportEnum type) {
+ public void showImportExportView(JAXXContext rootContext,
+ ImportExportEnum type) {
MainView mainView = getUI(rootContext);
ImportExport importExport = ImportExport.getInstance(mainView);
importExport.importExport(type, "", true);
}
+
+ public void loadURI(MainView ui) {
+ int port = LimaServiceFactory.getService(
+ HttpServerServiceMonitorable.class).getHttpPort();
+ String address = LimaConfig.getInstance().getHostAdress();
+ String url = "http://" + address + ":" + port + "/";
+
+ try {
+ SwingUtil.openLink(url);
+ } catch (Exception e) {
+ ErrorHelper.showErrorDialog("Can't open lima website at " + url, e);
+ }
+ }
+
+ /**
+ * Show a new closable tab.
+ *
+ * @param ui main ui
+ * @param name name of tab to show
+ * @param container the tab container
+ * @param canClose {@code false} if tab can't be closed
+ */
+ protected void showTab(MainView ui,
+ String name,
+ Component container,
+ boolean canClose) {
+ final JTabbedPane contentTabbedPane = ui.getContentTabbedPane();
+
+ // if contentTabbedPane doesnot yet contains tab
+ if (contentTabbedPane.indexOfTab(name) == -1) {
+ ClosableTabHeader closableHeader = new ClosableTabHeader();
+ closableHeader.setTitle(name);
+ closableHeader.setCanClose(canClose);
+ contentTabbedPane.addTab(name, container);
+ contentTabbedPane.setSelectedComponent(container);
+ contentTabbedPane.setTabComponentAt(
+ contentTabbedPane.indexOfTab(name), closableHeader);
+ closableHeader.getCloseTab().addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ JButton button = (JButton) e.getSource();
+ ClosableTabHeader closableTab =
+ (ClosableTabHeader) button.getParent();
+ String name = closableTab.getTitle();
+ contentTabbedPane.remove(contentTabbedPane.indexOfTab(name));
+ }
+ });
+ // if contentTabbedPane contains tab
+ } else {
+ contentTabbedPane.setSelectedIndex(contentTabbedPane.indexOfTab(name));
+ }
+ }
+
+ /**
+ * Show a new closable tab.
+ *
+ * @param ui main ui
+ * @param name name of tab to show
+ * @param container the tab container
+ */
+ protected void showTab(MainView ui, String name, Component container) {
+ showTab(ui, name, container, true);
+ }
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountTreeTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountTreeTableModel.java 2011-09-20 14:47:53 UTC (rev 3294)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountTreeTableModel.java 2011-09-20 14:51:40 UTC (rev 3295)
@@ -64,8 +64,7 @@
super(new AccountImpl());
// Gets factory service
accountService =
- LimaServiceFactory.getInstance().getService(
- AccountServiceMonitorable.class);
+ LimaServiceFactory.getService(AccountServiceMonitorable.class);
}
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 2011-09-20 14:47:53 UTC (rev 3294)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java 2011-09-20 14:51:40 UTC (rev 3295)
@@ -68,17 +68,12 @@
protected AccountViewHandler(AccountView view) {
this.view = view;
// Gets factory service
- LimaServiceFactory.getInstance().getService(
- ImportServiceMonitorable.class).addServiceListener(this);
- accountService =
- LimaServiceFactory.getInstance().getService(
- AccountServiceMonitorable.class);
+ LimaServiceFactory.addServiceListener(ImportServiceMonitorable.class, this);
+ accountService = LimaServiceFactory.getService(AccountServiceMonitorable.class);
}
/**
* Add new account with account form.
- *
- * @throws LimaException
*/
public void addAccount() {
@@ -140,8 +135,6 @@
}
}
- ;
-
public void addSubLedger() {
JXTreeTable accountsTreeTable = view.getAccountsTreeTable();
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 2011-09-20 14:47:53 UTC (rev 3294)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/UpdateAccountForm.jaxx 2011-09-20 14:51:40 UTC (rev 3295)
@@ -48,7 +48,7 @@
protected void performOk() {
if (getMasterAccountTextField().getText().length() != 0) {
AccountServiceMonitorable accountService =
- LimaServiceFactory.getInstance().getService(
+ LimaServiceFactory.getService(
AccountServiceMonitorable.class);
Account masterAccount = new AccountImpl();
try {
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 2011-09-20 14:47:53 UTC (rev 3294)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/UpdateSubLedgerForm.jaxx 2011-09-20 14:51:40 UTC (rev 3295)
@@ -48,7 +48,7 @@
protected void performOk() {
if (getMasterAccountTextField().getText().length() != 0) {
AccountServiceMonitorable accountService =
- LimaServiceFactory.getInstance().getService(
+ LimaServiceFactory.getService(
AccountServiceMonitorable.class);
Account masterAccount = new AccountImpl();
try {
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsPeriodSearchPanel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsPeriodSearchPanel.java 2011-09-20 14:47:53 UTC (rev 3294)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsPeriodSearchPanel.java 2011-09-20 14:51:40 UTC (rev 3295)
@@ -31,9 +31,9 @@
import org.chorem.lima.entity.FinancialPeriod;
import org.chorem.lima.entity.FiscalPeriod;
import org.chorem.lima.enums.ComboBoxDatesEnum;
+import org.chorem.lima.ui.LimaRendererUtil;
import org.chorem.lima.ui.combobox.FinancialPeriodComboBoxModel;
import org.chorem.lima.ui.combobox.FiscalPeriodComboBoxModel;
-import org.chorem.lima.ui.renderers.RendererUtil;
import org.jdesktop.swingx.JXDatePicker;
import javax.swing.JComboBox;
@@ -111,7 +111,7 @@
case FISCAL_PERIOD:
FiscalPeriodComboBoxModel fiscalModel = new FiscalPeriodComboBoxModel(true);
ListCellRenderer renderer =
- RendererUtil.newDecoratorListCellRenderer(FiscalPeriod.class);
+ LimaRendererUtil.newDecoratorListCellRenderer(FiscalPeriod.class);
final JComboBox fiscalPeriod = new JComboBox(fiscalModel);
fiscalPeriod.setRenderer(renderer);
fiscalPeriod.setEditable(false);
@@ -134,7 +134,7 @@
case FINANCIAL_PERIOD:
FinancialPeriodComboBoxModel financialModel = new FinancialPeriodComboBoxModel(true);
- renderer = RendererUtil.newDecoratorListCellRenderer(FinancialPeriod.class);
+ renderer = LimaRendererUtil.newDecoratorListCellRenderer(FinancialPeriod.class);
final JComboBox financialPeriod = new JComboBox(financialModel);
financialPeriod.setRenderer(renderer);
financialPeriod.setEditable(false);
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsViewHandler.java 2011-09-20 14:47:53 UTC (rev 3294)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsViewHandler.java 2011-09-20 14:51:40 UTC (rev 3295)
@@ -77,12 +77,11 @@
this.view = view;
reportService =
- LimaServiceFactory.getInstance().getService(
- ReportServiceMonitorable.class);
- LimaServiceFactory.getInstance().getService(
- ImportServiceMonitorable.class).addServiceListener(this);
- LimaServiceFactory.getInstance().getService(
- FinancialTransactionServiceMonitorable.class).addServiceListener(this);
+ LimaServiceFactory.getService(ReportServiceMonitorable.class);
+ LimaServiceFactory.addServiceListener(
+ ImportServiceMonitorable.class, this);
+ LimaServiceFactory.addServiceListener(
+ FinancialTransactionServiceMonitorable.class, this);
}
public void setBeginDate(Date date) {
@@ -110,7 +109,7 @@
selectedBeginDate, selectedEndDate);
} catch (LimaException eee) {
if (log.isErrorEnabled()) {
- log.debug("Can't update model", eee);
+ log.error("Can't update model", eee);
}
ErrorHelper.showErrorDialog(_("lima.accountsreports.listerror"), eee);
}
@@ -140,7 +139,7 @@
view.amountSoldeLabel.setText(amountSolde.toString());
- if (amountSolde == BigDecimal.ZERO) {
+ if (BigDecimal.ZERO.equals(amountSolde)) {
view.soldeLabel.setText(_("lima.common.solde"));
} else {
// set label solde: credit or debit
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalancePeriodSearchPanel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalancePeriodSearchPanel.java 2011-09-20 14:47:53 UTC (rev 3294)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalancePeriodSearchPanel.java 2011-09-20 14:51:40 UTC (rev 3295)
@@ -31,9 +31,9 @@
import org.chorem.lima.entity.FinancialPeriod;
import org.chorem.lima.entity.FiscalPeriod;
import org.chorem.lima.enums.ComboBoxDatesEnum;
+import org.chorem.lima.ui.LimaRendererUtil;
import org.chorem.lima.ui.combobox.FinancialPeriodComboBoxModel;
import org.chorem.lima.ui.combobox.FiscalPeriodComboBoxModel;
-import org.chorem.lima.ui.renderers.RendererUtil;
import org.jdesktop.swingx.JXDatePicker;
import javax.swing.JComboBox;
@@ -112,7 +112,7 @@
case FISCAL_PERIOD:
FiscalPeriodComboBoxModel fiscalModel = new FiscalPeriodComboBoxModel(true);
ListCellRenderer renderer =
- RendererUtil.newDecoratorListCellRenderer(FiscalPeriod.class);
+ LimaRendererUtil.newDecoratorListCellRenderer(FiscalPeriod.class);
final JComboBox fiscalPeriod = new JComboBox(fiscalModel);
fiscalPeriod.setRenderer(renderer);
@@ -137,7 +137,7 @@
case FINANCIAL_PERIOD:
FinancialPeriodComboBoxModel financialModel = new FinancialPeriodComboBoxModel(true);
renderer =
- RendererUtil.newDecoratorListCellRenderer(FinancialPeriod.class);
+ LimaRendererUtil.newDecoratorListCellRenderer(FinancialPeriod.class);
final JComboBox financialPeriod = new JComboBox(financialModel);
financialPeriod.setRenderer(renderer);
financialPeriod.setEditable(false);
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceViewHandler.java 2011-09-20 14:47:53 UTC (rev 3294)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceViewHandler.java 2011-09-20 14:51:40 UTC (rev 3295)
@@ -96,17 +96,14 @@
this.view = view;
reportService =
- LimaServiceFactory.getInstance().getService(
- ReportServiceMonitorable.class);
- port = LimaServiceFactory.getInstance().getService(
+ LimaServiceFactory.getService(ReportServiceMonitorable.class);
+ port = LimaServiceFactory.getService(
HttpServerServiceMonitorable.class).getHttpPort();
fiscalPeriodService =
- LimaServiceFactory.getInstance().getService(
+ LimaServiceFactory.getService(
FiscalPeriodServiceMonitorable.class);
- LimaServiceFactory.getInstance().getService(
- ImportServiceMonitorable.class).addServiceListener(this);
- LimaServiceFactory.getInstance().getService(
- FinancialTransactionServiceMonitorable.class).addServiceListener(this);
+ LimaServiceFactory.addServiceListener(ImportServiceMonitorable.class, this);
+ LimaServiceFactory.addServiceListener(FinancialTransactionServiceMonitorable.class, this);
}
@@ -137,7 +134,7 @@
results = reportService.generateBalanceTrial(selectedBeginDate, selectedEndDate, selectedAccounts, false, view.getMovmentedFilter().isSelected());
} catch (LimaException eee) {
if (log.isErrorEnabled()) {
- log.debug("Can't update model", eee);
+ log.error("Can't update model", eee);
}
ErrorHelper.showErrorDialog(_("lima.balance.listerror"), eee);
}
@@ -191,7 +188,7 @@
blockedFiscalPeriods = fiscalPeriodService.getAllBlockedFiscalPeriods();
} catch (LimaException eee) {
if (log.isErrorEnabled()) {
- log.debug("Enable to create document ", eee);
+ log.error("Enable to create document ", eee);
}
ErrorHelper.showErrorDialog(_("lima.balance.documentcreationerror"), eee);
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/EntryBookTableCellEditor.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/EntryBookTableCellEditor.java 2011-09-20 14:47:53 UTC (rev 3294)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/EntryBookTableCellEditor.java 2011-09-20 14:51:40 UTC (rev 3295)
@@ -28,8 +28,8 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.entity.EntryBook;
+import org.chorem.lima.ui.LimaRendererUtil;
import org.chorem.lima.ui.combobox.EntryBookComboBoxModel;
-import org.chorem.lima.ui.renderers.RendererUtil;
import org.chorem.lima.util.EntryBookToString;
import org.chorem.lima.widgets.JWideComboBox;
import org.jdesktop.swingx.autocomplete.AutoCompleteDecorator;
@@ -63,7 +63,7 @@
EntryBookComboBoxModel entryBookComboBoxModel = new EntryBookComboBoxModel();
comboBox.setModel(entryBookComboBoxModel);
ListCellRenderer renderer =
- RendererUtil.newDecoratorListCellRenderer(EntryBook.class);
+ LimaRendererUtil.newDecoratorListCellRenderer(EntryBook.class);
comboBox.setRenderer(renderer);
// AutoCompletion
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/LetterTableCellEditor.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/LetterTableCellEditor.java 2011-09-20 14:47:53 UTC (rev 3294)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/LetterTableCellEditor.java 2011-09-20 14:51:40 UTC (rev 3295)
@@ -29,8 +29,8 @@
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.entity.Account;
import org.chorem.lima.entity.Letter;
+import org.chorem.lima.ui.LimaRendererUtil;
import org.chorem.lima.ui.combobox.LetterComboBoxModel;
-import org.chorem.lima.ui.renderers.RendererUtil;
import org.chorem.lima.util.LetterToString;
import org.chorem.lima.widgets.JWideComboBox;
import org.jdesktop.swingx.autocomplete.AutoCompleteDecorator;
@@ -64,7 +64,7 @@
LetterComboBoxModel comboBoxModel = new LetterComboBoxModel();
comboBox.setModel(comboBoxModel);
ListCellRenderer renderer =
- RendererUtil.newDecoratorListCellRenderer(Letter.class);
+ LimaRendererUtil.newDecoratorListCellRenderer(Letter.class);
comboBox.setRenderer(renderer);
AutoCompleteDecorator.decorate(comboBox, LetterToString.getInstance());
comboBox.getEditor().getEditorComponent().addKeyListener(this);
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/AccountComboBoxModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/AccountComboBoxModel.java 2011-09-20 14:47:53 UTC (rev 3294)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/AccountComboBoxModel.java 2011-09-20 14:51:40 UTC (rev 3295)
@@ -31,6 +31,7 @@
import org.chorem.lima.business.ImportServiceMonitorable;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.business.ServiceListener;
+import org.chorem.lima.business.ejbinterface.AccountService;
import org.chorem.lima.entity.Account;
import org.chorem.lima.service.LimaServiceFactory;
import org.chorem.lima.ui.financialperiod.FinancialPeriodTableModel;
@@ -52,15 +53,14 @@
protected List<Account> datasCache;
- protected AccountServiceMonitorable accountService;
+ protected AccountService accountService;
public AccountComboBoxModel() {
accountService =
- LimaServiceFactory.getInstance().getService(
+ LimaServiceFactory.getService(
AccountServiceMonitorable.class);
- accountService.addServiceListener(this);
- LimaServiceFactory.getInstance().getService(
- ImportServiceMonitorable.class).addServiceListener(this);
+ LimaServiceFactory.addServiceListener(accountService, this);
+ LimaServiceFactory.addServiceListener(ImportServiceMonitorable.class, this);
datasCache = getDataList();
}
@@ -106,7 +106,8 @@
@Override
public void notifyMethod(String serviceName, String methodeName) {
- if (methodeName.contains("Account") || methodeName.contains("importAll")) {
+ if (methodeName.contains("Account") ||
+ methodeName.contains("importAll")) {
refresh();
}
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/EntryBookComboBoxModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/EntryBookComboBoxModel.java 2011-09-20 14:47:53 UTC (rev 3294)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/EntryBookComboBoxModel.java 2011-09-20 14:51:40 UTC (rev 3295)
@@ -31,6 +31,7 @@
import org.chorem.lima.business.ImportServiceMonitorable;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.business.ServiceListener;
+import org.chorem.lima.business.ejbinterface.EntryBookService;
import org.chorem.lima.entity.EntryBook;
import org.chorem.lima.service.LimaServiceFactory;
import org.chorem.lima.ui.financialperiod.FinancialPeriodTableModel;
@@ -57,17 +58,15 @@
protected Object selectedEntryBook;
- protected EntryBookServiceMonitorable entryBookService;
+ protected EntryBookService entryBookService;
protected List<EntryBook> cacheDatas;
public EntryBookComboBoxModel() {
entryBookService =
- LimaServiceFactory.getInstance().getService(
- EntryBookServiceMonitorable.class);
- entryBookService.addServiceListener(this);
- LimaServiceFactory.getInstance().getService(
- ImportServiceMonitorable.class).addServiceListener(this);
+ LimaServiceFactory.getService(EntryBookServiceMonitorable.class);
+ LimaServiceFactory.addServiceListener(EntryBookServiceMonitorable.class, this);
+ LimaServiceFactory.addServiceListener(ImportServiceMonitorable.class, this);
cacheDatas = getDataList();
}
Deleted: trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/EntryBookRenderer.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/EntryBookRenderer.java 2011-09-20 14:47:53 UTC (rev 3294)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/EntryBookRenderer.java 2011-09-20 14:51:40 UTC (rev 3295)
@@ -1,65 +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%
- */
-
-package org.chorem.lima.ui.combobox;
-
-import org.chorem.lima.entity.EntryBook;
-
-import javax.swing.DefaultListCellRenderer;
-import javax.swing.JLabel;
-import javax.swing.JList;
-import java.awt.Component;
-
-@Deprecated
-public class EntryBookRenderer extends DefaultListCellRenderer {
-
- private static final long serialVersionUID = 1L;
-
- @Override
- public Component getListCellRendererComponent(JList list,
- Object value,
- int index,
- boolean isSelected,
- boolean cellHasFocus) {
-
- JLabel label = (JLabel) super.getListCellRendererComponent(list,
- value,
- index,
- isSelected,
- cellHasFocus
- );
- String text;
- if (value == null) {
- text = "\t";
- } else {
- EntryBook entrybook = (EntryBook) value;
- text = entrybook.getCode() + " - " + entrybook.getLabel();
- }
- label.setText(text);
- return this;
- }
-
-
-}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FinancialPeriodComboBoxModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FinancialPeriodComboBoxModel.java 2011-09-20 14:47:53 UTC (rev 3294)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FinancialPeriodComboBoxModel.java 2011-09-20 14:51:40 UTC (rev 3295)
@@ -32,6 +32,7 @@
import org.chorem.lima.business.ImportServiceMonitorable;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.business.ServiceListener;
+import org.chorem.lima.business.ejbinterface.FinancialPeriodService;
import org.chorem.lima.entity.FinancialPeriod;
import org.chorem.lima.entity.FiscalPeriod;
import org.chorem.lima.service.LimaServiceFactory;
@@ -61,7 +62,7 @@
protected List<FinancialPeriod> datasCache;
- protected FinancialPeriodServiceMonitorable financialPeriodService;
+ protected FinancialPeriodService financialPeriodService;
protected FiscalPeriod selectedFiscalPeriod;
@@ -75,7 +76,7 @@
/**
* Constructor for period list.
*
- * @param all if {@code true}, display all available period, otherwize
+ * @param displayAllPeriods if {@code true}, display all available period, otherwize
* display only locked ones
*/
public FinancialPeriodComboBoxModel(boolean displayAllPeriods) {
@@ -83,13 +84,11 @@
this.displayAllPeriods = displayAllPeriods;
financialPeriodService =
- LimaServiceFactory.getInstance().getService(
+ LimaServiceFactory.getService(
FinancialPeriodServiceMonitorable.class);
- financialPeriodService.addServiceListener(this);
- LimaServiceFactory.getInstance().getService(
- FiscalPeriodServiceMonitorable.class).addServiceListener(this);
- LimaServiceFactory.getInstance().getService(
- ImportServiceMonitorable.class).addServiceListener(this);
+ LimaServiceFactory.addServiceListener(financialPeriodService, this);
+ LimaServiceFactory.addServiceListener(FiscalPeriodServiceMonitorable.class, this);
+ LimaServiceFactory.addServiceListener(ImportServiceMonitorable.class, this);
if (displayAllPeriods) {
datasCache = getAllDataList();
} else {
@@ -97,7 +96,7 @@
}
}
- public void setFiscalPeriod(FiscalPeriod fiscalPeriod) {
+ public void setSelectedFiscalPeriod(FiscalPeriod fiscalPeriod) {
selectedFiscalPeriod = fiscalPeriod;
if (displayAllPeriods) {
datasCache = getAllDataList();
@@ -161,7 +160,6 @@
return result;
}
-
public void refresh() {
datasCache = getDataList();
fireContentsChanged(this, 0, datasCache.size());
Deleted: trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FinancialPeriodComboBoxRenderer.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FinancialPeriodComboBoxRenderer.java 2011-09-20 14:47:53 UTC (rev 3294)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FinancialPeriodComboBoxRenderer.java 2011-09-20 14:51:40 UTC (rev 3295)
@@ -1,65 +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%
- */
-
-package org.chorem.lima.ui.combobox;
-
-import org.chorem.lima.entity.FinancialPeriod;
-
-import javax.swing.DefaultListCellRenderer;
-import javax.swing.JLabel;
-import javax.swing.JList;
-import java.awt.Component;
-import java.text.SimpleDateFormat;
-
-@Deprecated
-public class FinancialPeriodComboBoxRenderer extends DefaultListCellRenderer {
-
- private static final long serialVersionUID = 1L;
-
- SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd MMM yy");
-
- @Override
- public Component getListCellRendererComponent(JList list,
- Object value,
- int index,
- boolean isSelected,
- boolean cellHasFocus) {
-
- JLabel label = (JLabel) super.getListCellRendererComponent(list,
- value,
- index,
- isSelected,
- cellHasFocus
- );
- if (value != null) {
- FinancialPeriod financialPeriod = (FinancialPeriod) value;
-
- label.setText(simpleDateFormat.format(financialPeriod.getBeginDate()) + " - " + simpleDateFormat.format(financialPeriod.getEndDate()));
- }
- return label;
- }
-
-
-}
\ No newline at end of file
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FiscalPeriodComboBoxModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FiscalPeriodComboBoxModel.java 2011-09-20 14:47:53 UTC (rev 3294)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FiscalPeriodComboBoxModel.java 2011-09-20 14:51:40 UTC (rev 3295)
@@ -31,6 +31,7 @@
import org.chorem.lima.business.ImportServiceMonitorable;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.business.ServiceListener;
+import org.chorem.lima.business.ejbinterface.FiscalPeriodService;
import org.chorem.lima.entity.FiscalPeriod;
import org.chorem.lima.service.LimaServiceFactory;
import org.chorem.lima.ui.financialperiod.FinancialPeriodTableModel;
@@ -47,29 +48,27 @@
protected Object selectedFiscalPeriod;
- protected FiscalPeriodServiceMonitorable fiscalPeriodService;
+ protected FiscalPeriodService fiscalPeriodService;
protected List<FiscalPeriod> datasCache;
//constructor for blocked fiscal period only
public FiscalPeriodComboBoxModel() {
fiscalPeriodService =
- LimaServiceFactory.getInstance().getService(
+ LimaServiceFactory.getService(
FiscalPeriodServiceMonitorable.class);
- fiscalPeriodService.addServiceListener(this);
- LimaServiceFactory.getInstance().getService(
- ImportServiceMonitorable.class).addServiceListener(this);
+ LimaServiceFactory.addServiceListener(fiscalPeriodService, this);
+ LimaServiceFactory.addServiceListener(ImportServiceMonitorable.class, this);
datasCache = getDataList();
}
//constructor for all fiscal period
public FiscalPeriodComboBoxModel(boolean all) {
fiscalPeriodService =
- LimaServiceFactory.getInstance().getService(
+ LimaServiceFactory.getService(
FiscalPeriodServiceMonitorable.class);
- fiscalPeriodService.addServiceListener(this);
- LimaServiceFactory.getInstance().getService(
- ImportServiceMonitorable.class).addServiceListener(this);
+ LimaServiceFactory.addServiceListener(fiscalPeriodService, this);
+ LimaServiceFactory.addServiceListener(ImportServiceMonitorable.class, this);
datasCache = getAllDataList();
}
Deleted: trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FiscalPeriodComboBoxRenderer.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FiscalPeriodComboBoxRenderer.java 2011-09-20 14:47:53 UTC (rev 3294)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FiscalPeriodComboBoxRenderer.java 2011-09-20 14:51:40 UTC (rev 3295)
@@ -1,66 +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%
- */
-
-package org.chorem.lima.ui.combobox;
-
-import org.chorem.lima.entity.FiscalPeriod;
-
-import javax.swing.DefaultListCellRenderer;
-import javax.swing.JLabel;
-import javax.swing.JList;
-import java.awt.Component;
-import java.text.SimpleDateFormat;
-
-@Deprecated
-public class FiscalPeriodComboBoxRenderer extends DefaultListCellRenderer {
-
- private static final long serialVersionUID = 1L;
-
- SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd MMM yy");
-
- @Override
- public Component getListCellRendererComponent(JList list,
- Object value,
- int index,
- boolean isSelected,
- boolean cellHasFocus) {
-
- JLabel label = (JLabel) super.getListCellRendererComponent(list,
- value,
- index,
- isSelected,
- cellHasFocus
- );
- if (value != null) {
- FiscalPeriod fiscalPeriod = (FiscalPeriod) value;
-
- label.setText(simpleDateFormat.format(fiscalPeriod.getBeginDate())
- + " - " + simpleDateFormat.format(fiscalPeriod.getEndDate()));
- }
- return label;
- }
-
-
-}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/LetterComboBoxModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/LetterComboBoxModel.java 2011-09-20 14:47:53 UTC (rev 3294)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/LetterComboBoxModel.java 2011-09-20 14:51:40 UTC (rev 3295)
@@ -31,6 +31,7 @@
import org.chorem.lima.business.ImportServiceMonitorable;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.business.ServiceListener;
+import org.chorem.lima.business.ejbinterface.FinancialTransactionService;
import org.chorem.lima.entity.Letter;
import org.chorem.lima.service.LimaServiceFactory;
import org.chorem.lima.ui.financialperiod.FinancialPeriodTableModel;
@@ -52,15 +53,14 @@
protected List<Letter> datasCache;
- protected FinancialTransactionServiceMonitorable service;
+ protected FinancialTransactionService service;
public LetterComboBoxModel() {
service =
- LimaServiceFactory.getInstance().getService(
+ LimaServiceFactory.getService(
FinancialTransactionServiceMonitorable.class);
- service.addServiceListener(this);
- LimaServiceFactory.getInstance().getService(
- ImportServiceMonitorable.class).addServiceListener(this);
+ LimaServiceFactory.addServiceListener(service, this);
+ LimaServiceFactory.addServiceListener(ImportServiceMonitorable.class, this);
datasCache = getDataList();
}
Deleted: trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/LetterRenderer.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/LetterRenderer.java 2011-09-20 14:47:53 UTC (rev 3294)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/LetterRenderer.java 2011-09-20 14:51:40 UTC (rev 3295)
@@ -1,56 +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%
- */
-
-package org.chorem.lima.ui.combobox;
-
-import org.chorem.lima.entity.Letter;
-
-import javax.swing.DefaultListCellRenderer;
-import javax.swing.JLabel;
-import javax.swing.JList;
-import java.awt.Component;
-
-@Deprecated
-public class LetterRenderer extends DefaultListCellRenderer {
-
- private static final long serialVersionUID = 1L;
-
- @Override
- public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
-
- JLabel label = (JLabel) super.getListCellRendererComponent(list,
- value,
- index,
- isSelected,
- cellHasFocus
- );
- if (value != null) {
- Letter letter = (Letter) value;
- label.setText(letter.getCode());
- }
- return label;
- }
-
-}
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 2011-09-20 14:47:53 UTC (rev 3294)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/SubAccountComboBoxModel.java 2011-09-20 14:51:40 UTC (rev 3295)
@@ -31,6 +31,7 @@
import org.chorem.lima.business.ImportServiceMonitorable;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.business.ServiceListener;
+import org.chorem.lima.business.ejbinterface.AccountService;
import org.chorem.lima.entity.Account;
import org.chorem.lima.service.LimaServiceFactory;
@@ -51,15 +52,13 @@
protected List<Account> datasCache;
- protected AccountServiceMonitorable accountService;
+ protected AccountService accountService;
public SubAccountComboBoxModel() {
accountService =
- LimaServiceFactory.getInstance().getService(
- AccountServiceMonitorable.class);
- accountService.addServiceListener(this);
- LimaServiceFactory.getInstance().getService(
- ImportServiceMonitorable.class).addServiceListener(this);
+ LimaServiceFactory.getService(AccountServiceMonitorable.class);
+ LimaServiceFactory.addServiceListener(accountService, this);
+ LimaServiceFactory.addServiceListener(ImportServiceMonitorable.class, this);
datasCache = getDataList();
}
@@ -104,7 +103,8 @@
@Override
public void notifyMethod(String serviceName, String methodeName) {
- if (serviceName.contains("Account") || methodeName.contains("importAll")) {
+ if (serviceName.contains("Account") ||
+ methodeName.contains("importAll")) {
refresh();
}
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookTableModel.java 2011-09-20 14:47:53 UTC (rev 3294)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookTableModel.java 2011-09-20 14:51:40 UTC (rev 3295)
@@ -62,9 +62,9 @@
/** Constructor. */
public EntryBookTableModel() {
entryBookService =
- LimaServiceFactory.getInstance().getService(
+ LimaServiceFactory.getService(
EntryBookServiceMonitorable.class);
- LimaServiceFactory.getInstance().getService(ImportServiceMonitorable.class).addServiceListener(this);
+ LimaServiceFactory.addServiceListener(ImportServiceMonitorable.class, this);
}
@Override
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 2011-09-20 14:47:53 UTC (rev 3294)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookViewHandler.java 2011-09-20 14:51:40 UTC (rev 3295)
@@ -63,7 +63,7 @@
public EntryBookViewHandler(EntryBookView view) {
this.view = view;
entryBookService =
- LimaServiceFactory.getInstance().getService(
+ LimaServiceFactory.getService(
EntryBookServiceMonitorable.class);
}
@@ -91,7 +91,7 @@
if (log.isErrorEnabled()) {
log.error("Can't add entry book", eee);
}
- DialogHelper.showMessageDialog(eee.getMessage());
+ DialogHelper.showErrorMessageDialog(view, eee);
}
}
}
@@ -122,7 +122,7 @@
if (log.isErrorEnabled()) {
log.error("Can't add update book", eee);
}
- DialogHelper.showMessageDialog(eee.getMessage());
+ DialogHelper.showErrorMessageDialog(view, eee);
}
}
@@ -151,7 +151,7 @@
if (log.isErrorEnabled()) {
log.error("Can't delete update book", eee);
}
- DialogHelper.showMessageDialog(eee.getMessage());
+ DialogHelper.showErrorMessageDialog(view, eee);
}
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBookComboBox.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBookComboBox.java 2011-09-20 14:47:53 UTC (rev 3294)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBookComboBox.java 2011-09-20 14:51:40 UTC (rev 3295)
@@ -28,8 +28,8 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.entity.EntryBook;
+import org.chorem.lima.ui.LimaRendererUtil;
import org.chorem.lima.ui.combobox.EntryBookComboBoxModel;
-import org.chorem.lima.ui.renderers.RendererUtil;
import org.chorem.lima.util.EntryBookToString;
import org.jdesktop.swingx.autocomplete.AutoCompleteDecorator;
@@ -51,7 +51,7 @@
this.handler = handler;
EntryBookComboBoxModel entryBookComboBoxModel = new EntryBookComboBoxModel();
setModel(entryBookComboBoxModel);
- setRenderer(RendererUtil.newDecoratorListCellRenderer(EntryBook.class));
+ setRenderer(LimaRendererUtil.newDecoratorListCellRenderer(EntryBook.class));
setEditable(true);
AutoCompleteDecorator.decorate(this, EntryBookToString.getInstance());
getEditor().getEditorComponent().addKeyListener(this);
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsPeriodSearchPanel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsPeriodSearchPanel.java 2011-09-20 14:47:53 UTC (rev 3294)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsPeriodSearchPanel.java 2011-09-20 14:51:40 UTC (rev 3295)
@@ -31,9 +31,9 @@
import org.chorem.lima.entity.FinancialPeriod;
import org.chorem.lima.entity.FiscalPeriod;
import org.chorem.lima.enums.ComboBoxDatesEnum;
+import org.chorem.lima.ui.LimaRendererUtil;
import org.chorem.lima.ui.combobox.FinancialPeriodComboBoxModel;
import org.chorem.lima.ui.combobox.FiscalPeriodComboBoxModel;
-import org.chorem.lima.ui.renderers.RendererUtil;
import org.jdesktop.swingx.JXDatePicker;
import javax.swing.JComboBox;
@@ -111,7 +111,7 @@
case FISCAL_PERIOD:
FiscalPeriodComboBoxModel fiscalModel = new FiscalPeriodComboBoxModel(true);
ListCellRenderer renderer =
- RendererUtil.newDecoratorListCellRenderer(FiscalPeriod.class);
+ LimaRendererUtil.newDecoratorListCellRenderer(FiscalPeriod.class);
final JComboBox fiscalPeriod = new JComboBox(fiscalModel);
fiscalPeriod.setRenderer(renderer);
@@ -136,7 +136,7 @@
case FINANCIAL_PERIOD:
FinancialPeriodComboBoxModel financialModel = new FinancialPeriodComboBoxModel(true);
renderer =
- RendererUtil.newDecoratorListCellRenderer(FinancialPeriod.class);
+ LimaRendererUtil.newDecoratorListCellRenderer(FinancialPeriod.class);
final JComboBox financialPeriod = new JComboBox(financialModel);
financialPeriod.setRenderer(renderer);
financialPeriod.setEditable(false);
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsViewHandler.java 2011-09-20 14:47:53 UTC (rev 3294)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsViewHandler.java 2011-09-20 14:51:40 UTC (rev 3295)
@@ -98,20 +98,18 @@
this.view = view;
reportService =
- LimaServiceFactory.getInstance().getService(
+ LimaServiceFactory.getService(
ReportServiceMonitorable.class);
- port = LimaServiceFactory.getInstance().getService(
+ port = LimaServiceFactory.getService(
HttpServerServiceMonitorable.class).getHttpPort();
documentService =
- LimaServiceFactory.getInstance().getService(
+ LimaServiceFactory.getService(
DocumentServiceMonitorable.class);
fiscalPeriodService =
- LimaServiceFactory.getInstance().getService(
+ LimaServiceFactory.getService(
FiscalPeriodServiceMonitorable.class);
- LimaServiceFactory.getInstance().getService(
- ImportServiceMonitorable.class).addServiceListener(this);
- LimaServiceFactory.getInstance().getService(
- FinancialTransactionServiceMonitorable.class).addServiceListener(this);
+ LimaServiceFactory.addServiceListener(ImportServiceMonitorable.class, this);
+ LimaServiceFactory.addServiceListener(FinancialTransactionServiceMonitorable.class, this);
}
public void setBeginDate(Date date) {
@@ -139,7 +137,7 @@
selectedEntryBook, selectedBeginDate, selectedEndDate);
} catch (LimaException eee) {
if (log.isErrorEnabled()) {
- log.debug("Can't update model", eee);
+ log.error("Can't update model", eee);
}
ErrorHelper.showErrorDialog(_("lima.entrybooksreports.listerror"), eee);
}
@@ -169,7 +167,7 @@
BigDecimal amountSolde = datasList.getAmountSolde();
view.amountSoldeLabel.setText(String.valueOf(amountSolde));
- if (amountSolde == BigDecimal.ZERO) {
+ if (BigDecimal.ZERO.equals(amountSolde)) {
view.soldeLabel.setText(_("lima.common.solde"));
} else {
// set label solde: credit or debit
@@ -194,7 +192,7 @@
blockedFiscalPeriods = fiscalPeriodService.getAllBlockedFiscalPeriods();
} catch (LimaException eee) {
if (log.isErrorEnabled()) {
- log.debug("Enable to create document ", eee);
+ log.error("Enable to create document ", eee);
}
ErrorHelper.showErrorDialog(_("lima.entrybooksreports.documentcreationerror"), eee);
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodTable.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodTable.java 2011-09-20 14:47:53 UTC (rev 3294)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodTable.java 2011-09-20 14:51:40 UTC (rev 3295)
@@ -75,7 +75,7 @@
model = this.handler.getView().modelFinancialPeriodTable;
financialPeriodService =
- LimaServiceFactory.getInstance().getService(
+ LimaServiceFactory.getService(
FinancialPeriodServiceMonitorable.class);
//highlight financial financial transactions
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodTableModel.java 2011-09-20 14:47:53 UTC (rev 3294)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodTableModel.java 2011-09-20 14:51:40 UTC (rev 3295)
@@ -71,12 +71,10 @@
public FinancialPeriodTableModel() {
financialPeriodService =
- LimaServiceFactory.getInstance().getService(
+ LimaServiceFactory.getService(
FinancialPeriodServiceMonitorable.class);
- LimaServiceFactory.getInstance().getService(
- ImportServiceMonitorable.class).addServiceListener(this);
- LimaServiceFactory.getInstance().getService(
- FiscalPeriodServiceMonitorable.class).addServiceListener(this);
+ LimaServiceFactory.addServiceListener(ImportServiceMonitorable.class, this);
+ LimaServiceFactory.addServiceListener(FiscalPeriodServiceMonitorable.class, this);
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartTreeTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartTreeTableModel.java 2011-09-20 14:47:53 UTC (rev 3294)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartTreeTableModel.java 2011-09-20 14:51:40 UTC (rev 3295)
@@ -63,7 +63,7 @@
super(new FinancialStatementImpl());
// Gets factory service
financialStatementService =
- LimaServiceFactory.getInstance().getService(
+ LimaServiceFactory.getService(
FinancialStatementServiceMonitorable.class);
}
@@ -216,7 +216,7 @@
* Add FinancialStatement(path can be null).
*
* @param path
- * @param account
+ * @param financialStatement
* @throws LimaException
*/
public void addFinancialStatement(TreePath path, FinancialStatement financialStatement) throws LimaException {
@@ -236,7 +236,7 @@
* Update financialStatement
*
* @param path
- * @param account
+ * @param financialStatement
* @throws LimaException
*/
public void updateFinancialStatement(TreePath path, FinancialStatement financialStatement) throws LimaException {
@@ -250,7 +250,7 @@
* Remove financialStatement
*
* @param path
- * @param object
+ * @param financialStatement
* @throws LimaException
*/
public void removeFinancialStatementObject(TreePath path, FinancialStatement financialStatement) throws LimaException {
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 2011-09-20 14:47:53 UTC (rev 3294)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartViewHandler.java 2011-09-20 14:51:40 UTC (rev 3295)
@@ -69,10 +69,9 @@
this.view = view;
financialStatementService =
- LimaServiceFactory.getInstance().getService(
+ LimaServiceFactory.getService(
FinancialStatementServiceMonitorable.class);
- LimaServiceFactory.getInstance().getService(
- ImportServiceMonitorable.class).addServiceListener(this);
+ LimaServiceFactory.addServiceListener(ImportServiceMonitorable.class, this);
}
/** Add new account with account form. */
@@ -111,7 +110,7 @@
if (log.isErrorEnabled()) {
log.error("Can't add financialStatementHeader", eee);
}
- DialogHelper.showMessageDialog(eee.getMessage());
+ DialogHelper.showErrorMessageDialog(view, eee);
} catch (LimaException ex) {
if (log.isErrorEnabled()) {
@@ -122,8 +121,6 @@
}
}
- ;
-
public void addFinancialStatementMovement() {
JXTreeTable treeTable = view.getTreeTable();
@@ -154,12 +151,12 @@
if (log.isErrorEnabled()) {
log.error("Can't add FinancialStatementMovement", eee);
}
- DialogHelper.showMessageDialog(eee.getMessage());
+ DialogHelper.showErrorMessageDialog(view, eee);
} catch (LimaException eee) {
if (log.isErrorEnabled()) {
log.error("Can't add FinancialStatementMovement", eee);
}
- DialogHelper.showMessageDialog(eee.getMessage());
+ DialogHelper.showErrorMessageDialog(view, eee);
}
}
}
@@ -221,7 +218,7 @@
if (log.isErrorEnabled()) {
log.error("Can't add update", eee);
}
- DialogHelper.showMessageDialog(eee.getMessage());
+ DialogHelper.showErrorMessageDialog(view, eee);
}
}
}
@@ -254,7 +251,7 @@
if (log.isErrorEnabled()) {
log.error("Can't delete account", eee);
}
- DialogHelper.showMessageDialog(eee.getMessage());
+ DialogHelper.showErrorMessageDialog(view, eee);
}
}
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportPeriodSearchPanel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportPeriodSearchPanel.java 2011-09-20 14:47:53 UTC (rev 3294)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportPeriodSearchPanel.java 2011-09-20 14:51:40 UTC (rev 3295)
@@ -31,9 +31,9 @@
import org.chorem.lima.entity.FinancialPeriod;
import org.chorem.lima.entity.FiscalPeriod;
import org.chorem.lima.enums.ComboBoxDatesEnum;
+import org.chorem.lima.ui.LimaRendererUtil;
import org.chorem.lima.ui.combobox.FinancialPeriodComboBoxModel;
import org.chorem.lima.ui.combobox.FiscalPeriodComboBoxModel;
-import org.chorem.lima.ui.renderers.RendererUtil;
import org.jdesktop.swingx.JXDatePicker;
import javax.swing.JComboBox;
@@ -111,7 +111,7 @@
case FISCAL_PERIOD:
FiscalPeriodComboBoxModel fiscalModel = new FiscalPeriodComboBoxModel(true);
ListCellRenderer renderer =
- RendererUtil.newDecoratorListCellRenderer(FiscalPeriod.class);
+ LimaRendererUtil.newDecoratorListCellRenderer(FiscalPeriod.class);
final JComboBox fiscalPeriod = new JComboBox(fiscalModel);
fiscalPeriod.setRenderer(renderer);
fiscalPeriod.setEditable(false);
@@ -135,7 +135,7 @@
case FINANCIAL_PERIOD:
FinancialPeriodComboBoxModel financialModel = new FinancialPeriodComboBoxModel(true);
renderer =
- RendererUtil.newDecoratorListCellRenderer(FinancialPeriod.class);
+ LimaRendererUtil.newDecoratorListCellRenderer(FinancialPeriod.class);
final JComboBox financialPeriod = new JComboBox(financialModel);
financialPeriod.setRenderer(renderer);
financialPeriod.setEditable(false);
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableModel.java 2011-09-20 14:47:53 UTC (rev 3294)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableModel.java 2011-09-20 14:51:40 UTC (rev 3295)
@@ -36,6 +36,8 @@
import org.chorem.lima.business.ImportServiceMonitorable;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.business.ServiceListener;
+import org.chorem.lima.business.ejbinterface.DocumentService;
+import org.chorem.lima.business.ejbinterface.FinancialStatementService;
import org.chorem.lima.business.utils.DocumentsEnum;
import org.chorem.lima.business.utils.FormatsEnum;
import org.chorem.lima.service.LimaServiceFactory;
@@ -72,9 +74,9 @@
private static final Log log = LogFactory.getLog(FinancialStatementReportTableModel.class);
/** Services. */
- protected FinancialStatementServiceMonitorable financialStatementService;
+ protected FinancialStatementService financialStatementService;
- protected DocumentServiceMonitorable documentService;
+ protected DocumentService documentService;
/** DatePicker Begin Date. */
protected Date selectedBeginDate;
@@ -93,17 +95,15 @@
/** Constructor. */
public FinancialStatementReportTableModel() {
financialStatementService =
- LimaServiceFactory.getInstance().getService(
+ LimaServiceFactory.getService(
FinancialStatementServiceMonitorable.class);
- financialStatementService.addServiceListener(this);
- port = LimaServiceFactory.getInstance().getService(
+ LimaServiceFactory.addServiceListener(financialStatementService, this);
+ port = LimaServiceFactory.getService(
HttpServerServiceMonitorable.class).getHttpPort();
- LimaServiceFactory.getInstance().getService(
- ImportServiceMonitorable.class).addServiceListener(this);
- LimaServiceFactory.getInstance().getService(
- FinancialTransactionServiceMonitorable.class).addServiceListener(this);
- documentService = LimaServiceFactory.getInstance().getService(DocumentServiceMonitorable.class);
+ LimaServiceFactory.addServiceListener(ImportServiceMonitorable.class, this);
+ LimaServiceFactory.addServiceListener(FinancialTransactionServiceMonitorable.class, this);
+ documentService = LimaServiceFactory.getService(DocumentServiceMonitorable.class);
}
@Override
@@ -258,7 +258,7 @@
results = financialStatementService.financialStatementReport(selectedBeginDate, selectedEndDate);
} catch (LimaException eee) {
if (log.isErrorEnabled()) {
- log.debug("Can't update model", eee);
+ log.error("Can't update model", eee);
}
ErrorHelper.showErrorDialog(_("lima.financialstatementreport.listerror"), eee);
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportViewHandler.java 2011-09-20 14:47:53 UTC (rev 3294)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportViewHandler.java 2011-09-20 14:51:40 UTC (rev 3295)
@@ -64,7 +64,7 @@
protected FinancialStatementReportViewHandler(FinancialStatementReportView view) {
this.view = view;
fiscalPeriodService =
- LimaServiceFactory.getInstance().getService(
+ LimaServiceFactory.getService(
FiscalPeriodServiceMonitorable.class);
}
@@ -90,7 +90,7 @@
blockedFiscalPeriods = fiscalPeriodService.getAllBlockedFiscalPeriods();
} catch (LimaException eee) {
if (log.isErrorEnabled()) {
- log.debug("Enable to create document ", eee);
+ log.error("Enable to create document ", eee);
}
ErrorHelper.showErrorDialog("Enable to create document ", eee);
}
Deleted: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialPeriodComboBox.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialPeriodComboBox.java 2011-09-20 14:47:53 UTC (rev 3294)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialPeriodComboBox.java 2011-09-20 14:51:40 UTC (rev 3295)
@@ -1,69 +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%
- */
-
-package org.chorem.lima.ui.financialtransaction;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.chorem.lima.entity.FinancialPeriod;
-
-import javax.swing.JComboBox;
-
-public class FinancialPeriodComboBox extends JComboBox {
-
- private static final long serialVersionUID = 1L;
-
- private static final Log log =
- LogFactory.getLog(FinancialPeriodComboBox.class);
-
- protected FinancialTransactionViewHandler handler;
-
- public FinancialPeriodComboBox(FinancialTransactionViewHandler handler) {
- this.handler = handler;
- }
-
- public void back() {
- int row = getSelectedIndex();
- log.debug(row);
- if (row > 0) {
- setSelectedItem(getItemAt(row - 1));
- repaint();
- handler.tableModel.setFinancialPeriod((FinancialPeriod) getSelectedItem());
- }
- }
-
- public void next() {
- int size = getModel().getSize();
- int row = getSelectedIndex();
- log.debug(row);
-
- if (row < size - 1) {
- setSelectedItem(getItemAt(row + 1));
- repaint();
- //FIXME
- handler.tableModel.setFinancialPeriod((FinancialPeriod) getSelectedItem());
- }
- }
-}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTable.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTable.java 2011-09-20 14:47:53 UTC (rev 3294)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTable.java 2011-09-20 14:51:40 UTC (rev 3295)
@@ -25,8 +25,6 @@
package org.chorem.lima.ui.financialtransaction;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.chorem.lima.entity.Account;
import org.chorem.lima.entity.Entry;
import org.chorem.lima.entity.EntryBook;
@@ -46,10 +44,10 @@
import javax.swing.SwingWorker;
import java.awt.Color;
import java.awt.Component;
+import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
-import java.awt.event.KeyListener;
+import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
import java.math.BigDecimal;
import java.util.Date;
@@ -59,22 +57,19 @@
*
* @author jpepin
*/
-public class FinancialTransactionTable extends JXTable
- implements KeyListener, MouseListener {
+public class FinancialTransactionTable extends JXTable {
/** serialVersionUID. */
private static final long serialVersionUID = 3133690382049594727L;
- /** log. */
- private static final Log log = LogFactory
- .getLog(FinancialTransactionTable.class);
+// /** log. */
+// private static final Log log = LogFactory
+// .getLog(FinancialTransactionTable.class);
protected FinancialTransactionViewHandler handler;
- private Highlighter colorTransaction;
+// private ColorHighlighter colorBalance;
- private ColorHighlighter colorBalance;
-
private int x_tab;
private int y_tab;
@@ -83,41 +78,35 @@
this.handler = handler;
- addKeyListener(this);
- addMouseListener(this);
+ addKeyListener(new MyKeyAdapter());
+ addMouseListener(new MyMouseAdapter());
+
//Get new date editor
setDefaultEditor(Date.class, new DateTableCellEditor());
+
//Get new entry book editor
setDefaultEditor(EntryBook.class, new EntryBookTableCellEditor());
+
//Get new account editor
setDefaultEditor(Account.class, new AccountTableCellEditor());
+
//Get new amount editor
setDefaultEditor(BigDecimal.class, new BigDecimalTableCellEditor());
+
//Get new BigDecimal renderer
setDefaultRenderer(BigDecimal.class, new BigDecimalTableCellRenderer());
+
//get new String renderer for empty cells
setDefaultRenderer(String.class, new EmptyCellRenderer());
+
//get new Account renderer for empty cells
setDefaultRenderer(Account.class, new EmptyCellRenderer());
+
//get new EntryBook renderer for empty cells
setDefaultRenderer(EntryBook.class, new EmptyCellRenderer());
//highlight financial financial transactions
- addColorTransaction();
- // highlight unbalanced financial transactions
- addColorNonBalancedTransaction();
- }
-
- /**
- * Cette méthode permet de colorer toutes les transactions dans le tableau
- * afin de bien distinguer les transactions et entrées comptables.
- * On récupère la première cellule, on vérifie que c'est une date
- */
- protected void addColorTransaction() {
- if (colorTransaction != null) {
- removeHighlighter(colorTransaction);
- }
HighlightPredicate predicate = new HighlightPredicate() {
@Override
public boolean isHighlighted(Component renderer,
@@ -125,23 +114,15 @@
return adapter.getValueAt(adapter.row, 0) instanceof Date;
}
};
- colorTransaction =
+ Highlighter colorTransaction =
new ColorHighlighter(predicate, new Color(222, 222, 222), null);
addHighlighter(colorTransaction);
- }
-
-
- /**
- * Permet de surligner une transaction dans le tableau lorsque
- * cette dernière n'est pas équilibrée.
- * On récupère la dernière cellule de la ligne
- * et on vérifie si la valeur est différente de 0
- */
- protected void addColorNonBalancedTransaction() {
- if (colorBalance != null) {
- removeHighlighter(colorBalance);
- }
- HighlightPredicate predicate = new HighlightPredicate() {
+
+ // highlight unbalanced financial transactions
+// if (colorBalance != null) {
+// removeHighlighter(colorBalance);
+// }
+ predicate = new HighlightPredicate() {
@Override
public boolean isHighlighted(Component renderer,
ComponentAdapter adapter) {
@@ -163,186 +144,392 @@
addHighlighter(colorTransaction);
}
- /**
- * for each action combination key are think
- * for extend keyboard and laptop keyboard
- */
- @Override
- public void keyPressed(KeyEvent e) {
+ public FinancialTransactionViewHandler getHandler() {
+ return handler;
+ }
- //TODO combinaison de touches dans la config
+// /**
+// * Cette méthode permet de colorer toutes les transactions dans le tableau
+// * afin de bien distinguer les transactions et entrées comptables.
+// * On récupère la première cellule, on vérifie que c'est une date
+// */
+// protected void addColorTransaction() {
+// if (colorTransaction != null) {
+// removeHighlighter(colorTransaction);
+// }
+// HighlightPredicate predicate = new HighlightPredicate() {
+// @Override
+// public boolean isHighlighted(Component renderer,
+// ComponentAdapter adapter) {
+// return adapter.getValueAt(adapter.row, 0) instanceof Date;
+// }
+// };
+// colorTransaction =
+// new ColorHighlighter(predicate, new Color(222, 222, 222), null);
+// addHighlighter(colorTransaction);
+// }
- // delete selected row with the key : delete or ctrl + clear
- // ou de l'entree
- if (e.getKeyCode() == KeyEvent.VK_DELETE
- || e.getKeyCode() == KeyEvent.VK_CLEAR
- && e.getModifiers() == KeyEvent.CTRL_MASK) {
- handler.deleteSelectedRow();
- }
+// /**
+// * Permet de surligner une transaction dans le tableau lorsque
+// * cette dernière n'est pas équilibrée.
+// * On récupère la dernière cellule de la ligne
+// * et on vérifie si la valeur est différente de 0
+// */
+// protected void addColorNonBalancedTransaction() {
+// if (colorBalance != null) {
+// removeHighlighter(colorBalance);
+// }
+// HighlightPredicate predicate = new HighlightPredicate() {
+// @Override
+// public boolean isHighlighted(Component renderer,
+// ComponentAdapter adapter) {
+// boolean isHighlighted = false;
+// Object value = adapter.getValueAt(adapter.row, 8);
+// if (value instanceof BigDecimal) {
+// BigDecimal currentBalance = (BigDecimal) value;
+// // can compare two BigDecimals with different scales
+// // e.g: 3.1 == 3.10
+// if (currentBalance.compareTo(BigDecimal.ZERO) != 0) {
+// isHighlighted = true;
+// }
+// }
+// return isHighlighted;
+// }
+// };
+// colorTransaction =
+// new ColorHighlighter(predicate, new Color(255, 198, 209), null);
+// addHighlighter(colorTransaction);
+// }
- // add entry with the key combination : insert or ctrl + enter
- if (e.getKeyCode() == KeyEvent.VK_INSERT
- || e.getKeyCode() == KeyEvent.VK_ENTER
- && e.getModifiers() == KeyEvent.CTRL_MASK) {
- handler.addEmptyEntry();
- }
+// /**
+// * for each action combination key are think
+// * for extend keyboard and laptop keyboard
+// */
+// @Override
+// public void keyPressed(KeyEvent e) {
+//
+// //TODO combinaison de touches dans la config
+//
+// // delete selected row with the key : delete or ctrl + clear
+// // ou de l'entree
+// if (e.getKeyCode() == KeyEvent.VK_DELETE
+// || e.getKeyCode() == KeyEvent.VK_CLEAR
+// && e.getModifiers() == KeyEvent.CTRL_MASK) {
+// handler.deleteSelectedRow();
+// }
+//
+// // add entry with the key combination : insert or ctrl + enter
+// if (e.getKeyCode() == KeyEvent.VK_INSERT
+// || e.getKeyCode() == KeyEvent.VK_ENTER
+// && e.getModifiers() == KeyEvent.CTRL_MASK) {
+// handler.addEntry();
+// }
+//
+// // copy : ctrl + c
+//
+// // add financial transaction with the key combination : ctrl + c
+// if (e.getKeyCode() == KeyEvent.VK_C
+// && e.getModifiers() == KeyEvent.CTRL_MASK) {
+// handler.copyRow();
+// }
+//
+// // paste : ctrl + v
+//
+// // add financial transaction with the key combination : ctrl + v
+// if (e.getKeyCode() == KeyEvent.VK_V
+// && e.getModifiers() == KeyEvent.CTRL_MASK) {
+// handler.pasteRow();
+// }
+//
+// // add financial transaction with the key combination : ctrl + tab
+// if (e.getKeyCode() == KeyEvent.VK_TAB
+// && e.getModifiers() == KeyEvent.CTRL_MASK) {
+// handler.addFinancialTransaction();
+// }
+//
+// // clear row selection with the key: escape
+// if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
+// if (!isEditing()) {
+// clearSelection();
+// }
+// }
+//
+// /**
+// * Touche tab
+// * Incrémente le curseur de case tant que la case n'est pas editable
+// * Ajoute une entrée comptable si tab est sur
+// * la dernière cellule et si la transaction est non équilibré
+// * sinon rajoute une transaction
+// */
+//
+// if (e.getKeyChar() == KeyEvent.VK_TAB) {
+// int max_x = getColumnCount();
+// int max_y = getRowCount();
+// x_tab = getSelectedColumn();
+// y_tab = getSelectedRow();
+// Boolean end = true;
+//
+// if (x_tab < max_x - 1) {
+// x_tab++;
+// }
+// //end of row
+// else {
+// x_tab = 0;
+// y_tab++;
+// }
+//
+// //skip all cell while not editable or if end of table add entry or transaction or end of table
+// while (!isCellEditable(y_tab, x_tab) && end) {
+// //if end of row
+// if (x_tab == max_x - 1) {
+// Object object = handler.tableModel.getElementAt(y_tab);
+//
+// //if transaction, add entry
+// if (object instanceof FinancialTransaction) {
+// FinancialTransaction financialTransaction = (FinancialTransaction) object;
+// if (financialTransaction.getEntry().size() == 0) {
+// handler.addEntry();
+// setColumnSelectionInterval(1, 1);
+// }
+// }
+// //if entry
+// else {
+// //FIXME set value is doing after key pressed
+// // so update not terminated before get balanced
+// //Swing Worker stop the UI 500ms
+// // found best solution ?
+// final JXTable table = this;
+// final int y_t = y_tab;
+// final int m_t = max_y;
+// new SwingWorker<Void, Void>() {
+// @Override
+// protected Void doInBackground() throws InterruptedException {
+// Thread.sleep(500);
+// return null;
+// }
+//
+// @Override
+// protected void done() {
+// Object object = handler.tableModel.getElementAt(y_tab - 1);
+// FinancialTransaction financialTransaction = null;
+// if (object instanceof Entry) {
+// financialTransaction = ((Entry) object).getFinancialTransaction();
+// } else if (object instanceof FinancialTransaction) {
+// financialTransaction = (FinancialTransaction) object;
+// }
+// BigDecimal amountC = financialTransaction.getAmountCredit();
+// BigDecimal amountD = financialTransaction.getAmountDebit();
+// if (amountC == amountD) {
+// if (y_t == m_t - 1) {
+// handler.addFinancialTransaction();
+// table.setColumnSelectionInterval(0, 0);
+// }
+// } else {
+// handler.addEntry();
+// table.setColumnSelectionInterval(1, 1);
+// y_tab++;
+// // positionne la sélection sur la nouvelle ligne créée
+// table.setRowSelectionInterval(y_tab, y_tab);
+// x_tab = 0;
+// }
+// }
+// }.execute();
+// }
+// end = false;
+// } else {
+// if (x_tab < max_x) {
+// setRowSelectionInterval(y_tab, y_tab);
+// setColumnSelectionInterval(x_tab, x_tab);
+// x_tab++;
+// }
+// }
+// }
+// }
+// }
+//
+//
+// @Override
+// public void keyTyped(KeyEvent e) {
+// }
+//
+//
+// @Override
+// public void keyReleased(KeyEvent e) {
+// }
+//
+// @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) {
+// }
- // copy : ctrl + c
+ private class MyKeyAdapter extends KeyAdapter {
- // add financial transaction with the key combination : ctrl + c
- if (e.getKeyCode() == KeyEvent.VK_C
- && e.getModifiers() == KeyEvent.CTRL_MASK) {
- handler.copyRow();
- }
+ @Override
+ public void keyPressed(KeyEvent e) {
- // paste : ctrl + v
+ final FinancialTransactionViewHandler handler = getHandler();
- // add financial transaction with the key combination : ctrl + v
- if (e.getKeyCode() == KeyEvent.VK_V
- && e.getModifiers() == KeyEvent.CTRL_MASK) {
- handler.pasteRow();
- }
+ // delete selected row with the key : delete or ctrl + clear
+ // ou de l'entree
+ if (e.getKeyCode() == KeyEvent.VK_DELETE
+ || e.getKeyCode() == KeyEvent.VK_CLEAR
+ && e.getModifiers() == KeyEvent.CTRL_MASK) {
+ handler.deleteSelectedRow();
+ }
- // add financial transaction with the key combination : ctrl + tab
- if (e.getKeyCode() == KeyEvent.VK_TAB
- && e.getModifiers() == KeyEvent.CTRL_MASK) {
- handler.addFinancialTransaction();
- }
+ // add entry with the key combination : insert or ctrl + enter
+ if (e.getKeyCode() == KeyEvent.VK_INSERT
+ || e.getKeyCode() == KeyEvent.VK_ENTER
+ && e.getModifiers() == KeyEvent.CTRL_MASK) {
+ handler.addEntry();
+ }
- // clear row selection with the key: escape
- if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
- if (!isEditing()) {
- clearSelection();
+ // copy : ctrl + c
+
+ // add financial transaction with the key combination : ctrl + c
+ if (e.getKeyCode() == KeyEvent.VK_C
+ && e.getModifiers() == KeyEvent.CTRL_MASK) {
+ handler.copyRow(getSelectedRow());
}
- }
- /**
- * Touche tab
- * Incrémente le curseur de case tant que la case n'est pas editable
- * Ajoute une entrée comptable si tab est sur
- * la dernière cellule et si la transaction est non équilibré
- * sinon rajoute une transaction
- */
+ // paste : ctrl + v
- if (e.getKeyChar() == KeyEvent.VK_TAB) {
- int max_x = getColumnCount();
- int max_y = getRowCount();
- x_tab = getSelectedColumn();
- y_tab = getSelectedRow();
- Boolean end = true;
+ // add financial transaction with the key combination : ctrl + v
+ if (e.getKeyCode() == KeyEvent.VK_V
+ && e.getModifiers() == KeyEvent.CTRL_MASK) {
+ handler.pasteRow(getSelectedRow());
+ }
- if (x_tab < max_x - 1) {
- x_tab++;
+ // add financial transaction with the key combination : ctrl + tab
+ if (e.getKeyCode() == KeyEvent.VK_TAB
+ && e.getModifiers() == KeyEvent.CTRL_MASK) {
+ handler.addFinancialTransaction();
}
- //end of row
- else {
- x_tab = 0;
- y_tab++;
+
+ // clear row selection with the key: escape
+ if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
+ if (!isEditing()) {
+ clearSelection();
+ }
}
- //skip all cell while not editable or if end of table add entry or transaction or end of table
- while (!isCellEditable(y_tab, x_tab) && end) {
- //if end of row
- if (x_tab == max_x - 1) {
- Object object = handler.tableModel.getElementAt(y_tab);
+ /**
+ * Touche tab
+ * Incrémente le curseur de case tant que la case n'est pas editable
+ * Ajoute une entrée comptable si tab est sur
+ * la dernière cellule et si la transaction est non équilibré
+ * sinon rajoute une transaction
+ */
- //if transaction, add entry
- if (object instanceof FinancialTransaction) {
- FinancialTransaction financialTransaction = (FinancialTransaction) object;
- if (financialTransaction.getEntry().size() == 0) {
- handler.addEmptyEntry();
- setColumnSelectionInterval(1, 1);
+ if (e.getKeyChar() == KeyEvent.VK_TAB) {
+ int max_x = getColumnCount();
+ int max_y = getRowCount();
+ x_tab = getSelectedColumn();
+ y_tab = getSelectedRow();
+ Boolean end = true;
+
+ if (x_tab < max_x - 1) {
+ x_tab++;
+ }
+ //end of row
+ else {
+ x_tab = 0;
+ y_tab++;
+ }
+
+ //skip all cell while not editable or if end of table add entry or transaction or end of table
+ while (!isCellEditable(y_tab, x_tab) && end) {
+ //if end of row
+ if (x_tab == max_x - 1) {
+ Object object = handler.getTableModel().getElementAt(y_tab);
+
+ //if transaction, add entry
+ if (object instanceof FinancialTransaction) {
+ FinancialTransaction financialTransaction = (FinancialTransaction) object;
+ if (financialTransaction.getEntry().size() == 0) {
+ handler.addEntry();
+ setColumnSelectionInterval(1, 1);
+ }
}
- }
- //if entry
- else {
- //FIXME set value is doing after key pressed
- // so update not terminated before get balanced
- //Swing Worker stop the UI 500ms
- // found best solution ?
- final JXTable table = this;
- final int y_t = y_tab;
- final int m_t = max_y;
- new SwingWorker<Void, Void>() {
- @Override
- protected Void doInBackground() throws InterruptedException {
- Thread.sleep(500);
- return null;
- }
+ //if entry
+ else {
+ //FIXME set value is doing after key pressed
+ // so update not terminated before get balanced
+ //Swing Worker stop the UI 500ms
+ // found best solution ?
+ final int y_t = y_tab;
+ final int m_t = max_y;
+ new SwingWorker<Void, Void>() {
+ @Override
+ protected Void doInBackground() throws InterruptedException {
+ Thread.sleep(500);
+ return null;
+ }
- @Override
- protected void done() {
- Object object = handler.tableModel.getElementAt(y_tab - 1);
- FinancialTransaction financialTransaction = null;
- if (object instanceof Entry) {
- financialTransaction = ((Entry) object).getFinancialTransaction();
- } else if (object instanceof FinancialTransaction) {
- financialTransaction = (FinancialTransaction) object;
- }
- BigDecimal amountC = financialTransaction.getAmountCredit();
- BigDecimal amountD = financialTransaction.getAmountDebit();
- if (amountC == amountD) {
- if (y_t == m_t - 1) {
- handler.addFinancialTransaction();
- table.setColumnSelectionInterval(0, 0);
+ @Override
+ protected void done() {
+ Object object = handler.getTableModel().getElementAt(y_tab - 1);
+ FinancialTransaction financialTransaction = null;
+ if (object instanceof Entry) {
+ financialTransaction = ((Entry) object).getFinancialTransaction();
+ } else if (object instanceof FinancialTransaction) {
+ financialTransaction = (FinancialTransaction) object;
}
- } else {
- handler.addEmptyEntry();
- table.setColumnSelectionInterval(1, 1);
- y_tab++;
- // positionne la sélection sur la nouvelle ligne créée
- table.setRowSelectionInterval(y_tab, y_tab);
- x_tab = 0;
+ BigDecimal amountC = financialTransaction.getAmountCredit();
+ BigDecimal amountD = financialTransaction.getAmountDebit();
+ if (amountC == amountD) {
+ if (y_t == m_t - 1) {
+ handler.addFinancialTransaction();
+ setColumnSelectionInterval(0, 0);
+ }
+ } else {
+ handler.addEntry();
+ setColumnSelectionInterval(1, 1);
+ y_tab++;
+ // positionne la sélection sur la nouvelle ligne créée
+ setRowSelectionInterval(y_tab, y_tab);
+ x_tab = 0;
+ }
}
- }
- }.execute();
+ }.execute();
+ }
+ end = false;
+ } else {
+ if (x_tab < max_x) {
+ setRowSelectionInterval(y_tab, y_tab);
+ setColumnSelectionInterval(x_tab, x_tab);
+ x_tab++;
+ }
}
- end = false;
- } else {
- if (x_tab < max_x) {
- setRowSelectionInterval(y_tab, y_tab);
- setColumnSelectionInterval(x_tab, x_tab);
- x_tab++;
- }
}
}
}
-
-
}
-
- @Override
- public void keyTyped(KeyEvent e) {
-
- }
-
-
- @Override
- public void keyReleased(KeyEvent e) {
- }
-
- @Override
- public void mouseClicked(MouseEvent e) {
- }
-
- @Override
- public void mousePressed(MouseEvent e) {
- if (rowAtPoint(e.getPoint()) == -1) {
- clearSelection();
+ private class MyMouseAdapter extends MouseAdapter {
+ @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) {
- }
-
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTableModel.java 2011-09-20 14:47:53 UTC (rev 3294)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTableModel.java 2011-09-20 14:51:40 UTC (rev 3295)
@@ -33,6 +33,7 @@
import org.chorem.lima.business.LimaBusinessException;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.business.ServiceListener;
+import org.chorem.lima.business.ejbinterface.FinancialTransactionService;
import org.chorem.lima.business.utils.EntryComparator;
import org.chorem.lima.entity.Account;
import org.chorem.lima.entity.Entry;
@@ -43,7 +44,6 @@
import org.chorem.lima.entity.FinancialTransactionImpl;
import org.chorem.lima.entity.Letter;
import org.chorem.lima.service.LimaServiceFactory;
-import org.chorem.lima.util.DialogHelper;
import org.chorem.lima.util.ErrorHelper;
import javax.swing.table.AbstractTableModel;
@@ -65,13 +65,9 @@
* @author ore
* @author chatellier
* @version $Revision$
- * <p/>
- * Last update : $Date$
- * By : $Author$
*/
public class FinancialTransactionTableModel extends AbstractTableModel implements ServiceListener {
- /** serialVersionUID. */
private static final long serialVersionUID = 1L;
/** log. */
@@ -79,33 +75,22 @@
.getLog(FinancialTransactionTableModel.class);
/** Transaction service. */
- protected final FinancialTransactionServiceMonitorable financialTransactionService;
+ protected final FinancialTransactionService financialTransactionService;
/** selected financial period */
protected FinancialPeriod selectedFinancialPeriod;
/** data cache */
- protected List<Object> cacheDataList;
+ protected List<?> cacheDataList;
protected EntryBook selectedEntryBook;
- /**
- * collection
- * <p/>
- * <p/>
- * /**
- * Model constructor.
- * <p/>
- * Just init service proxies.
- */
public FinancialTransactionTableModel() {
/* Services */
- financialTransactionService =
- LimaServiceFactory.getInstance().getService(
- FinancialTransactionServiceMonitorable.class);
- financialTransactionService.addServiceListener(this);
- LimaServiceFactory.getInstance().getService(
- ImportServiceMonitorable.class).addServiceListener(this);
+ financialTransactionService = LimaServiceFactory.getService(
+ FinancialTransactionServiceMonitorable.class);
+ LimaServiceFactory.addServiceListener(financialTransactionService, this);
+ LimaServiceFactory.addServiceListener(ImportServiceMonitorable.class, this);
}
/**
@@ -113,7 +98,7 @@
*
* @return
*/
- protected List<Object> getDataList() {
+ protected List<?> getDataList() {
List<Object> results = new ArrayList<Object>();
if (selectedFinancialPeriod != null) {
try {
@@ -193,11 +178,9 @@
result = BigDecimal.class;
break;
}
-
return result;
}
-
@Override
public String getColumnName(int column) {
String result = "n/a";
@@ -231,15 +214,16 @@
result = _("lima.table.balance");
break;
}
-
return result;
}
@Override
public int getRowCount() {
- int result = 0;
+ int result;
- if (cacheDataList != null) {
+ if (cacheDataList == null) {
+ result = 0;
+ } else {
result = cacheDataList.size();
}
@@ -331,13 +315,15 @@
result = null;
break;
}
-
}
}
return result;
}
- public void setFinancialPeriod(FinancialPeriod financialPeriod) {
+ public void setSelectedFinancialPeriod(FinancialPeriod financialPeriod) {
+ if (log.isDebugEnabled()) {
+ log.debug("New selected financial period " + financialPeriod);
+ }
selectedFinancialPeriod = financialPeriod;
refresh();
}
@@ -374,6 +360,43 @@
}
/**
+ * Obtain the first entry book of the current transaction.
+ *
+ * @param selectedRow
+ * @return
+ */
+ public int getFirstEntry(int selectedRow) {
+ int result = -1;
+ int currentRow = selectedRow;
+ while (currentRow > -1) {
+ Object o = cacheDataList.get(currentRow);
+ if (o instanceof Entry) {
+
+ // current row is still a entry book
+ currentRow--;
+ continue;
+ }
+ if (o instanceof FinancialTransaction) {
+ // got the begin of a transaction
+ if (currentRow == selectedRow) {
+
+ // the selected row is on the transaction
+ //
+ // look out if there is a next line and if then look out if
+ // this is a entry book
+ result = -1;
+ } else {
+
+ // the next row is an entry book row
+ result = currentRow + 1;
+ }
+ break;
+ }
+ }
+ return result;
+ }
+
+ /**
* @return int: indexOf new FianancialTransaction
* @throws LimaException
*/
@@ -430,14 +453,15 @@
}
/**
- * @param value
* @param voucher
* @param description
* @param row
* @return int: indexOf new Entry
* @throws LimaException
*/
- public int addEmptyEntry(Object value, String voucher, String description, int row) throws LimaException {
+ public int addEmptyEntry(String voucher,
+ String description,
+ int row) throws LimaException {
FinancialTransaction currentTransaction = null;
Object currentRow = cacheDataList.get(row);
Entry entry = new EntryImpl();
@@ -468,13 +492,12 @@
}
/**
- * @param value
* @param entry
* @param row
* @return int: indexOf new Entry
* @throws LimaException
*/
- public int addEntry(Object value, Entry entry, int row) throws LimaException {
+ public int addEntry(Entry entry, int row) throws LimaException {
FinancialTransaction currentTransaction = null;
int financialTransactionRow = 0;
Object currentRow = cacheDataList.get(row);
@@ -528,33 +551,73 @@
currentFinancialTransaction.setEntryBook((EntryBook) value);
break;
}
- // notify service for modification
- try {
- financialTransactionService.
- updateFinancialTransaction(currentFinancialTransaction);
- } catch (LimaException eee) {
- if (log.isDebugEnabled()) {
- log.debug("Can't update financial transaction", eee);
- }
- DialogHelper.showMessageDialog(eee.getMessage());
- }
+ // update transaction
+ updateFinancialTransaction(currentFinancialTransaction);
+
//update the financial transaction in entire
financialTransactionRow =
getDataList().indexOf(currentRow);
} else if (currentRow instanceof Entry) {
Entry currentEntry = (Entry) currentRow;
+ FinancialTransaction financialTransaction =
+ currentEntry.getFinancialTransaction();
+ boolean updateTransaction = false;
switch (column) {
case 2:
- currentEntry.setVoucher(((String) value).trim());
+ String voucher = ((String) value).trim();
+
+ int firstEntryRow = getFirstEntry(row);
+ if (row == firstEntryRow) {
+
+ // let's update the voucher of all entries of
+ // the transaction
+
+ for (Entry entry : financialTransaction.getEntry()) {
+ entry.setVoucher(voucher);
+ }
+ updateTransaction = true;
+ } else {
+
+ // not on first row, just update this entry voucher
+ currentEntry.setVoucher(voucher);
+ }
break;
case 3:
Account account = (Account) value;
currentEntry.setAccount(account);
// let's copy the account description
- currentEntry.setDescription(account.getLabel());
+ String description1 = account.getLabel();
+ firstEntryRow = getFirstEntry(row);
+ if (row == firstEntryRow) {
+ // let's update the description of all entries of
+ // the transaction
+
+ for (Entry entry : financialTransaction.getEntry()) {
+ entry.setDescription(description1);
+ }
+ updateTransaction = true;
+ } else {
+ // not on first row, just update this entry description
+ currentEntry.setDescription(description1);
+ }
break;
case 4:
- currentEntry.setDescription(((String) value).trim());
+ String description = ((String) value).trim();
+ firstEntryRow = getFirstEntry(row);
+ if (row == firstEntryRow) {
+
+ // let's update the description of all entries of
+ // the transaction
+
+ for (Entry entry : financialTransaction.getEntry()) {
+ entry.setDescription(description);
+ }
+ updateTransaction = true;
+ } else {
+
+ // not on first row, just update this entry description
+ currentEntry.setDescription(description);
+ }
break;
case 5:
currentEntry.setLetter((Letter) value);
@@ -568,19 +631,19 @@
currentEntry.setDebit(false);
break;
}
- try {
- financialTransactionService.updateEntry(currentEntry);
+ if (updateTransaction) {
- } catch (LimaException eee) {
- if (log.isDebugEnabled()) {
- log.debug("Can't update entry", eee);
+ for (Entry entry : financialTransaction.getEntry()) {
+ updateEntry(entry);
}
- DialogHelper.showMessageDialog(eee.getMessage());
+ } else {
+
+ updateEntry(currentEntry);
}
+
//update the financial transaction in entire
financialTransactionRow =
- getDataList().indexOf(((Entry) currentRow).
- getFinancialTransaction());
+ getDataList().indexOf(financialTransaction);
}
//on recharge la liste
cacheDataList = getDataList();
@@ -588,6 +651,28 @@
}
}
+ protected void updateFinancialTransaction(FinancialTransaction transaction) {
+ try {
+ financialTransactionService.updateFinancialTransaction(transaction);
+ } catch (LimaException eee) {
+ if (log.isDebugEnabled()) {
+ log.debug("Can't update financial transaction", eee);
+ }
+ ErrorHelper.showErrorDialog("Can't update financial transaction", eee);
+ }
+ }
+
+ protected void updateEntry(Entry entry) {
+ try {
+ financialTransactionService.updateEntry(entry);
+ } catch (LimaException eee) {
+ if (log.isDebugEnabled()) {
+ log.debug("Can't update entry", eee);
+ }
+ ErrorHelper.showErrorDialog("Can't update entry", eee);
+ }
+ }
+
public Object getElementAt(int row) {
Object result = null;
if (cacheDataList != null) {
@@ -601,11 +686,10 @@
* <p/>
* Called by model.
*
- * @param object
* @param row
* @throws LimaException
*/
- public void removeObject(Object object, int row) throws LimaException {
+ public void removeObject(int row) throws LimaException {
Object currentRow = cacheDataList.get(row);
if (currentRow instanceof FinancialTransaction) {
FinancialTransaction currentTransaction =
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionView.jaxx 2011-09-20 14:47:53 UTC (rev 3294)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionView.jaxx 2011-09-20 14:51:40 UTC (rev 3295)
@@ -24,114 +24,84 @@
-->
<Table>
- <FinancialTransactionViewHandler id="handler"
- javaBean="new FinancialTransactionViewHandler(this)"/>
<import>
javax.swing.ListSelectionModel
org.chorem.lima.entity.FiscalPeriod
org.chorem.lima.entity.FinancialPeriod
org.chorem.lima.entity.EntryBook
- org.chorem.lima.LimaContext
org.chorem.lima.ui.combobox.FinancialPeriodComboBoxModel
org.chorem.lima.ui.combobox.FiscalPeriodComboBoxModel
- org.chorem.lima.ui.renderers.RendererUtil
+ org.chorem.lima.ui.LimaRendererUtil
</import>
+ <FinancialTransactionViewHandler id="handler" constructorParams="this"/>
<Boolean id="selectedRow" javaBean="false"/>
- <FiscalPeriodComboBoxModel id="modelFiscalPeriod"/>
- <FinancialPeriodComboBoxModel id="modelFinancialPeriod"/>
+ <FinancialTransactionTableModel id="financialTransactionTableModel"/>
+ <FiscalPeriodComboBoxModel id="fiscalPeriodComboBoxModel"/>
+ <FinancialPeriodComboBoxModel id="financialPeriodComboBoxModel"/>
<script>
<![CDATA[
void $afterCompleteSetup() {
- getHandler().initEntryBookModel(entryBookComboBox);
- getHandler().refresh();
+ handler.initEntryBookModel(entryBookComboBox);
+ handler.refresh();
}
-
]]>
</script>
<row weightx="1" weighty="0" anchor="center">
<cell anchor="east">
- <JLabel id="fiscalPeriodLabel" text="lima.charts.fiscalyear"/>
+ <JLabel id="fiscalPeriodLabel" text="lima.charts.fiscalyear"
+ labelFor='{fiscalPeriodComboBox}'/>
</cell>
<cell anchor="west">
<JComboBox id="fiscalPeriodComboBox"
- model="{getModelFiscalPeriod()}"
- renderer="{RendererUtil.newDecoratorListCellRenderer(FiscalPeriod.class)}"
- onActionPerformed="getModelFinancialPeriod().setFiscalPeriod((FiscalPeriod)fiscalPeriodComboBox.getSelectedItem())"
- editable="false"/>
+ model="{fiscalPeriodComboBoxModel}"
+ renderer="{LimaRendererUtil.newDecoratorListCellRenderer(FiscalPeriod.class)}"
+ onItemStateChanged="if ( event.getStateChange() == 1 ) financialPeriodComboBoxModel.setSelectedFiscalPeriod( (FiscalPeriod) event.getItem() );"/>
</cell>
<cell anchor="east">
- <JLabel id="financialPeriodLabel" text="lima.common.period"/>
+ <JLabel id="financialPeriodLabel" text="lima.common.period"
+ labelFor='{financialPeriodComboBox}'/>
</cell>
<cell anchor="west">
<JPanel>
- <FinancialPeriodComboBox id="financialPeriodComboBox"
- constructorParams="getHandler()"
- model="{getModelFinancialPeriod()}"
- renderer="{RendererUtil.newDecoratorListCellRenderer(FinancialPeriod.class)}"
- onActionPerformed="financialTransactionTableModel.setFinancialPeriod((FinancialPeriod)financialPeriodComboBox.getSelectedItem())"/>
+ <JComboBox id="financialPeriodComboBox"
+ model="{financialPeriodComboBoxModel}"
+ renderer="{LimaRendererUtil.newDecoratorListCellRenderer(FinancialPeriod.class)}"
+ onItemStateChanged="if ( event.getStateChange() == 1 ) financialTransactionTableModel.setSelectedFinancialPeriod( (FinancialPeriod) event.getItem() );"/>
<JButton id="back" text="lima.common.buttonback"
- onActionPerformed="financialPeriodComboBox.back()"/>
+ onActionPerformed="handler.back(financialPeriodComboBox)"/>
<JButton id="next" text="lima.common.buttonnext"
- onActionPerformed="financialPeriodComboBox.next()"/>
+ onActionPerformed="handler.next(financialPeriodComboBox)"/>
</JPanel>
</cell>
- <!--cell>
- <JButton id="back" text="lima.common.buttonback"
- onActionPerformed="financialPeriodComboBox.back()"/>
- </cell>
- <cell>
- <JButton id="next" text="lima.common.buttonnext"
- onActionPerformed="financialPeriodComboBox.next()"/>
- </cell-->
<cell anchor="east">
<JLabel id="entryBookComboBoxLabel" text="lima.common.entrybook"
labelFor='{entryBookComboBox}'/>
</cell>
<cell anchor="west">
<JComboBox id="entryBookComboBox"
- renderer="{RendererUtil.newDecoratorListCellRenderer(EntryBook.class)}"
- onActionPerformed="financialTransactionTableModel.setSelectedEntryBook((EntryBook)entryBookComboBox.getSelectedItem())"/>
+ renderer="{LimaRendererUtil.newDecoratorListCellRenderer(EntryBook.class)}"
+ onItemStateChanged="if ( event.getStateChange() == 1 ) financialTransactionTableModel.setSelectedEntryBook( (EntryBook) event.getItem() );"/>
</cell>
- <!--cell>
- <JButton text="lima.common.copy" enabled="{isSelectedRow()}"
- onActionPerformed="getHandler().copyRow()"/>
- </cell>
- <cell>
- <JButton text="lima.common.paste" enabled="{isSelectedRow()}"
- onActionPerformed="getHandler().pasteRow()"/>
- </cell>
- <cell>
- <JButton text="lima.entries.addTransaction"
- onActionPerformed="getHandler().addFinancialTransaction()"/>
- </cell>
- <cell>
- <JButton text="lima.entries.addEntry" enabled="{isSelectedRow()}"
- onActionPerformed="getHandler().addEmptyEntry()"/>
- </cell>
- <cell>
- <JButton text="lima.common.remove" enabled="{isSelectedRow()}"
- onActionPerformed="getHandler().deleteSelectedRow()"/>
- </cell-->
</row>
<row>
<cell weightx="1" columns="8">
<JToolBar floatable="false">
<JPanel layout='{new GridLayout(1,0)}'>
<JButton text="lima.common.copy" enabled="{isSelectedRow()}"
- onActionPerformed="getHandler().copyRow()"/>
+ onActionPerformed="handler.copyRow(financialTransactionTable.getSelectedRow())"/>
<JButton text="lima.common.paste" enabled="{isSelectedRow()}"
- onActionPerformed="getHandler().pasteRow()"/>
+ onActionPerformed="handler.pasteRow(financialTransactionTable.getSelectedRow())"/>
<JButton text="lima.entries.addTransaction"
- onActionPerformed="getHandler().addFinancialTransaction()"/>
+ onActionPerformed="handler.addFinancialTransaction()"/>
<JButton text="lima.entries.addEntry" enabled="{isSelectedRow()}"
- onActionPerformed="getHandler().addEmptyEntry()"/>
+ onActionPerformed="handler.addEntry()"/>
<JButton text="lima.common.remove" enabled="{isSelectedRow()}"
- onActionPerformed="getHandler().deleteSelectedRow()"/>
+ onActionPerformed="handler.deleteSelectedRow()"/>
</JPanel>
</JToolBar>
@@ -140,15 +110,14 @@
<row>
<cell fill="both" weightx="1" weighty="1" rows="3" columns="8">
<JScrollPane>
- <FinancialTransactionTableModel
- id="financialTransactionTableModel"/>
+
<FinancialTransactionTable
id="financialTransactionTable" sortable="false" rowHeight="22"
- constructorParams="getHandler()"
- model="{getFinancialTransactionTableModel()}"
- selectionMode="{ListSelectionModel.SINGLE_SELECTION}"/>
+ constructorParams='handler'
+ model='{financialTransactionTableModel}'
+ selectionMode='{ListSelectionModel.SINGLE_SELECTION}'/>
<ListSelectionModel
- javaBean="getFinancialTransactionTable().getSelectionModel()"
+ initializer="financialTransactionTable.getSelectionModel()"
onValueChanged="setSelectedRow(financialTransactionTable.getSelectedRow() != -1)"/>
</JScrollPane>
</cell>
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionViewHandler.java 2011-09-20 14:47:53 UTC (rev 3294)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionViewHandler.java 2011-09-20 14:51:40 UTC (rev 3295)
@@ -63,24 +63,31 @@
protected FinancialTransactionView view;
- protected FinancialTransactionTable table;
+ protected Object clipBoard;
- protected FinancialTransactionTableModel tableModel;
+ protected FinancialTransactionViewHandler(FinancialTransactionView view) {
+ this.view = view;
+ }
- protected FiscalPeriodComboBoxModel fiscalPeriodComboBoxModel;
+ public FinancialTransactionTable getTable() {
+ return view.getFinancialTransactionTable();
+ }
- protected FinancialPeriodComboBoxModel financialPeriodComboBoxModel;
+ public FinancialTransactionTableModel getTableModel() {
+ return view.getFinancialTransactionTableModel();
+ }
- protected Object clipBoard;
+ public FiscalPeriodComboBoxModel getFiscalPeriodComboBoxModel() {
+ return view.getFiscalPeriodComboBoxModel();
+ }
- protected FinancialTransactionViewHandler(FinancialTransactionView view) {
- this.view = view;
+ public FinancialPeriodComboBoxModel getFinancialPeriodComboBoxModel() {
+ return view.getFinancialPeriodComboBoxModel();
}
public void initEntryBookModel(JComboBox comboBox) {
EntryBookServiceMonitorable service =
- LimaServiceFactory.getInstance().getService(
- EntryBookServiceMonitorable.class);
+ LimaServiceFactory.getService(EntryBookServiceMonitorable.class);
try {
List<EntryBook> allEntryBooks = service.getAllEntryBooks();
allEntryBooks.add(0, null);
@@ -91,28 +98,23 @@
}
//copy entry
- public void copyRow() {
- table = view.getFinancialTransactionTable();
- int indexSelectedRow = table.getSelectedRow();
-
+ public void copyRow(int indexSelectedRow) {
if (indexSelectedRow != -1) {
- clipBoard = tableModel.getElementAt(indexSelectedRow);
+ clipBoard = getTableModel().getElementAt(indexSelectedRow);
}
}
//paste entry
- public void pasteRow() {
- table = view.getFinancialTransactionTable();
- int indexSelectedRow = table.getSelectedRow();
+ public void pasteRow(int indexSelectedRow) {
+ FinancialTransactionTable table = getTable();
+ FinancialTransactionTableModel tableModel = getTableModel();
if (indexSelectedRow != -1) {
- Object selectedValue = tableModel.getElementAt(indexSelectedRow);
if (clipBoard instanceof Entry) {
try {
- int index = tableModel.addEntry(selectedValue,
- (Entry) clipBoard,
- indexSelectedRow
- );
+ int index = tableModel.addEntry((Entry) clipBoard,
+ indexSelectedRow);
+
//select the new line
ListSelectionModel selectionModel =
table.getSelectionModel();
@@ -128,26 +130,23 @@
DialogHelper.showErrorMessageDialog(view, eee);
}
}
-
}
-
}
//add a new transaction
public void addFinancialTransaction() {
- table = view.getFinancialTransactionTable();
- tableModel = view.getFinancialTransactionTableModel();
+ FinancialTransactionTable table = getTable();
+ FinancialTransactionTableModel tableModel = getTableModel();
+ ListSelectionModel selectionModel = table.getSelectionModel();
try {
int index = tableModel.addFinancialTransaction();
//select the new line
int numberRow = table.getRowCount();
- ListSelectionModel selectionModel =
- table.getSelectionModel();
selectionModel.setSelectionInterval(numberRow - 1, numberRow - 1);
//focus on first column
table.changeSelection(index, 0, false, false);
- table.requestFocusInWindow();
+// table.requestFocusInWindow();
table.scrollCellToVisible(index, 0);
} catch (LimaException eee) {
if (log.isErrorEnabled()) {
@@ -159,33 +158,50 @@
//implement new transaction button
//add a new entry to the selected transaction
- public void addEmptyEntry() {
+ public void addEntry() {
- table = view.getFinancialTransactionTable();
- tableModel = view.getFinancialTransactionTableModel();
+ FinancialTransactionTable table = getTable();
+ FinancialTransactionTableModel tableModel = getTableModel();
+ ListSelectionModel selectionModel = table.getSelectionModel();
int indexSelectedRow = table.getSelectedRow();
if (indexSelectedRow != -1) {
- Object selectedValue = tableModel.getElementAt(indexSelectedRow);
- try {
- //copy + paste the voucher and the description
- String voucher = (String)
+
+ int firstentryBookrow =
+ tableModel.getFirstEntry(indexSelectedRow);
+
+ String voucher;
+ String description;
+ if (firstentryBookrow == -1) {
+
+ // no entry book for this transaction
+ voucher = null;
+ description = null;
+
+ } else {
+
+ // there is no first entry, grab the voucher and
+ voucher = (String)
tableModel.getValueAt(indexSelectedRow, 2);
- String description = (String)
+ description = (String)
tableModel.getValueAt(indexSelectedRow, 4);
- int index = tableModel.addEmptyEntry(selectedValue,
- voucher,
- description,
- indexSelectedRow
+ }
+ try {
+
+ // creates the new entry
+
+ int index = tableModel.addEmptyEntry(
+ voucher,
+ description,
+ indexSelectedRow
);
+
//select the new line
- ListSelectionModel selectionModel =
- table.getSelectionModel();
selectionModel.setSelectionInterval(
indexSelectedRow + 1, indexSelectedRow + 1);
//focus on second column
table.changeSelection(index, 1, false, false);
- table.requestFocusInWindow();
+// table.requestFocusInWindow();
} catch (LimaException eee) {
if (log.isErrorEnabled()) {
log.error("Can't add emptyentry", eee);
@@ -206,8 +222,8 @@
*/
public void deleteSelectedRow() {
- table = view.getFinancialTransactionTable();
- tableModel = view.getFinancialTransactionTableModel();
+ FinancialTransactionTable table = getTable();
+ FinancialTransactionTableModel tableModel = getTableModel();
int indexSelectedRow = table.getSelectedRow();
if (indexSelectedRow != -1) {
@@ -227,7 +243,7 @@
if (response == JOptionPane.YES_OPTION) {
try {
- tableModel.removeObject(selectedValue, indexSelectedRow);
+ tableModel.removeObject(indexSelectedRow);
//select the upper line
ListSelectionModel selectionModel =
table.getSelectionModel();
@@ -247,13 +263,36 @@
}
}
- public void refresh() {
- tableModel = view.getFinancialTransactionTableModel();
- tableModel.refresh();
- fiscalPeriodComboBoxModel = view.getModelFiscalPeriod();
- fiscalPeriodComboBoxModel.refresh();
+ public void back(JComboBox comboBox) {
+ int row = comboBox.getSelectedIndex();
+ if (log.isDebugEnabled()) {
+ log.debug(row);
+ }
- financialPeriodComboBoxModel = view.getModelFinancialPeriod();
- financialPeriodComboBoxModel.refresh();
+ if (row > 0) {
+ comboBox.setSelectedIndex(row - 1);
+ //FIXME tchemit-2011-09-20 Should never referesh ui by hand
+ comboBox.repaint();
+ }
}
+
+ public void next(JComboBox comboBox) {
+ int size = comboBox.getModel().getSize();
+ int row = comboBox.getSelectedIndex();
+ if (log.isDebugEnabled()) {
+ log.debug(row);
+ }
+
+ if (row < size - 1) {
+ comboBox.setSelectedIndex(row + 1);
+ //FIXME tchemit-2011-09-20 Should never referesh ui by hand
+ comboBox.repaint();
+ }
+ }
+
+ public void refresh() {
+ getTableModel().refresh();
+ getFiscalPeriodComboBoxModel().refresh();
+ getFinancialPeriodComboBoxModel().refresh();
+ }
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/EntryBookSearchComboBox.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/EntryBookSearchComboBox.java 2011-09-20 14:47:53 UTC (rev 3294)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/EntryBookSearchComboBox.java 2011-09-20 14:51:40 UTC (rev 3295)
@@ -28,8 +28,8 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.entity.EntryBook;
+import org.chorem.lima.ui.LimaRendererUtil;
import org.chorem.lima.ui.combobox.EntryBookComboBoxModel;
-import org.chorem.lima.ui.renderers.RendererUtil;
import org.chorem.lima.util.EntryBookToString;
import org.jdesktop.swingx.autocomplete.AutoCompleteDecorator;
@@ -52,7 +52,7 @@
this.handler = handler;
EntryBookComboBoxModel entryBookComboBoxModel = new EntryBookComboBoxModel();
ListCellRenderer renderer =
- RendererUtil.newDecoratorListCellRenderer(EntryBook.class);
+ LimaRendererUtil.newDecoratorListCellRenderer(EntryBook.class);
setModel(entryBookComboBoxModel);
setRenderer(renderer);
setEditable(true);
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionPeriodSearchPanel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionPeriodSearchPanel.java 2011-09-20 14:47:53 UTC (rev 3294)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionPeriodSearchPanel.java 2011-09-20 14:51:40 UTC (rev 3295)
@@ -31,9 +31,9 @@
import org.chorem.lima.entity.FinancialPeriod;
import org.chorem.lima.entity.FiscalPeriod;
import org.chorem.lima.enums.ComboBoxPeriodEnum;
+import org.chorem.lima.ui.LimaRendererUtil;
import org.chorem.lima.ui.combobox.FinancialPeriodComboBoxModel;
import org.chorem.lima.ui.combobox.FiscalPeriodComboBoxModel;
-import org.chorem.lima.ui.renderers.RendererUtil;
import org.jdesktop.swingx.JXDatePicker;
import javax.swing.JComboBox;
@@ -131,7 +131,7 @@
case FISCAL_PERIOD:
FiscalPeriodComboBoxModel fiscalModel = new FiscalPeriodComboBoxModel();
ListCellRenderer renderer =
- RendererUtil.newDecoratorListCellRenderer(FiscalPeriod.class);
+ LimaRendererUtil.newDecoratorListCellRenderer(FiscalPeriod.class);
final JComboBox fiscalPeriod = new JComboBox(fiscalModel);
fiscalPeriod.setRenderer(renderer);
fiscalPeriod.setEditable(false);
@@ -153,7 +153,7 @@
case FINANCIAL_PERIOD:
FinancialPeriodComboBoxModel financialModel = new FinancialPeriodComboBoxModel();
renderer =
- RendererUtil.newDecoratorListCellRenderer(FinancialPeriod.class);
+ LimaRendererUtil.newDecoratorListCellRenderer(FinancialPeriod.class);
final JComboBox financialPeriod = new JComboBox(financialModel);
financialPeriod.setRenderer(renderer);
financialPeriod.setEditable(false);
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchTable.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchTable.java 2011-09-20 14:47:53 UTC (rev 3294)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchTable.java 2011-09-20 14:51:40 UTC (rev 3295)
@@ -255,7 +255,7 @@
if (object instanceof FinancialTransaction){
FinancialTransaction financialTransaction = (FinancialTransaction) object;
if (financialTransaction.getEntry().size() == 0){
- handler.addEmptyEntry();
+ handler.addEntry();
this.setColumnSelectionInterval(1, 1);
}
}
@@ -291,7 +291,7 @@
}
}
else {
- handler.addEmptyEntry();
+ handler.addEntry();
table.setColumnSelectionInterval(1, 1);
y_tab++;
// positionne la sélection sur la nouvelle ligne créée
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchTableModel.java 2011-09-20 14:47:53 UTC (rev 3294)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchTableModel.java 2011-09-20 14:51:40 UTC (rev 3295)
@@ -34,6 +34,8 @@
import org.chorem.lima.business.LimaBusinessException;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.business.ServiceListener;
+import org.chorem.lima.business.ejbinterface.FinancialPeriodService;
+import org.chorem.lima.business.ejbinterface.FinancialTransactionService;
import org.chorem.lima.entity.Account;
import org.chorem.lima.entity.Entry;
import org.chorem.lima.entity.EntryBook;
@@ -77,10 +79,10 @@
.getLog(FinancialTransactionSearchTableModel.class);
/** Transaction service. */
- protected final FinancialTransactionServiceMonitorable financialTransactionService;
+ protected final FinancialTransactionService financialTransactionService;
/** Financial service */
- protected final FinancialPeriodServiceMonitorable financialPeriodService;
+ protected final FinancialPeriodService financialPeriodService;
/** selected financial period */
protected FiscalPeriod selectedFiscalPeriod;
@@ -99,11 +101,11 @@
public FinancialTransactionSearchTableModel() {
/* Services */
financialTransactionService =
- LimaServiceFactory.getInstance().getService(
+ LimaServiceFactory.getService(
FinancialTransactionServiceMonitorable.class);
- financialTransactionService.addServiceListener(this);
+ LimaServiceFactory.addServiceListener(financialTransactionService, this);
financialPeriodService =
- LimaServiceFactory.getInstance().getService(
+ LimaServiceFactory.getService(
FinancialPeriodServiceMonitorable.class);
}
@@ -374,7 +376,7 @@
throw new LimaException("Can't set new transaction");
}
financialTransaction.setFinancialPeriod(financialPeriod);
- //financialTransaction.setFinancialPeriod(selectedFiscalPeriod);
+ //financialTransaction.setSelectedFinancialPeriod(selectedFiscalPeriod);
// get today
Calendar actualCalendar = Calendar.getInstance();
// get the financial period date
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchViewHandler.java 2011-09-20 14:47:53 UTC (rev 3294)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchViewHandler.java 2011-09-20 14:51:40 UTC (rev 3295)
@@ -84,7 +84,7 @@
/* Services */
financialTransactionService =
- LimaServiceFactory.getInstance().getService(
+ LimaServiceFactory.getService(
FinancialTransactionServiceMonitorable.class);
financialTransactionSearch = new FinancialTransactionSearchImpl();
@@ -185,8 +185,6 @@
* Delete selected row in table (could be transaction or entry).
* <p/>
* Called by model.
- *
- * @throws LimaException
*/
public void deleteSelectedRow() {
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/LetterSearchComboBox.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/LetterSearchComboBox.java 2011-09-20 14:47:53 UTC (rev 3294)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/LetterSearchComboBox.java 2011-09-20 14:51:40 UTC (rev 3295)
@@ -28,8 +28,8 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.entity.Letter;
+import org.chorem.lima.ui.LimaRendererUtil;
import org.chorem.lima.ui.combobox.LetterComboBoxModel;
-import org.chorem.lima.ui.renderers.RendererUtil;
import org.chorem.lima.util.LetterToString;
import org.jdesktop.swingx.autocomplete.AutoCompleteDecorator;
@@ -52,7 +52,7 @@
this.handler = handler;
LetterComboBoxModel letterComboBoxModel = new LetterComboBoxModel();
ListCellRenderer renderer =
- RendererUtil.newDecoratorListCellRenderer(Letter.class);
+ LimaRendererUtil.newDecoratorListCellRenderer(Letter.class);
setModel(letterComboBoxModel);
setRenderer(renderer);
setEditable(true);
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTableModel.java 2011-09-20 14:47:53 UTC (rev 3294)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTableModel.java 2011-09-20 14:51:40 UTC (rev 3295)
@@ -47,6 +47,7 @@
import org.chorem.lima.business.FinancialTransactionServiceMonitorable;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.business.ServiceListener;
+import org.chorem.lima.business.ejbinterface.FinancialTransactionService;
import org.chorem.lima.business.utils.EntryComparator;
import org.chorem.lima.entity.Account;
import org.chorem.lima.entity.Entry;
@@ -90,7 +91,7 @@
.getLog(FinancialTransactionUnbalancedTableModel.class);
/** Transaction service. */
- protected final FinancialTransactionServiceMonitorable financialTransactionService;
+ protected final FinancialTransactionService financialTransactionService;
/** selected financial period */
protected FiscalPeriod selectedFiscalPeriod;
@@ -110,9 +111,9 @@
public FinancialTransactionUnbalancedTableModel() {
/* Services */
financialTransactionService =
- LimaServiceFactory.getInstance().getService(
+ LimaServiceFactory.getService(
FinancialTransactionServiceMonitorable.class);
- financialTransactionService.addServiceListener(this);
+ LimaServiceFactory.addServiceListener(financialTransactionService, this);
}
/**
@@ -419,8 +420,8 @@
DialogHelper.showMessageDialog(eee.getMessage());
}
//update the financial transaction in entire
- financialTransactionRow =
- cacheDataList.indexOf(currentRow);
+// financialTransactionRow =
+// cacheDataList.indexOf(currentRow);
} else if (currentRow instanceof Entry) {
Entry currentEntry = (Entry) currentRow;
switch (column) {
@@ -454,9 +455,9 @@
DialogHelper.showMessageDialog(eee.getMessage());
}
//update the financial transaction in entire
- financialTransactionRow =
- cacheDataList.indexOf(((Entry) currentRow).
- getFinancialTransaction());
+// financialTransactionRow =
+// cacheDataList.indexOf(((Entry) currentRow).
+// getFinancialTransaction());
}
//on recharge la liste
cacheDataList = getDataList();
@@ -496,7 +497,9 @@
@Override
public void notifyMethod(String serviceName, String methodeName) {
- if (serviceName.contains("FinancialTransaction") || methodeName.contains("importEntries") || methodeName.contains("importAll")) {
+ if (serviceName.contains("FinancialTransaction") ||
+ methodeName.contains("importEntries") ||
+ methodeName.contains("importAll")) {
refresh();
}
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedView.jaxx 2011-09-20 14:47:53 UTC (rev 3294)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedView.jaxx 2011-09-20 14:51:40 UTC (rev 3295)
@@ -28,7 +28,7 @@
javax.swing.ListSelectionModel
org.chorem.lima.entity.FiscalPeriod
org.chorem.lima.ui.combobox.FiscalPeriodComboBoxModel
- org.chorem.lima.ui.renderers.RendererUtil
+ org.chorem.lima.ui.LimaRendererUtil
</import>
<FinancialTransactionUnbalancedViewHandler id="handler"
javaBean="new FinancialTransactionUnbalancedViewHandler(this)"/>
@@ -61,7 +61,7 @@
<cell anchor="west">
<JComboBox id="fiscalPeriodComboBox"
model="{modelFiscalPeriod}"
- renderer="{RendererUtil.newDecoratorListCellRenderer(FiscalPeriod.class)}"
+ renderer="{LimaRendererUtil.newDecoratorListCellRenderer(FiscalPeriod.class)}"
onActionPerformed="getFinancialTransactionUnbalancedTableModel().setFiscalPeriod( (FiscalPeriod) fiscalPeriodComboBox.getSelectedItem());
getHandler().refresh()"
editable="false"/>
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 2011-09-20 14:47:53 UTC (rev 3294)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/AddPeriod.jaxx 2011-09-20 14:51:40 UTC (rev 3295)
@@ -44,7 +44,7 @@
getRootPane().setDefaultButton(okButton);
protected FiscalPeriodServiceMonitorable fiscalPeriodService =
- LimaServiceFactory.getInstance().getService(
+ LimaServiceFactory.getService(
FiscalPeriodServiceMonitorable.class);
// set begin date picker
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 2011-09-20 14:47:53 UTC (rev 3294)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodTableModel.java 2011-09-20 14:51:40 UTC (rev 3295)
@@ -32,6 +32,8 @@
import org.chorem.lima.business.ImportServiceMonitorable;
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.utils.FiscalPeriodComparator;
import org.chorem.lima.entity.FinancialTransaction;
import org.chorem.lima.entity.FiscalPeriod;
@@ -65,24 +67,23 @@
private static final Log log = LogFactory.getLog(FiscalPeriodTableModel.class);
- protected FiscalPeriodServiceMonitorable fiscalPeriodService;
+ protected FiscalPeriodService fiscalPeriodService;
- protected FinancialTransactionServiceMonitorable financialTransactionService;
+ protected FinancialTransactionService financialTransactionService;
/** data cache */
- protected List<Object> cacheDataList;
+ protected List<?> cacheDataList;
public FiscalPeriodTableModel() {
fiscalPeriodService =
- LimaServiceFactory.getInstance().getService(
+ LimaServiceFactory.getService(
FiscalPeriodServiceMonitorable.class);
- fiscalPeriodService.addServiceListener(this);
- LimaServiceFactory.getInstance().getService(
- ImportServiceMonitorable.class).addServiceListener(this);
+ LimaServiceFactory.addServiceListener(fiscalPeriodService, this);
+ LimaServiceFactory.addServiceListener(ImportServiceMonitorable.class, this);
financialTransactionService =
- LimaServiceFactory.getInstance().getService(
+ LimaServiceFactory.getService(
FinancialTransactionServiceMonitorable.class);
- financialTransactionService.addServiceListener(this);
+ LimaServiceFactory.addServiceListener(financialTransactionService, this);
cacheDataList = null;
}
@@ -95,7 +96,7 @@
results.addAll(fiscalPeriod);
} catch (LimaException eee) {
if (log.isErrorEnabled()) {
- log.debug("Can't update model", eee);
+ log.error("Can't update model", eee);
}
ErrorHelper.showErrorDialog(_("lima.fiscalperiod.listerror"), eee);
}
@@ -169,7 +170,7 @@
Object result = "n/a";
- List<Object> periods;
+ List<?> periods;
periods = cacheDataList;
FiscalPeriod fiscalPeriod = (FiscalPeriod) periods.get(rowIndex);
@@ -202,7 +203,10 @@
return fiscalPeriod;
}
- /** @param period */
+ /**
+ * @param period
+ * @throws LimaException
+ */
public void addFiscalPeriod(FiscalPeriod period) throws LimaException {
try {
@@ -214,7 +218,7 @@
fireTableRowsInserted(row, row);
} catch (LimaException eee) {
if (log.isErrorEnabled()) {
- log.debug("Can't create FiscalPeriod", eee);
+ log.error("Can't create FiscalPeriod", eee);
}
ErrorHelper.showErrorDialog(_("lima.fiscalperiod.creationerror"), eee);
}
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 2011-09-20 14:47:53 UTC (rev 3294)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodViewHandler.java 2011-09-20 14:51:40 UTC (rev 3295)
@@ -75,11 +75,11 @@
this.view = view;
fiscalPeriodService =
- LimaServiceFactory.getInstance().getService(
+ LimaServiceFactory.getService(
FiscalPeriodServiceMonitorable.class);
financialTransactionService =
- LimaServiceFactory.getInstance().getService(
+ LimaServiceFactory.getService(
FinancialTransactionServiceMonitorable.class);
}
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 2011-09-20 14:47:53 UTC (rev 3294)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/RetainedEarningsEntryBookForm.jaxx 2011-09-20 14:51:40 UTC (rev 3295)
@@ -29,7 +29,7 @@
<import>
javax.swing.text.Document
org.chorem.lima.entity.EntryBook
- org.chorem.lima.ui.renderers.RendererUtil
+ org.chorem.lima.ui.LimaRendererUtil
org.chorem.lima.ui.combobox.EntryBookComboBoxModel
</import>
<EntryBook id="entryBook" javaBean="null"/>
@@ -96,7 +96,7 @@
<EntryBookComboBoxModel id="modelEntryBookComboBox"/>
<JComboBox id="entryBookComboBox"
model="{getModelEntryBookComboBox()}"
- renderer="{RendererUtil.newDecoratorListCellRenderer(EntryBook.class)}"
+ renderer="{LimaRendererUtil.newDecoratorListCellRenderer(EntryBook.class)}"
editable="false"
onItemStateChanged="getEntryBook().setCode(((EntryBook)getEntryBookComboBox().getSelectedItem()).getCode()); getEntryBook().setLabel(((EntryBook)getEntryBookComboBox().getSelectedItem()).getLabel())"/>
</cell>
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 2011-09-20 14:47:53 UTC (rev 3294)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/AccountsPane.java 2011-09-20 14:51:40 UTC (rev 3295)
@@ -63,11 +63,12 @@
public AccountsPane(HomeView view) {
this.view = view;
accountService =
- LimaServiceFactory.getInstance().getService(
+ LimaServiceFactory.getService(
AccountServiceMonitorable.class);
- accountService.addServiceListener(this);
- LimaServiceFactory.getInstance().getService(
- ImportServiceMonitorable.class).addServiceListener(this);
+ LimaServiceFactory.addServiceListener(
+ AccountServiceMonitorable.class, this);
+ LimaServiceFactory.addServiceListener(
+ ImportServiceMonitorable.class, this);
//init
setOpaque(true);
@@ -80,7 +81,7 @@
@Override
public void hyperlinkUpdate(HyperlinkEvent e) {
- if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
+ if (HyperlinkEvent.EventType.ACTIVATED.equals(e.getEventType())) {
if (e.getDescription().equals("#accountschart")) {
MainView ui = LimaContext.MAIN_UI_ENTRY_DEF.getContextValue(view);
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 2011-09-20 14:47:53 UTC (rev 3294)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/EntryBooksPane.java 2011-09-20 14:51:40 UTC (rev 3295)
@@ -32,6 +32,7 @@
import org.chorem.lima.business.ImportServiceMonitorable;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.business.ServiceListener;
+import org.chorem.lima.business.ejbinterface.EntryBookService;
import org.chorem.lima.entity.EntryBook;
import org.chorem.lima.service.LimaServiceFactory;
import org.chorem.lima.ui.MainView;
@@ -53,7 +54,7 @@
protected HomeView view;
- protected EntryBookServiceMonitorable entryBookService;
+ protected EntryBookService entryBookService;
private static Color redBackground = new Color(0xff, 0xee, 0xee);
@@ -63,11 +64,10 @@
this.view = view;
entryBookService =
- LimaServiceFactory.getInstance().getService(
+ LimaServiceFactory.getService(
EntryBookServiceMonitorable.class);
- entryBookService.addServiceListener(this);
- LimaServiceFactory.getInstance().getService(
- ImportServiceMonitorable.class).addServiceListener(this);
+ LimaServiceFactory.addServiceListener(entryBookService, this);
+ LimaServiceFactory.addServiceListener(ImportServiceMonitorable.class, this);
//init
setOpaque(true);
@@ -81,7 +81,7 @@
@Override
public void hyperlinkUpdate(HyperlinkEvent e) {
- if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
+ if (HyperlinkEvent.EventType.ACTIVATED.equals(e.getEventType())) {
if (e.getDescription().equals("#entrybookschart")) {
MainView ui = LimaContext.MAIN_UI_ENTRY_DEF.getContextValue(view);
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 2011-09-20 14:47:53 UTC (rev 3294)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/FinancialTransactionsPane.java 2011-09-20 14:51:40 UTC (rev 3295)
@@ -33,6 +33,8 @@
import org.chorem.lima.business.ImportServiceMonitorable;
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.entity.FinancialTransaction;
import org.chorem.lima.entity.FiscalPeriod;
import org.chorem.lima.service.LimaServiceFactory;
@@ -55,9 +57,9 @@
protected HomeView view;
- protected FinancialTransactionServiceMonitorable financialTransactionService;
+ protected FinancialTransactionService financialTransactionService;
- protected FiscalPeriodServiceMonitorable fiscalPeriodService;
+ protected FiscalPeriodService fiscalPeriodService;
private static Color redBackground = new Color(0xff, 0xee, 0xee);
@@ -67,13 +69,12 @@
this.view = view;
financialTransactionService =
- LimaServiceFactory.getInstance().getService(FinancialTransactionServiceMonitorable.class);
- financialTransactionService.addServiceListener(this);
+ LimaServiceFactory.getService(FinancialTransactionServiceMonitorable.class);
+ LimaServiceFactory.addServiceListener(financialTransactionService, this);
fiscalPeriodService =
- LimaServiceFactory.getInstance().getService(FiscalPeriodServiceMonitorable.class);
- fiscalPeriodService.addServiceListener(this);
- LimaServiceFactory.getInstance().getService(
- ImportServiceMonitorable.class).addServiceListener(this);
+ LimaServiceFactory.getService(FiscalPeriodServiceMonitorable.class);
+ LimaServiceFactory.addServiceListener(fiscalPeriodService, this);
+ LimaServiceFactory.addServiceListener(ImportServiceMonitorable.class, this);
//init
setOpaque(true);
@@ -86,7 +87,7 @@
@Override
public void hyperlinkUpdate(HyperlinkEvent e) {
- if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
+ if (HyperlinkEvent.EventType.ACTIVATED.equals(e.getEventType())) {
if (e.getDescription().equals("#financialtransactionunbalanced")) {
MainView ui = LimaContext.MAIN_UI_ENTRY_DEF.getContextValue(view);
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 2011-09-20 14:47:53 UTC (rev 3294)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/FiscalPeriodsPane.java 2011-09-20 14:51:40 UTC (rev 3295)
@@ -32,6 +32,7 @@
import org.chorem.lima.business.ImportServiceMonitorable;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.business.ServiceListener;
+import org.chorem.lima.business.ejbinterface.FiscalPeriodService;
import org.chorem.lima.entity.FiscalPeriod;
import org.chorem.lima.service.LimaServiceFactory;
import org.chorem.lima.ui.MainView;
@@ -53,7 +54,7 @@
protected HomeView view;
- protected FiscalPeriodServiceMonitorable fiscalPeriodService;
+ protected FiscalPeriodService fiscalPeriodService;
private static Color redBackground = new Color(0xff, 0xee, 0xee);
@@ -63,10 +64,9 @@
this.view = view;
fiscalPeriodService =
- LimaServiceFactory.getInstance().getService(FiscalPeriodServiceMonitorable.class);
- fiscalPeriodService.addServiceListener(this);
- LimaServiceFactory.getInstance().getService(
- ImportServiceMonitorable.class).addServiceListener(this);
+ LimaServiceFactory.getService(FiscalPeriodServiceMonitorable.class);
+ LimaServiceFactory.addServiceListener(fiscalPeriodService, this);
+ LimaServiceFactory.addServiceListener(ImportServiceMonitorable.class, this);
//init
setOpaque(true);
@@ -79,7 +79,7 @@
@Override
public void hyperlinkUpdate(HyperlinkEvent e) {
- if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
+ if (HyperlinkEvent.EventType.ACTIVATED.equals(e.getEventType())) {
if (e.getDescription().equals("#fiscalperiodschart")) {
MainView ui = LimaContext.MAIN_UI_ENTRY_DEF.getContextValue(view);
@@ -133,8 +133,9 @@
@Override
public void notifyMethod(String serviceName, String methodeName) {
- if (methodeName.contains("FiscalPeriod") || methodeName.contains("importAll")
- || methodeName.contains("importAs")) {
+ if (methodeName.contains("FiscalPeriod") ||
+ methodeName.contains("importAll") ||
+ methodeName.contains("importAs")) {
refresh();
}
}
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 2011-09-20 14:47:53 UTC (rev 3294)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/HomeView.jaxx 2011-09-20 14:51:40 UTC (rev 3295)
@@ -29,7 +29,7 @@
java.awt.Font
javax.swing.BoxLayout
javax.swing.border.EtchedBorder
- javax.swing.ImageIcon
+ jaxx.runtime.SwingUtil
static org.nuiton.i18n.I18n._
</import>
@@ -48,7 +48,7 @@
<row>
<cell weightx="0" weighty="0.1" anchor="northwest">
<JLabel
- icon='{new ImageIcon(getClass().getResource("/images/accounts.png"))}'/>
+ icon='accounts.png'/>
</cell>
<cell weightx="1" weighty="0.1" anchor="center">
<JLabel foreground='{Color.DARK_GRAY}'
@@ -76,7 +76,7 @@
<row>
<cell weightx="0" weighty="0.1" anchor="northwest">
<JLabel
- icon='{new ImageIcon(getClass().getResource("/images/entrybooks.png"))}'/>
+ icon='entrybooks.png'/>
</cell>
<cell weightx="1" weighty="0.1" anchor="center">
<JLabel foreground='{Color.DARK_GRAY}'
@@ -106,7 +106,7 @@
<row>
<cell weightx="0" weighty="0.1" anchor="northwest">
<JLabel
- icon='{new ImageIcon(getClass().getResource("/images/fiscalperiods.png"))}'/>
+ icon='fiscalperiods.png'/>
</cell>
<cell weightx="1" weighty="0.1" anchor="center">
<JLabel foreground='{Color.DARK_GRAY}'
@@ -134,7 +134,7 @@
<row>
<cell weightx="0" weighty="0.1" anchor="northwest">
<JLabel
- icon='{new ImageIcon(getClass().getResource("/images/entries.png"))}'/>
+ icon='entries.png'/>
</cell>
<cell weightx="1" weighty="0.1" anchor="center">
<JLabel foreground='{Color.DARK_GRAY}'
@@ -144,8 +144,7 @@
</row>
<row fill="both">
<cell columns="2" weightx="1" weighty="0.9">
- <JEditorPane
- javaBean='new FinancialTransactionsPane(this)'/>
+ <JEditorPane initializer='new FinancialTransactionsPane(this)'/>
</cell>
</row>
</Table>
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/identity/IdentityHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/identity/IdentityHandler.java 2011-09-20 14:47:53 UTC (rev 3294)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/identity/IdentityHandler.java 2011-09-20 14:51:40 UTC (rev 3295)
@@ -43,7 +43,7 @@
public IdentityHandler() {
identityService =
- LimaServiceFactory.getInstance().getService(
+ LimaServiceFactory.getService(
IdentityServiceMonitorable.class);
}
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 2011-09-20 14:47:53 UTC (rev 3294)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java 2011-09-20 14:51:40 UTC (rev 3295)
@@ -84,10 +84,10 @@
//services
importService =
- LimaServiceFactory.getInstance().getService(
+ LimaServiceFactory.getService(
ImportServiceMonitorable.class);
exportService =
- LimaServiceFactory.getInstance().getService(
+ LimaServiceFactory.getService(
ExportServiceMonitorable.class);
//create the wait dialog panel
@@ -103,6 +103,8 @@
* Call the appropriate methode in business service.
*
* @param importExportMethode
+ * @param file
+ * @param verbose
*/
public void importExport(ImportExportEnum importExportMethode, String file, Boolean verbose) {
final ImportExportEnum importExportMethodeF = importExportMethode;
@@ -233,7 +235,7 @@
log.error("Can't get result message", eee);
}
} catch (ExecutionException eee) {
- DialogHelper.showMessageDialog(eee.getCause().getMessage());
+ DialogHelper.showErrorMessageDialog(viewComponent, eee.getCause());
if (log.isErrorEnabled()) {
log.error("Error on import", eee);
}
@@ -250,6 +252,7 @@
* folders for export or folders+files for import
*
* @param importMode
+ * @param importExportMethode
* @return
*/
public String chooseFile(Boolean importMode, ImportExportEnum importExportMethode) {
@@ -283,14 +286,21 @@
}
- /** Get csv datas in string and write file */
+ /** Get csv datas in string and write file
+ * @param filePath
+ * @param charset
+ * @param datas*/
public void createFile(String filePath, String charset, String datas) {
+ File file = new File(filePath);
try {
- File file = new File(filePath);
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), charset));
- out.write(datas);
- out.flush();
- out.close();
+ try {
+ out.write(datas);
+ out.flush();
+ out.close();
+ } finally {
+ out.close();
+ }
} catch (IOException eee) {
if (log.isErrorEnabled()) {
log.error("Can't write file " + filePath, eee);
@@ -298,7 +308,10 @@
}
}
- /** Open csv file and get his datas on a string. */
+ /** Open csv file and get his datas on a string.
+ * @param filePath
+ * @param charset
+ * @return*/
public String extractFile(String filePath, String charset) {
StringWriter sw = new StringWriter();
BufferedReader in = null;
@@ -314,7 +327,11 @@
}
in = new BufferedReader(new InputStreamReader(is, charset));
- IOUtils.copy(in, sw);
+ try {
+ IOUtils.copy(in, sw);
+ } finally {
+ in.close();
+ }
in.close();
} catch (IOException eee) {
if (log.isErrorEnabled()) {
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerPeriodSearchPanel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerPeriodSearchPanel.java 2011-09-20 14:47:53 UTC (rev 3294)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerPeriodSearchPanel.java 2011-09-20 14:51:40 UTC (rev 3295)
@@ -31,9 +31,9 @@
import org.chorem.lima.entity.FinancialPeriod;
import org.chorem.lima.entity.FiscalPeriod;
import org.chorem.lima.enums.ComboBoxDatesEnum;
+import org.chorem.lima.ui.LimaRendererUtil;
import org.chorem.lima.ui.combobox.FinancialPeriodComboBoxModel;
import org.chorem.lima.ui.combobox.FiscalPeriodComboBoxModel;
-import org.chorem.lima.ui.renderers.RendererUtil;
import org.jdesktop.swingx.JXDatePicker;
import javax.swing.JComboBox;
@@ -111,7 +111,7 @@
case FISCAL_PERIOD:
FiscalPeriodComboBoxModel fiscalModel = new FiscalPeriodComboBoxModel(true);
ListCellRenderer renderer =
- RendererUtil.newDecoratorListCellRenderer(FiscalPeriod.class);
+ LimaRendererUtil.newDecoratorListCellRenderer(FiscalPeriod.class);
final JComboBox fiscalPeriod = new JComboBox(fiscalModel);
fiscalPeriod.setRenderer(renderer);
fiscalPeriod.setEditable(false);
@@ -135,7 +135,7 @@
case FINANCIAL_PERIOD:
FinancialPeriodComboBoxModel financialModel = new FinancialPeriodComboBoxModel(true);
renderer =
- RendererUtil.newDecoratorListCellRenderer(FinancialPeriod.class);
+ LimaRendererUtil.newDecoratorListCellRenderer(FinancialPeriod.class);
final JComboBox financialPeriod = new JComboBox(financialModel);
financialPeriod.setRenderer(renderer);
financialPeriod.setEditable(false);
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerViewHandler.java 2011-09-20 14:47:53 UTC (rev 3294)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerViewHandler.java 2011-09-20 14:51:40 UTC (rev 3295)
@@ -30,7 +30,6 @@
import org.chorem.lima.LimaConfig;
import org.chorem.lima.beans.BalanceTrial;
import org.chorem.lima.beans.ReportsDatas;
-import org.chorem.lima.business.DocumentServiceMonitorable;
import org.chorem.lima.business.FinancialTransactionServiceMonitorable;
import org.chorem.lima.business.FiscalPeriodServiceMonitorable;
import org.chorem.lima.business.HttpServerServiceMonitorable;
@@ -38,6 +37,8 @@
import org.chorem.lima.business.LimaException;
import org.chorem.lima.business.ReportServiceMonitorable;
import org.chorem.lima.business.ServiceListener;
+import org.chorem.lima.business.ejbinterface.FiscalPeriodService;
+import org.chorem.lima.business.ejbinterface.ReportService;
import org.chorem.lima.business.utils.DocumentsEnum;
import org.chorem.lima.business.utils.EntryComparator;
import org.chorem.lima.business.utils.FormatsEnum;
@@ -75,11 +76,11 @@
private static final Log log = LogFactory.getLog(LedgerTableModel.class);
/** Services. */
- protected ReportServiceMonitorable reportService;
+ protected ReportService reportService;
- protected DocumentServiceMonitorable documentService;
+// protected DocumentService documentService;
- protected FiscalPeriodServiceMonitorable fiscalPeriodService;
+ protected FiscalPeriodService fiscalPeriodService;
/** Begin Date. */
protected Date selectedBeginDate;
@@ -103,21 +104,16 @@
this.view = view;
reportService =
- LimaServiceFactory.getInstance().getService(
- ReportServiceMonitorable.class);
- reportService.addServiceListener(this);
- port = LimaServiceFactory.getInstance().getService(
+ LimaServiceFactory.getService(ReportServiceMonitorable.class);
+ LimaServiceFactory.addServiceListener(reportService, this);
+ port = LimaServiceFactory.getService(
HttpServerServiceMonitorable.class).getHttpPort();
- documentService =
- LimaServiceFactory.getInstance().getService(
- DocumentServiceMonitorable.class);
+// documentService =
+// LimaServiceFactory.getService(DocumentServiceMonitorable.class);
fiscalPeriodService =
- LimaServiceFactory.getInstance().getService(
- FiscalPeriodServiceMonitorable.class);
- LimaServiceFactory.getInstance().getService(
- ImportServiceMonitorable.class).addServiceListener(this);
- LimaServiceFactory.getInstance().getService(
- FinancialTransactionServiceMonitorable.class).addServiceListener(this);
+ LimaServiceFactory.getService(FiscalPeriodServiceMonitorable.class);
+ LimaServiceFactory.addServiceListener(ImportServiceMonitorable.class, this);
+ LimaServiceFactory.addServiceListener(FinancialTransactionServiceMonitorable.class, this);
}
public void setBeginDate(Date date) {
@@ -156,7 +152,7 @@
}
} catch (LimaException eee) {
if (log.isErrorEnabled()) {
- log.debug("Can't update model", eee);
+ log.error("Can't update model", eee);
}
ErrorHelper.showErrorDialog("Can't get entries list", eee);
}
@@ -183,7 +179,7 @@
view.amountSoldeLabel.setText(
String.valueOf(amountSolde));
- if (amountSolde == BigDecimal.ZERO) {
+ if (BigDecimal.ZERO.equals(amountSolde)) {
view.soldeLabel.setText(_("lima.common.solde"));
} else {
// set label solde: credit or debit
@@ -207,7 +203,7 @@
blockedFiscalPeriods = fiscalPeriodService.getAllBlockedFiscalPeriods();
} catch (LimaException eee) {
if (log.isErrorEnabled()) {
- log.debug("Enable to create document ", eee);
+ log.error("Enable to create document ", eee);
}
ErrorHelper.showErrorDialog(_("lima.ledger.documentcreationerror"), eee);
}
@@ -253,7 +249,9 @@
@Override
public void notifyMethod(String serviceName, String methodeName) {
- if (serviceName.contains("FinancialTransaction") || methodeName.contains("importAccount") || methodeName.contains("importAll")) {
+ if (serviceName.contains("FinancialTransaction") ||
+ methodeName.contains("importAccount") ||
+ methodeName.contains("importAll")) {
refresh();
}
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetterComboBox.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetterComboBox.java 2011-09-20 14:47:53 UTC (rev 3294)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetterComboBox.java 2011-09-20 14:51:40 UTC (rev 3295)
@@ -28,8 +28,8 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.entity.Letter;
+import org.chorem.lima.ui.LimaRendererUtil;
import org.chorem.lima.ui.combobox.LetterComboBoxModel;
-import org.chorem.lima.ui.renderers.RendererUtil;
import org.chorem.lima.util.LetterToString;
import org.jdesktop.swingx.autocomplete.AutoCompleteDecorator;
@@ -48,7 +48,7 @@
LetterComboBoxModel letterComboBoxModel = new LetterComboBoxModel();
ListCellRenderer renderer =
- RendererUtil.newDecoratorListCellRenderer(Letter.class);
+ LimaRendererUtil.newDecoratorListCellRenderer(Letter.class);
setModel(letterComboBoxModel);
setRenderer(renderer);
setEditable(true);
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringPeriodSearchPanel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringPeriodSearchPanel.java 2011-09-20 14:47:53 UTC (rev 3294)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringPeriodSearchPanel.java 2011-09-20 14:51:40 UTC (rev 3295)
@@ -30,9 +30,9 @@
import org.chorem.lima.entity.FinancialPeriod;
import org.chorem.lima.entity.FiscalPeriod;
import org.chorem.lima.enums.ComboBoxDatesEnum;
+import org.chorem.lima.ui.LimaRendererUtil;
import org.chorem.lima.ui.combobox.FinancialPeriodComboBoxModel;
import org.chorem.lima.ui.combobox.FiscalPeriodComboBoxModel;
-import org.chorem.lima.ui.renderers.RendererUtil;
import org.jdesktop.swingx.JXDatePicker;
import javax.swing.JComboBox;
@@ -110,7 +110,7 @@
case FISCAL_PERIOD:
FiscalPeriodComboBoxModel fiscalModel = new FiscalPeriodComboBoxModel(true);
ListCellRenderer renderer =
- RendererUtil.newDecoratorListCellRenderer(FiscalPeriod.class);
+ LimaRendererUtil.newDecoratorListCellRenderer(FiscalPeriod.class);
final JComboBox fiscalPeriod = new JComboBox(fiscalModel);
fiscalPeriod.setRenderer(renderer);
fiscalPeriod.setEditable(false);
@@ -134,7 +134,7 @@
case FINANCIAL_PERIOD:
FinancialPeriodComboBoxModel financialModel = new FinancialPeriodComboBoxModel(true);
renderer =
- RendererUtil.newDecoratorListCellRenderer(FinancialPeriod.class);
+ LimaRendererUtil.newDecoratorListCellRenderer(FinancialPeriod.class);
final JComboBox financialPeriod = new JComboBox(financialModel);
financialPeriod.setRenderer(renderer);
financialPeriod.setEditable(false);
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTableModel.java 2011-09-20 14:47:53 UTC (rev 3294)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTableModel.java 2011-09-20 14:51:40 UTC (rev 3295)
@@ -31,6 +31,7 @@
import org.chorem.lima.business.ImportServiceMonitorable;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.business.ServiceListener;
+import org.chorem.lima.business.ejbinterface.FinancialTransactionService;
import org.chorem.lima.business.utils.EntryComparator;
import org.chorem.lima.entity.Account;
import org.chorem.lima.entity.Entry;
@@ -56,8 +57,8 @@
/**
* Basic transaction table model.
* <p/>
- * Le modele est filtré sur {@link #selectedFinancialPeriod} et
- * {@link #selectedFinancialPeriod} (montée en charge !).
+ * Le modele est filtré sur {@link #selectedBeginDate} et
+ * {@link #selectedEndDate} (montée en charge !).
*
* @author ore
* @author chatellier
@@ -76,7 +77,7 @@
.getLog(LetteringTableModel.class);
/** Transaction service. */
- protected final FinancialTransactionServiceMonitorable financialTransactionService;
+ protected final FinancialTransactionService financialTransactionService;
/** Begin Date. */
protected Date selectedBeginDate;
@@ -99,11 +100,10 @@
public LetteringTableModel() {
/* Services */
financialTransactionService =
- LimaServiceFactory.getInstance().getService(
+ LimaServiceFactory.getService(
FinancialTransactionServiceMonitorable.class);
- financialTransactionService.addServiceListener(this);
- LimaServiceFactory.getInstance().getService(
- ImportServiceMonitorable.class).addServiceListener(this);
+ LimaServiceFactory.addServiceListener(financialTransactionService,this);
+ LimaServiceFactory.addServiceListener(ImportServiceMonitorable.class, this);
}
public void setSelectedBeginDate(Date date) {
@@ -425,7 +425,9 @@
@Override
public void notifyMethod(String serviceName, String methodeName) {
- if (serviceName.contains("FinancialTransaction") || methodeName.contains("importEntries") || methodeName.contains("importAll")) {
+ if (serviceName.contains("FinancialTransaction") ||
+ methodeName.contains("importEntries") ||
+ methodeName.contains("importAll")) {
refresh();
}
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java 2011-09-20 14:47:53 UTC (rev 3294)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java 2011-09-20 14:51:40 UTC (rev 3295)
@@ -77,7 +77,7 @@
/* Services */
financialTransactionService =
- LimaServiceFactory.getInstance().getService(
+ LimaServiceFactory.getService(
FinancialTransactionServiceMonitorable.class);
}
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 2011-09-20 14:47:53 UTC (rev 3294)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateFiscalPeriodPanel.jaxx 2011-09-20 14:51:40 UTC (rev 3295)
@@ -37,7 +37,7 @@
<![CDATA[
protected FiscalPeriodServiceMonitorable fiscalPeriodService =
- LimaServiceFactory.getInstance().getService(
+ LimaServiceFactory.getService(
FiscalPeriodServiceMonitorable.class);
// set begin date picker
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 2011-09-20 14:47:53 UTC (rev 3294)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/OpeningView.jaxx 2011-09-20 14:51:40 UTC (rev 3295)
@@ -28,9 +28,10 @@
<import>
javax.swing.BorderFactory
javax.swing.ImageIcon
+ jaxx.runtime.SwingUtil
</import>
- <OpeningViewHandler id="handler" javaBean="new OpeningViewHandler(this)"/>
+ <OpeningViewHandler id="handler" constructorParams="this"/>
<script>
<![CDATA[
@@ -51,7 +52,7 @@
<row>
<cell weightx="0.1">
<JLabel id='identityIcon'
- icon='{new ImageIcon(getClass().getResource("/images/identity.png"))}'/>
+ icon='identity.png'/>
</cell>
<cell weightx="0.9" rows="4" fill="both">
<JPanel id='panel'>
@@ -63,20 +64,17 @@
</row>
<row>
<cell>
- <JLabel id='accountsIcon'
- icon='{new ImageIcon(getClass().getResource("/images/accounts.png"))}'/>
+ <JLabel id='accountsIcon' icon='accounts.png'/>
</cell>
</row>
<row>
<cell>
- <JLabel id='entrybooksIcon'
- icon='{new ImageIcon(getClass().getResource("/images/entrybooks.png"))}'/>
+ <JLabel id='entrybooksIcon' icon='entrybooks.png'/>
</cell>
</row>
<row>
<cell>
- <JLabel id='fiscalperiodsIcon'
- icon='{new ImageIcon(getClass().getResource("/images/fiscalperiods.png"))}'/>
+ <JLabel id='fiscalperiodsIcon' icon='fiscalperiods.png'/>
</cell>
</row>
</Table>
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 2011-09-20 14:47:53 UTC (rev 3294)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/OpeningViewHandler.java 2011-09-20 14:51:40 UTC (rev 3295)
@@ -191,7 +191,7 @@
fiscalPeriod.setBeginDate(fsPanel.getBeginDatePicker().getDate());
fiscalPeriod.setEndDate(fsPanel.getEndDatePicker().getDate());
- LimaServiceFactory.getInstance().getService(
+ LimaServiceFactory.getService(
FiscalPeriodServiceMonitorable.class).
createFiscalPeriod(fiscalPeriod);
Deleted: trunk/lima-swing/src/main/java/org/chorem/lima/ui/renderers/RendererUtil.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/renderers/RendererUtil.java 2011-09-20 14:47:53 UTC (rev 3294)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/renderers/RendererUtil.java 2011-09-20 14:51:40 UTC (rev 3295)
@@ -1,31 +0,0 @@
-package org.chorem.lima.ui.renderers;
-
-import jaxx.runtime.swing.renderer.DecoratorListCellRenderer;
-import jaxx.runtime.swing.renderer.DecoratorProviderListCellRenderer;
-import org.chorem.lima.LimaContext;
-import org.nuiton.util.decorator.Decorator;
-import org.nuiton.util.decorator.DecoratorProvider;
-
-import javax.swing.ListCellRenderer;
-
-/**
- * Helper class to deal with renderers.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.5.2
- */
-public class RendererUtil {
-
- public static ListCellRenderer newDecoratorProviderListCellRenderer() {
- DecoratorProvider decoratorProvider = LimaContext.get().getDecoratorProvider();
- return new DecoratorProviderListCellRenderer(decoratorProvider);
- }
-
- public static ListCellRenderer newDecoratorListCellRenderer(Class<?> type) {
-
- DecoratorProvider decoratorProvider = LimaContext.get().getDecoratorProvider();
- Decorator<?> decorator = decoratorProvider.getDecoratorByType(type);
- return new DecoratorListCellRenderer(decorator);
- }
-
-}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartTreeTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartTreeTableModel.java 2011-09-20 14:47:53 UTC (rev 3294)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartTreeTableModel.java 2011-09-20 14:51:40 UTC (rev 3295)
@@ -52,7 +52,7 @@
super(new VatStatementImpl());
// Gets factory service
vatStatementService =
- LimaServiceFactory.getInstance().getService(
+ LimaServiceFactory.getService(
VatStatementServiceMonitorable.class);
}
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 2011-09-20 14:47:53 UTC (rev 3294)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartViewHandler.java 2011-09-20 14:51:40 UTC (rev 3295)
@@ -58,10 +58,9 @@
this.view = view;
vatStatementService =
- LimaServiceFactory.getInstance().getService(
+ LimaServiceFactory.getService(
VatStatementServiceMonitorable.class);
- LimaServiceFactory.getInstance().getService(
- ImportServiceMonitorable.class).addServiceListener(this);
+ LimaServiceFactory.addServiceListener(ImportServiceMonitorable.class, this);
}
public void addVatStatementMovement() {
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportPeriodSearchPanel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportPeriodSearchPanel.java 2011-09-20 14:47:53 UTC (rev 3294)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportPeriodSearchPanel.java 2011-09-20 14:51:40 UTC (rev 3295)
@@ -30,9 +30,9 @@
import org.chorem.lima.entity.FinancialPeriod;
import org.chorem.lima.entity.FiscalPeriod;
import org.chorem.lima.enums.ComboBoxDatesEnum;
+import org.chorem.lima.ui.LimaRendererUtil;
import org.chorem.lima.ui.combobox.FinancialPeriodComboBoxModel;
import org.chorem.lima.ui.combobox.FiscalPeriodComboBoxModel;
-import org.chorem.lima.ui.renderers.RendererUtil;
import org.jdesktop.swingx.JXDatePicker;
import javax.swing.JComboBox;
@@ -80,14 +80,17 @@
//handler().setEndDate(endDate);
JLabel beginDateLabel = new JLabel(_("lima.common.begindate"));
final JXDatePicker beginDatePicker = new JXDatePicker(beginDate);
+ final VatReportTableModel tableModel = handler.getTableModel();
+
ActionListener beginDateActionListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
- handler.tableModel.setBeginDate(beginDatePicker.getDate());
+
+ tableModel.setBeginDate(beginDatePicker.getDate());
handler.refresh();
}
};
- handler.tableModel.setBeginDate(beginDatePicker.getDate());
+ tableModel.setBeginDate(beginDatePicker.getDate());
beginDatePicker.addActionListener(beginDateActionListener);
JLabel endDateLabel = new JLabel(_("lima.common.enddate"));
@@ -95,11 +98,11 @@
ActionListener endDateActionListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
- handler.tableModel.setEndDate(endDatePicker.getDate());
+ tableModel.setEndDate(endDatePicker.getDate());
handler.refresh();
}
};
- handler.tableModel.setEndDate(endDatePicker.getDate());
+ tableModel.setEndDate(endDatePicker.getDate());
endDatePicker.addActionListener(endDateActionListener);
handler.refresh();
@@ -111,9 +114,10 @@
break;
case FISCAL_PERIOD:
- FiscalPeriodComboBoxModel fiscalModel = new FiscalPeriodComboBoxModel(true);
+ FiscalPeriodComboBoxModel fiscalModel =
+ new FiscalPeriodComboBoxModel(true);
ListCellRenderer renderer =
- RendererUtil.newDecoratorListCellRenderer(FiscalPeriod.class);
+ LimaRendererUtil.newDecoratorListCellRenderer(FiscalPeriod.class);
final JComboBox fiscalPeriod = new JComboBox(fiscalModel);
fiscalPeriod.setRenderer(renderer);
fiscalPeriod.setEditable(false);
@@ -122,8 +126,8 @@
public void actionPerformed(ActionEvent e) {
FiscalPeriod fPeriod = (FiscalPeriod) fiscalPeriod.getSelectedItem();
if (fPeriod != null) {
- handler.tableModel.setBeginDate(fPeriod.getBeginDate());
- handler.tableModel.setEndDate(fPeriod.getEndDate());
+ handler.getTableModel().setBeginDate(fPeriod.getBeginDate());
+ handler.getTableModel().setEndDate(fPeriod.getEndDate());
handler.refresh();
}
}
@@ -135,9 +139,10 @@
break;
case FINANCIAL_PERIOD:
- FinancialPeriodComboBoxModel financialModel = new FinancialPeriodComboBoxModel(true);
+ FinancialPeriodComboBoxModel financialModel =
+ new FinancialPeriodComboBoxModel(true);
renderer =
- RendererUtil.newDecoratorListCellRenderer(FinancialPeriod.class);
+ LimaRendererUtil.newDecoratorListCellRenderer(FinancialPeriod.class);
final JComboBox financialPeriod = new JComboBox(financialModel);
financialPeriod.setRenderer(renderer);
financialPeriod.setEditable(false);
@@ -146,8 +151,8 @@
public void actionPerformed(ActionEvent e) {
FinancialPeriod fPeriod = (FinancialPeriod) financialPeriod.getSelectedItem();
if (fPeriod != null) {
- handler.tableModel.setBeginDate(fPeriod.getBeginDate());
- handler.tableModel.setEndDate(fPeriod.getEndDate());
+ handler.getTableModel().setBeginDate(fPeriod.getBeginDate());
+ handler.getTableModel().setEndDate(fPeriod.getEndDate());
handler.refresh();
}
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportTable.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportTable.java 2011-09-20 14:47:53 UTC (rev 3294)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportTable.java 2011-09-20 14:51:40 UTC (rev 3295)
@@ -24,31 +24,31 @@
*/
package org.chorem.lima.ui.vatreports;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.chorem.lima.ui.celleditor.BigDecimalTableCellEditor;
import org.chorem.lima.ui.celleditor.BigDecimalTableCellRenderer;
import org.jdesktop.swingx.JXTable;
import java.math.BigDecimal;
+/** @deprecated since 0.5.2 : Ne sert à rien! */
+@Deprecated
public class VatReportTable extends JXTable {
/** serialVersionUID. */
private static final long serialVersionUID = 4042515416850867834L;
- /** log. */
- private static final Log log = LogFactory.getLog(VatReportTable.class);
+// /** log. */
+// private static final Log log = LogFactory.getLog(VatReportTable.class);
protected VatReportViewHandler handler;
- protected VatReportTableModel model;
+// protected VatReportTableModel model;
public VatReportTable(VatReportViewHandler handler) {
this.handler = handler;
- model = this.handler.getView().getVatReportTableModel();
+// model = this.handler.getTableModel();
//Get new BigDecimal editor
setDefaultEditor(BigDecimal.class, new BigDecimalTableCellEditor());
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportTableModel.java 2011-09-20 14:47:53 UTC (rev 3294)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportTableModel.java 2011-09-20 14:51:40 UTC (rev 3295)
@@ -30,9 +30,9 @@
import org.chorem.lima.business.FinancialTransactionServiceMonitorable;
import org.chorem.lima.business.ImportServiceMonitorable;
import org.chorem.lima.business.LimaException;
-import org.chorem.lima.business.ReportServiceMonitorable;
import org.chorem.lima.business.ServiceListener;
import org.chorem.lima.business.VatStatementServiceMonitorable;
+import org.chorem.lima.business.ejbinterface.VatStatementService;
import org.chorem.lima.service.LimaServiceFactory;
import org.chorem.lima.util.ErrorHelper;
import org.nuiton.topia.TopiaException;
@@ -54,14 +54,14 @@
.getLog(VatReportTableModel.class);
/** Services. */
- protected ReportServiceMonitorable reportService;
+// protected ReportServiceMonitorable reportService;
- protected VatStatementServiceMonitorable vatStatementService;
+ protected VatStatementService vatStatementService;
- protected FinancialTransactionServiceMonitorable financialTransactionService;
+// protected FinancialTransactionServiceMonitorable financialTransactionService;
+//
+// protected ImportServiceMonitorable importService;
- protected ImportServiceMonitorable importService;
-
/** selected financial period */
protected Date selectedBeginDate;
@@ -70,35 +70,31 @@
/** data cache */
protected List<VatStatementAmounts> cacheDataList;
- /**
- * variable used for the document edition,
- * if "true" then the document will be automatically filled in
- * if "false" the the document will be empty
- */
- protected String autocomplete;
+// /**
+// * variable used for the document edition,
+// * if "true" then the document will be automatically filled in
+// * if "false" the the document will be empty
+// */
+// protected String autocomplet;
public VatReportTableModel() {
- reportService =
- LimaServiceFactory.getInstance().getService(
- ReportServiceMonitorable.class);
+// reportService =
+// LimaServiceFactory.getService(
+// ReportServiceMonitorable.class);
//add listeners
vatStatementService =
- LimaServiceFactory.getInstance().getService(
+ LimaServiceFactory.getService(
VatStatementServiceMonitorable.class);
- vatStatementService.addServiceListener(this);
- financialTransactionService =
- LimaServiceFactory.getInstance().getService(
- FinancialTransactionServiceMonitorable.class);
- financialTransactionService.addServiceListener(this);
- importService =
- LimaServiceFactory.getInstance().getService(
- ImportServiceMonitorable.class);
- importService.addServiceListener(this);
+ LimaServiceFactory.addServiceListener(vatStatementService, this);
+ LimaServiceFactory.addServiceListener(
+ FinancialTransactionServiceMonitorable.class, this);
+ LimaServiceFactory.addServiceListener(
+ ImportServiceMonitorable.class, this);
- //sets autocomplete mode to true on start
- autocomplete = "true";
+// //sets autocomplete mode to true on start
+// autocomplete = "true";
}
protected List<VatStatementAmounts> getDataList() throws TopiaException {
@@ -112,7 +108,7 @@
getEndDate());
} catch (LimaException eee) {
if (log.isErrorEnabled()) {
- log.debug("Can't update model", eee);
+ log.error("Can't update model", eee);
}
ErrorHelper.showErrorDialog(_("lima.vatreport.listerror"), eee);
}
@@ -125,7 +121,7 @@
cacheDataList = getDataList();
} catch (TopiaException eee) {
if (log.isErrorEnabled()) {
- log.debug("Can't update model", eee);
+ log.error("Can't update model", eee);
}
ErrorHelper.showErrorDialog("Can't get VAT list", eee);
}
@@ -224,18 +220,18 @@
return selectedEndDate;
}
- public String getAutocomplete() {
- return autocomplete;
- }
+// public String getAutocomplete() {
+// return autocomplete;
+// }
+//
+// public void setAutocomplete() {
+// if (getAutocomplete().equals("true")) {
+// autocomplete = "false";
+// } else {
+// autocomplete = "true";
+// }
+// }
- public void setAutocomplete() {
- if (getAutocomplete().equals("true")) {
- autocomplete = "false";
- } else {
- autocomplete = "true";
- }
- }
-
@Override
public boolean isCellEditable(int row, int column) {
return false;
@@ -244,7 +240,9 @@
@Override
public void notifyMethod(String serviceName, String methodeName) {
//automatic refresh when FinancialTransaction, VatStatement chart or import for VAT services have been used by the user
- if (serviceName.contains("FinancialTransaction") || methodeName.contains("VatStatement") || methodeName.contains("import")) {
+ if (serviceName.contains("FinancialTransaction") ||
+ methodeName.contains("VatStatement") ||
+ methodeName.contains("import")) {
refresh();
}
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportView.jaxx 2011-09-20 14:47:53 UTC (rev 3294)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportView.jaxx 2011-09-20 14:51:40 UTC (rev 3295)
@@ -23,27 +23,24 @@
#L%
-->
<Table>
- <VatReportViewHandler id="handler" javaBean="new VatReportViewHandler(this)"/>
- <Boolean id="selectedRow" javaBean="false"/>
+ <VatReportViewHandler id="handler"
+ initializer="new VatReportViewHandler(this)"/>
+ <import>
+ javax.swing.ListSelectionModel
+ org.jdesktop.swingx.JXTable
+ org.chorem.lima.entity.FiscalPeriod
+ org.chorem.lima.entity.FinancialPeriod
+ org.chorem.lima.enums.ComboBoxDatesEnum
+ </import>
+
+ <Boolean id="autoComplete" javaBean="false"/>
+
<script>
<![CDATA[
- import org.chorem.lima.entity.FiscalPeriod;
- import org.chorem.lima.entity.FinancialPeriod;
- import org.chorem.lima.ui.combobox.FiscalPeriodComboBoxModel;
- import org.chorem.lima.ui.financialtransaction.FinancialPeriodComboBox;
- import org.chorem.lima.ui.combobox.FinancialPeriodComboBoxRenderer;
- import org.chorem.lima.ui.combobox.FiscalPeriodComboBoxRenderer;
- import org.chorem.lima.ui.vatreports.VatTableModel;
- import org.chorem.lima.ui.vatreports.VatTable;
-
- import org.chorem.lima.enums.ComboBoxDatesEnum;
- VatReportPeriodSearchPanel periodSearchPanel = new VatReportPeriodSearchPanel(handler);
-
void $afterCompleteSetup() {
- getHandler().refresh();
+ getHandler().init();
}
-
]]>
</script>
@@ -52,20 +49,19 @@
<JLabel id="fiscalPeriodLabel" text="lima.charts.fiscalyear"/>
</cell>
<cell anchor="west">
- <org.chorem.lima.ui.combobox.FiscalPeriodComboBoxModel
- id="modelFiscalPeriod"/>
<JComboBox id="periodComboBox"
javaBean="new JComboBox(ComboBoxDatesEnum.descriptions())"
onActionPerformed="periodSearchPanel.refresh(ComboBoxDatesEnum.valueOfDescription((String) periodComboBox.getSelectedItem()));
validate(); repaint()"/>
</cell>
<cell>
- <VatReportPeriodSearchPanel javaBean="periodSearchPanel"/>
+ <VatReportPeriodSearchPanel id="periodSearchPanel"
+ constructorParams="handler"/>
</cell>
<cell>
- <JCheckBox id='autocomplete' text='lima.common.autocomplete'
+ <JCheckBox id='autocompleteCheckBox' text='lima.common.autocomplete'
selected='true'
- onActionPerformed="getVatReportTableModel().setAutocomplete()"/>
+ onActionPerformed="setAutoComplete(!autoComplete)"/>
</cell>
<cell>
<JButton id="editVatButton" text="lima.reports.vat"
@@ -75,15 +71,13 @@
<row>
<cell fill="both" weightx="1" weighty="1" rows="3" columns="11">
<JScrollPane>
- <org.chorem.lima.ui.vatreports.VatReportTableModel
- id="vatReportTableModel"/>
- <org.chorem.lima.ui.vatreports.VatReportTable
- id="vatReportTable" sortable="false" rowHeight="22"
- constructorParams="getHandler()" model="{getVatReportTableModel()}"
- selectionMode="{ListSelectionModel.SINGLE_SELECTION}"/>
- <javax.swing.ListSelectionModel
- javaBean="getVatReportTable().getSelectionModel()"
- onValueChanged="setSelectedRow(vatReportTable.getSelectedRow() != -1)"/>
+ <!--<VatReportTableModel id="vatReportTableModel"/>-->
+ <JXTable id="vatReportTable" sortable="false" rowHeight="22"
+ model="{new VatReportTableModel()}"
+ selectionMode="{ListSelectionModel.SINGLE_SELECTION}"/>
+ <!--<ListSelectionModel-->
+ <!--initializer="getVatReportTable().getSelectionModel()"-->
+ <!--onValueChanged="setSelectedRow(vatReportTable.getSelectedRow() != -1)"/>-->
</JScrollPane>
</cell>
</row>
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportViewHandler.java 2011-09-20 14:47:53 UTC (rev 3294)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportViewHandler.java 2011-09-20 14:51:40 UTC (rev 3295)
@@ -31,9 +31,12 @@
import org.chorem.lima.business.HttpServerServiceMonitorable;
import org.chorem.lima.business.utils.DocumentsEnum;
import org.chorem.lima.service.LimaServiceFactory;
+import org.chorem.lima.ui.celleditor.BigDecimalTableCellEditor;
+import org.chorem.lima.ui.celleditor.BigDecimalTableCellRenderer;
import java.awt.Desktop;
import java.io.IOException;
+import java.math.BigDecimal;
import java.net.URI;
import java.net.URISyntaxException;
import java.text.SimpleDateFormat;
@@ -45,10 +48,6 @@
protected VatReportView view;
- protected VatReportTable table;
-
- protected VatReportTableModel tableModel;
-
protected DocumentServiceMonitorable documentService;
private static SimpleDateFormat dateFormat =
@@ -59,21 +58,36 @@
protected VatReportViewHandler(VatReportView view) {
this.view = view;
- port = LimaServiceFactory.getInstance().getService(
+ port = LimaServiceFactory.getService(
HttpServerServiceMonitorable.class).getHttpPort();
documentService =
- LimaServiceFactory.getInstance().getService(
+ LimaServiceFactory.getService(
DocumentServiceMonitorable.class);
}
+ public void init() {
+ //Get new BigDecimal editor
+ view.getVatReportTable().setDefaultEditor(BigDecimal.class, new BigDecimalTableCellEditor());
+
+ //Get new BigDecimal renderer
+ view.getVatReportTable().setDefaultRenderer(BigDecimal.class, new BigDecimalTableCellRenderer());
+
+ // do refresh (TODO check if required...)
+ refresh();
+ }
/** @return VatView */
public VatReportView getView() {
return view;
}
+ public VatReportTableModel getTableModel() {
+ return (VatReportTableModel) view.getVatReportTable().getModel();
+ }
+
/** Edit VAT document */
public void editVat() {
+ VatReportTableModel tableModel = getTableModel();
if (tableModel.getBeginDate() != null || tableModel.getEndDate() != null) {
String address = LimaConfig.getInstance().getHostAdress();
@@ -82,7 +96,7 @@
+ dateFormat.format(tableModel.getBeginDate())
+ "&endDate=" + dateFormat.format(tableModel.getEndDate())
+ "&format=.pdf&model=" + DocumentsEnum.VAT.getFileName()
- + "&autocomplete=" + tableModel.getAutocomplete();
+ + "&autocomplete=" + view.getAutoComplete();
Desktop.getDesktop().browse(new URI(url));
} catch (IOException e) {
log.error("Can't open browser", e);
@@ -94,7 +108,7 @@
/** Refresh VatTableModel */
public void refresh() {
- tableModel = view.getVatReportTableModel();
+ VatReportTableModel tableModel = getTableModel();
tableModel.refresh();
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/util/DialogHelper.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/util/DialogHelper.java 2011-09-20 14:47:53 UTC (rev 3294)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/util/DialogHelper.java 2011-09-20 14:51:40 UTC (rev 3295)
@@ -63,7 +63,7 @@
* JOptionPane.INFORMATION_MESSAGE);
*
* @param message
- * @deprecated since 0.5, prefer use the method {@link #showErrorMessageDialog(Component, Exception)}
+ * @deprecated since 0.5, prefer use the method {@link #showErrorMessageDialog(Component, Throwable)}
*/
@Deprecated
public static void showMessageDialog(String message) {
@@ -77,7 +77,7 @@
f.dispose();
}
- public static void showErrorMessageDialog(Component view, Exception e) {
+ public static void showErrorMessageDialog(Component view, Throwable e) {
JOptionPane.showMessageDialog(
view,
e.getMessage(),
Copied: trunk/lima-swing/src/main/resources/icons/accounts.png (from rev 3288, trunk/lima-swing/src/main/resources/images/accounts.png)
===================================================================
(Binary files differ)
Property changes on: trunk/lima-swing/src/main/resources/icons/accounts.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: svn:keywords
+ Author Date Id Revision HeadURL
Copied: trunk/lima-swing/src/main/resources/icons/entries.png (from rev 3288, trunk/lima-swing/src/main/resources/images/entries.png)
===================================================================
(Binary files differ)
Property changes on: trunk/lima-swing/src/main/resources/icons/entries.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: svn:keywords
+ Author Date Id Revision HeadURL
Copied: trunk/lima-swing/src/main/resources/icons/entrybooks.png (from rev 3288, trunk/lima-swing/src/main/resources/images/entrybooks.png)
===================================================================
(Binary files differ)
Property changes on: trunk/lima-swing/src/main/resources/icons/entrybooks.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: svn:keywords
+ Author Date Id Revision HeadURL
Copied: trunk/lima-swing/src/main/resources/icons/fiscalperiods.png (from rev 3288, trunk/lima-swing/src/main/resources/images/fiscalperiods.png)
===================================================================
(Binary files differ)
Property changes on: trunk/lima-swing/src/main/resources/icons/fiscalperiods.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: svn:keywords
+ Author Date Id Revision HeadURL
Copied: trunk/lima-swing/src/main/resources/icons/identity.png (from rev 3288, trunk/lima-swing/src/main/resources/images/identity.png)
===================================================================
(Binary files differ)
Property changes on: trunk/lima-swing/src/main/resources/icons/identity.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: svn:keywords
+ Author Date Id Revision HeadURL
Copied: trunk/lima-swing/src/main/resources/icons/puzzle_icon.png (from rev 3288, trunk/lima-swing/src/main/resources/images/puzzle_icon.png)
===================================================================
(Binary files differ)
Property changes on: trunk/lima-swing/src/main/resources/icons/puzzle_icon.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: svn:keywords
+ Author Date Id Revision HeadURL
Copied: trunk/lima-swing/src/main/resources/icons/puzzle_splash.png (from rev 3288, trunk/lima-swing/src/main/resources/images/puzzle_splash.png)
===================================================================
(Binary files differ)
Property changes on: trunk/lima-swing/src/main/resources/icons/puzzle_splash.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: svn:keywords
+ Author Date Id Revision HeadURL
Deleted: trunk/lima-swing/src/main/resources/images/accounts.png
===================================================================
(Binary files differ)
Deleted: trunk/lima-swing/src/main/resources/images/entries.png
===================================================================
(Binary files differ)
Deleted: trunk/lima-swing/src/main/resources/images/entrybooks.png
===================================================================
(Binary files differ)
Deleted: trunk/lima-swing/src/main/resources/images/fiscalperiods.png
===================================================================
(Binary files differ)
Deleted: trunk/lima-swing/src/main/resources/images/identity.png
===================================================================
(Binary files differ)
Deleted: trunk/lima-swing/src/main/resources/images/puzzle_icon.png
===================================================================
(Binary files differ)
Deleted: trunk/lima-swing/src/main/resources/images/puzzle_splash.png
===================================================================
(Binary files differ)
Modified: trunk/lima-swing/src/main/resources/log4j.properties
===================================================================
--- trunk/lima-swing/src/main/resources/log4j.properties 2011-09-20 14:47:53 UTC (rev 3294)
+++ trunk/lima-swing/src/main/resources/log4j.properties 2011-09-20 14:51:40 UTC (rev 3295)
@@ -37,4 +37,4 @@
log4j.appender.file.layout.ConversionPattern=%5p [%t] (%F:%L) %M - %m%n
# package level
-#log4j.logger.org.chorem.lima=DEBUG
\ No newline at end of file
+log4j.logger.org.chorem.lima=INFO
\ No newline at end of file
1
0
Author: tchemit
Date: 2011-09-20 16:47:53 +0200 (Tue, 20 Sep 2011)
New Revision: 3294
Url: http://chorem.org/repositories/revision/lima/3294
Log:
NEVER generate the toString (really linked to lazy stuff
Modified:
trunk/lima-callao/src/main/xmi/accounting.properties
Modified: trunk/lima-callao/src/main/xmi/accounting.properties
===================================================================
--- trunk/lima-callao/src/main/xmi/accounting.properties 2011-09-17 14:17:04 UTC (rev 3293)
+++ trunk/lima-callao/src/main/xmi/accounting.properties 2011-09-20 14:47:53 UTC (rev 3294)
@@ -25,6 +25,7 @@
# Precise l'entete de l'ensemble des fichiers generes
model.tagvalue.copyright=/*\n Copyright (C) 2009-2010 Lima Callao\n */
model.tagvalue.constantPrefix=PROPERTY_
+model.tagValue.notGenerateToString=true
# natural id
org.chorem.lima.entity.Account.class.tagvalue.naturalIdMutable=false
1
0
Author: tchemit
Date: 2011-09-17 16:17:04 +0200 (Sat, 17 Sep 2011)
New Revision: 3293
Url: http://chorem.org/repositories/revision/lima/3293
Log:
do not use renderer, prefer usage of the RendererUtil instead + reformat code
Added:
trunk/lima-swing/src/main/java/org/chorem/lima/widgets/ScrollBasicComboPopup.java
trunk/lima-swing/src/main/java/org/chorem/lima/widgets/ScrollMetalComboUI.java
Modified:
trunk/lima-swing/src/main/java/org/chorem/lima/LimaConfig.java
trunk/lima-swing/src/main/java/org/chorem/lima/LimaSplash.java
trunk/lima-swing/src/main/java/org/chorem/lima/actions/MiscAction.java
trunk/lima-swing/src/main/java/org/chorem/lima/enums/AccountsChartEnum.java
trunk/lima-swing/src/main/java/org/chorem/lima/enums/ComboBoxAccountsEnum.java
trunk/lima-swing/src/main/java/org/chorem/lima/enums/ComboBoxDatesEnum.java
trunk/lima-swing/src/main/java/org/chorem/lima/enums/ComboBoxEntryBooksEnum.java
trunk/lima-swing/src/main/java/org/chorem/lima/enums/ComboBoxLetterEnum.java
trunk/lima-swing/src/main/java/org/chorem/lima/enums/ComboBoxOperatorsEnum.java
trunk/lima-swing/src/main/java/org/chorem/lima/enums/ComboBoxPeriodEnum.java
trunk/lima-swing/src/main/java/org/chorem/lima/enums/EncodingEnum.java
trunk/lima-swing/src/main/java/org/chorem/lima/enums/EntryBooksChartEnum.java
trunk/lima-swing/src/main/java/org/chorem/lima/enums/FinancialStatementsChartEnum.java
trunk/lima-swing/src/main/java/org/chorem/lima/enums/ImportExportEnum.java
trunk/lima-swing/src/main/java/org/chorem/lima/enums/VatStatementsChartEnum.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/LimaDecoratorProvider.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/java/org/chorem/lima/ui/account/AccountTreeTable.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountTreeTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountComboBox.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsPeriodSearchPanel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsTable.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalancePeriodSearchPanel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceTable.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/AccountTableCellEditor.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellEditor.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellRenderer.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/DateTableCellEditor.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/EmptyCellRenderer.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/LetterTableCellEditor.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/AccountComboBoxModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/AccountRenderer.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/EntryBookComboBoxModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/EntryBookRenderer.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FinancialPeriodComboBoxModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FinancialPeriodComboBoxRenderer.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FiscalPeriodComboBoxModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FiscalPeriodComboBoxRenderer.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/LetterComboBoxModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/LetterRenderer.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/SubAccountComboBoxModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookTable.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBookComboBox.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsPeriodSearchPanel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsTable.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodTable.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartTreeTable.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartTreeTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementImportForm.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementDocument.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportPeriodSearchPanel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTable.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableCellRenderer.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionPeriodSearchPanel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/LetterSearchComboBox.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedView.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/FiscalPeriodViewHandler.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/identity/IdentityForm.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/identity/IdentityHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExportWaitView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerPeriodSearchPanel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerTable.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/AddLetterForm.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetterComboBox.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringPeriodSearchPanel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTable.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.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/VatChartTreeTable.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartTreeTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportPeriodSearchPanel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportTable.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/util/AccountToString.java
trunk/lima-swing/src/main/java/org/chorem/lima/util/EntryBookToString.java
trunk/lima-swing/src/main/java/org/chorem/lima/util/ErrorHelper.java
trunk/lima-swing/src/main/java/org/chorem/lima/util/LetterToString.java
trunk/lima-swing/src/main/java/org/chorem/lima/widgets/JWideComboBox.java
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/LimaConfig.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/LimaConfig.java 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/LimaConfig.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -57,31 +57,27 @@
*
* @author chemit
* @version $Revision$
- *
- * Last update : $Date$
- * By : $Author$
+ * <p/>
+ * Last update : $Date$
+ * By : $Author$
*/
public class LimaConfig extends ApplicationConfig {
- /**
- * to use log facility, just put in your code: log.info(\"...\");
- */
+ /** to use log facility, just put in your code: log.info(\"...\"); */
static private Log log = LogFactory.getLog(LimaConfig.class);
-
+
protected static LimaConfig instance;
-
+
private static final String configFile = "lima-config.properties";
-
+
protected OptionsServiceMonitorable optionsService;
-
- /**
- * La version du logiciel.
- */
+
+ /** La version du logiciel. */
protected Version version;
/**
* Get copyrighy text (include version).
- *
+ *
* @return copyright text
*/
public String getCopyrightText() {
@@ -90,7 +86,7 @@
/**
* Version as string.
- *
+ *
* @return le nombre global ex: 3.2.0.0
*/
public String getVersion() {
@@ -99,7 +95,7 @@
/**
* Lima config constructor.
- *
+ * <p/>
* Define all default options and action alias.
*/
public LimaConfig() {
@@ -123,7 +119,7 @@
// TODO what is it for ?
//FileUtil.setCurrentDirectory(getLimaUserDirectory());
//getLimaUserDirectory().mkdirs();
-
+
}
public static LimaConfig getInstance() {
@@ -133,9 +129,9 @@
}
return instance;
}
-
- protected void loadConfiguration(String configFileName){
+ protected void loadConfiguration(String configFileName) {
+
instance.setConfigFileName(configFileName);
try {
instance.parse(new String[0]);
@@ -146,26 +142,26 @@
}
instance.setOption(TopiaContextFactory.CONFIG_PERSISTENCE_CLASSES,
LimaCallaoDAOHelper.getImplementationClassesAsString());
-}
-
+ }
+
@Override
public ApplicationConfig parse(String... args) throws ArgumentsParserException {
-
+
// super parse, read config file etc...
super.parse(args);
-
+
// on ne peut pas connaitre la version avant la lecture du fichier
// on supprime tout ce qui est apres - (-SNAPSHOT, -rc-1 ,...)
String sVersion = VersionUtil.removeSnapshot(getOption("application.version"));
version = VersionUtil.valueOf(sVersion);
-
+
return this;
-
+
}
/**
* Get application locale.
- *
+ *
* @return configuration application locale
*/
public Locale getLocale() {
@@ -176,7 +172,7 @@
/**
* Locale setter for command line parameters.
- *
+ *
* @param locale new locale
*/
public void setLocale(String locale) {
@@ -186,7 +182,7 @@
/**
* Change locale (not command line version).
* Save user file.
- *
+ *
* @param newLocale new locale
*/
public void setLocale(Locale newLocale) {
@@ -197,18 +193,18 @@
/**
* Get application decimal separator
- *
+ *
* @return configuration application decimal separator
*/
public char getDecimalSeparator() {
char decimalSeparator = getOption(Option.DECIMAL_SEPARATOR.key).charAt(0);
return decimalSeparator;
}
-
+
/**
* Change decimal separator
* Save user file.
- *
+ *
* @param decimalSeparator new DecimalSeparator
*/
public void setDecimalSeparator(String decimalSeparator) {
@@ -219,17 +215,17 @@
/**
* Get application scale
- *
+ *
* @return configuration application scale
*/
public int getScale() {
return getOptionAsInt(Option.SCALE.key);
}
-
+
/**
* Change scale
* Save user file.
- *
+ *
* @param scale new Scale
*/
public void setScale(String scale) {
@@ -241,20 +237,20 @@
}
optionsService.setScale(scale);
}
-
+
/**
* Get application thousand separator
- *
+ *
* @return configuration application thousand separator
*/
public char getThousandSeparator() {
return getOption(Option.THOUSAND_SEPARATOR.key).charAt(0);
}
-
+
/**
* Change the thousand separator
* Save user file.
- *
+ *
* @param thousandSeparator new thousandSeparator
*/
public void setThousandSeparator(String thousandSeparator) {
@@ -262,19 +258,19 @@
saveForUser();
firePropertyChange("thousandSeparator", null, thousandSeparator);
}
-
+
/**
* currency configuration boolean
- *
+ *
* @return {@code true} if the currency must be displayed
*/
public boolean getCurrency() {
- return getOptionAsBoolean(Option.CURRENCY.key);
+ return getOptionAsBoolean(Option.CURRENCY.key);
}
-
+
/**
* Change the currency displaying
- *
+ *
* @param currency
*/
public void setCurrency(String currency) {
@@ -285,7 +281,7 @@
/**
* Launch ui configuration value.
- *
+ *
* @return {@code true} if ui must be displayed
*/
public boolean isLaunchui() {
@@ -295,7 +291,7 @@
/**
* Launch ui setter for command line parameters.
- *
+ *
* @param launchui new lauch ui value
*/
public void setLaunchui(String launchui) {
@@ -305,7 +301,7 @@
/**
* Change full screen mode.
* Save user file.
- *
+ *
* @param fullscreen new fullscreen mode
*/
public void setFullscreen(boolean fullscreen) {
@@ -322,7 +318,7 @@
/**
* Get support email address.
- *
+ *
* @return support email
*/
public String getSupportEmail() {
@@ -331,7 +327,7 @@
/**
* Return true if ejb mode is configured as remote.
- *
+ *
* @return {@code true} if remote mode should be used
*/
public boolean isEJBRemoteMode() {
@@ -348,24 +344,20 @@
File result = getOptionAsFile(Option.RESOURCES_DIRECTORY.key);
return result;
}
-
- public File getI18nDirectory() {
+
+ public File getI18nDirectory() {
File result = getOptionAsFile(Option.I18N_DIRECTORY.key);
return result;
}
-
+
public String getHostAdress() {
return getOption(Option.LIMA_HOST_ADDRESS.key);
- }
+ }
- /**
- * Used in ????
- */
- public static final String[] DEFAULT_JAXX_PCS = { "fullScreen", "locale", "decimalSeparator", "scale", "thousandSeparator", "currency" };
+ /** Used in ???? */
+ public static final String[] DEFAULT_JAXX_PCS = {"fullScreen", "locale", "decimalSeparator", "scale", "thousandSeparator", "currency"};
- /**
- * Used in ????
- */
+ /** Used in ???? */
public void removeJaxxPropertyChangeListener() {
PropertyChangeListener[] toRemove = JAXXUtil.findJaxxPropertyChangeListener(DEFAULT_JAXX_PCS, getPropertyChangeListeners());
if (toRemove == null || toRemove.length == 0) {
@@ -386,7 +378,7 @@
/**
* Lima option definition.
- *
+ * <p/>
* Contains all lima configuration key, with defaut value and
* information for jaxx configuration frame ({@link #type},
* {@link #_transient}, {@link #_final}...)
@@ -407,16 +399,21 @@
SUPPORT_EMAIL("lima.misc.supportemail", _("lima.misc.supportemail.description"), "support(a)codelutin.com", 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"), "localhost", String.class, false, false);
-
+
public final String key;
+
public final String description;
+
public String defaultValue;
+
public final Class<?> type;
+
public boolean _transient;
+
public boolean _final;
Option(String key, String description, String defaultValue,
- Class<?> type, boolean _transient, boolean _final) {
+ Class<?> type, boolean _transient, boolean _final) {
this.key = key;
this.description = description;
this.defaultValue = defaultValue;
@@ -429,20 +426,20 @@
public boolean isFinal() {
return _final;
}
-
+
@Override
- public void setFinal(boolean _final){
- this._final=_final;
+ public void setFinal(boolean _final) {
+ this._final = _final;
}
-
+
@Override
public boolean isTransient() {
return _transient;
}
-
+
@Override
public void setTransient(boolean _transient) {
- this._transient=_transient;
+ this._transient = _transient;
}
@Override
@@ -452,9 +449,9 @@
@Override
public void setDefaultValue(String defaultValue) {
- this.defaultValue=defaultValue;
+ this.defaultValue = defaultValue;
}
-
+
@Override
public String getDescription() {
return description;
@@ -471,20 +468,21 @@
}
}
- /**
- * Lima action definition.
- */
+ /** Lima action definition. */
public enum Action {
HELP(_("lima.action.commandline.help"), MiscAction.class.getName() + "#help", "-h", "--help");
/** Before init action step. */
public static final int BEFORE_EXIT_STEP = 0;
+
/** After init action step. */
public static final int AFTER_INIT_STEP = 1;
public String description;
+
public String action;
+
public String[] aliases;
Action(String description, String action, String... aliases) {
@@ -493,7 +491,7 @@
this.aliases = aliases;
}
}
-
+
/**
* Save configuration, in user home directory using the
* {@link #getConfigFileName}. Default, env and commande line note saved
@@ -501,7 +499,7 @@
* @param excludeKeys optional list of keys to exclude from
*/
public void saveForUser(String... excludeKeys) {
-
+
File file = getUserConfigFile();
if (log.isDebugEnabled()) {
log.debug("will save user configuration in " + file);
@@ -515,26 +513,26 @@
}
}
}
-
+
/**
* 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 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
*/
public void save(File file,
boolean forceAll,
String... excludeKeys) throws IOException {
-
+
//
String[] serverProperties = {"scale"};
// store sorted in file
Properties prop = new SortedProperties();
-
+
// store server properties in file
Properties serverProp = new SortedProperties();
@@ -555,7 +553,7 @@
for (String excludeKey : excludeKeys) {
prop.remove(excludeKey);
}
-
+
for (String serverPropertie : serverProperties) {
if (prop.containsKey(serverPropertie)) {
serverProp.put(serverPropertie, prop.get(serverPropertie));
@@ -574,11 +572,11 @@
} finally {
stream.close();
}
-
+
optionsService =
- LimaServiceFactory.getInstance().getService(
- OptionsServiceMonitorable.class);
-
+ LimaServiceFactory.getInstance().getService(
+ OptionsServiceMonitorable.class);
+
if (!serverProp.isEmpty()) {
if (serverProp.containsKey("scale")) {
if (!serverProp.getProperty("scale").isEmpty()) {
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/LimaSplash.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/LimaSplash.java 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/LimaSplash.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -25,30 +25,30 @@
package org.chorem.lima;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
import java.awt.AlphaComposite;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics2D;
import java.awt.SplashScreen;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
/**
* Utility class used to manage information on slash screen.
- *
+ * <p/>
* Currently display:
* <ul>
- * <li>Version
- * <li>Loading information
+ * <li>Version
+ * <li>Loading information
* </ul>
- *
- * @since 0.3.2
+ *
* @author chatellier
* @version $Revision$
- *
- * Last update : $Date$
- * By : $Author$
+ * <p/>
+ * Last update : $Date$
+ * By : $Author$
+ * @since 0.3.2
*/
public class LimaSplash {
@@ -69,9 +69,7 @@
}
}
- /**
- * Init splash (add version).
- */
+ /** Init splash (add version). */
public void initSplash() {
if (splashGraphics != null) {
splashGraphics.setColor(Color.GRAY);
@@ -82,10 +80,9 @@
Font font = new Font("Lucida Sans", Font.BOLD, 14);
splashGraphics.setFont(font);
splashGraphics.drawString("Lutin Invoice Monitoring and Accounting", 65, 249);
-
+
splash.update();
- }
- else {
+ } else {
if (log.isWarnEnabled()) {
log.warn("Can't find splash screen");
log.warn("Make sure that lima is launched with -splash:image.png VM argument");
@@ -94,7 +91,7 @@
}
}
- public void drawVersion(String version){
+ public void drawVersion(String version) {
if (splashGraphics != null) {
splashGraphics.setColor(Color.DARK_GRAY);
Font font = new Font("Lucida Sans", Font.PLAIN, 12);
@@ -104,19 +101,19 @@
splash.update();
}
}
-
+
/**
* Update progression.
- *
+ *
* @param progress progress (between 0.0 and 1.0)
- * @param message message can be {@code null}
+ * @param message message can be {@code null}
*/
public void updateProgression(double progress, String message) {
if (splashGraphics != null && splash.isVisible()) {
-
+
splashGraphics.setColor(Color.GRAY);
splashGraphics.drawRect(65, 253, 300, 10);
- splashGraphics.fillRect(65, 253, (int)(300.0 * progress), 10);
+ splashGraphics.fillRect(65, 253, (int) (300.0 * progress), 10);
if (message != null) {
splashGraphics.setComposite(AlphaComposite.Clear);
@@ -130,10 +127,8 @@
splash.update();
}
}
-
- /**
- * Close splash screen (if needed).
- */
+
+ /** Close splash screen (if needed). */
public void closeSplash() {
if (splash != null && splash.isVisible()) {
splash.close();
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/actions/MiscAction.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/actions/MiscAction.java 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/actions/MiscAction.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -25,21 +25,21 @@
package org.chorem.lima.actions;
-import static org.nuiton.i18n.I18n._;
-
import org.chorem.lima.LimaConfig;
import org.chorem.lima.LimaMain;
import java.util.Arrays;
+import static org.nuiton.i18n.I18n._;
+
/**
* Les actions appellables via {@link LimaMain}.
*
* @author tony
* @version $Revision$
- *
- * Last update : $Date$
- * By : $Author$
+ * <p/>
+ * Last update : $Date$
+ * By : $Author$
*/
public class MiscAction {
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/enums/AccountsChartEnum.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/enums/AccountsChartEnum.java 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/enums/AccountsChartEnum.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -28,18 +28,18 @@
public enum AccountsChartEnum {
IMPORT(""), IMPORTEBP(""), SHORTENED("pcg_shortened.csv"), BASE("pcg_base.csv"), DEVELOPED("pcg_developed.csv");
-
+
private final String filePath;
-
+
AccountsChartEnum(String filePath) {
this.filePath = filePath;
}
-
+
public String getFilePath() {
String result = "";
- if (!filePath.equals("")){
- result=getClass().getResource("/import/"+ filePath).getPath();
+ if (!filePath.equals("")) {
+ result = getClass().getResource("/import/" + filePath).getPath();
}
- return result;
+ return result;
}
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/enums/ComboBoxAccountsEnum.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/enums/ComboBoxAccountsEnum.java 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/enums/ComboBoxAccountsEnum.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -33,18 +33,18 @@
ALL(_("lima.enum.comboboxaccount.allaccount")),
ACCOUNT(_("lima.enum.comboboxaccount.account")),
ACCOUNT_LIST(_("lima.enum.comboboxaccount.accountlist"));
-
+
private final String description;
-
+
ComboBoxAccountsEnum(String description) {
this.description = description;
}
-
+
public String getDescription() {
- return description;
+ return description;
}
-
- public static String[] descriptions(){
+
+ public static String[] descriptions() {
int nbElts = ComboBoxAccountsEnum.values().length;
String[] descriptions = new String[nbElts];
ComboBoxAccountsEnum[] enums = ComboBoxAccountsEnum.values();
@@ -53,12 +53,12 @@
}
return descriptions;
}
-
- public static ComboBoxAccountsEnum valueOfDescription(String description){
+
+ public static ComboBoxAccountsEnum valueOfDescription(String description) {
ComboBoxAccountsEnum value = null;
-
+
for (ComboBoxAccountsEnum enums : ComboBoxAccountsEnum.values()) {
- if (description.equals(enums.description)){
+ if (description.equals(enums.description)) {
value = enums;
break;
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/enums/ComboBoxDatesEnum.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/enums/ComboBoxDatesEnum.java 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/enums/ComboBoxDatesEnum.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -33,18 +33,18 @@
FISCAL_PERIOD(_("lima.enum.comboboxperiod.fiscalperiod")),
FINANCIAL_PERIOD(_("lima.enum.comboboxperiod.financialperiod")),
PERIOD(_("lima.enum.comboboxperiod.period"));
-
+
private final String description;
-
+
ComboBoxDatesEnum(String description) {
this.description = description;
}
-
+
public String getDescription() {
- return description;
+ return description;
}
-
- public static String[] descriptions(){
+
+ public static String[] descriptions() {
int nbElts = ComboBoxDatesEnum.values().length;
String[] descriptions = new String[nbElts];
ComboBoxDatesEnum[] enums = ComboBoxDatesEnum.values();
@@ -53,12 +53,12 @@
}
return descriptions;
}
-
- public static ComboBoxDatesEnum valueOfDescription(String description){
+
+ public static ComboBoxDatesEnum valueOfDescription(String description) {
ComboBoxDatesEnum value = null;
-
+
for (ComboBoxDatesEnum enums : ComboBoxDatesEnum.values()) {
- if (description.equals(enums.description)){
+ if (description.equals(enums.description)) {
value = enums;
break;
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/enums/ComboBoxEntryBooksEnum.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/enums/ComboBoxEntryBooksEnum.java 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/enums/ComboBoxEntryBooksEnum.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -32,18 +32,18 @@
ALL(_("lima.enum.comboboxentrybook.all")),
SELECT_ONE(_("lima.enum.comboboxentrybook.select_one"));
-
+
private final String description;
-
+
ComboBoxEntryBooksEnum(String description) {
this.description = description;
}
-
+
public String getDescription() {
- return description;
+ return description;
}
-
- public static String[] descriptions(){
+
+ public static String[] descriptions() {
int nbElts = ComboBoxEntryBooksEnum.values().length;
String[] descriptions = new String[nbElts];
ComboBoxEntryBooksEnum[] enums = ComboBoxEntryBooksEnum.values();
@@ -52,12 +52,12 @@
}
return descriptions;
}
-
- public static ComboBoxEntryBooksEnum valueOfDescription(String description){
+
+ public static ComboBoxEntryBooksEnum valueOfDescription(String description) {
ComboBoxEntryBooksEnum value = null;
-
+
for (ComboBoxEntryBooksEnum enums : ComboBoxEntryBooksEnum.values()) {
- if (description.equals(enums.description)){
+ if (description.equals(enums.description)) {
value = enums;
break;
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/enums/ComboBoxLetterEnum.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/enums/ComboBoxLetterEnum.java 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/enums/ComboBoxLetterEnum.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -32,18 +32,18 @@
ALL(_("lima.enum.comboboxletter.all")),
SELECT_ONE(_("lima.enum.comboboxletter.selectone"));
-
+
private final String description;
-
+
ComboBoxLetterEnum(String description) {
this.description = description;
}
-
+
public String getDescription() {
- return description;
+ return description;
}
-
- public static String[] descriptions(){
+
+ public static String[] descriptions() {
int nbElts = ComboBoxLetterEnum.values().length;
String[] descriptions = new String[nbElts];
ComboBoxLetterEnum[] enums = ComboBoxLetterEnum.values();
@@ -52,12 +52,12 @@
}
return descriptions;
}
-
- public static ComboBoxLetterEnum valueOfDescription(String description){
+
+ public static ComboBoxLetterEnum valueOfDescription(String description) {
ComboBoxLetterEnum value = null;
-
+
for (ComboBoxLetterEnum enums : ComboBoxLetterEnum.values()) {
- if (description.equals(enums.description)){
+ if (description.equals(enums.description)) {
value = enums;
break;
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/enums/ComboBoxOperatorsEnum.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/enums/ComboBoxOperatorsEnum.java 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/enums/ComboBoxOperatorsEnum.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -36,25 +36,26 @@
SUPERIOR(_("lima.enum.comboboxoperator.superior"), ">"),
INFERIOR(_("lima.enum.comboboxoperator.inferior"), "<"),
INTERVAL(_("lima.enum.comboboxoperator.interval"), ""),
- NOT_EQUAL(_("lima.enum.comboboxoperator.notequal"),"!=");
-
+ NOT_EQUAL(_("lima.enum.comboboxoperator.notequal"), "!=");
+
private final String description;
+
private final String symbol;
-
+
ComboBoxOperatorsEnum(String description, String symbol) {
this.description = description;
this.symbol = symbol;
}
-
+
public String getDescription() {
return description;
}
-
- public String getSymbol(){
+
+ public String getSymbol() {
return symbol;
}
-
- public static String[] descriptions(){
+
+ public static String[] descriptions() {
int nbElts = ComboBoxOperatorsEnum.values().length;
String[] descriptions = new String[nbElts];
ComboBoxOperatorsEnum[] enums = ComboBoxOperatorsEnum.values();
@@ -64,12 +65,12 @@
return descriptions;
}
-
- public static ComboBoxOperatorsEnum valueOfDescription(String description){
+
+ public static ComboBoxOperatorsEnum valueOfDescription(String description) {
ComboBoxOperatorsEnum value = null;
-
+
for (ComboBoxOperatorsEnum enums : ComboBoxOperatorsEnum.values()) {
- if (description.equals(enums.description)){
+ if (description.equals(enums.description)) {
value = enums;
break;
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/enums/ComboBoxPeriodEnum.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/enums/ComboBoxPeriodEnum.java 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/enums/ComboBoxPeriodEnum.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -34,18 +34,18 @@
DATE(_("lima.enum.comboboxperiod.date")),
FISCAL_PERIOD(_("lima.enum.comboboxperiod.fiscalperiod")),
FINANCIAL_PERIOD(_("lima.enum.comboboxperiod.financialperiod"));
-
+
private final String description;
-
+
ComboBoxPeriodEnum(String description) {
this.description = description;
}
-
+
public String getDescription() {
- return description;
+ return description;
}
-
- public static String[] descriptions(){
+
+ public static String[] descriptions() {
int nbElts = ComboBoxPeriodEnum.values().length;
String[] descriptions = new String[nbElts];
ComboBoxPeriodEnum[] enums = ComboBoxPeriodEnum.values();
@@ -54,12 +54,12 @@
}
return descriptions;
}
-
- public static ComboBoxPeriodEnum valueOfDescription(String description){
+
+ public static ComboBoxPeriodEnum valueOfDescription(String description) {
ComboBoxPeriodEnum value = null;
-
+
for (ComboBoxPeriodEnum enums : ComboBoxPeriodEnum.values()) {
- if (description.equals(enums.description)){
+ if (description.equals(enums.description)) {
value = enums;
break;
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/enums/EncodingEnum.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/enums/EncodingEnum.java 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/enums/EncodingEnum.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -29,24 +29,25 @@
UTF8("UTF-8", "UTF-8 Lima"), ISOLATIN1("ISO-8859-1", "ISO-Latin-1 Excel / Windows"),
MACROMAN("MacRoman", "MacRoman Excel / Mac");
-
+
private final String encoding;
+
private final String description;
-
+
EncodingEnum(String encoding, String description) {
this.encoding = encoding;
this.description = description;
}
-
+
public String getEncoding() {
return encoding;
}
-
- public String getDescription(){
+
+ public String getDescription() {
return description;
}
-
- public static String[] descriptions(){
+
+ public static String[] descriptions() {
int nbElts = EncodingEnum.values().length;
String[] descriptions = new String[nbElts];
EncodingEnum[] encodingEnums = EncodingEnum.values();
@@ -55,17 +56,17 @@
}
return descriptions;
}
-
- public static EncodingEnum valueOfDescription(String description){
+
+ public static EncodingEnum valueOfDescription(String description) {
EncodingEnum value = null;
-
+
for (EncodingEnum encodingEnum : EncodingEnum.values()) {
- if (description.equals(encodingEnum.description)){
+ if (description.equals(encodingEnum.description)) {
value = encodingEnum;
break;
}
}
return value;
}
-
+
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/enums/EntryBooksChartEnum.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/enums/EntryBooksChartEnum.java 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/enums/EntryBooksChartEnum.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -28,17 +28,18 @@
public enum EntryBooksChartEnum {
IMPORT(""), DEFAULT("eb_default.csv");
-
+
private final String filePath;
-
+
EntryBooksChartEnum(String filePath) {
this.filePath = filePath;
}
-
+
public String getFilePath() {
String result = "";
- if (!filePath.equals("")){
- result=getClass().getResource("/import/"+ filePath).getPath();
+ if (!filePath.equals("")) {
+ result = getClass().getResource("/import/" + filePath).getPath();
}
- return result; }
+ return result;
+ }
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/enums/FinancialStatementsChartEnum.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/enums/FinancialStatementsChartEnum.java 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/enums/FinancialStatementsChartEnum.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -28,19 +28,19 @@
public enum FinancialStatementsChartEnum {
IMPORT(""), SHORTENED("bcr_shortened.csv"), BASE("bcr_base.csv"), DEVELOPED("bcr_developed.csv");
-
+
private final String filePath;
-
+
FinancialStatementsChartEnum(String filePath) {
this.filePath = filePath;
-
+
}
-
+
public String getFilePath() {
String result = "";
- if (!filePath.equals("")){
- result=getClass().getResource("/import/"+ filePath).getPath();
- }
+ if (!filePath.equals("")) {
+ result = getClass().getResource("/import/" + filePath).getPath();
+ }
return result;
}
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/enums/ImportExportEnum.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/enums/ImportExportEnum.java 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/enums/ImportExportEnum.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -26,10 +26,7 @@
package org.chorem.lima.enums;
-/**
- * Boolean importMode define if it's a import (true) or an export (false)
- *
- */
+/** Boolean importMode define if it's a import (true) or an export (false) */
public enum ImportExportEnum {
CSV_ALL_EXPORT(false, true), CSV_ALL_IMPORT(true, true),
CSV_ACCOUNTCHARTS_EXPORT(false, true), CSV_ACCOUNTCHARTS_IMPORT(true, true),
@@ -39,10 +36,11 @@
PDF_VAT_EXPORT(false, true), PDF_VAT_IMPORT(true, true),
EBP_ACCOUNTCHARTS_EXPORT(false, false), EBP_ENTRIES_EXPORT(false, false),
EBP_ACCOUNTCHARTS_IMPORT(true, false), EBP_ENTRIES_IMPORT(true, false);
-
+
private final Boolean importMode;
+
private final Boolean encodingOption;
-
+
/**
* import mode :
* true if import, false if export
@@ -51,15 +49,15 @@
this.importMode = importMode;
this.encodingOption = encodingOption;
}
-
+
/**
* encoding choice
* true if import or export methode let encoding option
*/
- public Boolean getEncodingOption(){
+ public Boolean getEncodingOption() {
return encodingOption;
}
-
+
public Boolean getImportMode() {
return importMode;
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/enums/VatStatementsChartEnum.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/enums/VatStatementsChartEnum.java 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/enums/VatStatementsChartEnum.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -28,19 +28,19 @@
IMPORT(""), SHORTENED("vat_shortened.csv"), BASE("vat_base.csv"),
DEVELOPED("vat_developed.csv"), DEFAULT("vat_default.csv");
-
+
private final String filePath;
-
+
VatStatementsChartEnum(String filePath) {
this.filePath = filePath;
-
+
}
-
+
public String getFilePath() {
String result = "";
- if (!filePath.equals("")){
- result=getClass().getResource("/import/"+ filePath).getPath();
- }
+ if (!filePath.equals("")) {
+ result = getClass().getResource("/import/" + filePath).getPath();
+ }
return result;
}
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/LimaDecoratorProvider.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/LimaDecoratorProvider.java 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/LimaDecoratorProvider.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -3,6 +3,7 @@
import org.chorem.lima.entity.EntryBook;
import org.chorem.lima.entity.FinancialPeriod;
import org.chorem.lima.entity.FiscalPeriod;
+import org.chorem.lima.entity.Letter;
import org.nuiton.util.decorator.DecoratorProvider;
/**
@@ -18,6 +19,8 @@
registerJXPathDecorator(EntryBook.class, "${code}$s - ${label}$s");
+ registerJXPathDecorator(Letter.class, "${code}$s");
+
registerJXPathDecorator(
FiscalPeriod.class,
"${beginDate}$td/%1$tm/%1$tY - ${endDate}$td/%1$tm/%1$tY");
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 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainView.jaxx 2011-09-17 14:17:04 UTC (rev 3293)
@@ -46,7 +46,7 @@
org.chorem.lima.enums.ImportExportEnum
org.chorem.lima.service.LimaServiceFactory
</import>
-
+
<Desktop id='desktop' javaBean='Desktop.getDesktop()'/>
<script><![CDATA[
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 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -62,21 +62,19 @@
/**
* Handler for main view.
- *
+ * <p/>
* Date: 8 nov. 2009
* Time: 09:59:54
- *
+ *
* @author chemit
* @version $Revision$
- *
- * Last update : $Date$
- * By : $Author$
+ * <p/>
+ * Last update : $Date$
+ * By : $Author$
*/
public class MainViewHandler {
- /**
- * to use log facility, just put in your code: log.info(\"...\");
- */
+ /** to use log facility, just put in your code: log.info(\"...\"); */
static private Log log = LogFactory.getLog(MainViewHandler.class);
/**
@@ -167,7 +165,7 @@
ConfigUIHelper helper = new ConfigUIHelper(config);
helper.addCategory(_("lima.config.category.directories"), _("lima.config.category.directories.description"));
helper.addOption(LimaConfig.Option.CONFIG_FILE);
-
+
helper.addCategory(_("lima.config.category.other"), _("lima.config.category.other.description"));
helper.addOption(LimaConfig.Option.FULL_SCREEN);
helper.addOption(LimaConfig.Option.LOCALE);
@@ -175,7 +173,7 @@
helper.addOption(LimaConfig.Option.SCALE);
helper.addOption(LimaConfig.Option.THOUSAND_SEPARATOR);
helper.addOption(LimaConfig.Option.CURRENCY);
-
+
helper.buildUI(context, _("lima.config.category.directories"));
helper.displayUI(ui, false);
}
@@ -282,16 +280,17 @@
HomeView homeView = new HomeView(mainView);
mainView.showTab(_("lima.tab.home"), homeView, false);
}
-
+
public void showIdentity(JAXXContext rootContext) {
MainView mainView = getUI(rootContext);
IdentityForm identityForm = new IdentityForm();
identityForm.setLocationRelativeTo(mainView);
identityForm.setVisible(true);
}
-
+
/**
* Show account tree table view to create or modify accounts
+ *
* @param rootContext
*/
public void showAccountView(JAXXContext rootContext) {
@@ -299,19 +298,21 @@
AccountView accountView = new AccountView(mainView);
mainView.showTab(_("lima.charts.account"), accountView);
}
-
+
/**
* Show account tree table view to create or modify accounts
+ *
* @param rootContext
*/
public void showEntryBookView(JAXXContext rootContext) {
MainView mainView = getUI(rootContext);
- EntryBookView entryBookView= new EntryBookView(mainView);
+ EntryBookView entryBookView = new EntryBookView(mainView);
mainView.showTab(_("lima.common.entrybooks"), entryBookView);
}
/**
* Show fiscal period view to create or block a period
+ *
* @param rootContext
*/
public void showFiscalPeriodView(JAXXContext rootContext) {
@@ -319,63 +320,69 @@
FiscalPeriodView fiscalPeriodView = new FiscalPeriodView(mainView);
mainView.showTab(_("lima.charts.fiscalyear"), fiscalPeriodView);
}
-
+
/**
* Show financial period view to create or block a period
+ *
* @param rootContext
*/
public void showFinancialPeriodView(JAXXContext rootContext) {
MainView mainView = getUI(rootContext);
FinancialPeriodView financialPeriodView =
- new FinancialPeriodView(mainView);
+ new FinancialPeriodView(mainView);
mainView.showTab(_("lima.charts.financialperiod"), financialPeriodView);
}
-
+
/**
* Show financial statement view to generate balance sheet and income statement
+ *
* @param rootContext
*/
public void showFinancialStatementView(JAXXContext rootContext) {
MainView mainView = getUI(rootContext);
FinancialStatementChartView financialStatementView =
- new FinancialStatementChartView(mainView);
+ new FinancialStatementChartView(mainView);
mainView.showTab(_("lima.charts.financialstatement"), financialStatementView);
}
-
+
/**
* Show vat chart to generate vat document
+ *
* @param rootContext
*/
- public void showVatChartView(JAXXContext rootContext){
- MainView mainView = getUI(rootContext);
- VatChartView vatChartView = new VatChartView(mainView);
- mainView.showTab(_("lima.charts.vatstatement"), vatChartView);
+ public void showVatChartView(JAXXContext rootContext) {
+ MainView mainView = getUI(rootContext);
+ VatChartView vatChartView = new VatChartView(mainView);
+ mainView.showTab(_("lima.charts.vatstatement"), vatChartView);
}
-
+
/**
* Show account table report to view an account on a period
+ *
* @param rootContext
*/
public void showAccountReports(JAXXContext rootContext) {
MainView mainView = getUI(rootContext);
AccountsReportsView accountsReportsView =
- new AccountsReportsView(mainView);
+ new AccountsReportsView(mainView);
mainView.showTab(_("lima.reports.accounts"), accountsReportsView);
}
-
+
/**
* Show entry book table report to view an account on a period
+ *
* @param rootContext
*/
public void showEntryBookReports(JAXXContext rootContext) {
MainView mainView = getUI(rootContext);
- EntryBooksReportsView entryBooksReportsView= new EntryBooksReportsView(mainView);
+ EntryBooksReportsView entryBooksReportsView = new EntryBooksReportsView(mainView);
mainView.showTab(_("lima.reports.entrybooks"), entryBooksReportsView);
}
-
-
+
+
/**
* Show financial transactions view to create entries
+ *
* @param rootContext
*/
public void showTransactionView(JAXXContext rootContext) {
@@ -383,48 +390,48 @@
FinancialTransactionView transactionView = new FinancialTransactionView(mainView);
mainView.showTab(_("lima.entries.writetransaction"), transactionView);
}
-
+
public void showTransactionUnbalancedView(JAXXContext rootContext) {
MainView mainView = getUI(rootContext);
FinancialTransactionUnbalancedView searchResultView = new FinancialTransactionUnbalancedView(mainView);
mainView.showTab(_("lima.entries.searchunbalancedtransaction"), searchResultView);
}
-
+
public void showTransactionSearchView(JAXXContext rootContext) {
MainView mainView = getUI(rootContext);
FinancialTransactionSearchView searchView = new FinancialTransactionSearchView(mainView);
mainView.showTab(_("lima.entries.searchtransaction"), searchView);
}
-
- public void showLetteringView(JAXXContext rootContext){
- MainView mainView = getUI(rootContext);
- LetteringView letteringView = new LetteringView(mainView);
- mainView.showTab(_("lima.entries.lettering"), letteringView);
+
+ public void showLetteringView(JAXXContext rootContext) {
+ MainView mainView = getUI(rootContext);
+ LetteringView letteringView = new LetteringView(mainView);
+ mainView.showTab(_("lima.entries.lettering"), letteringView);
}
-
+
public void showBalanceView(JAXXContext rootContext) {
MainView mainView = getUI(rootContext);
- BalanceView balanceView = new BalanceView(mainView);
- mainView.showTab(_("lima.reports.balance"), balanceView);
+ BalanceView balanceView = new BalanceView(mainView);
+ mainView.showTab(_("lima.reports.balance"), balanceView);
}
-
+
public void showLedgerView(JAXXContext rootContext) {
MainView mainView = getUI(rootContext);
- LedgerView ledgerView = new LedgerView(mainView);
- mainView.showTab(_("lima.reports.ledger"), ledgerView);
+ LedgerView ledgerView = new LedgerView(mainView);
+ mainView.showTab(_("lima.reports.ledger"), ledgerView);
}
-
+
public void showFinancialStatementReportsView(JAXXContext rootContext) {
MainView mainView = getUI(rootContext);
FinancialStatementReportView financialStatementReportView = new FinancialStatementReportView(mainView);
mainView.showTab(_("lima.reports.financialstatement"), financialStatementReportView);
}
-
+
public void showVatReportView(JAXXContext rootContext) {
MainView mainView = getUI(rootContext);
VatReportView vatReportView = new VatReportView(mainView);
mainView.showTab(_("lima.reports.vat"), vatReportView);
-
+
}
public void showImportExportView(JAXXContext rootContext, ImportExportEnum type) {
Modified: 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 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountTreeTable.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -24,34 +24,34 @@
*/
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;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jdesktop.swingx.JXTreeTable;
-
public class AccountTreeTable extends JXTreeTable
implements KeyListener, MouseListener {
- /** serialVersionUID. */
- private static final long serialVersionUID = 1092873442245932784L;
+ /** serialVersionUID. */
+ private static final long serialVersionUID = 1092873442245932784L;
- /** log. */
+ /** 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
@@ -89,9 +89,9 @@
public void keyPressed(KeyEvent e) {
// clear row selection with the key: escape
if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
- if (!isEditing()) {
+ if (!isEditing()) {
clearSelection();
- }
+ }
}
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountTreeTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountTreeTableModel.java 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountTreeTableModel.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -25,9 +25,6 @@
package org.chorem.lima.ui.account;
-import static org.nuiton.i18n.I18n._;
-import java.util.List;
-import javax.swing.tree.TreePath;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.AccountServiceMonitorable;
@@ -38,34 +35,37 @@
import org.chorem.lima.service.LimaServiceFactory;
import org.jdesktop.swingx.treetable.AbstractTreeTableModel;
+import javax.swing.tree.TreePath;
+import java.util.List;
+
+import static org.nuiton.i18n.I18n._;
+
/**
* Tree table model for account edition.
- *
+ *
* @author ore
* @author chatellier
* @version $Revision$
- *
- * Last update : $Date$
- * By : $Author$
+ * <p/>
+ * Last update : $Date$
+ * By : $Author$
*/
public class AccountTreeTableModel extends AbstractTreeTableModel {
-
+
/** log. */
private static final Log log = LogFactory.getLog(AccountViewHandler.class);
-
+
/** Account service. */
protected final AccountServiceMonitorable accountService;
- /**
- * Model constructor. Init account service used here.
- */
+ /** Model constructor. Init account service used here. */
public AccountTreeTableModel() {
// root
super(new AccountImpl());
// Gets factory service
accountService =
- LimaServiceFactory.getInstance().getService(
- AccountServiceMonitorable.class);
+ LimaServiceFactory.getInstance().getService(
+ AccountServiceMonitorable.class);
}
@@ -97,8 +97,7 @@
} catch (LimaException eee) {
log.debug("Can't count child", eee);
}
- }
- else {
+ } else {
Account parentAccount = (Account) node;
try {
result = accountService.getChildrenAccounts(parentAccount).size();
@@ -115,19 +114,18 @@
if (parent == getRoot()) {
try {
List<Account> allAccounts =
- accountService.getChildrenAccounts(null);
+ accountService.getChildrenAccounts(null);
result = allAccounts.get(index);
} catch (LimaException eee) {
log.debug("Can't get child", eee);
}
- }
- else {
+ } else {
Account parentAccount = (Account) parent;
// FIXME sub account is a collection ?
try {
List<Account> subaccounts =
- accountService.getChildrenAccounts(parentAccount);
+ accountService.getChildrenAccounts(parentAccount);
result = subaccounts.get(index);
} catch (LimaException eee) {
log.debug("Can't get child", eee);
@@ -141,21 +139,20 @@
int result = 0;
Account parentAccount = (Account) parent;
Account childAccount = (Account) child;
-
+
if (parent == getRoot()) {
try {
List<Account> allAccounts =
- accountService.getChildrenAccounts(null);
+ accountService.getChildrenAccounts(null);
result = allAccounts.indexOf(child);
} catch (LimaException eee) {
log.debug("Can't get index child", eee);
}
- }
- else {
+ } else {
// FIXME sub account is a collection ?
try {
List<Account> subaccounts =
- accountService.getChildrenAccounts(parentAccount);
+ accountService.getChildrenAccounts(parentAccount);
result = subaccounts.indexOf(childAccount);
} catch (LimaException eee) {
log.debug("Can't get index child", eee);
@@ -163,7 +160,7 @@
}
return result;
}
-
+
@Override
public Object getValueAt(Object node, int column) {
Object result = "n/a";
@@ -190,15 +187,15 @@
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{
+ 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);
@@ -207,7 +204,7 @@
/**
* Add account
- *
+ *
* @param parentAccount
* @param account
* @throws LimaException
@@ -218,34 +215,30 @@
//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{
+ try {
accountService.updateAccount(account);
- }
- catch (LimaBusinessException eee) {
+ } catch (LimaBusinessException eee) {
//modelSupport.fireTreeStructureChanged(path);
throw new LimaBusinessException("Can't update account : "
- + account.getAccountNumber(), eee);
+ + 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.
- *
- */
+
+ /** Refresh accountschart. */
public void refreshTree() throws LimaException {
modelSupport.fireNewRoot();
@@ -253,7 +246,7 @@
/**
* Remove account.
- *
+ *
* @param path
* @param account
* @throws LimaException
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 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -49,12 +49,12 @@
/**
* Handler associated with account view.
- *
+ *
* @author chatellier
* @version $Revision$
- *
- * Last update : $Date$
- * By : $Author$
+ * <p/>
+ * Last update : $Date$
+ * By : $Author$
*/
public class AccountViewHandler implements ServiceListener {
@@ -62,28 +62,29 @@
private static final Log log = LogFactory.getLog(AccountViewHandler.class);
protected AccountView view;
-
+
protected AccountServiceMonitorable accountService;
-
+
protected AccountViewHandler(AccountView view) {
this.view = view;
// Gets factory service
LimaServiceFactory.getInstance().getService(
ImportServiceMonitorable.class).addServiceListener(this);
accountService =
- LimaServiceFactory.getInstance().getService(
- AccountServiceMonitorable.class);
+ LimaServiceFactory.getInstance().getService(
+ AccountServiceMonitorable.class);
}
/**
* Add new account with account form.
- * @throws LimaException
+ *
+ * @throws LimaException
*/
public void addAccount() {
-
+
JXTreeTable accountsTreeTable = view.getAccountsTreeTable();
AccountTreeTableModel accountsTreeTableModel =
- (AccountTreeTableModel)accountsTreeTable.getTreeTableModel();
+ (AccountTreeTableModel) accountsTreeTable.getTreeTableModel();
Account newAccount = new AccountImpl();
AccountForm accountForm = new AccountForm(view);
@@ -91,8 +92,8 @@
// jaxx constructor don't call super() ?
accountForm.setLocationRelativeTo(view);
accountForm.setVisible(true);
-
-
+
+
// null == cancel action
newAccount = accountForm.getAccount();
Account parentAccount = new AccountImpl();
@@ -103,7 +104,7 @@
//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
- for (int i = 1; i<number.length(); i++) {
+ for (int i = 1; i < number.length(); i++) {
try {
//get the parent account from the new account subnumber
parentAccount = accountService.getAccountByNumber(number.substring(0, i));
@@ -113,14 +114,14 @@
if (parentAccount == null) {
try {
//if the account is null, get the previous account searched then stop the loop
- parentAccount = accountService.getAccountByNumber(number.substring(0, i-1));
+ parentAccount = accountService.getAccountByNumber(number.substring(0, i - 1));
break;
} catch (LimaException eee) {
- log.debug("Can't search account : " + number.substring(0, i-1), eee);
+ log.debug("Can't search account : " + number.substring(0, i - 1), eee);
}
}
}
-
+
// add it
try {
accountsTreeTableModel.addAccount(parentAccount, newAccount);
@@ -130,39 +131,39 @@
}
DialogHelper.showErrorMessageDialog(view, eee);
- }
-
- catch (LimaException ex) {
+ } catch (LimaException ex) {
if (log.isErrorEnabled()) {
log.error("Can't add account", ex);
}
ErrorHelper.showErrorDialog(_("lima.account.addaccounterror"), ex);
}
}
- };
-
- public void addSubLedger(){
-
+ }
+
+ ;
+
+ public void addSubLedger() {
+
JXTreeTable accountsTreeTable = view.getAccountsTreeTable();
AccountTreeTableModel accountsTreeTableModel =
- (AccountTreeTableModel)accountsTreeTable.getTreeTableModel();
+ (AccountTreeTableModel) accountsTreeTable.getTreeTableModel();
Account newAccount = new AccountImpl();
SubLedgerForm subledgerForm = new SubLedgerForm(view);
subledgerForm.setAccount(newAccount);
// jaxx constructor don't call super() ?
subledgerForm.setLocationRelativeTo(view);
subledgerForm.setVisible(true);
- newAccount=subledgerForm.getAccount();
-
+ newAccount = subledgerForm.getAccount();
+
// null == cancel action
if (newAccount != null) {
Account parentAccount = new AccountImpl();
String number = newAccount.getAccountNumber();
-
+
//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
- for (int i = 1; i<=number.length(); i++) {
+ for (int i = 1; i <= number.length(); i++) {
try {
//get the parent account from the new account subnumber
parentAccount = accountService.getAccountByNumber(number.substring(0, i));
@@ -172,14 +173,14 @@
if (parentAccount == null) {
try {
//if the account is null, get the previous account searched then stop the loop
- parentAccount = accountService.getAccountByNumber(number.substring(0, i-1));
+ parentAccount = accountService.getAccountByNumber(number.substring(0, i - 1));
break;
} catch (LimaException eee) {
- log.debug("Can't search account : " + number.substring(0, i-1), eee);
+ log.debug("Can't search account : " + number.substring(0, i - 1), eee);
}
}
}
-
+
// add it
try {
accountsTreeTableModel.addSubLedger(parentAccount, newAccount);
@@ -188,9 +189,7 @@
log.error("Can't add subledger", eee);
}
DialogHelper.showErrorMessageDialog(view, eee);
- }
-
- catch (LimaException eee) {
+ } catch (LimaException eee) {
if (log.isErrorEnabled()) {
log.error("Can't add subledger", eee);
}
@@ -206,82 +205,80 @@
public void updateAccount() {
JXTreeTable accountsTreeTable = view.getAccountsTreeTable();
AccountTreeTableModel accountsTreeTableModel =
- (AccountTreeTableModel)accountsTreeTable.getTreeTableModel();
+ (AccountTreeTableModel) accountsTreeTable.getTreeTableModel();
// get selected account
int selectedRow = view.getAccountsTreeTable().getSelectedRow();
TreePath treePath = view.getAccountsTreeTable().getPathForRow(selectedRow); // not null
- Account selectedObject = (Account)treePath.getLastPathComponent();
- //update Account or update SubLedger
+ Account selectedObject = (Account) treePath.getLastPathComponent();
+ //update Account or update SubLedger
+ if (selectedObject != null) {
+ // get current selection path
+ if (selectedRow != -1) {
+ treePath = view.getAccountsTreeTable().getPathForRow(selectedRow);
+ } else {
+ treePath = new TreePath(accountsTreeTableModel.getRoot());
+ }
+ //test if selectedrow is account or ledger
+ if (selectedObject.getGeneralLedger() == null) {
+ UpdateAccountForm accountForm = new UpdateAccountForm(view);
+ accountForm.setAccount(selectedObject);
+ // jaxx constructor don't call super() ?
+ accountForm.setLocationRelativeTo(view);
+ accountForm.setVisible(true);
+ // null == cancel action
+ selectedObject = accountForm.getAccount();
+ }
+ // else is a subledger
+ else {
+ UpdateSubLedgerForm subLedgerForm = new UpdateSubLedgerForm(view);
+ subLedgerForm.setAccount(selectedObject);
+ // jaxx constructor don't call super() ?
+ subLedgerForm.setLocationRelativeTo(view);
+ subLedgerForm.setVisible(true);
+ // null == cancel action
+ selectedObject = subLedgerForm.getAccount();
+ }
+ //if action confirmed
if (selectedObject != null) {
- // get current selection path
- if ( selectedRow != -1) {
- treePath = view.getAccountsTreeTable().getPathForRow(selectedRow);
- } else {
- treePath = new TreePath(accountsTreeTableModel.getRoot());
- }
- //test if selectedrow is account or ledger
- if (selectedObject.getGeneralLedger()==null) {
- UpdateAccountForm accountForm = new UpdateAccountForm(view);
- accountForm.setAccount(selectedObject);
- // jaxx constructor don't call super() ?
- accountForm.setLocationRelativeTo(view);
- accountForm.setVisible(true);
- // null == cancel action
- selectedObject = accountForm.getAccount();
- }
- // else is a subledger
- else {
- UpdateSubLedgerForm subLedgerForm = new UpdateSubLedgerForm(view);
- subLedgerForm.setAccount(selectedObject);
- // jaxx constructor don't call super() ?
- subLedgerForm.setLocationRelativeTo(view);
- subLedgerForm.setVisible(true);
- // null == cancel action
- selectedObject = subLedgerForm.getAccount();
- }
- //if action confirmed
- if (selectedObject != null) {
- // update it
- try {
- accountsTreeTableModel.
- updateAccount(selectedObject);
- } catch (LimaException eee) {
- if (log.isErrorEnabled()) {
- log.error("Can't add update", eee);
- }
- DialogHelper.showErrorMessageDialog(view, eee);
+ // update it
+ try {
+ accountsTreeTableModel.
+ updateAccount(selectedObject);
+ } catch (LimaException eee) {
+ if (log.isErrorEnabled()) {
+ log.error("Can't add update", eee);
}
+ DialogHelper.showErrorMessageDialog(view, eee);
}
}
-
+ }
+
}
- /**
- * Ask for user to remove for selected account, and remove it if confirmed.
- */
+ /** Ask for user to remove for selected account, and remove it if confirmed. */
public void removeAccount() {
// maybe this code can be factorised
JXTreeTable accountsTreeTable = view.getAccountsTreeTable();
AccountTreeTableModel accountsTreeTableModel =
- (AccountTreeTableModel)accountsTreeTable.getTreeTableModel();
+ (AccountTreeTableModel) accountsTreeTable.getTreeTableModel();
// Any row selected
int selectedRow = view.getAccountsTreeTable().getSelectedRow();
- if ( selectedRow != -1) {
+ if (selectedRow != -1) {
int n = JOptionPane.showConfirmDialog(view,
- _("lima.charts.account.question.remove"),
- _("lima.common.question"),
- JOptionPane.YES_NO_OPTION,
- JOptionPane.QUESTION_MESSAGE);
+ _("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 = view.getAccountsTreeTable().
- getPathForRow(selectedRow);
+ getPathForRow(selectedRow);
Account account = (Account) treePath.getLastPathComponent();
- try{
+ try {
accountsTreeTableModel.removeAccount(treePath, account);
} catch (LimaException eee) {
if (log.isErrorEnabled()) {
@@ -292,57 +289,57 @@
}
}
}
-
- public void refresh(){
+
+ public void refresh() {
JXTreeTable accountsTreeTable = view.getAccountsTreeTable();
AccountTreeTableModel accountsTreeTableModel =
- (AccountTreeTableModel)accountsTreeTable.getTreeTableModel();
- try {
- accountsTreeTableModel.refreshTree();
+ (AccountTreeTableModel) accountsTreeTable.getTreeTableModel();
+ try {
+ accountsTreeTableModel.refreshTree();
} catch (LimaException eee) {
- if(log.isDebugEnabled()){
+ if (log.isDebugEnabled()) {
log.debug("Can't refresh model", eee);
}
}
//refresh view
view.repaint();
- }
-
- public void importAccountsChart(){
-
- AccountImportForm form = new AccountImportForm();
- //
- form.setLocationRelativeTo(view);
- form.setVisible(true);
-
- ImportExport importExport = ImportExport.getInstance(view);
+ }
- Object value = form.getRadioButtons().getSelectedValue();
- // if action confirmed
- if (value != null){
- AccountsChartEnum defaultAccountsChartEnum =
- (AccountsChartEnum) value;
- //Import accounts chart
- switch (defaultAccountsChartEnum) {
- case IMPORTEBP:
- importExport.importExport(ImportExportEnum.EBP_ACCOUNTCHARTS_IMPORT,
- defaultAccountsChartEnum.getFilePath(), false);
- break;
+ public void importAccountsChart() {
- default:
- importExport.importExport(ImportExportEnum.CSV_ACCOUNTCHARTS_IMPORT,
- defaultAccountsChartEnum.getFilePath(), false);
- break;
- }
- }
+ AccountImportForm form = new AccountImportForm();
+ //
+ form.setLocationRelativeTo(view);
+ form.setVisible(true);
+
+ ImportExport importExport = ImportExport.getInstance(view);
+
+ Object value = form.getRadioButtons().getSelectedValue();
+ // if action confirmed
+ if (value != null) {
+ AccountsChartEnum defaultAccountsChartEnum =
+ (AccountsChartEnum) value;
+ //Import accounts chart
+ switch (defaultAccountsChartEnum) {
+ case IMPORTEBP:
+ importExport.importExport(ImportExportEnum.EBP_ACCOUNTCHARTS_IMPORT,
+ defaultAccountsChartEnum.getFilePath(), false);
+ break;
+
+ default:
+ importExport.importExport(ImportExportEnum.CSV_ACCOUNTCHARTS_IMPORT,
+ defaultAccountsChartEnum.getFilePath(), false);
+ break;
+ }
+ }
}
-
+
@Override
public void notifyMethod(String serviceName, String methodeName) {
-
- if (methodeName.contains("importAccounts") || methodeName.contains("importAll") || methodeName.contains("importAsCSV")){
+
+ if (methodeName.contains("importAccounts") || methodeName.contains("importAll") || methodeName.contains("importAsCSV")) {
refresh();
}
}
-
+
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountComboBox.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountComboBox.java 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountComboBox.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -25,11 +25,6 @@
package org.chorem.lima.ui.accountsreports;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.KeyEvent;
-import java.awt.event.KeyListener;
-import javax.swing.JComboBox;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.entity.Account;
@@ -38,15 +33,20 @@
import org.chorem.lima.util.AccountToString;
import org.jdesktop.swingx.autocomplete.AutoCompleteDecorator;
+import javax.swing.JComboBox;
+import java.awt.event.ActionEvent;
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
+
public class AccountComboBox extends JComboBox implements KeyListener {
private static final long serialVersionUID = 1L;
private static final Log log =
- LogFactory.getLog(AccountComboBox.class);
-
+ LogFactory.getLog(AccountComboBox.class);
+
protected AccountsReportsViewHandler handler;
-
+
public AccountComboBox(AccountsReportsViewHandler handler) {
this.handler = handler;
AccountComboBoxModel accountComboBoxModel = new AccountComboBoxModel();
@@ -59,30 +59,30 @@
addActionListener(this);
}
- public void back(){
+ public void back() {
int row = getSelectedIndex();
log.debug(row);
- if (row > 0){
- getEditor().setItem(getItemAt(row-1));
+ if (row > 0) {
+ getEditor().setItem(getItemAt(row - 1));
handler.setAccount((Account) getSelectedItem());
}
}
-
- public void next(){
+
+ public void next() {
int size = getModel().getSize();
int row = getSelectedIndex();
log.debug(row);
-
- if (row < size-1){
- getEditor().setItem(getItemAt(row+1));
+
+ if (row < size - 1) {
+ getEditor().setItem(getItemAt(row + 1));
handler.setAccount((Account) getSelectedItem());
}
}
-
+
@Override
public void actionPerformed(ActionEvent e) {
Object object = getSelectedItem();
- if (object instanceof Account){
+ if (object instanceof Account) {
handler.setAccount((Account) getSelectedItem());
}
}
@@ -90,26 +90,25 @@
@Override
public void keyPressed(KeyEvent e) {
-
+
}
@Override
public void keyReleased(KeyEvent e) {
Object object = getSelectedItem();
- if (object instanceof Account){
+ if (object instanceof Account) {
handler.setAccount((Account) getSelectedItem());
}
-
+
// delegate popup list menu
- if ( e.getKeyChar() == KeyEvent.VK_ENTER )
- {
+ if (e.getKeyChar() == KeyEvent.VK_ENTER) {
firePopupMenuCanceled();
}
}
@Override
public void keyTyped(KeyEvent e) {
-
+
}
-
+
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsPeriodSearchPanel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsPeriodSearchPanel.java 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsPeriodSearchPanel.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -25,14 +25,6 @@
package org.chorem.lima.ui.accountsreports;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.util.Calendar;
-import java.util.Date;
-import static org.nuiton.i18n.I18n._;
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
import org.apache.commons.lang.time.DateUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -40,120 +32,129 @@
import org.chorem.lima.entity.FiscalPeriod;
import org.chorem.lima.enums.ComboBoxDatesEnum;
import org.chorem.lima.ui.combobox.FinancialPeriodComboBoxModel;
-import org.chorem.lima.ui.combobox.FinancialPeriodComboBoxRenderer;
import org.chorem.lima.ui.combobox.FiscalPeriodComboBoxModel;
-import org.chorem.lima.ui.combobox.FiscalPeriodComboBoxRenderer;
+import org.chorem.lima.ui.renderers.RendererUtil;
import org.jdesktop.swingx.JXDatePicker;
+import javax.swing.JComboBox;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.ListCellRenderer;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.Calendar;
+import java.util.Date;
+
+import static org.nuiton.i18n.I18n._;
+
public class AccountsReportsPeriodSearchPanel extends JPanel {
-
+
private static final Log log =
- LogFactory.getLog(AccountsReportsPeriodSearchPanel.class);
-
+ LogFactory.getLog(AccountsReportsPeriodSearchPanel.class);
+
protected AccountsReportsViewHandler handler;
-
+
public AccountsReportsPeriodSearchPanel(AccountsReportsViewHandler handler) {
this.handler = handler;
-
+
//init date
refresh(ComboBoxDatesEnum.FISCAL_PERIOD);
}
-
- static final long serialVersionUID = 1L;
- public void refresh(ComboBoxDatesEnum comboBoxPeriodEnum){
-
+ public void refresh(ComboBoxDatesEnum comboBoxPeriodEnum) {
+
switch (comboBoxPeriodEnum) {
- case PERIOD:
- // get begin date
- Calendar calendarBegin = Calendar.getInstance();
- // set begindate to JAN 1 - 0:00.000 of this years
- Date beginDate = calendarBegin.getTime();
- beginDate = DateUtils.truncate(beginDate, Calendar.YEAR);
- //handler().setBeginDate(beginDate);
-
- // get end date
- Calendar calendarEnd = Calendar.getInstance();
- Date endDate = calendarEnd.getTime();
- //handler().setEndDate(endDate);
- JLabel beginDateLabel = new JLabel(_("lima.common.begindate"));
- final JXDatePicker beginDatePicker = new JXDatePicker(beginDate);
- ActionListener beginDateActionListener = new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- handler.setBeginDate(beginDatePicker.getDate());
- handler.refresh();
- }
- };
- handler.setBeginDate(beginDatePicker.getDate());
- beginDatePicker.addActionListener(beginDateActionListener);
-
- JLabel endDateLabel = new JLabel(_("lima.common.enddate"));
- final JXDatePicker endDatePicker = new JXDatePicker(endDate);
- ActionListener endDateActionListener = new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- handler.setEndDate(endDatePicker.getDate());
- handler.refresh();
- }
- };
- handler.setEndDate(endDatePicker.getDate());
- endDatePicker.addActionListener(endDateActionListener);
- handler.refresh();
+ case PERIOD:
+ // get begin date
+ Calendar calendarBegin = Calendar.getInstance();
+ // set begindate to JAN 1 - 0:00.000 of this years
+ Date beginDate = calendarBegin.getTime();
+ beginDate = DateUtils.truncate(beginDate, Calendar.YEAR);
+ //handler().setBeginDate(beginDate);
- removeAll();
- add(beginDateLabel);
- add(beginDatePicker);
- add(endDateLabel);
- add(endDatePicker);
- break;
-
- case FISCAL_PERIOD:
- FiscalPeriodComboBoxModel fiscalModel = new FiscalPeriodComboBoxModel(true);
- FiscalPeriodComboBoxRenderer fiscalRenderer = new FiscalPeriodComboBoxRenderer();
- final JComboBox fiscalPeriod = new JComboBox(fiscalModel);
- fiscalPeriod.setRenderer(fiscalRenderer);
- fiscalPeriod.setEditable(false);
- ActionListener fiscalPeriodActionListener = new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- FiscalPeriod fPeriod = (FiscalPeriod) fiscalPeriod.getSelectedItem();
- if (fPeriod != null){
- handler.setBeginDate(fPeriod.getBeginDate());
- handler.setEndDate(fPeriod.getEndDate());
- handler.refresh();
+ // get end date
+ Calendar calendarEnd = Calendar.getInstance();
+ Date endDate = calendarEnd.getTime();
+ //handler().setEndDate(endDate);
+ JLabel beginDateLabel = new JLabel(_("lima.common.begindate"));
+ final JXDatePicker beginDatePicker = new JXDatePicker(beginDate);
+ ActionListener beginDateActionListener = new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ handler.setBeginDate(beginDatePicker.getDate());
+ handler.refresh();
}
- }
- };
- fiscalPeriod.addActionListener(fiscalPeriodActionListener);
+ };
+ handler.setBeginDate(beginDatePicker.getDate());
+ beginDatePicker.addActionListener(beginDateActionListener);
- removeAll();
- add(fiscalPeriod);
- break;
-
- case FINANCIAL_PERIOD:
- FinancialPeriodComboBoxModel financialModel = new FinancialPeriodComboBoxModel(true);
- FinancialPeriodComboBoxRenderer financialRenderer = new FinancialPeriodComboBoxRenderer();
- final JComboBox financialPeriod = new JComboBox(financialModel);
- financialPeriod.setRenderer(financialRenderer);
- financialPeriod.setEditable(false);
- ActionListener financialPeriodActionListener = new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- FinancialPeriod fPeriod = (FinancialPeriod) financialPeriod.getSelectedItem();
- if (fPeriod !=null){
- handler.setBeginDate(fPeriod.getBeginDate());
- handler.setEndDate(fPeriod.getEndDate());
- handler.refresh();
+ JLabel endDateLabel = new JLabel(_("lima.common.enddate"));
+ final JXDatePicker endDatePicker = new JXDatePicker(endDate);
+ ActionListener endDateActionListener = new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ handler.setEndDate(endDatePicker.getDate());
+ handler.refresh();
}
- }
- };
- financialPeriod.addActionListener(financialPeriodActionListener);
- removeAll();
- add(financialPeriod);
- break;
+ };
+ handler.setEndDate(endDatePicker.getDate());
+ endDatePicker.addActionListener(endDateActionListener);
+ handler.refresh();
+
+ removeAll();
+ add(beginDateLabel);
+ add(beginDatePicker);
+ add(endDateLabel);
+ add(endDatePicker);
+ break;
+
+ case FISCAL_PERIOD:
+ FiscalPeriodComboBoxModel fiscalModel = new FiscalPeriodComboBoxModel(true);
+ ListCellRenderer renderer =
+ RendererUtil.newDecoratorListCellRenderer(FiscalPeriod.class);
+ final JComboBox fiscalPeriod = new JComboBox(fiscalModel);
+ fiscalPeriod.setRenderer(renderer);
+ fiscalPeriod.setEditable(false);
+ ActionListener fiscalPeriodActionListener = new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ FiscalPeriod fPeriod = (FiscalPeriod) fiscalPeriod.getSelectedItem();
+ if (fPeriod != null) {
+ handler.setBeginDate(fPeriod.getBeginDate());
+ handler.setEndDate(fPeriod.getEndDate());
+ handler.refresh();
+ }
+ }
+ };
+ fiscalPeriod.addActionListener(fiscalPeriodActionListener);
+
+ removeAll();
+ add(fiscalPeriod);
+ break;
+
+ case FINANCIAL_PERIOD:
+ FinancialPeriodComboBoxModel financialModel = new FinancialPeriodComboBoxModel(true);
+ renderer = RendererUtil.newDecoratorListCellRenderer(FinancialPeriod.class);
+ final JComboBox financialPeriod = new JComboBox(financialModel);
+ financialPeriod.setRenderer(renderer);
+ financialPeriod.setEditable(false);
+ ActionListener financialPeriodActionListener = new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ FinancialPeriod fPeriod = (FinancialPeriod) financialPeriod.getSelectedItem();
+ if (fPeriod != null) {
+ handler.setBeginDate(fPeriod.getBeginDate());
+ handler.setEndDate(fPeriod.getEndDate());
+ handler.refresh();
+ }
+ }
+ };
+ financialPeriod.addActionListener(financialPeriodActionListener);
+ removeAll();
+ add(financialPeriod);
+ break;
}
-
+
}
-
+
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsTable.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsTable.java 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsTable.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -24,19 +24,17 @@
*/
package org.chorem.lima.ui.accountsreports;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.chorem.lima.ui.celleditor.BigDecimalTableCellRenderer;
+import org.jdesktop.swingx.JXTable;
+
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.math.BigDecimal;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.chorem.lima.ui.accountsreports.AccountsReportsTable;
-import org.chorem.lima.ui.accountsreports.AccountsReportsViewHandler;
-import org.chorem.lima.ui.celleditor.BigDecimalTableCellRenderer;
-import org.jdesktop.swingx.JXTable;
-
public class AccountsReportsTable extends JXTable
implements KeyListener, MouseListener {
@@ -46,16 +44,16 @@
/** log. */
private static final Log log = LogFactory
.getLog(AccountsReportsTable.class);
-
+
protected AccountsReportsViewHandler handler;
public AccountsReportsTable(AccountsReportsViewHandler handler) {
this.handler = handler;
-
+
addKeyListener(this);
addMouseListener(this);
-
+
//Get new BigDecimal renderer
setDefaultRenderer(BigDecimal.class, new BigDecimalTableCellRenderer());
@@ -96,9 +94,9 @@
public void keyPressed(KeyEvent e) {
// clear row selection with the key: escape
if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
- if (!isEditing()) {
+ if (!isEditing()) {
clearSelection();
- }
+ }
}
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsTableModel.java 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsTableModel.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -25,13 +25,6 @@
package org.chorem.lima.ui.accountsreports;
-import static org.nuiton.i18n.I18n._;
-
-import java.math.BigDecimal;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-import javax.swing.table.AbstractTableModel;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.beans.ReportsDatas;
@@ -39,29 +32,36 @@
import org.chorem.lima.entity.Entry;
import org.chorem.lima.entity.Letter;
+import javax.swing.table.AbstractTableModel;
+import java.math.BigDecimal;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import static org.nuiton.i18n.I18n._;
+
/**
* Entry book table model.
* By : $Author$
*/
-public class AccountsReportsTableModel extends AbstractTableModel{
+public class AccountsReportsTableModel extends AbstractTableModel {
/** serialVersionUID. */
private static final long serialVersionUID = 1L;
/** log. */
private static final Log log = LogFactory.getLog(AccountsReportsTableModel.class);
-
+
/** data cache */
protected ReportsDatas cacheDataList;
-
+
@Override
public int getRowCount() {
int result = 0;
-
+
// just prevent too much result
if (cacheDataList != null) {
- if (cacheDataList.getListEntry() != null){
+ if (cacheDataList.getListEntry() != null) {
result = cacheDataList.getListEntry().size();
}
}
@@ -73,37 +73,37 @@
public int getColumnCount() {
return 8;
}
-
+
@Override
public Class<?> getColumnClass(int column) {
Class<?> result = null;
switch (column) {
- case 0:
- result = Account.class;
- break;
- case 1:
- result = Date.class;
- break;
- case 2:
- result = Entry.class;
- break;
- case 3:
- result = String.class;
- break;
- case 4:
- result = String.class;
- break;
- case 5:
- result = Letter.class;
- break;
- case 6:
- result = BigDecimal.class;
- break;
- case 7:
- result = BigDecimal.class;
- break;
+ case 0:
+ result = Account.class;
+ break;
+ case 1:
+ result = Date.class;
+ break;
+ case 2:
+ result = Entry.class;
+ break;
+ case 3:
+ result = String.class;
+ break;
+ case 4:
+ result = String.class;
+ break;
+ case 5:
+ result = Letter.class;
+ break;
+ case 6:
+ result = BigDecimal.class;
+ break;
+ case 7:
+ result = BigDecimal.class;
+ break;
}
return result;
@@ -145,11 +145,11 @@
@Override
public Object getValueAt(int row, int column) {
Object result = null;
- if(cacheDataList != null) {
+ if (cacheDataList != null) {
Entry currentRow = cacheDataList.getListEntry().get(row);
SimpleDateFormat simpleDateFormat
- = new SimpleDateFormat("dd MMMMM yyyy");
-
+ = new SimpleDateFormat("dd MMMMM yyyy");
+
switch (column) {
case 0:
result = currentRow.getAccount().getAccountNumber();
@@ -159,10 +159,9 @@
format(currentRow.getFinancialTransaction().getTransactionDate());
break;
case 2:
- if (currentRow.getFinancialTransaction().getEntryBook() != null){
+ if (currentRow.getFinancialTransaction().getEntryBook() != null) {
result = currentRow.getFinancialTransaction().getEntryBook().getCode();
- }
- else {
+ } else {
result = null;
}
break;
@@ -173,10 +172,9 @@
result = currentRow.getDescription();
break;
case 5:
- if (currentRow.getLetter() != null){
+ if (currentRow.getLetter() != null) {
result = currentRow.getLetter().getCode();
- }
- else {
+ } else {
result = null;
}
break;
@@ -187,8 +185,7 @@
result = currentRow.getDebit() ? BigDecimal.ZERO : currentRow.getAmount();
break;
}
- }
- else {
+ } else {
if (log.isDebugEnabled()) {
log.debug("No Account selected skip table model update");
}
@@ -203,10 +200,10 @@
// Just read, no write
return false;
}
-
- public void refresh(ReportsDatas datasList){
+
+ public void refresh(ReportsDatas datasList) {
cacheDataList = datasList;
fireTableDataChanged();
}
-
+
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsViewHandler.java 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsViewHandler.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -25,10 +25,6 @@
package org.chorem.lima.ui.accountsreports;
-import static org.nuiton.i18n.I18n._;
-
-import java.math.BigDecimal;
-import java.util.Date;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.beans.ReportsDatas;
@@ -42,7 +38,12 @@
import org.chorem.lima.ui.combobox.AccountComboBoxModel;
import org.chorem.lima.util.ErrorHelper;
+import java.math.BigDecimal;
+import java.util.Date;
+import static org.nuiton.i18n.I18n._;
+
+
/**
* Handler associated with accounts reports view.
* By : $Author$
@@ -50,65 +51,64 @@
public class AccountsReportsViewHandler implements ServiceListener {
protected AccountsReportsView view;
-
+
protected AccountsReportsTable table;
-
+
protected AccountsReportsTableModel tableModel;
-
+
protected AccountComboBoxModel comboBoxModel;
-
+
/** log. */
private static final Log log = LogFactory.getLog(AccountsReportsViewHandler.class);
-
+
/** Account. */
protected Account selectedAccount;
-
+
/** Begin Date. */
protected Date selectedBeginDate;
-
+
/** EndDate. */
protected Date selectedEndDate;
-
+
/** Services. */
protected ReportServiceMonitorable reportService;
-
+
protected AccountsReportsViewHandler(AccountsReportsView view) {
this.view = view;
-
+
reportService =
- LimaServiceFactory.getInstance().getService(
- ReportServiceMonitorable.class);
+ LimaServiceFactory.getInstance().getService(
+ ReportServiceMonitorable.class);
LimaServiceFactory.getInstance().getService(
ImportServiceMonitorable.class).addServiceListener(this);
LimaServiceFactory.getInstance().getService(
FinancialTransactionServiceMonitorable.class).addServiceListener(this);
}
-
- public void setBeginDate(Date date){
+
+ public void setBeginDate(Date date) {
selectedBeginDate = date;
refresh();
}
-
- public void setEndDate(Date date){
+
+ public void setEndDate(Date date) {
selectedEndDate = date;
refresh();
}
-
+
public void setAccount(Account account) {
selectedAccount = account;
refresh();
}
-
- public ReportsDatas getDataList(){
+
+ public ReportsDatas getDataList() {
ReportsDatas results = null;
//avoid unnecessary call to service
- if (selectedAccount != null){
+ if (selectedAccount != null) {
try {
results = reportService.generateAccountsReports(selectedAccount, true,
- selectedBeginDate, selectedEndDate);
- }
- catch (LimaException eee) {
+ selectedBeginDate, selectedEndDate);
+ } catch (LimaException eee) {
if (log.isErrorEnabled()) {
log.debug("Can't update model", eee);
}
@@ -117,20 +117,20 @@
}
return results;
}
-
- public void refresh(){
-
- if (selectedBeginDate != null && selectedEndDate != null && selectedAccount != null){
+
+ public void refresh() {
+
+ if (selectedBeginDate != null && selectedEndDate != null && selectedAccount != null) {
ReportsDatas datasList = getDataList();
-
+
tableModel = view.getModelAccountsReportsTable();
tableModel.refresh(datasList);
-
- /**
- * set text and amounts of labels credit, debit, solde
- */
-
- if (datasList != null){
+
+ /**
+ * set text and amounts of labels credit, debit, solde
+ */
+
+ if (datasList != null) {
// set amounts credit and debit and solde
view.amountCreditLabel.setText(
datasList.getAmountCredit().toString());
@@ -138,29 +138,27 @@
datasList.getAmountDebit().toString());
BigDecimal amountSolde = datasList.getAmountSolde();
view.amountSoldeLabel.setText(amountSolde.toString());
-
-
- if (amountSolde == BigDecimal.ZERO){
+
+
+ if (amountSolde == BigDecimal.ZERO) {
view.soldeLabel.setText(_("lima.common.solde"));
- }
- else {
+ } else {
// set label solde: credit or debit
if (datasList.getSoldeDebit()) {
view.soldeLabel.setText(_("lima.common.soldedebit"));
- }
- else {
+ } else {
view.soldeLabel.setText(_("lima.common.soldecredit"));
}
}
}
}
}
-
+
@Override
public void notifyMethod(String serviceName, String methodeName) {
- if (serviceName.contains("FinancialTransaction") || methodeName.contains("importAccount") || methodeName.contains("importAll")){
+ if (serviceName.contains("FinancialTransaction") || methodeName.contains("importAccount") || methodeName.contains("importAll")) {
refresh();
}
}
-
+
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalancePeriodSearchPanel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalancePeriodSearchPanel.java 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalancePeriodSearchPanel.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -25,14 +25,6 @@
package org.chorem.lima.ui.balance;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.util.Calendar;
-import java.util.Date;
-import static org.nuiton.i18n.I18n._;
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
import org.apache.commons.lang.time.DateUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -40,121 +32,132 @@
import org.chorem.lima.entity.FiscalPeriod;
import org.chorem.lima.enums.ComboBoxDatesEnum;
import org.chorem.lima.ui.combobox.FinancialPeriodComboBoxModel;
-import org.chorem.lima.ui.combobox.FinancialPeriodComboBoxRenderer;
import org.chorem.lima.ui.combobox.FiscalPeriodComboBoxModel;
-import org.chorem.lima.ui.combobox.FiscalPeriodComboBoxRenderer;
+import org.chorem.lima.ui.renderers.RendererUtil;
import org.jdesktop.swingx.JXDatePicker;
+import javax.swing.JComboBox;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.ListCellRenderer;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.Calendar;
+import java.util.Date;
+
+import static org.nuiton.i18n.I18n._;
+
public class BalancePeriodSearchPanel extends JPanel {
-
+
private static final Log log =
- LogFactory.getLog(BalancePeriodSearchPanel.class);
-
+ LogFactory.getLog(BalancePeriodSearchPanel.class);
+
protected BalanceViewHandler handler;
-
+
public BalancePeriodSearchPanel(BalanceViewHandler handler) {
this.handler = handler;
-
+
//init date
refresh(ComboBoxDatesEnum.FISCAL_PERIOD);
}
-
- static final long serialVersionUID = 1L;
- public void refresh(ComboBoxDatesEnum comboBoxPeriodEnum){
-
+ public void refresh(ComboBoxDatesEnum comboBoxPeriodEnum) {
+
switch (comboBoxPeriodEnum) {
- case PERIOD:
- // get begin date
- Calendar calendarBegin = Calendar.getInstance();
- // set begindate to JAN 1 - 0:00.000 of this years
- Date beginDate = calendarBegin.getTime();
- beginDate = DateUtils.truncate(beginDate, Calendar.YEAR);
- //handler().setBeginDate(beginDate);
-
- // get end date
- Calendar calendarEnd = Calendar.getInstance();
- Date endDate = calendarEnd.getTime();
- //handler().setEndDate(endDate);
- JLabel beginDateLabel = new JLabel(_("lima.common.begindate"));
- final JXDatePicker beginDatePicker = new JXDatePicker(beginDate);
- ActionListener beginDateActionListener = new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- handler.setBeginDate(beginDatePicker.getDate());
- handler.refresh();
- }
- };
- handler.setBeginDate(beginDatePicker.getDate());
- beginDatePicker.addActionListener(beginDateActionListener);
-
- JLabel endDateLabel = new JLabel(_("lima.common.enddate"));
- final JXDatePicker endDatePicker = new JXDatePicker(endDate);
- ActionListener endDateActionListener = new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- handler.setEndDate(endDatePicker.getDate());
- handler.refresh();
- }
- };
- handler.setEndDate(endDatePicker.getDate());
- endDatePicker.addActionListener(endDateActionListener);
- handler.refresh();
+ case PERIOD:
+ // get begin date
+ Calendar calendarBegin = Calendar.getInstance();
+ // set begindate to JAN 1 - 0:00.000 of this years
+ Date beginDate = calendarBegin.getTime();
+ beginDate = DateUtils.truncate(beginDate, Calendar.YEAR);
+ //handler().setBeginDate(beginDate);
- removeAll();
- add(beginDateLabel);
- add(beginDatePicker);
- add(endDateLabel);
- add(endDatePicker);
- break;
-
- case FISCAL_PERIOD:
- FiscalPeriodComboBoxModel fiscalModel = new FiscalPeriodComboBoxModel(true);
- FiscalPeriodComboBoxRenderer fiscalRenderer = new FiscalPeriodComboBoxRenderer();
- final JComboBox fiscalPeriod = new JComboBox(fiscalModel);
- fiscalPeriod.setRenderer(fiscalRenderer);
- fiscalPeriod.setEditable(false);
- ActionListener fiscalPeriodActionListener = new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- FiscalPeriod fPeriod = (FiscalPeriod) fiscalPeriod.getSelectedItem();
- if (fPeriod !=null){
- handler.setBeginDate(fPeriod.getBeginDate());
- handler.setEndDate(fPeriod.getEndDate());
+ // get end date
+ Calendar calendarEnd = Calendar.getInstance();
+ Date endDate = calendarEnd.getTime();
+ //handler().setEndDate(endDate);
+ JLabel beginDateLabel = new JLabel(_("lima.common.begindate"));
+ final JXDatePicker beginDatePicker = new JXDatePicker(beginDate);
+ ActionListener beginDateActionListener = new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ handler.setBeginDate(beginDatePicker.getDate());
handler.refresh();
- }
- }
- };
- fiscalPeriod.addActionListener(fiscalPeriodActionListener);
+ }
+ };
+ handler.setBeginDate(beginDatePicker.getDate());
+ beginDatePicker.addActionListener(beginDateActionListener);
- removeAll();
- add(fiscalPeriod);
- break;
-
- case FINANCIAL_PERIOD:
- FinancialPeriodComboBoxModel financialModel = new FinancialPeriodComboBoxModel(true);
- FinancialPeriodComboBoxRenderer financialRenderer = new FinancialPeriodComboBoxRenderer();
- final JComboBox financialPeriod = new JComboBox(financialModel);
- financialPeriod.setRenderer(financialRenderer);
- financialPeriod.setEditable(false);
- ActionListener financialPeriodActionListener = new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- FinancialPeriod fPeriod = (FinancialPeriod) financialPeriod.getSelectedItem();
- if (fPeriod !=null){
- handler.setBeginDate(fPeriod.getBeginDate());
- handler.setEndDate(fPeriod.getEndDate());
- handler.refresh();
+ JLabel endDateLabel = new JLabel(_("lima.common.enddate"));
+ final JXDatePicker endDatePicker = new JXDatePicker(endDate);
+ ActionListener endDateActionListener = new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ handler.setEndDate(endDatePicker.getDate());
+ handler.refresh();
}
- }
- };
- financialPeriod.addActionListener(financialPeriodActionListener);
- removeAll();
- add(financialPeriod);
- break;
+ };
+ handler.setEndDate(endDatePicker.getDate());
+ endDatePicker.addActionListener(endDateActionListener);
+ handler.refresh();
+
+ removeAll();
+ add(beginDateLabel);
+ add(beginDatePicker);
+ add(endDateLabel);
+ add(endDatePicker);
+ break;
+
+ case FISCAL_PERIOD:
+ FiscalPeriodComboBoxModel fiscalModel = new FiscalPeriodComboBoxModel(true);
+ ListCellRenderer renderer =
+ RendererUtil.newDecoratorListCellRenderer(FiscalPeriod.class);
+
+ final JComboBox fiscalPeriod = new JComboBox(fiscalModel);
+ fiscalPeriod.setRenderer(renderer);
+ fiscalPeriod.setEditable(false);
+ ActionListener fiscalPeriodActionListener = new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ FiscalPeriod fPeriod = (FiscalPeriod) fiscalPeriod.getSelectedItem();
+ if (fPeriod != null) {
+ handler.setBeginDate(fPeriod.getBeginDate());
+ handler.setEndDate(fPeriod.getEndDate());
+ handler.refresh();
+ }
+ }
+ };
+ fiscalPeriod.addActionListener(fiscalPeriodActionListener);
+
+ removeAll();
+ add(fiscalPeriod);
+ break;
+
+ case FINANCIAL_PERIOD:
+ FinancialPeriodComboBoxModel financialModel = new FinancialPeriodComboBoxModel(true);
+ renderer =
+ RendererUtil.newDecoratorListCellRenderer(FinancialPeriod.class);
+ final JComboBox financialPeriod = new JComboBox(financialModel);
+ financialPeriod.setRenderer(renderer);
+ financialPeriod.setEditable(false);
+ ActionListener financialPeriodActionListener = new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ FinancialPeriod fPeriod = (FinancialPeriod) financialPeriod.getSelectedItem();
+ if (fPeriod != null) {
+ handler.setBeginDate(fPeriod.getBeginDate());
+ handler.setEndDate(fPeriod.getEndDate());
+ handler.refresh();
+ }
+ }
+ };
+ financialPeriod.addActionListener(financialPeriodActionListener);
+ removeAll();
+ add(financialPeriod);
+ break;
}
-
+
}
-
+
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceTable.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceTable.java 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceTable.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -24,35 +24,35 @@
*/
package org.chorem.lima.ui.balance;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.chorem.lima.ui.celleditor.BigDecimalTableCellRenderer;
+import org.jdesktop.swingx.JXTable;
+
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.math.BigDecimal;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.chorem.lima.ui.celleditor.BigDecimalTableCellRenderer;
-import org.chorem.lima.ui.balance.BalanceViewHandler;
-import org.jdesktop.swingx.JXTable;
-public class BalanceTable extends JXTable implements KeyListener, MouseListener{
+public class BalanceTable extends JXTable implements KeyListener, MouseListener {
/** serialVersionUID. */
private static final long serialVersionUID = 6093850347322834480L;
-
+
/** log. */
private static final Log log = LogFactory
.getLog(BalanceTable.class);
-
+
protected BalanceViewHandler handler;
public BalanceTable(BalanceViewHandler handler) {
this.handler = handler;
-
+
addKeyListener(this);
addMouseListener(this);
-
+
//Get new BigDecimal renderer
setDefaultRenderer(BigDecimal.class, new BigDecimalTableCellRenderer());
@@ -93,9 +93,9 @@
public void keyPressed(KeyEvent e) {
// clear row selection with the key: escape
if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
- if (!isEditing()) {
+ if (!isEditing()) {
clearSelection();
- }
+ }
}
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceTableModel.java 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceTableModel.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -25,18 +25,19 @@
package org.chorem.lima.ui.balance;
-import static org.nuiton.i18n.I18n._;
-
-import java.math.BigDecimal;
-import java.util.List;
-import javax.swing.table.AbstractTableModel;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.beans.BalanceTrial;
import org.chorem.lima.beans.ReportsDatas;
import org.chorem.lima.entity.Account;
+import javax.swing.table.AbstractTableModel;
+import java.math.BigDecimal;
+import java.util.List;
+import static org.nuiton.i18n.I18n._;
+
+
/**
* Entry book table model.
* By : $Author$
@@ -48,15 +49,15 @@
/** log. */
private static final Log log = LogFactory.getLog(BalanceTableModel.class);
-
+
/** data cache */
protected BalanceTrial cacheDataList;
@Override
public int getRowCount() {
int result = 0;
- if (cacheDataList != null){
- result = cacheDataList.getReportsDatas().size();
+ if (cacheDataList != null) {
+ result = cacheDataList.getReportsDatas().size();
}
return result;
}
@@ -65,31 +66,31 @@
public int getColumnCount() {
return 6;
}
-
+
@Override
public Class<?> getColumnClass(int column) {
Class<?> result = null;
switch (column) {
- case 0:
- result = Account.class;
- break;
- case 1:
- result = String.class;
- break;
- case 2:
- result = BigDecimal.class;
- break;
- case 3:
- result = BigDecimal.class;
- break;
- case 4:
- result = BigDecimal.class;
- break;
- case 5:
- result = BigDecimal.class;
- break;
+ case 0:
+ result = Account.class;
+ break;
+ case 1:
+ result = String.class;
+ break;
+ case 2:
+ result = BigDecimal.class;
+ break;
+ case 3:
+ result = BigDecimal.class;
+ break;
+ case 4:
+ result = BigDecimal.class;
+ break;
+ case 5:
+ result = BigDecimal.class;
+ break;
}
return result;
@@ -141,27 +142,24 @@
result = currentRow.getAmountCredit(); // total crédit
break;
case 4: // solde debit
- if (currentRow.getSoldeDebit()){
+ if (currentRow.getSoldeDebit()) {
result = currentRow.getAmountSolde();
- }
- else {
+ } else {
result = BigDecimal.ZERO;
}
break;
case 5: // solde credit
- if (!currentRow.getSoldeDebit()){
+ if (!currentRow.getSoldeDebit()) {
result = currentRow.getAmountSolde();
- }
- else {
+ } else {
result = BigDecimal.ZERO;
}
break;
}
- }
- catch (Exception eee) {
+ } catch (Exception eee) {
log.debug("Can't get entries", eee);
}
-
+
return result;
}
@@ -171,11 +169,11 @@
// Just read, no write
return false;
}
-
-
- public void refresh(BalanceTrial datasList){
+
+
+ public void refresh(BalanceTrial datasList) {
cacheDataList = datasList;
fireTableDataChanged();
}
-
+
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceViewHandler.java 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceViewHandler.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -25,19 +25,6 @@
package org.chorem.lima.ui.balance;
-import static org.nuiton.i18n.I18n._;
-import java.awt.Desktop;
-import java.io.IOException;
-import java.math.BigDecimal;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-
-import javax.swing.JOptionPane;
-
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.LimaConfig;
@@ -55,7 +42,20 @@
import org.chorem.lima.service.LimaServiceFactory;
import org.chorem.lima.util.ErrorHelper;
+import javax.swing.JOptionPane;
+import java.awt.Desktop;
+import java.io.IOException;
+import java.math.BigDecimal;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import static org.nuiton.i18n.I18n._;
+
+
/**
* Handler associated with accounts reports view.
* By : $Author$
@@ -63,77 +63,79 @@
public class BalanceViewHandler implements ServiceListener {
protected BalanceView view;
-
+
/** log. */
private static final Log log = LogFactory.getLog(BalanceViewHandler.class);
-
+
/** Services. */
protected ReportServiceMonitorable reportService;
+
protected HttpServerServiceMonitorable httpServerServiceMonitorable;
+
protected FiscalPeriodServiceMonitorable fiscalPeriodService;
-
+
/** DatePicker Begin Date. */
protected Date selectedBeginDate;
-
+
/** DatePicker EndDate. */
protected Date selectedEndDate;
-
+
/** Text field Accounts */
protected String selectedAccounts;
-
+
protected BalanceTable table;
protected BalanceTableModel model;
-
+
private static SimpleDateFormat dateFormat =
- new SimpleDateFormat("yyyy-MM-dd");
-
+ new SimpleDateFormat("yyyy-MM-dd");
+
protected int port;
-
+
protected BalanceViewHandler(BalanceView view) {
this.view = view;
-
+
reportService =
- LimaServiceFactory.getInstance().getService(
- ReportServiceMonitorable.class);
+ LimaServiceFactory.getInstance().getService(
+ ReportServiceMonitorable.class);
port = LimaServiceFactory.getInstance().getService(
HttpServerServiceMonitorable.class).getHttpPort();
fiscalPeriodService =
- LimaServiceFactory.getInstance().getService(
- FiscalPeriodServiceMonitorable.class);
+ LimaServiceFactory.getInstance().getService(
+ FiscalPeriodServiceMonitorable.class);
LimaServiceFactory.getInstance().getService(
ImportServiceMonitorable.class).addServiceListener(this);
LimaServiceFactory.getInstance().getService(
FinancialTransactionServiceMonitorable.class).addServiceListener(this);
-
+
}
-
- public void setBeginDate(Date date){
+
+ public void setBeginDate(Date date) {
selectedBeginDate = date;
refresh();
}
-
- public void setEndDate(Date date){
+
+ public void setEndDate(Date date) {
selectedEndDate = date;
refresh();
}
-
+
public void setAccountFilter(String accounts) {
selectedAccounts = accounts;
refresh();
}
-
+
/**
* get all account fot the selected period
+ *
* @return
*/
- public BalanceTrial getDataList(){
+ public BalanceTrial getDataList() {
BalanceTrial results = null;
-
+
try {
results = reportService.generateBalanceTrial(selectedBeginDate, selectedEndDate, selectedAccounts, false, view.getMovmentedFilter().isSelected());
- }
- catch (LimaException eee) {
+ } catch (LimaException eee) {
if (log.isErrorEnabled()) {
log.debug("Can't update model", eee);
}
@@ -141,72 +143,70 @@
}
return results;
}
-
- public void refresh(){
-
- if (selectedBeginDate != null && selectedEndDate != null){
+
+ public void refresh() {
+
+ if (selectedBeginDate != null && selectedEndDate != null) {
model = view.getModelBalanceTable();
BalanceTrial datasList = getDataList();
model.refresh(datasList);
-
- /**
- * update the labels credit, debit, solde on the footer
- * get all entries for all accounts on the selected period
- */
-
- if (datasList != null){
+
+ /**
+ * update the labels credit, debit, solde on the footer
+ * get all entries for all accounts on the selected period
+ */
+
+ if (datasList != null) {
// set amounts credit, debit and solde
view.amountCreditLabel.setText(
String.valueOf(datasList.getAmountCredit()));
view.amountDebitLabel.setText(
- String.valueOf(datasList.getAmountDebit()));
+ String.valueOf(datasList.getAmountDebit()));
BigDecimal amountSolde = datasList.getAmountSolde();
view.amountSoldeLabel.setText(
String.valueOf(amountSolde));
-
-
- if (amountSolde.compareTo(BigDecimal.ZERO) == 0){
+
+
+ if (amountSolde.compareTo(BigDecimal.ZERO) == 0) {
view.soldeLabel.setText(_("lima.common.solde"));
- }
- else {
+ } else {
// set label solde: credit or debit
if (datasList.getSoldeDebit()) {
view.soldeLabel.setText(_("lima.common.soldedebit"));
- }
- else {
+ } else {
view.soldeLabel.setText(_("lima.common.soldecredit"));
}
}
}
}
}
-
+
public void createDocument() {
-
- if (selectedBeginDate != null & selectedEndDate != null){
-
+
+ if (selectedBeginDate != null & selectedEndDate != null) {
+
//looks for all blocked fiscal periods
List<FiscalPeriod> blockedFiscalPeriods = new ArrayList<FiscalPeriod>();
try {
blockedFiscalPeriods = fiscalPeriodService.getAllBlockedFiscalPeriods();
- }catch (LimaException eee) {
+ } catch (LimaException eee) {
if (log.isErrorEnabled()) {
log.debug("Enable to create document ", eee);
}
ErrorHelper.showErrorDialog(_("lima.balance.documentcreationerror"), eee);
}
-
+
//tells if the fiscaPeriod as been found and is blocked
boolean error = true;
-
+
for (FiscalPeriod blockedFiscalPeriod : blockedFiscalPeriods) {
if (blockedFiscalPeriod.getBeginDate().equals(selectedBeginDate)
- && blockedFiscalPeriod.getEndDate().equals(selectedEndDate)
- && blockedFiscalPeriod.getLocked()) {
+ && blockedFiscalPeriod.getEndDate().equals(selectedEndDate)
+ && blockedFiscalPeriod.getLocked()) {
error = false;
}
}
-
+
//shows error message to user if the fiscalPeriod is unblocked
if (error) {
JOptionPane.showMessageDialog(
@@ -215,18 +215,18 @@
_("lima.common.error"),
JOptionPane.ERROR_MESSAGE);
} else {
-
+
FormatsEnum selectedEnum =
- (FormatsEnum) view.getDocumentEditor().getSelectedItem();
+ (FormatsEnum) view.getDocumentEditor().getSelectedItem();
String address = LimaConfig.getInstance().getHostAdress();
-
+
try {
- String url = "http://"+address+":"+port+"/?beginDate="
- +dateFormat.format(selectedBeginDate)
- +"&endDate="+dateFormat.format(selectedEndDate)+"&format="
- +selectedEnum.getExtension()+"&model="
- + DocumentsEnum.BALANCE.getFileName();
- Desktop.getDesktop().browse(new URI(url));
+ String url = "http://" + address + ":" + port + "/?beginDate="
+ + dateFormat.format(selectedBeginDate)
+ + "&endDate=" + dateFormat.format(selectedEndDate) + "&format="
+ + selectedEnum.getExtension() + "&model="
+ + DocumentsEnum.BALANCE.getFileName();
+ Desktop.getDesktop().browse(new URI(url));
} catch (IOException e) {
log.error("Can't open browser", e);
} catch (URISyntaxException e) {
@@ -235,10 +235,10 @@
}
}
}
-
+
@Override
public void notifyMethod(String serviceName, String methodeName) {
- if (serviceName.contains("FinancialTransaction") || methodeName.contains("importAccount") || methodeName.contains("importAll")){
+ if (serviceName.contains("FinancialTransaction") || methodeName.contains("importAccount") || methodeName.contains("importAll")) {
refresh();
}
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/AccountTableCellEditor.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/AccountTableCellEditor.java 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/AccountTableCellEditor.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -48,15 +48,15 @@
public class AccountTableCellEditor extends AbstractCellEditor implements TableCellEditor, KeyListener {
protected static final Log log = LogFactory.getLog(EntryBookTableCellEditor.class);
+
private final JWideComboBox comboBox;
+
private static final long serialVersionUID = 1L;
// private static AccountTableCellEditor editor;
private static boolean keyPressed;
- /**
- * constructor
- */
+ /** constructor */
public AccountTableCellEditor() {
comboBox = new JWideComboBox();
SubAccountComboBoxModel accountComboBoxModel = new SubAccountComboBoxModel();
@@ -69,9 +69,9 @@
@Override
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
- if (value instanceof Account){
+ if (value instanceof Account) {
comboBox.setSelectedItem(value);
- }
+ }
return comboBox;
}
@@ -79,28 +79,28 @@
public Object getCellEditorValue() {
return comboBox.getSelectedItem();
}
-
+
/**
* Vérifie si la cellule peut être éditable :
* seulement si il y a une frappe au clavier ou un double clic.
+ *
* @param evt
* @return
*/
- @Override
+ @Override
public boolean isCellEditable(EventObject evt) {
// Si il y a une frappe au clavier
if (evt instanceof KeyEvent) {
final KeyEvent keyEvent = (KeyEvent) evt;
// Empèche la touche echap
- if ( keyEvent.getKeyChar() != KeyEvent.VK_ESCAPE){
+ if (keyEvent.getKeyChar() != KeyEvent.VK_ESCAPE) {
// Permet de placer le focus sur l'editor de la comboBox
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
comboBox.getEditor().getEditorComponent().requestFocus();
JTextComponent edit = (JTextComponent) comboBox.getEditor().getEditorComponent();
- if (!Character.isIdentifierIgnorable(keyEvent.getKeyChar()))
- {
+ if (!Character.isIdentifierIgnorable(keyEvent.getKeyChar())) {
edit.setText(Character.toString(keyEvent.getKeyChar()));
}
}
@@ -111,37 +111,35 @@
return !(evt instanceof MouseEvent) || ((MouseEvent) evt).getClickCount() == 2;
}
-
+
@Override
public void keyPressed(KeyEvent e) {
-
+
}
-
+
@Override
public void keyReleased(KeyEvent e) {
-
+
// Vérifie si c'est la première frappe au clavier
- if (!keyPressed)
- {
+ if (!keyPressed) {
// Récupère l'editor de la comboBox
JTextComponent edit = (JTextComponent) comboBox.getEditor().getEditorComponent();
// Met en place le curseur et la selection après la première lettre
edit.select(1, edit.getText().length());
keyPressed = true;
}
-
+
// delegate popup list menu
- if ( e.getKeyChar() == KeyEvent.VK_ENTER )
- {
+ if (e.getKeyChar() == KeyEvent.VK_ENTER) {
fireEditingStopped();
}
}
-
+
@Override
public void keyTyped(KeyEvent e) {
-
+
}
-
+
// public static AccountTableCellEditor getInstance() {
// if (editor == null) {
// editor = new AccountTableCellEditor();
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellEditor.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellEditor.java 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellEditor.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -49,13 +49,14 @@
implements TableCellEditor, FocusListener, AncestorListener, KeyListener {
private static final Log log = LogFactory.getLog(BigDecimalTableCellEditor.class);
+
private static final long serialVersionUID = 1L;
+
protected final JTextField textField;
+
private boolean keyPressed;
- /**
- * constructor
- */
+ /** constructor */
public BigDecimalTableCellEditor() {
textField = new JTextField();
textField.setEditable(true);
@@ -65,10 +66,10 @@
textField.addKeyListener(this);
keyPressed = false;
}
-
+
@Override
public Component getTableCellEditorComponent(JTable table, Object value,
- boolean isSelected, int row, int column) {
+ boolean isSelected, int row, int column) {
textField.setText(value.toString());
return textField;
}
@@ -92,39 +93,37 @@
}
//round half up the number using the scale given by the configuration
bdValue = bdValue.setScale(LimaContext.getContext().getConfig().getScale(),
- BigDecimal.ROUND_HALF_UP);
+ BigDecimal.ROUND_HALF_UP);
return bdValue;
}
}
-
+
@Override
public boolean isCellEditable(EventObject evt) {
return !(evt instanceof MouseEvent) || ((MouseEvent) evt).getClickCount() == 2;
}
-
- /**
- * Listeners
- */
+
+ /** Listeners */
@Override
public void focusGained(FocusEvent e) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
textField.selectAll();
- }
+ }
});
}
-
+
@Override
public void focusLost(FocusEvent e) {
keyPressed = false;
}
-
+
@Override
public void ancestorAdded(AncestorEvent e) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
textField.requestFocus();
- }
+ }
});
}
@@ -143,19 +142,19 @@
@Override
public void keyPressed(KeyEvent e) {
- }
+ }
@Override
public void keyReleased(KeyEvent e) {
// replace all the cell content only if all the text has been selected
if (!keyPressed
- && textField.getSelectionStart() == 0
- && textField.getSelectionEnd() == textField.getText().length()) {
+ && textField.getSelectionStart() == 0
+ && textField.getSelectionEnd() == textField.getText().length()) {
// delete the the cell content
if (e.getKeyChar() == KeyEvent.VK_BACK_SPACE) {
textField.setText("");
keyPressed = true;
- // replace the content by the char typed in
+ // replace the content by the char typed in
} else if (String.valueOf(e.getKeyChar()).matches("[a-zA-z0-9]")) {
textField.setText(String.valueOf(e.getKeyChar()));
keyPressed = true;
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellRenderer.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellRenderer.java 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellRenderer.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -38,14 +38,13 @@
public class BigDecimalTableCellRenderer extends DefaultTableCellRenderer {
private static final long serialVersionUID = -2499433026151065390L;
-
+
public BigDecimalTableCellRenderer() {
//
}
- public Component getTableCellRendererComponent(JTable table, Object value,
- boolean isSelected, boolean hasFocus, int row, int column)
- {
+ public Component getTableCellRendererComponent(JTable table, Object value,
+ boolean isSelected, boolean hasFocus, int row, int column) {
super.getTableCellRendererComponent(
table, value, isSelected, hasFocus, row, column);
@@ -53,7 +52,7 @@
setValue(value);
return this;
}
-
+
public void setValue(Object aValue) {
Object result = aValue;
if (aValue != null && aValue instanceof BigDecimal) {
@@ -72,7 +71,7 @@
formatter.setGroupingUsed(true);
formatter.setGroupingSize(3);
result = formatter.format(result);
- }
+ }
super.setValue(result);
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/DateTableCellEditor.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/DateTableCellEditor.java 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/DateTableCellEditor.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -29,35 +29,32 @@
import org.chorem.lima.LimaContext;
import org.jdesktop.swingx.JXDatePicker;
-import javax.swing.*;
+import javax.swing.AbstractCellEditor;
+import javax.swing.JTable;
+import javax.swing.SwingUtilities;
import javax.swing.event.AncestorEvent;
import javax.swing.event.AncestorListener;
import javax.swing.table.TableCellEditor;
-
import java.awt.Component;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.awt.event.MouseEvent;
-
import java.util.Date;
import java.util.EventObject;
-/**
- * @author ore
- */
+/** @author ore */
public class DateTableCellEditor extends AbstractCellEditor
implements TableCellEditor, FocusListener, AncestorListener {
private final JXDatePicker datePicker;
+
private static final long serialVersionUID = 1L;
// private static DateTableCellEditor editor;
-
+
//used to tell if the user has pressed a key
private Date date;
- /**
- * constructor
- */
+ /** constructor */
public DateTableCellEditor() {
datePicker = new JXDatePicker(LimaContext.getContext().getConfig().getLocale());
datePicker.getEditor().addFocusListener(this);
@@ -88,7 +85,7 @@
}
//month
if (str.length > 1) {
- date = DateUtils.setMonths(date, Integer.valueOf(str[1])-1);
+ date = DateUtils.setMonths(date, Integer.valueOf(str[1]) - 1);
}
//year
if (str.length > 2) {
@@ -110,18 +107,16 @@
// }
// return editor;
// }
-
- /**
- * Listeners
- */
+
+ /** Listeners */
public void focusGained(FocusEvent e) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
datePicker.getEditor().selectAll();
- }
+ }
});
}
-
+
public void focusLost(FocusEvent e) {
}
@@ -130,7 +125,7 @@
SwingUtilities.invokeLater(new Runnable() {
public void run() {
datePicker.requestFocus();
- }
+ }
});
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/EmptyCellRenderer.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/EmptyCellRenderer.java 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/EmptyCellRenderer.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -37,11 +37,10 @@
@SuppressWarnings("restriction")
public class EmptyCellRenderer extends DefaultTableCellRenderer {
- private static final long serialVersionUID = -7834417406160620726L;
+ private static final long serialVersionUID = -7834417406160620726L;
- public Component getTableCellRendererComponent(JTable table, Object value,
- boolean isSelected, boolean hasFocus, int row, int column)
- {
+ public Component getTableCellRendererComponent(JTable table, Object value,
+ boolean isSelected, boolean hasFocus, int row, int column) {
//Create a new JLabel to avoid colouring only when row is selected
JLabel mycell = new JLabel();
mycell.setOpaque(true);
@@ -56,7 +55,7 @@
}
//Setting default foreGround and backGround colours when hasFocus
if (hasFocus) {
- Border border = null;
+ Border border = null;
if (isSelected) {
border = DefaultLookup.getBorder(this, ui, "Table.focusSelectedCellHighlightBorder");
}
@@ -74,11 +73,11 @@
if (String.valueOf(value).isEmpty() || String.valueOf(value) == null) {
mycell.setBackground(new Color(255, 198, 209));
} else {
- mycell.setText(value.toString());
+ mycell.setText(value.toString());
}
- } else {
- mycell.setBackground(new Color(255, 198, 209));
- }
+ } else {
+ mycell.setBackground(new Color(255, 198, 209));
+ }
}
return mycell;
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/LetterTableCellEditor.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/LetterTableCellEditor.java 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/LetterTableCellEditor.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -28,14 +28,16 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.entity.Account;
+import org.chorem.lima.entity.Letter;
import org.chorem.lima.ui.combobox.LetterComboBoxModel;
-import org.chorem.lima.ui.combobox.LetterRenderer;
+import org.chorem.lima.ui.renderers.RendererUtil;
import org.chorem.lima.util.LetterToString;
import org.chorem.lima.widgets.JWideComboBox;
import org.jdesktop.swingx.autocomplete.AutoCompleteDecorator;
import javax.swing.AbstractCellEditor;
import javax.swing.JTable;
+import javax.swing.ListCellRenderer;
import javax.swing.SwingUtilities;
import javax.swing.table.TableCellEditor;
import javax.swing.text.JTextComponent;
@@ -48,6 +50,7 @@
public class LetterTableCellEditor extends AbstractCellEditor implements TableCellEditor, KeyListener {
protected static final Log log = LogFactory.getLog(EntryBookTableCellEditor.class);
+
private static final long serialVersionUID = 1L;
private final JWideComboBox comboBox;
@@ -55,14 +58,13 @@
private static boolean keyPressed;
- /**
- * constructor
- */
+ /** constructor */
public LetterTableCellEditor() {
comboBox = new JWideComboBox();
LetterComboBoxModel comboBoxModel = new LetterComboBoxModel();
comboBox.setModel(comboBoxModel);
- LetterRenderer renderer = new LetterRenderer();
+ ListCellRenderer renderer =
+ RendererUtil.newDecoratorListCellRenderer(Letter.class);
comboBox.setRenderer(renderer);
AutoCompleteDecorator.decorate(comboBox, LetterToString.getInstance());
comboBox.getEditor().getEditorComponent().addKeyListener(this);
@@ -70,9 +72,9 @@
@Override
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
- if (value instanceof Account){
+ if (value instanceof Account) {
comboBox.setSelectedItem(value);
- }
+ }
return comboBox;
}
@@ -80,28 +82,28 @@
public Object getCellEditorValue() {
return comboBox.getSelectedItem();
}
-
+
/**
* Vérifie si la cellule peut être éditable :
* seulement si il y a une frappe au clavier ou un double clic.
+ *
* @param evt
* @return
*/
- @Override
+ @Override
public boolean isCellEditable(EventObject evt) {
// Si il y a une frappe au clavier
if (evt instanceof KeyEvent) {
final KeyEvent keyEvent = (KeyEvent) evt;
// Empèche la touche echap
- if ( keyEvent.getKeyChar() != KeyEvent.VK_ESCAPE){
+ if (keyEvent.getKeyChar() != KeyEvent.VK_ESCAPE) {
// Permet de placer le focus sur l'editor de la comboBox
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
comboBox.getEditor().getEditorComponent().requestFocus();
JTextComponent edit = (JTextComponent) comboBox.getEditor().getEditorComponent();
- if (!Character.isIdentifierIgnorable(keyEvent.getKeyChar()))
- {
+ if (!Character.isIdentifierIgnorable(keyEvent.getKeyChar())) {
edit.setText(Character.toString(keyEvent.getKeyChar()));
}
}
@@ -112,37 +114,35 @@
return !(evt instanceof MouseEvent) || ((MouseEvent) evt).getClickCount() == 2;
}
-
+
@Override
public void keyPressed(KeyEvent e) {
-
+
}
-
+
@Override
public void keyReleased(KeyEvent e) {
-
+
// Vérifie si c'est la première frappe au clavier
- if (!keyPressed)
- {
+ if (!keyPressed) {
// Récupère l'editor de la comboBox
JTextComponent edit = (JTextComponent) comboBox.getEditor().getEditorComponent();
// Met en place le curseur et la selection après la première lettre
edit.select(1, edit.getText().length());
keyPressed = true;
}
-
+
// delegate popup list menu
- if ( e.getKeyChar() == KeyEvent.VK_ENTER )
- {
+ if (e.getKeyChar() == KeyEvent.VK_ENTER) {
fireEditingStopped();
}
}
-
+
@Override
public void keyTyped(KeyEvent e) {
-
+
}
-
+
// public static LetterTableCellEditor getInstance() {
// if (editor == null) {
// editor = new LetterTableCellEditor();
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/AccountComboBoxModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/AccountComboBoxModel.java 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/AccountComboBoxModel.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -25,9 +25,6 @@
package org.chorem.lima.ui.combobox;
-import java.util.List;
-import javax.swing.AbstractListModel;
-import javax.swing.ComboBoxModel;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.AccountServiceMonitorable;
@@ -38,42 +35,44 @@
import org.chorem.lima.service.LimaServiceFactory;
import org.chorem.lima.ui.financialperiod.FinancialPeriodTableModel;
-/**
- * Account combo box model.
- */
+import javax.swing.AbstractListModel;
+import javax.swing.ComboBoxModel;
+import java.util.List;
+/** Account combo box model. */
+
public class AccountComboBoxModel extends AbstractListModel implements ComboBoxModel, ServiceListener {
-
+
private static final long serialVersionUID = 1L;
private static final Log log =
- LogFactory.getLog(FinancialPeriodTableModel.class);
-
+ LogFactory.getLog(FinancialPeriodTableModel.class);
+
protected Object selectedAccount;
-
+
protected List<Account> datasCache;
-
+
protected AccountServiceMonitorable accountService;
-
- public AccountComboBoxModel () {
+
+ public AccountComboBoxModel() {
accountService =
- LimaServiceFactory.getInstance().getService(
- AccountServiceMonitorable.class);
+ LimaServiceFactory.getInstance().getService(
+ AccountServiceMonitorable.class);
accountService.addServiceListener(this);
LimaServiceFactory.getInstance().getService(
ImportServiceMonitorable.class).addServiceListener(this);
datasCache = getDataList();
}
-
+
@Override
public Object getSelectedItem() {
- return selectedAccount;
+ return selectedAccount;
}
@Override
public void setSelectedItem(Object anItem) {
selectedAccount = anItem;
- fireContentsChanged(this, -1, -1);
+ fireContentsChanged(this, -1, -1);
}
@@ -84,34 +83,33 @@
@Override
public int getSize() {
- return datasCache.size();
+ return datasCache.size();
}
- public List<Account> getDataList(){
+ public List<Account> getDataList() {
List<Account> result = null;
try {
result = accountService.getAllAccounts();
- }
- catch (LimaException eee) {
- if (log.isDebugEnabled()){
+ } catch (LimaException eee) {
+ if (log.isDebugEnabled()) {
log.debug("Can't get list accounts", eee);
}
}
return result;
-
+
}
-
- public void refresh(){
+
+ public void refresh() {
datasCache = getDataList();
fireContentsChanged(this, 0, datasCache.size());
}
@Override
public void notifyMethod(String serviceName, String methodeName) {
- if (methodeName.contains("Account") || methodeName.contains("importAll")){
+ if (methodeName.contains("Account") || methodeName.contains("importAll")) {
refresh();
- }
+ }
}
-
+
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/AccountRenderer.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/AccountRenderer.java 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/AccountRenderer.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -43,7 +43,7 @@
boolean isSelected,
boolean cellHasFocus) {
- JLabel label = (JLabel) super.getListCellRendererComponent(list,
+ JLabel label = (JLabel) super.getListCellRendererComponent(list,
value,
index,
isSelected,
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/EntryBookComboBoxModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/EntryBookComboBoxModel.java 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/EntryBookComboBoxModel.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -25,9 +25,6 @@
package org.chorem.lima.ui.combobox;
-import java.util.List;
-import javax.swing.AbstractListModel;
-import javax.swing.ComboBoxModel;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.EntryBookServiceMonitorable;
@@ -38,32 +35,36 @@
import org.chorem.lima.service.LimaServiceFactory;
import org.chorem.lima.ui.financialperiod.FinancialPeriodTableModel;
+import javax.swing.AbstractListModel;
+import javax.swing.ComboBoxModel;
+import java.util.List;
+
/**
* Opened financial period combo box model.
- *
+ *
* @author chatellier
* @version $Revision$
- *
- * Last update : $Date$
- * By : $Author$
+ * <p/>
+ * Last update : $Date$
+ * By : $Author$
*/
public class EntryBookComboBoxModel extends AbstractListModel implements ComboBoxModel, ServiceListener {
private static final long serialVersionUID = 1L;
private static final Log log =
- LogFactory.getLog(FinancialPeriodTableModel.class);
-
+ LogFactory.getLog(FinancialPeriodTableModel.class);
+
protected Object selectedEntryBook;
-
+
protected EntryBookServiceMonitorable entryBookService;
protected List<EntryBook> cacheDatas;
-
+
public EntryBookComboBoxModel() {
entryBookService =
- LimaServiceFactory.getInstance().getService(
- EntryBookServiceMonitorable.class);
+ LimaServiceFactory.getInstance().getService(
+ EntryBookServiceMonitorable.class);
entryBookService.addServiceListener(this);
LimaServiceFactory.getInstance().getService(
ImportServiceMonitorable.class).addServiceListener(this);
@@ -72,12 +73,12 @@
@Override
public int getSize() {
- return cacheDatas.size();
+ return cacheDatas.size();
}
@Override
public Object getElementAt(int index) {
- return cacheDatas.get(index);
+ return cacheDatas.get(index);
}
@Override
@@ -90,32 +91,29 @@
public Object getSelectedItem() {
return selectedEntryBook;
}
-
- /**
- * get the accounts list
- */
- public List<EntryBook> getDataList(){
- List<EntryBook> result = null;
- try {
- result = entryBookService.getAllEntryBooks();
- }
- catch (LimaException eee) {
- if (log.isDebugEnabled()){
- log.debug("Can't get list accounts", eee);
- }
- }
- return result;
+
+ /** get the accounts list */
+ public List<EntryBook> getDataList() {
+ List<EntryBook> result = null;
+ try {
+ result = entryBookService.getAllEntryBooks();
+ } catch (LimaException eee) {
+ if (log.isDebugEnabled()) {
+ log.debug("Can't get list accounts", eee);
+ }
+ }
+ return result;
}
-
-
- public void refresh(){
+
+
+ public void refresh() {
cacheDatas = getDataList();
fireContentsChanged(this, 0, cacheDatas.size());
}
@Override
public void notifyMethod(String serviceName, String methodeName) {
- if (methodeName.contains("EntryBook") || methodeName.contains("importAll")){
+ if (methodeName.contains("EntryBook") || methodeName.contains("importAll")) {
refresh();
}
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/EntryBookRenderer.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/EntryBookRenderer.java 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/EntryBookRenderer.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -32,6 +32,7 @@
import javax.swing.JList;
import java.awt.Component;
+@Deprecated
public class EntryBookRenderer extends DefaultListCellRenderer {
private static final long serialVersionUID = 1L;
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FinancialPeriodComboBoxModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FinancialPeriodComboBoxModel.java 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FinancialPeriodComboBoxModel.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -25,9 +25,6 @@
package org.chorem.lima.ui.combobox;
-import java.util.List;
-import javax.swing.AbstractListModel;
-import javax.swing.ComboBoxModel;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.FinancialPeriodServiceMonitorable;
@@ -40,76 +37,76 @@
import org.chorem.lima.service.LimaServiceFactory;
import org.chorem.lima.ui.financialperiod.FinancialPeriodTableModel;
+import javax.swing.AbstractListModel;
+import javax.swing.ComboBoxModel;
+import java.util.List;
+
/**
* Opened financial period combo box model.
- *
+ *
* @author chatellier
* @version $Revision$
- *
- * Last update : $Date$
- * By : $Author$
+ * <p/>
+ * Last update : $Date$
+ * By : $Author$
*/
public class FinancialPeriodComboBoxModel extends AbstractListModel implements ComboBoxModel, ServiceListener {
-
+
private static final long serialVersionUID = 1L;
private static final Log log =
- LogFactory.getLog(FinancialPeriodTableModel.class);
+ LogFactory.getLog(FinancialPeriodTableModel.class);
protected Object selectedFinancialPeriod;
-
+
protected List<FinancialPeriod> datasCache;
-
+
protected FinancialPeriodServiceMonitorable financialPeriodService;
-
+
protected FiscalPeriod selectedFiscalPeriod;
-
+
private boolean displayAllPeriods;
- /**
- * Constructor for locked period list.
- */
+ /** Constructor for locked period list. */
public FinancialPeriodComboBoxModel() {
this(false);
}
/**
* Constructor for period list.
- *
+ *
* @param all if {@code true}, display all available period, otherwize
- * display only locked ones
+ * display only locked ones
*/
public FinancialPeriodComboBoxModel(boolean displayAllPeriods) {
-
+
this.displayAllPeriods = displayAllPeriods;
-
- financialPeriodService =
- LimaServiceFactory.getInstance().getService(
- FinancialPeriodServiceMonitorable.class);
+
+ financialPeriodService =
+ LimaServiceFactory.getInstance().getService(
+ FinancialPeriodServiceMonitorable.class);
financialPeriodService.addServiceListener(this);
LimaServiceFactory.getInstance().getService(
FiscalPeriodServiceMonitorable.class).addServiceListener(this);
LimaServiceFactory.getInstance().getService(
ImportServiceMonitorable.class).addServiceListener(this);
if (displayAllPeriods) {
- datasCache=getAllDataList();
+ datasCache = getAllDataList();
+ } else {
+ datasCache = getDataList();
}
- else {
- datasCache=getDataList();
- }
- }
+ }
- public void setFiscalPeriod(FiscalPeriod fiscalPeriod){
- selectedFiscalPeriod=fiscalPeriod;
+ public void setFiscalPeriod(FiscalPeriod fiscalPeriod) {
+ selectedFiscalPeriod = fiscalPeriod;
if (displayAllPeriods) {
- datasCache=getAllDataList();
+ datasCache = getAllDataList();
+ } else {
+ datasCache = getDataList();
}
- else {
- datasCache=getDataList();
- }
fireContentsChanged(this, 0, datasCache.size());
}
-
+
@Override
public int getSize() {
return datasCache.size();
@@ -129,51 +126,47 @@
public Object getSelectedItem() {
return selectedFinancialPeriod;
}
-
+
//get unblocked financial periods data list
- public List<FinancialPeriod> getDataList(){
+ public List<FinancialPeriod> getDataList() {
List<FinancialPeriod> result = null;
try {
- if (selectedFiscalPeriod != null){
+ if (selectedFiscalPeriod != null) {
result = financialPeriodService.getFinancialPeriods(selectedFiscalPeriod.getBeginDate(), selectedFiscalPeriod.getEndDate());
- }
- else {
+ } else {
result = financialPeriodService.getUnblockedFinancialPeriods();
}
- }
- catch (LimaException ex) {
- if (log.isDebugEnabled()){
- log.debug("Can't get Financial Period list",ex);
+ } catch (LimaException ex) {
+ if (log.isDebugEnabled()) {
+ log.debug("Can't get Financial Period list", ex);
}
}
- return result;
+ return result;
}
-
+
//get all financial periods data list
public List<FinancialPeriod> getAllDataList() {
- List<FinancialPeriod> result = null;
+ List<FinancialPeriod> result = null;
try {
- if (selectedFiscalPeriod != null){
+ if (selectedFiscalPeriod != null) {
result = financialPeriodService.getFinancialPeriods(selectedFiscalPeriod.getBeginDate(), selectedFiscalPeriod.getEndDate());
- }
- else {
+ } else {
result = financialPeriodService.getAllFinancialPeriods();
}
- }
- catch (LimaException ex) {
- if (log.isDebugEnabled()){
- log.debug("Can't get Financial Period list",ex);
+ } catch (LimaException ex) {
+ if (log.isDebugEnabled()) {
+ log.debug("Can't get Financial Period list", ex);
}
}
- return result;
+ return result;
}
-
-
- public void refresh(){
+
+
+ public void refresh() {
datasCache = getDataList();
fireContentsChanged(this, 0, datasCache.size());
}
-
+
public void refreshAll() {
datasCache = getAllDataList();
fireContentsChanged(this, 0, datasCache.size());
@@ -181,13 +174,12 @@
@Override
public void notifyMethod(String serviceName, String methodeName) {
- if (serviceName.contains("Period") || methodeName.contains("importAll")){
+ if (serviceName.contains("Period") || methodeName.contains("importAll")) {
if (displayAllPeriods) {
- datasCache=getAllDataList();
+ datasCache = getAllDataList();
+ } else {
+ datasCache = getDataList();
}
- else {
- datasCache=getDataList();
- }
- }
+ }
}
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FinancialPeriodComboBoxRenderer.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FinancialPeriodComboBoxRenderer.java 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FinancialPeriodComboBoxRenderer.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -33,7 +33,7 @@
import java.awt.Component;
import java.text.SimpleDateFormat;
-
+@Deprecated
public class FinancialPeriodComboBoxRenderer extends DefaultListCellRenderer {
private static final long serialVersionUID = 1L;
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FiscalPeriodComboBoxModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FiscalPeriodComboBoxModel.java 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FiscalPeriodComboBoxModel.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -39,40 +39,40 @@
import javax.swing.ComboBoxModel;
import java.util.List;
-public class FiscalPeriodComboBoxModel extends AbstractListModel implements ComboBoxModel, ServiceListener{
+public class FiscalPeriodComboBoxModel extends AbstractListModel implements ComboBoxModel, ServiceListener {
private static final long serialVersionUID = 1L;
private static final Log log = LogFactory.getLog(FinancialPeriodTableModel.class);
protected Object selectedFiscalPeriod;
-
+
protected FiscalPeriodServiceMonitorable fiscalPeriodService;
-
+
protected List<FiscalPeriod> datasCache;
//constructor for blocked fiscal period only
- public FiscalPeriodComboBoxModel(){
+ public FiscalPeriodComboBoxModel() {
fiscalPeriodService =
- LimaServiceFactory.getInstance().getService(
- FiscalPeriodServiceMonitorable.class);
+ LimaServiceFactory.getInstance().getService(
+ FiscalPeriodServiceMonitorable.class);
fiscalPeriodService.addServiceListener(this);
LimaServiceFactory.getInstance().getService(
ImportServiceMonitorable.class).addServiceListener(this);
datasCache = getDataList();
}
-
+
//constructor for all fiscal period
public FiscalPeriodComboBoxModel(boolean all) {
- fiscalPeriodService =
- LimaServiceFactory.getInstance().getService(
- FiscalPeriodServiceMonitorable.class);
+ fiscalPeriodService =
+ LimaServiceFactory.getInstance().getService(
+ FiscalPeriodServiceMonitorable.class);
fiscalPeriodService.addServiceListener(this);
LimaServiceFactory.getInstance().getService(
ImportServiceMonitorable.class).addServiceListener(this);
datasCache = getAllDataList();
- }
-
+ }
+
@Override
public int getSize() {
return datasCache.size();
@@ -93,50 +93,48 @@
public Object getSelectedItem() {
return selectedFiscalPeriod;
}
-
+
//get unblocked fiscal periods data list
- public List<FiscalPeriod> getDataList(){
+ public List<FiscalPeriod> getDataList() {
List<FiscalPeriod> result = null;
try {
result = fiscalPeriodService.getAllUnblockedFiscalPeriods();
- }
- catch (LimaException eee) {
- if (log.isDebugEnabled()){
+ } catch (LimaException eee) {
+ if (log.isDebugEnabled()) {
log.debug("Can't get list accounts", eee);
}
}
return result;
-
+
}
-
+
//get all fiscal periods data list
public List<FiscalPeriod> getAllDataList() {
- List<FiscalPeriod> result = null;
- try {
- result = fiscalPeriodService.getAllFiscalPeriods();
- }
- catch (LimaException eee) {
- if (log.isDebugEnabled()) {
- log.debug("Can't get list accounts", eee);
- }
- }
- return result;
+ List<FiscalPeriod> result = null;
+ try {
+ result = fiscalPeriodService.getAllFiscalPeriods();
+ } catch (LimaException eee) {
+ if (log.isDebugEnabled()) {
+ log.debug("Can't get list accounts", eee);
+ }
+ }
+ return result;
}
-
- public void refresh(){
+
+ public void refresh() {
datasCache = getDataList();
fireContentsChanged(this, 0, datasCache.size());
}
-
+
public void refreshAll() {
- datasCache = getAllDataList();
- fireContentsChanged(this, 0, datasCache.size());
+ datasCache = getAllDataList();
+ fireContentsChanged(this, 0, datasCache.size());
}
-
+
@Override
public void notifyMethod(String serviceName, String methodeName) {
- if (serviceName.contains("FiscalPeriod") || methodeName.contains("importAll")){
+ if (serviceName.contains("FiscalPeriod") || methodeName.contains("importAll")) {
refresh();
- }
+ }
}
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FiscalPeriodComboBoxRenderer.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FiscalPeriodComboBoxRenderer.java 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FiscalPeriodComboBoxRenderer.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -33,6 +33,7 @@
import java.awt.Component;
import java.text.SimpleDateFormat;
+@Deprecated
public class FiscalPeriodComboBoxRenderer extends DefaultListCellRenderer {
private static final long serialVersionUID = 1L;
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/LetterComboBoxModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/LetterComboBoxModel.java 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/LetterComboBoxModel.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -25,9 +25,6 @@
package org.chorem.lima.ui.combobox;
-import java.util.List;
-import javax.swing.AbstractListModel;
-import javax.swing.ComboBoxModel;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.FinancialTransactionServiceMonitorable;
@@ -38,42 +35,44 @@
import org.chorem.lima.service.LimaServiceFactory;
import org.chorem.lima.ui.financialperiod.FinancialPeriodTableModel;
-/**
- * Account combo box model.
- */
+import javax.swing.AbstractListModel;
+import javax.swing.ComboBoxModel;
+import java.util.List;
+/** Account combo box model. */
+
public class LetterComboBoxModel extends AbstractListModel implements ComboBoxModel, ServiceListener {
-
+
private static final long serialVersionUID = 1L;
private static final Log log =
- LogFactory.getLog(FinancialPeriodTableModel.class);
-
+ LogFactory.getLog(FinancialPeriodTableModel.class);
+
protected Object selectedAccount;
-
+
protected List<Letter> datasCache;
-
+
protected FinancialTransactionServiceMonitorable service;
-
- public LetterComboBoxModel () {
+
+ public LetterComboBoxModel() {
service =
- LimaServiceFactory.getInstance().getService(
- FinancialTransactionServiceMonitorable.class);
+ LimaServiceFactory.getInstance().getService(
+ FinancialTransactionServiceMonitorable.class);
service.addServiceListener(this);
LimaServiceFactory.getInstance().getService(
ImportServiceMonitorable.class).addServiceListener(this);
datasCache = getDataList();
}
-
+
@Override
public Object getSelectedItem() {
- return selectedAccount;
+ return selectedAccount;
}
@Override
public void setSelectedItem(Object anItem) {
selectedAccount = anItem;
- fireContentsChanged(this, -1, -1);
+ fireContentsChanged(this, -1, -1);
}
@@ -84,34 +83,33 @@
@Override
public int getSize() {
- return datasCache.size();
+ return datasCache.size();
}
- public List<Letter> getDataList(){
+ public List<Letter> getDataList() {
List<Letter> result = null;
try {
result = service.getAllLetters();
- }
- catch (LimaException eee) {
- if (log.isDebugEnabled()){
+ } catch (LimaException eee) {
+ if (log.isDebugEnabled()) {
log.debug("Can't get list letters", eee);
}
}
return result;
-
+
}
-
- public void refresh(){
+
+ public void refresh() {
datasCache = getDataList();
fireContentsChanged(this, 0, datasCache.size());
}
@Override
public void notifyMethod(String serviceName, String methodeName) {
- if (methodeName.contains("Letter") || methodeName.contains("importAll")){
+ if (methodeName.contains("Letter") || methodeName.contains("importAll")) {
refresh();
- }
+ }
}
-
+
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/LetterRenderer.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/LetterRenderer.java 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/LetterRenderer.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -32,6 +32,7 @@
import javax.swing.JList;
import java.awt.Component;
+@Deprecated
public class LetterRenderer extends DefaultListCellRenderer {
private static final long serialVersionUID = 1L;
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 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/SubAccountComboBoxModel.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -25,10 +25,6 @@
package org.chorem.lima.ui.combobox;
-import java.util.ArrayList;
-import java.util.List;
-import javax.swing.AbstractListModel;
-import javax.swing.ComboBoxModel;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.AccountServiceMonitorable;
@@ -38,35 +34,38 @@
import org.chorem.lima.entity.Account;
import org.chorem.lima.service.LimaServiceFactory;
-/**
- * Account combo box model.
- */
+import javax.swing.AbstractListModel;
+import javax.swing.ComboBoxModel;
+import java.util.ArrayList;
+import java.util.List;
+/** Account combo box model. */
+
public class SubAccountComboBoxModel extends AbstractListModel implements ComboBoxModel, ServiceListener {
-
+
private static final long serialVersionUID = 1L;
private static final Log log = LogFactory.getLog(SubAccountComboBoxModel.class);
-
+
protected Object selectedAccount;
-
+
protected List<Account> datasCache;
-
+
protected AccountServiceMonitorable accountService;
-
+
public SubAccountComboBoxModel() {
accountService =
- LimaServiceFactory.getInstance().getService(
- AccountServiceMonitorable.class);
+ LimaServiceFactory.getInstance().getService(
+ AccountServiceMonitorable.class);
accountService.addServiceListener(this);
LimaServiceFactory.getInstance().getService(
ImportServiceMonitorable.class).addServiceListener(this);
datasCache = getDataList();
}
-
+
@Override
public Object getSelectedItem() {
- return selectedAccount;
+ return selectedAccount;
}
@Override
@@ -77,7 +76,7 @@
@Override
public Object getElementAt(int index) {
- return datasCache.get(index);
+ return datasCache.get(index);
}
@Override
@@ -85,31 +84,30 @@
return datasCache.size();
}
- public List<Account> getDataList(){
+ public List<Account> getDataList() {
List<Account> result = new ArrayList<Account>();
try {
result = accountService.getAllSubAccounts();
- }
- catch (LimaException eee) {
- if (log.isDebugEnabled()){
+ } catch (LimaException eee) {
+ if (log.isDebugEnabled()) {
log.debug("Can't get list subaccounts", eee);
}
}
return result;
-
+
}
-
- public void refresh(){
+
+ public void refresh() {
datasCache = getDataList();
fireContentsChanged(this, 0, datasCache.size());
}
@Override
public void notifyMethod(String serviceName, String methodeName) {
- if (serviceName.contains("Account") || methodeName.contains("importAll")){
+ if (serviceName.contains("Account") || methodeName.contains("importAll")) {
refresh();
- }
+ }
}
-
+
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookTable.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookTable.java 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookTable.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -24,34 +24,34 @@
*/
package org.chorem.lima.ui.entrybook;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jdesktop.swingx.JXTable;
+
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jdesktop.swingx.JXTable;
-
public class EntryBookTable extends JXTable
implements KeyListener, MouseListener {
- /** serialVersionUID. */
- private static final long serialVersionUID = 6228396251512013262L;
-
- /** log. */
+ /** serialVersionUID. */
+ private static final long serialVersionUID = 6228396251512013262L;
+
+ /** log. */
private static final Log log = LogFactory
.getLog(EntryBookTable.class);
-
+
protected EntryBookViewHandler handler;
-
+
public EntryBookTable(EntryBookViewHandler handler) {
-
+
this.handler = handler;
-
+
addKeyListener(this);
addMouseListener(this);
-
+
}
@Override
@@ -89,9 +89,9 @@
public void keyPressed(KeyEvent e) {
// clear row selection with the key: escape
if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
- if (!isEditing()) {
+ if (!isEditing()) {
clearSelection();
- }
+ }
}
}
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 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookTableModel.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -25,8 +25,6 @@
package org.chorem.lima.ui.entrybook;
-import static org.nuiton.i18n.I18n._;
-import javax.swing.table.AbstractTableModel;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.EntryBookServiceMonitorable;
@@ -36,15 +34,19 @@
import org.chorem.lima.entity.EntryBook;
import org.chorem.lima.service.LimaServiceFactory;
+import javax.swing.table.AbstractTableModel;
+
+import static org.nuiton.i18n.I18n._;
+
/**
* Entry book table model.
- *
+ *
* @author ore
* @author chatellier
* @version $Revision$
- *
- * Last update : $Date$
- * By : $Author$
+ * <p/>
+ * Last update : $Date$
+ * By : $Author$
*/
public class EntryBookTableModel extends AbstractTableModel implements ServiceListener {
@@ -57,28 +59,26 @@
/** Services. */
protected EntryBookServiceMonitorable entryBookService;
- /**
- * Constructor.
- */
+ /** Constructor. */
public EntryBookTableModel() {
entryBookService =
- LimaServiceFactory.getInstance().getService(
- EntryBookServiceMonitorable.class);
+ LimaServiceFactory.getInstance().getService(
+ EntryBookServiceMonitorable.class);
LimaServiceFactory.getInstance().getService(ImportServiceMonitorable.class).addServiceListener(this);
- }
+ }
@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);
+ if (log.isDebugEnabled()) {
+ log.debug("Can't get all entrybooks", e);
}
}
-
+
return result;
}
@@ -104,7 +104,7 @@
public EntryBook getEntryBookAtRow(int row) throws LimaException {
EntryBook entryBook;
entryBook = entryBookService.getAllEntryBooks().get(row);
-
+
return entryBook;
}
@@ -124,8 +124,8 @@
break;
}
} catch (LimaException eee) {
- if (log.isDebugEnabled()){
- log.debug("Can't get EntryBook",eee);
+ if (log.isDebugEnabled()) {
+ log.debug("Can't get EntryBook", eee);
}
}
@@ -140,7 +140,7 @@
/**
* @param entryBook
- * @throws LimaException
+ * @throws LimaException
*/
public void addEntryBook(EntryBook entryBook) throws LimaException {
/* Calling journal service */
@@ -150,7 +150,6 @@
}
/**
- *
* @param entryBook
* @throws LimaException
*/
@@ -162,9 +161,8 @@
}
/**
- *
* @param entryBook
- * @throws LimaException
+ * @throws LimaException
*/
public void removeEntryBook(EntryBook entryBook) throws LimaException {
/* Calling journal service */
@@ -172,14 +170,14 @@
entryBookService.removeEntryBook(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")){
+ || methodeName.contains("importAll")
+ || methodeName.contains("importAs")) {
fireTableDataChanged();
}
}
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 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookViewHandler.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -25,9 +25,6 @@
package org.chorem.lima.ui.entrybook;
-import static org.nuiton.i18n.I18n._;
-
-import javax.swing.JOptionPane;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.EntryBookServiceMonitorable;
@@ -42,35 +39,39 @@
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.
- *
+ *
* @author chatellier
* @version $Revision$
- *
- * Last update : $Date$
- * By : $Author$
+ * <p/>
+ * Last update : $Date$
+ * By : $Author$
*/
public class EntryBookViewHandler {
private static final Log log = LogFactory.getLog(EntryBookViewHandler.class);
-
+
protected EntryBookView view;
-
+
protected EntryBookService entryBookService;
-
+
public EntryBookViewHandler(EntryBookView view) {
this.view = view;
entryBookService =
- LimaServiceFactory.getInstance().getService(
- EntryBookServiceMonitorable.class);
- }
-
+ LimaServiceFactory.getInstance().getService(
+ EntryBookServiceMonitorable.class);
+ }
+
public void addEntryBook() {
JXTable entryBookTable = view.getEntryBooksTable();
EntryBookTableModel entryBookTableModel =
- (EntryBookTableModel)entryBookTable.getModel();
+ (EntryBookTableModel) entryBookTable.getModel();
EntryBook newEntryBook = new EntryBookImpl();
EntryBookForm entryBookForm = new EntryBookForm(view);
@@ -78,7 +79,7 @@
// jaxx constructor don't call super() ?
entryBookForm.setLocationRelativeTo(view);
entryBookForm.setVisible(true);
-
+
// null == cancel action
newEntryBook = entryBookForm.getEntryBook();
if (newEntryBook != null) {
@@ -100,18 +101,18 @@
JXTable entryBookTable = view.getEntryBooksTable();
int selectedRow = entryBookTable.getSelectedRow();
EntryBookTableModel entryBookTableModel =
- (EntryBookTableModel)entryBookTable.getModel();
+ (EntryBookTableModel) entryBookTable.getModel();
// add it
try {
EntryBook selectedEntryBook =
- entryBookTableModel.getEntryBookAtRow(selectedRow);
+ entryBookTableModel.getEntryBookAtRow(selectedRow);
EntryBookForm entryBookForm = new EntryBookForm(view);
entryBookForm.setEntryBook(selectedEntryBook);
// jaxx constructor don't call super() ?
entryBookForm.setLocationRelativeTo(view);
entryBookForm.setVisible(true);
-
+
// null == cancel action
selectedEntryBook = entryBookForm.getEntryBook();
if (selectedEntryBook != null) {
@@ -129,19 +130,19 @@
JXTable entryBookTable = view.getEntryBooksTable();
int selectedRow = entryBookTable.getSelectedRow();
EntryBookTableModel entryBookTableModel =
- (EntryBookTableModel)entryBookTable.getModel();
+ (EntryBookTableModel) entryBookTable.getModel();
// add it
try {
EntryBook selectedEntryBook =
- entryBookTableModel.getEntryBookAtRow(selectedRow);
-
+ entryBookTableModel.getEntryBookAtRow(selectedRow);
+
int response =
JOptionPane.showConfirmDialog(view,
- _("lima.charts.entrybook.confirmation",
- selectedEntryBook.getLabel()),
- _("lima.common.confirmation"), JOptionPane.YES_NO_OPTION,
- JOptionPane.QUESTION_MESSAGE);
+ _("lima.charts.entrybook.confirmation",
+ selectedEntryBook.getLabel()),
+ _("lima.common.confirmation"), JOptionPane.YES_NO_OPTION,
+ JOptionPane.QUESTION_MESSAGE);
if (response == JOptionPane.YES_OPTION) {
entryBookTableModel.removeEntryBook(selectedEntryBook);
@@ -153,25 +154,25 @@
DialogHelper.showMessageDialog(eee.getMessage());
}
}
-
-
- public void importEntryBooks(){
-
+
+
+ public void importEntryBooks() {
+
EntryBookImportForm form =
- new EntryBookImportForm();
+ new EntryBookImportForm();
form.setLocationRelativeTo(view);
form.setVisible(true);
Object value = form.getRadioButtons().getSelectedValue();
// if action confirmed
- if (value != null){
+ if (value != null) {
EntryBooksChartEnum defaultEntryBooksEnum =
- (EntryBooksChartEnum) value;
+ (EntryBooksChartEnum) value;
ImportExport importExport = ImportExport.getInstance(view);
importExport.importExport(ImportExportEnum.CSV_ENTRYBOOKS_IMPORT,
- defaultEntryBooksEnum.getFilePath(), true);
+ defaultEntryBooksEnum.getFilePath(), true);
}
}
-
+
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBookComboBox.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBookComboBox.java 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBookComboBox.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -43,10 +43,10 @@
private static final long serialVersionUID = 1L;
private static final Log log =
- LogFactory.getLog(EntryBookComboBox.class);
-
+ LogFactory.getLog(EntryBookComboBox.class);
+
protected EntryBooksReportsViewHandler handler;
-
+
public EntryBookComboBox(EntryBooksReportsViewHandler handler) {
this.handler = handler;
EntryBookComboBoxModel entryBookComboBoxModel = new EntryBookComboBoxModel();
@@ -58,30 +58,30 @@
addActionListener(this);
}
- public void back(){
+ public void back() {
int row = getSelectedIndex();
log.debug(row);
- if (row > 0){
- getEditor().setItem(getItemAt(row-1));
+ if (row > 0) {
+ getEditor().setItem(getItemAt(row - 1));
handler.setEntryBook((EntryBook) getSelectedItem());
}
}
-
- public void next(){
+
+ public void next() {
int size = getModel().getSize();
int row = getSelectedIndex();
log.debug(row);
-
- if (row < size-1){
- getEditor().setItem(getItemAt(row+1));
+
+ if (row < size - 1) {
+ getEditor().setItem(getItemAt(row + 1));
handler.setEntryBook((EntryBook) getSelectedItem());
}
}
-
+
@Override
public void actionPerformed(ActionEvent e) {
Object object = getSelectedItem();
- if (object instanceof EntryBook){
+ if (object instanceof EntryBook) {
handler.setEntryBook((EntryBook) getSelectedItem());
}
}
@@ -89,25 +89,24 @@
@Override
public void keyPressed(KeyEvent e) {
-
+
}
@Override
public void keyReleased(KeyEvent e) {
Object object = getSelectedItem();
- if (object instanceof EntryBook){
+ if (object instanceof EntryBook) {
handler.setEntryBook((EntryBook) getSelectedItem());
}
// delegate popup list menu
- if ( e.getKeyChar() == KeyEvent.VK_ENTER )
- {
+ if (e.getKeyChar() == KeyEvent.VK_ENTER) {
firePopupMenuCanceled();
}
}
@Override
public void keyTyped(KeyEvent e) {
-
+
}
-
+
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsPeriodSearchPanel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsPeriodSearchPanel.java 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsPeriodSearchPanel.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -25,14 +25,6 @@
package org.chorem.lima.ui.entrybooksreports;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.util.Calendar;
-import java.util.Date;
-import static org.nuiton.i18n.I18n._;
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
import org.apache.commons.lang.time.DateUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -40,120 +32,131 @@
import org.chorem.lima.entity.FiscalPeriod;
import org.chorem.lima.enums.ComboBoxDatesEnum;
import org.chorem.lima.ui.combobox.FinancialPeriodComboBoxModel;
-import org.chorem.lima.ui.combobox.FinancialPeriodComboBoxRenderer;
import org.chorem.lima.ui.combobox.FiscalPeriodComboBoxModel;
-import org.chorem.lima.ui.combobox.FiscalPeriodComboBoxRenderer;
+import org.chorem.lima.ui.renderers.RendererUtil;
import org.jdesktop.swingx.JXDatePicker;
+import javax.swing.JComboBox;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.ListCellRenderer;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.Calendar;
+import java.util.Date;
+
+import static org.nuiton.i18n.I18n._;
+
public class EntryBooksReportsPeriodSearchPanel extends JPanel {
-
+
private static final Log log =
- LogFactory.getLog(EntryBooksReportsPeriodSearchPanel.class);
-
+ LogFactory.getLog(EntryBooksReportsPeriodSearchPanel.class);
+
protected EntryBooksReportsViewHandler handler;
-
+
public EntryBooksReportsPeriodSearchPanel(EntryBooksReportsViewHandler handler) {
this.handler = handler;
-
+
//init date
refresh(ComboBoxDatesEnum.FISCAL_PERIOD);
}
-
- static final long serialVersionUID = 1L;
- public void refresh(ComboBoxDatesEnum comboBoxPeriodEnum){
-
+ public void refresh(ComboBoxDatesEnum comboBoxPeriodEnum) {
+
switch (comboBoxPeriodEnum) {
- case PERIOD:
- // get begin date
- Calendar calendarBegin = Calendar.getInstance();
- // set begindate to JAN 1 - 0:00.000 of this years
- Date beginDate = calendarBegin.getTime();
- beginDate = DateUtils.truncate(beginDate, Calendar.YEAR);
- //handler().setBeginDate(beginDate);
-
- // get end date
- Calendar calendarEnd = Calendar.getInstance();
- Date endDate = calendarEnd.getTime();
- //handler().setEndDate(endDate);
- JLabel beginDateLabel = new JLabel(_("lima.common.begindate"));
- final JXDatePicker beginDatePicker = new JXDatePicker(beginDate);
- ActionListener beginDateActionListener = new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- handler.setBeginDate(beginDatePicker.getDate());
- handler.refresh();
- }
- };
- handler.setBeginDate(beginDatePicker.getDate());
- beginDatePicker.addActionListener(beginDateActionListener);
-
- JLabel endDateLabel = new JLabel(_("lima.common.enddate"));
- final JXDatePicker endDatePicker = new JXDatePicker(endDate);
- ActionListener endDateActionListener = new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- handler.setEndDate(endDatePicker.getDate());
- handler.refresh();
- }
- };
- handler.setEndDate(endDatePicker.getDate());
- endDatePicker.addActionListener(endDateActionListener);
- handler.refresh();
+ case PERIOD:
+ // get begin date
+ Calendar calendarBegin = Calendar.getInstance();
+ // set begindate to JAN 1 - 0:00.000 of this years
+ Date beginDate = calendarBegin.getTime();
+ beginDate = DateUtils.truncate(beginDate, Calendar.YEAR);
+ //handler().setBeginDate(beginDate);
- removeAll();
- add(beginDateLabel);
- add(beginDatePicker);
- add(endDateLabel);
- add(endDatePicker);
- break;
-
- case FISCAL_PERIOD:
- FiscalPeriodComboBoxModel fiscalModel = new FiscalPeriodComboBoxModel(true);
- FiscalPeriodComboBoxRenderer fiscalRenderer = new FiscalPeriodComboBoxRenderer();
- final JComboBox fiscalPeriod = new JComboBox(fiscalModel);
- fiscalPeriod.setRenderer(fiscalRenderer);
- fiscalPeriod.setEditable(false);
- ActionListener fiscalPeriodActionListener = new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- FiscalPeriod fPeriod = (FiscalPeriod) fiscalPeriod.getSelectedItem();
- if (fPeriod != null){
- handler.setBeginDate(fPeriod.getBeginDate());
- handler.setEndDate(fPeriod.getEndDate());
+ // get end date
+ Calendar calendarEnd = Calendar.getInstance();
+ Date endDate = calendarEnd.getTime();
+ //handler().setEndDate(endDate);
+ JLabel beginDateLabel = new JLabel(_("lima.common.begindate"));
+ final JXDatePicker beginDatePicker = new JXDatePicker(beginDate);
+ ActionListener beginDateActionListener = new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ handler.setBeginDate(beginDatePicker.getDate());
handler.refresh();
}
- }
- };
- fiscalPeriod.addActionListener(fiscalPeriodActionListener);
+ };
+ handler.setBeginDate(beginDatePicker.getDate());
+ beginDatePicker.addActionListener(beginDateActionListener);
- removeAll();
- add(fiscalPeriod);
- break;
-
- case FINANCIAL_PERIOD:
- FinancialPeriodComboBoxModel financialModel = new FinancialPeriodComboBoxModel(true);
- FinancialPeriodComboBoxRenderer financialRenderer = new FinancialPeriodComboBoxRenderer();
- final JComboBox financialPeriod = new JComboBox(financialModel);
- financialPeriod.setRenderer(financialRenderer);
- financialPeriod.setEditable(false);
- ActionListener financialPeriodActionListener = new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- FinancialPeriod fPeriod = (FinancialPeriod) financialPeriod.getSelectedItem();
- if (fPeriod != null){
- handler.setBeginDate(fPeriod.getBeginDate());
- handler.setEndDate(fPeriod.getEndDate());
+ JLabel endDateLabel = new JLabel(_("lima.common.enddate"));
+ final JXDatePicker endDatePicker = new JXDatePicker(endDate);
+ ActionListener endDateActionListener = new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ handler.setEndDate(endDatePicker.getDate());
handler.refresh();
}
- }
- };
- financialPeriod.addActionListener(financialPeriodActionListener);
- removeAll();
- add(financialPeriod);
- break;
+ };
+ handler.setEndDate(endDatePicker.getDate());
+ endDatePicker.addActionListener(endDateActionListener);
+ handler.refresh();
+
+ removeAll();
+ add(beginDateLabel);
+ add(beginDatePicker);
+ add(endDateLabel);
+ add(endDatePicker);
+ break;
+
+ case FISCAL_PERIOD:
+ FiscalPeriodComboBoxModel fiscalModel = new FiscalPeriodComboBoxModel(true);
+ ListCellRenderer renderer =
+ RendererUtil.newDecoratorListCellRenderer(FiscalPeriod.class);
+
+ final JComboBox fiscalPeriod = new JComboBox(fiscalModel);
+ fiscalPeriod.setRenderer(renderer);
+ fiscalPeriod.setEditable(false);
+ ActionListener fiscalPeriodActionListener = new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ FiscalPeriod fPeriod = (FiscalPeriod) fiscalPeriod.getSelectedItem();
+ if (fPeriod != null) {
+ handler.setBeginDate(fPeriod.getBeginDate());
+ handler.setEndDate(fPeriod.getEndDate());
+ handler.refresh();
+ }
+ }
+ };
+ fiscalPeriod.addActionListener(fiscalPeriodActionListener);
+
+ removeAll();
+ add(fiscalPeriod);
+ break;
+
+ case FINANCIAL_PERIOD:
+ FinancialPeriodComboBoxModel financialModel = new FinancialPeriodComboBoxModel(true);
+ renderer =
+ RendererUtil.newDecoratorListCellRenderer(FinancialPeriod.class);
+ final JComboBox financialPeriod = new JComboBox(financialModel);
+ financialPeriod.setRenderer(renderer);
+ financialPeriod.setEditable(false);
+ ActionListener financialPeriodActionListener = new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ FinancialPeriod fPeriod = (FinancialPeriod) financialPeriod.getSelectedItem();
+ if (fPeriod != null) {
+ handler.setBeginDate(fPeriod.getBeginDate());
+ handler.setEndDate(fPeriod.getEndDate());
+ handler.refresh();
+ }
+ }
+ };
+ financialPeriod.addActionListener(financialPeriodActionListener);
+ removeAll();
+ add(financialPeriod);
+ break;
}
-
+
}
-
+
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsTable.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsTable.java 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsTable.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -25,14 +25,6 @@
package org.chorem.lima.ui.entrybooksreports;
-import java.awt.Color;
-import java.awt.Component;
-import java.awt.event.KeyEvent;
-import java.awt.event.KeyListener;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-import java.math.BigDecimal;
-
import org.chorem.lima.entity.Entry;
import org.chorem.lima.entity.FinancialTransaction;
import org.chorem.lima.ui.celleditor.BigDecimalTableCellRenderer;
@@ -42,21 +34,29 @@
import org.jdesktop.swingx.decorator.HighlightPredicate;
import org.jdesktop.swingx.decorator.Highlighter;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.math.BigDecimal;
+
public class EntryBooksReportsTable extends JXTable
- implements KeyListener, MouseListener {
+ implements KeyListener, MouseListener {
/** serialVersionUID. */
private static final long serialVersionUID = 1L;
protected EntryBooksReportsViewHandler handler;
-
+
protected EntryBooksReportsTableModel model;
-
+
private Highlighter colorReportsDatas;
-
+
private FinancialTransaction oldRow;
-
+
private Boolean highlighterReportsDatasBoolean;
/**
@@ -65,11 +65,11 @@
this.handler = handler;
this.model = model;
-
+
addKeyListener(this);
addMouseListener(this);
-
- highlighterReportsDatasBoolean=true;
+
+ highlighterReportsDatasBoolean = true;
//Get new BigDecimal renderer
setDefaultRenderer(BigDecimal.class, new BigDecimalTableCellRenderer());
//highlight financial financial transactions
@@ -82,28 +82,28 @@
* afin de bien distinguer les entête de comptes et les entrées comptables.
* On récupère la première cellule, on vérifie que c'est pas null
*/
- protected void addColorReportsDatas() {
- if (colorReportsDatas != null) {
- removeHighlighter(colorReportsDatas);
- }
- HighlightPredicate predicate = new HighlightPredicate() {
- @Override
- public boolean isHighlighted(Component renderer,
- ComponentAdapter adapter) {
- Entry entry = model.getElementAt(adapter.row);
- FinancialTransaction financialTransaction = entry.getFinancialTransaction();
- if (financialTransaction != oldRow){
- highlighterReportsDatasBoolean = !highlighterReportsDatasBoolean;
- }
- oldRow = financialTransaction;
- if (adapter.row ==0){
- highlighterReportsDatasBoolean=false;
- }
- return highlighterReportsDatasBoolean;
- }
- };
- colorReportsDatas =
- new ColorHighlighter(predicate, new Color(222,222,222), null);
+ protected void addColorReportsDatas() {
+ if (colorReportsDatas != null) {
+ removeHighlighter(colorReportsDatas);
+ }
+ HighlightPredicate predicate = new HighlightPredicate() {
+ @Override
+ public boolean isHighlighted(Component renderer,
+ ComponentAdapter adapter) {
+ Entry entry = model.getElementAt(adapter.row);
+ FinancialTransaction financialTransaction = entry.getFinancialTransaction();
+ if (financialTransaction != oldRow) {
+ highlighterReportsDatasBoolean = !highlighterReportsDatasBoolean;
+ }
+ oldRow = financialTransaction;
+ if (adapter.row == 0) {
+ highlighterReportsDatasBoolean = false;
+ }
+ return highlighterReportsDatasBoolean;
+ }
+ };
+ colorReportsDatas =
+ new ColorHighlighter(predicate, new Color(222, 222, 222), null);
addHighlighter(colorReportsDatas);
}
@@ -142,9 +142,9 @@
public void keyPressed(KeyEvent e) {
// clear row selection with the key: escape
if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
- if (!isEditing()) {
+ if (!isEditing()) {
clearSelection();
- }
+ }
}
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsTableModel.java 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsTableModel.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -25,13 +25,6 @@
package org.chorem.lima.ui.entrybooksreports;
-import static org.nuiton.i18n.I18n._;
-
-import java.math.BigDecimal;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-import javax.swing.table.AbstractTableModel;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.beans.ReportsDatas;
@@ -39,7 +32,14 @@
import org.chorem.lima.entity.Entry;
import org.chorem.lima.entity.Letter;
+import javax.swing.table.AbstractTableModel;
+import java.math.BigDecimal;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import static org.nuiton.i18n.I18n._;
+
+
/**
* Entry book table model.
* By : $Author$
@@ -51,14 +51,14 @@
/** log. */
private static final Log log = LogFactory.getLog(EntryBooksReportsTableModel.class);
-
+
/** data cache */
protected ReportsDatas cacheDataList;
@Override
public int getRowCount() {
int result = 0;
-
+
// just prevent too much result
if (cacheDataList != null && cacheDataList.getListEntry() != null) {
result = cacheDataList.getListEntry().size();
@@ -71,34 +71,34 @@
public int getColumnCount() {
return 7;
}
-
+
@Override
public Class<?> getColumnClass(int column) {
Class<?> result = null;
switch (column) {
- case 0:
- result = Date.class;
- break;
- case 1:
- result = Account.class;
- break;
- case 2:
- result = String.class;
- break;
- case 3:
- result = String.class;
- break;
- case 4:
- result = Letter.class;
- break;
- case 5:
- result = BigDecimal.class;
- break;
- case 6:
- result = BigDecimal.class;
- break;
+ case 0:
+ result = Date.class;
+ break;
+ case 1:
+ result = Account.class;
+ break;
+ case 2:
+ result = String.class;
+ break;
+ case 3:
+ result = String.class;
+ break;
+ case 4:
+ result = Letter.class;
+ break;
+ case 5:
+ result = BigDecimal.class;
+ break;
+ case 6:
+ result = BigDecimal.class;
+ break;
}
return result;
@@ -122,7 +122,7 @@
break;
case 4:
res = _("lima.table.letter");
- break;
+ break;
case 5:
res = _("lima.table.debit");
break;
@@ -136,21 +136,20 @@
@Override
public Object getValueAt(int row, int column) {
Object result = null;
- if(cacheDataList.getListEntry() != null) {
+ if (cacheDataList.getListEntry() != null) {
Entry currentRow = cacheDataList.getListEntry().get(row);
SimpleDateFormat simpleDateFormat =
- new SimpleDateFormat("dd MMMMM yyyy");
-
+ new SimpleDateFormat("dd MMMMM yyyy");
+
switch (column) {
case 0:
result = simpleDateFormat.
- format(currentRow.getFinancialTransaction().getTransactionDate());
+ format(currentRow.getFinancialTransaction().getTransactionDate());
break;
case 1:
- if (currentRow.getAccount() != null){
+ if (currentRow.getAccount() != null) {
result = currentRow.getAccount().getAccountNumber();
- }
- else {
+ } else {
result = null;
}
break;
@@ -161,10 +160,9 @@
result = currentRow.getDescription();
break;
case 4:
- if (currentRow.getLetter() != null){
+ if (currentRow.getLetter() != null) {
result = currentRow.getLetter().getCode();
- }
- else {
+ } else {
result = null;
}
break;
@@ -175,8 +173,7 @@
result = currentRow.getDebit() ? BigDecimal.ZERO : currentRow.getAmount();
break;
}
- }
- else {
+ } else {
if (log.isDebugEnabled()) {
log.debug("No EntryBook selected skip table model update");
}
@@ -185,20 +182,20 @@
return result;
}
- public Entry getElementAt(int row){
+ public Entry getElementAt(int row) {
return cacheDataList.getListEntry().get(row);
}
-
+
@Override
public boolean isCellEditable(int rowIndex, int columnIndex) {
// Just read, no write
return false;
}
-
- public void refresh(ReportsDatas datasList){
+
+ public void refresh(ReportsDatas datasList) {
cacheDataList = datasList;
fireTableDataChanged();
}
-
+
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsViewHandler.java 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsViewHandler.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -25,19 +25,6 @@
package org.chorem.lima.ui.entrybooksreports;
-import static org.nuiton.i18n.I18n._;
-import java.awt.Desktop;
-import java.io.IOException;
-import java.math.BigDecimal;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-
-import javax.swing.JOptionPane;
-
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.LimaConfig;
@@ -57,7 +44,20 @@
import org.chorem.lima.service.LimaServiceFactory;
import org.chorem.lima.util.ErrorHelper;
+import javax.swing.JOptionPane;
+import java.awt.Desktop;
+import java.io.IOException;
+import java.math.BigDecimal;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import static org.nuiton.i18n.I18n._;
+
+
/**
* Handler associated with accounts reports view.
* By : $Author$
@@ -65,131 +65,129 @@
public class EntryBooksReportsViewHandler implements ServiceListener {
protected EntryBooksReportsView view;
-
+
protected EntryBooksReportsTable table;
-
+
protected EntryBooksReportsTableModel tableModel;
-
+
/** log. */
private static final Log log = LogFactory.getLog(EntryBooksReportsViewHandler.class);
-
+
/** Services. */
protected ReportServiceMonitorable reportService;
+
protected DocumentServiceMonitorable documentService;
+
protected FiscalPeriodServiceMonitorable fiscalPeriodService;
-
+
/** Account. */
protected EntryBook selectedEntryBook;
-
+
/** Begin Date. */
protected Date selectedBeginDate;
-
+
/** EndDate. */
protected Date selectedEndDate;
-
+
protected int port;
-
+
private static SimpleDateFormat dateFormat =
- new SimpleDateFormat("yyyy-MM-dd");
-
+ new SimpleDateFormat("yyyy-MM-dd");
+
protected EntryBooksReportsViewHandler(EntryBooksReportsView view) {
this.view = view;
-
+
reportService =
- LimaServiceFactory.getInstance().getService(
- ReportServiceMonitorable.class);
+ LimaServiceFactory.getInstance().getService(
+ ReportServiceMonitorable.class);
port = LimaServiceFactory.getInstance().getService(
HttpServerServiceMonitorable.class).getHttpPort();
documentService =
- LimaServiceFactory.getInstance().getService(
- DocumentServiceMonitorable.class);
+ LimaServiceFactory.getInstance().getService(
+ DocumentServiceMonitorable.class);
fiscalPeriodService =
- LimaServiceFactory.getInstance().getService(
- FiscalPeriodServiceMonitorable.class);
+ LimaServiceFactory.getInstance().getService(
+ FiscalPeriodServiceMonitorable.class);
LimaServiceFactory.getInstance().getService(
ImportServiceMonitorable.class).addServiceListener(this);
LimaServiceFactory.getInstance().getService(
FinancialTransactionServiceMonitorable.class).addServiceListener(this);
}
-
- public void setBeginDate(Date date){
+
+ public void setBeginDate(Date date) {
selectedBeginDate = date;
refresh();
}
-
- public void setEndDate(Date date){
+
+ public void setEndDate(Date date) {
selectedEndDate = date;
refresh();
}
-
+
public void setEntryBook(EntryBook entryBook) {
selectedEntryBook = entryBook;
refresh();
}
-
- public ReportsDatas getDataList(){
+
+ public ReportsDatas getDataList() {
ReportsDatas results = null;
- if (selectedEntryBook != null){
+ if (selectedEntryBook != null) {
try {
results =
- reportService.generateEntryBooksReports(
- selectedEntryBook, selectedBeginDate, selectedEndDate);
- }
- catch (LimaException eee) {
+ reportService.generateEntryBooksReports(
+ selectedEntryBook, selectedBeginDate, selectedEndDate);
+ } catch (LimaException eee) {
if (log.isErrorEnabled()) {
log.debug("Can't update model", eee);
}
ErrorHelper.showErrorDialog(_("lima.entrybooksreports.listerror"), eee);
- }
+ }
}
return results;
}
-
- public void refresh(){
-
- if (selectedBeginDate != null && selectedEndDate != null && selectedEntryBook != null){
+
+ public void refresh() {
+
+ if (selectedBeginDate != null && selectedEndDate != null && selectedEntryBook != null) {
tableModel = view.getModelTable();
-
+
ReportsDatas datasList = getDataList();
-
- tableModel.refresh(datasList);
-
- /**
- * set text and amounts of labels credit, debit, solde
- */
-
- if (datasList != null){
+
+ tableModel.refresh(datasList);
+
+ /**
+ * set text and amounts of labels credit, debit, solde
+ */
+
+ if (datasList != null) {
// set amounts credit, debit and solde
view.amountCreditLabel.setText(
String.valueOf(datasList.getAmountCredit()));
view.amountDebitLabel.setText(
- String.valueOf(datasList.getAmountDebit()));
+ String.valueOf(datasList.getAmountDebit()));
BigDecimal amountSolde = datasList.getAmountSolde();
view.amountSoldeLabel.setText(String.valueOf(amountSolde));
-
- if (amountSolde == BigDecimal.ZERO){
+
+ if (amountSolde == BigDecimal.ZERO) {
view.soldeLabel.setText(_("lima.common.solde"));
- }
- else {
+ } else {
// set label solde: credit or debit
if (datasList.getSoldeDebit()) {
view.soldeLabel.setText(_("lima.common.soldedebit"));
- }
- else {
+ } else {
view.soldeLabel.setText(_("lima.common.soldecredit"));
}
}
}
}
}
-
-
-
+
+
public void createDocument() {
-
- if (selectedBeginDate != null && selectedEndDate != null){
-
+
+ if (selectedBeginDate != null && selectedEndDate != null) {
+
//looks for all blocked fiscal periods
List<FiscalPeriod> blockedFiscalPeriods = new ArrayList<FiscalPeriod>();
try {
@@ -200,18 +198,18 @@
}
ErrorHelper.showErrorDialog(_("lima.entrybooksreports.documentcreationerror"), eee);
}
-
+
//tells if the fiscaPeriod as been found and is blocked
boolean error = true;
-
+
for (FiscalPeriod blockedFiscalPeriod : blockedFiscalPeriods) {
if (blockedFiscalPeriod.getBeginDate().equals(selectedBeginDate)
- && blockedFiscalPeriod.getEndDate().equals(selectedEndDate)
- && blockedFiscalPeriod.getLocked()) {
+ && blockedFiscalPeriod.getEndDate().equals(selectedEndDate)
+ && blockedFiscalPeriod.getLocked()) {
error = false;
}
}
-
+
//shows error message to user if the fiscalPeriod is unblocked
if (error) {
JOptionPane.showMessageDialog(
@@ -220,25 +218,25 @@
_("lima.common.error"),
JOptionPane.ERROR_MESSAGE);
} else {
-
+
FormatsEnum selectedEnum = (FormatsEnum) view.getDocumentEditor().getSelectedItem();
String address = LimaConfig.getInstance().getHostAdress();
-
+
try {
- String url = "http://"+address+":"+port+"/?beginDate="
- + dateFormat.format(selectedBeginDate)
- + "&endDate="+dateFormat.format(selectedEndDate)
- + "&format="+selectedEnum.getExtension()+"&model="
- + DocumentsEnum.ENTRYBOOKS.getFileName();
+ String url = "http://" + address + ":" + port + "/?beginDate="
+ + dateFormat.format(selectedBeginDate)
+ + "&endDate=" + dateFormat.format(selectedEndDate)
+ + "&format=" + selectedEnum.getExtension() + "&model="
+ + DocumentsEnum.ENTRYBOOKS.getFileName();
Desktop.getDesktop().browse(new URI(url));
-
- String url2 = "http://"+address+":"+port+"/?beginDate="
- + dateFormat.format(selectedBeginDate)
- + "&endDate="+dateFormat.format(selectedEndDate)
- + "&format="+selectedEnum.getExtension()+"&model="
- + DocumentsEnum.GENERAL_ENTRYBOOK.getFileName();
- Desktop.getDesktop().browse(new URI(url2));
-
+
+ String url2 = "http://" + address + ":" + port + "/?beginDate="
+ + dateFormat.format(selectedBeginDate)
+ + "&endDate=" + dateFormat.format(selectedEndDate)
+ + "&format=" + selectedEnum.getExtension() + "&model="
+ + DocumentsEnum.GENERAL_ENTRYBOOK.getFileName();
+ Desktop.getDesktop().browse(new URI(url2));
+
} catch (IOException e) {
log.error("Can't open browser", e);
} catch (URISyntaxException e) {
@@ -247,12 +245,12 @@
}
}
}
-
+
@Override
public void notifyMethod(String serviceName, String methodeName) {
- if (serviceName.contains("FinancialTransaction") || methodeName.contains("importEntryBook") || methodeName.contains("importAll")){
+ if (serviceName.contains("FinancialTransaction") || methodeName.contains("importEntryBook") || methodeName.contains("importAll")) {
refresh();
}
}
-
+
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodTable.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodTable.java 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodTable.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -25,14 +25,6 @@
package org.chorem.lima.ui.financialperiod;
-import java.awt.Color;
-import java.awt.Component;
-import java.awt.event.KeyEvent;
-import java.awt.event.KeyListener;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-import java.text.SimpleDateFormat;
-
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.FinancialPeriodServiceMonitorable;
@@ -47,36 +39,44 @@
import org.jdesktop.swingx.decorator.HighlightPredicate;
import org.jdesktop.swingx.decorator.Highlighter;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.text.SimpleDateFormat;
+
public class FinancialPeriodTable extends JXTable
implements KeyListener, MouseListener {
-
+
private static final long serialVersionUID = -1960326844433064178L;
private static final Log log =
- LogFactory.getLog(FinancialPeriodTableModel.class);
-
+ LogFactory.getLog(FinancialPeriodTableModel.class);
+
protected FinancialPeriodViewHandler handler;
-
+
protected FinancialPeriodTableModel model;
-
+
protected FinancialPeriodService financialPeriodService;
-
+
private Highlighter colorTransaction;
-
+
/*
- * Constructor, call highlighter
- */
+ * Constructor, call highlighter
+ */
public FinancialPeriodTable(FinancialPeriodViewHandler handler) {
this.handler = handler;
-
+
addKeyListener(this);
addMouseListener(this);
-
+
model = this.handler.getView().modelFinancialPeriodTable;
financialPeriodService =
- LimaServiceFactory.getInstance().getService(
- FinancialPeriodServiceMonitorable.class);
+ LimaServiceFactory.getInstance().getService(
+ FinancialPeriodServiceMonitorable.class);
//highlight financial financial transactions
addMonthColor();
@@ -90,50 +90,50 @@
HighlightPredicate predicate = new HighlightPredicate() {
@Override
public boolean isHighlighted(Component renderer,
- ComponentAdapter adapter) {
+ ComponentAdapter adapter) {
ClosedPeriodicEntryBook closedPeriodicEntryBook
- = (ClosedPeriodicEntryBook) model.getElementAt(adapter.row);
+ = (ClosedPeriodicEntryBook) model.getElementAt(adapter.row);
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MM");
int month = Integer.parseInt(simpleDateFormat.format(
closedPeriodicEntryBook.getFinancialPeriod().getBeginDate()));
// true if month is even
- return month % 2 ==0;
-
+ return month % 2 == 0;
+
}
};
- colorTransaction =
- new ColorHighlighter(predicate, new Color(222,222,222), null);
- addHighlighter(colorTransaction);
- }
-
+ colorTransaction =
+ new ColorHighlighter(predicate, new Color(222, 222, 222), null);
+ addHighlighter(colorTransaction);
+ }
+
/*
- * Color the font in red if period are closed
- */
+ * Color the font in red if period are closed
+ */
protected void addBlockColor() {
HighlightPredicate predicate = new HighlightPredicate() {
@Override
public boolean isHighlighted(Component renderer,
- ComponentAdapter adapter) {
+ ComponentAdapter adapter) {
ClosedPeriodicEntryBook closedPeriodicEntryBook =
- new ClosedPeriodicEntryBookImpl();
+ new ClosedPeriodicEntryBookImpl();
ClosedPeriodicEntryBook selectedClosedPeriodicEntryBook =
- (ClosedPeriodicEntryBook) model.getElementAt(adapter.row);
+ (ClosedPeriodicEntryBook) model.getElementAt(adapter.row);
// true if locked
try {
closedPeriodicEntryBook =
- financialPeriodService.getClosedPeriodicEntryBook(
- selectedClosedPeriodicEntryBook.getEntryBook(),
- selectedClosedPeriodicEntryBook.getFinancialPeriod());
+ financialPeriodService.getClosedPeriodicEntryBook(
+ selectedClosedPeriodicEntryBook.getEntryBook(),
+ selectedClosedPeriodicEntryBook.getFinancialPeriod());
} catch (LimaException eee) {
- log.debug("Can't get closePeriodicEntryBook",eee);
+ log.debug("Can't get closePeriodicEntryBook", eee);
}
return closedPeriodicEntryBook.getLocked();
}
};
- colorTransaction =
- new ColorHighlighter(predicate, null, new Color(222,0,0));
- addHighlighter(colorTransaction);
- }
+ colorTransaction =
+ new ColorHighlighter(predicate, null, new Color(222, 0, 0));
+ addHighlighter(colorTransaction);
+ }
@Override
public void mouseClicked(MouseEvent e) {
@@ -170,14 +170,14 @@
public void keyPressed(KeyEvent e) {
// clear row selection with the key: escape
if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
- if (!isEditing()) {
+ if (!isEditing()) {
clearSelection();
- }
+ }
}
}
@Override
public void keyReleased(KeyEvent e) {
}
-
+
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodTableModel.java 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodTableModel.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -25,12 +25,6 @@
package org.chorem.lima.ui.financialperiod;
-import static org.nuiton.i18n.I18n._;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import javax.swing.table.AbstractTableModel;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.FinancialPeriodServiceMonitorable;
@@ -44,14 +38,22 @@
import org.chorem.lima.entity.FinancialPeriod;
import org.chorem.lima.service.LimaServiceFactory;
+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._;
+
/**
* TODO add comment here.
- *
+ *
* @author chatellier
* @version $Revision$
- *
- * Last update : $Date$
- * By : $Author$
+ * <p/>
+ * Last update : $Date$
+ * By : $Author$
*/
public class FinancialPeriodTableModel extends AbstractTableModel implements ServiceListener {
@@ -59,29 +61,29 @@
private static final long serialVersionUID = 77027335135838258L;
private static final Log log =
- LogFactory.getLog(FinancialPeriodTableModel.class);
+ LogFactory.getLog(FinancialPeriodTableModel.class);
/** service */
protected FinancialPeriodServiceMonitorable financialPeriodService;
-
+
/** Datas cache */
protected List<Object> cacheDataList;
-
+
public FinancialPeriodTableModel() {
financialPeriodService =
- LimaServiceFactory.getInstance().getService(
- FinancialPeriodServiceMonitorable.class);
+ LimaServiceFactory.getInstance().getService(
+ FinancialPeriodServiceMonitorable.class);
LimaServiceFactory.getInstance().getService(
ImportServiceMonitorable.class).addServiceListener(this);
LimaServiceFactory.getInstance().getService(
FiscalPeriodServiceMonitorable.class).addServiceListener(this);
}
-
-
+
+
@Override
public int getRowCount() {
int result = 0;
-
+
if (cacheDataList != null) {
result = cacheDataList.size();
}
@@ -98,32 +100,32 @@
@Override
public String getColumnName(int columnIndex) {
-
+
String result = "n/a";
-
- switch(columnIndex) {
- case 0 :
- result = _("lima.table.period");
- break;
- case 1:
- result = _("lima.table.entrybook");
- break;
- case 2:
- result = _("lima.table.closure");
- break;
+
+ switch (columnIndex) {
+ case 0:
+ result = _("lima.table.period");
+ break;
+ case 1:
+ result = _("lima.table.entrybook");
+ break;
+ case 2:
+ result = _("lima.table.closure");
+ break;
}
return result;
}
-
+
@Override
public Class<?> getColumnClass(int columnIndex) {
// both String
return String.class;
}
-
+
@Override
public boolean isCellEditable(int rowIndex, int columnIndex) {
return false;
@@ -132,82 +134,81 @@
public ClosedPeriodicEntryBook getFinancialPeriodAtRow(int row) throws LimaException {
return (ClosedPeriodicEntryBook) cacheDataList.get(row);
}
-
-
- public Object getElementAt(int row){
-
+
+
+ public Object getElementAt(int row) {
+
Object currentRow = cacheDataList.get(row);
return currentRow;
}
-
-
+
+
@Override
public Object getValueAt(int rowIndex, int columnIndex) {
Object result = null;
ClosedPeriodicEntryBook closedPeriodicEntryBook
= (ClosedPeriodicEntryBook) cacheDataList.get(rowIndex);
-
- if (closedPeriodicEntryBook != null){
- EntryBook entryBook = closedPeriodicEntryBook.getEntryBook();
- FinancialPeriod financialPeriod =
+
+ if (closedPeriodicEntryBook != null) {
+ EntryBook entryBook = closedPeriodicEntryBook.getEntryBook();
+ FinancialPeriod financialPeriod =
closedPeriodicEntryBook.getFinancialPeriod();
-
- SimpleDateFormat simpleDateFormat
- = new SimpleDateFormat("dd MMM yyyy");
-
- switch (columnIndex) {
+
+ SimpleDateFormat simpleDateFormat
+ = new SimpleDateFormat("dd MMM yyyy");
+
+ switch (columnIndex) {
case 0:
result = simpleDateFormat.format(financialPeriod.getBeginDate())
- +" - "+simpleDateFormat.format(financialPeriod.getEndDate());
+ + " - " + simpleDateFormat.format(financialPeriod.getEndDate());
break;
case 1:
- result = entryBook.getCode()+" - "+entryBook.getLabel();
+ result = entryBook.getCode() + " - " + entryBook.getLabel();
break;
case 2:
- if(closedPeriodicEntryBook.getLocked()){
+ if (closedPeriodicEntryBook.getLocked()) {
result = _("lima.common.closed");
- }
- else{
+ } else {
result = _("lima.common.open");
}
break;
- }
}
+ }
return result;
}
-
- public List<Object> getDataList(){
+
+ public List<Object> getDataList() {
List<Object> results =
- new ArrayList<Object>();
+ new ArrayList<Object>();
try {
List<ClosedPeriodicEntryBook> closedPeriodicEntryBook = financialPeriodService.//getAllClosedPeriodicEntryBooks();
- getAllClosedPeriodicEntryBooksFromUnblockedFiscalPeriod();
+ getAllClosedPeriodicEntryBooksFromUnblockedFiscalPeriod();
Collections.sort(closedPeriodicEntryBook, new FinancialPeriodComparator());
results.addAll(closedPeriodicEntryBook);
- } catch (LimaException eee){
- if (log.isDebugEnabled()){
- log.debug("Can't get closedperiodicentrybook list", eee );
+ } catch (LimaException eee) {
+ if (log.isDebugEnabled()) {
+ log.debug("Can't get closedperiodicentrybook list", eee);
}
}
return results;
}
-
- public void refresh(){
+
+ public void refresh() {
cacheDataList = getDataList();
fireTableDataChanged();
}
-
+
public void blockFinancialPeriod(ClosedPeriodicEntryBook closedPeriodicEntryBook) throws LimaException {
financialPeriodService.
- blockClosedPeriodicEntryBook(closedPeriodicEntryBook);
+ blockClosedPeriodicEntryBook(closedPeriodicEntryBook);
refresh();
}
@Override
public void notifyMethod(String serviceName, String methodeName) {
- if (methodeName.contains("FiscalPeriod") || methodeName.contains("importAll")){
+ if (methodeName.contains("FiscalPeriod") || methodeName.contains("importAll")) {
refresh();
}
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodViewHandler.java 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodViewHandler.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -25,36 +25,36 @@
package org.chorem.lima.ui.financialperiod;
-import static org.nuiton.i18n.I18n._;
-
-import javax.swing.JOptionPane;
-
-import org.jdesktop.swingx.JXTable;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.entity.ClosedPeriodicEntryBook;
import org.chorem.lima.util.DialogHelper;
+import org.jdesktop.swingx.JXTable;
+import javax.swing.JOptionPane;
+
+import static org.nuiton.i18n.I18n._;
+
/**
* TODO add comment here.
- *
+ *
* @author chatellier
* @version $Revision$
- *
- * Last update : $Date$
- * By : $Author$
+ * <p/>
+ * Last update : $Date$
+ * By : $Author$
*/
public class FinancialPeriodViewHandler {
private static final Log log = LogFactory.getLog(FinancialPeriodViewHandler.class);
-
+
protected FinancialPeriodView view;
-
+
protected FinancialPeriodTable table;
-
+
protected FinancialPeriodTableModel tableModel;
-
+
protected FinancialPeriodViewHandler(FinancialPeriodView view) {
this.view = view;
}
@@ -62,13 +62,13 @@
public void blockFinancialPeriod() {
JXTable financialPeriodeTable = view.getFinancialPeriodTable();
int selectedRow = financialPeriodeTable.getSelectedRow();
- FinancialPeriodTableModel model = (FinancialPeriodTableModel)view.getFinancialPeriodTable().getModel();
-
+ FinancialPeriodTableModel model = (FinancialPeriodTableModel) view.getFinancialPeriodTable().getModel();
+
// blocked it
try {
ClosedPeriodicEntryBook closedPeriodicEntryBook = model.getFinancialPeriodAtRow(selectedRow);
int response = JOptionPane.showConfirmDialog(view, _("lima.charts.financialperiod.question.blocked"),
- _("lima.common.question"), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
+ _("lima.common.question"), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
if (response == JOptionPane.YES_OPTION) {
model.blockFinancialPeriod(closedPeriodicEntryBook);
@@ -80,13 +80,13 @@
DialogHelper.showMessageDialog(eee.getMessage());
}
}
-
+
public FinancialPeriodView getView() {
return view;
}
-
+
public void refresh() {
- tableModel = (FinancialPeriodTableModel)getView().getFinancialPeriodTable().getModel();
+ tableModel = (FinancialPeriodTableModel) getView().getFinancialPeriodTable().getModel();
tableModel.refresh();
}
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartTreeTable.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartTreeTable.java 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartTreeTable.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -24,15 +24,15 @@
*/
package org.chorem.lima.ui.financialstatementchart;
+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;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jdesktop.swingx.JXTreeTable;
-
public class FinancialStatementChartTreeTable extends JXTreeTable
implements KeyListener, MouseListener {
@@ -42,15 +42,15 @@
/** log. */
private static final Log log = LogFactory
.getLog(FinancialStatementChartTreeTable.class);
-
+
protected FinancialStatementChartViewHandler handler;
-
+
public FinancialStatementChartTreeTable(FinancialStatementChartViewHandler handler) {
this.handler = handler;
-
+
addKeyListener(this);
addMouseListener(this);
-
+
}
@Override
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartTreeTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartTreeTableModel.java 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartTreeTableModel.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -25,9 +25,6 @@
package org.chorem.lima.ui.financialstatementchart;
-import static org.nuiton.i18n.I18n._;
-import java.util.List;
-import javax.swing.tree.TreePath;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.FinancialStatementServiceMonitorable;
@@ -37,35 +34,38 @@
import org.chorem.lima.service.LimaServiceFactory;
import org.jdesktop.swingx.treetable.AbstractTreeTableModel;
+import javax.swing.tree.TreePath;
+import java.util.List;
+
+import static org.nuiton.i18n.I18n._;
+
/**
* Tree table model for account edition.
- *
+ *
* @author ore
* @author chatellier
* @version $Revision$
- *
- * Last update : $Date$
- * By : $Author$
+ * <p/>
+ * Last update : $Date$
+ * By : $Author$
*/
public class FinancialStatementChartTreeTableModel extends AbstractTreeTableModel {
-
+
/** log. */
private static final Log log = LogFactory.getLog(FinancialStatementChartViewHandler.class);
-
+
/** Services. */
protected final FinancialStatementServiceMonitorable financialStatementService;
- /**
- * Model constructor. Init account service used here.
- */
+ /** Model constructor. Init account service used here. */
public FinancialStatementChartTreeTableModel() {
//create root for the tree
super(new FinancialStatementImpl());
// Gets factory service
financialStatementService =
- LimaServiceFactory.getInstance().getService(
- FinancialStatementServiceMonitorable.class);
- }
+ LimaServiceFactory.getInstance().getService(
+ FinancialStatementServiceMonitorable.class);
+ }
@Override
@@ -102,21 +102,20 @@
if (node == getRoot()) {
try {
result = financialStatementService.
- getChildrenFinancialStatement(null).size();
+ getChildrenFinancialStatement(null).size();
} catch (LimaException eee) {
log.debug("Can't count child", eee);
}
- }
- else {
- FinancialStatement parentFinancialStatementHeader =
+ } else {
+ FinancialStatement parentFinancialStatementHeader =
(FinancialStatement) node;
- try {
- result = financialStatementService.getChildrenFinancialStatement(
- parentFinancialStatementHeader).size();
- } catch (LimaException eee) {
- log.debug("Can't count child", eee);
- }
+ try {
+ result = financialStatementService.getChildrenFinancialStatement(
+ parentFinancialStatementHeader).size();
+ } catch (LimaException eee) {
+ log.debug("Can't count child", eee);
}
+ }
return result;
}
@@ -126,18 +125,17 @@
if (parent == getRoot()) {
try {
List<FinancialStatement> financialStatements =
- financialStatementService.getChildrenFinancialStatement(null);
+ financialStatementService.getChildrenFinancialStatement(null);
result = financialStatements.get(index);
} catch (LimaException eee) {
log.debug("Can't get child", eee);
}
- }
- else {
+ } else {
FinancialStatement parentFinancialStatement =
- (FinancialStatement) parent;
+ (FinancialStatement) parent;
try {
List<FinancialStatement> financialStatements = financialStatementService.
- getChildrenFinancialStatement(parentFinancialStatement);
+ getChildrenFinancialStatement(parentFinancialStatement);
result = financialStatements.get(index);
} catch (LimaException eee) {
log.debug("Can't get child", eee);
@@ -149,22 +147,21 @@
@Override
public int getIndexOfChild(Object parent, Object child) {
int result = 0;
-
+
if (parent == getRoot()) {
try {
List<FinancialStatement> financialStatements =
- financialStatementService.getChildrenFinancialStatement(null);
+ financialStatementService.getChildrenFinancialStatement(null);
result = financialStatements.indexOf(child);
} catch (LimaException eee) {
log.debug("Can't get index child", eee);
}
- }
- else {
+ } else {
FinancialStatement parentFinancialStatement =
- (FinancialStatement) parent;
+ (FinancialStatement) parent;
try {
List<FinancialStatement> financialStatements = financialStatementService.
- getChildrenFinancialStatement(parentFinancialStatement);
+ getChildrenFinancialStatement(parentFinancialStatement);
result = financialStatements.indexOf(child);
} catch (LimaException eee) {
log.debug("Can't get index child", eee);
@@ -172,28 +169,28 @@
}
return result;
}
-
+
@Override
public Object getValueAt(Object node, int column) {
Object result = "n/a";
- FinancialStatement financialStatement = (FinancialStatement) node;
- switch (column) {
- case 0:
- result = financialStatement.getLabel();
- break;
- case 1:
- result = financialStatement.getAccounts();
- break;
- case 2:
- result = financialStatement.getDebitAccounts();
- break;
- case 3:
- result = financialStatement.getCreditAccounts();
- break;
- case 4:
- result = financialStatement.getProvisionDeprecationAccounts();
- break;
- }
+ FinancialStatement financialStatement = (FinancialStatement) node;
+ switch (column) {
+ case 0:
+ result = financialStatement.getLabel();
+ break;
+ case 1:
+ result = financialStatement.getAccounts();
+ break;
+ case 2:
+ result = financialStatement.getDebitAccounts();
+ break;
+ case 3:
+ result = financialStatement.getCreditAccounts();
+ break;
+ case 4:
+ result = financialStatement.getProvisionDeprecationAccounts();
+ break;
+ }
return result;
}
@@ -207,20 +204,17 @@
return getChildCount(node) == 0;
}
-
- /**
- * Refresh FinancialStatementChart.
- *
- */
+
+ /** Refresh FinancialStatementChart. */
public void refreshTree() throws LimaException {
modelSupport.fireNewRoot();
}
-
-
+
+
/**
* Add FinancialStatement(path can be null).
- *
+ *
* @param path
* @param account
* @throws LimaException
@@ -228,7 +222,7 @@
public void addFinancialStatement(TreePath path, FinancialStatement financialStatement) throws LimaException {
// Calling account service
FinancialStatement parentFinancialStatementHeader =
- (FinancialStatement) path.getLastPathComponent();
+ (FinancialStatement) path.getLastPathComponent();
if (parentFinancialStatementHeader == getRoot()) {
parentFinancialStatementHeader = null;
}
@@ -237,10 +231,10 @@
modelSupport.fireTreeStructureChanged(path);
}
-
+
/**
* Update financialStatement
- *
+ *
* @param path
* @param account
* @throws LimaException
@@ -250,11 +244,11 @@
financialStatementService.updateFinancialStatement(financialStatement);
modelSupport.fireTreeStructureChanged(path);
}
-
-
+
+
/**
* Remove financialStatement
- *
+ *
* @param path
* @param object
* @throws LimaException
@@ -263,7 +257,7 @@
// Calling account service
int index = getIndexOfChild(
path.getParentPath().getLastPathComponent(), financialStatement);
- financialStatementService.removeFinancialStatement(financialStatement);
+ financialStatementService.removeFinancialStatement(financialStatement);
modelSupport.fireChildRemoved(path.getParentPath(), index, financialStatement);
}
}
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 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartViewHandler.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -25,10 +25,6 @@
package org.chorem.lima.ui.financialstatementchart;
-import static org.nuiton.i18n.I18n._;
-
-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.FinancialStatementServiceMonitorable;
@@ -46,14 +42,19 @@
import org.chorem.lima.util.ErrorHelper;
import org.jdesktop.swingx.JXTreeTable;
+import javax.swing.JOptionPane;
+import javax.swing.tree.TreePath;
+
+import static org.nuiton.i18n.I18n._;
+
/**
* Handler associated with account view.
- *
+ *
* @author chatellier
* @version $Revision$
- *
- * Last update : $Date$
- * By : $Author$
+ * <p/>
+ * Last update : $Date$
+ * By : $Author$
*/
public class FinancialStatementChartViewHandler implements ServiceListener {
@@ -61,37 +62,35 @@
private static final Log log = LogFactory.getLog(FinancialStatementChartViewHandler.class);
protected FinancialStatementServiceMonitorable financialStatementService;
-
+
protected FinancialStatementChartView view;
-
+
protected FinancialStatementChartViewHandler(FinancialStatementChartView view) {
this.view = view;
-
+
financialStatementService =
- LimaServiceFactory.getInstance().getService(
- FinancialStatementServiceMonitorable.class);
+ LimaServiceFactory.getInstance().getService(
+ FinancialStatementServiceMonitorable.class);
LimaServiceFactory.getInstance().getService(
ImportServiceMonitorable.class).addServiceListener(this);
}
- /**
- * Add new account with account form.
- */
+ /** Add new account with account form. */
public void addFinancialStatementHeader() {
JXTreeTable treeTable = view.getTreeTable();
FinancialStatementChartTreeTableModel treeTableModel =
- (FinancialStatementChartTreeTableModel) treeTable.getTreeTableModel();
+ (FinancialStatementChartTreeTableModel) treeTable.getTreeTableModel();
FinancialStatement newFinancialStatementHeader =
- new FinancialStatementImpl();
+ new FinancialStatementImpl();
FinancialStatementHeaderForm financialStatementHeaderForm =
- new FinancialStatementHeaderForm(view);
+ new FinancialStatementHeaderForm(view);
financialStatementHeaderForm.setFinancialStatement(newFinancialStatementHeader);
// jaxx constructor don't call super() ?
financialStatementHeaderForm.setLocationRelativeTo(view);
financialStatementHeaderForm.setVisible(true);
-
+
// null == cancel action
newFinancialStatementHeader = financialStatementHeaderForm.getFinancialStatement();
if (newFinancialStatementHeader != null) {
@@ -99,12 +98,12 @@
// get current selection path
TreePath treePath;
int selectedRow = treeTable.getSelectedRow();
- if ( selectedRow != -1) {
+ if (selectedRow != -1) {
treePath = treeTable.getPathForRow(selectedRow);
} else {
treePath = new TreePath(treeTableModel.getRoot());
}
-
+
// add it
try {
treeTableModel.addFinancialStatement(treePath, newFinancialStatementHeader);
@@ -114,57 +113,55 @@
}
DialogHelper.showMessageDialog(eee.getMessage());
- }
-
- catch (LimaException ex) {
+ } catch (LimaException ex) {
if (log.isErrorEnabled()) {
log.error("Can't add financialStatementHeader", ex);
}
ErrorHelper.showErrorDialog(_("lima.financialstatement.addfinancialStatementHeadererror"), ex);
}
}
- };
-
- public void addFinancialStatementMovement(){
+ }
- JXTreeTable treeTable = view.getTreeTable();
- FinancialStatementChartTreeTableModel treeTableModel =
- (FinancialStatementChartTreeTableModel) treeTable.getTreeTableModel();
+ ;
+ public void addFinancialStatementMovement() {
+
+ JXTreeTable treeTable = view.getTreeTable();
+ FinancialStatementChartTreeTableModel treeTableModel =
+ (FinancialStatementChartTreeTableModel) treeTable.getTreeTableModel();
+
FinancialStatement newFinancialStatementMovement =
- new FinancialStatementImpl();
+ new FinancialStatementImpl();
FinancialStatementMovementForm financialStatementMovementForm =
- new FinancialStatementMovementForm(view);
+ new FinancialStatementMovementForm(view);
financialStatementMovementForm.setFinancialStatement(newFinancialStatementMovement);
- // jaxx constructor don't call super() ?
+ // jaxx constructor don't call super() ?
financialStatementMovementForm.setLocationRelativeTo(view);
financialStatementMovementForm.setVisible(true);
- newFinancialStatementMovement=financialStatementMovementForm.getFinancialStatement();
-
- // null == cancel action
- if (newFinancialStatementMovement != null) {
- // get current selection path
- TreePath treePath;
- int selectedRow = view.treeTable.getSelectedRow();
- treePath = view.treeTable.getPathForRow(selectedRow);
- // add it
- try {
- treeTableModel.
- addFinancialStatement(treePath, newFinancialStatementMovement);
- } catch (LimaBusinessException eee) {
- if (log.isErrorEnabled()) {
- log.error("Can't add FinancialStatementMovement", eee);
- }
- DialogHelper.showMessageDialog(eee.getMessage());
- }
-
- catch (LimaException eee) {
- if (log.isErrorEnabled()) {
- log.error("Can't add FinancialStatementMovement", eee);
- }
- DialogHelper.showMessageDialog(eee.getMessage());
- }
- }
+ newFinancialStatementMovement = financialStatementMovementForm.getFinancialStatement();
+
+ // null == cancel action
+ if (newFinancialStatementMovement != null) {
+ // get current selection path
+ TreePath treePath;
+ int selectedRow = view.treeTable.getSelectedRow();
+ treePath = view.treeTable.getPathForRow(selectedRow);
+ // add it
+ try {
+ treeTableModel.
+ addFinancialStatement(treePath, newFinancialStatementMovement);
+ } catch (LimaBusinessException eee) {
+ if (log.isErrorEnabled()) {
+ log.error("Can't add FinancialStatementMovement", eee);
+ }
+ DialogHelper.showMessageDialog(eee.getMessage());
+ } catch (LimaException eee) {
+ if (log.isErrorEnabled()) {
+ log.error("Can't add FinancialStatementMovement", eee);
+ }
+ DialogHelper.showMessageDialog(eee.getMessage());
+ }
+ }
}
/**
@@ -172,50 +169,50 @@
* Verifiy if it's an account or a subledger
*/
public void updateFinancialStatement() {
-
- JXTreeTable treeTable = view.getTreeTable();
- FinancialStatementChartTreeTableModel treeTableModel =
- (FinancialStatementChartTreeTableModel) treeTable.getTreeTableModel();
+ JXTreeTable treeTable = view.getTreeTable();
+ FinancialStatementChartTreeTableModel treeTableModel =
+ (FinancialStatementChartTreeTableModel) treeTable.getTreeTableModel();
+
// get selected account
int selectedRow = view.treeTable.getSelectedRow();
TreePath treePath = view.treeTable.getPathForRow(selectedRow); // not null
FinancialStatement financialStatement =
- (FinancialStatement) treePath.getLastPathComponent();
+ (FinancialStatement) treePath.getLastPathComponent();
//update Account or update SubLedger
if (financialStatement != null) {
// get current selection path
- if ( selectedRow != -1) {
+ if (selectedRow != -1) {
treePath = view.treeTable.getPathForRow(selectedRow);
} else {
treePath = new TreePath(treeTableModel.getRoot());
}
//test if selectedrow is account or ledger
log.debug(financialStatement.getHeader());
- if (financialStatement.getHeader()){
+ if (financialStatement.getHeader()) {
FinancialStatementHeaderForm financialStatementHeaderForm =
- new FinancialStatementHeaderForm(view);
+ new FinancialStatementHeaderForm(view);
financialStatementHeaderForm.setFinancialStatement(financialStatement);
// jaxx constructor don't call super() ?
financialStatementHeaderForm.setLocationRelativeTo(view);
financialStatementHeaderForm.setVisible(true);
// null == cancel action
financialStatement = financialStatementHeaderForm.getFinancialStatement();
- }
+ }
// else is a movement
- else{
+ else {
FinancialStatementMovementForm financialStatementMovementForm =
- new FinancialStatementMovementForm(view);
+ new FinancialStatementMovementForm(view);
financialStatementMovementForm.setFinancialStatement(financialStatement);
// jaxx constructor don't call super() ?
financialStatementMovementForm.setLocationRelativeTo(view);
financialStatementMovementForm.setVisible(true);
// null == cancel action
financialStatement =
- financialStatementMovementForm.getFinancialStatement();
+ financialStatementMovementForm.getFinancialStatement();
}
//if action confirmed
- if (financialStatement != null){
+ if (financialStatement != null) {
// update it
try {
treeTableModel.updateFinancialStatement(
@@ -230,29 +227,27 @@
}
}
- /**
- * Ask for user to remove for selected account, and remove it if confirmed.
- */
+ /** Ask for user to remove for selected account, and remove it if confirmed. */
public void removeFinancialStatement() {
- JXTreeTable treeTable = view.getTreeTable();
- FinancialStatementChartTreeTableModel treeTableModel =
- (FinancialStatementChartTreeTableModel) treeTable.getTreeTableModel();
+ JXTreeTable treeTable = view.getTreeTable();
+ FinancialStatementChartTreeTableModel treeTableModel =
+ (FinancialStatementChartTreeTableModel) treeTable.getTreeTableModel();
// Any row selected
int selectedRow = view.treeTable.getSelectedRow();
- if ( selectedRow != -1) {
+ if (selectedRow != -1) {
int n = JOptionPane.showConfirmDialog(view,
- _("lima.charts.account.question.remove"),
- _("lima.common.confirmation"),
- JOptionPane.YES_NO_OPTION,
- JOptionPane.QUESTION_MESSAGE);
+ _("lima.charts.account.question.remove"),
+ _("lima.common.confirmation"),
+ JOptionPane.YES_NO_OPTION,
+ JOptionPane.QUESTION_MESSAGE);
if (n == JOptionPane.YES_OPTION) {
// update view of treetable
TreePath treePath = view.treeTable.getPathForRow(selectedRow);
FinancialStatement financialStatement =
- (FinancialStatement) treePath.getLastPathComponent();
+ (FinancialStatement) treePath.getLastPathComponent();
- try{
+ try {
treeTableModel.removeFinancialStatementObject(
treePath, financialStatement);
} catch (LimaException eee) {
@@ -264,70 +259,70 @@
}
}
}
-
- public void refresh(){
- JXTreeTable treeTable = view.getTreeTable();
- FinancialStatementChartTreeTableModel treeTableModel =
- (FinancialStatementChartTreeTableModel) treeTable.getTreeTableModel();
- try {
+
+ public void refresh() {
+ JXTreeTable treeTable = view.getTreeTable();
+ FinancialStatementChartTreeTableModel treeTableModel =
+ (FinancialStatementChartTreeTableModel) treeTable.getTreeTableModel();
+ try {
treeTableModel.refreshTree();
} catch (LimaException eee) {
- if(log.isDebugEnabled()){
+ if (log.isDebugEnabled()) {
log.debug("Can't refresh model", eee);
}
}
//refresh view
view.repaint();
}
-
- public void importFinancialStatementChart(){
+
+ public void importFinancialStatementChart() {
FinancialStatementImportForm form =
- new FinancialStatementImportForm();
+ new FinancialStatementImportForm();
form.setLocationRelativeTo(view);
form.setVisible(true);
Object value = form.getRadioButtons().getSelectedValue();
// if action confirmed
- if (value != null){
- if (form.getDeleteFinancialStatementChart().isSelected()){
+ if (value != null) {
+ if (form.getDeleteFinancialStatementChart().isSelected()) {
try {
financialStatementService.removeAllFinancialStatement();
-
+
} catch (LimaException eee) {
- if (log.isDebugEnabled()){
+ if (log.isDebugEnabled()) {
log.debug("Can't delete financial statement chart", eee);
}
}
}
- FinancialStatementsChartEnum defaultFinancialStatementsEnum =
- (FinancialStatementsChartEnum) value;
+ FinancialStatementsChartEnum defaultFinancialStatementsEnum =
+ (FinancialStatementsChartEnum) value;
ImportExport importExport = ImportExport.getInstance(view);
importExport.importExport(ImportExportEnum.CSV_FINANCIALSTATEMENTS_IMPORT,
- defaultFinancialStatementsEnum.getFilePath(), true);
+ defaultFinancialStatementsEnum.getFilePath(), true);
}
}
-
-
- public void financialStatementChartCheck(){
+
+
+ public void financialStatementChartCheck() {
String result;
try {
result = financialStatementService.checkFinancialStatementChart();
DialogHelper.showReportDialog(result, _("lima.financialstatement.check"), view);
} catch (LimaException e) {
- log.error("Can't check financialstatement chart",e);
+ log.error("Can't check financialstatement chart", e);
}
}
-
+
@Override
public void notifyMethod(String serviceName, String methodName) {
-
+
if (methodName.contains("FinancialStatements")
- || methodName.contains("importAll")
- || methodName.contains("importAs")){
+ || methodName.contains("importAll")
+ || methodName.contains("importAs")) {
refresh();
}
}
-
+
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementImportForm.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementImportForm.jaxx 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementImportForm.jaxx 2011-09-17 14:17:04 UTC (rev 3293)
@@ -31,7 +31,7 @@
jaxx.runtime.swing.JAXXButtonGroup
org.chorem.lima.enums.FinancialStatementsChartEnum
</import>
-
+
<JAXXButtonGroup id="radioButtons" javaBean='new JAXXButtonGroup()'/>
<Boolean id="addState" javaBean='true'/>
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementDocument.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementDocument.java 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementDocument.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -31,8 +31,7 @@
public class FinancialStatementDocument {
private static final Log log =
- LogFactory.getLog(FinancialStatementReportTable.class);
-
-
-
+ LogFactory.getLog(FinancialStatementReportTable.class);
+
+
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportPeriodSearchPanel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportPeriodSearchPanel.java 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportPeriodSearchPanel.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -25,14 +25,6 @@
package org.chorem.lima.ui.financialstatementreport;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.util.Calendar;
-import java.util.Date;
-import static org.nuiton.i18n.I18n._;
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
import org.apache.commons.lang.time.DateUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -40,120 +32,130 @@
import org.chorem.lima.entity.FiscalPeriod;
import org.chorem.lima.enums.ComboBoxDatesEnum;
import org.chorem.lima.ui.combobox.FinancialPeriodComboBoxModel;
-import org.chorem.lima.ui.combobox.FinancialPeriodComboBoxRenderer;
import org.chorem.lima.ui.combobox.FiscalPeriodComboBoxModel;
-import org.chorem.lima.ui.combobox.FiscalPeriodComboBoxRenderer;
+import org.chorem.lima.ui.renderers.RendererUtil;
import org.jdesktop.swingx.JXDatePicker;
+import javax.swing.JComboBox;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.ListCellRenderer;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.Calendar;
+import java.util.Date;
+
+import static org.nuiton.i18n.I18n._;
+
public class FinancialStatementReportPeriodSearchPanel extends JPanel {
-
+
private static final Log log =
- LogFactory.getLog(FinancialStatementReportPeriodSearchPanel.class);
-
+ LogFactory.getLog(FinancialStatementReportPeriodSearchPanel.class);
+
protected FinancialStatementReportTableModel model;
-
+
public FinancialStatementReportPeriodSearchPanel(FinancialStatementReportTableModel model) {
this.model = model;
-
+
//init date
refresh(ComboBoxDatesEnum.FISCAL_PERIOD);
}
-
- static final long serialVersionUID = 1L;
- public void refresh(ComboBoxDatesEnum comboBoxPeriodEnum){
-
+ public void refresh(ComboBoxDatesEnum comboBoxPeriodEnum) {
+
switch (comboBoxPeriodEnum) {
- case PERIOD:
- // get begin date
- Calendar calendarBegin = Calendar.getInstance();
- // set begindate to JAN 1 - 0:00.000 of this years
- Date beginDate = calendarBegin.getTime();
- beginDate = DateUtils.truncate(beginDate, Calendar.YEAR);
- //handler().setBeginDate(beginDate);
-
- // get end date
- Calendar calendarEnd = Calendar.getInstance();
- Date endDate = calendarEnd.getTime();
- //handler().setEndDate(endDate);
- JLabel beginDateLabel = new JLabel(_("lima.common.begindate"));
- final JXDatePicker beginDatePicker = new JXDatePicker(beginDate);
- ActionListener beginDateActionListener = new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- model.setBeginDate(beginDatePicker.getDate());
- model.refresh();
- }
- };
- model.setBeginDate(beginDatePicker.getDate());
- beginDatePicker.addActionListener(beginDateActionListener);
-
- JLabel endDateLabel = new JLabel(_("lima.common.enddate"));
- final JXDatePicker endDatePicker = new JXDatePicker(endDate);
- ActionListener endDateActionListener = new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- model.setEndDate(endDatePicker.getDate());
- model.refresh();
- }
- };
- model.setEndDate(endDatePicker.getDate());
- endDatePicker.addActionListener(endDateActionListener);
- model.refresh();
+ case PERIOD:
+ // get begin date
+ Calendar calendarBegin = Calendar.getInstance();
+ // set begindate to JAN 1 - 0:00.000 of this years
+ Date beginDate = calendarBegin.getTime();
+ beginDate = DateUtils.truncate(beginDate, Calendar.YEAR);
+ //handler().setBeginDate(beginDate);
- removeAll();
- add(beginDateLabel);
- add(beginDatePicker);
- add(endDateLabel);
- add(endDatePicker);
- break;
-
- case FISCAL_PERIOD:
- FiscalPeriodComboBoxModel fiscalModel = new FiscalPeriodComboBoxModel(true);
- FiscalPeriodComboBoxRenderer fiscalRenderer = new FiscalPeriodComboBoxRenderer();
- final JComboBox fiscalPeriod = new JComboBox(fiscalModel);
- fiscalPeriod.setRenderer(fiscalRenderer);
- fiscalPeriod.setEditable(false);
- ActionListener fiscalPeriodActionListener = new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- FiscalPeriod fPeriod = (FiscalPeriod) fiscalPeriod.getSelectedItem();
- if (fPeriod != null){
- model.setBeginDate(fPeriod.getBeginDate());
- model.setEndDate(fPeriod.getEndDate());
- model.refresh();
+ // get end date
+ Calendar calendarEnd = Calendar.getInstance();
+ Date endDate = calendarEnd.getTime();
+ //handler().setEndDate(endDate);
+ JLabel beginDateLabel = new JLabel(_("lima.common.begindate"));
+ final JXDatePicker beginDatePicker = new JXDatePicker(beginDate);
+ ActionListener beginDateActionListener = new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ model.setBeginDate(beginDatePicker.getDate());
+ model.refresh();
}
- }
- };
- fiscalPeriod.addActionListener(fiscalPeriodActionListener);
+ };
+ model.setBeginDate(beginDatePicker.getDate());
+ beginDatePicker.addActionListener(beginDateActionListener);
- removeAll();
- add(fiscalPeriod);
- break;
-
- case FINANCIAL_PERIOD:
- FinancialPeriodComboBoxModel financialModel = new FinancialPeriodComboBoxModel(true);
- FinancialPeriodComboBoxRenderer financialRenderer = new FinancialPeriodComboBoxRenderer();
- final JComboBox financialPeriod = new JComboBox(financialModel);
- financialPeriod.setRenderer(financialRenderer);
- financialPeriod.setEditable(false);
- ActionListener financialPeriodActionListener = new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- FinancialPeriod fPeriod = (FinancialPeriod) financialPeriod.getSelectedItem();
- if (fPeriod !=null){
- model.setBeginDate(fPeriod.getBeginDate());
- model.setEndDate(fPeriod.getEndDate());
- model.refresh();
+ JLabel endDateLabel = new JLabel(_("lima.common.enddate"));
+ final JXDatePicker endDatePicker = new JXDatePicker(endDate);
+ ActionListener endDateActionListener = new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ model.setEndDate(endDatePicker.getDate());
+ model.refresh();
}
- }
- };
- financialPeriod.addActionListener(financialPeriodActionListener);
- removeAll();
- add(financialPeriod);
- break;
+ };
+ model.setEndDate(endDatePicker.getDate());
+ endDatePicker.addActionListener(endDateActionListener);
+ model.refresh();
+
+ removeAll();
+ add(beginDateLabel);
+ add(beginDatePicker);
+ add(endDateLabel);
+ add(endDatePicker);
+ break;
+
+ case FISCAL_PERIOD:
+ FiscalPeriodComboBoxModel fiscalModel = new FiscalPeriodComboBoxModel(true);
+ ListCellRenderer renderer =
+ RendererUtil.newDecoratorListCellRenderer(FiscalPeriod.class);
+ final JComboBox fiscalPeriod = new JComboBox(fiscalModel);
+ fiscalPeriod.setRenderer(renderer);
+ fiscalPeriod.setEditable(false);
+ ActionListener fiscalPeriodActionListener = new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ FiscalPeriod fPeriod = (FiscalPeriod) fiscalPeriod.getSelectedItem();
+ if (fPeriod != null) {
+ model.setBeginDate(fPeriod.getBeginDate());
+ model.setEndDate(fPeriod.getEndDate());
+ model.refresh();
+ }
+ }
+ };
+ fiscalPeriod.addActionListener(fiscalPeriodActionListener);
+
+ removeAll();
+ add(fiscalPeriod);
+ break;
+
+ case FINANCIAL_PERIOD:
+ FinancialPeriodComboBoxModel financialModel = new FinancialPeriodComboBoxModel(true);
+ renderer =
+ RendererUtil.newDecoratorListCellRenderer(FinancialPeriod.class);
+ final JComboBox financialPeriod = new JComboBox(financialModel);
+ financialPeriod.setRenderer(renderer);
+ financialPeriod.setEditable(false);
+ ActionListener financialPeriodActionListener = new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ FinancialPeriod fPeriod = (FinancialPeriod) financialPeriod.getSelectedItem();
+ if (fPeriod != null) {
+ model.setBeginDate(fPeriod.getBeginDate());
+ model.setEndDate(fPeriod.getEndDate());
+ model.refresh();
+ }
+ }
+ };
+ financialPeriod.addActionListener(financialPeriodActionListener);
+ removeAll();
+ add(financialPeriod);
+ break;
}
-
+
}
-
+
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTable.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTable.java 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTable.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -25,6 +25,13 @@
package org.chorem.lima.ui.financialstatementreport;
+import org.chorem.lima.beans.FinancialStatementAmounts;
+import org.jdesktop.swingx.JXTable;
+import org.jdesktop.swingx.decorator.ColorHighlighter;
+import org.jdesktop.swingx.decorator.ComponentAdapter;
+import org.jdesktop.swingx.decorator.HighlightPredicate;
+import org.jdesktop.swingx.decorator.Highlighter;
+
import java.awt.Color;
import java.awt.Component;
import java.awt.event.KeyEvent;
@@ -32,41 +39,34 @@
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
-import org.chorem.lima.beans.FinancialStatementAmounts;
-import org.jdesktop.swingx.JXTable;
-import org.jdesktop.swingx.decorator.ColorHighlighter;
-import org.jdesktop.swingx.decorator.ComponentAdapter;
-import org.jdesktop.swingx.decorator.HighlightPredicate;
-import org.jdesktop.swingx.decorator.Highlighter;
-
public class FinancialStatementReportTable extends JXTable
implements KeyListener, MouseListener {
-
+
private static final long serialVersionUID = 154211277688304679L;
protected FinancialStatementReportViewHandler handler;
-
+
protected FinancialStatementReportTableModel model;
-
+
private Highlighter colorTransaction;
-
+
/*
- * Constructor, call highlighter
- */
+ * Constructor, call highlighter
+ */
public FinancialStatementReportTable(FinancialStatementReportViewHandler handler) {
super(handler.getView().modelTable);
this.handler = handler;
-
+
addKeyListener(this);
addMouseListener(this);
-
+
model = this.handler.getView().modelTable;
//highlight financial financial transactions
colorTitle1();
colorTitle2();
-
+
//Renderer for font
FinancialStatementReportTableCellRenderer renderer = new FinancialStatementReportTableCellRenderer();
for (int i = 0; i < getColumnModel().getColumnCount(); i++) {
@@ -78,49 +78,49 @@
* Color the background row in grey if the level is 1
*/
protected void colorTitle1() {
-
-
- HighlightPredicate predicate = new HighlightPredicate() {
+
+
+ HighlightPredicate predicate = new HighlightPredicate() {
@Override
public boolean isHighlighted(Component renderer,
- ComponentAdapter adapter) {
+ ComponentAdapter adapter) {
Boolean result = false;
Object object = model.getElementAt(adapter.row);
- if (model.getElementAt(adapter.row) instanceof FinancialStatementAmounts){
+ if (model.getElementAt(adapter.row) instanceof FinancialStatementAmounts) {
FinancialStatementAmounts financialStatementAmounts = (FinancialStatementAmounts) object;
result = financialStatementAmounts.getLevel() == 1;
}
return result;
}
};
- colorTransaction =
- new ColorHighlighter(predicate, new Color(222,222,222), null);
- addHighlighter(colorTransaction);
- }
-
+ colorTransaction =
+ new ColorHighlighter(predicate, new Color(222, 222, 222), null);
+ addHighlighter(colorTransaction);
+ }
+
/*
- * Color the background in light grey if is a subamount
- */
+ * Color the background in light grey if is a subamount
+ */
protected void colorTitle2() {
-
-
+
+
HighlightPredicate predicate = new HighlightPredicate() {
- @Override
- public boolean isHighlighted(Component renderer,
- ComponentAdapter adapter) {
- Boolean result = false;
- Object object = model.getElementAt(adapter.row);
- if (model.getElementAt(adapter.row) instanceof FinancialStatementAmounts){
- FinancialStatementAmounts financialStatementAmounts = (FinancialStatementAmounts) object;
- result = financialStatementAmounts.getSubAmount();
- }
- return result;
- }
- };
- colorTransaction =
- new ColorHighlighter(predicate, new Color(244,244,244), null);
- addHighlighter(colorTransaction);
- }
+ @Override
+ public boolean isHighlighted(Component renderer,
+ ComponentAdapter adapter) {
+ Boolean result = false;
+ Object object = model.getElementAt(adapter.row);
+ if (model.getElementAt(adapter.row) instanceof FinancialStatementAmounts) {
+ FinancialStatementAmounts financialStatementAmounts = (FinancialStatementAmounts) object;
+ result = financialStatementAmounts.getSubAmount();
+ }
+ return result;
+ }
+ };
+ colorTransaction =
+ new ColorHighlighter(predicate, new Color(244, 244, 244), null);
+ addHighlighter(colorTransaction);
+ }
@Override
public void mouseClicked(MouseEvent e) {
@@ -157,9 +157,9 @@
public void keyPressed(KeyEvent e) {
// clear row selection with the key: escape
if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
- if (!isEditing()) {
+ if (!isEditing()) {
clearSelection();
- }
+ }
}
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableCellRenderer.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableCellRenderer.java 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableCellRenderer.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -25,23 +25,23 @@
package org.chorem.lima.ui.financialstatementreport;
+import org.chorem.lima.LimaConfig;
+import org.chorem.lima.LimaContext;
+import org.chorem.lima.beans.FinancialStatementAmounts;
+
+import javax.swing.JTable;
+import javax.swing.SwingConstants;
+import javax.swing.table.DefaultTableCellRenderer;
import java.awt.Component;
import java.awt.Font;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
-import javax.swing.JTable;
-import javax.swing.SwingConstants;
-import javax.swing.table.DefaultTableCellRenderer;
-import org.chorem.lima.LimaConfig;
-import org.chorem.lima.LimaContext;
-import org.chorem.lima.beans.FinancialStatementAmounts;
-
-
/**
* Permet de modifier l'apparence du tableau pour le bilan à l'actif
+ *
* @author Rémi Chapelet
*/
@@ -51,37 +51,34 @@
@Override
public Component getTableCellRendererComponent(JTable table, Object value,
- boolean isSelected, boolean hasFocus, int row, int column)
- {
+ boolean isSelected, boolean hasFocus, int row, int column) {
// Get table
FinancialStatementReportTableModel financialStatementReportTableModel = (FinancialStatementReportTableModel) table.getModel();
-
+
// Récupère le bilan de la ligne
Object object = financialStatementReportTableModel.getElementAt(row);
Component cell = super.getTableCellRendererComponent(
table, value, isSelected, hasFocus, row, column);
-
+
// Si le bilan est un soustotal, alors la ligne est en gras
- if (object instanceof FinancialStatementAmounts){
+ if (object instanceof FinancialStatementAmounts) {
FinancialStatementAmounts financialStatementAmounts = (FinancialStatementAmounts) object;
-
- if (financialStatementAmounts.getLevel() == 1)
- {
+
+ if (financialStatementAmounts.getLevel() == 1) {
setFont(new Font("Verdana", Font.BOLD, 14));
}
- if (financialStatementAmounts.getHeader())
- {
+ if (financialStatementAmounts.getHeader()) {
setFont(new Font("Verdana", Font.BOLD, 12));
}
- if (!financialStatementAmounts.getHeader() && !financialStatementAmounts.getSubAmount()){
- if (column == 0){
+ if (!financialStatementAmounts.getHeader() && !financialStatementAmounts.getSubAmount()) {
+ if (column == 0) {
cell.setFont(new Font("Verdana", Font.ITALIC, 12));
}
}
}
-
+
if (object instanceof BigDecimal) {
setHorizontalAlignment(SwingConstants.LEFT);
setValue(value);
@@ -89,7 +86,7 @@
return this;
}
-
+
public void setValue(Object aValue) {
Object result = aValue;
if (aValue != null && aValue instanceof BigDecimal) {
@@ -106,7 +103,7 @@
formatter.setGroupingUsed(true);
formatter.setGroupingSize(3);
result = formatter.format(result);
- }
+ }
super.setValue(result);
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableModel.java 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableModel.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -25,17 +25,6 @@
package org.chorem.lima.ui.financialstatementreport;
-import static org.nuiton.i18n.I18n._;
-
-import java.awt.Desktop;
-import java.io.IOException;
-import java.math.BigDecimal;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.List;
-import javax.swing.table.AbstractTableModel;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.LimaConfig;
@@ -52,15 +41,27 @@
import org.chorem.lima.service.LimaServiceFactory;
import org.chorem.lima.util.ErrorHelper;
+import javax.swing.table.AbstractTableModel;
+import java.awt.Desktop;
+import java.io.IOException;
+import java.math.BigDecimal;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
+
+import static org.nuiton.i18n.I18n._;
+
/**
* Entry book table model.
- *
+ *
* @author ore
* @author chatellier
* @version $Revision$
- *
- * Last update : $Date$
- * By : $Author$
+ * <p/>
+ * Last update : $Date$
+ * By : $Author$
*/
public class FinancialStatementReportTableModel extends AbstractTableModel implements ServiceListener {
@@ -72,30 +73,29 @@
/** Services. */
protected FinancialStatementServiceMonitorable financialStatementService;
+
protected DocumentServiceMonitorable documentService;
-
+
/** DatePicker Begin Date. */
protected Date selectedBeginDate;
-
+
/** DatePicker EndDate. */
protected Date selectedEndDate;
-
+
protected int port;
-
+
private static SimpleDateFormat dateFormat =
- new SimpleDateFormat("yyyy-MM-dd");
-
+ new SimpleDateFormat("yyyy-MM-dd");
+
/** data cache */
protected List<FinancialStatementAmounts> cacheDataList;
-
- /**
- * Constructor.
- */
+
+ /** Constructor. */
public FinancialStatementReportTableModel() {
financialStatementService =
- LimaServiceFactory.getInstance().getService(
- FinancialStatementServiceMonitorable.class);
-
+ LimaServiceFactory.getInstance().getService(
+ FinancialStatementServiceMonitorable.class);
+
financialStatementService.addServiceListener(this);
port = LimaServiceFactory.getInstance().getService(
HttpServerServiceMonitorable.class).getHttpPort();
@@ -109,8 +109,8 @@
@Override
public int getRowCount() {
int result = 0;
- if (cacheDataList != null){
- result = cacheDataList.size();
+ if (cacheDataList != null) {
+ result = cacheDataList.size();
}
return result;
}
@@ -119,25 +119,25 @@
public int getColumnCount() {
return 4;
}
-
+
@Override
public Class<?> getColumnClass(int column) {
Class<?> result = null;
switch (column) {
- case 0:
- result = String.class;
- break;
- case 1:
- result = BigDecimal.class;
- break;
- case 2:
- result = BigDecimal.class;
- break;
- case 3:
- result = BigDecimal.class;
- break;
+ case 0:
+ result = String.class;
+ break;
+ case 1:
+ result = BigDecimal.class;
+ break;
+ case 2:
+ result = BigDecimal.class;
+ break;
+ case 3:
+ result = BigDecimal.class;
+ break;
}
return result;
@@ -163,12 +163,12 @@
return res;
}
- public Object getElementAt(int row){
-
+ public Object getElementAt(int row) {
+
Object currentRow = cacheDataList.get(row);
return currentRow;
}
-
+
@Override
public Object getValueAt(int row, int column) {
Object result = cacheDataList.get(row);
@@ -176,50 +176,47 @@
if (result instanceof FinancialStatementAmounts) {
FinancialStatementAmounts currentRow = (FinancialStatementAmounts) result;
BigDecimal grossAmount = currentRow.getGrossAmount();
- if (grossAmount == null ){
+ if (grossAmount == null) {
grossAmount = BigDecimal.ZERO;
}
-
+
BigDecimal provisionDeprecationAmount = currentRow.getProvisionDeprecationAmount();
- if (provisionDeprecationAmount == null ){
+ if (provisionDeprecationAmount == null) {
provisionDeprecationAmount = BigDecimal.ZERO;
}
switch (column) {
- case 0:
- result = "";
- String label = currentRow.getLabel();
- if ( label != null){
- for (int i = 0; i <= currentRow.getLevel(); i++) {
- result = result+"\t";
+ case 0:
+ result = "";
+ String label = currentRow.getLabel();
+ if (label != null) {
+ for (int i = 0; i <= currentRow.getLevel(); i++) {
+ result = result + "\t";
+ }
+ result = result + label;
}
- result = result+label;
- }
- break;
- case 1:
- if (grossAmount.compareTo(BigDecimal.ZERO) == 0){
- result = null;
- }
- else {
- result = grossAmount;
- }
- break;
- case 2:
- if (provisionDeprecationAmount.compareTo(BigDecimal.ZERO) == 0){
- result = null;
- }
- else {
- result = provisionDeprecationAmount;
- }
- break;
- case 3:
- BigDecimal solde = grossAmount.subtract(provisionDeprecationAmount);
- if (solde.compareTo(BigDecimal.ZERO) == 0) {
- result = null;
- }
- else {
- result = solde;
- }
- break;
+ break;
+ case 1:
+ if (grossAmount.compareTo(BigDecimal.ZERO) == 0) {
+ result = null;
+ } else {
+ result = grossAmount;
+ }
+ break;
+ case 2:
+ if (provisionDeprecationAmount.compareTo(BigDecimal.ZERO) == 0) {
+ result = null;
+ } else {
+ result = provisionDeprecationAmount;
+ }
+ break;
+ case 3:
+ BigDecimal solde = grossAmount.subtract(provisionDeprecationAmount);
+ if (solde.compareTo(BigDecimal.ZERO) == 0) {
+ result = null;
+ } else {
+ result = solde;
+ }
+ break;
}
}
@@ -232,34 +229,34 @@
// Just read, no write
return false;
}
-
+
public Date getBeginDate() {
return selectedBeginDate;
}
- public void setBeginDate(Date date){
+ public void setBeginDate(Date date) {
selectedBeginDate = date;
}
-
+
public Date getEndDate() {
return selectedEndDate;
}
-
- public void setEndDate(Date date){
+
+ public void setEndDate(Date date) {
selectedEndDate = date;
}
-
+
/**
* get all account fot the selected period
+ *
* @return
*/
- public List<FinancialStatementAmounts> getDataList(){
+ public List<FinancialStatementAmounts> getDataList() {
List<FinancialStatementAmounts> results = null;
- if (selectedBeginDate != null && selectedEndDate != null){
+ if (selectedBeginDate != null && selectedEndDate != null) {
try {
results = financialStatementService.financialStatementReport(selectedBeginDate, selectedEndDate);
- }
- catch (LimaException eee) {
+ } catch (LimaException eee) {
if (log.isErrorEnabled()) {
log.debug("Can't update model", eee);
}
@@ -268,24 +265,24 @@
}
return results;
}
-
- public void refresh(){
+
+ public void refresh() {
cacheDataList = getDataList();
fireTableDataChanged();
}
-
+
public void createDocument(FormatsEnum formatsEnum) {
-
- if (selectedBeginDate != null && selectedEndDate != null){
+
+ if (selectedBeginDate != null && selectedEndDate != null) {
String address = LimaConfig.getInstance().getHostAdress();
try {
- String url = "http://"+address+":"+port+"/?beginDate="
- +dateFormat.format(selectedBeginDate)
- +"&endDate="+dateFormat.format(selectedEndDate)
- +"&format="+formatsEnum.getExtension()+"&model="
- + DocumentsEnum.FINANCIALSTATEMENT.getFileName();
- Desktop.getDesktop().browse(new URI(url));
+ String url = "http://" + address + ":" + port + "/?beginDate="
+ + dateFormat.format(selectedBeginDate)
+ + "&endDate=" + dateFormat.format(selectedEndDate)
+ + "&format=" + formatsEnum.getExtension() + "&model="
+ + DocumentsEnum.FINANCIALSTATEMENT.getFileName();
+ Desktop.getDesktop().browse(new URI(url));
} catch (IOException e) {
log.error("Can't open browser", e);
} catch (URISyntaxException e) {
@@ -293,12 +290,12 @@
}
}
}
-
+
@Override
public void notifyMethod(String serviceName, String methodeName) {
- if (serviceName.contains("FinancialTransaction") || methodeName.contains("FinancialStatement") || methodeName.contains("importAll")){
+ if (serviceName.contains("FinancialTransaction") || methodeName.contains("FinancialStatement") || methodeName.contains("importAll")) {
refresh();
}
}
-
+
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportViewHandler.java 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportViewHandler.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -25,14 +25,6 @@
package org.chorem.lima.ui.financialstatementreport;
-import static org.nuiton.i18n.I18n._;
-
-import java.util.ArrayList;
-import java.util.Date;
-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.FiscalPeriodServiceMonitorable;
@@ -42,48 +34,55 @@
import org.chorem.lima.service.LimaServiceFactory;
import org.chorem.lima.util.ErrorHelper;
+import javax.swing.JOptionPane;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import static org.nuiton.i18n.I18n._;
+
/**
* Handler associated with accounts reports view.
- *
+ *
* @author chatellier
* @version $Revision$
- *
- * Last update : $Date$
- * By : $Author$
+ * <p/>
+ * Last update : $Date$
+ * By : $Author$
*/
public class FinancialStatementReportViewHandler {
-
+
/** log. */
private static final Log log = LogFactory.getLog(FinancialStatementReportViewHandler.class);
protected FinancialStatementReportView view;
-
+
protected FinancialStatementReportTableModel model;
-
+
protected FiscalPeriodServiceMonitorable fiscalPeriodService;
-
+
protected FinancialStatementReportViewHandler(FinancialStatementReportView view) {
this.view = view;
fiscalPeriodService =
- LimaServiceFactory.getInstance().getService(
- FiscalPeriodServiceMonitorable.class);
+ LimaServiceFactory.getInstance().getService(
+ FiscalPeriodServiceMonitorable.class);
}
-
- public void refresh(){
+
+ public void refresh() {
model = view.getModelTable();
- model.refresh();
+ model.refresh();
}
-
+
public FinancialStatementReportView getView() {
return view;
}
-
+
public void createDocument() {
-
+
model = view.getModelTable();
Date selectedBeginDate = model.getBeginDate();
Date selectedEndDate = model.getEndDate();
-
+
if (selectedBeginDate != null && selectedEndDate != null) {
//looks for all blocked fiscal periods
List<FiscalPeriod> blockedFiscalPeriods = new ArrayList<FiscalPeriod>();
@@ -95,18 +94,18 @@
}
ErrorHelper.showErrorDialog("Enable to create document ", eee);
}
-
+
//tells if the fiscaPeriod as been found and is blocked
boolean error = true;
-
+
for (FiscalPeriod blockedFiscalPeriod : blockedFiscalPeriods) {
if (blockedFiscalPeriod.getBeginDate().equals(selectedBeginDate)
- && blockedFiscalPeriod.getEndDate().equals(selectedEndDate)
- && blockedFiscalPeriod.getLocked()) {
+ && blockedFiscalPeriod.getEndDate().equals(selectedEndDate)
+ && blockedFiscalPeriod.getLocked()) {
error = false;
}
}
-
+
//shows error message to user if the fiscalPeriod is unblocked
if (error) {
JOptionPane.showMessageDialog(
@@ -116,7 +115,7 @@
JOptionPane.ERROR_MESSAGE);
} else {
FormatsEnum selectedEnum =
- (FormatsEnum) view.getDocumentEditor().getSelectedItem();
+ (FormatsEnum) view.getDocumentEditor().getSelectedItem();
model.createDocument(selectedEnum);
}
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionView.jaxx 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionView.jaxx 2011-09-17 14:17:04 UTC (rev 3293)
@@ -69,15 +69,15 @@
</cell>
<cell anchor="west">
<JPanel>
- <FinancialPeriodComboBox id="financialPeriodComboBox"
- constructorParams="getHandler()"
- model="{getModelFinancialPeriod()}"
- renderer="{RendererUtil.newDecoratorListCellRenderer(FinancialPeriod.class)}"
- onActionPerformed="financialTransactionTableModel.setFinancialPeriod((FinancialPeriod)financialPeriodComboBox.getSelectedItem())"/>
+ <FinancialPeriodComboBox id="financialPeriodComboBox"
+ constructorParams="getHandler()"
+ model="{getModelFinancialPeriod()}"
+ renderer="{RendererUtil.newDecoratorListCellRenderer(FinancialPeriod.class)}"
+ onActionPerformed="financialTransactionTableModel.setFinancialPeriod((FinancialPeriod)financialPeriodComboBox.getSelectedItem())"/>
<JButton id="back" text="lima.common.buttonback"
- onActionPerformed="financialPeriodComboBox.back()"/>
+ onActionPerformed="financialPeriodComboBox.back()"/>
<JButton id="next" text="lima.common.buttonnext"
- onActionPerformed="financialPeriodComboBox.next()"/>
+ onActionPerformed="financialPeriodComboBox.next()"/>
</JPanel>
</cell>
<!--cell>
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionPeriodSearchPanel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionPeriodSearchPanel.java 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionPeriodSearchPanel.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -32,14 +32,14 @@
import org.chorem.lima.entity.FiscalPeriod;
import org.chorem.lima.enums.ComboBoxPeriodEnum;
import org.chorem.lima.ui.combobox.FinancialPeriodComboBoxModel;
-import org.chorem.lima.ui.combobox.FinancialPeriodComboBoxRenderer;
import org.chorem.lima.ui.combobox.FiscalPeriodComboBoxModel;
-import org.chorem.lima.ui.combobox.FiscalPeriodComboBoxRenderer;
+import org.chorem.lima.ui.renderers.RendererUtil;
import org.jdesktop.swingx.JXDatePicker;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
+import javax.swing.ListCellRenderer;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Calendar;
@@ -130,9 +130,10 @@
case FISCAL_PERIOD:
FiscalPeriodComboBoxModel fiscalModel = new FiscalPeriodComboBoxModel();
- FiscalPeriodComboBoxRenderer fiscalRenderer = new FiscalPeriodComboBoxRenderer();
+ ListCellRenderer renderer =
+ RendererUtil.newDecoratorListCellRenderer(FiscalPeriod.class);
final JComboBox fiscalPeriod = new JComboBox(fiscalModel);
- fiscalPeriod.setRenderer(fiscalRenderer);
+ fiscalPeriod.setRenderer(renderer);
fiscalPeriod.setEditable(false);
ActionListener fiscalPeriodActionListener = new ActionListener() {
@Override
@@ -151,9 +152,10 @@
case FINANCIAL_PERIOD:
FinancialPeriodComboBoxModel financialModel = new FinancialPeriodComboBoxModel();
- FinancialPeriodComboBoxRenderer financialRenderer = new FinancialPeriodComboBoxRenderer();
+ renderer =
+ RendererUtil.newDecoratorListCellRenderer(FinancialPeriod.class);
final JComboBox financialPeriod = new JComboBox(financialModel);
- financialPeriod.setRenderer(financialRenderer);
+ financialPeriod.setRenderer(renderer);
financialPeriod.setEditable(false);
ActionListener financialPeriodActionListener = new ActionListener() {
@Override
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/LetterSearchComboBox.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/LetterSearchComboBox.java 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/LetterSearchComboBox.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -29,11 +29,12 @@
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.entity.Letter;
import org.chorem.lima.ui.combobox.LetterComboBoxModel;
-import org.chorem.lima.ui.combobox.LetterRenderer;
+import org.chorem.lima.ui.renderers.RendererUtil;
import org.chorem.lima.util.LetterToString;
import org.jdesktop.swingx.autocomplete.AutoCompleteDecorator;
import javax.swing.JComboBox;
+import javax.swing.ListCellRenderer;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
@@ -50,9 +51,10 @@
public LetterSearchComboBox(FinancialTransactionSearchViewHandler handler) {
this.handler = handler;
LetterComboBoxModel letterComboBoxModel = new LetterComboBoxModel();
- LetterRenderer letterRenderer = new LetterRenderer();
+ ListCellRenderer renderer =
+ RendererUtil.newDecoratorListCellRenderer(Letter.class);
setModel(letterComboBoxModel);
- setRenderer(letterRenderer);
+ setRenderer(renderer);
setEditable(true);
AutoCompleteDecorator.decorate(this, LetterToString.getInstance());
getEditor().getEditorComponent().addKeyListener(this);
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedView.jaxx 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedView.jaxx 2011-09-17 14:17:04 UTC (rev 3293)
@@ -27,8 +27,8 @@
<import>
javax.swing.ListSelectionModel
org.chorem.lima.entity.FiscalPeriod
- org.chorem.lima.ui.combobox.FiscalPeriodComboBoxRenderer
org.chorem.lima.ui.combobox.FiscalPeriodComboBoxModel
+ org.chorem.lima.ui.renderers.RendererUtil
</import>
<FinancialTransactionUnbalancedViewHandler id="handler"
javaBean="new FinancialTransactionUnbalancedViewHandler(this)"/>
@@ -61,7 +61,7 @@
<cell anchor="west">
<JComboBox id="fiscalPeriodComboBox"
model="{modelFiscalPeriod}"
- renderer="{new FiscalPeriodComboBoxRenderer()}"
+ renderer="{RendererUtil.newDecoratorListCellRenderer(FiscalPeriod.class)}"
onActionPerformed="getFinancialTransactionUnbalancedTableModel().setFiscalPeriod( (FiscalPeriod) fiscalPeriodComboBox.getSelectedItem());
getHandler().refresh()"
editable="false"/>
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 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodTable.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -25,6 +25,13 @@
package org.chorem.lima.ui.fiscalperiod;
+import org.chorem.lima.entity.FiscalPeriod;
+import org.jdesktop.swingx.JXTable;
+import org.jdesktop.swingx.decorator.ColorHighlighter;
+import org.jdesktop.swingx.decorator.ComponentAdapter;
+import org.jdesktop.swingx.decorator.HighlightPredicate;
+import org.jdesktop.swingx.decorator.Highlighter;
+
import java.awt.Color;
import java.awt.Component;
import java.awt.event.KeyEvent;
@@ -32,31 +39,24 @@
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
-import org.chorem.lima.entity.FiscalPeriod;
-import org.jdesktop.swingx.JXTable;
-import org.jdesktop.swingx.decorator.ColorHighlighter;
-import org.jdesktop.swingx.decorator.ComponentAdapter;
-import org.jdesktop.swingx.decorator.HighlightPredicate;
-import org.jdesktop.swingx.decorator.Highlighter;
-
public class FiscalPeriodTable extends JXTable
implements KeyListener, MouseListener {
private static final long serialVersionUID = -8462838870024505659L;
protected FiscalPeriodViewHandler handler;
-
+
protected FiscalPeriodTableModel model;
-
+
private Highlighter colorTransaction;
-
+
public FiscalPeriodTable(FiscalPeriodViewHandler handler) {
this.handler = handler;
-
+
addKeyListener(this);
addMouseListener(this);
-
+
model = this.handler.getView().getModelFiscalPeriodTable();
//highlight financial financial transactions
@@ -67,16 +67,16 @@
HighlightPredicate predicate = new HighlightPredicate() {
@Override
public boolean isHighlighted(Component renderer,
- ComponentAdapter adapter) {
+ ComponentAdapter adapter) {
FiscalPeriod fiscalPeriod = (FiscalPeriod) model.getElementAt(adapter.row);
// true if locked
return fiscalPeriod.getLocked();
}
};
- colorTransaction =
- new ColorHighlighter(predicate, null, new Color(222,0,0));
- addHighlighter(colorTransaction);
- }
+ colorTransaction =
+ new ColorHighlighter(predicate, null, new Color(222, 0, 0));
+ addHighlighter(colorTransaction);
+ }
@Override
public void mouseClicked(MouseEvent e) {
@@ -113,14 +113,14 @@
public void keyPressed(KeyEvent e) {
// clear row selection with the key: escape
if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
- if (!isEditing()) {
+ if (!isEditing()) {
clearSelection();
- }
+ }
}
}
@Override
public void keyReleased(KeyEvent e) {
}
-
+
}
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 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodTableModel.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -25,16 +25,6 @@
package org.chorem.lima.ui.fiscalperiod;
-import static org.nuiton.i18n.I18n._;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-
-import javax.swing.JFrame;
-import javax.swing.JOptionPane;
-import javax.swing.table.AbstractTableModel;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.FinancialTransactionServiceMonitorable;
@@ -49,16 +39,26 @@
import org.chorem.lima.util.ErrorHelper;
import org.nuiton.util.Resource;
+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._;
+
/**
* TODO add comment here.
- *
+ *
* @author chatellier
* @version $Revision$
- *
- * Last update : $Date$
- * By : $Author$
+ * <p/>
+ * Last update : $Date$
+ * By : $Author$
*/
-public class FiscalPeriodTableModel extends AbstractTableModel implements ServiceListener{
+public class FiscalPeriodTableModel extends AbstractTableModel implements ServiceListener {
/** serialVersionUID. */
private static final long serialVersionUID = 77027335135838258L;
@@ -66,35 +66,34 @@
private static final Log log = LogFactory.getLog(FiscalPeriodTableModel.class);
protected FiscalPeriodServiceMonitorable fiscalPeriodService;
-
+
protected FinancialTransactionServiceMonitorable financialTransactionService;
-
+
/** data cache */
protected List<Object> cacheDataList;
public FiscalPeriodTableModel() {
fiscalPeriodService =
- LimaServiceFactory.getInstance().getService(
- FiscalPeriodServiceMonitorable.class);
+ LimaServiceFactory.getInstance().getService(
+ FiscalPeriodServiceMonitorable.class);
fiscalPeriodService.addServiceListener(this);
- LimaServiceFactory.getInstance().getService(
+ LimaServiceFactory.getInstance().getService(
ImportServiceMonitorable.class).addServiceListener(this);
financialTransactionService =
- LimaServiceFactory.getInstance().getService(
- FinancialTransactionServiceMonitorable.class);
+ LimaServiceFactory.getInstance().getService(
+ FinancialTransactionServiceMonitorable.class);
financialTransactionService.addServiceListener(this);
cacheDataList = null;
- }
-
+ }
+
protected List<Object> getDataList() {
List<Object> results = new ArrayList<Object>();
try {
List<FiscalPeriod> fiscalPeriod =
- fiscalPeriodService.getAllFiscalPeriods();
+ fiscalPeriodService.getAllFiscalPeriods();
Collections.sort(fiscalPeriod, new FiscalPeriodComparator());
results.addAll(fiscalPeriod);
- }
- catch (LimaException eee) {
+ } catch (LimaException eee) {
if (log.isErrorEnabled()) {
log.debug("Can't update model", eee);
}
@@ -103,15 +102,15 @@
return results;
}
- public void refresh(){
+ public void refresh() {
cacheDataList = getDataList();
fireTableDataChanged();
}
-
+
@Override
public int getRowCount() {
int result = 0;
-
+
if (cacheDataList != null) {
result = cacheDataList.size();
}
@@ -124,30 +123,30 @@
return 2;
}
-
- public Object getElementAt(int row){
-
+
+ public Object getElementAt(int row) {
+
Object currentRow = null;
-
+
if (cacheDataList != null) {
currentRow = cacheDataList.get(row);
}
-
+
return currentRow;
}
-
+
@Override
public String getColumnName(int columnIndex) {
-
+
String result = "n/a";
-
- switch(columnIndex) {
- case 0 :
- result = _("lima.table.fiscalperiod");
- break;
- case 1:
- result = _("lima.table.closure");
- break;
+
+ switch (columnIndex) {
+ case 0:
+ result = _("lima.table.fiscalperiod");
+ break;
+ case 1:
+ result = _("lima.table.closure");
+ break;
}
return result;
@@ -172,43 +171,40 @@
List<Object> periods;
periods = cacheDataList;
- FiscalPeriod fiscalPeriod = (FiscalPeriod)periods.get(rowIndex);
-
- if (fiscalPeriod != null){
- SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd MMM yyyy");
+ FiscalPeriod fiscalPeriod = (FiscalPeriod) periods.get(rowIndex);
+ if (fiscalPeriod != null) {
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd MMM yyyy");
+
switch (columnIndex) {
- case 0:
- result = simpleDateFormat.
- format(fiscalPeriod.getBeginDate())
- + " - " + simpleDateFormat.
+ case 0:
+ result = simpleDateFormat.
+ format(fiscalPeriod.getBeginDate())
+ + " - " + simpleDateFormat.
format(fiscalPeriod.getEndDate());
- break;
- case 1:
- if(fiscalPeriod.getLocked()){
- result = _("lima.common.closed");
- }
- else{
- result = _("lima.common.open");
- }
- break;
+ break;
+ case 1:
+ if (fiscalPeriod.getLocked()) {
+ result = _("lima.common.closed");
+ } else {
+ result = _("lima.common.open");
+ }
+ break;
}
}
return result;
}
-
+
public FiscalPeriod getFiscalPeriodAtRow(int row) throws LimaException {
FiscalPeriod fiscalPeriod;
- fiscalPeriod = (FiscalPeriod) cacheDataList.get(row);
+ fiscalPeriod = (FiscalPeriod) cacheDataList.get(row);
return fiscalPeriod;
}
-
- /**
- * @param period
- */
+
+ /** @param period */
public void addFiscalPeriod(FiscalPeriod period) throws LimaException {
-
+
try {
// Calling fiscal period service
fiscalPeriodService.createFiscalPeriod(period);
@@ -216,26 +212,25 @@
cacheDataList = getDataList();
int row = getDataList().indexOf(period);
fireTableRowsInserted(row, row);
- }
- catch (LimaException eee) {
+ } catch (LimaException eee) {
if (log.isErrorEnabled()) {
log.debug("Can't create FiscalPeriod", eee);
}
ErrorHelper.showErrorDialog(_("lima.fiscalperiod.creationerror"), eee);
}
}
-
+
public void blockFiscalPeriod(FiscalPeriod fiscalPeriod) throws LimaException {
- List<FinancialTransaction> financialTransactionsUnbal =
- financialTransactionService.getAllInexactFinancialTransactions(fiscalPeriod);
+ List<FinancialTransaction> financialTransactionsUnbal =
+ financialTransactionService.getAllInexactFinancialTransactions(fiscalPeriod);
if (financialTransactionsUnbal.size() > 0) {
JFrame f = new JFrame();
- f.setIconImage(Resource.getIcon("icons/lima.png").getImage());
- JOptionPane.showMessageDialog(
- f,
- _("lima.fiscalperiod.unbalancedtransactions"),
- _("lima.common.error"),
- JOptionPane.ERROR_MESSAGE);
+ f.setIconImage(Resource.getIcon("icons/lima.png").getImage());
+ JOptionPane.showMessageDialog(
+ f,
+ _("lima.fiscalperiod.unbalancedtransactions"),
+ _("lima.common.error"),
+ JOptionPane.ERROR_MESSAGE);
f.dispose();
} else {
fiscalPeriodService.blockFiscalPeriod(fiscalPeriod);
@@ -246,8 +241,8 @@
@Override
public void notifyMethod(String serviceName, String methodeName) {
//refresh on import datas
- if (methodeName.contains("importAll")){
+ if (methodeName.contains("importAll")) {
refresh();
- }
+ }
}
}
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 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodViewHandler.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -49,66 +49,66 @@
/**
* TODO add comment here.
- *
+ *
* @author chatellier
* @version $Revision$
- *
- * Last update : $Date$
- * By : $Author$
+ * <p/>
+ * Last update : $Date$
+ * By : $Author$
*/
public class FiscalPeriodViewHandler {
private static final Log log = LogFactory.getLog(FiscalPeriodViewHandler.class);
-
+
private FiscalPeriodView view;
-
+
protected FiscalPeriodTable table;
-
+
protected FiscalPeriodTableModel tableModel;
-
+
/** Service. */
protected FiscalPeriodServiceMonitorable fiscalPeriodService;
-
+
protected FinancialTransactionServiceMonitorable financialTransactionService;
-
+
protected FiscalPeriodViewHandler(FiscalPeriodView view) {
- this.view=view;
-
+ this.view = view;
+
fiscalPeriodService =
- LimaServiceFactory.getInstance().getService(
- FiscalPeriodServiceMonitorable.class);
-
+ LimaServiceFactory.getInstance().getService(
+ FiscalPeriodServiceMonitorable.class);
+
financialTransactionService =
- LimaServiceFactory.getInstance().getService(
- FinancialTransactionServiceMonitorable.class);
+ LimaServiceFactory.getInstance().getService(
+ FinancialTransactionServiceMonitorable.class);
}
public void addFiscalPeriod() {
-
+
FiscalPeriodTableModel model =
- (FiscalPeriodTableModel)getView().getFiscalPeriodTable().getModel();
-
+ (FiscalPeriodTableModel) getView().getFiscalPeriodTable().getModel();
+
AddPeriod addPeriodDialog = new AddPeriod(getView());
// jaxx don't call super() ?
addPeriodDialog.setLocationRelativeTo(getView());
addPeriodDialog.setVisible(true);
-
+
FiscalPeriod fiscalPeriod = addPeriodDialog.getPeriod();
// null = cancel
- if (fiscalPeriod!= null) {
+ if (fiscalPeriod != null) {
//check if fiscalperiod have 12 months, ask a confirmation
int nbMonth =
- DateUtil.getDifferenceInMonths(fiscalPeriod.getBeginDate(),
- fiscalPeriod.getEndDate());
+ DateUtil.getDifferenceInMonths(fiscalPeriod.getBeginDate(),
+ fiscalPeriod.getEndDate());
int n = 0;
- if(nbMonth !=12){
+ if (nbMonth != 12) {
n = JOptionPane.showConfirmDialog(getView(),
- _("lima.charts.fiscalperiod.question.morethan12"),
- _("lima.common.question"),
- JOptionPane.YES_NO_OPTION,
- JOptionPane.QUESTION_MESSAGE);
+ _("lima.charts.fiscalperiod.question.morethan12"),
+ _("lima.common.question"),
+ JOptionPane.YES_NO_OPTION,
+ JOptionPane.QUESTION_MESSAGE);
}
- if (n == JOptionPane.YES_OPTION || nbMonth ==11){
+ if (n == JOptionPane.YES_OPTION || nbMonth == 11) {
try {
model.addFiscalPeriod(fiscalPeriod);
} catch (LimaException eee) {
@@ -125,30 +125,30 @@
JXTable fiscalPeriodeTable = getView().getFiscalPeriodTable();
int selectedRow = fiscalPeriodeTable.getSelectedRow();
FiscalPeriodTableModel model =
- (FiscalPeriodTableModel)getView().getFiscalPeriodTable().getModel();
+ (FiscalPeriodTableModel) getView().getFiscalPeriodTable().getModel();
// blocked it
try {
FiscalPeriod selectedFiscalPeriod =
- model.getFiscalPeriodAtRow(selectedRow);
+ 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);
+ JOptionPane.showConfirmDialog(getView(),
+ _("lima.charts.fiscalperiod.question.blocked"),
+ _("lima.common.question"), JOptionPane.YES_NO_OPTION,
+ JOptionPane.QUESTION_MESSAGE);
if (response == JOptionPane.YES_OPTION) {
//use to tell if the user wants to create a new fiscal year
boolean newyear = false;
//check if two fiscal periods are open
- if (model.getRowCount()-1 != selectedRow) {
+ if (model.getRowCount() - 1 != selectedRow) {
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);
+ JOptionPane.showConfirmDialog(getView(),
+ _("lima.charts.fiscalperiod.question.newyear"),
+ _("lima.common.question"), JOptionPane.YES_NO_OPTION,
+ JOptionPane.QUESTION_MESSAGE);
//create a new fiscal year
if (response == JOptionPane.YES_OPTION) {
addFiscalPeriod();
@@ -165,10 +165,10 @@
DialogHelper.showErrorMessageDialog(view, eee);
}
}
-
+
/**
- *
* Sets EntryBook and Date to use
+ *
* @param selectedFiscalPeriod
* @param newyear
*/
@@ -179,7 +179,7 @@
// (FiscalPeriodTableModel)getView().getFiscalPeriodTable().getModel();
try {
boolean found = false;
- List<FinancialTransaction> financialTransactionsList =
+ List<FinancialTransaction> financialTransactionsList =
financialTransactionService.getAllFinancialTransactionsFromDateToDate(
selectedFiscalPeriod.getBeginDate(), selectedFiscalPeriod.getEndDate());
//check if they are at least one transaction to be report
@@ -189,7 +189,7 @@
Collection<Entry> entryList = financialTransactionsList.get(i).getEntry();
for (Entry entry : entryList) {
if (Integer.valueOf(entry.getAccount().getAccountNumber().substring(0, 1)) < 6
- && !entry.getAmount().equals(BigDecimal.ZERO)) {
+ && !entry.getAmount().equals(BigDecimal.ZERO)) {
found = true;
}
}
@@ -200,15 +200,15 @@
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);
+ JOptionPane.showConfirmDialog(getView(),
+ _("lima.charts.fiscalperiod.question.addretainedearnings"),
+ _("lima.common.question"), JOptionPane.YES_NO_OPTION,
+ JOptionPane.QUESTION_MESSAGE);
//ask user for the entrybook to use for retained earnings
if (response == JOptionPane.YES_OPTION) {
//Sets EntryBook
EntryBook newEntryBook = new EntryBookImpl();
- RetainedEarningsEntryBookForm entryBookForm =
+ RetainedEarningsEntryBookForm entryBookForm =
new RetainedEarningsEntryBookForm(view);
entryBookForm.setEntryBook(newEntryBook);
// jaxx constructor don't call super() ?
@@ -227,16 +227,16 @@
log.error("Can't set net income", eee);
}
DialogHelper.showErrorMessageDialog(view, eee);
-
+
}
}
public FiscalPeriodView getView() {
return view;
}
-
- public void refresh(){
- tableModel = (FiscalPeriodTableModel)getView().getFiscalPeriodTable().getModel();
+
+ public void refresh() {
+ tableModel = (FiscalPeriodTableModel) getView().getFiscalPeriodTable().getModel();
tableModel.refresh();
}
}
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 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/AccountsPane.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -25,14 +25,6 @@
package org.chorem.lima.ui.home;
-import static org.nuiton.i18n.I18n._;
-import java.awt.Color;
-import java.util.List;
-import javax.swing.JEditorPane;
-import javax.swing.event.HyperlinkEvent;
-import javax.swing.event.HyperlinkListener;
-import javax.swing.plaf.basic.BasicEditorPaneUI;
-
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.LimaContext;
@@ -44,30 +36,39 @@
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;
+
+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;
+ this.view = view;
accountService =
- LimaServiceFactory.getInstance().getService(
- AccountServiceMonitorable.class);
+ LimaServiceFactory.getInstance().getService(
+ AccountServiceMonitorable.class);
accountService.addServiceListener(this);
LimaServiceFactory.getInstance().getService(
ImportServiceMonitorable.class).addServiceListener(this);
-
+
//init
setOpaque(true);
setContentType("text/html");
@@ -80,7 +81,7 @@
@Override
public void hyperlinkUpdate(HyperlinkEvent e) {
if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
-
+
if (e.getDescription().equals("#accountschart")) {
MainView ui = LimaContext.MAIN_UI_ENTRY_DEF.getContextValue(view);
ui.getHandler().showAccountView(ui);
@@ -88,29 +89,28 @@
}
}
- public void refresh(){
-
+ public void refresh() {
+
String htmlBegin = "<font face='sans-serif' size=3>"
- + "<p style=vertical-align:'bottom', horizontal-align:'center'>";
+ + "<p style=vertical-align:'bottom', horizontal-align:'center'>";
String htmlEnd = "</p></font>";
-
+
try {
-
+
List<Account> accounts = accountService.getAllAccounts();
- if (accounts.size()>0){
+ if (accounts.size() > 0) {
setBackground(greenBackground);
String accountsString = _("lima.home.chartaccounts.state1_2") + " "
- + accounts.size() + " " + _("lima.home.chartaccounts.state2_2")
- + "<br/><br/><a href='#accountschart'>"
- + _("lima.home.chartaccounts.modify") + "</a>";
+ + accounts.size() + " " + _("lima.home.chartaccounts.state2_2")
+ + "<br/><br/><a href='#accountschart'>"
+ + _("lima.home.chartaccounts.modify") + "</a>";
//set Text
setText(htmlBegin + accountsString + htmlEnd);
- }
- else {
+ } else {
setBackground(redBackground);
String accountsString = _("lima.home.chartaccounts.nothing")
- + "<br/><br/><a href='#accountschart'>"
- + _("lima.home.chartaccounts.create") + "</a>";
+ + "<br/><br/><a href='#accountschart'>"
+ + _("lima.home.chartaccounts.create") + "</a>";
//set Text
setText(htmlBegin + accountsString + htmlEnd);
}
@@ -121,9 +121,9 @@
@Override
public void notifyMethod(String serviceName, String methodeName) {
- if (methodeName.contains("Account") || methodeName.contains("importAll") || methodeName.contains("importAs")){
+ if (methodeName.contains("Account") || methodeName.contains("importAll") || methodeName.contains("importAs")) {
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 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/EntryBooksPane.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -25,13 +25,6 @@
package org.chorem.lima.ui.home;
-import static org.nuiton.i18n.I18n._;
-import java.awt.Color;
-import java.util.List;
-import javax.swing.JEditorPane;
-import javax.swing.event.HyperlinkEvent;
-import javax.swing.event.HyperlinkListener;
-import javax.swing.plaf.basic.BasicEditorPaneUI;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.LimaContext;
@@ -43,29 +36,39 @@
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;
+
+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 EntryBookServiceMonitorable 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;
+ this.view = view;
entryBookService =
- LimaServiceFactory.getInstance().getService(
- EntryBookServiceMonitorable.class);
+ LimaServiceFactory.getInstance().getService(
+ EntryBookServiceMonitorable.class);
entryBookService.addServiceListener(this);
LimaServiceFactory.getInstance().getService(
ImportServiceMonitorable.class).addServiceListener(this);
-
+
//init
setOpaque(true);
setContentType("text/html");
@@ -74,12 +77,12 @@
addHyperlinkListener(this);
refresh();
}
-
+
@Override
public void hyperlinkUpdate(HyperlinkEvent e) {
if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
-
+
if (e.getDescription().equals("#entrybookschart")) {
MainView ui = LimaContext.MAIN_UI_ENTRY_DEF.getContextValue(view);
ui.getHandler().showEntryBookView(ui);
@@ -87,65 +90,63 @@
}
}
- public void refresh(){
-
+ public void refresh() {
+
String htmlBegin = "<font face='sans-serif' size=3>"
- + "<p style=vertical-align:'bottom', horizontal-align:'center'>";
+ + "<p style=vertical-align:'bottom', horizontal-align:'center'>";
String htmlEnd = "</p></font>";
-
+
try {
-
+
List<EntryBook> entryBooks = entryBookService.getAllEntryBooks();
int ebSize = entryBooks.size();
- if (ebSize>0){
+ if (ebSize > 0) {
setBackground(greenBackground);
String entryBooksString;
- if (ebSize == 1){
+ if (ebSize == 1) {
entryBooksString = _("lima.home.entrybooks.state.single")
- + "<br/>" + entryBooks.get(0).getLabel()
- + "<br/><br/><a href='#entrybookschart'>"
- + _("lima.home.entrybooks.modify") + "</a>";
-
- }
- else {
+ + "<br/>" + entryBooks.get(0).getLabel()
+ + "<br/><br/><a href='#entrybookschart'>"
+ + _("lima.home.entrybooks.modify") + "</a>";
+
+ } else {
entryBooksString = _("lima.home.entrybooks.state1_2.plural")
- + " " + entryBooks.size() + " "
- + _("lima.home.entrybooks.state2_2.plural") + "<ul>";
+ + " " + entryBooks.size() + " "
+ + _("lima.home.entrybooks.state2_2.plural") + "<ul>";
for (int i = 0; i < ebSize && i < 3; i++) {
// for (EntryBook entryBook : entryBooks) {
EntryBook entryBook = entryBooks.get(i);
- entryBooksString += "<li>"+entryBook.getCode() +
- " - "+entryBook.getLabel()+"</li>";
+ entryBooksString += "<li>" + entryBook.getCode() +
+ " - " + entryBook.getLabel() + "</li>";
}
if (ebSize > 3) {
entryBooksString += "<li> ... </li>";
}
entryBooksString += "</ul></p><p horizontal-align:'center'>"
- + "<a href='#entrybookschart'>"
- + _("lima.home.entrybooks.modify") + "</a>";
+ + "<a href='#entrybookschart'>"
+ + _("lima.home.entrybooks.modify") + "</a>";
}
//set Text
setText(htmlBegin + entryBooksString + htmlEnd);
- }
- else {
+ } else {
setBackground(redBackground);
//set Text
setText(htmlBegin
- + _("lima.home.entrybooks.nothing")
- + "<br/><br/><a href='#entrybookschart'>"
- + _("lima.home.entrybooks.create") +"</a>" + htmlEnd);
+ + _("lima.home.entrybooks.nothing")
+ + "<br/><br/><a href='#entrybookschart'>"
+ + _("lima.home.entrybooks.create") + "</a>" + htmlEnd);
}
-
+
} catch (LimaException eee) {
log.debug("Can't get datas account editor pane home", eee);
}
}
-
+
@Override
public void notifyMethod(String serviceName, String methodeName) {
if (methodeName.contains("EntryBook") || methodeName.contains("importAll")
- || methodeName.contains("importAs") || methodeName.contains("importEntries")){
+ || methodeName.contains("importAs") || methodeName.contains("importEntries")) {
refresh();
- }
+ }
}
}
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 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/FinancialTransactionsPane.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -25,13 +25,6 @@
package org.chorem.lima.ui.home;
-import static org.nuiton.i18n.I18n._;
-import java.awt.Color;
-import java.util.List;
-import javax.swing.JEditorPane;
-import javax.swing.event.HyperlinkEvent;
-import javax.swing.event.HyperlinkListener;
-import javax.swing.plaf.basic.BasicEditorPaneUI;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.LimaContext;
@@ -45,32 +38,43 @@
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;
+
+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 FinancialTransactionServiceMonitorable financialTransactionService;
+
protected FiscalPeriodServiceMonitorable 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;
-
+
financialTransactionService =
- LimaServiceFactory.getInstance().getService(FinancialTransactionServiceMonitorable.class);
+ LimaServiceFactory.getInstance().getService(FinancialTransactionServiceMonitorable.class);
financialTransactionService.addServiceListener(this);
fiscalPeriodService =
- LimaServiceFactory.getInstance().getService(FiscalPeriodServiceMonitorable.class);
+ LimaServiceFactory.getInstance().getService(FiscalPeriodServiceMonitorable.class);
fiscalPeriodService.addServiceListener(this);
LimaServiceFactory.getInstance().getService(
ImportServiceMonitorable.class).addServiceListener(this);
-
+
//init
setOpaque(true);
setContentType("text/html");
@@ -78,86 +82,82 @@
setUI(new BasicEditorPaneUI());
addHyperlinkListener(this);
refresh();
- }
-
+ }
+
@Override
public void hyperlinkUpdate(HyperlinkEvent e) {
if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
-
+
if (e.getDescription().equals("#financialtransactionunbalanced")) {
MainView ui = LimaContext.MAIN_UI_ENTRY_DEF.getContextValue(view);
ui.getHandler().showTransactionUnbalancedView(ui);
- }
- else if (e.getDescription().equals("#financialtransactionbalanced")) {
+ } else if (e.getDescription().equals("#financialtransactionbalanced")) {
MainView ui = LimaContext.MAIN_UI_ENTRY_DEF.getContextValue(view);
ui.getHandler().showTransactionView(ui);
}
- }
+ }
}
-public void refresh(){
-
+ public void refresh() {
+
String htmlBegin = "<font face='sans-serif' size=3>"
- + "<p style=vertical-align:'bottom', horizontal-align:'center'>";
+ + "<p style=vertical-align:'bottom', horizontal-align:'center'>";
String htmlEnd = "</p></font>";
-
+
try {
-
+
List<FiscalPeriod> unblockedFiscalPeriods =
- fiscalPeriodService.getAllUnblockedFiscalPeriods();
- if (unblockedFiscalPeriods.size() != 0){
+ fiscalPeriodService.getAllUnblockedFiscalPeriods();
+ if (unblockedFiscalPeriods.size() != 0) {
List<FinancialTransaction> financialTransactionsUnbal =
- financialTransactionService.
- getAllInexactFinancialTransactions(unblockedFiscalPeriods.get(0));
- if (financialTransactionsUnbal.size()>0){
+ financialTransactionService.
+ getAllInexactFinancialTransactions(unblockedFiscalPeriods.get(0));
+ if (financialTransactionsUnbal.size() > 0) {
setBackground(redBackground);
String transactionsString = financialTransactionsUnbal.size()
- + " " + _("lima.home.transaction.unbalanced")
- + "<br/><br/><a href='#financialtransactionunbalanced'>"
- + _("lima.home.transaction.modifiy.unbalanced") + "</a>";
+ + " " + _("lima.home.transaction.unbalanced")
+ + "<br/><br/><a href='#financialtransactionunbalanced'>"
+ + _("lima.home.transaction.modifiy.unbalanced") + "</a>";
//set Text
setText(htmlBegin + transactionsString + htmlEnd);
- }
- else {
+ } else {
List<FinancialTransaction> financialTransactionsBal =
- financialTransactionService.getAllFinancialTransactionsBalanced(unblockedFiscalPeriods.get(0));
-
- if (financialTransactionsBal.size()>0){
+ financialTransactionService.getAllFinancialTransactionsBalanced(unblockedFiscalPeriods.get(0));
+
+ if (financialTransactionsBal.size() > 0) {
setBackground(greenBackground);
String transactionsString = financialTransactionsBal.size()
- + " " + _("lima.home.transaction.balanced")
- + "<br/><br/><a href='#financialtransactionbalanced'>"
- + _("lima.home.transaction.modifiy.balanced") + "</a>";
+ + " " + _("lima.home.transaction.balanced")
+ + "<br/><br/><a href='#financialtransactionbalanced'>"
+ + _("lima.home.transaction.modifiy.balanced") + "</a>";
//set Text
setText(htmlBegin + transactionsString + htmlEnd);
- }
- else {
+ } else {
setBackground(redBackground);
String transactionsString = _("lima.home.transaction.nothing")
- + "<br/><br/><a href='#financialtransactionbalanced'>"
- + _("lima.home.transaction.create") + "</a>";
+ + "<br/><br/><a href='#financialtransactionbalanced'>"
+ + _("lima.home.transaction.create") + "</a>";
//set Text
setText(htmlBegin + transactionsString + htmlEnd);
}
}
- }
- else {
+ } else {
setBackground(redBackground);
}
-
+
} catch (LimaException eee) {
log.debug("Can't get datas account editor pane home", eee);
}
}
-
+
@Override
public void notifyMethod(String serviceName, String methodeName) {
if (methodeName.contains("FiscalPeriod") || methodeName.contains("FinancialTransaction")
- || methodeName.contains("Entry") || methodeName.contains("importEntries")
- || methodeName.contains("importAll") || methodeName.contains("importAs")){
+ || methodeName.contains("Entry") || methodeName.contains("importEntries")
+ || methodeName.contains("importAll") || methodeName.contains("importAs")) {
refresh();
- }
+ }
}
}
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 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/FiscalPeriodsPane.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -25,13 +25,6 @@
package org.chorem.lima.ui.home;
-import static org.nuiton.i18n.I18n._;
-import java.awt.Color;
-import java.util.List;
-import javax.swing.JEditorPane;
-import javax.swing.event.HyperlinkEvent;
-import javax.swing.event.HyperlinkListener;
-import javax.swing.plaf.basic.BasicEditorPaneUI;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.LimaContext;
@@ -43,82 +36,92 @@
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;
+
+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 FiscalPeriodServiceMonitorable fiscalPeriodService;
-
+
private static Color redBackground = new Color(0xff, 0xee, 0xee);
+
private static Color greenBackground = new Color(0xee, 0xff, 0xee);
-
+
public FiscalPeriodsPane(HomeView view) {
this.view = view;
-
+
fiscalPeriodService =
- LimaServiceFactory.getInstance().getService(FiscalPeriodServiceMonitorable.class);
+ LimaServiceFactory.getInstance().getService(FiscalPeriodServiceMonitorable.class);
fiscalPeriodService.addServiceListener(this);
LimaServiceFactory.getInstance().getService(
ImportServiceMonitorable.class).addServiceListener(this);
-
+
//init
setOpaque(true);
setContentType("text/html");
setEditable(false);
setUI(new BasicEditorPaneUI());
addHyperlinkListener(this);
- refresh(); }
-
+ refresh();
+ }
+
@Override
public void hyperlinkUpdate(HyperlinkEvent e) {
if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
-
+
if (e.getDescription().equals("#fiscalperiodschart")) {
MainView ui = LimaContext.MAIN_UI_ENTRY_DEF.getContextValue(view);
ui.getHandler().showFiscalPeriodView(ui);
}
}
}
-
-public void refresh(){
-
+
+ public void refresh() {
+
String htmlBegin = "<font face='sans-serif' size=3>"
- + "<p style=vertical-align:'bottom', horizontal-align:'center'>";
+ + "<p style=vertical-align:'bottom', horizontal-align:'center'>";
String htmlEnd = "</p></font>";
-
+
try {
-
+
//FISCAL PERIOD
List<FiscalPeriod> fiscalPeriods =
- fiscalPeriodService.getAllFiscalPeriods();
+ fiscalPeriodService.getAllFiscalPeriods();
List<FiscalPeriod> unblockedFiscalPeriods =
- fiscalPeriodService.getAllUnblockedFiscalPeriods();
- if (unblockedFiscalPeriods.size()>0){
+ fiscalPeriodService.getAllUnblockedFiscalPeriods();
+ if (unblockedFiscalPeriods.size() > 0) {
setBackground(greenBackground);
String fiscalString = unblockedFiscalPeriods.size() + " "
- + _("lima.home.fiscalperiod.opened") + "<br/>"
- + (fiscalPeriods.size()-unblockedFiscalPeriods.size())
- + " " + _("lima.home.fiscalperiod.closed")
- + "<br/><br/><a href='#fiscalperiodschart'>"
- + _("lima.home.fiscalperiod.modify") + "</a>";
+ + _("lima.home.fiscalperiod.opened") + "<br/>"
+ + (fiscalPeriods.size() - unblockedFiscalPeriods.size())
+ + " " + _("lima.home.fiscalperiod.closed")
+ + "<br/><br/><a href='#fiscalperiodschart'>"
+ + _("lima.home.fiscalperiod.modify") + "</a>";
//set Text
setText(htmlBegin + fiscalString + htmlEnd);
-
-
- }
- else {
+
+
+ } else {
setBackground(redBackground);
String fiscalString = _("lima.home.fiscalperiod.noopen");
- if (fiscalPeriods.size()>0){
+ if (fiscalPeriods.size() > 0) {
fiscalString += "<br/>" + fiscalPeriods.size() + " "
- + _("lima.home.fiscalperiod.closed");
+ + _("lima.home.fiscalperiod.closed");
}
fiscalString += "<br/><br/><a href='#fiscalperiodschart'>"
- + _("lima.home.fiscalperiod.create") + "</a>";
+ + _("lima.home.fiscalperiod.create") + "</a>";
//set Text
setText(htmlBegin + fiscalString + htmlEnd);
@@ -131,9 +134,9 @@
@Override
public void notifyMethod(String serviceName, String methodeName) {
if (methodeName.contains("FiscalPeriod") || methodeName.contains("importAll")
- || methodeName.contains("importAs")){
+ || methodeName.contains("importAs")) {
refresh();
- }
+ }
}
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/identity/IdentityForm.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/identity/IdentityForm.jaxx 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/identity/IdentityForm.jaxx 2011-09-17 14:17:04 UTC (rev 3293)
@@ -27,10 +27,11 @@
defaultCloseOperation="{JDialog.DO_NOTHING_ON_CLOSE}"
onWindowClosing="performCancel();">
- <IdentityHandler id="handler" javaBean="new IdentityHandler()" />
- <org.chorem.lima.entity.Identity id="identity" javaBean='handler.getIdentity()'/>
+ <IdentityHandler id="handler" javaBean="new IdentityHandler()"/>
+ <org.chorem.lima.entity.Identity id="identity"
+ javaBean='handler.getIdentity()'/>
- <script>
+ <script>
<![CDATA[
getRootPane().setDefaultButton(ok);
protected void performCancel() {
@@ -38,138 +39,152 @@
dispose();
}
]]>
- </script>
+ </script>
- <Table>
- <row>
- <cell fill="horizontal">
- <JLabel text="lima.identity.name"/>
- </cell>
- <cell fill="horizontal">
- <JTextField id="nameTextField" text="{getIdentity().getName()}"/>
- <javax.swing.text.Document javaBean="getNameTextField().getDocument()"
- onInsertUpdate='getIdentity().setName(getNameTextField().getText())'
- onRemoveUpdate='getIdentity().setName(getNameTextField().getText())' />
- </cell>
- </row>
- <row>
- <cell fill="horizontal">
- <JLabel text="lima.identity.description"/>
- </cell>
- <cell fill="horizontal">
- <JTextField id="descriptionTextField" text="{getIdentity().getDescription()}"/>
- <javax.swing.text.Document javaBean="getDescriptionTextField().getDocument()"
- onInsertUpdate='getIdentity().setDescription(getDescriptionTextField().getText())'
- onRemoveUpdate='getIdentity().setDescription(getDescriptionTextField().getText())' />
- </cell>
- </row>
- <row>
- <cell fill="horizontal">
- <JLabel text="lima.identity.address"/>
- </cell>
- <cell fill="horizontal">
- <JTextField id="addressTextField" text="{getIdentity().getAddress()}"/>
- <javax.swing.text.Document javaBean="getAddressTextField().getDocument()"
- onInsertUpdate='getIdentity().setAddress(getAddressTextField().getText())'
- onRemoveUpdate='getIdentity().setAddress(getAddressTextField().getText())' />
- </cell>
- </row>
- <row>
- <cell fill="horizontal">
- <JLabel text="lima.identity.address2"/>
- </cell>
- <cell fill="horizontal">
- <JTextField id="address2TextField" text="{getIdentity().getAddress2()}"/>
- <javax.swing.text.Document javaBean="getAddress2TextField().getDocument()"
- onInsertUpdate='getIdentity().setAddress2(getAddress2TextField().getText())'
- onRemoveUpdate='getIdentity().setAddress2(getAddress2TextField().getText())' />
- </cell>
- </row>
- <row>
- <cell fill="horizontal">
- <JLabel text="lima.identity.zipCode"/>
- </cell>
- <cell fill="horizontal">
- <JTextField id="zipCodeTextField" text="{getIdentity().getZipCode()}"/>
- <javax.swing.text.Document javaBean="getZipCodeTextField().getDocument()"
- onInsertUpdate='getIdentity().setZipCode(getZipCodeTextField().getText())'
- onRemoveUpdate='getIdentity().setZipCode(getZipCodeTextField().getText())' />
- </cell>
- </row>
- <row>
- <cell fill="horizontal">
- <JLabel text="lima.identity.city"/>
- </cell>
- <cell fill="horizontal">
- <JTextField id="cityTextField" text="{getIdentity().getCity()}"/>
- <javax.swing.text.Document javaBean="getCityTextField().getDocument()"
- onInsertUpdate='getIdentity().setCity(getCityTextField().getText())'
- onRemoveUpdate='getIdentity().setCity(getCityTextField().getText())' />
- </cell>
- </row>
- <row>
- <cell fill="horizontal">
- <JLabel text="lima.identity.businessNumber"/>
- </cell>
- <cell fill="horizontal">
- <JTextField id="businessNumberTextField" text="{getIdentity().getBusinessNumber()}"/>
- <javax.swing.text.Document javaBean="getBusinessNumberTextField().getDocument()"
- onInsertUpdate='getIdentity().setBusinessNumber(getBusinessNumberTextField().getText())'
- onRemoveUpdate='getIdentity().setBusinessNumber(getBusinessNumberTextField().getText())' />
- </cell>
- </row>
- <row>
- <cell fill="horizontal">
- <JLabel text="lima.identity.vatNumber"/>
- </cell>
- <cell fill="horizontal">
- <JTextField id="vatNumberTextField" text="{getIdentity().getVatNumber()}"/>
- <javax.swing.text.Document javaBean="getVatNumberTextField().getDocument()"
- onInsertUpdate='getIdentity().setVatNumber(getVatNumberTextField().getText())'
- onRemoveUpdate='getIdentity().setVatNumber(getVatNumberTextField().getText())' />
- </cell>
- </row>
- <row>
- <cell fill="horizontal">
- <JLabel text="lima.identity.classificationCode"/>
- </cell>
- <cell fill="horizontal">
- <JTextField id="classificationCodeTextField" text="{getIdentity().getClassificationCode()}"/>
- <javax.swing.text.Document javaBean="getClassificationCodeTextField().getDocument()"
- onInsertUpdate='getIdentity().setClassificationCode(getClassificationCodeTextField().getText())'
- onRemoveUpdate='getIdentity().setClassificationCode(getClassificationCodeTextField().getText())' />
- </cell>
- </row>
- <row>
- <cell fill="horizontal">
- <JLabel text="lima.identity.phoneNumber"/>
- </cell>
- <cell fill="horizontal">
- <JTextField id="phoneNumberTextField" text="{getIdentity().getPhoneNumber()}"/>
- <javax.swing.text.Document javaBean="getPhoneNumberTextField().getDocument()"
- onInsertUpdate='getIdentity().setPhoneNumber(getPhoneNumberTextField().getText())'
- onRemoveUpdate='getIdentity().setPhoneNumber(getPhoneNumberTextField().getText())' />
- </cell>
- </row>
- <row>
- <cell fill="horizontal">
- <JLabel text="lima.identity.email"/>
- </cell>
- <cell fill="horizontal">
- <JTextField id="emailTextField" text="{getIdentity().getEmail()}"/>
- <javax.swing.text.Document javaBean="getEmailTextField().getDocument()"
- onInsertUpdate='getIdentity().setEmail(getEmailTextField().getText())'
- onRemoveUpdate='getIdentity().setEmail(getEmailTextField().getText())' />
- </cell>
- </row>
- <row>
- <cell fill="none">
- <JButton text="lima.common.cancel" onActionPerformed="performCancel()"/>
- </cell>
- <cell fill="none">
- <JButton id="ok" text="lima.common.ok" onActionPerformed="handler.updateIdentity(getIdentity());
+ <Table>
+ <row>
+ <cell fill="horizontal">
+ <JLabel text="lima.identity.name"/>
+ </cell>
+ <cell fill="horizontal">
+ <JTextField id="nameTextField" text="{getIdentity().getName()}"/>
+ <javax.swing.text.Document javaBean="getNameTextField().getDocument()"
+ onInsertUpdate='getIdentity().setName(getNameTextField().getText())'
+ onRemoveUpdate='getIdentity().setName(getNameTextField().getText())'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill="horizontal">
+ <JLabel text="lima.identity.description"/>
+ </cell>
+ <cell fill="horizontal">
+ <JTextField id="descriptionTextField"
+ text="{getIdentity().getDescription()}"/>
+ <javax.swing.text.Document
+ javaBean="getDescriptionTextField().getDocument()"
+ onInsertUpdate='getIdentity().setDescription(getDescriptionTextField().getText())'
+ onRemoveUpdate='getIdentity().setDescription(getDescriptionTextField().getText())'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill="horizontal">
+ <JLabel text="lima.identity.address"/>
+ </cell>
+ <cell fill="horizontal">
+ <JTextField id="addressTextField" text="{getIdentity().getAddress()}"/>
+ <javax.swing.text.Document
+ javaBean="getAddressTextField().getDocument()"
+ onInsertUpdate='getIdentity().setAddress(getAddressTextField().getText())'
+ onRemoveUpdate='getIdentity().setAddress(getAddressTextField().getText())'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill="horizontal">
+ <JLabel text="lima.identity.address2"/>
+ </cell>
+ <cell fill="horizontal">
+ <JTextField id="address2TextField"
+ text="{getIdentity().getAddress2()}"/>
+ <javax.swing.text.Document
+ javaBean="getAddress2TextField().getDocument()"
+ onInsertUpdate='getIdentity().setAddress2(getAddress2TextField().getText())'
+ onRemoveUpdate='getIdentity().setAddress2(getAddress2TextField().getText())'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill="horizontal">
+ <JLabel text="lima.identity.zipCode"/>
+ </cell>
+ <cell fill="horizontal">
+ <JTextField id="zipCodeTextField" text="{getIdentity().getZipCode()}"/>
+ <javax.swing.text.Document
+ javaBean="getZipCodeTextField().getDocument()"
+ onInsertUpdate='getIdentity().setZipCode(getZipCodeTextField().getText())'
+ onRemoveUpdate='getIdentity().setZipCode(getZipCodeTextField().getText())'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill="horizontal">
+ <JLabel text="lima.identity.city"/>
+ </cell>
+ <cell fill="horizontal">
+ <JTextField id="cityTextField" text="{getIdentity().getCity()}"/>
+ <javax.swing.text.Document javaBean="getCityTextField().getDocument()"
+ onInsertUpdate='getIdentity().setCity(getCityTextField().getText())'
+ onRemoveUpdate='getIdentity().setCity(getCityTextField().getText())'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill="horizontal">
+ <JLabel text="lima.identity.businessNumber"/>
+ </cell>
+ <cell fill="horizontal">
+ <JTextField id="businessNumberTextField"
+ text="{getIdentity().getBusinessNumber()}"/>
+ <javax.swing.text.Document
+ javaBean="getBusinessNumberTextField().getDocument()"
+ onInsertUpdate='getIdentity().setBusinessNumber(getBusinessNumberTextField().getText())'
+ onRemoveUpdate='getIdentity().setBusinessNumber(getBusinessNumberTextField().getText())'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill="horizontal">
+ <JLabel text="lima.identity.vatNumber"/>
+ </cell>
+ <cell fill="horizontal">
+ <JTextField id="vatNumberTextField"
+ text="{getIdentity().getVatNumber()}"/>
+ <javax.swing.text.Document
+ javaBean="getVatNumberTextField().getDocument()"
+ onInsertUpdate='getIdentity().setVatNumber(getVatNumberTextField().getText())'
+ onRemoveUpdate='getIdentity().setVatNumber(getVatNumberTextField().getText())'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill="horizontal">
+ <JLabel text="lima.identity.classificationCode"/>
+ </cell>
+ <cell fill="horizontal">
+ <JTextField id="classificationCodeTextField"
+ text="{getIdentity().getClassificationCode()}"/>
+ <javax.swing.text.Document
+ javaBean="getClassificationCodeTextField().getDocument()"
+ onInsertUpdate='getIdentity().setClassificationCode(getClassificationCodeTextField().getText())'
+ onRemoveUpdate='getIdentity().setClassificationCode(getClassificationCodeTextField().getText())'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill="horizontal">
+ <JLabel text="lima.identity.phoneNumber"/>
+ </cell>
+ <cell fill="horizontal">
+ <JTextField id="phoneNumberTextField"
+ text="{getIdentity().getPhoneNumber()}"/>
+ <javax.swing.text.Document
+ javaBean="getPhoneNumberTextField().getDocument()"
+ onInsertUpdate='getIdentity().setPhoneNumber(getPhoneNumberTextField().getText())'
+ onRemoveUpdate='getIdentity().setPhoneNumber(getPhoneNumberTextField().getText())'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill="horizontal">
+ <JLabel text="lima.identity.email"/>
+ </cell>
+ <cell fill="horizontal">
+ <JTextField id="emailTextField" text="{getIdentity().getEmail()}"/>
+ <javax.swing.text.Document javaBean="getEmailTextField().getDocument()"
+ onInsertUpdate='getIdentity().setEmail(getEmailTextField().getText())'
+ onRemoveUpdate='getIdentity().setEmail(getEmailTextField().getText())'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill="none">
+ <JButton text="lima.common.cancel" onActionPerformed="performCancel()"/>
+ </cell>
+ <cell fill="none">
+ <JButton id="ok" text="lima.common.ok" onActionPerformed="handler.updateIdentity(getIdentity());
dispose()"/>
- </cell>
- </row>
- </Table>
+ </cell>
+ </row>
+ </Table>
</JDialog>
\ No newline at end of file
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/identity/IdentityHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/identity/IdentityHandler.java 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/identity/IdentityHandler.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -40,36 +40,36 @@
private static final Log log = LogFactory.getLog(IdentityHandler.class);
-
+
public IdentityHandler() {
identityService =
- LimaServiceFactory.getInstance().getService(
- IdentityServiceMonitorable.class);
+ LimaServiceFactory.getInstance().getService(
+ IdentityServiceMonitorable.class);
}
- public Identity getIdentity(){
+ public Identity getIdentity() {
Identity identity = null;
try {
identity = identityService.getIdentity();
} catch (LimaException eee) {
- if (log.isDebugEnabled()){
+ if (log.isDebugEnabled()) {
log.debug("Can't get Identity", eee);
}
}
- if (identity == null){
+ if (identity == null) {
identity = new IdentityImpl();
}
return identity;
}
- public void updateIdentity(Identity identity){
-
+ public void updateIdentity(Identity identity) {
+
try {
identityService.updateIdentity(identity);
} catch (LimaException eee) {
- if (log.isDebugEnabled()){
+ if (log.isDebugEnabled()) {
log.debug("Can't update Identity", eee);
}
}
- }
+ }
}
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 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -64,32 +64,32 @@
import static org.nuiton.i18n.I18n._;
public class ImportExport {
-
+
private static ImportExport exchanger;
-
+
private static final Log log = LogFactory.getLog(AccountViewHandler.class);
-
+
protected static Component viewComponent;
-
+
protected EncodingEnum encodingEnum;
protected ImportServiceMonitorable importService;
-
+
protected ExportServiceMonitorable exportService;
-
+
private ImportExportWaitView waitView;
public ImportExport(Component view) {
- viewComponent=view;
-
+ viewComponent = view;
+
//services
importService =
- LimaServiceFactory.getInstance().getService(
- ImportServiceMonitorable.class);
+ LimaServiceFactory.getInstance().getService(
+ ImportServiceMonitorable.class);
exportService =
- LimaServiceFactory.getInstance().getService(
- ExportServiceMonitorable.class);
-
+ LimaServiceFactory.getInstance().getService(
+ ExportServiceMonitorable.class);
+
//create the wait dialog panel
waitView = new ImportExportWaitView();
waitView.waitDialog.setSize(400, 200);
@@ -101,10 +101,10 @@
/**
* Call the appropriate methode in business service.
- *
+ *
* @param importExportMethode
*/
- public void importExport(ImportExportEnum importExportMethode, String file, Boolean verbose){
+ public void importExport(ImportExportEnum importExportMethode, String file, Boolean verbose) {
final ImportExportEnum importExportMethodeF = importExportMethode;
encodingEnum = EncodingEnum.UTF8;
if (file.equals("")) {
@@ -116,8 +116,9 @@
final String filePath = file;
final Boolean verboseMode = verbose;
final Boolean importMode = importExportMethode.getImportMode();
- new SwingWorker<String,Void>() {
- @Override protected String doInBackground() throws LimaException {
+ new SwingWorker<String, Void>() {
+ @Override
+ protected String doInBackground() throws LimaException {
String datas;
String result = "";
switch (importExportMethodeF) {
@@ -173,8 +174,8 @@
break;
case PDF_VAT_IMPORT:
int response = JOptionPane.showConfirmDialog(waitView,
- _("lima.importexport.usevatpdf"),
- _("lima.common.confirmation"), JOptionPane.YES_NO_OPTION);
+ _("lima.importexport.usevatpdf"),
+ _("lima.common.confirmation"), JOptionPane.YES_NO_OPTION);
datas = extractFile(filePath, charset.getEncoding());
result = importService.importAsPDF(filePath, ImportExportEntityEnum.VATPDF, response == JOptionPane.YES_OPTION);
break;
@@ -188,52 +189,52 @@
datas = extractFile(filePath, EncodingEnum.ISOLATIN1.getEncoding());
result = importService.importEntriesFromEbp(datas);
break;
- }
+ }
return result;
}
- @Override protected void done() {
+
+ @Override
+ protected void done() {
try {
//hidde wait dialog panel
waitView.setVisible(false);
// display result dialog
- if (verboseMode){
+ if (verboseMode) {
String result = get();
- if (!result.equals("")){
+ if (!result.equals("")) {
DialogHelper.showReportDialog(result, _("lima.importexport.import"), viewComponent);
- }
- else {
- if (importMode){
- //special message when importing a VAT PDF
- if (importExportMethodeF.equals(ImportExportEnum.PDF_VAT_IMPORT)) {
- JOptionPane.showMessageDialog(
- waitView,
- _("lima.importexport.import.vatpdfimport"),
- _("lima.importexport.import"),
- JOptionPane.INFORMATION_MESSAGE);
- } else {
+ } else {
+ if (importMode) {
+ //special message when importing a VAT PDF
+ if (importExportMethodeF.equals(ImportExportEnum.PDF_VAT_IMPORT)) {
JOptionPane.showMessageDialog(
+ waitView,
+ _("lima.importexport.import.vatpdfimport"),
+ _("lima.importexport.import"),
+ JOptionPane.INFORMATION_MESSAGE);
+ } else {
+ JOptionPane.showMessageDialog(
+ waitView,
+ _("lima.importexport.import.terminated"),
+ _("lima.importexport.import"),
+ JOptionPane.INFORMATION_MESSAGE);
+ }
+ } else {
+ JOptionPane.showMessageDialog(
waitView,
- _("lima.importexport.import.terminated"),
- _("lima.importexport.import"),
- JOptionPane.INFORMATION_MESSAGE);
- }
- }
- else {
- JOptionPane.showMessageDialog(
- waitView,
_("lima.importexport.export.terminated"),
_("lima.importexport.export"),
JOptionPane.INFORMATION_MESSAGE);
- }
- }
+ }
+ }
}
} catch (InterruptedException eee) {
- if (log.isErrorEnabled()){
+ if (log.isErrorEnabled()) {
log.error("Can't get result message", eee);
}
} catch (ExecutionException eee) {
DialogHelper.showMessageDialog(eee.getCause().getMessage());
- if (log.isErrorEnabled()){
+ if (log.isErrorEnabled()) {
log.error("Error on import", eee);
}
}
@@ -242,68 +243,62 @@
waitView.setVisible(true);
}
}
-
-
+
+
/**
* open choose file dialog with appropriate file mode view
* folders for export or folders+files for import
+ *
* @param importMode
* @return
*/
- public String chooseFile(Boolean importMode, ImportExportEnum importExportMethode){
+ public String chooseFile(Boolean importMode, ImportExportEnum importExportMethode) {
String filePath = "";
- JFileChooser chooser = new JFileChooser();
- //Encoding option
-
- JComboBox comboBox = new JComboBox(EncodingEnum.descriptions());
- if (importExportMethode.getEncodingOption()){
- JPanel panel = new JPanel();
- panel.setLayout(new BorderLayout());
- panel.add(new JLabel(_("lima.importexport.choiceencoding")), BorderLayout.WEST);
- panel.add(comboBox, BorderLayout.CENTER);
- ((Container)chooser.getComponent(2)).add(panel, BorderLayout.SOUTH);
- }
-
- if (importMode){
- chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
+ JFileChooser chooser = new JFileChooser();
+ //Encoding option
+
+ JComboBox comboBox = new JComboBox(EncodingEnum.descriptions());
+ if (importExportMethode.getEncodingOption()) {
+ JPanel panel = new JPanel();
+ panel.setLayout(new BorderLayout());
+ panel.add(new JLabel(_("lima.importexport.choiceencoding")), BorderLayout.WEST);
+ panel.add(comboBox, BorderLayout.CENTER);
+ ((Container) chooser.getComponent(2)).add(panel, BorderLayout.SOUTH);
}
- else {
+
+ if (importMode) {
+ chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
+ } else {
chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
}
if (chooser.showOpenDialog(viewComponent) == JFileChooser.APPROVE_OPTION) {
filePath = chooser.getSelectedFile().getAbsolutePath();
- if (importExportMethode.getEncodingOption()){
+ if (importExportMethode.getEncodingOption()) {
encodingEnum = EncodingEnum.valueOfDescription((String) comboBox.getSelectedItem());
}
}
return filePath;
}
-
-
- /**
- * Get csv datas in string and write file
- *
- */
- public void createFile(String filePath, String charset, String datas){
+
+
+ /** Get csv datas in string and write file */
+ public void createFile(String filePath, String charset, String datas) {
try {
File file = new File(filePath);
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), charset));
out.write(datas);
out.flush();
out.close();
- }
- catch (IOException eee) {
- if (log.isErrorEnabled()){
+ } catch (IOException eee) {
+ if (log.isErrorEnabled()) {
log.error("Can't write file " + filePath, eee);
}
}
}
- /**
- * Open csv file and get his datas on a string.
- */
+ /** Open csv file and get his datas on a string. */
public String extractFile(String filePath, String charset) {
StringWriter sw = new StringWriter();
BufferedReader in = null;
@@ -314,35 +309,31 @@
if (filePath != null && filePath.indexOf(".jar!") > 0) {
String resourcesPath = filePath.substring(filePath.indexOf(".jar!") + 5);
is = ImportExport.class.getResourceAsStream(resourcesPath);
- }
- else {
+ } else {
is = new FileInputStream(filePath);
}
in = new BufferedReader(new InputStreamReader(is, charset));
IOUtils.copy(in, sw);
in.close();
- }
- catch (IOException eee) {
+ } catch (IOException eee) {
if (log.isErrorEnabled()) {
log.error("Can't read file " + filePath, eee);
}
- }
- finally {
+ } finally {
IOUtils.closeQuietly(in);
}
return sw.toString();
}
-
+
public static ImportExport getInstance(Component view) {
if (exchanger == null) {
exchanger = new ImportExport(view);
+ } else {
+ viewComponent = view;
}
- else {
- viewComponent=view;
- }
return exchanger;
}
-
+
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExportWaitView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExportWaitView.jaxx 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExportWaitView.jaxx 2011-09-17 14:17:04 UTC (rev 3293)
@@ -25,20 +25,20 @@
<JDialog modal="true" id="waitDialog">
- <script>
+ <script>
<![CDATA[
- ]]>
- </script>
+ ]]>
+ </script>
- <Table>
- <row>
- <cell>
- <org.jdesktop.swingx.JXBusyLabel id='busylabel' busy='true'/>
- </cell>
- <cell>
- <JLabel text='lima.importexport.wait'/>
- </cell>
- </row>
- </Table>
+ <Table>
+ <row>
+ <cell>
+ <org.jdesktop.swingx.JXBusyLabel id='busylabel' busy='true'/>
+ </cell>
+ <cell>
+ <JLabel text='lima.importexport.wait'/>
+ </cell>
+ </row>
+ </Table>
</JDialog>
\ No newline at end of file
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerPeriodSearchPanel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerPeriodSearchPanel.java 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerPeriodSearchPanel.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -25,14 +25,6 @@
package org.chorem.lima.ui.ledger;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.util.Calendar;
-import java.util.Date;
-import static org.nuiton.i18n.I18n._;
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
import org.apache.commons.lang.time.DateUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -40,120 +32,130 @@
import org.chorem.lima.entity.FiscalPeriod;
import org.chorem.lima.enums.ComboBoxDatesEnum;
import org.chorem.lima.ui.combobox.FinancialPeriodComboBoxModel;
-import org.chorem.lima.ui.combobox.FinancialPeriodComboBoxRenderer;
import org.chorem.lima.ui.combobox.FiscalPeriodComboBoxModel;
-import org.chorem.lima.ui.combobox.FiscalPeriodComboBoxRenderer;
+import org.chorem.lima.ui.renderers.RendererUtil;
import org.jdesktop.swingx.JXDatePicker;
+import javax.swing.JComboBox;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.ListCellRenderer;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.Calendar;
+import java.util.Date;
+
+import static org.nuiton.i18n.I18n._;
+
public class LedgerPeriodSearchPanel extends JPanel {
-
+
private static final Log log =
- LogFactory.getLog(LedgerPeriodSearchPanel.class);
-
+ LogFactory.getLog(LedgerPeriodSearchPanel.class);
+
protected LedgerViewHandler handler;
-
+
public LedgerPeriodSearchPanel(LedgerViewHandler handler) {
this.handler = handler;
-
+
//init date
refresh(ComboBoxDatesEnum.FISCAL_PERIOD);
}
-
- static final long serialVersionUID = 1L;
- public void refresh(ComboBoxDatesEnum comboBoxPeriodEnum){
-
+ public void refresh(ComboBoxDatesEnum comboBoxPeriodEnum) {
+
switch (comboBoxPeriodEnum) {
- case PERIOD:
- // get begin date
- Calendar calendarBegin = Calendar.getInstance();
- // set begindate to JAN 1 - 0:00.000 of this years
- Date beginDate = calendarBegin.getTime();
- beginDate = DateUtils.truncate(beginDate, Calendar.YEAR);
- //handler().setBeginDate(beginDate);
-
- // get end date
- Calendar calendarEnd = Calendar.getInstance();
- Date endDate = calendarEnd.getTime();
- //handler().setEndDate(endDate);
- JLabel beginDateLabel = new JLabel(_("lima.common.begindate"));
- final JXDatePicker beginDatePicker = new JXDatePicker(beginDate);
- ActionListener beginDateActionListener = new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- handler.setBeginDate(beginDatePicker.getDate());
- handler.refresh();
- }
- };
- handler.setBeginDate(beginDatePicker.getDate());
- beginDatePicker.addActionListener(beginDateActionListener);
-
- JLabel endDateLabel = new JLabel(_("lima.common.enddate"));
- final JXDatePicker endDatePicker = new JXDatePicker(endDate);
- ActionListener endDateActionListener = new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- handler.setEndDate(endDatePicker.getDate());
- handler.refresh();
- }
- };
- handler.setEndDate(endDatePicker.getDate());
- endDatePicker.addActionListener(endDateActionListener);
- handler.refresh();
+ case PERIOD:
+ // get begin date
+ Calendar calendarBegin = Calendar.getInstance();
+ // set begindate to JAN 1 - 0:00.000 of this years
+ Date beginDate = calendarBegin.getTime();
+ beginDate = DateUtils.truncate(beginDate, Calendar.YEAR);
+ //handler().setBeginDate(beginDate);
- removeAll();
- add(beginDateLabel);
- add(beginDatePicker);
- add(endDateLabel);
- add(endDatePicker);
- break;
-
- case FISCAL_PERIOD:
- FiscalPeriodComboBoxModel fiscalModel = new FiscalPeriodComboBoxModel(true);
- FiscalPeriodComboBoxRenderer fiscalRenderer = new FiscalPeriodComboBoxRenderer();
- final JComboBox fiscalPeriod = new JComboBox(fiscalModel);
- fiscalPeriod.setRenderer(fiscalRenderer);
- fiscalPeriod.setEditable(false);
- ActionListener fiscalPeriodActionListener = new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- FiscalPeriod fPeriod = (FiscalPeriod) fiscalPeriod.getSelectedItem();
- if (fPeriod != null){
- handler.setBeginDate(fPeriod.getBeginDate());
- handler.setEndDate(fPeriod.getEndDate());
+ // get end date
+ Calendar calendarEnd = Calendar.getInstance();
+ Date endDate = calendarEnd.getTime();
+ //handler().setEndDate(endDate);
+ JLabel beginDateLabel = new JLabel(_("lima.common.begindate"));
+ final JXDatePicker beginDatePicker = new JXDatePicker(beginDate);
+ ActionListener beginDateActionListener = new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ handler.setBeginDate(beginDatePicker.getDate());
handler.refresh();
}
- }
- };
- fiscalPeriod.addActionListener(fiscalPeriodActionListener);
+ };
+ handler.setBeginDate(beginDatePicker.getDate());
+ beginDatePicker.addActionListener(beginDateActionListener);
- removeAll();
- add(fiscalPeriod);
- break;
-
- case FINANCIAL_PERIOD:
- FinancialPeriodComboBoxModel financialModel = new FinancialPeriodComboBoxModel(true);
- FinancialPeriodComboBoxRenderer financialRenderer = new FinancialPeriodComboBoxRenderer();
- final JComboBox financialPeriod = new JComboBox(financialModel);
- financialPeriod.setRenderer(financialRenderer);
- financialPeriod.setEditable(false);
- ActionListener financialPeriodActionListener = new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- FinancialPeriod fPeriod = (FinancialPeriod) financialPeriod.getSelectedItem();
- if (fPeriod != null){
- handler.setBeginDate(fPeriod.getBeginDate());
- handler.setEndDate(fPeriod.getEndDate());
+ JLabel endDateLabel = new JLabel(_("lima.common.enddate"));
+ final JXDatePicker endDatePicker = new JXDatePicker(endDate);
+ ActionListener endDateActionListener = new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ handler.setEndDate(endDatePicker.getDate());
handler.refresh();
}
- }
- };
- financialPeriod.addActionListener(financialPeriodActionListener);
- removeAll();
- add(financialPeriod);
- break;
+ };
+ handler.setEndDate(endDatePicker.getDate());
+ endDatePicker.addActionListener(endDateActionListener);
+ handler.refresh();
+
+ removeAll();
+ add(beginDateLabel);
+ add(beginDatePicker);
+ add(endDateLabel);
+ add(endDatePicker);
+ break;
+
+ case FISCAL_PERIOD:
+ FiscalPeriodComboBoxModel fiscalModel = new FiscalPeriodComboBoxModel(true);
+ ListCellRenderer renderer =
+ RendererUtil.newDecoratorListCellRenderer(FiscalPeriod.class);
+ final JComboBox fiscalPeriod = new JComboBox(fiscalModel);
+ fiscalPeriod.setRenderer(renderer);
+ fiscalPeriod.setEditable(false);
+ ActionListener fiscalPeriodActionListener = new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ FiscalPeriod fPeriod = (FiscalPeriod) fiscalPeriod.getSelectedItem();
+ if (fPeriod != null) {
+ handler.setBeginDate(fPeriod.getBeginDate());
+ handler.setEndDate(fPeriod.getEndDate());
+ handler.refresh();
+ }
+ }
+ };
+ fiscalPeriod.addActionListener(fiscalPeriodActionListener);
+
+ removeAll();
+ add(fiscalPeriod);
+ break;
+
+ case FINANCIAL_PERIOD:
+ FinancialPeriodComboBoxModel financialModel = new FinancialPeriodComboBoxModel(true);
+ renderer =
+ RendererUtil.newDecoratorListCellRenderer(FinancialPeriod.class);
+ final JComboBox financialPeriod = new JComboBox(financialModel);
+ financialPeriod.setRenderer(renderer);
+ financialPeriod.setEditable(false);
+ ActionListener financialPeriodActionListener = new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ FinancialPeriod fPeriod = (FinancialPeriod) financialPeriod.getSelectedItem();
+ if (fPeriod != null) {
+ handler.setBeginDate(fPeriod.getBeginDate());
+ handler.setEndDate(fPeriod.getEndDate());
+ handler.refresh();
+ }
+ }
+ };
+ financialPeriod.addActionListener(financialPeriodActionListener);
+ removeAll();
+ add(financialPeriod);
+ break;
}
-
+
}
-
+
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerTable.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerTable.java 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerTable.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -25,6 +25,13 @@
package org.chorem.lima.ui.ledger;
+import org.chorem.lima.ui.celleditor.BigDecimalTableCellRenderer;
+import org.jdesktop.swingx.JXTable;
+import org.jdesktop.swingx.decorator.ColorHighlighter;
+import org.jdesktop.swingx.decorator.ComponentAdapter;
+import org.jdesktop.swingx.decorator.HighlightPredicate;
+import org.jdesktop.swingx.decorator.Highlighter;
+
import java.awt.Color;
import java.awt.Component;
import java.awt.event.KeyEvent;
@@ -33,17 +40,10 @@
import java.awt.event.MouseListener;
import java.math.BigDecimal;
-import org.chorem.lima.ui.celleditor.BigDecimalTableCellRenderer;
-import org.jdesktop.swingx.JXTable;
-import org.jdesktop.swingx.decorator.ColorHighlighter;
-import org.jdesktop.swingx.decorator.ComponentAdapter;
-import org.jdesktop.swingx.decorator.HighlightPredicate;
-import org.jdesktop.swingx.decorator.Highlighter;
-
/**
* Table des transaction qui ajoute des comportement (keys).
- *
+ *
* @author ore
* @author Rémi Chapelet
*/
@@ -53,7 +53,7 @@
private static final long serialVersionUID = 3133690382049594727L;
protected LedgerViewHandler handler;
-
+
private Highlighter colorReportsDatas;
/**
@@ -61,13 +61,13 @@
public LedgerTable(LedgerViewHandler handler) {
this.handler = handler;
-
+
addKeyListener(this);
addMouseListener(this);
-
+
//Get new BigDecimal renderer
setDefaultRenderer(BigDecimal.class, new BigDecimalTableCellRenderer());
-
+
//highlight financial financial transactions
addColorReportsDatas();
@@ -78,19 +78,19 @@
* afin de bien distinguer les entête de comptes et les entrées comptables.
* On récupère la première cellule, on vérifie que c'est pas null
*/
- protected void addColorReportsDatas() {
- if (colorReportsDatas != null) {
- removeHighlighter(colorReportsDatas);
- }
- HighlightPredicate predicate = new HighlightPredicate() {
- @Override
- public boolean isHighlighted(Component renderer,
- ComponentAdapter adapter) {
- return adapter.getValueAt(adapter.row, 0) != null;
- }
- };
- colorReportsDatas =
- new ColorHighlighter(predicate, new Color(222,222,222), null);
+ protected void addColorReportsDatas() {
+ if (colorReportsDatas != null) {
+ removeHighlighter(colorReportsDatas);
+ }
+ HighlightPredicate predicate = new HighlightPredicate() {
+ @Override
+ public boolean isHighlighted(Component renderer,
+ ComponentAdapter adapter) {
+ return adapter.getValueAt(adapter.row, 0) != null;
+ }
+ };
+ colorReportsDatas =
+ new ColorHighlighter(predicate, new Color(222, 222, 222), null);
addHighlighter(colorReportsDatas);
}
@@ -129,9 +129,9 @@
public void keyPressed(KeyEvent e) {
// clear row selection with the key: escape
if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
- if (!isEditing()) {
+ if (!isEditing()) {
clearSelection();
- }
+ }
}
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerTableModel.java 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerTableModel.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -25,13 +25,6 @@
package org.chorem.lima.ui.ledger;
-import static org.nuiton.i18n.I18n._;
-
-import java.math.BigDecimal;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.List;
-import javax.swing.table.AbstractTableModel;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.beans.ReportsDatas;
@@ -39,15 +32,23 @@
import org.chorem.lima.entity.Entry;
import org.chorem.lima.entity.EntryBook;
+import javax.swing.table.AbstractTableModel;
+import java.math.BigDecimal;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
+
+import static org.nuiton.i18n.I18n._;
+
/**
* Entry book table model.
- *
+ *
* @author ore
* @author chatellier
* @version $Revision$
- *
- * Last update : $Date$
- * By : $Author$
+ * <p/>
+ * Last update : $Date$
+ * By : $Author$
*/
public class LedgerTableModel extends AbstractTableModel {
@@ -56,14 +57,14 @@
/** log. */
private static final Log log = LogFactory.getLog(LedgerTableModel.class);
-
+
/** data cache */
protected List<Object> cacheDataList;
@Override
public int getRowCount() {
int result = 0;
-
+
// just prevent too much result
if (cacheDataList != null) {
result = cacheDataList.size();
@@ -76,44 +77,43 @@
public int getColumnCount() {
return 8;
}
-
+
@Override
public Class<?> getColumnClass(int column) {
Class<?> result = null;
switch (column) {
- case 0:
- result = Account.class;
- break;
- case 1:
- result = Date.class;
- break;
- case 2:
- result = EntryBook.class;
- break;
- case 3:
- result = String.class;
- break;
- case 4:
- result = String.class;
- break;
- case 5:
- result = BigDecimal.class;
- break;
- case 6:
- result = BigDecimal.class;
- break;
- case 7:
- result = BigDecimal.class;
- break;
+ case 0:
+ result = Account.class;
+ break;
+ case 1:
+ result = Date.class;
+ break;
+ case 2:
+ result = EntryBook.class;
+ break;
+ case 3:
+ result = String.class;
+ break;
+ case 4:
+ result = String.class;
+ break;
+ case 5:
+ result = BigDecimal.class;
+ break;
+ case 6:
+ result = BigDecimal.class;
+ break;
+ case 7:
+ result = BigDecimal.class;
+ break;
}
return result;
}
-
-
+
@Override
public String getColumnName(int column) {
String res = "n/a";
@@ -145,114 +145,110 @@
}
return res;
}
-
+
@Override
public Object getValueAt(int row, int column) {
Object result = null;
-
+
// just prevent too much result
if (cacheDataList != null) {
result = cacheDataList.get(row);
SimpleDateFormat simpleDateFormat
- = new SimpleDateFormat("dd MMMMM yyyy");
-
+ = new SimpleDateFormat("dd MMMMM yyyy");
+
if (result instanceof ReportsDatas) {
- ReportsDatas currentRow = (ReportsDatas)result;
+ ReportsDatas currentRow = (ReportsDatas) result;
BigDecimal amountDebit = currentRow.getAmountDebit();
BigDecimal amountCredit = currentRow.getAmountCredit();
-
+
switch (column) {
- case 0:
- if (currentRow.getAccount() != null){
- result = currentRow.getAccount().getAccountNumber();
- }
- else {
- result = null;
- }
- break;
- case 1:
- result = null; // date
- break;
- case 2:
- result = null; //entrybook
- break;
- case 3:
- result = null; // voucher
- break;
- case 4:
- result = null; // description
- break;
- case 5 :
- result = amountDebit; // position
- break;
- case 6:
- result = amountCredit;
- break;
- case 7:
- result = amountDebit.subtract(amountCredit);
- break;
+ case 0:
+ if (currentRow.getAccount() != null) {
+ result = currentRow.getAccount().getAccountNumber();
+ } else {
+ result = null;
+ }
+ break;
+ case 1:
+ result = null; // date
+ break;
+ case 2:
+ result = null; //entrybook
+ break;
+ case 3:
+ result = null; // voucher
+ break;
+ case 4:
+ result = null; // description
+ break;
+ case 5:
+ result = amountDebit; // position
+ break;
+ case 6:
+ result = amountCredit;
+ break;
+ case 7:
+ result = amountDebit.subtract(amountCredit);
+ break;
}
- }
- else if (result instanceof Entry) {
- Entry currentRow = (Entry)result;
+ } else if (result instanceof Entry) {
+ Entry currentRow = (Entry) result;
BigDecimal amountDebit = BigDecimal.ZERO,
- amountCredit = BigDecimal.ZERO;
- if (currentRow.getDebit()){
+ amountCredit = BigDecimal.ZERO;
+ if (currentRow.getDebit()) {
amountDebit = currentRow.getAmount();
- }
- else {
+ } else {
amountCredit = currentRow.getAmount();
}
switch (column) {
- case 0:
- result = null; // account
- break;
- case 1 : // date
- result = simpleDateFormat.
- format(currentRow.getFinancialTransaction().getTransactionDate());
- break;
- case 2:
- if (currentRow.getFinancialTransaction().getEntryBook() != null){
- result = currentRow.getFinancialTransaction().getEntryBook().getCode();
- }
- else { //entrybook
- result = null;
- }
- break;
- case 3: // description
- result = currentRow.getVoucher();
- break;
- case 4:
- result = currentRow.getDescription();
- break;
- case 5 :
- result = amountDebit;
- break;
- case 6:
- result = amountCredit;
- break;
- case 7:
- result = amountDebit.subtract(amountCredit);
- break;
+ case 0:
+ result = null; // account
+ break;
+ case 1: // date
+ result = simpleDateFormat.
+ format(currentRow.getFinancialTransaction().getTransactionDate());
+ break;
+ case 2:
+ if (currentRow.getFinancialTransaction().getEntryBook() != null) {
+ result = currentRow.getFinancialTransaction().getEntryBook().getCode();
+ } else { //entrybook
+ result = null;
+ }
+ break;
+ case 3: // description
+ result = currentRow.getVoucher();
+ break;
+ case 4:
+ result = currentRow.getDescription();
+ break;
+ case 5:
+ result = amountDebit;
+ break;
+ case 6:
+ result = amountCredit;
+ break;
+ case 7:
+ result = amountDebit.subtract(amountCredit);
+ break;
}
-
+
}
}
return result;
}
-
+
@Override
public boolean isCellEditable(int rowIndex, int columnIndex) {
// Just read, no write
return false;
}
-
-
- public void refresh(List<Object> datasList){
+
+
+ public void refresh(List<Object> datasList) {
cacheDataList = datasList;
fireTableDataChanged();
}
-
+
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerView.jaxx 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerView.jaxx 2011-09-17 14:17:04 UTC (rev 3293)
@@ -24,11 +24,11 @@
-->
<Table>
- <LedgerViewHandler id="handler" javaBean="new LedgerViewHandler(this)" />
- <Boolean id="selectedRow" javaBean="false" />
- <org.chorem.lima.ui.combobox.EntryBookComboBoxModel id="modelEntryBook"/>
- <org.chorem.lima.ui.ledger.LedgerTableModel id="modelTable"/>
- <script>
+ <LedgerViewHandler id="handler" javaBean="new LedgerViewHandler(this)"/>
+ <Boolean id="selectedRow" javaBean="false"/>
+ <org.chorem.lima.ui.combobox.EntryBookComboBoxModel id="modelEntryBook"/>
+ <org.chorem.lima.ui.ledger.LedgerTableModel id="modelTable"/>
+ <script>
<![CDATA[
import org.chorem.lima.enums.ComboBoxDatesEnum;
LedgerPeriodSearchPanel periodSearchPanel = new LedgerPeriodSearchPanel(handler);
@@ -37,71 +37,83 @@
}
]]>
- </script>
- <row weightx="1" weighty="0" anchor="center">
- <cell fill='both'><Table><row>
- <cell anchor="west"><JComboBox id="periodComboBox" javaBean="new JComboBox(ComboBoxDatesEnum.descriptions())"
- onActionPerformed="periodSearchPanel.refresh(ComboBoxDatesEnum.valueOfDescription((String) periodComboBox.getSelectedItem()));
- validate(); repaint()"/></cell>
- <cell><LedgerPeriodSearchPanel javaBean="periodSearchPanel"/></cell>
- </row></Table></cell>
- <cell anchor="east">
- <JLabel text="lima.common.filter"/>
- </cell>
- <cell anchor="west">
- <JTextField id='balanceFilter' toolTipText="lima.tooltip.filter" minimumSize='{balanceFilter.getPreferredSize()}'/>
- <javax.swing.text.Document javaBean="balanceFilter.getDocument()"
- onInsertUpdate='handler.setAccountFilter(balanceFilter.getText())'
- onRemoveUpdate='handler.setAccountFilter(balanceFilter.getText())' />
- </cell>
- <cell anchor="center">
- <JCheckBox id='movmentedFilter' text='lima.common.movmentedfilter' selected='false'
- onActionPerformed="getHandler().refresh()"/>
- </cell>
- <cell>
- <EnumEditor id='DocumentEditor'
- constructorParams='org.chorem.lima.business.utils.FormatsEnum.class'/>
- </cell>
- <cell>
- <JButton text="lima.common.ok"
- onActionPerformed="getHandler().createDocument()"/>
- </cell>
- </row>
- <row>
- <cell fill="both" weightx="1" weighty="1" columns="8">
- <JScrollPane>
- <org.chorem.lima.ui.ledger.LedgerTable
- id="table" sortable="false" rowHeight="24"
- constructorParams="getHandler()" model="{getModelTable()}"
- selectionMode="{ListSelectionModel.SINGLE_SELECTION}" />
- <javax.swing.ListSelectionModel javaBean="getTable().getSelectionModel()"/>
- </JScrollPane>
- </cell>
- </row>
- <row>
- <cell fill="horizontal" weightx="1" columns="7">
- <Table>
- <row fill="horizontal" weightx="1">
- <cell>
- <JLabel text="lima.common.amountdebit" />
- </cell>
- <cell>
- <JLabel id="amountDebitLabel" />
- </cell>
- <cell>
- <JLabel text="lima.common.amountcredit"/>
- </cell>
- <cell>
- <JLabel id="amountCreditLabel" />
- </cell>
- <cell>
- <JLabel id="soldeLabel" text="lima.common.solde"/>
- </cell>
- <cell>
- <JLabel id="amountSoldeLabel"/>
- </cell>
- </row>
- </Table>
- </cell>
- </row>
+ </script>
+ <row weightx="1" weighty="0" anchor="center">
+ <cell fill='both'>
+ <Table>
+ <row>
+ <cell anchor="west">
+ <JComboBox id="periodComboBox"
+ javaBean="new JComboBox(ComboBoxDatesEnum.descriptions())"
+ onActionPerformed="periodSearchPanel.refresh(ComboBoxDatesEnum.valueOfDescription((String) periodComboBox.getSelectedItem()));
+ validate(); repaint()"/>
+ </cell>
+ <cell>
+ <LedgerPeriodSearchPanel javaBean="periodSearchPanel"/>
+ </cell>
+ </row>
+ </Table>
+ </cell>
+ <cell anchor="east">
+ <JLabel text="lima.common.filter"/>
+ </cell>
+ <cell anchor="west">
+ <JTextField id='balanceFilter' toolTipText="lima.tooltip.filter"
+ minimumSize='{balanceFilter.getPreferredSize()}'/>
+ <javax.swing.text.Document javaBean="balanceFilter.getDocument()"
+ onInsertUpdate='handler.setAccountFilter(balanceFilter.getText())'
+ onRemoveUpdate='handler.setAccountFilter(balanceFilter.getText())'/>
+ </cell>
+ <cell anchor="center">
+ <JCheckBox id='movmentedFilter' text='lima.common.movmentedfilter'
+ selected='false'
+ onActionPerformed="getHandler().refresh()"/>
+ </cell>
+ <cell>
+ <EnumEditor id='DocumentEditor'
+ constructorParams='org.chorem.lima.business.utils.FormatsEnum.class'/>
+ </cell>
+ <cell>
+ <JButton text="lima.common.ok"
+ onActionPerformed="getHandler().createDocument()"/>
+ </cell>
+ </row>
+ <row>
+ <cell fill="both" weightx="1" weighty="1" columns="8">
+ <JScrollPane>
+ <org.chorem.lima.ui.ledger.LedgerTable
+ id="table" sortable="false" rowHeight="24"
+ constructorParams="getHandler()" model="{getModelTable()}"
+ selectionMode="{ListSelectionModel.SINGLE_SELECTION}"/>
+ <javax.swing.ListSelectionModel
+ javaBean="getTable().getSelectionModel()"/>
+ </JScrollPane>
+ </cell>
+ </row>
+ <row>
+ <cell fill="horizontal" weightx="1" columns="7">
+ <Table>
+ <row fill="horizontal" weightx="1">
+ <cell>
+ <JLabel text="lima.common.amountdebit"/>
+ </cell>
+ <cell>
+ <JLabel id="amountDebitLabel"/>
+ </cell>
+ <cell>
+ <JLabel text="lima.common.amountcredit"/>
+ </cell>
+ <cell>
+ <JLabel id="amountCreditLabel"/>
+ </cell>
+ <cell>
+ <JLabel id="soldeLabel" text="lima.common.solde"/>
+ </cell>
+ <cell>
+ <JLabel id="amountSoldeLabel"/>
+ </cell>
+ </row>
+ </Table>
+ </cell>
+ </row>
</Table>
\ No newline at end of file
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerViewHandler.java 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerViewHandler.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -25,20 +25,6 @@
package org.chorem.lima.ui.ledger;
-import static org.nuiton.i18n.I18n._;
-import java.awt.Desktop;
-import java.io.IOException;
-import java.math.BigDecimal;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Date;
-import java.util.List;
-
-import javax.swing.JOptionPane;
-
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.LimaConfig;
@@ -60,7 +46,21 @@
import org.chorem.lima.service.LimaServiceFactory;
import org.chorem.lima.util.ErrorHelper;
+import javax.swing.JOptionPane;
+import java.awt.Desktop;
+import java.io.IOException;
+import java.math.BigDecimal;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
+import static org.nuiton.i18n.I18n._;
+
+
/**
* Handler associated with accounts reports view.
* By : $Author$
@@ -70,89 +70,91 @@
protected LedgerView view;
protected LedgerTableModel model;
-
+
/** log. */
private static final Log log = LogFactory.getLog(LedgerTableModel.class);
/** Services. */
protected ReportServiceMonitorable reportService;
+
protected DocumentServiceMonitorable documentService;
+
protected FiscalPeriodServiceMonitorable fiscalPeriodService;
-
+
/** Begin Date. */
protected Date selectedBeginDate;
-
+
/** EndDate. */
protected Date selectedEndDate;
-
+
/** Text field Accounts */
protected String selectedAccounts;
-
+
protected BalanceTrial balanceTrialCache;
private static SimpleDateFormat dateFormat =
- new SimpleDateFormat("yyyy-MM-dd");
-
+ new SimpleDateFormat("yyyy-MM-dd");
+
protected int port;
-
+
protected List<Object> cachedatasList;
-
+
protected LedgerViewHandler(LedgerView view) {
this.view = view;
-
+
reportService =
- LimaServiceFactory.getInstance().getService(
- ReportServiceMonitorable.class);
+ LimaServiceFactory.getInstance().getService(
+ ReportServiceMonitorable.class);
reportService.addServiceListener(this);
port = LimaServiceFactory.getInstance().getService(
HttpServerServiceMonitorable.class).getHttpPort();
documentService =
- LimaServiceFactory.getInstance().getService(
- DocumentServiceMonitorable.class);
+ LimaServiceFactory.getInstance().getService(
+ DocumentServiceMonitorable.class);
fiscalPeriodService =
- LimaServiceFactory.getInstance().getService(
- FiscalPeriodServiceMonitorable.class);
+ LimaServiceFactory.getInstance().getService(
+ FiscalPeriodServiceMonitorable.class);
LimaServiceFactory.getInstance().getService(
ImportServiceMonitorable.class).addServiceListener(this);
LimaServiceFactory.getInstance().getService(
FinancialTransactionServiceMonitorable.class).addServiceListener(this);
}
-
- public void setBeginDate(Date date){
+
+ public void setBeginDate(Date date) {
selectedBeginDate = date;
}
-
- public void setEndDate(Date date){
+
+ public void setEndDate(Date date) {
selectedEndDate = date;
}
-
+
public void setAccountFilter(String accounts) {
selectedAccounts = accounts;
refresh();
}
-
+
/**
* get all account fot the selected period
+ *
* @return
*/
- public List<Object> getDataList(){
+ public List<Object> getDataList() {
List<Object> results = new ArrayList<Object>();
try {
balanceTrialCache = reportService.generateLedger(selectedBeginDate,
- selectedEndDate, selectedAccounts,
- view.getMovmentedFilter().isSelected());
- if (balanceTrialCache.getReportsDatas() != null){
- for (ReportsDatas reportsDatas : balanceTrialCache.getReportsDatas()) {
+ selectedEndDate, selectedAccounts,
+ view.getMovmentedFilter().isSelected());
+ if (balanceTrialCache.getReportsDatas() != null) {
+ for (ReportsDatas reportsDatas : balanceTrialCache.getReportsDatas()) {
results.add(reportsDatas);
List<Entry> entries = reportsDatas.getListEntry();
- if (entries != null){
+ if (entries != null) {
Collections.sort(entries, new EntryComparator());
- results.addAll(entries);
+ results.addAll(entries);
}
}
}
- }
- catch (LimaException eee) {
+ } catch (LimaException eee) {
if (log.isErrorEnabled()) {
log.debug("Can't update model", eee);
}
@@ -160,47 +162,45 @@
}
return results;
}
-
- public void refresh(){
- if (selectedBeginDate != null && selectedEndDate != null){
+
+ public void refresh() {
+ if (selectedBeginDate != null && selectedEndDate != null) {
model = view.getModelTable();
cachedatasList = getDataList();
model.refresh(cachedatasList);
-
- /**
- * set text and amounts of labels credit, debit, solde
- */
-
- if (balanceTrialCache != null){
+
+ /**
+ * set text and amounts of labels credit, debit, solde
+ */
+
+ if (balanceTrialCache != null) {
// set amounts credit, debit and solde
view.amountCreditLabel.setText(
String.valueOf(balanceTrialCache.getAmountCredit()));
view.amountDebitLabel.setText(
- String.valueOf(balanceTrialCache.getAmountDebit()));
+ String.valueOf(balanceTrialCache.getAmountDebit()));
BigDecimal amountSolde = balanceTrialCache.getAmountSolde();
view.amountSoldeLabel.setText(
String.valueOf(amountSolde));
-
- if (amountSolde == BigDecimal.ZERO){
+
+ if (amountSolde == BigDecimal.ZERO) {
view.soldeLabel.setText(_("lima.common.solde"));
- }
- else {
+ } else {
// set label solde: credit or debit
if (balanceTrialCache.getSoldeDebit()) {
view.soldeLabel.setText(_("lima.common.soldedebit"));
- }
- else {
+ } else {
view.soldeLabel.setText(_("lima.common.soldecredit"));
}
}
}
}
}
-
+
public void createDocument() {
-
- if (selectedBeginDate != null && selectedEndDate != null){
-
+
+ if (selectedBeginDate != null && selectedEndDate != null) {
+
//looks for all blocked fiscal periods
List<FiscalPeriod> blockedFiscalPeriods = new ArrayList<FiscalPeriod>();
try {
@@ -211,18 +211,18 @@
}
ErrorHelper.showErrorDialog(_("lima.ledger.documentcreationerror"), eee);
}
-
+
//tells if the fiscaPeriod as been found and is blocked
boolean error = true;
-
+
for (FiscalPeriod blockedFiscalPeriod : blockedFiscalPeriods) {
if (blockedFiscalPeriod.getBeginDate().equals(selectedBeginDate)
- && blockedFiscalPeriod.getEndDate().equals(selectedEndDate)
- && blockedFiscalPeriod.getLocked()) {
+ && blockedFiscalPeriod.getEndDate().equals(selectedEndDate)
+ && blockedFiscalPeriod.getLocked()) {
error = false;
}
}
-
+
//shows error message to user if the fiscalPeriod is unblocked
if (error) {
JOptionPane.showMessageDialog(
@@ -231,17 +231,17 @@
_("lima.common.error"),
JOptionPane.ERROR_MESSAGE);
} else {
-
+
FormatsEnum selectedEnum = (FormatsEnum) view.getDocumentEditor().getSelectedItem();
String address = LimaConfig.getInstance().getHostAdress();
-
+
try {
- String url = "http://"+address+":"+port+"/?beginDate="
- + dateFormat.format(selectedBeginDate)
- + "&endDate="+dateFormat.format(selectedEndDate)
- + "&format="+selectedEnum.getExtension()+"&model="
- + DocumentsEnum.LEDGER.getFileName();
- Desktop.getDesktop().browse(new URI(url));
+ String url = "http://" + address + ":" + port + "/?beginDate="
+ + dateFormat.format(selectedBeginDate)
+ + "&endDate=" + dateFormat.format(selectedEndDate)
+ + "&format=" + selectedEnum.getExtension() + "&model="
+ + DocumentsEnum.LEDGER.getFileName();
+ Desktop.getDesktop().browse(new URI(url));
} catch (IOException e) {
log.error("Can't open browser", e);
} catch (URISyntaxException e) {
@@ -250,12 +250,12 @@
}
}
}
-
+
@Override
public void notifyMethod(String serviceName, String methodeName) {
- if (serviceName.contains("FinancialTransaction") || methodeName.contains("importAccount") || methodeName.contains("importAll")){
+ if (serviceName.contains("FinancialTransaction") || methodeName.contains("importAccount") || methodeName.contains("importAll")) {
refresh();
}
}
-
+
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/AddLetterForm.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/AddLetterForm.jaxx 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/AddLetterForm.jaxx 2011-09-17 14:17:04 UTC (rev 3293)
@@ -29,7 +29,7 @@
<import>
jaxx.runtime.swing.JAXXButtonGroup
</import>
-
+
<JAXXButtonGroup id="radioButtons" javaBean='new JAXXButtonGroup()'/>
<Boolean id="validOk" javaBean='true'/>
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetterComboBox.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetterComboBox.java 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetterComboBox.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -25,30 +25,34 @@
package org.chorem.lima.ui.lettering;
-import javax.swing.JComboBox;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.chorem.lima.entity.Letter;
import org.chorem.lima.ui.combobox.LetterComboBoxModel;
-import org.chorem.lima.ui.combobox.LetterRenderer;
+import org.chorem.lima.ui.renderers.RendererUtil;
import org.chorem.lima.util.LetterToString;
import org.jdesktop.swingx.autocomplete.AutoCompleteDecorator;
+import javax.swing.JComboBox;
+import javax.swing.ListCellRenderer;
+
public class LetterComboBox extends JComboBox {
private static final long serialVersionUID = 1L;
private static final Log log =
- LogFactory.getLog(LetterComboBox.class);
-
-
+ LogFactory.getLog(LetterComboBox.class);
+
+
public LetterComboBox() {
-
+
LetterComboBoxModel letterComboBoxModel = new LetterComboBoxModel();
- LetterRenderer letterRenderer = new LetterRenderer();
+ ListCellRenderer renderer =
+ RendererUtil.newDecoratorListCellRenderer(Letter.class);
setModel(letterComboBoxModel);
- setRenderer(letterRenderer);
+ setRenderer(renderer);
setEditable(true);
AutoCompleteDecorator.decorate(this, LetterToString.getInstance());
}
-
+
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringPeriodSearchPanel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringPeriodSearchPanel.java 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringPeriodSearchPanel.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -24,15 +24,6 @@
*/
package org.chorem.lima.ui.lettering;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.util.Calendar;
-import java.util.Date;
-import static org.nuiton.i18n.I18n._;
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-
import org.apache.commons.lang.time.DateUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -40,120 +31,130 @@
import org.chorem.lima.entity.FiscalPeriod;
import org.chorem.lima.enums.ComboBoxDatesEnum;
import org.chorem.lima.ui.combobox.FinancialPeriodComboBoxModel;
-import org.chorem.lima.ui.combobox.FinancialPeriodComboBoxRenderer;
import org.chorem.lima.ui.combobox.FiscalPeriodComboBoxModel;
-import org.chorem.lima.ui.combobox.FiscalPeriodComboBoxRenderer;
+import org.chorem.lima.ui.renderers.RendererUtil;
import org.jdesktop.swingx.JXDatePicker;
+import javax.swing.JComboBox;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.ListCellRenderer;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.Calendar;
+import java.util.Date;
+
+import static org.nuiton.i18n.I18n._;
+
public class LetteringPeriodSearchPanel extends JPanel {
-
+
private static final Log log =
- LogFactory.getLog(LetteringPeriodSearchPanel.class);
-
+ LogFactory.getLog(LetteringPeriodSearchPanel.class);
+
protected LetteringViewHandler handler;
-
+
public LetteringPeriodSearchPanel(LetteringViewHandler handler) {
this.handler = handler;
-
+
//init date
refresh(ComboBoxDatesEnum.FISCAL_PERIOD);
}
-
- static final long serialVersionUID = 1L;
- public void refresh(ComboBoxDatesEnum comboBoxPeriodEnum){
-
+ public void refresh(ComboBoxDatesEnum comboBoxPeriodEnum) {
+
switch (comboBoxPeriodEnum) {
- case PERIOD:
- // get begin date
- Calendar calendarBegin = Calendar.getInstance();
- // set begindate to JAN 1 - 0:00.000 of this years
- Date beginDate = calendarBegin.getTime();
- beginDate = DateUtils.truncate(beginDate, Calendar.YEAR);
- //handler().setBeginDate(beginDate);
-
- // get end date
- Calendar calendarEnd = Calendar.getInstance();
- Date endDate = calendarEnd.getTime();
- //handler().setEndDate(endDate);
- JLabel beginDateLabel = new JLabel(_("lima.common.begindate"));
- final JXDatePicker beginDatePicker = new JXDatePicker(beginDate);
- ActionListener beginDateActionListener = new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- handler.setBeginDate(beginDatePicker.getDate());
- handler.refresh();
- }
- };
- handler.setBeginDate(beginDatePicker.getDate());
- beginDatePicker.addActionListener(beginDateActionListener);
-
- JLabel endDateLabel = new JLabel(_("lima.common.enddate"));
- final JXDatePicker endDatePicker = new JXDatePicker(endDate);
- ActionListener endDateActionListener = new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- handler.setEndDate(endDatePicker.getDate());
- handler.refresh();
- }
- };
- handler.setEndDate(endDatePicker.getDate());
- endDatePicker.addActionListener(endDateActionListener);
- handler.refresh();
+ case PERIOD:
+ // get begin date
+ Calendar calendarBegin = Calendar.getInstance();
+ // set begindate to JAN 1 - 0:00.000 of this years
+ Date beginDate = calendarBegin.getTime();
+ beginDate = DateUtils.truncate(beginDate, Calendar.YEAR);
+ //handler().setBeginDate(beginDate);
- removeAll();
- add(beginDateLabel);
- add(beginDatePicker);
- add(endDateLabel);
- add(endDatePicker);
- break;
-
- case FISCAL_PERIOD:
- FiscalPeriodComboBoxModel fiscalModel = new FiscalPeriodComboBoxModel(true);
- FiscalPeriodComboBoxRenderer fiscalRenderer = new FiscalPeriodComboBoxRenderer();
- final JComboBox fiscalPeriod = new JComboBox(fiscalModel);
- fiscalPeriod.setRenderer(fiscalRenderer);
- fiscalPeriod.setEditable(false);
- ActionListener fiscalPeriodActionListener = new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- FiscalPeriod fPeriod = (FiscalPeriod) fiscalPeriod.getSelectedItem();
- if (fPeriod != null){
- handler.setBeginDate(fPeriod.getBeginDate());
- handler.setEndDate(fPeriod.getEndDate());
+ // get end date
+ Calendar calendarEnd = Calendar.getInstance();
+ Date endDate = calendarEnd.getTime();
+ //handler().setEndDate(endDate);
+ JLabel beginDateLabel = new JLabel(_("lima.common.begindate"));
+ final JXDatePicker beginDatePicker = new JXDatePicker(beginDate);
+ ActionListener beginDateActionListener = new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ handler.setBeginDate(beginDatePicker.getDate());
handler.refresh();
}
- }
- };
- fiscalPeriod.addActionListener(fiscalPeriodActionListener);
+ };
+ handler.setBeginDate(beginDatePicker.getDate());
+ beginDatePicker.addActionListener(beginDateActionListener);
- removeAll();
- add(fiscalPeriod);
- break;
-
- case FINANCIAL_PERIOD:
- FinancialPeriodComboBoxModel financialModel = new FinancialPeriodComboBoxModel(true);
- FinancialPeriodComboBoxRenderer financialRenderer = new FinancialPeriodComboBoxRenderer();
- final JComboBox financialPeriod = new JComboBox(financialModel);
- financialPeriod.setRenderer(financialRenderer);
- financialPeriod.setEditable(false);
- ActionListener financialPeriodActionListener = new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- FinancialPeriod fPeriod = (FinancialPeriod) financialPeriod.getSelectedItem();
- if (fPeriod != null){
- handler.setBeginDate(fPeriod.getBeginDate());
- handler.setEndDate(fPeriod.getEndDate());
+ JLabel endDateLabel = new JLabel(_("lima.common.enddate"));
+ final JXDatePicker endDatePicker = new JXDatePicker(endDate);
+ ActionListener endDateActionListener = new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ handler.setEndDate(endDatePicker.getDate());
handler.refresh();
}
- }
- };
- financialPeriod.addActionListener(financialPeriodActionListener);
- removeAll();
- add(financialPeriod);
- break;
+ };
+ handler.setEndDate(endDatePicker.getDate());
+ endDatePicker.addActionListener(endDateActionListener);
+ handler.refresh();
+
+ removeAll();
+ add(beginDateLabel);
+ add(beginDatePicker);
+ add(endDateLabel);
+ add(endDatePicker);
+ break;
+
+ case FISCAL_PERIOD:
+ FiscalPeriodComboBoxModel fiscalModel = new FiscalPeriodComboBoxModel(true);
+ ListCellRenderer renderer =
+ RendererUtil.newDecoratorListCellRenderer(FiscalPeriod.class);
+ final JComboBox fiscalPeriod = new JComboBox(fiscalModel);
+ fiscalPeriod.setRenderer(renderer);
+ fiscalPeriod.setEditable(false);
+ ActionListener fiscalPeriodActionListener = new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ FiscalPeriod fPeriod = (FiscalPeriod) fiscalPeriod.getSelectedItem();
+ if (fPeriod != null) {
+ handler.setBeginDate(fPeriod.getBeginDate());
+ handler.setEndDate(fPeriod.getEndDate());
+ handler.refresh();
+ }
+ }
+ };
+ fiscalPeriod.addActionListener(fiscalPeriodActionListener);
+
+ removeAll();
+ add(fiscalPeriod);
+ break;
+
+ case FINANCIAL_PERIOD:
+ FinancialPeriodComboBoxModel financialModel = new FinancialPeriodComboBoxModel(true);
+ renderer =
+ RendererUtil.newDecoratorListCellRenderer(FinancialPeriod.class);
+ final JComboBox financialPeriod = new JComboBox(financialModel);
+ financialPeriod.setRenderer(renderer);
+ financialPeriod.setEditable(false);
+ ActionListener financialPeriodActionListener = new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ FinancialPeriod fPeriod = (FinancialPeriod) financialPeriod.getSelectedItem();
+ if (fPeriod != null) {
+ handler.setBeginDate(fPeriod.getBeginDate());
+ handler.setEndDate(fPeriod.getEndDate());
+ handler.refresh();
+ }
+ }
+ };
+ financialPeriod.addActionListener(financialPeriodActionListener);
+ removeAll();
+ add(financialPeriod);
+ break;
}
-
+
}
-
+
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTable.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTable.java 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTable.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -25,15 +25,6 @@
package org.chorem.lima.ui.lettering;
-import java.awt.Color;
-import java.awt.Component;
-import java.awt.event.KeyEvent;
-import java.awt.event.KeyListener;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-import java.math.BigDecimal;
-import java.util.Date;
-
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.entity.Account;
@@ -51,10 +42,19 @@
import org.jdesktop.swingx.decorator.HighlightPredicate;
import org.jdesktop.swingx.decorator.Highlighter;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.math.BigDecimal;
+import java.util.Date;
+
/**
* Table des transaction qui ajoute des comportement (keys).
- *
+ *
* @author jpepin
*/
public class LetteringTable extends JXTable
@@ -62,7 +62,7 @@
/** serialVersionUID. */
private static final long serialVersionUID = 3133690382049594727L;
-
+
/** log. */
private static final Log log = LogFactory
.getLog(LetteringTable.class);
@@ -72,14 +72,14 @@
private Highlighter colorTransaction;
private ColorHighlighter colorBalance;
-
+
public LetteringTable(LetteringViewHandler handler) {
this.handler = handler;
-
+
addKeyListener(this);
addMouseListener(this);
-
+
//Get new date editor
setDefaultEditor(Date.class, new DateTableCellEditor());
//Get new entry book editor
@@ -92,38 +92,37 @@
setDefaultEditor(BigDecimal.class, new BigDecimalTableCellEditor());
//Get new BigDecimal renderer
setDefaultRenderer(BigDecimal.class, new BigDecimalTableCellRenderer());
-
+
//highlight financial financial transactions
addColorTransaction();
// highlight unbalanced financial transactions
addColorNonBalancedTransaction();
-
-
+
+
}
-
+
/**
* Cette méthode permet de colorer toutes les transactions dans le tableau
* afin de bien distinguer les transactions et entrées comptables.
* On récupère la première cellule, on vérifie que c'est une date
*/
- protected void addColorTransaction() {
- if (colorTransaction != null) {
- removeHighlighter(colorTransaction);
- }
- HighlightPredicate predicate = new HighlightPredicate() {
- @Override
- public boolean isHighlighted(Component renderer,
- ComponentAdapter adapter) {
- return adapter.getValueAt(adapter.row, 0) instanceof Date;
- }
- };
+ protected void addColorTransaction() {
+ if (colorTransaction != null) {
+ removeHighlighter(colorTransaction);
+ }
+ HighlightPredicate predicate = new HighlightPredicate() {
+ @Override
+ public boolean isHighlighted(Component renderer,
+ ComponentAdapter adapter) {
+ return adapter.getValueAt(adapter.row, 0) instanceof Date;
+ }
+ };
colorTransaction =
- new ColorHighlighter(predicate, new Color(222,222,222), null);
+ new ColorHighlighter(predicate, new Color(222, 222, 222), null);
addHighlighter(colorTransaction);
}
-
-
+
/**
* Permet de surligner une transaction dans le tableau lorsque
* cette dernière n'est pas équilibrée.
@@ -137,7 +136,7 @@
HighlightPredicate predicate = new HighlightPredicate() {
@Override
public boolean isHighlighted(Component renderer,
- ComponentAdapter adapter) {
+ ComponentAdapter adapter) {
boolean isHighlighted = false;
Object value = adapter.getValueAt(adapter.row, 8);
if (value instanceof BigDecimal) {
@@ -151,8 +150,8 @@
return isHighlighted;
}
};
- colorTransaction =
- new ColorHighlighter(predicate, new Color(255, 198, 209), null);
+ colorTransaction =
+ new ColorHighlighter(predicate, new Color(255, 198, 209), null);
addHighlighter(colorTransaction);
}
@@ -163,20 +162,20 @@
@Override
public void keyPressed(KeyEvent e) {
-
+
// add letter with the key combination : ctrl + L
- if (e.getKeyCode() == KeyEvent.VK_L
+ if (e.getKeyCode() == KeyEvent.VK_L
&& e.getModifiers() == KeyEvent.CTRL_MASK) {
handler.addLetter();
}
-
+
// clear row selection with the key: escape
if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
- if (!isEditing()) {
+ if (!isEditing()) {
clearSelection();
- }
+ }
}
-
+
}
@@ -189,28 +188,28 @@
public void keyReleased(KeyEvent e) {
}
- @Override
- public void mouseClicked(MouseEvent e) {
- }
+ @Override
+ public void mouseClicked(MouseEvent e) {
+ }
- @Override
- public void mousePressed(MouseEvent e) {
+ @Override
+ public void mousePressed(MouseEvent e) {
if (rowAtPoint(e.getPoint()) == -1) {
clearSelection();
}
- }
+ }
- @Override
- public void mouseReleased(MouseEvent e) {
- }
+ @Override
+ public void mouseReleased(MouseEvent e) {
+ }
- @Override
- public void mouseEntered(MouseEvent e) {
- }
+ @Override
+ public void mouseEntered(MouseEvent e) {
+ }
- @Override
- public void mouseExited(MouseEvent e) {
- }
+ @Override
+ public void mouseExited(MouseEvent e) {
+ }
-
+
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTableModel.java 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTableModel.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -25,16 +25,6 @@
package org.chorem.lima.ui.lettering;
-import static org.nuiton.i18n.I18n._;
-import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Date;
-import java.util.List;
-
-import javax.swing.JFrame;
-import javax.swing.JOptionPane;
-import javax.swing.table.AbstractTableModel;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.FinancialTransactionServiceMonitorable;
@@ -52,20 +42,31 @@
import org.chorem.lima.util.ErrorHelper;
import org.nuiton.util.Resource;
+import javax.swing.JFrame;
+import javax.swing.JOptionPane;
+import javax.swing.table.AbstractTableModel;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
+
+import static org.nuiton.i18n.I18n._;
+
/**
* Basic transaction table model.
- *
+ * <p/>
* Le modele est filtré sur {@link #selectedFinancialPeriod} et
* {@link #selectedFinancialPeriod} (montée en charge !).
- *
+ *
* @author ore
* @author chatellier
* @version $Revision$
- *
- * Last update : $Date$
- * By : $Author$
+ * <p/>
+ * Last update : $Date$
+ * By : $Author$
*/
-public class LetteringTableModel extends AbstractTableModel implements ServiceListener{
+public class LetteringTableModel extends AbstractTableModel implements ServiceListener {
/** serialVersionUID. */
private static final long serialVersionUID = 1L;
@@ -76,81 +77,80 @@
/** Transaction service. */
protected final FinancialTransactionServiceMonitorable financialTransactionService;
-
+
/** Begin Date. */
protected Date selectedBeginDate;
-
+
/** EndDate. */
protected Date selectedEndDate;
-
+
/** data cache */
protected List<Object> cacheDataList;
-
- /** collection
-
/**
+ * collection
+ * <p/>
+ * <p/>
+ * /**
* Model constructor.
- *
+ * <p/>
* Just init service proxies.
*/
public LetteringTableModel() {
/* Services */
financialTransactionService =
- LimaServiceFactory.getInstance().getService(
- FinancialTransactionServiceMonitorable.class);
+ LimaServiceFactory.getInstance().getService(
+ FinancialTransactionServiceMonitorable.class);
financialTransactionService.addServiceListener(this);
LimaServiceFactory.getInstance().getService(
ImportServiceMonitorable.class).addServiceListener(this);
}
-
+
public void setSelectedBeginDate(Date date) {
selectedBeginDate = date;
}
-
+
public void setSelectedEndDate(Date date) {
selectedEndDate = date;
}
/**
* Le model est une combinaison de Transaction/Entries.
- *
- *
+ *
* @return
*/
protected List<Object> getDataList() {
List<Object> results = new ArrayList<Object>();
- if (selectedBeginDate != null && selectedEndDate != null){
+ if (selectedBeginDate != null && selectedEndDate != null) {
try {
List<FinancialTransaction> financialtransactions =
- financialTransactionService.getAllFinancialTransactionsFromDateToDate(
- selectedBeginDate, selectedEndDate);
+ financialTransactionService.getAllFinancialTransactionsFromDateToDate(
+ selectedBeginDate, selectedEndDate);
for (FinancialTransaction financialtransaction : financialtransactions) {
results.add(financialtransaction);
List<Entry> entries = (List<Entry>) financialtransaction.getEntry();
Collections.sort(entries, new EntryComparator());
results.addAll(entries);
}
- }
- catch (LimaException eee) {
+ } catch (LimaException eee) {
if (log.isErrorEnabled()) {
log.error("Can't update model", eee);
}
ErrorHelper.showErrorDialog(_("lima.lettering.listerror"), eee);
- }
+ }
}
return results;
}
-
- public void setLetter(int row, Letter letter){
+
+ public void setLetter(int row, Letter letter) {
Object currentRow = cacheDataList.get(row);
- if (currentRow instanceof Entry){
+ if (currentRow instanceof Entry) {
Entry entry = (Entry) currentRow;
entry.setLetter(letter);
try {
financialTransactionService.updateEntry(entry);
} catch (LimaException eee) {
- if (log.isDebugEnabled()){
+ if (log.isDebugEnabled()) {
log.debug("Can't set letter", eee);
}
JFrame f = new JFrame();
@@ -164,20 +164,20 @@
}
}
}
-
- public void removeLetter(int row){
+
+ public void removeLetter(int row) {
try {
Object currentRow = cacheDataList.get(row);
- if (currentRow instanceof Entry){
+ if (currentRow instanceof Entry) {
Entry entry = (Entry) currentRow;
- financialTransactionService.removeEntryLetter(entry);
+ financialTransactionService.removeEntryLetter(entry);
}
} catch (LimaException eee) {
log.error("Can't remove letter", eee);
}
}
-
- public void refresh(){
+
+ public void refresh() {
cacheDataList = getDataList();
fireTableDataChanged();
}
@@ -193,72 +193,71 @@
Class<?> result = null;
switch (column) {
- case 0:
- result = Date.class;
- break;
- case 1:
- result = EntryBook.class;
- break;
- case 2:
- result = String.class;
- break;
- case 3:
- result = Account.class;
- break;
- case 4:
- result = String.class;
- break;
- case 5:
- result = Letter.class;
- break;
- case 6:
- result = BigDecimal.class;
- break;
- case 7:
- result = BigDecimal.class;
- break;
- case 8:
- result = BigDecimal.class;
- break;
+ case 0:
+ result = Date.class;
+ break;
+ case 1:
+ result = EntryBook.class;
+ break;
+ case 2:
+ result = String.class;
+ break;
+ case 3:
+ result = Account.class;
+ break;
+ case 4:
+ result = String.class;
+ break;
+ case 5:
+ result = Letter.class;
+ break;
+ case 6:
+ result = BigDecimal.class;
+ break;
+ case 7:
+ result = BigDecimal.class;
+ break;
+ case 8:
+ result = BigDecimal.class;
+ break;
}
return result;
}
-
-
+
@Override
public String getColumnName(int column) {
String result = "n/a";
switch (column) {
- case 0:
- result = _("lima.table.date");
- break;
- case 1:
- result = _("lima.table.entrybook");
- break;
- case 2:
- result = _("lima.table.voucher");
- break;
- case 3:
- result = _("lima.table.account");
- break;
- case 4:
- result = _("lima.table.description");
- break;
- case 5:
- result = _("lima.table.letter");
- break;
- case 6:
- result = _("lima.table.debit");
- break;
- case 7:
- result = _("lima.table.credit");
- break;
- case 8:
- result = _("lima.table.balance");
- break;
+ case 0:
+ result = _("lima.table.date");
+ break;
+ case 1:
+ result = _("lima.table.entrybook");
+ break;
+ case 2:
+ result = _("lima.table.voucher");
+ break;
+ case 3:
+ result = _("lima.table.account");
+ break;
+ case 4:
+ result = _("lima.table.description");
+ break;
+ case 5:
+ result = _("lima.table.letter");
+ break;
+ case 6:
+ result = _("lima.table.debit");
+ break;
+ case 7:
+ result = _("lima.table.credit");
+ break;
+ case 8:
+ result = _("lima.table.balance");
+ break;
}
return result;
@@ -267,7 +266,7 @@
@Override
public int getRowCount() {
int result = 0;
-
+
if (cacheDataList != null) {
result = cacheDataList.size();
}
@@ -278,163 +277,157 @@
@Override
public Object getValueAt(int row, int column) {
Object result = null;
-
+
// just prevent too much result
if (cacheDataList != null) {
result = cacheDataList.get(row);
-
+
if (result instanceof FinancialTransaction) {
- FinancialTransaction currentRow = (FinancialTransaction)result;
+ FinancialTransaction currentRow = (FinancialTransaction) result;
BigDecimal amountDebit = currentRow.getAmountDebit();
BigDecimal amountCredit = currentRow.getAmountCredit();
-
+
switch (column) {
- case 0:
- result = currentRow.getTransactionDate();
- break;
- case 1:
- if (currentRow.getEntryBook() != null){
- result = currentRow.getEntryBook().getCode();
- }
- else {
- result = null;
- }
- break;
- case 2:
- result = null; //voucher
- break;
- case 3:
- result = null; // account
- break;
- case 4:
- result = null; // description
- break;
- case 5 :
- result = null; // letter
- break;
- case 6:
- result = amountDebit;
- break;
- case 7:
- result = amountCredit;
- break;
- case 8:
- result = amountDebit.subtract(amountCredit);
- break;
+ case 0:
+ result = currentRow.getTransactionDate();
+ break;
+ case 1:
+ if (currentRow.getEntryBook() != null) {
+ result = currentRow.getEntryBook().getCode();
+ } else {
+ result = null;
+ }
+ break;
+ case 2:
+ result = null; //voucher
+ break;
+ case 3:
+ result = null; // account
+ break;
+ case 4:
+ result = null; // description
+ break;
+ case 5:
+ result = null; // letter
+ break;
+ case 6:
+ result = amountDebit;
+ break;
+ case 7:
+ result = amountCredit;
+ break;
+ case 8:
+ result = amountDebit.subtract(amountCredit);
+ break;
}
- }
- else if (result instanceof Entry) {
- Entry currentEntry = (Entry)result;
+ } else if (result instanceof Entry) {
+ Entry currentEntry = (Entry) result;
switch (column) {
- case 0:
- result = null; // date
- break;
- case 1 : // entry book
- result = null;
- break;
- case 2:
- result = currentEntry.getVoucher();
- break;
- case 3: // account
- if (currentEntry.getAccount() != null){
- result = currentEntry.getAccount().getAccountNumber();
- }
- else {
+ case 0:
+ result = null; // date
+ break;
+ case 1: // entry book
result = null;
- }
- break;
- case 4:
- result = currentEntry.getDescription();
- break;
- case 5 :
- if (currentEntry.getLetter() != null){
- result = currentEntry.getLetter().getCode();
- }
- else {
+ break;
+ case 2:
+ result = currentEntry.getVoucher();
+ break;
+ case 3: // account
+ if (currentEntry.getAccount() != null) {
+ result = currentEntry.getAccount().getAccountNumber();
+ } else {
+ result = null;
+ }
+ break;
+ case 4:
+ result = currentEntry.getDescription();
+ break;
+ case 5:
+ if (currentEntry.getLetter() != null) {
+ result = currentEntry.getLetter().getCode();
+ } else {
+ result = null;
+ }
+ break;
+ case 6:
+ result = currentEntry.getDebit() ? currentEntry.getAmount() : BigDecimal.ZERO;
+ break;
+ case 7:
+ result = currentEntry.getDebit() ? BigDecimal.ZERO : currentEntry.getAmount();
+ break;
+ case 8:
result = null;
- }
- break;
- case 6:
- result = currentEntry.getDebit() ? currentEntry.getAmount() : BigDecimal.ZERO;
- break;
- case 7:
- result = currentEntry.getDebit() ? BigDecimal.ZERO : currentEntry.getAmount();
- break;
- case 8:
- result = null;
- break;
+ break;
}
-
+
}
}
return result;
}
-
+
/**
* To set cells editable or not
* different condition for entry or financial transaction
*/
@Override
public boolean isCellEditable(int rowIndex, int columnIndex) {
- boolean editableCell=false;
+ boolean editableCell = false;
Object currentRow = cacheDataList.get(rowIndex);
// cells editable for the entry row, all cells exclude the date
- if (currentRow instanceof Entry && columnIndex==5) {
- editableCell=true;
+ if (currentRow instanceof Entry && columnIndex == 5) {
+ editableCell = true;
}
- return editableCell; }
-
-
-
- public Object getElementAt(int row){
+ return editableCell;
+ }
+
+
+ public Object getElementAt(int row) {
Object result = null;
- if (cacheDataList != null){
+ if (cacheDataList != null) {
result = cacheDataList.get(row);
}
return result;
}
-
-
- /**
- * to modifiy letter entry
- */
+
+
+ /** to modifiy letter entry */
@Override
public void setValueAt(Object value, int row, int column) {
int financialTransactionRow = 0;
if (cacheDataList != null) {
Object currentRow = cacheDataList.get(row);
if (currentRow instanceof Entry) {
- Entry currentEntry = (Entry)currentRow;
+ Entry currentEntry = (Entry) currentRow;
switch (column) {
- case 5 :
- currentEntry.setLetter((Letter)value);
- break;
+ case 5:
+ currentEntry.setLetter((Letter) value);
+ break;
}
try {
financialTransactionService.updateEntry(currentEntry);
} catch (LimaException eee) {
- if (log.isDebugEnabled()){
+ if (log.isDebugEnabled()) {
log.error("Can't update entry", eee);
}
DialogHelper.showMessageDialog(eee.getMessage());
}
//update the financial transaction in entire
- financialTransactionRow =
- getDataList().indexOf(((Entry) currentRow).
- getFinancialTransaction());
+ financialTransactionRow =
+ getDataList().indexOf(((Entry) currentRow).
+ getFinancialTransaction());
}
//on recharge la liste
cacheDataList = getDataList();
- fireTableRowsUpdated(financialTransactionRow, getRowCount()-1);
+ fireTableRowsUpdated(financialTransactionRow, getRowCount() - 1);
}
}
@Override
public void notifyMethod(String serviceName, String methodeName) {
- if (serviceName.contains("FinancialTransaction") || methodeName.contains("importEntries") || methodeName.contains("importAll")){
+ if (serviceName.contains("FinancialTransaction") || methodeName.contains("importEntries") || methodeName.contains("importAll")) {
refresh();
}
}
-
+
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringView.jaxx 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringView.jaxx 2011-09-17 14:17:04 UTC (rev 3293)
@@ -29,24 +29,12 @@
javax.swing.ListSelectionModel
org.chorem.lima.entity.FiscalPeriod
org.chorem.lima.entity.FinancialPeriod
- org.chorem.lima.ui.combobox.FinancialPeriodComboBoxRenderer
org.chorem.lima.enums.ComboBoxDatesEnum
</import>
<LetteringViewHandler id="handler" javaBean="new LetteringViewHandler(this)"/>
<Boolean id="selectedRow" javaBean="false"/>
- <script>
- <![CDATA[
-
- LetteringPeriodSearchPanel periodSearchPanel = new LetteringPeriodSearchPanel(handler);
-
- void $afterCompleteSetup() {
- }
-
- ]]>
- </script>
-
<row weightx="1" weighty="0" anchor="center">
<cell fill='both'>
<Table>
@@ -58,7 +46,8 @@
validate(); repaint()"/>
</cell>
<cell>
- <LetteringPeriodSearchPanel javaBean="periodSearchPanel"/>
+ <LetteringPeriodSearchPanel id='periodSearchPanel'
+ constructorParams='handler'/>
</cell>
</row>
</Table>
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -25,12 +25,6 @@
package org.chorem.lima.ui.lettering;
-import static org.nuiton.i18n.I18n._;
-
-import java.util.Date;
-
-import javax.swing.JComboBox;
-import javax.swing.JTextField;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.FinancialTransactionServiceMonitorable;
@@ -41,115 +35,120 @@
import org.chorem.lima.ui.combobox.FiscalPeriodComboBoxModel;
import org.chorem.lima.util.DialogHelper;
+import javax.swing.JComboBox;
+import javax.swing.JTextField;
+import java.util.Date;
+import static org.nuiton.i18n.I18n._;
+
+
/**
* Handler associated with financial transaction view.
- *
+ *
* @author chatellier
* @version $Revision$
- *
- * Last update : $Date$
- * By : $Author$
+ * <p/>
+ * Last update : $Date$
+ * By : $Author$
*/
public class LetteringViewHandler {
/** log. */
private static final Log log =
- LogFactory.getLog(LetteringViewHandler.class);
+ LogFactory.getLog(LetteringViewHandler.class);
protected LetteringView view;
-
+
protected LetteringTable table;
-
+
protected LetteringTableModel tableModel;
-
+
protected FiscalPeriodComboBoxModel fiscalPeriodComboBoxModel;
-
+
protected FinancialPeriodComboBoxModel financialPeriodComboBoxModel;
-
+
/** Transaction service. */
protected final FinancialTransactionServiceMonitorable financialTransactionService;
-
+
protected Object clipBoard;
protected LetteringViewHandler(LetteringView view) {
this.view = view;
-
+
/* Services */
financialTransactionService =
- LimaServiceFactory.getInstance().getService(
- FinancialTransactionServiceMonitorable.class);
+ LimaServiceFactory.getInstance().getService(
+ FinancialTransactionServiceMonitorable.class);
}
-
- public void setBeginDate(Date date){
+
+ public void setBeginDate(Date date) {
tableModel = view.getTableModel();
tableModel.setSelectedBeginDate(date);
}
-
- public void setEndDate(Date date){
+
+ public void setEndDate(Date date) {
tableModel = view.getTableModel();
tableModel.setSelectedEndDate(date);
}
-
- public void addLetter(){
- Letter letter = null;
- Boolean valid = true;
-
- table = view.getTable();
- tableModel = view.getTableModel();
-
- AddLetterForm addLetterForm = new AddLetterForm();
- JTextField newLetterTextField = addLetterForm.getNewLetterTextField();
- try {
- letter = financialTransactionService.getNewLetter();
- newLetterTextField.setText(letter.getCode());
- } catch (LimaException eee) {
- log.error("Can't get new letter", eee);
- }
-
- addLetterForm.setLocationRelativeTo(view);
- addLetterForm.setVisible(true);
-
- //false = cancel Action
- if (addLetterForm.validOk){
- Object object = addLetterForm.getRadioButtons().getSelectedValue();
- if (!(Boolean) object){
- JComboBox comboBox = addLetterForm.getLetterListComboBox();
- Object selectedObject = comboBox.getSelectedItem();
- if (selectedObject instanceof Letter){
- letter = (Letter) selectedObject;
- }
- else {
- DialogHelper.showMessageDialog(_("lima.entries.lettering.noletterselected"));
- valid = false;
- }
- }
- if (valid){
- //addLetters
- int[] rows = table.getSelectedRows();
- for (int i : rows) {
- tableModel.setLetter(i, letter);
+ public void addLetter() {
+ Letter letter = null;
+ Boolean valid = true;
+
+ table = view.getTable();
+ tableModel = view.getTableModel();
+
+ AddLetterForm addLetterForm = new AddLetterForm();
+ JTextField newLetterTextField = addLetterForm.getNewLetterTextField();
+
+ try {
+ letter = financialTransactionService.getNewLetter();
+ newLetterTextField.setText(letter.getCode());
+ } catch (LimaException eee) {
+ log.error("Can't get new letter", eee);
+ }
+
+ addLetterForm.setLocationRelativeTo(view);
+ addLetterForm.setVisible(true);
+
+ //false = cancel Action
+ if (addLetterForm.validOk) {
+ Object object = addLetterForm.getRadioButtons().getSelectedValue();
+ if (!(Boolean) object) {
+ JComboBox comboBox = addLetterForm.getLetterListComboBox();
+ Object selectedObject = comboBox.getSelectedItem();
+ if (selectedObject instanceof Letter) {
+ letter = (Letter) selectedObject;
+ } else {
+ DialogHelper.showMessageDialog(_("lima.entries.lettering.noletterselected"));
+ valid = false;
}
- tableModel.refresh();
- }
- }
- }
-
- public void removeLetter(){
+ }
+ if (valid) {
+ //addLetters
+ int[] rows = table.getSelectedRows();
+ for (int i : rows) {
+ tableModel.setLetter(i, letter);
+ }
+ tableModel.refresh();
+ }
+ }
+ }
- table = view.getTable();
- tableModel = view.getTableModel();
-
- //removeLetters
- int[] rows = table.getSelectedRows();
- for (int i : rows) {
- tableModel.removeLetter(i);
+ public void removeLetter() {
+
+ table = view.getTable();
+ tableModel = view.getTableModel();
+
+ //removeLetters
+ int[] rows = table.getSelectedRows();
+ for (int i : rows) {
+ tableModel.removeLetter(i);
}
- tableModel.refresh();
- }
-
- public void refresh(){
+ tableModel.refresh();
+ }
+
+ public void refresh() {
tableModel = view.getTableModel();
tableModel.refresh();
}
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 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/OpeningViewHandler.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -25,12 +25,6 @@
package org.chorem.lima.ui.opening;
-import static org.nuiton.i18n.I18n._;
-import java.awt.Color;
-import javax.swing.BorderFactory;
-import javax.swing.JPanel;
-import javax.swing.border.Border;
-import javax.swing.border.EmptyBorder;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.FiscalPeriodServiceMonitorable;
@@ -46,22 +40,35 @@
import org.chorem.lima.ui.identity.IdentityHandler;
import org.chorem.lima.ui.importexport.ImportExport;
+import javax.swing.BorderFactory;
+import javax.swing.JPanel;
+import javax.swing.border.Border;
+import javax.swing.border.EmptyBorder;
+import java.awt.Color;
+
+import static org.nuiton.i18n.I18n._;
+
public class OpeningViewHandler {
-
+
private static final Log log = LogFactory.getLog(OpeningViewHandler.class);
-
- private static Border noBorder = new EmptyBorder(0,0,0,0);
+
+ private static Border noBorder = new EmptyBorder(0, 0, 0, 0);
+
private static Color green = new Color(0x66, 0xcc, 0x00);
-
+
protected int step;
+
protected OpeningView view;
-
+
//Panels
private CreateAccountsPanel caPanel;
+
private CreateIdentityPanel idPanel;
+
private CreateEntryBookPanel ebPanel;
+
private CreateFiscalPeriodPanel fsPanel;
-
+
public OpeningViewHandler(OpeningView view) {
this.view = view;
caPanel = new CreateAccountsPanel();
@@ -70,130 +77,130 @@
fsPanel = new CreateFiscalPeriodPanel();
step = 0;
}
-
-
+
+
public void importSave() {
ImportExport importExport = new ImportExport(view);
importExport.importExport(ImportExportEnum.CSV_ALL_IMPORT, "", true);
view.dispose();
}
-
+
public void next() {
ImportExport importExport = ImportExport.getInstance(view);
JPanel panel = view.getPanel();
panel.removeAll();
switch (step) {
- case 0:
- //refresh UI
- view.getIdentityIcon().setBorder(BorderFactory.createLineBorder(green, 2));
- panel.add(idPanel);
- panel.validate();
- view.repaint();
- step++;
- break;
- case 1:
- IdentityHandler identityHandler = new IdentityHandler();
- identityHandler.updateIdentity(idPanel.getIdentity());
- //refresh UI
- view.getIdentityIcon().setBorder(noBorder);
- view.getAccountsIcon().setBorder(BorderFactory.createLineBorder(green, 2));
- panel.add(caPanel);
- panel.validate();
- view.repaint();
- step++;
- break;
-
- case 2 :
- Object value = caPanel.getRadioButtons().getSelectedValue();
- // if action confirmed
- if (value != null){
- AccountsChartEnum defaultAccountsChartEnum =
- (AccountsChartEnum) value;
- //Import accounts chart
- switch (defaultAccountsChartEnum) {
- case IMPORTEBP:
- importExport.importExport(ImportExportEnum.EBP_ACCOUNTCHARTS_IMPORT,
- defaultAccountsChartEnum.getFilePath(), false);
- break;
+ case 0:
+ //refresh UI
+ view.getIdentityIcon().setBorder(BorderFactory.createLineBorder(green, 2));
+ panel.add(idPanel);
+ panel.validate();
+ view.repaint();
+ step++;
+ break;
+ case 1:
+ IdentityHandler identityHandler = new IdentityHandler();
+ identityHandler.updateIdentity(idPanel.getIdentity());
+ //refresh UI
+ view.getIdentityIcon().setBorder(noBorder);
+ view.getAccountsIcon().setBorder(BorderFactory.createLineBorder(green, 2));
+ panel.add(caPanel);
+ panel.validate();
+ view.repaint();
+ step++;
+ break;
- default:
- importExport.importExport(ImportExportEnum.CSV_ACCOUNTCHARTS_IMPORT,
- defaultAccountsChartEnum.getFilePath(), false);
- break;
+ case 2:
+ Object value = caPanel.getRadioButtons().getSelectedValue();
+ // if action confirmed
+ if (value != null) {
+ AccountsChartEnum defaultAccountsChartEnum =
+ (AccountsChartEnum) value;
+ //Import accounts chart
+ switch (defaultAccountsChartEnum) {
+ case IMPORTEBP:
+ importExport.importExport(ImportExportEnum.EBP_ACCOUNTCHARTS_IMPORT,
+ defaultAccountsChartEnum.getFilePath(), false);
+ break;
+
+ default:
+ importExport.importExport(ImportExportEnum.CSV_ACCOUNTCHARTS_IMPORT,
+ defaultAccountsChartEnum.getFilePath(), false);
+ break;
+ }
+ //Import financialstatement
+ switch (defaultAccountsChartEnum) {
+ case SHORTENED:
+ importExport.importExport(ImportExportEnum.CSV_FINANCIALSTATEMENTS_IMPORT,
+ FinancialStatementsChartEnum.SHORTENED.getFilePath(), false);
+ break;
+ case DEVELOPED:
+ importExport.importExport(ImportExportEnum.CSV_FINANCIALSTATEMENTS_IMPORT,
+ FinancialStatementsChartEnum.DEVELOPED.getFilePath(), false);
+ break;
+ default:
+ importExport.importExport(ImportExportEnum.CSV_FINANCIALSTATEMENTS_IMPORT,
+ FinancialStatementsChartEnum.BASE.getFilePath(), false);
+ break;
+ }
+ //Import vatstatement
+ switch (defaultAccountsChartEnum) {
+ case SHORTENED:
+ importExport.importExport(ImportExportEnum.CSV_VAT_IMPORT,
+ VatStatementsChartEnum.SHORTENED.getFilePath(), false);
+ break;
+ case BASE:
+ importExport.importExport(ImportExportEnum.CSV_VAT_IMPORT,
+ VatStatementsChartEnum.BASE.getFilePath(), false);
+ break;
+ case DEVELOPED:
+ importExport.importExport(ImportExportEnum.CSV_VAT_IMPORT,
+ VatStatementsChartEnum.DEVELOPED.getFilePath(), false);
+ break;
+ default:
+ importExport.importExport(ImportExportEnum.CSV_VAT_IMPORT,
+ VatStatementsChartEnum.DEFAULT.getFilePath(), false);
+ break;
+ }
+
}
- //Import financialstatement
- switch (defaultAccountsChartEnum) {
- case SHORTENED:
- importExport.importExport(ImportExportEnum.CSV_FINANCIALSTATEMENTS_IMPORT,
- FinancialStatementsChartEnum.SHORTENED.getFilePath(), false);
- break;
- case DEVELOPED:
- importExport.importExport(ImportExportEnum.CSV_FINANCIALSTATEMENTS_IMPORT,
- FinancialStatementsChartEnum.DEVELOPED.getFilePath(), false);
- break;
- default:
- importExport.importExport(ImportExportEnum.CSV_FINANCIALSTATEMENTS_IMPORT,
- FinancialStatementsChartEnum.BASE.getFilePath(), false);
- break;
+ view.getAccountsIcon().setBorder(noBorder);
+ view.getEntrybooksIcon().setBorder(BorderFactory.createLineBorder(green, 2));
+ panel.add(ebPanel);
+ panel.validate();
+ view.repaint();
+ step++;
+ break;
+
+ case 3:
+ if (ebPanel.getImportEntryBook().isSelected()) {
+ importExport.importExport(ImportExportEnum.CSV_ENTRYBOOKS_IMPORT,
+ EntryBooksChartEnum.DEFAULT.getFilePath(), false);
}
- //Import vatstatement
- switch(defaultAccountsChartEnum) {
- case SHORTENED:
- importExport.importExport(ImportExportEnum.CSV_VAT_IMPORT,
- VatStatementsChartEnum.SHORTENED.getFilePath(), false);
- break;
- case BASE:
- importExport.importExport(ImportExportEnum.CSV_VAT_IMPORT,
- VatStatementsChartEnum.BASE.getFilePath(), false);
- break;
- case DEVELOPED:
- importExport.importExport(ImportExportEnum.CSV_VAT_IMPORT,
- VatStatementsChartEnum.DEVELOPED.getFilePath(), false);
- break;
- default:
- importExport.importExport(ImportExportEnum.CSV_VAT_IMPORT,
- VatStatementsChartEnum.DEFAULT.getFilePath(), false);
- break;
+ view.getEntrybooksIcon().setBorder(noBorder);
+ view.getFiscalperiodsIcon().setBorder(BorderFactory.createLineBorder(green, 2));
+ panel.add(fsPanel);
+ panel.validate();
+ view.getOk().setText(_("lima.common.fin"));
+ view.repaint();
+ step++;
+ break;
+ case 4:
+ try {
+ FiscalPeriod fiscalPeriod = new FiscalPeriodImpl();
+ fiscalPeriod.setBeginDate(fsPanel.getBeginDatePicker().getDate());
+ fiscalPeriod.setEndDate(fsPanel.getEndDatePicker().getDate());
+
+ LimaServiceFactory.getInstance().getService(
+ FiscalPeriodServiceMonitorable.class).
+ createFiscalPeriod(fiscalPeriod);
+
+ } catch (LimaException ex) {
+ if (log.isErrorEnabled()) {
+ log.error("Can't create fiscal period", ex);
+ }
}
-
- }
- view.getAccountsIcon().setBorder(noBorder);
- view.getEntrybooksIcon().setBorder(BorderFactory.createLineBorder(green, 2));
- panel.add(ebPanel);
- panel.validate();
- view.repaint();
- step++;
- break;
-
- case 3 :
- if (ebPanel.getImportEntryBook().isSelected()) {
- importExport.importExport(ImportExportEnum.CSV_ENTRYBOOKS_IMPORT,
- EntryBooksChartEnum.DEFAULT.getFilePath(), false);
- }
- view.getEntrybooksIcon().setBorder(noBorder);
- view.getFiscalperiodsIcon().setBorder(BorderFactory.createLineBorder(green, 2));
- panel.add(fsPanel);
- panel.validate();
- view.getOk().setText(_("lima.common.fin"));
- view.repaint();
- step++;
- break;
- case 4 :
- try {
- FiscalPeriod fiscalPeriod = new FiscalPeriodImpl();
- fiscalPeriod.setBeginDate(fsPanel.getBeginDatePicker().getDate());
- fiscalPeriod.setEndDate(fsPanel.getEndDatePicker().getDate());
-
- LimaServiceFactory.getInstance().getService(
- FiscalPeriodServiceMonitorable.class).
- createFiscalPeriod(fiscalPeriod);
-
- } catch (LimaException ex) {
- if (log.isErrorEnabled()) {
- log.error("Can't create fiscal period", ex);
- }
- }
- view.dispose();
+ view.dispose();
}
}
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartTreeTable.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartTreeTable.java 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartTreeTable.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -24,15 +24,6 @@
*/
package org.chorem.lima.ui.vatchart;
-import java.awt.Color;
-import java.awt.Component;
-import java.awt.event.KeyEvent;
-import java.awt.event.KeyListener;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-
-import javax.swing.tree.TreePath;
-
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.entity.VatStatement;
@@ -43,33 +34,39 @@
import org.jdesktop.swingx.decorator.Highlighter;
import org.jdesktop.swingx.treetable.TreeTableModel;
+import javax.swing.tree.TreePath;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+
public class VatChartTreeTable extends JXTreeTable
implements KeyListener, MouseListener {
/** serialVersionUID. */
- private static final long serialVersionUID = 3960840343197845825L;
+ private static final long serialVersionUID = 3960840343197845825L;
- /** log. */
+ /** log. */
private static final Log log = LogFactory
.getLog(VatChartTreeTable.class);
-
+
protected VatChartViewHandler handler;
-
+
private Highlighter colorLine;
-
+
public VatChartTreeTable(VatChartViewHandler handler) {
this.handler = handler;
-
+
addKeyListener(this);
addMouseListener(this);
-
+
//highlight missing box name lines
- addMissingBoxNameColor();
+ addMissingBoxNameColor();
}
-
- /**
- * Highlights line when line is a leaf and is missing its BoxName parameter
- */
+
+ /** Highlights line when line is a leaf and is missing its BoxName parameter */
private void addMissingBoxNameColor() {
if (colorLine != null) {
removeHighlighter(colorLine);
@@ -77,12 +74,12 @@
HighlightPredicate predicate = new HighlightPredicate() {
@Override
public boolean isHighlighted(Component renderer,
- ComponentAdapter adapter) {
+ ComponentAdapter adapter) {
JXTreeTable treeTable = handler.view.getTreeTable();
TreeTableModel treeTableModel = treeTable.getTreeTableModel();
TreePath treePath = treeTable.getPathForRow(adapter.row);
VatStatement vatStatement =
- (VatStatement) treePath.getLastPathComponent();
+ (VatStatement) treePath.getLastPathComponent();
boolean highlighted = false;
if (vatStatement.getBoxName() != null) {
if (treeTableModel.isLeaf(vatStatement) && vatStatement.getBoxName().isEmpty()) {
@@ -96,7 +93,7 @@
};
colorLine =
new ColorHighlighter(predicate, new Color(255, 198, 209), null);
- addHighlighter(colorLine);
+ addHighlighter(colorLine);
}
@Override
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartTreeTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartTreeTableModel.java 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartTreeTableModel.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -24,9 +24,6 @@
*/
package org.chorem.lima.ui.vatchart;
-import static org.nuiton.i18n.I18n._;
-import java.util.List;
-import javax.swing.tree.TreePath;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.LimaException;
@@ -36,25 +33,28 @@
import org.chorem.lima.service.LimaServiceFactory;
import org.jdesktop.swingx.treetable.AbstractTreeTableModel;
+import javax.swing.tree.TreePath;
+import java.util.List;
+
+import static org.nuiton.i18n.I18n._;
+
public class VatChartTreeTableModel extends AbstractTreeTableModel {
-
+
/** log. */
private static final Log log = LogFactory.getLog(VatChartViewHandler.class);
-
+
/** Services. */
protected final VatStatementServiceMonitorable vatStatementService;
- /**
- * Model constructor. Initiate account service used here.
- */
+ /** Model constructor. Initiate account service used here. */
public VatChartTreeTableModel() {
//create root for the tree
super(new VatStatementImpl());
// Gets factory service
vatStatementService =
- LimaServiceFactory.getInstance().getService(
- VatStatementServiceMonitorable.class);
- }
+ LimaServiceFactory.getInstance().getService(
+ VatStatementServiceMonitorable.class);
+ }
@Override
@@ -82,21 +82,20 @@
if (node == getRoot()) {
try {
result = vatStatementService.
- getChildrenVatStatement(null).size();
+ getChildrenVatStatement(null).size();
} catch (LimaException eee) {
log.debug("Can't count child", eee);
}
- }
- else {
- VatStatement parentVatStatementHeader =
+ } else {
+ VatStatement parentVatStatementHeader =
(VatStatement) node;
- try {
- result = vatStatementService.getChildrenVatStatement(
- parentVatStatementHeader).size();
- } catch (LimaException eee) {
- log.debug("Can't count child", eee);
- }
+ try {
+ result = vatStatementService.getChildrenVatStatement(
+ parentVatStatementHeader).size();
+ } catch (LimaException eee) {
+ log.debug("Can't count child", eee);
}
+ }
return result;
}
@@ -106,18 +105,17 @@
if (parent == getRoot()) {
try {
List<VatStatement> vatStatements =
- vatStatementService.getChildrenVatStatement(null);
+ vatStatementService.getChildrenVatStatement(null);
result = vatStatements.get(index);
} catch (LimaException eee) {
log.debug("Can't get child", eee);
}
- }
- else {
+ } else {
VatStatement parentVatStatement =
- (VatStatement) parent;
+ (VatStatement) parent;
try {
List<VatStatement> vatStatements = vatStatementService.
- getChildrenVatStatement(parentVatStatement);
+ getChildrenVatStatement(parentVatStatement);
result = vatStatements.get(index);
} catch (LimaException eee) {
log.debug("Can't get child", eee);
@@ -129,22 +127,21 @@
@Override
public int getIndexOfChild(Object parent, Object child) {
int result = 0;
-
+
if (parent == getRoot()) {
try {
List<VatStatement> vatStatements =
- vatStatementService.getChildrenVatStatement(null);
+ vatStatementService.getChildrenVatStatement(null);
result = vatStatements.indexOf(child);
} catch (LimaException eee) {
log.debug("Can't get index child", eee);
}
- }
- else {
+ } else {
VatStatement parentVatStatement =
- (VatStatement) parent;
+ (VatStatement) parent;
try {
List<VatStatement> vatStatements = vatStatementService.
- getChildrenVatStatement(parentVatStatement);
+ getChildrenVatStatement(parentVatStatement);
result = vatStatements.indexOf(child);
} catch (LimaException eee) {
log.debug("Can't get index child", eee);
@@ -152,19 +149,19 @@
}
return result;
}
-
+
@Override
public Object getValueAt(Object node, int column) {
Object result = "n/a";
- VatStatement vatStatement = (VatStatement) node;
- switch (column) {
- case 0:
- result = vatStatement.getLabel();
- break;
- case 1:
- result = vatStatement.getAccounts();
- break;
- }
+ VatStatement vatStatement = (VatStatement) node;
+ switch (column) {
+ case 0:
+ result = vatStatement.getLabel();
+ break;
+ case 1:
+ result = vatStatement.getAccounts();
+ break;
+ }
return result;
}
@@ -178,20 +175,17 @@
return getChildCount(node) == 0;
}
-
- /**
- * Refresh VatStatementChart.
- *
- */
+
+ /** Refresh VatStatementChart. */
public void refreshTree() throws LimaException {
modelSupport.fireNewRoot();
}
-
-
+
+
/**
* Add VatStatement(path can be null).
- *
+ *
* @param path
* @param account
* @throws LimaException
@@ -202,17 +196,17 @@
VatStatement parentVatStatementHeader = null;
if (path != null) {
parentVatStatementHeader =
- (VatStatement) path.getLastPathComponent();
+ (VatStatement) path.getLastPathComponent();
}
vatStatementService.createVatStatement(
parentVatStatementHeader, vatStatement);
modelSupport.fireTreeStructureChanged(path);
}
-
+
/**
* Update vatStatement
- *
+ *
* @param path
* @param account
* @throws LimaException
@@ -222,10 +216,10 @@
vatStatementService.updateVatStatement(vatStatement);
modelSupport.fireTreeStructureChanged(path);
}
-
+
/**
* Remove vatStatement
- *
+ *
* @param path
* @param object
* @throws LimaException
@@ -234,7 +228,7 @@
// Calling account service
int index = getIndexOfChild(
path.getParentPath().getLastPathComponent(), vatStatement);
- vatStatementService.removeVatStatement(vatStatement);
+ vatStatementService.removeVatStatement(vatStatement);
modelSupport.fireChildRemoved(path.getParentPath(), index, vatStatement);
}
@@ -249,6 +243,6 @@
log.debug("Can't update vatStatement", eee);
}
}
-
-
+
+
}
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 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartViewHandler.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -24,13 +24,6 @@
*/
package org.chorem.lima.ui.vatchart;
-import static org.nuiton.i18n.I18n._;
-
-import java.math.BigDecimal;
-
-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.ImportServiceMonitorable;
@@ -46,30 +39,36 @@
import org.chorem.lima.ui.importexport.ImportExport;
import org.jdesktop.swingx.JXTreeTable;
+import javax.swing.JOptionPane;
+import javax.swing.tree.TreePath;
+import java.math.BigDecimal;
+
+import static org.nuiton.i18n.I18n._;
+
public class VatChartViewHandler implements ServiceListener {
/** log. */
private static final Log log = LogFactory.getLog(VatChartViewHandler.class);
protected VatStatementServiceMonitorable vatStatementService;
-
+
protected VatChartView view;
protected VatChartViewHandler(VatChartView view) {
this.view = view;
-
+
vatStatementService =
- LimaServiceFactory.getInstance().getService(
- VatStatementServiceMonitorable.class);
+ LimaServiceFactory.getInstance().getService(
+ VatStatementServiceMonitorable.class);
LimaServiceFactory.getInstance().getService(
ImportServiceMonitorable.class).addServiceListener(this);
}
-
- public void addVatStatementMovement(){
+ public void addVatStatementMovement() {
+
VatChartTreeTableModel treeTableModel =
- (VatChartTreeTableModel) view.getTreeTable().getTreeTableModel();
-
+ (VatChartTreeTableModel) view.getTreeTable().getTreeTableModel();
+
int selectedRow = view.getTreeTable().getSelectedRow();
// get current selection path
TreePath treePath;
@@ -81,10 +80,10 @@
VatStatement newVatChartMovement = new VatStatementImpl();
VatChartMovementForm vatChartMovementForm =
- new VatChartMovementForm(view);
+ new VatChartMovementForm(view);
VatStatement masterVatStatement = null;
if (selectedRow != -1) {
- masterVatStatement = (VatStatement)treePath.getLastPathComponent();
+ masterVatStatement = (VatStatement) treePath.getLastPathComponent();
}
newVatChartMovement.setMasterVatStatement(masterVatStatement);
vatChartMovementForm.setVatStatement(newVatChartMovement);
@@ -92,13 +91,13 @@
vatChartMovementForm.setLocationRelativeTo(view);
vatChartMovementForm.setVisible(true);
newVatChartMovement = vatChartMovementForm.getVatStatement();
-
- // null == cancel action
- if (newVatChartMovement != null) {
- newVatChartMovement.setAmount(BigDecimal.ZERO);
- // add it
- try {
- treeTableModel.addVatStatement(treePath, newVatChartMovement);
+
+ // null == cancel action
+ if (newVatChartMovement != null) {
+ newVatChartMovement.setAmount(BigDecimal.ZERO);
+ // add it
+ try {
+ treeTableModel.addVatStatement(treePath, newVatChartMovement);
} catch (LimaBusinessException eee) {
if (log.isErrorEnabled()) {
log.error("Can't add Vat chart Movement", eee);
@@ -108,8 +107,7 @@
eee.getMessage(),
_("lima.common.error"),
JOptionPane.ERROR_MESSAGE);
- }
- catch (LimaException eee) {
+ } catch (LimaException eee) {
if (log.isErrorEnabled()) {
log.error("Can't add Vat chart Movement", eee);
}
@@ -122,108 +120,106 @@
refresh();
}
}
-
+
public void updateVatStatement() {
-
+
JXTreeTable treeTable = view.getTreeTable();
VatChartTreeTableModel treeTableModel =
- (VatChartTreeTableModel) treeTable.getTreeTableModel();
+ (VatChartTreeTableModel) treeTable.getTreeTableModel();
- // get selected account
- int selectedRow = view.treeTable.getSelectedRow();
- TreePath treePath = view.treeTable.getPathForRow(selectedRow); // not null
- VatStatement vatStatement =
- (VatStatement) treePath.getLastPathComponent();
- //update Account or update SubLedger
- if (vatStatement != null) {
- // get current selection path
- if ( selectedRow != -1) {
- treePath = view.treeTable.getPathForRow(selectedRow);
- } else {
- treePath = new TreePath(treeTableModel.getRoot());
- }
- VatChartMovementForm vatChartMovementForm =
- new VatChartMovementForm(view);
- if (vatStatement.getMasterVatStatement() == null) {
- VatStatement masterVatStatement = new VatStatementImpl();
- vatStatement.setMasterVatStatement(masterVatStatement);
- }
- vatChartMovementForm.setVatStatement(vatStatement);
- // jaxx constructor don't call super() ?
- vatChartMovementForm.setLocationRelativeTo(view);
- vatChartMovementForm.setVisible(true);
- // null == cancel action
- vatStatement = vatChartMovementForm.getVatStatement();
- //if action confirmed
- if (vatStatement != null){
- // update it
- try {
- treeTableModel.updateVatStatement(
- treePath, vatStatement);
- } catch (LimaException eee) {
- if (log.isErrorEnabled()) {
- log.error("Can't add update", eee);
- }
- JOptionPane.showMessageDialog(
- view,
- eee.getMessage(),
- _("lima.common.error"),
- JOptionPane.ERROR_MESSAGE);
- }
- }
- }
+ // get selected account
+ int selectedRow = view.treeTable.getSelectedRow();
+ TreePath treePath = view.treeTable.getPathForRow(selectedRow); // not null
+ VatStatement vatStatement =
+ (VatStatement) treePath.getLastPathComponent();
+ //update Account or update SubLedger
+ if (vatStatement != null) {
+ // get current selection path
+ if (selectedRow != -1) {
+ treePath = view.treeTable.getPathForRow(selectedRow);
+ } else {
+ treePath = new TreePath(treeTableModel.getRoot());
+ }
+ VatChartMovementForm vatChartMovementForm =
+ new VatChartMovementForm(view);
+ if (vatStatement.getMasterVatStatement() == null) {
+ VatStatement masterVatStatement = new VatStatementImpl();
+ vatStatement.setMasterVatStatement(masterVatStatement);
+ }
+ vatChartMovementForm.setVatStatement(vatStatement);
+ // jaxx constructor don't call super() ?
+ vatChartMovementForm.setLocationRelativeTo(view);
+ vatChartMovementForm.setVisible(true);
+ // null == cancel action
+ vatStatement = vatChartMovementForm.getVatStatement();
+ //if action confirmed
+ if (vatStatement != null) {
+ // update it
+ try {
+ treeTableModel.updateVatStatement(
+ treePath, vatStatement);
+ } catch (LimaException eee) {
+ if (log.isErrorEnabled()) {
+ log.error("Can't add update", eee);
+ }
+ JOptionPane.showMessageDialog(
+ view,
+ eee.getMessage(),
+ _("lima.common.error"),
+ JOptionPane.ERROR_MESSAGE);
+ }
+ }
+ }
refresh();
}
-
- public void importVatStatementChart(){
+
+ public void importVatStatementChart() {
VatChartImportForm form =
- new VatChartImportForm();
+ new VatChartImportForm();
form.setLocationRelativeTo(view);
form.setVisible(true);
Object value = form.getRadioButtons().getSelectedValue();
// if action confirmed
- if (value != null){
- if (form.getDeleteVatStatementChart().isSelected()){
+ if (value != null) {
+ if (form.getDeleteVatStatementChart().isSelected()) {
try {
vatStatementService.removeAllVatStatement();
-
+
} catch (LimaException eee) {
- if (log.isDebugEnabled()){
+ if (log.isDebugEnabled()) {
log.debug("Can't delete financial statement chart", eee);
}
}
}
- VatStatementsChartEnum defaultVatStatementsEnum =
- (VatStatementsChartEnum) value;
+ VatStatementsChartEnum defaultVatStatementsEnum =
+ (VatStatementsChartEnum) value;
ImportExport importExport = ImportExport.getInstance(view);
importExport.importExport(ImportExportEnum.CSV_VAT_IMPORT,
- defaultVatStatementsEnum.getFilePath(), true);
+ defaultVatStatementsEnum.getFilePath(), true);
refresh();
}
}
-
- /**
- * Ask for user to remove for selected account, and remove it if confirmed.
- */
+
+ /** Ask for user to remove for selected account, and remove it if confirmed. */
public void removeVatStatement() {
- JXTreeTable treeTable = view.getTreeTable();
- VatChartTreeTableModel treeTableModel =
- (VatChartTreeTableModel) treeTable.getTreeTableModel();
+ JXTreeTable treeTable = view.getTreeTable();
+ VatChartTreeTableModel treeTableModel =
+ (VatChartTreeTableModel) treeTable.getTreeTableModel();
// Any row selected
int selectedRow = view.treeTable.getSelectedRow();
- if ( selectedRow != -1) {
+ if (selectedRow != -1) {
int n = JOptionPane.showConfirmDialog(view,
- _("lima.charts.vatstatement.question.remove"),
- _("lima.common.confirmation"),
- JOptionPane.YES_NO_OPTION,
- JOptionPane.QUESTION_MESSAGE);
+ _("lima.charts.vatstatement.question.remove"),
+ _("lima.common.confirmation"),
+ JOptionPane.YES_NO_OPTION,
+ JOptionPane.QUESTION_MESSAGE);
if (n == JOptionPane.YES_OPTION) {
// update view of treetable
TreePath treePath = treeTable.getPathForRow(selectedRow);
VatStatement vatStatement =
- (VatStatement) treePath.getLastPathComponent();
+ (VatStatement) treePath.getLastPathComponent();
if (!treeTableModel.isLeaf(vatStatement)) {
JOptionPane.showMessageDialog(
view,
@@ -231,7 +227,7 @@
_("lima.common.info"),
JOptionPane.INFORMATION_MESSAGE);
} else {
- try{
+ try {
treeTableModel.removeVatStatementObject(
treePath, vatStatement);
} catch (LimaException eee) {
@@ -249,15 +245,15 @@
refresh();
}
}
-
- public void refresh(){
+
+ public void refresh() {
JXTreeTable treeTable = view.getTreeTable();
VatChartTreeTableModel treeTableModel =
- (VatChartTreeTableModel) treeTable.getTreeTableModel();
+ (VatChartTreeTableModel) treeTable.getTreeTableModel();
try {
treeTableModel.refreshTree();
} catch (LimaException eee) {
- if(log.isDebugEnabled()){
+ if (log.isDebugEnabled()) {
log.debug("Can't refresh model", eee);
}
}
@@ -265,14 +261,14 @@
view.repaint();
}
- @Override
- public void notifyMethod(String serviceName, String methodeName) {
+ @Override
+ public void notifyMethod(String serviceName, String methodeName) {
if (methodeName.contains("VatStatements")
- || methodeName.contains("importAll")
- || methodeName.contains("importAs")){
+ || methodeName.contains("importAll")
+ || methodeName.contains("importAs")) {
refresh();
- }
- }
+ }
+ }
-
+
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportPeriodSearchPanel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportPeriodSearchPanel.java 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportPeriodSearchPanel.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -24,17 +24,6 @@
*/
package org.chorem.lima.ui.vatreports;
-import static org.nuiton.i18n.I18n._;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.util.Calendar;
-import java.util.Date;
-
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-
import org.apache.commons.lang.time.DateUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -42,121 +31,133 @@
import org.chorem.lima.entity.FiscalPeriod;
import org.chorem.lima.enums.ComboBoxDatesEnum;
import org.chorem.lima.ui.combobox.FinancialPeriodComboBoxModel;
-import org.chorem.lima.ui.combobox.FinancialPeriodComboBoxRenderer;
import org.chorem.lima.ui.combobox.FiscalPeriodComboBoxModel;
-import org.chorem.lima.ui.combobox.FiscalPeriodComboBoxRenderer;
+import org.chorem.lima.ui.renderers.RendererUtil;
import org.jdesktop.swingx.JXDatePicker;
+import javax.swing.JComboBox;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.ListCellRenderer;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.Calendar;
+import java.util.Date;
+
+import static org.nuiton.i18n.I18n._;
+
public class VatReportPeriodSearchPanel extends JPanel {
private static final long serialVersionUID = 1L;
-
+
private static final Log log =
LogFactory.getLog(VatReportPeriodSearchPanel.class);
-
+
protected VatReportViewHandler handler;
-
+
public VatReportPeriodSearchPanel(VatReportViewHandler handler) {
-
+
this.handler = handler;
-
+
//init date
refresh(ComboBoxDatesEnum.FISCAL_PERIOD);
}
- public void refresh(ComboBoxDatesEnum comboBoxPeriodEnum){
-
+ public void refresh(ComboBoxDatesEnum comboBoxPeriodEnum) {
+
switch (comboBoxPeriodEnum) {
- case PERIOD:
- // get begin date
- Calendar calendarBegin = Calendar.getInstance();
- // set begindate to JAN 1 - 0:00.000 of this years
- Date beginDate = calendarBegin.getTime();
- beginDate = DateUtils.truncate(beginDate, Calendar.YEAR);
- //handler().setBeginDate(beginDate);
-
- // get end date
- Calendar calendarEnd = Calendar.getInstance();
- Date endDate = calendarEnd.getTime();
- //handler().setEndDate(endDate);
- JLabel beginDateLabel = new JLabel(_("lima.common.begindate"));
- final JXDatePicker beginDatePicker = new JXDatePicker(beginDate);
- ActionListener beginDateActionListener = new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- handler.tableModel.setBeginDate(beginDatePicker.getDate());
- handler.refresh();
- }
- };
- handler.tableModel.setBeginDate(beginDatePicker.getDate());
- beginDatePicker.addActionListener(beginDateActionListener);
-
- JLabel endDateLabel = new JLabel(_("lima.common.enddate"));
- final JXDatePicker endDatePicker = new JXDatePicker(endDate);
- ActionListener endDateActionListener = new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- handler.tableModel.setEndDate(endDatePicker.getDate());
- handler.refresh();
- }
- };
- handler.tableModel.setEndDate(endDatePicker.getDate());
- endDatePicker.addActionListener(endDateActionListener);
- handler.refresh();
+ case PERIOD:
+ // get begin date
+ Calendar calendarBegin = Calendar.getInstance();
+ // set begindate to JAN 1 - 0:00.000 of this years
+ Date beginDate = calendarBegin.getTime();
+ beginDate = DateUtils.truncate(beginDate, Calendar.YEAR);
+ //handler().setBeginDate(beginDate);
- removeAll();
- add(beginDateLabel);
- add(beginDatePicker);
- add(endDateLabel);
- add(endDatePicker);
- break;
-
- case FISCAL_PERIOD:
- FiscalPeriodComboBoxModel fiscalModel = new FiscalPeriodComboBoxModel(true);
- FiscalPeriodComboBoxRenderer fiscalRenderer = new FiscalPeriodComboBoxRenderer();
- final JComboBox fiscalPeriod = new JComboBox(fiscalModel);
- fiscalPeriod.setRenderer(fiscalRenderer);
- fiscalPeriod.setEditable(false);
- ActionListener fiscalPeriodActionListener = new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- FiscalPeriod fPeriod = (FiscalPeriod) fiscalPeriod.getSelectedItem();
- if (fPeriod != null){
- handler.tableModel.setBeginDate(fPeriod.getBeginDate());
- handler.tableModel.setEndDate(fPeriod.getEndDate());
- handler.refresh();
+ // get end date
+ Calendar calendarEnd = Calendar.getInstance();
+ Date endDate = calendarEnd.getTime();
+ //handler().setEndDate(endDate);
+ JLabel beginDateLabel = new JLabel(_("lima.common.begindate"));
+ final JXDatePicker beginDatePicker = new JXDatePicker(beginDate);
+ ActionListener beginDateActionListener = new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ handler.tableModel.setBeginDate(beginDatePicker.getDate());
+ handler.refresh();
}
- }
- };
- fiscalPeriod.addActionListener(fiscalPeriodActionListener);
+ };
+ handler.tableModel.setBeginDate(beginDatePicker.getDate());
+ beginDatePicker.addActionListener(beginDateActionListener);
- removeAll();
- add(fiscalPeriod);
- break;
-
- case FINANCIAL_PERIOD:
- FinancialPeriodComboBoxModel financialModel = new FinancialPeriodComboBoxModel(true);
- FinancialPeriodComboBoxRenderer financialRenderer = new FinancialPeriodComboBoxRenderer();
- final JComboBox financialPeriod = new JComboBox(financialModel);
- financialPeriod.setRenderer(financialRenderer);
- financialPeriod.setEditable(false);
- ActionListener financialPeriodActionListener = new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- FinancialPeriod fPeriod = (FinancialPeriod) financialPeriod.getSelectedItem();
- if (fPeriod !=null){
- handler.tableModel.setBeginDate(fPeriod.getBeginDate());
- handler.tableModel.setEndDate(fPeriod.getEndDate());
- handler.refresh();
+ JLabel endDateLabel = new JLabel(_("lima.common.enddate"));
+ final JXDatePicker endDatePicker = new JXDatePicker(endDate);
+ ActionListener endDateActionListener = new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ handler.tableModel.setEndDate(endDatePicker.getDate());
+ handler.refresh();
}
- }
- };
- financialPeriod.addActionListener(financialPeriodActionListener);
- removeAll();
- add(financialPeriod);
- break;
+ };
+ handler.tableModel.setEndDate(endDatePicker.getDate());
+ endDatePicker.addActionListener(endDateActionListener);
+ handler.refresh();
+
+ removeAll();
+ add(beginDateLabel);
+ add(beginDatePicker);
+ add(endDateLabel);
+ add(endDatePicker);
+ break;
+
+ case FISCAL_PERIOD:
+ FiscalPeriodComboBoxModel fiscalModel = new FiscalPeriodComboBoxModel(true);
+ ListCellRenderer renderer =
+ RendererUtil.newDecoratorListCellRenderer(FiscalPeriod.class);
+ final JComboBox fiscalPeriod = new JComboBox(fiscalModel);
+ fiscalPeriod.setRenderer(renderer);
+ fiscalPeriod.setEditable(false);
+ ActionListener fiscalPeriodActionListener = new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ FiscalPeriod fPeriod = (FiscalPeriod) fiscalPeriod.getSelectedItem();
+ if (fPeriod != null) {
+ handler.tableModel.setBeginDate(fPeriod.getBeginDate());
+ handler.tableModel.setEndDate(fPeriod.getEndDate());
+ handler.refresh();
+ }
+ }
+ };
+ fiscalPeriod.addActionListener(fiscalPeriodActionListener);
+
+ removeAll();
+ add(fiscalPeriod);
+ break;
+
+ case FINANCIAL_PERIOD:
+ FinancialPeriodComboBoxModel financialModel = new FinancialPeriodComboBoxModel(true);
+ renderer =
+ RendererUtil.newDecoratorListCellRenderer(FinancialPeriod.class);
+ final JComboBox financialPeriod = new JComboBox(financialModel);
+ financialPeriod.setRenderer(renderer);
+ financialPeriod.setEditable(false);
+ ActionListener financialPeriodActionListener = new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ FinancialPeriod fPeriod = (FinancialPeriod) financialPeriod.getSelectedItem();
+ if (fPeriod != null) {
+ handler.tableModel.setBeginDate(fPeriod.getBeginDate());
+ handler.tableModel.setEndDate(fPeriod.getEndDate());
+ handler.refresh();
+ }
+ }
+ };
+ financialPeriod.addActionListener(financialPeriodActionListener);
+ removeAll();
+ add(financialPeriod);
+ break;
}
-
+
}
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportTable.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportTable.java 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportTable.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -24,32 +24,32 @@
*/
package org.chorem.lima.ui.vatreports;
-import java.math.BigDecimal;
-
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.ui.celleditor.BigDecimalTableCellEditor;
import org.chorem.lima.ui.celleditor.BigDecimalTableCellRenderer;
import org.jdesktop.swingx.JXTable;
+import java.math.BigDecimal;
+
public class VatReportTable extends JXTable {
/** serialVersionUID. */
private static final long serialVersionUID = 4042515416850867834L;
-
+
/** log. */
private static final Log log = LogFactory.getLog(VatReportTable.class);
-
+
protected VatReportViewHandler handler;
-
+
protected VatReportTableModel model;
public VatReportTable(VatReportViewHandler handler) {
this.handler = handler;
-
+
model = this.handler.getView().getVatReportTableModel();
-
+
//Get new BigDecimal editor
setDefaultEditor(BigDecimal.class, new BigDecimalTableCellEditor());
//Get new BigDecimal renderer
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportTableModel.java 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportTableModel.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -24,14 +24,6 @@
*/
package org.chorem.lima.ui.vatreports;
-import static org.nuiton.i18n.I18n._;
-
-import java.math.BigDecimal;
-import java.util.Date;
-import java.util.List;
-
-import javax.swing.table.AbstractTableModel;
-
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.beans.VatStatementAmounts;
@@ -45,70 +37,80 @@
import org.chorem.lima.util.ErrorHelper;
import org.nuiton.topia.TopiaException;
+import javax.swing.table.AbstractTableModel;
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.List;
+
+import static org.nuiton.i18n.I18n._;
+
public class VatReportTableModel extends AbstractTableModel implements ServiceListener {
/** serialVersionUID. */
private static final long serialVersionUID = -6301817853711018389L;
-
+
/** log. */
private static final Log log = LogFactory
.getLog(VatReportTableModel.class);
-
+
/** Services. */
protected ReportServiceMonitorable reportService;
+
protected VatStatementServiceMonitorable vatStatementService;
+
protected FinancialTransactionServiceMonitorable financialTransactionService;
+
protected ImportServiceMonitorable importService;
-
+
/** selected financial period */
protected Date selectedBeginDate;
+
protected Date selectedEndDate;
-
+
/** data cache */
protected List<VatStatementAmounts> cacheDataList;
-
+
/**
* variable used for the document edition,
* if "true" then the document will be automatically filled in
* if "false" the the document will be empty
*/
protected String autocomplete;
-
-
+
+
public VatReportTableModel() {
reportService =
- LimaServiceFactory.getInstance().getService(
- ReportServiceMonitorable.class);
-
+ LimaServiceFactory.getInstance().getService(
+ ReportServiceMonitorable.class);
+
//add listeners
vatStatementService =
- LimaServiceFactory.getInstance().getService(
- VatStatementServiceMonitorable.class);
+ LimaServiceFactory.getInstance().getService(
+ VatStatementServiceMonitorable.class);
vatStatementService.addServiceListener(this);
- financialTransactionService =
- LimaServiceFactory.getInstance().getService(
- FinancialTransactionServiceMonitorable.class);
+ financialTransactionService =
+ LimaServiceFactory.getInstance().getService(
+ FinancialTransactionServiceMonitorable.class);
financialTransactionService.addServiceListener(this);
importService =
- LimaServiceFactory.getInstance().getService(
- ImportServiceMonitorable.class);
+ LimaServiceFactory.getInstance().getService(
+ ImportServiceMonitorable.class);
importService.addServiceListener(this);
-
+
//sets autocomplete mode to true on start
autocomplete = "true";
}
-
+
protected List<VatStatementAmounts> getDataList() throws TopiaException {
-
+
List<VatStatementAmounts> list = null;
-
+
if (selectedBeginDate != null || selectedEndDate != null) {
try {
list = vatStatementService.vatStatementReport(
getBeginDate(),
getEndDate());
- }
- catch (LimaException eee) {
+ } catch (LimaException eee) {
if (log.isErrorEnabled()) {
log.debug("Can't update model", eee);
}
@@ -118,7 +120,7 @@
return list;
}
- public void refresh(){
+ public void refresh() {
try {
cacheDataList = getDataList();
} catch (TopiaException eee) {
@@ -129,35 +131,35 @@
}
fireTableDataChanged();
}
-
+
@Override
public Class<?> getColumnClass(int column) {
Class<?> result = null;
switch (column) {
- case 0:
- result = String.class; //label
- break;
- case 1:
- result = BigDecimal.class; //solde
- break;
+ case 0:
+ result = String.class; //label
+ break;
+ case 1:
+ result = BigDecimal.class; //solde
+ break;
}
return result;
}
-
+
@Override
public String getColumnName(int column) {
String result = "n/a";
switch (column) {
- case 0:
- result = _("lima.table.label"); //label
- break;
- case 1:
- result = _("lima.table.solde"); //solde
- break;
+ case 0:
+ result = _("lima.table.label"); //label
+ break;
+ case 1:
+ result = _("lima.table.solde"); //solde
+ break;
}
return result;
@@ -166,7 +168,7 @@
@Override
public int getRowCount() {
int result = 0;
-
+
if (cacheDataList != null) {
result = cacheDataList.size();
}
@@ -178,8 +180,8 @@
public int getColumnCount() {
return 2;
}
-
- public VatStatementAmounts getElementAt(int row){
+
+ public VatStatementAmounts getElementAt(int row) {
VatStatementAmounts currentRow = cacheDataList.get(row);
return currentRow;
}
@@ -209,23 +211,23 @@
public void setBeginDate(Date date) {
selectedBeginDate = date;
}
-
+
public Date getBeginDate() {
return selectedBeginDate;
}
-
+
public void setEndDate(Date date) {
selectedEndDate = date;
}
-
+
public Date getEndDate() {
return selectedEndDate;
}
-
+
public String getAutocomplete() {
return autocomplete;
}
-
+
public void setAutocomplete() {
if (getAutocomplete().equals("true")) {
autocomplete = "false";
@@ -233,7 +235,7 @@
autocomplete = "true";
}
}
-
+
@Override
public boolean isCellEditable(int row, int column) {
return false;
@@ -242,7 +244,7 @@
@Override
public void notifyMethod(String serviceName, String methodeName) {
//automatic refresh when FinancialTransaction, VatStatement chart or import for VAT services have been used by the user
- if (serviceName.contains("FinancialTransaction") || methodeName.contains("VatStatement") || methodeName.contains("import") ) {
+ if (serviceName.contains("FinancialTransaction") || methodeName.contains("VatStatement") || methodeName.contains("import")) {
refresh();
}
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportView.jaxx 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportView.jaxx 2011-09-17 14:17:04 UTC (rev 3293)
@@ -23,10 +23,10 @@
#L%
-->
<Table>
- <VatReportViewHandler id="handler" javaBean="new VatReportViewHandler(this)" />
- <Boolean id="selectedRow" javaBean="false" />
+ <VatReportViewHandler id="handler" javaBean="new VatReportViewHandler(this)"/>
+ <Boolean id="selectedRow" javaBean="false"/>
- <script>
+ <script>
<![CDATA[
import org.chorem.lima.entity.FiscalPeriod;
import org.chorem.lima.entity.FinancialPeriod;
@@ -45,40 +45,46 @@
}
]]>
- </script>
-
- <row weightx="1" weighty="0" anchor="center">
- <cell anchor="east">
- <JLabel id="fiscalPeriodLabel" text="lima.charts.fiscalyear"/>
- </cell>
- <cell anchor="west">
- <org.chorem.lima.ui.combobox.FiscalPeriodComboBoxModel id="modelFiscalPeriod"/>
- <JComboBox id="periodComboBox" javaBean="new JComboBox(ComboBoxDatesEnum.descriptions())"
- onActionPerformed="periodSearchPanel.refresh(ComboBoxDatesEnum.valueOfDescription((String) periodComboBox.getSelectedItem()));
+ </script>
+
+ <row weightx="1" weighty="0" anchor="center">
+ <cell anchor="east">
+ <JLabel id="fiscalPeriodLabel" text="lima.charts.fiscalyear"/>
+ </cell>
+ <cell anchor="west">
+ <org.chorem.lima.ui.combobox.FiscalPeriodComboBoxModel
+ id="modelFiscalPeriod"/>
+ <JComboBox id="periodComboBox"
+ javaBean="new JComboBox(ComboBoxDatesEnum.descriptions())"
+ onActionPerformed="periodSearchPanel.refresh(ComboBoxDatesEnum.valueOfDescription((String) periodComboBox.getSelectedItem()));
validate(); repaint()"/>
- </cell>
- <cell><VatReportPeriodSearchPanel javaBean="periodSearchPanel"/></cell>
- <cell>
- <JCheckBox id='autocomplete' text='lima.common.autocomplete' selected='true'
- onActionPerformed="getVatReportTableModel().setAutocomplete()"/>
- </cell>
- <cell>
- <JButton id="editVatButton" text="lima.reports.vat"
- onActionPerformed="getHandler().editVat()"/>
- </cell>
- </row>
- <row>
- <cell fill="both" weightx="1" weighty="1" rows="3" columns="11">
- <JScrollPane>
- <org.chorem.lima.ui.vatreports.VatReportTableModel
- id="vatReportTableModel"/>
- <org.chorem.lima.ui.vatreports.VatReportTable
- id="vatReportTable" sortable="false" rowHeight="22"
- constructorParams="getHandler()" model="{getVatReportTableModel()}"
- selectionMode="{ListSelectionModel.SINGLE_SELECTION}" />
- <javax.swing.ListSelectionModel javaBean="getVatReportTable().getSelectionModel()"
- onValueChanged="setSelectedRow(vatReportTable.getSelectedRow() != -1)"/>
- </JScrollPane>
- </cell>
- </row>
+ </cell>
+ <cell>
+ <VatReportPeriodSearchPanel javaBean="periodSearchPanel"/>
+ </cell>
+ <cell>
+ <JCheckBox id='autocomplete' text='lima.common.autocomplete'
+ selected='true'
+ onActionPerformed="getVatReportTableModel().setAutocomplete()"/>
+ </cell>
+ <cell>
+ <JButton id="editVatButton" text="lima.reports.vat"
+ onActionPerformed="getHandler().editVat()"/>
+ </cell>
+ </row>
+ <row>
+ <cell fill="both" weightx="1" weighty="1" rows="3" columns="11">
+ <JScrollPane>
+ <org.chorem.lima.ui.vatreports.VatReportTableModel
+ id="vatReportTableModel"/>
+ <org.chorem.lima.ui.vatreports.VatReportTable
+ id="vatReportTable" sortable="false" rowHeight="22"
+ constructorParams="getHandler()" model="{getVatReportTableModel()}"
+ selectionMode="{ListSelectionModel.SINGLE_SELECTION}"/>
+ <javax.swing.ListSelectionModel
+ javaBean="getVatReportTable().getSelectionModel()"
+ onValueChanged="setSelectedRow(vatReportTable.getSelectedRow() != -1)"/>
+ </JScrollPane>
+ </cell>
+ </row>
</Table>
\ No newline at end of file
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportViewHandler.java 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportViewHandler.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -24,12 +24,6 @@
*/
package org.chorem.lima.ui.vatreports;
-import java.awt.Desktop;
-import java.io.IOException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.text.SimpleDateFormat;
-
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.LimaConfig;
@@ -38,56 +32,58 @@
import org.chorem.lima.business.utils.DocumentsEnum;
import org.chorem.lima.service.LimaServiceFactory;
+import java.awt.Desktop;
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.text.SimpleDateFormat;
+
public class VatReportViewHandler {
/** log. */
private static final Log log =
- LogFactory.getLog(VatReportViewHandler.class);
-
+ LogFactory.getLog(VatReportViewHandler.class);
+
protected VatReportView view;
-
+
protected VatReportTable table;
-
+
protected VatReportTableModel tableModel;
-
+
protected DocumentServiceMonitorable documentService;
-
+
private static SimpleDateFormat dateFormat =
- new SimpleDateFormat("yyyy-MM-dd");
-
+ new SimpleDateFormat("yyyy-MM-dd");
+
protected int port;
-
+
protected VatReportViewHandler(VatReportView view) {
this.view = view;
-
+
port = LimaServiceFactory.getInstance().getService(
HttpServerServiceMonitorable.class).getHttpPort();
-
+
documentService =
- LimaServiceFactory.getInstance().getService(
- DocumentServiceMonitorable.class);
+ LimaServiceFactory.getInstance().getService(
+ DocumentServiceMonitorable.class);
}
-
- /**
- * @return VatView
- */
+
+ /** @return VatView */
public VatReportView getView() {
return view;
}
-
- /**
- * Edit VAT document
- */
+
+ /** Edit VAT document */
public void editVat() {
- if (tableModel.getBeginDate() != null || tableModel.getEndDate() != null){
+ if (tableModel.getBeginDate() != null || tableModel.getEndDate() != null) {
String address = LimaConfig.getInstance().getHostAdress();
-
+
try {
- String url = "http://"+address+":"+port+"/?beginDate="
- + dateFormat.format(tableModel.getBeginDate())
- + "&endDate=" + dateFormat.format(tableModel.getEndDate())
- + "&format=.pdf&model=" + DocumentsEnum.VAT.getFileName()
- + "&autocomplete=" + tableModel.getAutocomplete();
- Desktop.getDesktop().browse(new URI(url));
+ String url = "http://" + address + ":" + port + "/?beginDate="
+ + dateFormat.format(tableModel.getBeginDate())
+ + "&endDate=" + dateFormat.format(tableModel.getEndDate())
+ + "&format=.pdf&model=" + DocumentsEnum.VAT.getFileName()
+ + "&autocomplete=" + tableModel.getAutocomplete();
+ Desktop.getDesktop().browse(new URI(url));
} catch (IOException e) {
log.error("Can't open browser", e);
} catch (URISyntaxException e) {
@@ -95,13 +91,11 @@
}
}
}
-
- /**
- * Refresh VatTableModel
- */
- public void refresh(){
+
+ /** Refresh VatTableModel */
+ public void refresh() {
tableModel = view.getVatReportTableModel();
tableModel.refresh();
}
-
+
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/util/AccountToString.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/util/AccountToString.java 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/util/AccountToString.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -29,16 +29,16 @@
import org.jdesktop.swingx.autocomplete.ObjectToStringConverter;
public class AccountToString extends ObjectToStringConverter {
-
+
private static AccountToString converter;
-
+
@Override
public String getPreferredStringForItem(Object item) {
String result = null;
- if (item != null){
- if (item instanceof Account){
+ if (item != null) {
+ if (item instanceof Account) {
Account account = (Account) item;
- result = account.getAccountNumber()+" - "+account.getLabel();
+ result = account.getAccountNumber() + " - " + account.getLabel();
}
}
return result;
@@ -50,5 +50,5 @@
}
return converter;
}
-
+
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/util/EntryBookToString.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/util/EntryBookToString.java 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/util/EntryBookToString.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -28,23 +28,23 @@
import org.chorem.lima.entity.EntryBook;
import org.jdesktop.swingx.autocomplete.ObjectToStringConverter;
-public class EntryBookToString extends ObjectToStringConverter{
+public class EntryBookToString extends ObjectToStringConverter {
private static EntryBookToString converter;
-
+
@Override
public String getPreferredStringForItem(Object item) {
String result = null;
- if (item != null){
- if (item instanceof EntryBook){
+ if (item != null) {
+ if (item instanceof EntryBook) {
EntryBook entryBook = (EntryBook) item;
- result = entryBook.getCode()+" - "+entryBook.getLabel();
+ result = entryBook.getCode() + " - " + entryBook.getLabel();
}
}
return result;
}
-
-
+
+
public static EntryBookToString getInstance() {
if (converter == null) {
converter = new EntryBookToString();
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/util/ErrorHelper.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/util/ErrorHelper.java 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/util/ErrorHelper.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -25,18 +25,6 @@
package org.chorem.lima.util;
-import static org.nuiton.i18n.I18n._;
-
-import java.awt.Component;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Date;
-import java.util.List;
-
-import javax.swing.JOptionPane;
-
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -47,35 +35,46 @@
import org.jdesktop.swingx.error.ErrorInfo;
import org.jdesktop.swingx.error.ErrorReporter;
+import javax.swing.JOptionPane;
+import java.awt.Component;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
+
+import static org.nuiton.i18n.I18n._;
+
/**
* Error helper.
- *
+ * <p/>
* Used to easily switch real exception interface. Currently used : swingx.
- *
+ *
* @author chatellier
* @version $Revision$
- *
- * Last update : $Date$
- * By : $Author$
+ * <p/>
+ * Last update : $Date$
+ * By : $Author$
*/
public class ErrorHelper implements ErrorReporter {
/** Log. */
private static final Log log = LogFactory.getLog(ErrorHelper.class);
-
+
/**
* Display a user friendly error frame.
- *
- * @param parent parent component
+ *
+ * @param parent parent component
* @param message message for user
- * @param cause exception cause
+ * @param cause exception cause
*/
public static void showErrorDialog(Component parent, String message,
- Throwable cause) {
+ Throwable cause) {
JXErrorPane pane = new JXErrorPane();
ErrorInfo info = new ErrorInfo(_("lima.common.error"),
- _("lima.error.errorpane.htmlmessage", message), null, null,
- cause, null, null);
+ _("lima.error.errorpane.htmlmessage", message), null, null,
+ cause, null, null);
pane.setErrorInfo(info);
pane.setErrorReporter(new ErrorHelper());
JXErrorPane.showDialog(parent, pane);
@@ -83,7 +82,7 @@
/**
* Display a user friendly error frame.
- *
+ *
* @param message message for user
*/
public static void showErrorDialog(String message) {
@@ -92,9 +91,9 @@
/**
* Display a user friendly error frame.
- *
+ *
* @param message message for user
- * @param cause exception cause
+ * @param cause exception cause
*/
public static void showErrorDialog(String message, Throwable cause) {
showErrorDialog(null, message, cause);
@@ -148,15 +147,15 @@
// send mail
email.send();
-
+
JOptionPane.showMessageDialog(null, "A report message has been sent to " + emailTo);
} catch (EmailException ex) {
if (log.isErrorEnabled()) {
- log.error("Can't send report email" ,ex);
+ log.error("Can't send report email", ex);
}
}
}
-
+
protected String formatMessage(String category, String content) {
String formatted = category + " :\n";
if (StringUtils.isNotEmpty(content)) {
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/util/LetterToString.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/util/LetterToString.java 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/util/LetterToString.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -25,20 +25,31 @@
package org.chorem.lima.util;
+import org.chorem.lima.LimaContext;
import org.chorem.lima.entity.Letter;
import org.jdesktop.swingx.autocomplete.ObjectToStringConverter;
+import org.nuiton.util.decorator.Decorator;
+import org.nuiton.util.decorator.DecoratorProvider;
public class LetterToString extends ObjectToStringConverter {
-
+
private static LetterToString converter;
-
+
+ protected Decorator<Letter> decorator;
+
+ public LetterToString() {
+
+ DecoratorProvider provider = LimaContext.get().getDecoratorProvider();
+ decorator = provider.getDecoratorByType(Letter.class);
+ }
+
@Override
public String getPreferredStringForItem(Object item) {
String result = null;
- if (item != null){
- if (item instanceof Letter){
+ if (item != null) {
+ if (item instanceof Letter) {
Letter letter = (Letter) item;
- result = letter.getCode();
+ result = decorator.toString(letter);
}
}
return result;
@@ -50,5 +61,5 @@
}
return converter;
}
-
+
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/widgets/JWideComboBox.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/widgets/JWideComboBox.java 2011-09-17 13:50:17 UTC (rev 3292)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/widgets/JWideComboBox.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -25,46 +25,15 @@
package org.chorem.lima.widgets;
-import java.awt.Dimension;
-
import javax.swing.ComboBoxModel;
import javax.swing.JComboBox;
-import javax.swing.JScrollPane;
-import javax.swing.plaf.basic.BasicComboPopup;
-import javax.swing.plaf.basic.ComboPopup;
-import javax.swing.plaf.metal.MetalComboBoxUI;
+import java.awt.Dimension;
-// put it at begin, otherwise jaxx complains again !!!
-class ScrollMetalComboUI extends MetalComboBoxUI {
-
- @Override
- protected ComboPopup createPopup() {
- return new ScrollBasicComboPopup(comboBox);
- }
-}
-
-//put it at begin, otherwise jaxx complains again !!!
-class ScrollBasicComboPopup extends BasicComboPopup {
-
- /** serialVersionUID. */
- private static final long serialVersionUID = 2353523521723292218L;
-
- public ScrollBasicComboPopup(JComboBox combo) {
- super(combo);
- }
-
- @Override
- protected JScrollPane createScroller() {
- return new JScrollPane(list, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
- JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
- }
-}
-
/**
* Cette combo box surcharge quelques methodes de l'UI par defaut
* pour que le composant popup soit plus grand que la combobox
* elle même.
- *
+ *
* @author ore
*/
public class JWideComboBox extends JComboBox {
Added: trunk/lima-swing/src/main/java/org/chorem/lima/widgets/ScrollBasicComboPopup.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/widgets/ScrollBasicComboPopup.java (rev 0)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/widgets/ScrollBasicComboPopup.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -0,0 +1,27 @@
+package org.chorem.lima.widgets;
+
+import javax.swing.JComboBox;
+import javax.swing.JScrollPane;
+import javax.swing.plaf.basic.BasicComboPopup;
+
+/**
+ * TODO
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since TODO
+ */ //put it at begin, otherwise jaxx complains again !!!
+public class ScrollBasicComboPopup extends BasicComboPopup {
+
+ /** serialVersionUID. */
+ private static final long serialVersionUID = 2353523521723292218L;
+
+ public ScrollBasicComboPopup(JComboBox combo) {
+ super(combo);
+ }
+
+ @Override
+ protected JScrollPane createScroller() {
+ return new JScrollPane(list, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
+ JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
+ }
+}
Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/widgets/ScrollBasicComboPopup.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/lima-swing/src/main/java/org/chorem/lima/widgets/ScrollMetalComboUI.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/widgets/ScrollMetalComboUI.java (rev 0)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/widgets/ScrollMetalComboUI.java 2011-09-17 14:17:04 UTC (rev 3293)
@@ -0,0 +1,18 @@
+package org.chorem.lima.widgets;
+
+import javax.swing.plaf.basic.ComboPopup;
+import javax.swing.plaf.metal.MetalComboBoxUI;
+
+/**
+ * TODO
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since TODO
+ */ // put it at begin, otherwise jaxx complains again !!!
+public class ScrollMetalComboUI extends MetalComboBoxUI {
+
+ @Override
+ protected ComboPopup createPopup() {
+ return new ScrollBasicComboPopup(comboBox);
+ }
+}
Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/widgets/ScrollMetalComboUI.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
1
0
17 Sep '11
Author: tchemit
Date: 2011-09-17 15:50:17 +0200 (Sat, 17 Sep 2011)
New Revision: 3292
Url: http://chorem.org/repositories/revision/lima/3292
Log:
Evolution #456: Nettoyage du code des ui
Modified:
trunk/lima-swing/src/main/java/org/chorem/lima/ui/ClosableTabHeader.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainView.jaxx
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/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/accountsreports/AccountsReportsView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/EntryBookTableCellEditor.java
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/EntryBookView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBookComboBox.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementHeaderForm.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementImportForm.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementMovementForm.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/EntryBookSearchComboBox.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/AddPeriod.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/RetainedEarningsEntryBookForm.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/HomeView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/AddLetterForm.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringView.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/vatchart/VatChartImportForm.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartMovementForm.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/util/ReportDialogView.jaxx
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/ClosableTabHeader.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/ClosableTabHeader.jaxx 2011-09-17 12:59:34 UTC (rev 3291)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/ClosableTabHeader.jaxx 2011-09-17 13:50:17 UTC (rev 3292)
@@ -24,35 +24,30 @@
-->
<Table insets='0,0,0,0' opaque='false'>
- <script>
- <![CDATA[
-
- import java.awt.Dimension;
-
- ]]>
- </script>
-
-
- <String id="title" javaBean='null' />
- <Boolean id="canClose" javaBean='true'/>
+ <import>
+ java.awt.Dimension
+ </import>
- <row fill='both'>
- <cell anchor='west' weightx="1" insets='0,0,0,0'>
- <JLabel id='label' opaque='false' font-size='12'
- verticalAlignment='center' verticalTextPosition='0'
- text='{getTitle()}'/>
- </cell>
- <cell anchor='east' insets='2,15,0,0' weighty='0'>
- <JButton id='closeTab' preferredSize='{new Dimension(16,16)}'
- verticalAlignment='0'
- verticalTextPosition='0'
- opaque='true'
- borderPainted='false'
- focusPainted='false'
- enabled='{isCanClose()}'
- horizontalTextPosition='0'
- actionIcon='closeTab'
- />
- </cell>
- </row>
+ <String id="title" javaBean='null'/>
+ <Boolean id="canClose" javaBean='true'/>
+
+ <row fill='both'>
+ <cell anchor='west' weightx="1" insets='0,0,0,0'>
+ <JLabel id='label' opaque='false' font-size='12'
+ verticalAlignment='center' verticalTextPosition='0'
+ text='{getTitle()}'/>
+ </cell>
+ <cell anchor='east' insets='2,15,0,0' weighty='0'>
+ <JButton id='closeTab' preferredSize='{new Dimension(16,16)}'
+ verticalAlignment='0'
+ verticalTextPosition='0'
+ opaque='true'
+ borderPainted='false'
+ focusPainted='false'
+ enabled='{isCanClose()}'
+ horizontalTextPosition='0'
+ actionIcon='closeTab'
+ />
+ </cell>
+ </row>
</Table>
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 2011-09-17 12:59:34 UTC (rev 3291)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainView.jaxx 2011-09-17 13:50:17 UTC (rev 3292)
@@ -22,31 +22,35 @@
<http://www.gnu.org/licenses/gpl-3.0.html>.
#L%
-->
-
+
<JFrame title="lima.title" onWindowClosing="getHandler().close(this)"
defaultCloseOperation="do_nothing_on_close"
undecorated='{getConfig().isFullScreen()}'
resizable="true" width="800" height="600"
extendedState='{this.MAXIMIZED_BOTH}'
iconImage='{new ImageIcon(getClass().getResource("/images/puzzle_icon.png")).getImage()}'>
-
-<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.net.URISyntaxException;
- import java.net.URI;
- import org.chorem.lima.business.HttpServerServiceMonitorable;
- import org.chorem.lima.service.LimaServiceFactory;
- import java.awt.Component;
- import javax.swing.BoxLayout;
- import javax.swing.border.EtchedBorder;
- import javax.swing.ImageIcon;
- import java.io.IOException;
- import javax.swing.JButton;
+ <import>
+ java.awt.Component
+ java.awt.Desktop
+ java.io.IOException
+ java.net.URI
+ java.net.URISyntaxException
+ java.util.Locale
+ javax.swing.BoxLayout
+ javax.swing.border.EtchedBorder
+ javax.swing.ImageIcon
+ javax.swing.JButton
+ org.chorem.lima.LimaConfig
+ org.chorem.lima.business.HttpServerServiceMonitorable
+ org.chorem.lima.enums.ImportExportEnum
+ org.chorem.lima.service.LimaServiceFactory
+ </import>
+
+ <Desktop id='desktop' javaBean='Desktop.getDesktop()'/>
+ <script><![CDATA[
+
public LimaConfig getConfig() {
return getContextValue(LimaConfig.class);
}
@@ -114,139 +118,175 @@
showTab(name, container, true);
}
]]>
- </script>
-
- <JMenuBar>
-
- <JMenu text="lima.menu.file">
- <JMenu text="lima.importexport.csv">
- <JMenu text="lima.importexport.import" actionIcon='import-element'>
- <JMenuItem text="lima.importexport.all" onActionPerformed='getHandler().showImportExportView(this, ImportExportEnum.CSV_ALL_IMPORT)'/>
- <JMenuItem text="lima.importexport.accountcharts" onActionPerformed='getHandler().showImportExportView(this, ImportExportEnum.CSV_ACCOUNTCHARTS_IMPORT)'/>
- <JMenuItem text="lima.common.entrybooks" onActionPerformed='getHandler().showImportExportView(this, ImportExportEnum.CSV_ENTRYBOOKS_IMPORT)'/>
- <JMenuItem text="lima.importexport.financialstatements" onActionPerformed='getHandler().showImportExportView(this, ImportExportEnum.CSV_FINANCIALSTATEMENTS_IMPORT)'/>
- <JMenuItem text="lima.importexport.vatstatements" onActionPerformed='getHandler().showImportExportView(this, ImportExportEnum.CSV_VAT_IMPORT)'/>
- </JMenu>
- <JMenu text="lima.importexport.export" actionIcon='export-element'>
- <JMenuItem text="lima.importexport.all" onActionPerformed='getHandler().showImportExportView(this, ImportExportEnum.CSV_ALL_EXPORT)'/>
- <JMenuItem text="lima.importexport.accountcharts" onActionPerformed='getHandler().showImportExportView(this, ImportExportEnum.CSV_ACCOUNTCHARTS_EXPORT)'/>
- <JMenuItem text="lima.common.entrybooks" onActionPerformed='getHandler().showImportExportView(this, ImportExportEnum.CSV_ENTRYBOOKS_EXPORT)'/>
- <JMenuItem text="lima.importexport.financialstatements" onActionPerformed='getHandler().showImportExportView(this, ImportExportEnum.CSV_FINANCIALSTATEMENTS_EXPORT)'/>
- <JMenuItem text="lima.importexport.vatstatements" onActionPerformed='getHandler().showImportExportView(this, ImportExportEnum.CSV_VAT_EXPORT)'/>
- </JMenu>
- </JMenu>
- <JMenu text="lima.importexport.ebp">
- <JMenu text="lima.importexport.import" actionIcon='import-element'>
- <JMenuItem text="lima.importexport.accountcharts" onActionPerformed='getHandler().showImportExportView(this, ImportExportEnum.EBP_ACCOUNTCHARTS_IMPORT)'/>
- <JMenuItem text="lima.importexport.entries" onActionPerformed='getHandler().showImportExportView(this, ImportExportEnum.EBP_ENTRIES_IMPORT)'/>
- </JMenu>
- <JMenu text="lima.importexport.export" actionIcon='export-element'>
- <JMenuItem text="lima.importexport.accountcharts" onActionPerformed='getHandler().showImportExportView(this, ImportExportEnum.EBP_ACCOUNTCHARTS_EXPORT)'/>
- <JMenuItem text="lima.importexport.entries" onActionPerformed='getHandler().showImportExportView(this, ImportExportEnum.EBP_ENTRIES_EXPORT)'/>
- </JMenu>
- </JMenu>
- <JSeparator/>
- <JMenuItem actionIcon='documents' text="lima.documents"
- onActionPerformed="loadURI()"/>
- <JSeparator/>
- <JMenuItem text="lima.identity"
- actionIcon="identity" onActionPerformed="getHandler().showIdentity(this)"/>
- <JMenuItem text="lima.preferences"
- actionIcon="config" onActionPerformed="getHandler().showConfig(this)"/>
- <JSeparator/>
- <JMenuItem mnemonic="{'Q'}"
- actionIcon='quit'
- text="lima.common.quit" onActionPerformed='getHandler().close(this)'/>
- </JMenu>
+ </script>
- <JMenu text="lima.structure" mnemonic="{'S'}">
- <JMenuItem text="lima.charts.account" onActionPerformed='getHandler().showAccountView(this)'
- actionIcon='charts-accounts'/>
- <JMenuItem text="lima.common.entrybooks" onActionPerformed='getHandler().showEntryBookView(this)'
- actionIcon='charts-entrybooks'/>
- <JMenuItem text="lima.charts.fiscalyear" onActionPerformed='getHandler().showFiscalPeriodView(this)'
- actionIcon='charts-fiscalperiod'/>
- <JMenuItem text="lima.charts.financialperiod" onActionPerformed='getHandler().showFinancialPeriodView(this)'
- actionIcon='charts-financialperiod'/>
- <JMenuItem text="lima.charts.financialstatement" onActionPerformed='getHandler().showFinancialStatementView(this)'
- actionIcon='charts-financialstatements'/>
- <JMenu text="lima.charts.vatstatement" actionIcon='charts-vatstatements'>
- <JMenuItem text="lima.charts.vatstatement" onActionPerformed='getHandler().showVatChartView(this)'
- actionIcon='charts-vatstatements'/>
- <JMenuItem text="lima.charts.vatpdf" onActionPerformed='getHandler().showImportExportView(this, ImportExportEnum.PDF_VAT_IMPORT)'
- actionIcon='charts-vatstatements'/>
- </JMenu>
- </JMenu>
+ <JMenuBar>
- <JMenu text="lima.entries" mnemonic="{'E'}">
- <JMenuItem text="lima.entries.writetransaction" onActionPerformed='getHandler().showTransactionView(this)'
- actionIcon='entries-balanced'/>
- <JMenuItem text="lima.entries.searchunbalancedtransaction" onActionPerformed='getHandler().showTransactionUnbalancedView(this)'
- actionIcon='entries-unbalanced'/>
- <JMenuItem text="lima.entries.searchtransaction" onActionPerformed='getHandler().showTransactionSearchView(this)'
- actionIcon='entries-search'/>
- <JMenuItem text="lima.entries.lettering" onActionPerformed='getHandler().showLetteringView(this)'
- actionIcon='lettering'/>
+ <JMenu text="lima.menu.file">
+ <JMenu text="lima.importexport.csv">
+ <JMenu text="lima.importexport.import" actionIcon='import-element'>
+ <JMenuItem text="lima.importexport.all"
+ onActionPerformed='getHandler().showImportExportView(this, ImportExportEnum.CSV_ALL_IMPORT)'/>
+ <JMenuItem text="lima.importexport.accountcharts"
+ onActionPerformed='getHandler().showImportExportView(this, ImportExportEnum.CSV_ACCOUNTCHARTS_IMPORT)'/>
+ <JMenuItem text="lima.common.entrybooks"
+ onActionPerformed='getHandler().showImportExportView(this, ImportExportEnum.CSV_ENTRYBOOKS_IMPORT)'/>
+ <JMenuItem text="lima.importexport.financialstatements"
+ onActionPerformed='getHandler().showImportExportView(this, ImportExportEnum.CSV_FINANCIALSTATEMENTS_IMPORT)'/>
+ <JMenuItem text="lima.importexport.vatstatements"
+ onActionPerformed='getHandler().showImportExportView(this, ImportExportEnum.CSV_VAT_IMPORT)'/>
</JMenu>
- <JMenu text="lima.reports" mnemonic="{'R'}">
- <JMenuItem text="lima.reports.accounts" onActionPerformed='getHandler().showAccountReports(this)'
- actionIcon='reports-account'/>
- <JMenuItem text="lima.reports.entrybooks" onActionPerformed='getHandler().showEntryBookReports(this)'
- actionIcon='reports-entrybook'/>
- <JMenuItem text="lima.reports.balance" onActionPerformed='getHandler().showBalanceView(this)'
- actionIcon='reports-balance'/>
- <JMenuItem text="lima.reports.ledger" onActionPerformed='getHandler().showLedgerView(this)'
- actionIcon='reports-ledger'/>
- <JMenuItem text="lima.reports.financialstatement" onActionPerformed='getHandler().showFinancialStatementReportsView(this)'
- actionIcon='reports-financialstatement'/>
- <JMenuItem text="lima.reports.vat" onActionPerformed='getHandler().showVatReportView(this)'
- actionIcon='reports-vatstatement'/>
-
+ <JMenu text="lima.importexport.export" actionIcon='export-element'>
+ <JMenuItem text="lima.importexport.all"
+ onActionPerformed='getHandler().showImportExportView(this, ImportExportEnum.CSV_ALL_EXPORT)'/>
+ <JMenuItem text="lima.importexport.accountcharts"
+ onActionPerformed='getHandler().showImportExportView(this, ImportExportEnum.CSV_ACCOUNTCHARTS_EXPORT)'/>
+ <JMenuItem text="lima.common.entrybooks"
+ onActionPerformed='getHandler().showImportExportView(this, ImportExportEnum.CSV_ENTRYBOOKS_EXPORT)'/>
+ <JMenuItem text="lima.importexport.financialstatements"
+ onActionPerformed='getHandler().showImportExportView(this, ImportExportEnum.CSV_FINANCIALSTATEMENTS_EXPORT)'/>
+ <JMenuItem text="lima.importexport.vatstatements"
+ onActionPerformed='getHandler().showImportExportView(this, ImportExportEnum.CSV_VAT_EXPORT)'/>
</JMenu>
+ </JMenu>
+ <JMenu text="lima.importexport.ebp">
+ <JMenu text="lima.importexport.import" actionIcon='import-element'>
+ <JMenuItem text="lima.importexport.accountcharts"
+ onActionPerformed='getHandler().showImportExportView(this, ImportExportEnum.EBP_ACCOUNTCHARTS_IMPORT)'/>
+ <JMenuItem text="lima.importexport.entries"
+ onActionPerformed='getHandler().showImportExportView(this, ImportExportEnum.EBP_ENTRIES_IMPORT)'/>
+ </JMenu>
+ <JMenu text="lima.importexport.export" actionIcon='export-element'>
+ <JMenuItem text="lima.importexport.accountcharts"
+ onActionPerformed='getHandler().showImportExportView(this, ImportExportEnum.EBP_ACCOUNTCHARTS_EXPORT)'/>
+ <JMenuItem text="lima.importexport.entries"
+ onActionPerformed='getHandler().showImportExportView(this, ImportExportEnum.EBP_ENTRIES_EXPORT)'/>
+ </JMenu>
+ </JMenu>
+ <JSeparator/>
+ <JMenuItem actionIcon='documents' text="lima.documents"
+ onActionPerformed="loadURI()"/>
+ <JSeparator/>
+ <JMenuItem text="lima.identity"
+ actionIcon="identity"
+ onActionPerformed="getHandler().showIdentity(this)"/>
+ <JMenuItem text="lima.preferences"
+ actionIcon="config"
+ onActionPerformed="getHandler().showConfig(this)"/>
+ <JSeparator/>
+ <JMenuItem mnemonic="{'Q'}"
+ actionIcon='quit'
+ text="lima.common.quit"
+ onActionPerformed='getHandler().close(this)'/>
+ </JMenu>
- <JMenu text="lima.menu.window" mnemonic="{'W'}">
- <JMenuItem id='menuFileFullscreen'
- text="lima.action.fullscreen"
- toolTipText="lima.action.fullscreen.tip"
- actionIcon="fullscreen"
- mnemonic="P"
- visible="{!isUndecorated()}"
- onActionPerformed="getHandler().changeScreen(this, true)"/>
- <JMenuItem id='menuFileNormalscreen'
- text="lima.action.normalscreen"
- toolTipText="lima.action.normalscreen.tip"
- actionIcon="leave-fullscreen"
- mnemonic="N"
- visible="{isUndecorated()}"
- onActionPerformed="getHandler().changeScreen(this, false)"/>
- </JMenu>
-
- <JMenu text="lima.menu.help" mnemonic="{'H'}">
+ <JMenu text="lima.structure" mnemonic="{'S'}">
+ <JMenuItem text="lima.charts.account"
+ onActionPerformed='getHandler().showAccountView(this)'
+ actionIcon='charts-accounts'/>
+ <JMenuItem text="lima.common.entrybooks"
+ onActionPerformed='getHandler().showEntryBookView(this)'
+ actionIcon='charts-entrybooks'/>
+ <JMenuItem text="lima.charts.fiscalyear"
+ onActionPerformed='getHandler().showFiscalPeriodView(this)'
+ actionIcon='charts-fiscalperiod'/>
+ <JMenuItem text="lima.charts.financialperiod"
+ onActionPerformed='getHandler().showFinancialPeriodView(this)'
+ actionIcon='charts-financialperiod'/>
+ <JMenuItem text="lima.charts.financialstatement"
+ onActionPerformed='getHandler().showFinancialStatementView(this)'
+ actionIcon='charts-financialstatements'/>
+ <JMenu text="lima.charts.vatstatement" actionIcon='charts-vatstatements'>
+ <JMenuItem text="lima.charts.vatstatement"
+ onActionPerformed='getHandler().showVatChartView(this)'
+ actionIcon='charts-vatstatements'/>
+ <JMenuItem text="lima.charts.vatpdf"
+ onActionPerformed='getHandler().showImportExportView(this, ImportExportEnum.PDF_VAT_IMPORT)'
+ actionIcon='charts-vatstatements'/>
+ </JMenu>
+ </JMenu>
- <JMenuItem id="help" text='lima.menu.help.help' actionIcon="help"
- onActionPerformed="getHandler().showHelp(this, null)"/>
+ <JMenu text="lima.entries" mnemonic="{'E'}">
+ <JMenuItem text="lima.entries.writetransaction"
+ onActionPerformed='getHandler().showTransactionView(this)'
+ actionIcon='entries-balanced'/>
+ <JMenuItem text="lima.entries.searchunbalancedtransaction"
+ onActionPerformed='getHandler().showTransactionUnbalancedView(this)'
+ actionIcon='entries-unbalanced'/>
+ <JMenuItem text="lima.entries.searchtransaction"
+ onActionPerformed='getHandler().showTransactionSearchView(this)'
+ actionIcon='entries-search'/>
+ <JMenuItem text="lima.entries.lettering"
+ onActionPerformed='getHandler().showLetteringView(this)'
+ actionIcon='lettering'/>
+ </JMenu>
+ <JMenu text="lima.reports" mnemonic="{'R'}">
+ <JMenuItem text="lima.reports.accounts"
+ onActionPerformed='getHandler().showAccountReports(this)'
+ actionIcon='reports-account'/>
+ <JMenuItem text="lima.reports.entrybooks"
+ onActionPerformed='getHandler().showEntryBookReports(this)'
+ actionIcon='reports-entrybook'/>
+ <JMenuItem text="lima.reports.balance"
+ onActionPerformed='getHandler().showBalanceView(this)'
+ actionIcon='reports-balance'/>
+ <JMenuItem text="lima.reports.ledger"
+ onActionPerformed='getHandler().showLedgerView(this)'
+ actionIcon='reports-ledger'/>
+ <JMenuItem text="lima.reports.financialstatement"
+ onActionPerformed='getHandler().showFinancialStatementReportsView(this)'
+ actionIcon='reports-financialstatement'/>
+ <JMenuItem text="lima.reports.vat"
+ onActionPerformed='getHandler().showVatReportView(this)'
+ actionIcon='reports-vatstatement'/>
- <JMenuItem id="site" text='lima.menu.help.site' actionIcon="site"
- onActionPerformed="getHandler().gotoSite(this)"/>
+ </JMenu>
- <JMenuItem id="about" text='lima.menu.help.about' actionIcon="about"
- onActionPerformed="getHandler().showAbout(this)"/>
+ <JMenu text="lima.menu.window" mnemonic="{'W'}">
+ <JMenuItem id='menuFileFullscreen'
+ text="lima.action.fullscreen"
+ toolTipText="lima.action.fullscreen.tip"
+ actionIcon="fullscreen"
+ mnemonic="P"
+ visible="{!isUndecorated()}"
+ onActionPerformed="getHandler().changeScreen(this, true)"/>
+ <JMenuItem id='menuFileNormalscreen'
+ text="lima.action.normalscreen"
+ toolTipText="lima.action.normalscreen.tip"
+ actionIcon="leave-fullscreen"
+ mnemonic="N"
+ visible="{isUndecorated()}"
+ onActionPerformed="getHandler().changeScreen(this, false)"/>
+ </JMenu>
- <JMenu text='lima.menu.help.i18n' mnemonic="{'L'}" actionIcon="translate">
+ <JMenu text="lima.menu.help" mnemonic="{'H'}">
- <JMenuItem id="i18n_fr" actionIcon="i18n-fr" text='lima.menu.help.i18n.fr'
- enabled='{!acceptLocale(getConfig().getLocale(), "fr_FR")}'
- onActionPerformed="getHandler().changeLanguage(this, Locale.FRANCE)"/>
+ <JMenuItem id="help" text='lima.menu.help.help' actionIcon="help"
+ onActionPerformed="getHandler().showHelp(this, null)"/>
- <JMenuItem id="i18n_en" actionIcon="i18n-uk" text='lima.menu.help.i18n.uk'
- enabled='{!acceptLocale(getConfig().getLocale(), "en_GB")}'
- onActionPerformed="getHandler().changeLanguage(this, Locale.UK)"/>
+ <JMenuItem id="site" text='lima.menu.help.site' actionIcon="site"
+ onActionPerformed="getHandler().gotoSite(this)"/>
- </JMenu>
- </JMenu>
- </JMenuBar>
- <JPanel layout='{new BorderLayout()}'>
- <JTabbedPane id="contentTabbedPane" constraints="BorderLayout.CENTER"/>
- </JPanel>
+ <JMenuItem id="about" text='lima.menu.help.about' actionIcon="about"
+ onActionPerformed="getHandler().showAbout(this)"/>
+ <JMenu text='lima.menu.help.i18n' mnemonic="{'L'}" actionIcon="translate">
+
+ <JMenuItem id="i18n_fr" actionIcon="i18n-fr"
+ text='lima.menu.help.i18n.fr'
+ enabled='{!acceptLocale(getConfig().getLocale(), "fr_FR")}'
+ onActionPerformed="getHandler().changeLanguage(this, Locale.FRANCE)"/>
+
+ <JMenuItem id="i18n_en" actionIcon="i18n-uk"
+ text='lima.menu.help.i18n.uk'
+ enabled='{!acceptLocale(getConfig().getLocale(), "en_GB")}'
+ onActionPerformed="getHandler().changeLanguage(this, Locale.UK)"/>
+
+ </JMenu>
+ </JMenu>
+ </JMenuBar>
+ <JPanel layout='{new BorderLayout()}'>
+ <JTabbedPane id="contentTabbedPane" constraints="BorderLayout.CENTER"/>
+ </JPanel>
+
</JFrame>
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 2011-09-17 12:59:34 UTC (rev 3291)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountForm.jaxx 2011-09-17 13:50:17 UTC (rev 3292)
@@ -27,9 +27,14 @@
defaultCloseOperation="{JDialog.DO_NOTHING_ON_CLOSE}"
onWindowClosing="performCancel();">
- <org.chorem.lima.entity.Account id="account" javaBean='null'/>
+ <import>
+ javax.swing.text.Document
+ org.chorem.lima.entity.Account
+ </import>
- <script>
+ <Account id="account" javaBean='null'/>
+
+ <script>
<![CDATA[
getRootPane().setDefaultButton(ok);
protected void performCancel() {
@@ -37,39 +42,40 @@
dispose();
}
]]>
- </script>
+ </script>
- <Table>
-
- <row>
- <cell fill="horizontal">
- <JLabel text="lima.charts.account.number"/>
- </cell>
- <cell fill="horizontal">
- <JTextField id="numberTextField" text="{getAccount().getAccountNumber()}"/>
- <javax.swing.text.Document javaBean="getNumberTextField().getDocument()"
- onInsertUpdate='getAccount().setAccountNumber(getNumberTextField().getText())'
- onRemoveUpdate='getAccount().setAccountNumber(getNumberTextField().getText())' />
- </cell>
- </row>
- <row>
- <cell fill="horizontal">
- <JLabel text="lima.common.label"/>
- </cell>
- <cell fill="horizontal">
- <JTextField id="descriptionTextField" text="{getAccount().getLabel()}"/>
- <javax.swing.text.Document javaBean="getDescriptionTextField().getDocument()"
- onInsertUpdate='getAccount().setLabel(getDescriptionTextField().getText())'
- onRemoveUpdate='getAccount().setLabel(getDescriptionTextField().getText())' />
- </cell>
- </row>
- <row>
- <cell fill="none">
- <JButton text="lima.common.cancel" onActionPerformed="performCancel()"/>
- </cell>
- <cell fill="none">
- <JButton id="ok" text="lima.common.ok" onActionPerformed="dispose()"/>
- </cell>
- </row>
- </Table>
+ <Table>
+
+ <row>
+ <cell fill="horizontal">
+ <JLabel text="lima.charts.account.number"/>
+ </cell>
+ <cell fill="horizontal">
+ <JTextField id="numberTextField"
+ text="{getAccount().getAccountNumber()}"/>
+ <Document javaBean="getNumberTextField().getDocument()"
+ onInsertUpdate='getAccount().setAccountNumber(getNumberTextField().getText())'
+ onRemoveUpdate='getAccount().setAccountNumber(getNumberTextField().getText())'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill="horizontal">
+ <JLabel text="lima.common.label"/>
+ </cell>
+ <cell fill="horizontal">
+ <JTextField id="descriptionTextField" text="{getAccount().getLabel()}"/>
+ <Document javaBean="getDescriptionTextField().getDocument()"
+ onInsertUpdate='getAccount().setLabel(getDescriptionTextField().getText())'
+ onRemoveUpdate='getAccount().setLabel(getDescriptionTextField().getText())'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill="none">
+ <JButton text="lima.common.cancel" onActionPerformed="performCancel()"/>
+ </cell>
+ <cell fill="none">
+ <JButton id="ok" text="lima.common.ok" onActionPerformed="dispose()"/>
+ </cell>
+ </row>
+ </Table>
</JDialog>
\ No newline at end of file
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 2011-09-17 12:59:34 UTC (rev 3291)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountImportForm.jaxx 2011-09-17 13:50:17 UTC (rev 3292)
@@ -27,67 +27,85 @@
defaultCloseOperation="{JDialog.DO_NOTHING_ON_CLOSE}"
onWindowClosing="performCancel();">
- <jaxx.runtime.swing.JAXXButtonGroup id="radioButtons" javaBean='new JAXXButtonGroup()'/>
- <Boolean id="addState" javaBean='true'/>
+ <import>
+ jaxx.runtime.swing.JAXXButtonGroup
+ org.chorem.lima.enums.AccountsChartEnum
+ </import>
- <script>
+ <JAXXButtonGroup id="radioButtons" javaBean='new JAXXButtonGroup()'/>
+ <Boolean id="addState" javaBean='true'/>
+
+ <script>
<![CDATA[
- import org.chorem.lima.enums.AccountsChartEnum;
getRootPane().setDefaultButton(ok);
protected void performCancel() {
getRadioButtons().setSelectedValue(null);
dispose();
}
]]>
- </script>
+ </script>
- <Table>
- <row>
- <cell><JLabel text='lima.opening.accounts' /></cell>
- </row>
- <row>
- <cell>
- <JRadioButton text='lima.charts.account.shortened' value='{AccountsChartEnum.SHORTENED}' buttonGroup="{getRadioButtons()}"
- selected='true'/>
- </cell>
- </row>
- <row>
- <cell>
- <JRadioButton text='lima.charts.account.base' value='{AccountsChartEnum.BASE}' buttonGroup="{getRadioButtons()}"
- selected='true'/>
- </cell>
- </row>
- <row>
- <cell>
- <JRadioButton text='lima.charts.account.developed' value='{AccountsChartEnum.DEVELOPED}' buttonGroup="{getRadioButtons()}"
- selected='true'/>
- </cell>
- </row>
- <row>
- <cell>
- <JRadioButton text='lima.importexport.importcsv' value='{AccountsChartEnum.IMPORT}' buttonGroup="{getRadioButtons()}"
- selected='true'/>
- </cell>
- </row>
- <row>
- <cell>
- <JRadioButton text='lima.importexport.importebp' value='{AccountsChartEnum.IMPORTEBP}' buttonGroup="{getRadioButtons()}"
- selected='true'/>
+ <Table>
+ <row>
+ <cell>
+ <JLabel text='lima.opening.accounts'/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JRadioButton text='lima.charts.account.shortened'
+ value='{AccountsChartEnum.SHORTENED}'
+ buttonGroup="{getRadioButtons()}"
+ selected='true'/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JRadioButton text='lima.charts.account.base'
+ value='{AccountsChartEnum.BASE}'
+ buttonGroup="{getRadioButtons()}"
+ selected='true'/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JRadioButton text='lima.charts.account.developed'
+ value='{AccountsChartEnum.DEVELOPED}'
+ buttonGroup="{getRadioButtons()}"
+ selected='true'/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JRadioButton text='lima.importexport.importcsv'
+ value='{AccountsChartEnum.IMPORT}'
+ buttonGroup="{getRadioButtons()}"
+ selected='true'/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JRadioButton text='lima.importexport.importebp'
+ value='{AccountsChartEnum.IMPORTEBP}'
+ buttonGroup="{getRadioButtons()}"
+ selected='true'/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <Table>
+ <row>
+ <cell fill="none">
+ <JButton text="lima.common.cancel"
+ onActionPerformed="performCancel()"/>
</cell>
- </row>
- <row>
- <cell>
- <Table>
- <row>
- <cell fill="none">
- <JButton text="lima.common.cancel" onActionPerformed="performCancel()"/>
- </cell>
- <cell fill="none">
- <JButton id="ok" text="lima.common.ok" onActionPerformed="dispose()"/>
- </cell>
- </row>
- </Table>
- </cell>
- </row>
- </Table>
+ <cell fill="none">
+ <JButton id="ok" text="lima.common.ok"
+ onActionPerformed="dispose()"/>
+ </cell>
+ </row>
+ </Table>
+ </cell>
+ </row>
+ </Table>
</JDialog>
\ No newline at end of file
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountView.jaxx 2011-09-17 12:59:34 UTC (rev 3291)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountView.jaxx 2011-09-17 13:50:17 UTC (rev 3292)
@@ -22,60 +22,65 @@
<http://www.gnu.org/licenses/gpl-3.0.html>.
#L%
-->
-
+
<Table>
- <AccountViewHandler id="handler" javaBean="new AccountViewHandler(this)" />
- <Boolean id="selectedRow" javaBean="false" />
+ <import>
+ javax.swing.ListSelectionModel
+ org.jdesktop.swingx.decorator.HighlighterFactory
+ </import>
- <script>
+ <AccountViewHandler id="handler" javaBean="new AccountViewHandler(this)"/>
+ <Boolean id="selectedRow" javaBean="false"/>
+
+ <script>
<![CDATA[
-
- ]]>
- </script>
- <row>
- <cell fill="both" weightx="1" weighty="1" rows='5'>
- <JScrollPane>
- <AccountTreeTable id="accountsTreeTable"
- constructorParams="getHandler()"
- selectionMode="{ListSelectionModel.SINGLE_SELECTION}"
- treeTableModel="{new org.chorem.lima.ui.account.AccountTreeTableModel()}"
- highlighters="{org.jdesktop.swingx.decorator.HighlighterFactory.createSimpleStriping(new java.awt.Color(222,222,222))}" />
- <javax.swing.ListSelectionModel
- javaBean="getAccountsTreeTable().getSelectionModel()"
- onValueChanged="setSelectedRow(accountsTreeTable.getSelectedRow() != -1)"/>
- </JScrollPane>
- </cell>
- <cell fill="horizontal">
- <JButton id="addButton" text="lima.charts.account.addAccount"
- onActionPerformed="getHandler().addAccount()"/>
- </cell>
- </row>
- <row>
- <cell fill="horizontal">
- <JButton id="addSubLedger" text="lima.charts.account.addSubLedger"
- onActionPerformed="getHandler().addSubLedger()"/>
- </cell>
- </row>
- <row>
- <cell fill="horizontal">
- <JButton id="updateButton" text="lima.common.update"
- onActionPerformed="getHandler().updateAccount()"
- enabled="{isSelectedRow()}"/>
- </cell>
- </row>
- <row>
- <cell fill="horizontal">
- <JButton id="removeButton" text="lima.common.remove"
- onActionPerformed="getHandler().removeAccount()"
- enabled="{isSelectedRow()}"/>
- </cell>
- </row>
- <row>
- <cell fill="horizontal">
- <JButton id="importButton" text="lima.importexport.import"
- onActionPerformed="getHandler().importAccountsChart()"/>
- </cell>
- </row>
+ ]]>
+ </script>
+
+ <row>
+ <cell fill="both" weightx="1" weighty="1" rows='5'>
+ <JScrollPane>
+ <AccountTreeTable id="accountsTreeTable"
+ constructorParams="getHandler()"
+ selectionMode="{ListSelectionModel.SINGLE_SELECTION}"
+ treeTableModel="{new AccountTreeTableModel()}"
+ highlighters="{HighlighterFactory.createSimpleStriping(new java.awt.Color(222,222,222))}"/>
+ <ListSelectionModel
+ javaBean="getAccountsTreeTable().getSelectionModel()"
+ onValueChanged="setSelectedRow(accountsTreeTable.getSelectedRow() != -1)"/>
+ </JScrollPane>
+ </cell>
+ <cell fill="horizontal">
+ <JButton id="addButton" text="lima.charts.account.addAccount"
+ onActionPerformed="getHandler().addAccount()"/>
+ </cell>
+ </row>
+ <row>
+ <cell fill="horizontal">
+ <JButton id="addSubLedger" text="lima.charts.account.addSubLedger"
+ onActionPerformed="getHandler().addSubLedger()"/>
+ </cell>
+ </row>
+ <row>
+ <cell fill="horizontal">
+ <JButton id="updateButton" text="lima.common.update"
+ onActionPerformed="getHandler().updateAccount()"
+ enabled="{isSelectedRow()}"/>
+ </cell>
+ </row>
+ <row>
+ <cell fill="horizontal">
+ <JButton id="removeButton" text="lima.common.remove"
+ onActionPerformed="getHandler().removeAccount()"
+ enabled="{isSelectedRow()}"/>
+ </cell>
+ </row>
+ <row>
+ <cell fill="horizontal">
+ <JButton id="importButton" text="lima.importexport.import"
+ onActionPerformed="getHandler().importAccountsChart()"/>
+ </cell>
+ </row>
</Table>
\ No newline at end of file
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 2011-09-17 12:59:34 UTC (rev 3291)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/SubLedgerForm.jaxx 2011-09-17 13:50:17 UTC (rev 3292)
@@ -27,9 +27,14 @@
defaultCloseOperation="{JDialog.DO_NOTHING_ON_CLOSE}"
onWindowClosing="performCancel();">
- <org.chorem.lima.entity.Account id="account" javaBean='null'/>
+ <import>
+ javax.swing.text.Document
+ org.chorem.lima.entity.Account
+ </import>
- <script>
+ <Account id="account" javaBean='null'/>
+
+ <script>
<![CDATA[
getRootPane().setDefaultButton(ok);
protected void performCancel() {
@@ -37,51 +42,54 @@
dispose();
}
]]>
- </script>
+ </script>
- <Table>
- <row>
- <cell fill="horizontal">
- <JLabel text="lima.common.code"/>
- </cell>
- <cell fill="horizontal">
- <JTextField id="numberTextField"
- text="{getAccount().getAccountNumber()}"/>
- <javax.swing.text.Document javaBean="getNumberTextField().getDocument()"
- onInsertUpdate='getAccount().setAccountNumber(getNumberTextField().getText())'
- onRemoveUpdate='getAccount().setAccountNumber(getNumberTextField().getText())' />
- </cell>
- </row>
- <row>
- <cell fill="horizontal">
- <JLabel text="lima.common.label"/>
- </cell>
- <cell fill="horizontal">
- <JTextField id="descriptionTextField" text="{getAccount().getLabel()}"/>
- <javax.swing.text.Document javaBean="getDescriptionTextField().getDocument()"
- onInsertUpdate='getAccount().setLabel(getDescriptionTextField().getText())'
- onRemoveUpdate='getAccount().setLabel(getDescriptionTextField().getText())' />
- </cell>
- </row>
- <!-- Lien Fiche contact-->
- <row>
- <cell fill="horizontal">
- <JLabel text="lima.identity.contact"/>
- </cell>
- <cell fill="horizontal">
- <JTextField id="thirdPartyTextField" text="{getAccount().getThirdParty()}"/>
- <javax.swing.text.Document javaBean="getThirdPartyTextField().getDocument()"
- onInsertUpdate='getAccount().setThirdParty(getThirdPartyTextField().getText())'
- onRemoveUpdate='getAccount().setThirdParty(getThirdPartyTextField().getText())' />
- </cell>
- </row>
- <row>
- <cell fill="none">
- <JButton text="lima.common.cancel" onActionPerformed="performCancel()"/>
- </cell>
- <cell fill="none">
- <JButton id="ok" text="lima.common.ok" onActionPerformed="dispose()"/>
- </cell>
- </row>
- </Table>
+ <Table>
+ <row>
+ <cell fill="horizontal">
+ <JLabel text="lima.common.code"/>
+ </cell>
+ <cell fill="horizontal">
+ <JTextField id="numberTextField"
+ text="{getAccount().getAccountNumber()}"/>
+ <Document javaBean="getNumberTextField().getDocument()"
+ onInsertUpdate='getAccount().setAccountNumber(getNumberTextField().getText())'
+ onRemoveUpdate='getAccount().setAccountNumber(getNumberTextField().getText())'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill="horizontal">
+ <JLabel text="lima.common.label"/>
+ </cell>
+ <cell fill="horizontal">
+ <JTextField id="descriptionTextField" text="{getAccount().getLabel()}"/>
+ <Document
+ javaBean="getDescriptionTextField().getDocument()"
+ onInsertUpdate='getAccount().setLabel(getDescriptionTextField().getText())'
+ onRemoveUpdate='getAccount().setLabel(getDescriptionTextField().getText())'/>
+ </cell>
+ </row>
+ <!-- Lien Fiche contact-->
+ <row>
+ <cell fill="horizontal">
+ <JLabel text="lima.identity.contact"/>
+ </cell>
+ <cell fill="horizontal">
+ <JTextField id="thirdPartyTextField"
+ text="{getAccount().getThirdParty()}"/>
+ <Document
+ javaBean="getThirdPartyTextField().getDocument()"
+ onInsertUpdate='getAccount().setThirdParty(getThirdPartyTextField().getText())'
+ onRemoveUpdate='getAccount().setThirdParty(getThirdPartyTextField().getText())'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill="none">
+ <JButton text="lima.common.cancel" onActionPerformed="performCancel()"/>
+ </cell>
+ <cell fill="none">
+ <JButton id="ok" text="lima.common.ok" onActionPerformed="dispose()"/>
+ </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 2011-09-17 12:59:34 UTC (rev 3291)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/UpdateAccountForm.jaxx 2011-09-17 13:50:17 UTC (rev 3292)
@@ -26,14 +26,19 @@
defaultCloseOperation="{JDialog.DO_NOTHING_ON_CLOSE}"
onWindowClosing="performCancel();">
- <org.chorem.lima.entity.Account id="account" javaBean='null'/>
+ <import>
+ javax.swing.text.Document
+ org.chorem.lima.entity.Account
+ org.chorem.lima.entity.AccountImpl
+ org.chorem.lima.business.AccountServiceMonitorable
+ org.chorem.lima.business.LimaException
+ org.chorem.lima.service.LimaServiceFactory
+ </import>
- <script>
+ <Account id="account" javaBean='null'/>
+
+ <script>
<![CDATA[
- import org.chorem.lima.business.AccountServiceMonitorable;
- import org.chorem.lima.service.LimaServiceFactory;
- import org.chorem.lima.business.LimaException;
- import org.chorem.lima.entity.AccountImpl;
getRootPane().setDefaultButton(ok);
protected void performCancel() {
@@ -67,44 +72,46 @@
dispose();
}
]]>
- </script>
+ </script>
- <Table>
-
- <row>
- <cell fill="horizontal">
- <JLabel text="lima.charts.account.number"/>
- </cell>
- <cell fill="horizontal">
- <JTextField id="numberTextField" editable='{false}' text="{getAccount().getAccountNumber()}"/>
- </cell>
- </row>
- <row>
- <cell fill="horizontal">
- <JLabel text="lima.common.label"/>
- </cell>
- <cell fill="horizontal">
- <JTextField id="descriptionTextField" text="{getAccount().getLabel()}"/>
- <javax.swing.text.Document javaBean="getDescriptionTextField().getDocument()"
- onInsertUpdate='getAccount().setLabel(getDescriptionTextField().getText())'
- onRemoveUpdate='getAccount().setLabel(getDescriptionTextField().getText())' />
- </cell>
- </row>
- <row>
- <cell fill="horizontal">
- <JLabel text="lima.common.masteraccount"/>
- </cell>
- <cell fill="horizontal">
- <JTextField id="masterAccountTextField" text="{getAccount().getMasterAccount().getAccountNumber()}"/>
- </cell>
- </row>
- <row>
- <cell fill="none">
- <JButton text="lima.common.cancel" onActionPerformed="performCancel()"/>
- </cell>
- <cell fill="none">
- <JButton id="ok" text="lima.common.ok" onActionPerformed="performOk()"/>
- </cell>
- </row>
- </Table>
+ <Table>
+
+ <row>
+ <cell fill="horizontal">
+ <JLabel text="lima.charts.account.number"/>
+ </cell>
+ <cell fill="horizontal">
+ <JTextField id="numberTextField" editable='{false}'
+ text="{getAccount().getAccountNumber()}"/>
+ </cell>
+ </row>
+ <row>
+ <cell fill="horizontal">
+ <JLabel text="lima.common.label"/>
+ </cell>
+ <cell fill="horizontal">
+ <JTextField id="descriptionTextField" text="{getAccount().getLabel()}"/>
+ <Document javaBean="getDescriptionTextField().getDocument()"
+ onInsertUpdate='getAccount().setLabel(getDescriptionTextField().getText())'
+ onRemoveUpdate='getAccount().setLabel(getDescriptionTextField().getText())'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill="horizontal">
+ <JLabel text="lima.common.masteraccount"/>
+ </cell>
+ <cell fill="horizontal">
+ <JTextField id="masterAccountTextField"
+ text="{getAccount().getMasterAccount().getAccountNumber()}"/>
+ </cell>
+ </row>
+ <row>
+ <cell fill="none">
+ <JButton text="lima.common.cancel" onActionPerformed="performCancel()"/>
+ </cell>
+ <cell fill="none">
+ <JButton id="ok" text="lima.common.ok" onActionPerformed="performOk()"/>
+ </cell>
+ </row>
+ </Table>
</JDialog>
\ No newline at end of file
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 2011-09-17 12:59:34 UTC (rev 3291)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/UpdateSubLedgerForm.jaxx 2011-09-17 13:50:17 UTC (rev 3292)
@@ -26,15 +26,20 @@
defaultCloseOperation="{JDialog.DO_NOTHING_ON_CLOSE}"
onWindowClosing="performCancel();">
- <org.chorem.lima.entity.Account id="account" javaBean='null'/>
+ <import>
+ javax.swing.text.Document
+ org.chorem.lima.entity.Account
+ org.chorem.lima.entity.AccountImpl
+ org.chorem.lima.business.AccountServiceMonitorable
+ org.chorem.lima.business.LimaException
+ org.chorem.lima.service.LimaServiceFactory
+ </import>
- <script>
+ <Account id="account" javaBean='null'/>
+
+ <script>
<![CDATA[
- import org.chorem.lima.business.AccountServiceMonitorable;
- import org.chorem.lima.service.LimaServiceFactory;
- import org.chorem.lima.business.LimaException;
- import org.chorem.lima.entity.AccountImpl;
-
+
getRootPane().setDefaultButton(ok);
protected void performCancel() {
setAccount(null);
@@ -67,59 +72,63 @@
dispose();
}
]]>
- </script>
+ </script>
- <Table>
- <row>
- <cell fill="horizontal">
- <JLabel text="lima.common.code"/>
- </cell>
- <cell fill="horizontal">
- <JTextField id="numberTextField"
- text="{getAccount().getAccountNumber()}"/>
- <javax.swing.text.Document javaBean="getNumberTextField().getDocument()"
- onInsertUpdate='getAccount().setAccountNumber(getNumberTextField().getText())'
- onRemoveUpdate='getAccount().setAccountNumber(getNumberTextField().getText())' />
- </cell>
- </row>
- <row>
- <cell fill="horizontal">
- <JLabel text="lima.common.label"/>
- </cell>
- <cell fill="horizontal">
- <JTextField id="descriptionTextField" text="{getAccount().getLabel()}"/>
- <javax.swing.text.Document javaBean="getDescriptionTextField().getDocument()"
- onInsertUpdate='getAccount().setLabel(getDescriptionTextField().getText())'
- onRemoveUpdate='getAccount().setLabel(getDescriptionTextField().getText())' />
- </cell>
- </row>
- <!-- Lien Fiche contact-->
- <row>
- <cell fill="horizontal">
- <JLabel text="lima.identity.contact"/>
- </cell>
- <cell fill="horizontal">
- <JTextField id="thirdPartyTextField" text="{getAccount().getThirdParty()}"/>
- <javax.swing.text.Document javaBean="getThirdPartyTextField().getDocument()"
- onInsertUpdate='getAccount().setThirdParty(getThirdPartyTextField().getText())'
- onRemoveUpdate='getAccount().setThirdParty(getThirdPartyTextField().getText())' />
- </cell>
- </row>
- <row>
- <cell fill="horizontal">
- <JLabel text="lima.common.masteraccount"/>
- </cell>
- <cell fill="horizontal">
- <JTextField id="masterAccountTextField" text="{getAccount().getMasterAccount().getAccountNumber()}"/>
- </cell>
- </row>
- <row>
- <cell fill="none">
- <JButton text="lima.common.cancel" onActionPerformed="performCancel()"/>
- </cell>
- <cell fill="none">
- <JButton id="ok" text="lima.common.ok" onActionPerformed="performOk()"/>
- </cell>
- </row>
- </Table>
+ <Table>
+ <row>
+ <cell fill="horizontal">
+ <JLabel text="lima.common.code"/>
+ </cell>
+ <cell fill="horizontal">
+ <JTextField id="numberTextField"
+ text="{getAccount().getAccountNumber()}"/>
+ <Document javaBean="getNumberTextField().getDocument()"
+ onInsertUpdate='getAccount().setAccountNumber(getNumberTextField().getText())'
+ onRemoveUpdate='getAccount().setAccountNumber(getNumberTextField().getText())'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill="horizontal">
+ <JLabel text="lima.common.label"/>
+ </cell>
+ <cell fill="horizontal">
+ <JTextField id="descriptionTextField" text="{getAccount().getLabel()}"/>
+ <Document
+ javaBean="getDescriptionTextField().getDocument()"
+ onInsertUpdate='getAccount().setLabel(getDescriptionTextField().getText())'
+ onRemoveUpdate='getAccount().setLabel(getDescriptionTextField().getText())'/>
+ </cell>
+ </row>
+ <!-- Lien Fiche contact-->
+ <row>
+ <cell fill="horizontal">
+ <JLabel text="lima.identity.contact"/>
+ </cell>
+ <cell fill="horizontal">
+ <JTextField id="thirdPartyTextField"
+ text="{getAccount().getThirdParty()}"/>
+ <Document
+ javaBean="getThirdPartyTextField().getDocument()"
+ onInsertUpdate='getAccount().setThirdParty(getThirdPartyTextField().getText())'
+ onRemoveUpdate='getAccount().setThirdParty(getThirdPartyTextField().getText())'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill="horizontal">
+ <JLabel text="lima.common.masteraccount"/>
+ </cell>
+ <cell fill="horizontal">
+ <JTextField id="masterAccountTextField"
+ text="{getAccount().getMasterAccount().getAccountNumber()}"/>
+ </cell>
+ </row>
+ <row>
+ <cell fill="none">
+ <JButton text="lima.common.cancel" onActionPerformed="performCancel()"/>
+ </cell>
+ <cell fill="none">
+ <JButton id="ok" text="lima.common.ok" onActionPerformed="performOk()"/>
+ </cell>
+ </row>
+ </Table>
</JDialog>
\ No newline at end of file
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsView.jaxx 2011-09-17 12:59:34 UTC (rev 3291)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsView.jaxx 2011-09-17 13:50:17 UTC (rev 3292)
@@ -24,14 +24,20 @@
-->
<Table>
- <AccountsReportsViewHandler id="handler" javaBean="new AccountsReportsViewHandler(this)" />
- <Boolean id="selectedRow" javaBean="false" />
- <org.chorem.lima.ui.accountsreports.AccountsReportsTableModel id="modelAccountsReportsTable"/>
- <script>
+
+ <import>
+ javax.swing.ListSelectionModel
+ org.jdesktop.swingx.decorator.HighlighterFactory
+ org.chorem.lima.enums.ComboBoxDatesEnum
+ org.chorem.lima.ui.accountsreports.AccountComboBox
+ </import>
+
+ <AccountsReportsViewHandler id="handler"
+ javaBean="new AccountsReportsViewHandler(this)"/>
+ <Boolean id="selectedRow" javaBean="false"/>
+ <AccountsReportsTableModel id="modelAccountsReportsTable"/>
+ <script>
<![CDATA[
-
- import org.chorem.lima.enums.ComboBoxDatesEnum;
- import org.chorem.lima.ui.accountsreports.AccountComboBox;
AccountsReportsPeriodSearchPanel periodSearchPanel = new AccountsReportsPeriodSearchPanel(handler);
AccountComboBox comboBox = new AccountComboBox(handler);
@@ -39,66 +45,77 @@
}
]]>
- </script>
- <row weightx="1" weighty="0" anchor="center">
- <cell fill='both'><Table><row>
- <cell anchor="west"><JComboBox id="periodComboBox" javaBean="new JComboBox(ComboBoxDatesEnum.descriptions())"
- onActionPerformed="periodSearchPanel.refresh(ComboBoxDatesEnum.valueOfDescription((String) periodComboBox.getSelectedItem()));
- validate(); repaint()"/></cell>
- <cell><AccountsReportsPeriodSearchPanel javaBean="periodSearchPanel"/></cell>
- </row></Table></cell>
- <cell anchor="east">
- <JLabel id="accountSelectorLabel" text="lima.common.account"/>
- </cell>
- <cell anchor="west">
- <JComboBox javaBean='comboBox' />
- </cell>
- <cell>
- <JButton id="back" text="lima.common.buttonback"
- onActionPerformed="comboBox.back()"/>
- </cell>
- <cell>
- <JButton id="next" text="lima.common.buttonnext"
- onActionPerformed="comboBox.next()"/>
- </cell>
- </row>
- <row>
- <cell fill="both" weightx="1" weighty="1" columns="6">
- <JScrollPane>
- <org.chorem.lima.ui.accountsreports.AccountsReportsTable id="accountsReportsTable" rowHeight="24"
- constructorParams="getHandler()"
- model="{getModelAccountsReportsTable()}"
- highlighters="{org.jdesktop.swingx.decorator.HighlighterFactory.createSimpleStriping(new java.awt.Color(222,222,222))}"
- selectionMode="{ListSelectionModel.SINGLE_SELECTION}"
- columnControlVisible="true"/>
- <javax.swing.ListSelectionModel javaBean="getAccountsReportsTable().getSelectionModel()"/>
- </JScrollPane>
- </cell>
- </row>
- <row>
- <cell fill="horizontal" weightx="1" columns="7">
- <Table>
- <row fill="horizontal" weightx="1">
- <cell>
- <JLabel text="lima.common.amountdebit" />
- </cell>
- <cell>
- <JLabel id="amountDebitLabel" />
- </cell>
- <cell>
- <JLabel text="lima.common.amountcredit"/>
- </cell>
- <cell>
- <JLabel id="amountCreditLabel" />
- </cell>
- <cell>
- <JLabel id="soldeLabel" text="lima.common.solde"/>
- </cell>
- <cell>
- <JLabel id="amountSoldeLabel"/>
- </cell>
- </row>
- </Table>
- </cell>
- </row>
+ </script>
+ <row weightx="1" weighty="0" anchor="center">
+ <cell fill='both'>
+ <Table>
+ <row>
+ <cell anchor="west">
+ <JComboBox id="periodComboBox"
+ javaBean="new JComboBox(ComboBoxDatesEnum.descriptions())"
+ onActionPerformed="periodSearchPanel.refresh(ComboBoxDatesEnum.valueOfDescription((String) periodComboBox.getSelectedItem()));
+ validate(); repaint()"/>
+ </cell>
+ <cell>
+ <AccountsReportsPeriodSearchPanel javaBean="periodSearchPanel"/>
+ </cell>
+ </row>
+ </Table>
+ </cell>
+ <cell anchor="east">
+ <JLabel id="accountSelectorLabel" text="lima.common.account"/>
+ </cell>
+ <cell anchor="west">
+ <JComboBox javaBean='comboBox'/>
+ </cell>
+ <cell>
+ <JButton id="back" text="lima.common.buttonback"
+ onActionPerformed="comboBox.back()"/>
+ </cell>
+ <cell>
+ <JButton id="next" text="lima.common.buttonnext"
+ onActionPerformed="comboBox.next()"/>
+ </cell>
+ </row>
+ <row>
+ <cell fill="both" weightx="1" weighty="1" columns="6">
+ <JScrollPane>
+ <AccountsReportsTable
+ id="accountsReportsTable" rowHeight="24"
+ constructorParams="getHandler()"
+ model="{getModelAccountsReportsTable()}"
+ highlighters="{HighlighterFactory.createSimpleStriping(new java.awt.Color(222,222,222))}"
+ selectionMode="{ListSelectionModel.SINGLE_SELECTION}"
+ columnControlVisible="true"/>
+ <ListSelectionModel
+ javaBean="getAccountsReportsTable().getSelectionModel()"/>
+ </JScrollPane>
+ </cell>
+ </row>
+ <row>
+ <cell fill="horizontal" weightx="1" columns="7">
+ <Table>
+ <row fill="horizontal" weightx="1">
+ <cell>
+ <JLabel text="lima.common.amountdebit"/>
+ </cell>
+ <cell>
+ <JLabel id="amountDebitLabel"/>
+ </cell>
+ <cell>
+ <JLabel text="lima.common.amountcredit"/>
+ </cell>
+ <cell>
+ <JLabel id="amountCreditLabel"/>
+ </cell>
+ <cell>
+ <JLabel id="soldeLabel" text="lima.common.solde"/>
+ </cell>
+ <cell>
+ <JLabel id="amountSoldeLabel"/>
+ </cell>
+ </row>
+ </Table>
+ </cell>
+ </row>
</Table>
\ No newline at end of file
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceView.jaxx 2011-09-17 12:59:34 UTC (rev 3291)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceView.jaxx 2011-09-17 13:50:17 UTC (rev 3292)
@@ -24,13 +24,21 @@
-->
<Table>
- <BalanceViewHandler id="handler" javaBean="new BalanceViewHandler(this)" />
- <Boolean id="selectedRow" javaBean="false" />
- <org.chorem.lima.ui.balance.BalanceTableModel id="modelBalanceTable"/>
- <script>
+
+ <import>
+ javax.swing.ListSelectionModel
+ javax.swing.text.Document
+ org.jdesktop.swingx.decorator.HighlighterFactory
+ org.chorem.lima.business.utils.FormatsEnum
+ org.chorem.lima.enums.ComboBoxDatesEnum
+ </import>
+
+ <BalanceViewHandler id="handler" javaBean="new BalanceViewHandler(this)"/>
+ <Boolean id="selectedRow" javaBean="false"/>
+ <BalanceTableModel id="modelBalanceTable"/>
+ <script>
<![CDATA[
-
- import org.chorem.lima.enums.ComboBoxDatesEnum;
+
BalancePeriodSearchPanel periodSearchPanel = new BalancePeriodSearchPanel(handler);
void $afterCompleteSetup() {
@@ -38,73 +46,86 @@
]]>
- </script>
- <row weightx="1" weighty="0" anchor="center">
- <cell fill='both'><Table><row>
- <cell anchor="west"><JComboBox id="periodComboBox" javaBean="new JComboBox(ComboBoxDatesEnum.descriptions())"
- onActionPerformed="periodSearchPanel.refresh(ComboBoxDatesEnum.valueOfDescription((String) periodComboBox.getSelectedItem()));
- validate(); repaint()"/></cell>
- <cell><BalancePeriodSearchPanel javaBean="periodSearchPanel"/></cell>
- </row></Table></cell>
- <cell anchor="east">
- <JLabel text="lima.common.filter"/>
- </cell>
- <cell anchor="west">
- <JTextField id='balanceFilter' toolTipText="lima.tooltip.filter" minimumSize='{balanceFilter.getPreferredSize()}'/>
- <javax.swing.text.Document javaBean="balanceFilter.getDocument()"
- onInsertUpdate='handler.setAccountFilter(balanceFilter.getText())'
- onRemoveUpdate='handler.setAccountFilter(balanceFilter.getText())' />
- </cell>
- <cell anchor="center">
- <JCheckBox id='movmentedFilter' text='lima.common.movmentedfilter' selected='false'
- onActionPerformed="getHandler().refresh()"/>
- </cell>
- <cell>
- <EnumEditor id='DocumentEditor'
- constructorParams='org.chorem.lima.business.utils.FormatsEnum.class'/>
- </cell>
- <cell>
- <JButton text="lima.common.ok"
- onActionPerformed="getHandler().createDocument()"/>
- </cell>
- </row>
- <row>
- <cell fill="both" weightx="1" weighty="1" columns="8">
- <JScrollPane>
- <org.chorem.lima.ui.balance.BalanceTable id="balanceTable" rowHeight="24"
- constructorParams="getHandler()"
- model="{getModelBalanceTable()}"
- highlighters="{org.jdesktop.swingx.decorator.HighlighterFactory.createSimpleStriping(new java.awt.Color(222,222,222))}"
- selectionMode="{ListSelectionModel.SINGLE_SELECTION}"
- columnControlVisible="true"/>
- <javax.swing.ListSelectionModel javaBean="getBalanceTable().getSelectionModel()"/>
- </JScrollPane>
- </cell>
- </row>
- <row>
- <cell fill="horizontal" weightx="1" columns="7">
- <Table>
- <row fill="horizontal" weightx="1">
- <cell>
- <JLabel text="lima.common.amountdebit" />
- </cell>
- <cell>
- <JLabel id="amountDebitLabel" />
- </cell>
- <cell>
- <JLabel text="lima.common.amountcredit"/>
- </cell>
- <cell>
- <JLabel id="amountCreditLabel" />
- </cell>
- <cell>
- <JLabel id="soldeLabel" text="lima.common.solde"/>
- </cell>
- <cell>
- <JLabel id="amountSoldeLabel"/>
- </cell>
- </row>
- </Table>
- </cell>
- </row>
+ </script>
+ <row weightx="1" weighty="0" anchor="center">
+ <cell fill='both'>
+ <Table>
+ <row>
+ <cell anchor="west">
+ <JComboBox id="periodComboBox"
+ javaBean="new JComboBox(ComboBoxDatesEnum.descriptions())"
+ onActionPerformed="periodSearchPanel.refresh(ComboBoxDatesEnum.valueOfDescription((String) periodComboBox.getSelectedItem()));
+ validate(); repaint()"/>
+ </cell>
+ <cell>
+ <BalancePeriodSearchPanel javaBean="periodSearchPanel"/>
+ </cell>
+ </row>
+ </Table>
+ </cell>
+ <cell anchor="east">
+ <JLabel text="lima.common.filter"/>
+ </cell>
+ <cell anchor="west">
+ <JTextField id='balanceFilter' toolTipText="lima.tooltip.filter"
+ minimumSize='{balanceFilter.getPreferredSize()}'/>
+ <Document javaBean="balanceFilter.getDocument()"
+ onInsertUpdate='handler.setAccountFilter(balanceFilter.getText())'
+ onRemoveUpdate='handler.setAccountFilter(balanceFilter.getText())'/>
+ </cell>
+ <cell anchor="center">
+ <JCheckBox id='movmentedFilter' text='lima.common.movmentedfilter'
+ selected='false'
+ onActionPerformed="getHandler().refresh()"/>
+ </cell>
+ <cell>
+ <EnumEditor id='DocumentEditor'
+ constructorParams='FormatsEnum.class'/>
+ </cell>
+ <cell>
+ <JButton text="lima.common.ok"
+ onActionPerformed="getHandler().createDocument()"/>
+ </cell>
+ </row>
+ <row>
+ <cell fill="both" weightx="1" weighty="1" columns="8">
+ <JScrollPane>
+ <BalanceTable id="balanceTable"
+ rowHeight="24"
+ constructorParams="getHandler()"
+ model="{getModelBalanceTable()}"
+ highlighters="{HighlighterFactory.createSimpleStriping(new java.awt.Color(222,222,222))}"
+ selectionMode="{ListSelectionModel.SINGLE_SELECTION}"
+ columnControlVisible="true"/>
+ <ListSelectionModel
+ javaBean="getBalanceTable().getSelectionModel()"/>
+ </JScrollPane>
+ </cell>
+ </row>
+ <row>
+ <cell fill="horizontal" weightx="1" columns="7">
+ <Table>
+ <row fill="horizontal" weightx="1">
+ <cell>
+ <JLabel text="lima.common.amountdebit"/>
+ </cell>
+ <cell>
+ <JLabel id="amountDebitLabel"/>
+ </cell>
+ <cell>
+ <JLabel text="lima.common.amountcredit"/>
+ </cell>
+ <cell>
+ <JLabel id="amountCreditLabel"/>
+ </cell>
+ <cell>
+ <JLabel id="soldeLabel" text="lima.common.solde"/>
+ </cell>
+ <cell>
+ <JLabel id="amountSoldeLabel"/>
+ </cell>
+ </row>
+ </Table>
+ </cell>
+ </row>
</Table>
\ No newline at end of file
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/EntryBookTableCellEditor.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/EntryBookTableCellEditor.java 2011-09-17 12:59:34 UTC (rev 3291)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/EntryBookTableCellEditor.java 2011-09-17 13:50:17 UTC (rev 3292)
@@ -29,13 +29,14 @@
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.entity.EntryBook;
import org.chorem.lima.ui.combobox.EntryBookComboBoxModel;
-import org.chorem.lima.ui.combobox.EntryBookRenderer;
+import org.chorem.lima.ui.renderers.RendererUtil;
import org.chorem.lima.util.EntryBookToString;
import org.chorem.lima.widgets.JWideComboBox;
import org.jdesktop.swingx.autocomplete.AutoCompleteDecorator;
import javax.swing.AbstractCellEditor;
import javax.swing.JTable;
+import javax.swing.ListCellRenderer;
import javax.swing.SwingUtilities;
import javax.swing.table.TableCellEditor;
import javax.swing.text.JTextComponent;
@@ -61,8 +62,9 @@
comboBox = new JWideComboBox();
EntryBookComboBoxModel entryBookComboBoxModel = new EntryBookComboBoxModel();
comboBox.setModel(entryBookComboBoxModel);
- EntryBookRenderer entryBookRenderer = new EntryBookRenderer();
- comboBox.setRenderer(entryBookRenderer);
+ ListCellRenderer renderer =
+ RendererUtil.newDecoratorListCellRenderer(EntryBook.class);
+ comboBox.setRenderer(renderer);
// AutoCompletion
AutoCompleteDecorator.decorate(comboBox, EntryBookToString.getInstance());
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 2011-09-17 12:59:34 UTC (rev 3291)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookForm.jaxx 2011-09-17 13:50:17 UTC (rev 3292)
@@ -26,10 +26,14 @@
defaultCloseOperation="{JDialog.DO_NOTHING_ON_CLOSE}"
onWindowClosing="performCancel();">
- <org.chorem.lima.entity.EntryBook id="entryBook" javaBean="null" />
- <Boolean id="addState" javaBean='true'/>
+ <import>
+ javax.swing.text.Document
+ org.chorem.lima.entity.EntryBook
+ </import>
+ <EntryBook id="entryBook" javaBean="null"/>
+ <Boolean id="addState" javaBean='true'/>
- <script>
+ <script>
<![CDATA[
getRootPane().setDefaultButton(okButton);
protected void performCancel() {
@@ -37,39 +41,42 @@
dispose();
}
]]>
- </script>
+ </script>
- <Table>
- <row>
- <cell>
- <JLabel text="lima.common.code"/>
- </cell>
- <cell>
- <JTextField id="entryBookCodeField" text="{getEntryBook().getCode()}"/>
- <javax.swing.text.Document javaBean="getEntryBookCodeField().getDocument()"
- onInsertUpdate='getEntryBook().setCode(getEntryBookCodeField().getText())'
- onRemoveUpdate='getEntryBook().setCode(getEntryBookCodeField().getText())' />
- </cell>
- </row>
- <row>
- <cell>
- <JLabel text="lima.common.label"/>
- </cell>
- <cell>
- <JTextField id="entryBookLabelField" editable='{isAddState()}' text="{getEntryBook().getLabel()}"/>
- <javax.swing.text.Document javaBean="getEntryBookLabelField().getDocument()"
- onInsertUpdate='getEntryBook().setLabel(getEntryBookLabelField().getText())'
- onRemoveUpdate='getEntryBook().setLabel(getEntryBookLabelField().getText())' />
- </cell>
- </row>
- <row>
- <cell>
- <JButton id="cancelButton" text="lima.common.cancel" onActionPerformed="performCancel()"/>
- </cell>
- <cell>
- <JButton id="okButton" text="lima.common.ok" onActionPerformed="dispose()"/>
- </cell>
+ <Table>
+ <row>
+ <cell>
+ <JLabel text="lima.common.code"/>
+ </cell>
+ <cell>
+ <JTextField id="entryBookCodeField" text="{getEntryBook().getCode()}"/>
+ <Document javaBean="getEntryBookCodeField().getDocument()"
+ onInsertUpdate='getEntryBook().setCode(getEntryBookCodeField().getText())'
+ onRemoveUpdate='getEntryBook().setCode(getEntryBookCodeField().getText())'/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JLabel text="lima.common.label"/>
+ </cell>
+ <cell>
+ <JTextField id="entryBookLabelField" editable='{isAddState()}'
+ text="{getEntryBook().getLabel()}"/>
+ <Document javaBean="getEntryBookLabelField().getDocument()"
+ onInsertUpdate='getEntryBook().setLabel(getEntryBookLabelField().getText())'
+ onRemoveUpdate='getEntryBook().setLabel(getEntryBookLabelField().getText())'/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JButton id="cancelButton" text="lima.common.cancel"
+ onActionPerformed="performCancel()"/>
+ </cell>
+ <cell>
+ <JButton id="okButton" text="lima.common.ok"
+ onActionPerformed="dispose()"/>
+ </cell>
- </row>
- </Table>
+ </row>
+ </Table>
</JDialog>
\ No newline at end of file
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 2011-09-17 12:59:34 UTC (rev 3291)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookImportForm.jaxx 2011-09-17 13:50:17 UTC (rev 3292)
@@ -27,44 +27,53 @@
defaultCloseOperation="{JDialog.DO_NOTHING_ON_CLOSE}"
onWindowClosing="performCancel();">
- <jaxx.runtime.swing.JAXXButtonGroup id="radioButtons" javaBean='new JAXXButtonGroup()'/>
- <Boolean id="addState" javaBean='true'/>
+ <import>
+ jaxx.runtime.swing.JAXXButtonGroup
+ org.chorem.lima.enums.EntryBooksChartEnum
+ </import>
+ <JAXXButtonGroup id="radioButtons" javaBean='new JAXXButtonGroup()'/>
+ <Boolean id="addState" javaBean='true'/>
- <script>
+ <script>
<![CDATA[
- import org.chorem.lima.enums.EntryBooksChartEnum;
getRootPane().setDefaultButton(ok);
protected void performCancel() {
getRadioButtons().setSelectedValue(null);
dispose();
}
]]>
- </script>
+ </script>
- <Table>
- <row>
- <cell>
- <JRadioButton text='lima.charts.entrybook.default' value='{EntryBooksChartEnum.DEFAULT}' buttonGroup="{getRadioButtons()}"
- selected='true'/>
+ <Table>
+ <row>
+ <cell>
+ <JRadioButton text='lima.charts.entrybook.default'
+ value='{EntryBooksChartEnum.DEFAULT}'
+ buttonGroup="{getRadioButtons()}"
+ selected='true'/>
+ </cell>
+ <cell>
+ <JRadioButton text='lima.charts.entrybook.import'
+ value='{EntryBooksChartEnum.IMPORT}'
+ buttonGroup="{getRadioButtons()}"
+ selected='true'/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <Table>
+ <row>
+ <cell fill="none">
+ <JButton text="lima.common.cancel"
+ onActionPerformed="performCancel()"/>
</cell>
- <cell>
- <JRadioButton text='lima.charts.entrybook.import' value='{EntryBooksChartEnum.IMPORT}' buttonGroup="{getRadioButtons()}"
- selected='true'/>
- </cell>
- </row>
- <row>
- <cell>
- <Table>
- <row>
- <cell fill="none">
- <JButton text="lima.common.cancel" onActionPerformed="performCancel()"/>
- </cell>
- <cell fill="none">
- <JButton id="ok" text="lima.common.ok" onActionPerformed="dispose()"/>
- </cell>
- </row>
- </Table>
- </cell>
- </row>
- </Table>
+ <cell fill="none">
+ <JButton id="ok" text="lima.common.ok"
+ onActionPerformed="dispose()"/>
+ </cell>
+ </row>
+ </Table>
+ </cell>
+ </row>
+ </Table>
</JDialog>
\ No newline at end of file
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 2011-09-17 12:59:34 UTC (rev 3291)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookView.jaxx 2011-09-17 13:50:17 UTC (rev 3292)
@@ -25,52 +25,53 @@
<Table>
- <EntryBookViewHandler id="handler" javaBean="new EntryBookViewHandler(this)" />
- <!-- Selected row bindings -->
- <Boolean id="selectedRow" javaBean="false" />
+ <import>
+ java.awt.Dimension
+ javax.swing.ListSelectionModel
+ </import>
- <script>
- <![CDATA[
- import java.awt.Dimension;
+ <EntryBookViewHandler id="handler" javaBean="new EntryBookViewHandler(this)"/>
+ <!-- Selected row bindings -->
+ <Boolean id="selectedRow" javaBean="false"/>
- ]]>
- </script>
- <row>
- <cell fill="both" weightx="1" weighty="1" rows='5'>
- <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))}"
- selectionMode="{ListSelectionModel.SINGLE_SELECTION}"
- columnControlVisible="true"/>
- <javax.swing.ListSelectionModel javaBean="getEntryBooksTable().getSelectionModel()"
- onValueChanged="setSelectedRow(entryBooksTable.getSelectedRow() != -1)"/>
- </JScrollPane>
- </cell>
- </row>
- <row>
- <cell fill="horizontal">
- <JButton id="addButton" text="lima.charts.entrybook.add"
- onActionPerformed="getHandler().addEntryBook()"/>
- </cell>
- </row>
- <row>
- <cell fill="horizontal">
- <JButton id="updateButton" text="lima.common.update" enabled="{isSelectedRow()}"
- onActionPerformed="getHandler().updateEntryBook()"/>
- </cell>
- </row>
- <row>
- <cell fill="horizontal">
- <JButton id="removeButton" text="lima.common.remove" enabled="{isSelectedRow()}"
- onActionPerformed="getHandler().deleteEntryBook()"/>
- </cell>
- </row>
- <row>
- <cell fill="horizontal">
- <JButton id="importButton" text="lima.importexport.import"
- onActionPerformed="getHandler().importEntryBooks()"/>
- </cell>
- </row>
+ <row>
+ <cell fill="both" weightx="1" weighty="1" rows='5'>
+ <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))}"
+ 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"
+ onActionPerformed="getHandler().addEntryBook()"/>
+ </cell>
+ </row>
+ <row>
+ <cell fill="horizontal">
+ <JButton id="updateButton" text="lima.common.update"
+ enabled="{isSelectedRow()}"
+ onActionPerformed="getHandler().updateEntryBook()"/>
+ </cell>
+ </row>
+ <row>
+ <cell fill="horizontal">
+ <JButton id="removeButton" text="lima.common.remove"
+ enabled="{isSelectedRow()}"
+ onActionPerformed="getHandler().deleteEntryBook()"/>
+ </cell>
+ </row>
+ <row>
+ <cell fill="horizontal">
+ <JButton id="importButton" text="lima.importexport.import"
+ onActionPerformed="getHandler().importEntryBooks()"/>
+ </cell>
+ </row>
</Table>
\ No newline at end of file
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBookComboBox.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBookComboBox.java 2011-09-17 12:59:34 UTC (rev 3291)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBookComboBox.java 2011-09-17 13:50:17 UTC (rev 3292)
@@ -25,19 +25,19 @@
package org.chorem.lima.ui.entrybooksreports;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.KeyEvent;
-import java.awt.event.KeyListener;
-import javax.swing.JComboBox;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.entity.EntryBook;
import org.chorem.lima.ui.combobox.EntryBookComboBoxModel;
-import org.chorem.lima.ui.combobox.EntryBookRenderer;
+import org.chorem.lima.ui.renderers.RendererUtil;
import org.chorem.lima.util.EntryBookToString;
import org.jdesktop.swingx.autocomplete.AutoCompleteDecorator;
+import javax.swing.JComboBox;
+import java.awt.event.ActionEvent;
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
+
public class EntryBookComboBox extends JComboBox implements KeyListener {
private static final long serialVersionUID = 1L;
@@ -50,9 +50,8 @@
public EntryBookComboBox(EntryBooksReportsViewHandler handler) {
this.handler = handler;
EntryBookComboBoxModel entryBookComboBoxModel = new EntryBookComboBoxModel();
- EntryBookRenderer entryBookRenderer = new EntryBookRenderer();
setModel(entryBookComboBoxModel);
- setRenderer(entryBookRenderer);
+ setRenderer(RendererUtil.newDecoratorListCellRenderer(EntryBook.class));
setEditable(true);
AutoCompleteDecorator.decorate(this, EntryBookToString.getInstance());
getEditor().getEditorComponent().addKeyListener(this);
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsView.jaxx 2011-09-17 12:59:34 UTC (rev 3291)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsView.jaxx 2011-09-17 13:50:17 UTC (rev 3292)
@@ -24,15 +24,22 @@
-->
<Table>
- <EntryBooksReportsViewHandler id="handler" javaBean="new EntryBooksReportsViewHandler(this)" />
- <Boolean id="selectedRow" javaBean="false" />
- <org.chorem.lima.ui.combobox.EntryBookComboBoxModel id="modelEntryBook"/>
- <org.chorem.lima.ui.entrybooksreports.EntryBooksReportsTableModel id="modelTable"/>
- <script>
+ <import>
+ javax.swing.ListSelectionModel
+ org.chorem.lima.enums.ComboBoxDatesEnum
+ org.chorem.lima.ui.combobox.EntryBookComboBoxModel
+ org.chorem.lima.ui.entrybooksreports.EntryBookComboBox
+ org.chorem.lima.ui.entrybooksreports.EntryBooksReportsTable
+ org.chorem.lima.ui.entrybooksreports.EntryBooksReportsTableModel
+ </import>
+ <EntryBooksReportsViewHandler id="handler"
+ javaBean="new EntryBooksReportsViewHandler(this)"/>
+ <Boolean id="selectedRow" javaBean="false"/>
+ <EntryBookComboBoxModel id="modelEntryBook"/>
+ <EntryBooksReportsTableModel id="modelTable"/>
+ <script>
<![CDATA[
-
- import org.chorem.lima.enums.ComboBoxDatesEnum;
- import org.chorem.lima.ui.entrybooksreports.EntryBookComboBox;
+
EntryBooksReportsPeriodSearchPanel periodSearchPanel = new EntryBooksReportsPeriodSearchPanel(handler);
EntryBookComboBox comboBox = new EntryBookComboBox(handler);
@@ -40,72 +47,83 @@
}
]]>
- </script>
- <row weightx="1" weighty="0" anchor="center">
- <cell fill='both'><Table><row>
- <cell anchor="west"><JComboBox id="periodComboBox" javaBean="new JComboBox(ComboBoxDatesEnum.descriptions())"
- onActionPerformed="periodSearchPanel.refresh(ComboBoxDatesEnum.valueOfDescription((String) periodComboBox.getSelectedItem()));
- validate(); repaint()"/></cell>
- <cell><EntryBooksReportsPeriodSearchPanel javaBean="periodSearchPanel"/></cell>
- </row></Table></cell>
- <cell anchor="east">
- <JLabel id="entryBookSelectorLabel" text="lima.common.entrybook"/>
- </cell>
- <cell anchor="west">
- <JComboBox javaBean='comboBox' />
- </cell>
- <cell>
- <JButton id="back" text="lima.common.buttonback"
- onActionPerformed="comboBox.back()"/>
- </cell>
- <cell>
- <JButton id="next" text="lima.common.buttonnext"
- onActionPerformed="comboBox.next()"/>
- </cell>
- <cell>
- <EnumEditor id='DocumentEditor'
- constructorParams='org.chorem.lima.business.utils.FormatsEnum.class'/>
- </cell>
- <cell>
- <JButton text="lima.common.ok"
- onActionPerformed="getHandler().createDocument()"/>
- </cell>
- </row>
- <row>
- <cell fill="both" weightx="1" weighty="1" columns="7">
- <JScrollPane>
- <org.chorem.lima.ui.entrybooksreports.EntryBooksReportsTable
- id="table" sortable="false" rowHeight="24"
- constructorParams="getHandler(), getModelTable()" model="{getModelTable()}"
- selectionMode="{ListSelectionModel.SINGLE_SELECTION}" />
- <javax.swing.ListSelectionModel javaBean="getTable().getSelectionModel()"/>
- </JScrollPane>
- </cell>
- </row>
- <row>
- <cell fill="horizontal" weightx="1" columns="7">
- <Table>
- <row fill="horizontal" weightx="1">
- <cell>
- <JLabel text="lima.common.amountdebit" />
- </cell>
- <cell>
- <JLabel id="amountDebitLabel" />
- </cell>
- <cell>
- <JLabel text="lima.common.amountcredit"/>
- </cell>
- <cell>
- <JLabel id="amountCreditLabel" />
- </cell>
- <cell>
- <JLabel id="soldeLabel" text="lima.common.solde"/>
- </cell>
- <cell>
- <JLabel id="amountSoldeLabel"/>
- </cell>
- </row>
- </Table>
- </cell>
- </row>
+ </script>
+ <row weightx="1" weighty="0" anchor="center">
+ <cell fill='both'>
+ <Table>
+ <row>
+ <cell anchor="west">
+ <JComboBox id="periodComboBox"
+ javaBean="new JComboBox(ComboBoxDatesEnum.descriptions())"
+ onActionPerformed="periodSearchPanel.refresh(ComboBoxDatesEnum.valueOfDescription((String) periodComboBox.getSelectedItem()));
+ validate(); repaint()"/>
+ </cell>
+ <cell>
+ <EntryBooksReportsPeriodSearchPanel javaBean="periodSearchPanel"/>
+ </cell>
+ </row>
+ </Table>
+ </cell>
+ <cell anchor="east">
+ <JLabel id="entryBookSelectorLabel" text="lima.common.entrybook"/>
+ </cell>
+ <cell anchor="west">
+ <JComboBox javaBean='comboBox'/>
+ </cell>
+ <cell>
+ <JButton id="back" text="lima.common.buttonback"
+ onActionPerformed="comboBox.back()"/>
+ </cell>
+ <cell>
+ <JButton id="next" text="lima.common.buttonnext"
+ onActionPerformed="comboBox.next()"/>
+ </cell>
+ <cell>
+ <EnumEditor id='DocumentEditor'
+ constructorParams='org.chorem.lima.business.utils.FormatsEnum.class'/>
+ </cell>
+ <cell>
+ <JButton text="lima.common.ok"
+ onActionPerformed="getHandler().createDocument()"/>
+ </cell>
+ </row>
+ <row>
+ <cell fill="both" weightx="1" weighty="1" columns="7">
+ <JScrollPane>
+ <EntryBooksReportsTable
+ id="table" sortable="false" rowHeight="24"
+ constructorParams="getHandler(), getModelTable()"
+ model="{getModelTable()}"
+ selectionMode="{ListSelectionModel.SINGLE_SELECTION}"/>
+ <ListSelectionModel
+ javaBean="getTable().getSelectionModel()"/>
+ </JScrollPane>
+ </cell>
+ </row>
+ <row>
+ <cell fill="horizontal" weightx="1" columns="7">
+ <Table>
+ <row fill="horizontal" weightx="1">
+ <cell>
+ <JLabel text="lima.common.amountdebit"/>
+ </cell>
+ <cell>
+ <JLabel id="amountDebitLabel"/>
+ </cell>
+ <cell>
+ <JLabel text="lima.common.amountcredit"/>
+ </cell>
+ <cell>
+ <JLabel id="amountCreditLabel"/>
+ </cell>
+ <cell>
+ <JLabel id="soldeLabel" text="lima.common.solde"/>
+ </cell>
+ <cell>
+ <JLabel id="amountSoldeLabel"/>
+ </cell>
+ </row>
+ </Table>
+ </cell>
+ </row>
</Table>
\ No newline at end of file
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodView.jaxx 2011-09-17 12:59:34 UTC (rev 3291)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodView.jaxx 2011-09-17 13:50:17 UTC (rev 3292)
@@ -24,43 +24,53 @@
-->
<Table>
- <FinancialPeriodViewHandler id="handler" javaBean="new FinancialPeriodViewHandler(this)" />
- <Boolean id="selectedPeriod" javaBean="false" />
+ <import>
+ javax.swing.ListSelectionModel
+ org.chorem.lima.entity.FiscalPeriod
+ org.chorem.lima.entity.FinancialPeriod
+ org.chorem.lima.ui.financialperiod.FinancialPeriodTable
+ org.chorem.lima.ui.financialperiod.FinancialPeriodTableModel
+ </import>
- <script>
+ <FinancialPeriodViewHandler id="handler"
+ javaBean="new FinancialPeriodViewHandler(this)"/>
+ <Boolean id="selectedPeriod" javaBean="false"/>
+
+ <script>
<![CDATA[
- import org.chorem.lima.entity.FiscalPeriod;
- import org.chorem.lima.entity.FinancialPeriod;
-
+
void $afterCompleteSetup() {
getHandler().refresh();
}
]]>
- </script>
- <row>
- <cell fill="both" weightx="1" weighty="1">
- <JScrollPane>
- <org.chorem.lima.ui.financialperiod.FinancialPeriodTableModel
- id="modelFinancialPeriodTable"/>
- <org.chorem.lima.ui.financialperiod.FinancialPeriodTable
- id="financialPeriodTable" sortable="false" rowHeight="24"
- constructorParams="getHandler()" model="{getModelFinancialPeriodTable()}"
- selectionMode="{ListSelectionModel.SINGLE_INTERVAL_SELECTION}"
- columnControlVisible="true" />
- <javax.swing.ListSelectionModel javaBean="getFinancialPeriodTable().getSelectionModel()"
- onValueChanged="setSelectedPeriod(financialPeriodTable.getSelectedRow() != -1)"/>
- </JScrollPane>
- </cell>
- <cell fill="horizontal" weighty="1" anchor="north">
- <Table>
- <row>
- <cell>
- <JButton id="blockButton" text="lima.charts.financialperiod.block" enabled="{isSelectedPeriod()}"
- onActionPerformed="getHandler().blockFinancialPeriod();" />
- </cell>
- </row>
- </Table>
- </cell>
- </row>
+ </script>
+ <row>
+ <cell fill="both" weightx="1" weighty="1">
+ <JScrollPane>
+ <FinancialPeriodTableModel
+ id="modelFinancialPeriodTable"/>
+ <FinancialPeriodTable
+ id="financialPeriodTable" sortable="false" rowHeight="24"
+ constructorParams="getHandler()"
+ model="{getModelFinancialPeriodTable()}"
+ selectionMode="{ListSelectionModel.SINGLE_INTERVAL_SELECTION}"
+ columnControlVisible="true"/>
+ <ListSelectionModel
+ javaBean="getFinancialPeriodTable().getSelectionModel()"
+ onValueChanged="setSelectedPeriod(financialPeriodTable.getSelectedRow() != -1)"/>
+ </JScrollPane>
+ </cell>
+ <cell fill="horizontal" weighty="1" anchor="north">
+ <Table>
+ <row>
+ <cell>
+ <JButton id="blockButton" text="lima.charts.financialperiod.block"
+ enabled="{isSelectedPeriod()}"
+ onActionPerformed="getHandler().blockFinancialPeriod();"/>
+ </cell>
+ </row>
+ </Table>
+ </cell>
+ </row>
</Table>
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartView.jaxx 2011-09-17 12:59:34 UTC (rev 3291)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartView.jaxx 2011-09-17 13:50:17 UTC (rev 3292)
@@ -22,67 +22,69 @@
<http://www.gnu.org/licenses/gpl-3.0.html>.
#L%
-->
-
+
<Table>
- <FinancialStatementChartViewHandler id="handler" javaBean="new FinancialStatementChartViewHandler(this)" />
- <Boolean id="selectedRow" javaBean="false" />
+ <import>
+ javax.swing.ListSelectionModel
+ org.jdesktop.swingx.decorator.HighlighterFactory
+ </import>
- <script>
- <![CDATA[
- //getHandler().init();
- ]]>
- </script>
+ <FinancialStatementChartViewHandler id="handler"
+ javaBean="new FinancialStatementChartViewHandler(this)"/>
+ <Boolean id="selectedRow" javaBean="false"/>
- <row>
- <cell fill="both" weightx="1" weighty="1" rows='6'>
- <JScrollPane>
- <FinancialStatementChartTreeTable id="treeTable"
- constructorParams="getHandler()"
- selectionMode="{ListSelectionModel.SINGLE_SELECTION}"
- treeTableModel="{new org.chorem.lima.ui.financialstatementchart.FinancialStatementChartTreeTableModel()}"
- highlighters="{org.jdesktop.swingx.decorator.HighlighterFactory.createSimpleStriping(new java.awt.Color(222,222,222))}" />
- <javax.swing.ListSelectionModel
- javaBean="getTreeTable().getSelectionModel()"
- onValueChanged="setSelectedRow(treeTable.getSelectedRow() != -1)"/>
- </JScrollPane>
- </cell>
- <cell fill="horizontal">
- <JButton id="addFinancialStatementHeader" text="lima.financialstatement.header.add"
- onActionPerformed="getHandler().addFinancialStatementHeader()"/>
- </cell>
- </row>
- <row>
- <cell fill="horizontal">
- <JButton id="addFinancialStatementMovement" text="lima.financialstatement.movement.add"
- onActionPerformed="getHandler().addFinancialStatementMovement()"
- enabled="{isSelectedRow()}"/>
- </cell>
- </row>
- <row>
- <cell fill="horizontal">
- <JButton id="updateButton" text="lima.common.update"
- onActionPerformed="getHandler().updateFinancialStatement()"
- enabled="{isSelectedRow()}"/>
- </cell>
- </row>
- <row>
- <cell fill="horizontal">
- <JButton id="removeButton" text="lima.common.remove"
- onActionPerformed="getHandler().removeFinancialStatement()"
- enabled="{isSelectedRow()}"/>
- </cell>
- </row>
- <row>
- <cell fill="horizontal">
- <JButton id="importButton" text="lima.importexport.import"
- onActionPerformed="getHandler().importFinancialStatementChart()"/>
- </cell>
- </row>
- <row>
- <cell fill="horizontal">
- <JButton id="checkButton" text="lima.financialstatement.check"
- onActionPerformed="getHandler().financialStatementChartCheck()"/>
- </cell>
- </row>
+ <row>
+ <cell fill="both" weightx="1" weighty="1" rows='6'>
+ <JScrollPane>
+ <FinancialStatementChartTreeTable id="treeTable"
+ constructorParams="getHandler()"
+ selectionMode="{ListSelectionModel.SINGLE_SELECTION}"
+ treeTableModel="{new FinancialStatementChartTreeTableModel()}"
+ highlighters="{HighlighterFactory.createSimpleStriping(new java.awt.Color(222,222,222))}"/>
+ <ListSelectionModel
+ javaBean="getTreeTable().getSelectionModel()"
+ onValueChanged="setSelectedRow(treeTable.getSelectedRow() != -1)"/>
+ </JScrollPane>
+ </cell>
+ <cell fill="horizontal">
+ <JButton id="addFinancialStatementHeader"
+ text="lima.financialstatement.header.add"
+ onActionPerformed="getHandler().addFinancialStatementHeader()"/>
+ </cell>
+ </row>
+ <row>
+ <cell fill="horizontal">
+ <JButton id="addFinancialStatementMovement"
+ text="lima.financialstatement.movement.add"
+ onActionPerformed="getHandler().addFinancialStatementMovement()"
+ enabled="{isSelectedRow()}"/>
+ </cell>
+ </row>
+ <row>
+ <cell fill="horizontal">
+ <JButton id="updateButton" text="lima.common.update"
+ onActionPerformed="getHandler().updateFinancialStatement()"
+ enabled="{isSelectedRow()}"/>
+ </cell>
+ </row>
+ <row>
+ <cell fill="horizontal">
+ <JButton id="removeButton" text="lima.common.remove"
+ onActionPerformed="getHandler().removeFinancialStatement()"
+ enabled="{isSelectedRow()}"/>
+ </cell>
+ </row>
+ <row>
+ <cell fill="horizontal">
+ <JButton id="importButton" text="lima.importexport.import"
+ onActionPerformed="getHandler().importFinancialStatementChart()"/>
+ </cell>
+ </row>
+ <row>
+ <cell fill="horizontal">
+ <JButton id="checkButton" text="lima.financialstatement.check"
+ onActionPerformed="getHandler().financialStatementChartCheck()"/>
+ </cell>
+ </row>
</Table>
\ No newline at end of file
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementHeaderForm.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementHeaderForm.jaxx 2011-09-17 12:59:34 UTC (rev 3291)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementHeaderForm.jaxx 2011-09-17 13:50:17 UTC (rev 3292)
@@ -27,15 +27,18 @@
defaultCloseOperation="{JDialog.DO_NOTHING_ON_CLOSE}"
onWindowClosing="performCancel();">
- <org.chorem.lima.entity.FinancialStatement id="financialStatement" javaBean='null'/>
- <Boolean id="addState" javaBean='true'/>
+ <import>
+ javax.swing.text.Document
+ org.chorem.lima.FinancialStatementWayEnum
+ org.chorem.lima.entity.FinancialStatement
+ org.chorem.lima.entity.FinancialStatementImpl
+ </import>
+ <FinancialStatement id="financialStatement" javaBean='null'/>
+ <Boolean id="addState" javaBean='true'/>
- <script>
+ <script>
<![CDATA[
- import org.chorem.lima.entity.FinancialStatementImpl;
- import org.chorem.lima.FinancialStatementWayEnum;
-
-
+
protected void getFinancialStatementWayValue(){
FinancialStatementWayEnum fSWE =
@@ -53,49 +56,52 @@
dispose();
}
]]>
- </script>
+ </script>
- <Table>
- <row>
- <cell fill="horizontal">
- <JLabel text="lima.financialstatement.label"/>
- </cell>
- <cell fill="horizontal">
- <JTextField id="descriptionTextField" text="{getFinancialStatement().getLabel()}"/>
- <javax.swing.text.Document javaBean="getDescriptionTextField().getDocument()"
- onInsertUpdate='getFinancialStatement().setLabel(getDescriptionTextField().getText())'
- onRemoveUpdate='getFinancialStatement().setLabel(getDescriptionTextField().getText())' />
- </cell>
- </row>
- <row>
- <cell>
- <JCheckBox id='subAmountCheckBox' text='lima.financialstatement.subamount'
- selected="{getFinancialStatement().getSubAmount()}"
- onActionPerformed="getFinancialStatement().setSubAmount(subAmountCheckBox.isSelected())"/>
- </cell>
- </row>
- <row>
- <cell>
- <JCheckBox id='headerAmountCheckBox' text='lima.financialstatement.headeramount'
- selected="{getFinancialStatement().getHeaderAmount()}"
- onActionPerformed="getFinancialStatement().setHeaderAmount(headerAmountCheckBox.isSelected())"/>
- </cell>
- </row>
- <row>
- <cell>
- <EnumEditor id='wayEnumEditor'
- selectedItem="{getFinancialStatement().getWay()}"
- constructorParams='org.chorem.lima.FinancialStatementWayEnum.class'
- onActionPerformed="getFinancialStatementWayValue()"/>
- </cell>
- </row>
- <row>
- <cell fill="none">
- <JButton text="lima.common.cancel" onActionPerformed="performCancel()"/>
- </cell>
- <cell fill="none">
- <JButton id="ok" text="lima.common.ok" onActionPerformed="dispose()"/>
- </cell>
- </row>
- </Table>
+ <Table>
+ <row>
+ <cell fill="horizontal">
+ <JLabel text="lima.financialstatement.label"/>
+ </cell>
+ <cell fill="horizontal">
+ <JTextField id="descriptionTextField"
+ text="{getFinancialStatement().getLabel()}"/>
+ <Document javaBean="getDescriptionTextField().getDocument()"
+ onInsertUpdate='getFinancialStatement().setLabel(getDescriptionTextField().getText())'
+ onRemoveUpdate='getFinancialStatement().setLabel(getDescriptionTextField().getText())'/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JCheckBox id='subAmountCheckBox'
+ text='lima.financialstatement.subamount'
+ selected="{getFinancialStatement().getSubAmount()}"
+ onActionPerformed="getFinancialStatement().setSubAmount(subAmountCheckBox.isSelected())"/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JCheckBox id='headerAmountCheckBox'
+ text='lima.financialstatement.headeramount'
+ selected="{getFinancialStatement().getHeaderAmount()}"
+ onActionPerformed="getFinancialStatement().setHeaderAmount(headerAmountCheckBox.isSelected())"/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <EnumEditor id='wayEnumEditor'
+ selectedItem="{getFinancialStatement().getWay()}"
+ constructorParams='org.chorem.lima.FinancialStatementWayEnum.class'
+ onActionPerformed="getFinancialStatementWayValue()"/>
+ </cell>
+ </row>
+ <row>
+ <cell fill="none">
+ <JButton text="lima.common.cancel" onActionPerformed="performCancel()"/>
+ </cell>
+ <cell fill="none">
+ <JButton id="ok" text="lima.common.ok" onActionPerformed="dispose()"/>
+ </cell>
+ </row>
+ </Table>
</JDialog>
\ No newline at end of file
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementImportForm.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementImportForm.jaxx 2011-09-17 12:59:34 UTC (rev 3291)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementImportForm.jaxx 2011-09-17 13:50:17 UTC (rev 3292)
@@ -27,66 +27,84 @@
defaultCloseOperation="{JDialog.DO_NOTHING_ON_CLOSE}"
onWindowClosing="performCancel();">
- <jaxx.runtime.swing.JAXXButtonGroup id="radioButtons" javaBean='new JAXXButtonGroup()'/>
- <Boolean id="addState" javaBean='true'/>
+ <import>
+ jaxx.runtime.swing.JAXXButtonGroup
+ org.chorem.lima.enums.FinancialStatementsChartEnum
+ </import>
+
+ <JAXXButtonGroup id="radioButtons" javaBean='new JAXXButtonGroup()'/>
+ <Boolean id="addState" javaBean='true'/>
- <script>
+ <script>
<![CDATA[
- import org.chorem.lima.enums.FinancialStatementsChartEnum;
+
getRootPane().setDefaultButton(ok);
protected void performCancel() {
getRadioButtons().setSelectedValue(null);
dispose();
}
]]>
- </script>
+ </script>
- <Table>
- <row>
- <cell><JLabel text='lima.charts.financialstatement.nothing' /></cell>
- </row>
- <row>
- <cell>
- <JRadioButton text='lima.charts.financialstatement.shortened' value='{FinancialStatementsChartEnum.SHORTENED}' buttonGroup="{getRadioButtons()}"
- selected='true'/>
+ <Table>
+ <row>
+ <cell>
+ <JLabel text='lima.charts.financialstatement.nothing'/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JRadioButton text='lima.charts.financialstatement.shortened'
+ value='{FinancialStatementsChartEnum.SHORTENED}'
+ buttonGroup="{getRadioButtons()}"
+ selected='true'/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JRadioButton text='lima.charts.financialstatement.base'
+ value='{FinancialStatementsChartEnum.BASE}'
+ buttonGroup="{getRadioButtons()}"
+ selected='true'/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JRadioButton text='lima.charts.financialstatement.developed'
+ value='{FinancialStatementsChartEnum.DEVELOPED}'
+ buttonGroup="{getRadioButtons()}"
+ selected='true'/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JRadioButton text='lima.importexport.import'
+ value='{FinancialStatementsChartEnum.IMPORT}'
+ buttonGroup="{getRadioButtons()}"
+ selected='true'/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JCheckBox id='deleteFinancialStatementChart'
+ text='lima.financialstatement.delete' selected='false'/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <Table>
+ <row>
+ <cell fill="none">
+ <JButton text="lima.common.cancel"
+ onActionPerformed="performCancel()"/>
</cell>
- </row>
- <row>
- <cell>
- <JRadioButton text='lima.charts.financialstatement.base' value='{FinancialStatementsChartEnum.BASE}' buttonGroup="{getRadioButtons()}"
- selected='true'/>
- </cell>
- </row>
- <row>
- <cell>
- <JRadioButton text='lima.charts.financialstatement.developed' value='{FinancialStatementsChartEnum.DEVELOPED}' buttonGroup="{getRadioButtons()}"
- selected='true'/>
+ <cell fill="none">
+ <JButton id="ok" text="lima.common.ok"
+ onActionPerformed="dispose()"/>
</cell>
- </row>
- <row>
- <cell>
- <JRadioButton text='lima.importexport.import' value='{FinancialStatementsChartEnum.IMPORT}' buttonGroup="{getRadioButtons()}"
- selected='true'/>
- </cell>
- </row>
- <row>
- <cell>
- <JCheckBox id='deleteFinancialStatementChart' text='lima.financialstatement.delete' selected='false'/>
- </cell>
- </row>
- <row>
- <cell>
- <Table>
- <row>
- <cell fill="none">
- <JButton text="lima.common.cancel" onActionPerformed="performCancel()"/>
- </cell>
- <cell fill="none">
- <JButton id="ok" text="lima.common.ok" onActionPerformed="dispose()"/>
- </cell>
- </row>
- </Table>
- </cell>
- </row>
- </Table>
+ </row>
+ </Table>
+ </cell>
+ </row>
+ </Table>
</JDialog>
\ No newline at end of file
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementMovementForm.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementMovementForm.jaxx 2011-09-17 12:59:34 UTC (rev 3291)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementMovementForm.jaxx 2011-09-17 13:50:17 UTC (rev 3292)
@@ -27,11 +27,16 @@
defaultCloseOperation="{JDialog.DO_NOTHING_ON_CLOSE}"
onWindowClosing="performCancel();">
- <org.chorem.lima.entity.FinancialStatement id="financialStatement" javaBean='null'/>
-
- <Boolean id="addState" javaBean='true'/>
+ <import>
+ javax.swing.text.Document
+ org.chorem.lima.entity.FinancialStatement
+ </import>
- <script>
+ <FinancialStatement id="financialStatement" javaBean='null'/>
+
+ <Boolean id="addState" javaBean='true'/>
+
+ <script>
<![CDATA[
getRootPane().setDefaultButton(ok);
protected void performCancel() {
@@ -39,71 +44,77 @@
dispose();
}
]]>
- </script>
+ </script>
- <Table>
- <row>
- <cell fill="horizontal">
- <JLabel text="lima.financialstatement.label"/>
- </cell>
- <cell fill="horizontal">
- <JTextField id="descriptionTextField" text="{getFinancialStatement().getLabel()}"/>
- <javax.swing.text.Document javaBean="getDescriptionTextField().getDocument()"
- onInsertUpdate='getFinancialStatement().setLabel(getDescriptionTextField().getText())'
- onRemoveUpdate='getFinancialStatement().setLabel(getDescriptionTextField().getText())' />
- </cell>
- </row>
- <row>
- <cell fill="horizontal">
- <JLabel text="lima.financialstatement.accounts"/>
- </cell>
- <cell fill="horizontal">
- <JTextField id="accountsTextField" text="{getFinancialStatement().getAccounts()}"/>
- <javax.swing.text.Document javaBean="getAccountsTextField().getDocument()"
- onInsertUpdate='getFinancialStatement().setAccounts(getAccountsTextField().getText())'
- onRemoveUpdate='getFinancialStatement().setAccounts(getAccountsTextField().getText())' />
- </cell>
- </row>
- <row>
- <cell fill="horizontal">
- <JLabel text="lima.financialstatement.debitaccounts"/>
- </cell>
- <cell fill="horizontal">
- <JTextField id="debitAccountsTextField" text="{getFinancialStatement().getDebitAccounts()}"/>
- <javax.swing.text.Document javaBean="getDebitAccountsTextField().getDocument()"
- onInsertUpdate='getFinancialStatement().setDebitAccounts(getDebitAccountsTextField().getText())'
- onRemoveUpdate='getFinancialStatement().setDebitAccounts(getDebitAccountsTextField().getText())' />
- </cell>
- </row>
- <row>
- <cell fill="horizontal">
- <JLabel text="lima.financialstatement.creditaccounts"/>
- </cell>
- <cell fill="horizontal">
- <JTextField id="creditAccountsTextField" text="{getFinancialStatement().getCreditAccounts()}"/>
- <javax.swing.text.Document javaBean="getCreditAccountsTextField().getDocument()"
- onInsertUpdate='getFinancialStatement().setCreditAccounts(getCreditAccountsTextField().getText())'
- onRemoveUpdate='getFinancialStatement().setCreditAccounts(getCreditAccountsTextField().getText())' />
- </cell>
- </row>
- <row>
- <cell fill="horizontal">
- <JLabel text="lima.financialstatement.provisiondeprecationaccounts"/>
- </cell>
- <cell fill="horizontal">
- <JTextField id="provisionDeprecationAccountsTextField" text="{getFinancialStatement().getProvisionDeprecationAccounts()}"/>
- <javax.swing.text.Document javaBean="getProvisionDeprecationAccountsTextField().getDocument()"
- onInsertUpdate='getFinancialStatement().setProvisionDeprecationAccounts(getProvisionDeprecationAccountsTextField().getText())'
- onRemoveUpdate='getFinancialStatement().setProvisionDeprecationAccounts(getProvisionDeprecationAccountsTextField().getText())' />
- </cell>
- </row>
- <row>
- <cell fill="none">
- <JButton text="lima.common.cancel" onActionPerformed="performCancel()"/>
- </cell>
- <cell fill="none">
- <JButton id="ok" text="lima.common.ok" onActionPerformed="dispose()"/>
- </cell>
- </row>
- </Table>
+ <Table>
+ <row>
+ <cell fill="horizontal">
+ <JLabel text="lima.financialstatement.label"/>
+ </cell>
+ <cell fill="horizontal">
+ <JTextField id="descriptionTextField"
+ text="{getFinancialStatement().getLabel()}"/>
+ <Document javaBean="getDescriptionTextField().getDocument()"
+ onInsertUpdate='getFinancialStatement().setLabel(getDescriptionTextField().getText())'
+ onRemoveUpdate='getFinancialStatement().setLabel(getDescriptionTextField().getText())'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill="horizontal">
+ <JLabel text="lima.financialstatement.accounts"/>
+ </cell>
+ <cell fill="horizontal">
+ <JTextField id="accountsTextField"
+ text="{getFinancialStatement().getAccounts()}"/>
+ <Document javaBean="getAccountsTextField().getDocument()"
+ onInsertUpdate='getFinancialStatement().setAccounts(getAccountsTextField().getText())'
+ onRemoveUpdate='getFinancialStatement().setAccounts(getAccountsTextField().getText())'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill="horizontal">
+ <JLabel text="lima.financialstatement.debitaccounts"/>
+ </cell>
+ <cell fill="horizontal">
+ <JTextField id="debitAccountsTextField"
+ text="{getFinancialStatement().getDebitAccounts()}"/>
+ <Document javaBean="getDebitAccountsTextField().getDocument()"
+ onInsertUpdate='getFinancialStatement().setDebitAccounts(getDebitAccountsTextField().getText())'
+ onRemoveUpdate='getFinancialStatement().setDebitAccounts(getDebitAccountsTextField().getText())'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill="horizontal">
+ <JLabel text="lima.financialstatement.creditaccounts"/>
+ </cell>
+ <cell fill="horizontal">
+ <JTextField id="creditAccountsTextField"
+ text="{getFinancialStatement().getCreditAccounts()}"/>
+ <Document javaBean="getCreditAccountsTextField().getDocument()"
+ onInsertUpdate='getFinancialStatement().setCreditAccounts(getCreditAccountsTextField().getText())'
+ onRemoveUpdate='getFinancialStatement().setCreditAccounts(getCreditAccountsTextField().getText())'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill="horizontal">
+ <JLabel text="lima.financialstatement.provisiondeprecationaccounts"/>
+ </cell>
+ <cell fill="horizontal">
+ <JTextField id="provisionDeprecationAccountsTextField"
+ text="{getFinancialStatement().getProvisionDeprecationAccounts()}"/>
+ <Document
+ javaBean="getProvisionDeprecationAccountsTextField().getDocument()"
+ onInsertUpdate='getFinancialStatement().setProvisionDeprecationAccounts(getProvisionDeprecationAccountsTextField().getText())'
+ onRemoveUpdate='getFinancialStatement().setProvisionDeprecationAccounts(getProvisionDeprecationAccountsTextField().getText())'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill="none">
+ <JButton text="lima.common.cancel" onActionPerformed="performCancel()"/>
+ </cell>
+ <cell fill="none">
+ <JButton id="ok" text="lima.common.ok" onActionPerformed="dispose()"/>
+ </cell>
+ </row>
+ </Table>
</JDialog>
\ No newline at end of file
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportView.jaxx 2011-09-17 12:59:34 UTC (rev 3291)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportView.jaxx 2011-09-17 13:50:17 UTC (rev 3292)
@@ -24,13 +24,19 @@
-->
<Table>
- <FinancialStatementReportViewHandler id="handler" javaBean="new FinancialStatementReportViewHandler(this)" />
- <Boolean id="selectedRow" javaBean="false" />
- <org.chorem.lima.ui.financialstatementreport.FinancialStatementReportTableModel id="modelTable"/>
- <script>
+ <import>
+ javax.swing.ListSelectionModel
+ org.chorem.lima.enums.ComboBoxDatesEnum
+ org.chorem.lima.ui.financialstatementreport.FinancialStatementReportTableModel
+ </import>
+ <FinancialStatementReportViewHandler
+ id="handler"
+ javaBean="new FinancialStatementReportViewHandler(this)"/>
+ <Boolean id="selectedRow" javaBean="false"/>
+ <FinancialStatementReportTableModel id="modelTable"/>
+ <script>
<![CDATA[
-
- import org.chorem.lima.enums.ComboBoxDatesEnum;
+
FinancialStatementReportPeriodSearchPanel periodSearchPanel =
new FinancialStatementReportPeriodSearchPanel(modelTable);
@@ -39,32 +45,42 @@
]]>
- </script>
- <row weightx="1" weighty="0" anchor="center">
- <cell fill='both'><Table><row>
- <cell anchor="west"><JComboBox id="periodComboBox" javaBean="new JComboBox(ComboBoxDatesEnum.descriptions())"
- onActionPerformed="periodSearchPanel.refresh(ComboBoxDatesEnum.valueOfDescription((String) periodComboBox.getSelectedItem()));
- validate(); repaint()"/></cell>
- <cell><FinancialStatementReportPeriodSearchPanel javaBean="periodSearchPanel"/></cell>
- </row></Table></cell>
- <cell>
- <EnumEditor id='DocumentEditor'
- constructorParams='org.chorem.lima.business.utils.FormatsEnum.class'/>
- </cell>
- <cell>
- <JButton text="lima.common.ok"
- onActionPerformed="getHandler().createDocument()"/>
- </cell>
- </row>
- <row>
- <cell fill="both" weightx="1" weighty="1" columns="7">
- <JScrollPane>
- <org.chorem.lima.ui.financialstatementreport.FinancialStatementReportTable id="table" rowHeight="24"
- constructorParams="getHandler()"
- model="{getModelTable()}"
- selectionMode="{ListSelectionModel.SINGLE_SELECTION}"/>
- <javax.swing.ListSelectionModel javaBean="getTable().getSelectionModel()"/>
- </JScrollPane>
- </cell>
- </row>
+ </script>
+ <row weightx="1" weighty="0" anchor="center">
+ <cell fill='both'>
+ <Table>
+ <row>
+ <cell anchor="west">
+ <JComboBox id="periodComboBox"
+ javaBean="new JComboBox(ComboBoxDatesEnum.descriptions())"
+ onActionPerformed="periodSearchPanel.refresh(ComboBoxDatesEnum.valueOfDescription((String) periodComboBox.getSelectedItem()));
+ validate(); repaint()"/>
+ </cell>
+ <cell>
+ <FinancialStatementReportPeriodSearchPanel
+ javaBean="periodSearchPanel"/>
+ </cell>
+ </row>
+ </Table>
+ </cell>
+ <cell>
+ <EnumEditor id='DocumentEditor'
+ constructorParams='org.chorem.lima.business.utils.FormatsEnum.class'/>
+ </cell>
+ <cell>
+ <JButton text="lima.common.ok"
+ onActionPerformed="getHandler().createDocument()"/>
+ </cell>
+ </row>
+ <row>
+ <cell fill="both" weightx="1" weighty="1" columns="7">
+ <JScrollPane>
+ <FinancialStatementReportTable id="table" rowHeight="24"
+ constructorParams="getHandler()"
+ model="{getModelTable()}"
+ selectionMode="{ListSelectionModel.SINGLE_SELECTION}"/>
+ <ListSelectionModel javaBean="getTable().getSelectionModel()"/>
+ </JScrollPane>
+ </cell>
+ </row>
</Table>
\ No newline at end of file
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/EntryBookSearchComboBox.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/EntryBookSearchComboBox.java 2011-09-17 12:59:34 UTC (rev 3291)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/EntryBookSearchComboBox.java 2011-09-17 13:50:17 UTC (rev 3292)
@@ -29,11 +29,12 @@
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.entity.EntryBook;
import org.chorem.lima.ui.combobox.EntryBookComboBoxModel;
-import org.chorem.lima.ui.combobox.EntryBookRenderer;
+import org.chorem.lima.ui.renderers.RendererUtil;
import org.chorem.lima.util.EntryBookToString;
import org.jdesktop.swingx.autocomplete.AutoCompleteDecorator;
import javax.swing.JComboBox;
+import javax.swing.ListCellRenderer;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
@@ -50,9 +51,10 @@
public EntryBookSearchComboBox(FinancialTransactionSearchViewHandler handler) {
this.handler = handler;
EntryBookComboBoxModel entryBookComboBoxModel = new EntryBookComboBoxModel();
- EntryBookRenderer entryBookRenderer = new EntryBookRenderer();
+ ListCellRenderer renderer =
+ RendererUtil.newDecoratorListCellRenderer(EntryBook.class);
setModel(entryBookComboBoxModel);
- setRenderer(entryBookRenderer);
+ setRenderer(renderer);
setEditable(true);
AutoCompleteDecorator.decorate(this, EntryBookToString.getInstance());
getEditor().getEditorComponent().addKeyListener(this);
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedView.jaxx 2011-09-17 12:59:34 UTC (rev 3291)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedView.jaxx 2011-09-17 13:50:17 UTC (rev 3292)
@@ -24,68 +24,74 @@
-->
<Table>
- <FinancialTransactionUnbalancedViewHandler id="handler" javaBean="new FinancialTransactionUnbalancedViewHandler(this)" />
- <Boolean id="selectedRow" javaBean="false" />
- <org.chorem.lima.ui.combobox.FiscalPeriodComboBoxModel id="modelFiscalPeriod"/>
- <script>
+ <import>
+ javax.swing.ListSelectionModel
+ org.chorem.lima.entity.FiscalPeriod
+ org.chorem.lima.ui.combobox.FiscalPeriodComboBoxRenderer
+ org.chorem.lima.ui.combobox.FiscalPeriodComboBoxModel
+ </import>
+ <FinancialTransactionUnbalancedViewHandler id="handler"
+ javaBean="new FinancialTransactionUnbalancedViewHandler(this)"/>
+ <Boolean id="selectedRow" javaBean="false"/>
+ <FiscalPeriodComboBoxModel id="modelFiscalPeriod"/>
+ <script>
<![CDATA[
-
- import org.chorem.lima.entity.FiscalPeriod;
-
- void $afterCompleteSetup() {
+ void $afterCompleteSetup() {
getHandler().refresh();
}
-
]]>
- </script>
+ </script>
- <!-- <JPopupMenu id="MenuRightPanel">
- <JMenuItem text="lima.add.transaction" onActionPerformed='addEmptyTransaction()'/>
- <JMenuItem text="lima.print"/>
- </JPopupMenu>
- <JPopupMenu id="MenuRightTransaction">
- <JMenuItem text="lima.add" onActionPerformed='addEmptyTransaction()'/>
- <JMenuItem text="lima.print"/>
- </JPopupMenu> -->
-
- <row weightx="1" weighty="0" anchor="center">
- <cell anchor="west">
- <JButton text="lima.refresh" onActionPerformed="getHandler().refresh()"/>
- </cell>
- <cell anchor="east">
- <JLabel id="fiscalPeriodLabel" text="lima.charts.fiscalyear"/>
- </cell>
- <cell anchor="west">
- <JComboBox id="fiscalPeriodComboBox"
- model="{modelFiscalPeriod}"
- renderer="{new org.chorem.lima.ui.combobox.FiscalPeriodComboBoxRenderer()}"
- onActionPerformed="getFinancialTransactionUnbalancedTableModel().setFiscalPeriod( (FiscalPeriod) fiscalPeriodComboBox.getSelectedItem());
+ <!-- <JPopupMenu id="MenuRightPanel">
+ <JMenuItem text="lima.add.transaction" onActionPerformed='addEmptyTransaction()'/>
+ <JMenuItem text="lima.print"/>
+ </JPopupMenu>
+ <JPopupMenu id="MenuRightTransaction">
+ <JMenuItem text="lima.add" onActionPerformed='addEmptyTransaction()'/>
+ <JMenuItem text="lima.print"/>
+ </JPopupMenu> -->
+
+ <row weightx="1" weighty="0" anchor="center">
+ <cell anchor="west">
+ <JButton text="lima.refresh" onActionPerformed="getHandler().refresh()"/>
+ </cell>
+ <cell anchor="east">
+ <JLabel id="fiscalPeriodLabel" text="lima.charts.fiscalyear"/>
+ </cell>
+ <cell anchor="west">
+ <JComboBox id="fiscalPeriodComboBox"
+ model="{modelFiscalPeriod}"
+ renderer="{new FiscalPeriodComboBoxRenderer()}"
+ onActionPerformed="getFinancialTransactionUnbalancedTableModel().setFiscalPeriod( (FiscalPeriod) fiscalPeriodComboBox.getSelectedItem());
getHandler().refresh()"
- editable="false"/>
- </cell>
- <cell>
- <JButton text="lima.entries.addEntry"
- onActionPerformed="getHandler().addEmptyEntry()"
- enabled="{isSelectedRow()}"/>
- </cell>
- <cell>
- <JButton text="lima.common.remove"
- onActionPerformed="getHandler().deleteSelectedRow()"
- enabled="{isSelectedRow()}"/>
- </cell>
- </row>
- <row>
- <cell fill="both" weightx="1" weighty="1" rows="1" columns="9">
- <JScrollPane>
- <org.chorem.lima.ui.financialtransactionunbalanced.FinancialTransactionUnbalancedTableModel
- id="financialTransactionUnbalancedTableModel" />
- <org.chorem.lima.ui.financialtransactionunbalanced.FinancialTransactionUnbalancedTable
- id="financialTransactionUnbalancedTable" sortable="false" rowHeight="22"
- constructorParams="getHandler()" model="{getFinancialTransactionUnbalancedTableModel()}"
- selectionMode="{ListSelectionModel.SINGLE_SELECTION}" />
- <javax.swing.ListSelectionModel javaBean="getFinancialTransactionUnbalancedTable().getSelectionModel()"
- onValueChanged="setSelectedRow(financialTransactionUnbalancedTable.getSelectedRow() != -1)"/>
- </JScrollPane>
- </cell>
- </row>
+ editable="false"/>
+ </cell>
+ <cell>
+ <JButton text="lima.entries.addEntry"
+ onActionPerformed="getHandler().addEmptyEntry()"
+ enabled="{isSelectedRow()}"/>
+ </cell>
+ <cell>
+ <JButton text="lima.common.remove"
+ onActionPerformed="getHandler().deleteSelectedRow()"
+ enabled="{isSelectedRow()}"/>
+ </cell>
+ </row>
+ <row>
+ <cell fill="both" weightx="1" weighty="1" rows="1" columns="9">
+ <JScrollPane>
+ <FinancialTransactionUnbalancedTableModel
+ id="financialTransactionUnbalancedTableModel"/>
+ <FinancialTransactionUnbalancedTable
+ id="financialTransactionUnbalancedTable" sortable="false"
+ rowHeight="22"
+ constructorParams="getHandler()"
+ model="{getFinancialTransactionUnbalancedTableModel()}"
+ selectionMode="{ListSelectionModel.SINGLE_SELECTION}"/>
+ <ListSelectionModel
+ javaBean="getFinancialTransactionUnbalancedTable().getSelectionModel()"
+ onValueChanged="setSelectedRow(financialTransactionUnbalancedTable.getSelectedRow() != -1)"/>
+ </JScrollPane>
+ </cell>
+ </row>
</Table>
\ No newline at end of file
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 2011-09-17 12:59:34 UTC (rev 3291)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/AddPeriod.jaxx 2011-09-17 13:50:17 UTC (rev 3292)
@@ -25,18 +25,22 @@
<JDialog modal="true"
defaultCloseOperation="{JDialog.DO_NOTHING_ON_CLOSE}"
onWindowClosing="performCancel();">
- <org.chorem.lima.ui.fiscalperiod.FiscalPeriodTableModel id="modelFiscalPeriodTable"/>
- <script>
+ <import>
+ java.util.Date
+ java.util.Calendar
+ org.apache.commons.lang.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.FiscalPeriodServiceMonitorable
+ org.chorem.lima.service.LimaServiceFactory
+ org.chorem.lima.ui.fiscalperiod.FiscalPeriodTableModel
+ </import>
+ <FiscalPeriodTableModel id="modelFiscalPeriodTable"/>
+ <script>
<![CDATA[
- import org.chorem.lima.entity.FiscalPeriod;
- import org.chorem.lima.business.FiscalPeriodServiceMonitorable;
- import org.chorem.lima.service.LimaServiceFactory;
- import org.chorem.lima.business.LimaException;
- import org.apache.commons.lang.time.DateUtils;
- import java.util.Date;
- import java.util.Calendar;
- import org.chorem.lima.entity.FiscalPeriodImpl;
-
+
getRootPane().setDefaultButton(okButton);
protected FiscalPeriodServiceMonitorable fiscalPeriodService =
@@ -85,40 +89,42 @@
dispose();
}
]]>
- </script>
+ </script>
- <org.chorem.lima.entity.FiscalPeriod id="period" javaBean="null" />
+ <FiscalPeriod id="period" javaBean="null"/>
- <Table fill="both">
- <row>
+ <Table fill="both">
+ <row>
+ <cell>
+ <JLabel text="lima.common.begindate"/>
+ </cell>
+ <cell>
+ <JXDatePicker id="beginDatePicker"/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JLabel text="lima.common.enddate"/>
+ </cell>
+ <cell>
+ <JXDatePicker id="endDatePicker"/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <Table fill="none" anchor="center" weighty="1">
+ <row>
<cell>
- <JLabel text="lima.common.begindate"/>
+ <JButton id="cancelButton" text="lima.common.cancel"
+ onActionPerformed="performCancel()"/>
</cell>
<cell>
- <org.jdesktop.swingx.JXDatePicker id="beginDatePicker"/>
+ <JButton id="okButton" text="lima.common.ok"
+ onActionPerformed="performOk()"/>
</cell>
- </row>
- <row>
- <cell>
- <JLabel text="lima.common.enddate"/>
- </cell>
- <cell>
- <org.jdesktop.swingx.JXDatePicker id="endDatePicker"/>
- </cell>
- </row>
- <row>
- <cell>
- <Table fill="none" anchor="center" weighty="1">
- <row>
- <cell>
- <JButton id="cancelButton" text="lima.common.cancel" onActionPerformed="performCancel()"/>
- </cell>
- <cell>
- <JButton id="okButton" text="lima.common.ok" onActionPerformed="performOk()"/>
- </cell>
- </row>
- </Table>
- </cell>
- </row>
- </Table>
+ </row>
+ </Table>
+ </cell>
+ </row>
+ </Table>
</JDialog>
\ No newline at end of file
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 2011-09-17 12:59:34 UTC (rev 3291)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodView.jaxx 2011-09-17 13:50:17 UTC (rev 3292)
@@ -25,45 +25,52 @@
<Table>
- <FiscalPeriodViewHandler id="handler" javaBean="new FiscalPeriodViewHandler(this)" />
- <Boolean id="selectedPeriod" javaBean="false" />
+ <import>
+ 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)"/>
+ <Boolean id="selectedPeriod" javaBean="false"/>
- <script>
+ <script>
<![CDATA[
- import org.chorem.lima.entity.FiscalPeriod;
- import org.chorem.lima.entity.FinancialPeriod;
-
void $afterCompleteSetup() {
getHandler().refresh();
}
]]>
- </script>
- <row>
- <cell fill="both" weightx="1" weighty="1" rows="5">
- <JScrollPane>
- <org.chorem.lima.ui.fiscalperiod.FiscalPeriodTableModel
- id="modelFiscalPeriodTable"/>
- <org.chorem.lima.ui.fiscalperiod.FiscalPeriodTable
- id="fiscalPeriodTable" sortable="false" rowHeight="24"
- constructorParams="getHandler()" model="{getModelFiscalPeriodTable()}"
- selectionMode="{ListSelectionModel.SINGLE_INTERVAL_SELECTION}"
- columnControlVisible="true" />
- <javax.swing.ListSelectionModel javaBean="getFiscalPeriodTable().getSelectionModel()"
- onValueChanged="setSelectedPeriod(fiscalPeriodTable.getSelectedRow() != -1)"/>
- </JScrollPane>
- </cell>
- </row>
- <row>
- <cell fill="horizontal">
- <JButton id="addButton" text="lima.charts.fiscalperiod.add"
- onActionPerformed="getHandler().addFiscalPeriod()"/>
- </cell>
- </row>
- <row>
- <cell fill="horizontal">
- <JButton id="blockButton" text="lima.charts.fiscalperiod.block" enabled="{isSelectedPeriod()}"
- onActionPerformed="getHandler().blockFiscalPeriod()" />
- </cell>
- </row>
+ </script>
+ <row>
+ <cell fill="both" weightx="1" weighty="1" rows="5">
+ <JScrollPane>
+ <FiscalPeriodTableModel
+ id="modelFiscalPeriodTable"/>
+ <FiscalPeriodTable
+ id="fiscalPeriodTable" sortable="false" rowHeight="24"
+ constructorParams="getHandler()" model="{getModelFiscalPeriodTable()}"
+ selectionMode="{ListSelectionModel.SINGLE_INTERVAL_SELECTION}"
+ columnControlVisible="true"/>
+ <ListSelectionModel
+ javaBean="getFiscalPeriodTable().getSelectionModel()"
+ onValueChanged="setSelectedPeriod(fiscalPeriodTable.getSelectedRow() != -1)"/>
+ </JScrollPane>
+ </cell>
+ </row>
+ <row>
+ <cell fill="horizontal">
+ <JButton id="addButton" text="lima.charts.fiscalperiod.add"
+ onActionPerformed="getHandler().addFiscalPeriod()"/>
+ </cell>
+ </row>
+ <row>
+ <cell fill="horizontal">
+ <JButton id="blockButton" text="lima.charts.fiscalperiod.block"
+ enabled="{isSelectedPeriod()}"
+ onActionPerformed="getHandler().blockFiscalPeriod()"/>
+ </cell>
+ </row>
</Table>
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 2011-09-17 12:59:34 UTC (rev 3291)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/RetainedEarningsEntryBookForm.jaxx 2011-09-17 13:50:17 UTC (rev 3292)
@@ -1,41 +1,43 @@
-<!--
- #%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%
- -->
+<!--
+ #%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="performCancel();">
- <org.chorem.lima.entity.EntryBook id="entryBook" javaBean="null" />
- <Boolean id="addState" javaBean='true'/>
+ <import>
+ javax.swing.text.Document
+ org.chorem.lima.entity.EntryBook
+ org.chorem.lima.ui.renderers.RendererUtil
+ org.chorem.lima.ui.combobox.EntryBookComboBoxModel
+ </import>
+ <EntryBook id="entryBook" javaBean="null"/>
+ <Boolean id="addState" javaBean='true'/>
- <script>
+ <script>
<![CDATA[
-
- import org.chorem.lima.ui.combobox.EntryBookComboBoxModel;
- import org.chorem.lima.ui.combobox.EntryBookRenderer;
- import org.chorem.lima.entity.EntryBook;
-
+
getRootPane().setDefaultButton(okButton);
/**
@@ -73,72 +75,75 @@
performNew();
}
]]>
- </script>
+ </script>
- <Table>
- <row>
- <cell anchor="west">
- <JRadioButton
- id="selectedEntryBook"
- text="lima.common.entrybook"
- selected="true"
- buttonGroup="EntryBookGroup"
- onActionPerformed="performNew()"/>
- </cell>
- </row>
- <row>
- <cell>
- <JLabel id="entryBookSelectorLabel" text="lima.common.entrybook"/>
- </cell>
- <cell>
- <org.chorem.lima.ui.combobox.EntryBookComboBoxModel id="modelEntryBookComboBox"/>
- <JComboBox id="entryBookComboBox"
- model="{getModelEntryBookComboBox()}"
- renderer="{new org.chorem.lima.ui.combobox.EntryBookRenderer()}"
- editable="false"
- onItemStateChanged="getEntryBook().setCode(((EntryBook)getEntryBookComboBox().getSelectedItem()).getCode()); getEntryBook().setLabel(((EntryBook)getEntryBookComboBox().getSelectedItem()).getLabel())"/>
- </cell>
- </row>
- <row>
- <cell anchor="west">
- <JRadioButton
- id="newEntryBook"
- text="lima.home.entrybooks.create"
- selected="false"
- buttonGroup="EntryBookGroup"
- onActionPerformed="performNew()"/>
- </cell>
- </row>
- <row>
- <cell>
- <JLabel text="lima.common.code"/>
- </cell>
- <cell>
- <JTextField id="entryBookCodeField" text="{getEntryBook().getCode()}"/>
- <javax.swing.text.Document javaBean="getEntryBookCodeField().getDocument()"
- onInsertUpdate='getEntryBook().setCode(getEntryBookCodeField().getText())'
- onRemoveUpdate='getEntryBook().setCode(getEntryBookCodeField().getText())' />
- </cell>
- </row>
- <row>
- <cell>
- <JLabel text="lima.common.label"/>
- </cell>
- <cell>
- <JTextField id="entryBookLabelField" editable='{isAddState()}' text="{getEntryBook().getLabel()}"/>
- <javax.swing.text.Document javaBean="getEntryBookLabelField().getDocument()"
- onInsertUpdate='getEntryBook().setLabel(getEntryBookLabelField().getText())'
- onRemoveUpdate='getEntryBook().setLabel(getEntryBookLabelField().getText())' />
- </cell>
- </row>
- <row>
- <cell>
- <JButton id="cancelButton" text="lima.common.cancel" onActionPerformed="performCancel()"/>
- </cell>
- <cell>
- <JButton id="okButton" text="lima.common.ok" onActionPerformed="dispose()"/>
- </cell>
+ <Table>
+ <row>
+ <cell anchor="west">
+ <JRadioButton
+ id="selectedEntryBook"
+ text="lima.common.entrybook"
+ selected="true"
+ buttonGroup="EntryBookGroup"
+ onActionPerformed="performNew()"/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JLabel id="entryBookSelectorLabel" text="lima.common.entrybook"/>
+ </cell>
+ <cell>
+ <EntryBookComboBoxModel id="modelEntryBookComboBox"/>
+ <JComboBox id="entryBookComboBox"
+ model="{getModelEntryBookComboBox()}"
+ renderer="{RendererUtil.newDecoratorListCellRenderer(EntryBook.class)}"
+ editable="false"
+ onItemStateChanged="getEntryBook().setCode(((EntryBook)getEntryBookComboBox().getSelectedItem()).getCode()); getEntryBook().setLabel(((EntryBook)getEntryBookComboBox().getSelectedItem()).getLabel())"/>
+ </cell>
+ </row>
+ <row>
+ <cell anchor="west">
+ <JRadioButton
+ id="newEntryBook"
+ text="lima.home.entrybooks.create"
+ selected="false"
+ buttonGroup="EntryBookGroup"
+ onActionPerformed="performNew()"/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JLabel text="lima.common.code"/>
+ </cell>
+ <cell>
+ <JTextField id="entryBookCodeField" text="{getEntryBook().getCode()}"/>
+ <Document javaBean="getEntryBookCodeField().getDocument()"
+ onInsertUpdate='getEntryBook().setCode(getEntryBookCodeField().getText())'
+ onRemoveUpdate='getEntryBook().setCode(getEntryBookCodeField().getText())'/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JLabel text="lima.common.label"/>
+ </cell>
+ <cell>
+ <JTextField id="entryBookLabelField" editable='{isAddState()}'
+ text="{getEntryBook().getLabel()}"/>
+ <Document javaBean="getEntryBookLabelField().getDocument()"
+ onInsertUpdate='getEntryBook().setLabel(getEntryBookLabelField().getText())'
+ onRemoveUpdate='getEntryBook().setLabel(getEntryBookLabelField().getText())'/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JButton id="cancelButton" text="lima.common.cancel"
+ onActionPerformed="performCancel()"/>
+ </cell>
+ <cell>
+ <JButton id="okButton" text="lima.common.ok"
+ onActionPerformed="dispose()"/>
+ </cell>
- </row>
- </Table>
+ </row>
+ </Table>
</JDialog>
\ No newline at end of file
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 2011-09-17 12:59:34 UTC (rev 3291)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/HomeView.jaxx 2011-09-17 13:50:17 UTC (rev 3292)
@@ -24,104 +24,132 @@
-->
<Table>
- <Dimension id="fixedSize" javaBean='new Dimension(500,200)' />
- <Dimension id="miniSize" javaBean='new Dimension(300,150)' />
-
-
-
- <script>
- <![CDATA[
- import static org.nuiton.i18n.I18n._;
- import java.awt.Color;
- import java.awt.Font;
- import javax.swing.BoxLayout;
- import javax.swing.border.EtchedBorder;
- import javax.swing.ImageIcon;
-
- ]]>
- </script>
- <row>
+ <import>
+ java.awt.Color
+ java.awt.Font
+ javax.swing.BoxLayout
+ javax.swing.border.EtchedBorder
+ javax.swing.ImageIcon
+ static org.nuiton.i18n.I18n._
+ </import>
+
+ <Dimension id="fixedSize" javaBean='new Dimension(500,200)'/>
+ <Dimension id="miniSize" javaBean='new Dimension(300,150)'/>
+
+ <row>
<cell anchor="southeast">
- <JPanel
- id='accountPanel'
- border='{BorderFactory.createEtchedBorder(EtchedBorder.LOWERED)}'
- minimumSize='{getMiniSize()}'
- preferredSize='{getFixedSize()}'
- layout='{new BoxLayout(accountPanel, BoxLayout.X_AXIS)}'>
- <Table>
- <row>
- <cell weightx="0" weighty="0.1" anchor="northwest"><JLabel icon='{new ImageIcon(getClass().getResource("/images/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'/></cell>
- </row>
- <row fill="both">
- <cell columns="2" weightx="1" weighty="0.9">
- <JEditorPane javaBean='new org.chorem.lima.ui.home.AccountsPane(this)' />
- </cell>
- </row>
- </Table>
- </JPanel>
- </cell>
- <cell anchor="southwest">
- <JPanel
- id = 'entryBookPanel'
- border='{BorderFactory.createEtchedBorder(EtchedBorder.LOWERED)}'
- minimumSize='{getMiniSize()}'
- preferredSize='{getFixedSize()}'
- layout='{new BoxLayout(entryBookPanel, BoxLayout.X_AXIS)}'>
- <Table>
- <row>
- <cell weightx="0" weighty="0.1" anchor="northwest"><JLabel icon='{new ImageIcon(getClass().getResource("/images/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'/></cell>
- </row>
- <row fill="both">
- <cell columns="2" weightx="1" weighty="0.9">
- <JEditorPane javaBean='new org.chorem.lima.ui.home.EntryBooksPane(this)' />
- </cell>
- </row>
- </Table>
- </JPanel>
- </cell>
+ <JPanel
+ id='accountPanel'
+ border='{BorderFactory.createEtchedBorder(EtchedBorder.LOWERED)}'
+ minimumSize='{getMiniSize()}'
+ preferredSize='{getFixedSize()}'
+ layout='{new BoxLayout(accountPanel, BoxLayout.X_AXIS)}'>
+ <Table>
+ <row>
+ <cell weightx="0" weighty="0.1" anchor="northwest">
+ <JLabel
+ icon='{new ImageIcon(getClass().getResource("/images/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'/>
+ </cell>
+ </row>
+ <row fill="both">
+ <cell columns="2" weightx="1" weighty="0.9">
+ <JEditorPane
+ javaBean='new AccountsPane(this)'/>
+ </cell>
+ </row>
+ </Table>
+ </JPanel>
+ </cell>
+ <cell anchor="southwest">
+ <JPanel
+ id='entryBookPanel'
+ border='{BorderFactory.createEtchedBorder(EtchedBorder.LOWERED)}'
+ minimumSize='{getMiniSize()}'
+ preferredSize='{getFixedSize()}'
+ layout='{new BoxLayout(entryBookPanel, BoxLayout.X_AXIS)}'>
+ <Table>
+ <row>
+ <cell weightx="0" weighty="0.1" anchor="northwest">
+ <JLabel
+ icon='{new ImageIcon(getClass().getResource("/images/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'/>
+ </cell>
+ </row>
+ <row fill="both">
+ <cell columns="2" weightx="1" weighty="0.9">
+ <JEditorPane
+ javaBean='new EntryBooksPane(this)'/>
+ </cell>
+ </row>
+ </Table>
+ </JPanel>
+ </cell>
</row>
<row>
- <cell anchor="northeast">
- <JPanel
- id = 'fiscalPeriodPanel'
- border='{BorderFactory.createEtchedBorder(EtchedBorder.LOWERED)}'
- minimumSize='{getMiniSize()}'
- preferredSize='{getFixedSize()}'
- layout='{new BoxLayout(fiscalPeriodPanel, BoxLayout.X_AXIS)}'>
- <Table>
- <row>
- <cell weightx="0" weighty="0.1" anchor="northwest"><JLabel icon='{new ImageIcon(getClass().getResource("/images/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'/></cell>
- </row>
- <row fill="both">
- <cell columns="2" weightx="1" weighty="0.9">
- <JEditorPane javaBean='new org.chorem.lima.ui.home.FiscalPeriodsPane(this)' />
- </cell>
- </row>
- </Table>
- </JPanel>
- </cell>
- <cell anchor="northwest">
- <JPanel
- id = 'financialTransactionPanel'
- border='{BorderFactory.createEtchedBorder(EtchedBorder.LOWERED)}'
- minimumSize='{getMiniSize()}'
- preferredSize='{getFixedSize()}'
- layout='{new BoxLayout(financialTransactionPanel, BoxLayout.X_AXIS)}'>
- <Table>
- <row>
- <cell weightx="0" weighty="0.1" anchor="northwest"><JLabel icon='{new ImageIcon(getClass().getResource("/images/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'/></cell>
- </row>
- <row fill="both">
- <cell columns="2" weightx="1" weighty="0.9">
- <JEditorPane javaBean='new org.chorem.lima.ui.home.FinancialTransactionsPane(this)' />
- </cell>
- </row>
- </Table>
- </JPanel>
+ <cell anchor="northeast">
+ <JPanel
+ id='fiscalPeriodPanel'
+ border='{BorderFactory.createEtchedBorder(EtchedBorder.LOWERED)}'
+ minimumSize='{getMiniSize()}'
+ preferredSize='{getFixedSize()}'
+ layout='{new BoxLayout(fiscalPeriodPanel, BoxLayout.X_AXIS)}'>
+ <Table>
+ <row>
+ <cell weightx="0" weighty="0.1" anchor="northwest">
+ <JLabel
+ icon='{new ImageIcon(getClass().getResource("/images/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'/>
+ </cell>
+ </row>
+ <row fill="both">
+ <cell columns="2" weightx="1" weighty="0.9">
+ <JEditorPane
+ javaBean='new FiscalPeriodsPane(this)'/>
+ </cell>
+ </row>
+ </Table>
+ </JPanel>
</cell>
+ <cell anchor="northwest">
+ <JPanel
+ id='financialTransactionPanel'
+ border='{BorderFactory.createEtchedBorder(EtchedBorder.LOWERED)}'
+ minimumSize='{getMiniSize()}'
+ preferredSize='{getFixedSize()}'
+ layout='{new BoxLayout(financialTransactionPanel, BoxLayout.X_AXIS)}'>
+ <Table>
+ <row>
+ <cell weightx="0" weighty="0.1" anchor="northwest">
+ <JLabel
+ icon='{new ImageIcon(getClass().getResource("/images/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'/>
+ </cell>
+ </row>
+ <row fill="both">
+ <cell columns="2" weightx="1" weighty="0.9">
+ <JEditorPane
+ javaBean='new FinancialTransactionsPane(this)'/>
+ </cell>
+ </row>
+ </Table>
+ </JPanel>
+ </cell>
</row>
</Table>
\ No newline at end of file
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/AddLetterForm.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/AddLetterForm.jaxx 2011-09-17 12:59:34 UTC (rev 3291)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/AddLetterForm.jaxx 2011-09-17 13:50:17 UTC (rev 3292)
@@ -26,10 +26,14 @@
<JDialog modal="true"
defaultCloseOperation="{JDialog.DO_NOTHING_ON_CLOSE}"
onWindowClosing="performCancel();">
- <jaxx.runtime.swing.JAXXButtonGroup id="radioButtons" javaBean='new JAXXButtonGroup()'/>
- <Boolean id="validOk" javaBean='true'/>
-
- <script>
+ <import>
+ jaxx.runtime.swing.JAXXButtonGroup
+ </import>
+
+ <JAXXButtonGroup id="radioButtons" javaBean='new JAXXButtonGroup()'/>
+ <Boolean id="validOk" javaBean='true'/>
+
+ <script>
<![CDATA[
getRootPane().setDefaultButton(ok);
@@ -38,30 +42,40 @@
dispose();
}
]]>
- </script>
+ </script>
- <Table>
- <row fill="horizontal">
- <cell>
- <JRadioButton id="newLetter" text='lima.entries.lettering.radiobutton.new' value='{true}' buttonGroup="{getRadioButtons()}"
- selected='true'/>
- </cell>
- <cell><JTextField editable="false" visible="{newLetter.isSelected()}" id='newLetterTextField' /></cell>
- </row>
- <row>
- <cell>
- <JRadioButton id="listLetter" text='lima.entries.lettering.radiobutton.list' value='{false}' buttonGroup="{getRadioButtons()}"
- selected='true'/>
- </cell>
- <cell><JComboBox id='LetterListComboBox' visible="{listLetter.isSelected()}" javaBean="new LetterComboBox()"/></cell>
- </row>
- <row>
- <cell fill="none">
- <JButton text="lima.common.cancel" onActionPerformed="performCancel()"/>
- </cell>
- <cell fill="none">
- <JButton id="ok" text="lima.common.ok" onActionPerformed="dispose()"/>
- </cell>
- </row>
- </Table>
+ <Table>
+ <row fill="horizontal">
+ <cell>
+ <JRadioButton id="newLetter"
+ text='lima.entries.lettering.radiobutton.new'
+ value='{true}' buttonGroup="{getRadioButtons()}"
+ selected='true'/>
+ </cell>
+ <cell>
+ <JTextField editable="false" visible="{newLetter.isSelected()}"
+ id='newLetterTextField'/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JRadioButton id="listLetter"
+ text='lima.entries.lettering.radiobutton.list'
+ value='{false}' buttonGroup="{getRadioButtons()}"
+ selected='true'/>
+ </cell>
+ <cell>
+ <JComboBox id='LetterListComboBox' visible="{listLetter.isSelected()}"
+ javaBean="new LetterComboBox()"/>
+ </cell>
+ </row>
+ <row>
+ <cell fill="none">
+ <JButton text="lima.common.cancel" onActionPerformed="performCancel()"/>
+ </cell>
+ <cell fill="none">
+ <JButton id="ok" text="lima.common.ok" onActionPerformed="dispose()"/>
+ </cell>
+ </row>
+ </Table>
</JDialog>
\ No newline at end of file
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringView.jaxx 2011-09-17 12:59:34 UTC (rev 3291)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringView.jaxx 2011-09-17 13:50:17 UTC (rev 3292)
@@ -24,53 +24,70 @@
-->
<Table>
- <LetteringViewHandler id="handler" javaBean="new LetteringViewHandler(this)" />
- <Boolean id="selectedRow" javaBean="false" />
-
- <script>
+
+ <import>
+ javax.swing.ListSelectionModel
+ org.chorem.lima.entity.FiscalPeriod
+ org.chorem.lima.entity.FinancialPeriod
+ org.chorem.lima.ui.combobox.FinancialPeriodComboBoxRenderer
+ org.chorem.lima.enums.ComboBoxDatesEnum
+ </import>
+
+ <LetteringViewHandler id="handler" javaBean="new LetteringViewHandler(this)"/>
+ <Boolean id="selectedRow" javaBean="false"/>
+
+ <script>
<![CDATA[
- import org.chorem.lima.entity.FiscalPeriod;
- import org.chorem.lima.entity.FinancialPeriod;
- import org.chorem.lima.ui.combobox.FinancialPeriodComboBoxRenderer;
-
- import org.chorem.lima.enums.ComboBoxDatesEnum;
+
LetteringPeriodSearchPanel periodSearchPanel = new LetteringPeriodSearchPanel(handler);
void $afterCompleteSetup() {
}
]]>
- </script>
-
- <row weightx="1" weighty="0" anchor="center">
- <cell fill='both'><Table><row>
- <cell anchor="west"><JComboBox id="periodComboBox" javaBean="new JComboBox(ComboBoxDatesEnum.descriptions())"
- onActionPerformed="periodSearchPanel.refresh(ComboBoxDatesEnum.valueOfDescription((String) periodComboBox.getSelectedItem()));
- validate(); repaint()"/></cell>
- <cell><LetteringPeriodSearchPanel javaBean="periodSearchPanel"/></cell>
- </row></Table></cell>
- <cell>
- <JButton text="lima.entries.lettering.add"
- onActionPerformed="handler.addLetter()" toolTipText="lima.tooltip.lettering" enabled="{isSelectedRow()}"/>
- </cell>
- <cell>
- <JButton text="lima.entries.lettering.remove"
- onActionPerformed="handler.removeLetter()" enabled="{isSelectedRow()}"/>
- </cell>
+ </script>
- </row>
- <row>
- <cell fill="both" weightx="1" weighty="1" rows="3" columns="11">
- <JScrollPane>
- <org.chorem.lima.ui.lettering.LetteringTableModel
- id="tableModel"/>
- <org.chorem.lima.ui.lettering.LetteringTable
- id="table" sortable="false" rowHeight="22"
- constructorParams="getHandler()" model="{getTableModel()}"
- selectionMode="{ListSelectionModel.MULTIPLE_INTERVAL_SELECTION }" />
- <javax.swing.ListSelectionModel javaBean="getTable().getSelectionModel()"
- onValueChanged="setSelectedRow(table.getSelectedRow() != -1)"/>
- </JScrollPane>
- </cell>
- </row>
+ <row weightx="1" weighty="0" anchor="center">
+ <cell fill='both'>
+ <Table>
+ <row>
+ <cell anchor="west">
+ <JComboBox id="periodComboBox"
+ javaBean="new JComboBox(ComboBoxDatesEnum.descriptions())"
+ onActionPerformed="periodSearchPanel.refresh(ComboBoxDatesEnum.valueOfDescription((String) periodComboBox.getSelectedItem()));
+ validate(); repaint()"/>
+ </cell>
+ <cell>
+ <LetteringPeriodSearchPanel javaBean="periodSearchPanel"/>
+ </cell>
+ </row>
+ </Table>
+ </cell>
+ <cell>
+ <JButton text="lima.entries.lettering.add"
+ onActionPerformed="handler.addLetter()"
+ toolTipText="lima.tooltip.lettering"
+ enabled="{isSelectedRow()}"/>
+ </cell>
+ <cell>
+ <JButton text="lima.entries.lettering.remove"
+ onActionPerformed="handler.removeLetter()"
+ enabled="{isSelectedRow()}"/>
+ </cell>
+
+ </row>
+ <row>
+ <cell fill="both" weightx="1" weighty="1" rows="3" columns="11">
+ <JScrollPane>
+ <LetteringTableModel
+ id="tableModel"/>
+ <LetteringTable
+ id="table" sortable="false" rowHeight="22"
+ constructorParams="getHandler()" model="{getTableModel()}"
+ selectionMode="{ListSelectionModel.MULTIPLE_INTERVAL_SELECTION }"/>
+ <ListSelectionModel javaBean="getTable().getSelectionModel()"
+ onValueChanged="setSelectedRow(table.getSelectedRow() != -1)"/>
+ </JScrollPane>
+ </cell>
+ </row>
</Table>
\ No newline at end of file
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 2011-09-17 12:59:34 UTC (rev 3291)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateAccountsPanel.jaxx 2011-09-17 13:50:17 UTC (rev 3292)
@@ -24,47 +24,58 @@
-->
<JPanel>
- <jaxx.runtime.swing.JAXXButtonGroup id="radioButtons" javaBean='new JAXXButtonGroup()'/>
+ <import>
+ jaxx.runtime.swing.JAXXButtonGroup
+ org.chorem.lima.enums.AccountsChartEnum
+ </import>
+ <JAXXButtonGroup id="radioButtons"/>
- <script>
- <![CDATA[
- import org.chorem.lima.enums.AccountsChartEnum;
- ]]>
- </script>
- <Table>
- <row>
- <cell><JLabel text='lima.opening.accounts' /></cell>
- </row>
- <row>
- <cell>
- <JRadioButton text='lima.charts.account.shortened' value='{AccountsChartEnum.SHORTENED}' buttonGroup="{getRadioButtons()}"
- selected='true'/>
- </cell>
- </row>
- <row>
- <cell>
- <JRadioButton text='lima.charts.account.base' value='{AccountsChartEnum.BASE}' buttonGroup="{getRadioButtons()}"
- selected='true'/>
- </cell>
- </row>
- <row>
- <cell>
- <JRadioButton text='lima.charts.account.developed' value='{AccountsChartEnum.DEVELOPED}' buttonGroup="{getRadioButtons()}"
- selected='true'/>
- </cell>
- </row>
- <row>
- <cell>
- <JRadioButton text='lima.importexport.importcsv' value='{AccountsChartEnum.IMPORT}' buttonGroup="{getRadioButtons()}"
- selected='true'/>
- </cell>
- </row>
- <row>
- <cell>
- <JRadioButton text='lima.importexport.importebp' value='{AccountsChartEnum.IMPORTEBP}' buttonGroup="{getRadioButtons()}"
- selected='true'/>
- </cell>
- </row>
- </Table>
+ <Table>
+ <row>
+ <cell>
+ <JLabel text='lima.opening.accounts'/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JRadioButton text='lima.charts.account.shortened'
+ value='{AccountsChartEnum.SHORTENED}'
+ buttonGroup="{getRadioButtons()}"
+ selected='true'/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JRadioButton text='lima.charts.account.base'
+ value='{AccountsChartEnum.BASE}'
+ buttonGroup="{getRadioButtons()}"
+ selected='true'/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JRadioButton text='lima.charts.account.developed'
+ value='{AccountsChartEnum.DEVELOPED}'
+ buttonGroup="{getRadioButtons()}"
+ selected='true'/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JRadioButton text='lima.importexport.importcsv'
+ value='{AccountsChartEnum.IMPORT}'
+ buttonGroup="{getRadioButtons()}"
+ selected='true'/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JRadioButton text='lima.importexport.importebp'
+ value='{AccountsChartEnum.IMPORTEBP}'
+ buttonGroup="{getRadioButtons()}"
+ selected='true'/>
+ </cell>
+ </row>
+ </Table>
</JPanel>
\ No newline at end of file
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 2011-09-17 12:59:34 UTC (rev 3291)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateEntryBookPanel.jaxx 2011-09-17 13:50:17 UTC (rev 3292)
@@ -24,18 +24,17 @@
-->
<JPanel>
- <script>
- <![CDATA[
- ]]>
- </script>
- <Table>
- <row>
- <cell><JLabel text='lima.opening.entrybook' /></cell>
- </row>
- <row>
- <cell>
- <JCheckBox id='importEntryBook' text='lima.importexport.defaultentrybooks' selected='true'/>
- </cell>
- </row>
- </Table>
+ <Table>
+ <row>
+ <cell>
+ <JLabel text='lima.opening.entrybook'/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JCheckBox id='importEntryBook'
+ text='lima.importexport.defaultentrybooks' selected='true'/>
+ </cell>
+ </row>
+ </Table>
</JPanel>
\ No newline at end of file
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 2011-09-17 12:59:34 UTC (rev 3291)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateFiscalPeriodPanel.jaxx 2011-09-17 13:50:17 UTC (rev 3292)
@@ -23,16 +23,19 @@
#L%
-->
<JPanel>
- <script>
+ <import>
+ java.util.Calendar
+ java.util.Date
+ org.apache.commons.lang.time.DateUtils
+ org.jdesktop.swingx.JXDatePicker
+ org.chorem.lima.entity.FiscalPeriod
+ org.chorem.lima.business.FiscalPeriodServiceMonitorable
+ org.chorem.lima.business.LimaException
+ org.chorem.lima.service.LimaServiceFactory
+ </import>
+ <script>
<![CDATA[
- import org.chorem.lima.entity.FiscalPeriod;
- import org.chorem.lima.business.FiscalPeriodServiceMonitorable;
- import org.chorem.lima.service.LimaServiceFactory;
- import org.chorem.lima.business.LimaException;
- import org.apache.commons.lang.time.DateUtils;
- import java.util.Date;
- import java.util.Calendar;
-
+
protected FiscalPeriodServiceMonitorable fiscalPeriodService =
LimaServiceFactory.getInstance().getService(
FiscalPeriodServiceMonitorable.class);
@@ -64,27 +67,27 @@
getEndDatePicker().setDate(endDate);
]]>
- </script>
+ </script>
- <Table fill="both">
- <row>
- <cell columns ="3">
- <JLabel text="lima.charts.fiscalperiod.create"/>
- </cell>
- </row>
- <row>
- <cell>
- <JLabel text="lima.common.begindate"/>
- </cell>
- <cell>
- <org.jdesktop.swingx.JXDatePicker id="beginDatePicker"/>
- </cell>
- <cell>
- <JLabel text="lima.common.enddate"/>
- </cell>
- <cell>
- <org.jdesktop.swingx.JXDatePicker id="endDatePicker"/>
- </cell>
- </row>
- </Table>
+ <Table fill="both">
+ <row>
+ <cell columns="3">
+ <JLabel text="lima.charts.fiscalperiod.create"/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JLabel text="lima.common.begindate"/>
+ </cell>
+ <cell>
+ <JXDatePicker id="beginDatePicker"/>
+ </cell>
+ <cell>
+ <JLabel text="lima.common.enddate"/>
+ </cell>
+ <cell>
+ <JXDatePicker id="endDatePicker"/>
+ </cell>
+ </row>
+ </Table>
</JPanel>
\ No newline at end of file
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 2011-09-17 12:59:34 UTC (rev 3291)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateIdentityPanel.jaxx 2011-09-17 13:50:17 UTC (rev 3292)
@@ -24,124 +24,137 @@
-->
<JPanel>
- <org.chorem.lima.ui.identity.IdentityHandler id="handler" javaBean="new org.chorem.lima.ui.identity.IdentityHandler()" />
- <org.chorem.lima.entity.Identity id="identity" javaBean='handler.getIdentity()'/>
+ <import>
+ javax.swing.text.Document
+ org.chorem.lima.entity.Identity
+ org.chorem.lima.ui.identity.IdentityHandler
+ </import>
- <script>
+ <IdentityHandler id="handler"
+ javaBean="new org.chorem.lima.ui.identity.IdentityHandler()"/>
+ <Identity id="identity" javaBean='handler.getIdentity()'/>
+
+ <script>
<![CDATA[
- ]]>
- </script>
-<Table>
- <row>
- <cell fill="horizontal">
- <JLabel text="lima.identity.name"/>
- </cell>
- <cell fill="horizontal">
- <JTextField id="nameTextField" text="{getIdentity().getName()}"/>
- <javax.swing.text.Document javaBean="getNameTextField().getDocument()"
- onInsertUpdate='getIdentity().setName(getNameTextField().getText())'
- onRemoveUpdate='getIdentity().setName(getNameTextField().getText())' />
- </cell>
- <cell fill="horizontal">
- <JLabel text="lima.identity.description"/>
- </cell>
- <cell fill="horizontal">
- <JTextField id="descriptionTextField" text="{getIdentity().getDescription()}"/>
- <javax.swing.text.Document javaBean="getDescriptionTextField().getDocument()"
- onInsertUpdate='getIdentity().setDescription(getDescriptionTextField().getText())'
- onRemoveUpdate='getIdentity().setDescription(getDescriptionTextField().getText())' />
- </cell>
- </row>
- <row>
- <cell fill="horizontal">
- <JLabel text="lima.identity.address"/>
- </cell>
- <cell fill="horizontal">
- <JTextField id="addressTextField" text="{getIdentity().getAddress()}"/>
- <javax.swing.text.Document javaBean="getAddressTextField().getDocument()"
- onInsertUpdate='getIdentity().setAddress(getAddressTextField().getText())'
- onRemoveUpdate='getIdentity().setAddress(getAddressTextField().getText())' />
- </cell>
- <cell fill="horizontal">
- <JLabel text="lima.identity.address2"/>
- </cell>
- <cell fill="horizontal">
- <JTextField id="address2TextField" text="{getIdentity().getAddress2()}"/>
- <javax.swing.text.Document javaBean="getAddress2TextField().getDocument()"
- onInsertUpdate='getIdentity().setAddress2(getAddress2TextField().getText())'
- onRemoveUpdate='getIdentity().setAddress2(getAddress2TextField().getText())' />
- </cell>
- </row>
- <row>
- <cell fill="horizontal">
- <JLabel text="lima.identity.zipCode"/>
- </cell>
- <cell fill="horizontal">
- <JTextField id="zipCodeTextField" text="{getIdentity().getZipCode()}"/>
- <javax.swing.text.Document javaBean="getZipCodeTextField().getDocument()"
- onInsertUpdate='getIdentity().setZipCode(getZipCodeTextField().getText())'
- onRemoveUpdate='getIdentity().setZipCode(getZipCodeTextField().getText())' />
- </cell>
- <cell fill="horizontal">
- <JLabel text="lima.identity.city"/>
- </cell>
- <cell fill="horizontal">
- <JTextField id="cityTextField" text="{getIdentity().getCity()}"/>
- <javax.swing.text.Document javaBean="getCityTextField().getDocument()"
- onInsertUpdate='getIdentity().setCity(getCityTextField().getText())'
- onRemoveUpdate='getIdentity().setCity(getCityTextField().getText())' />
- </cell>
- </row>
- <row>
- <cell fill="horizontal">
- <JLabel text="lima.identity.businessNumber"/>
- </cell>
- <cell fill="horizontal">
- <JTextField id="businessNumberTextField" text="{getIdentity().getBusinessNumber()}"/>
- <javax.swing.text.Document javaBean="getBusinessNumberTextField().getDocument()"
- onInsertUpdate='getIdentity().setBusinessNumber(getBusinessNumberTextField().getText())'
- onRemoveUpdate='getIdentity().setBusinessNumber(getBusinessNumberTextField().getText())' />
- </cell>
- <cell fill="horizontal">
- <JLabel text="lima.identity.vatNumber"/>
- </cell>
- <cell fill="horizontal">
- <JTextField id="vatNumberTextField" text="{getIdentity().getVatNumber()}"/>
- <javax.swing.text.Document javaBean="getVatNumberTextField().getDocument()"
- onInsertUpdate='getIdentity().setVatNumber(getVatNumberTextField().getText())'
- onRemoveUpdate='getIdentity().setVatNumber(getVatNumberTextField().getText())' />
- </cell>
- </row>
- <row>
- <cell fill="horizontal">
- <JLabel text="lima.identity.classificationCode"/>
- </cell>
- <cell fill="horizontal">
- <JTextField id="classificationCodeTextField" text="{getIdentity().getClassificationCode()}"/>
- <javax.swing.text.Document javaBean="getClassificationCodeTextField().getDocument()"
- onInsertUpdate='getIdentity().setClassificationCode(getClassificationCodeTextField().getText())'
- onRemoveUpdate='getIdentity().setClassificationCode(getClassificationCodeTextField().getText())' />
- </cell>
- </row>
- <row>
- <cell fill="horizontal">
- <JLabel text="lima.identity.phoneNumber"/>
- </cell>
- <cell fill="horizontal">
- <JTextField id="phoneNumberTextField" text="{getIdentity().getPhoneNumber()}"/>
- <javax.swing.text.Document javaBean="getPhoneNumberTextField().getDocument()"
- onInsertUpdate='getIdentity().setPhoneNumber(getPhoneNumberTextField().getText())'
- onRemoveUpdate='getIdentity().setPhoneNumber(getPhoneNumberTextField().getText())' />
- </cell>
- <cell fill="horizontal">
- <JLabel text="lima.identity.email"/>
- </cell>
- <cell fill="horizontal">
- <JTextField id="emailTextField" text="{getIdentity().getEmail()}"/>
- <javax.swing.text.Document javaBean="getEmailTextField().getDocument()"
- onInsertUpdate='getIdentity().setEmail(getEmailTextField().getText())'
- onRemoveUpdate='getIdentity().setEmail(getEmailTextField().getText())' />
- </cell>
- </row>
- </Table>
+ ]]>
+ </script>
+ <Table>
+ <row>
+ <cell fill="horizontal">
+ <JLabel text="lima.identity.name"/>
+ </cell>
+ <cell fill="horizontal">
+ <JTextField id="nameTextField" text="{getIdentity().getName()}"/>
+ <Document javaBean="getNameTextField().getDocument()"
+ onInsertUpdate='getIdentity().setName(getNameTextField().getText())'
+ onRemoveUpdate='getIdentity().setName(getNameTextField().getText())'/>
+ </cell>
+ <cell fill="horizontal">
+ <JLabel text="lima.identity.description"/>
+ </cell>
+ <cell fill="horizontal">
+ <JTextField id="descriptionTextField"
+ text="{getIdentity().getDescription()}"/>
+ <Document javaBean="getDescriptionTextField().getDocument()"
+ onInsertUpdate='getIdentity().setDescription(getDescriptionTextField().getText())'
+ onRemoveUpdate='getIdentity().setDescription(getDescriptionTextField().getText())'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill="horizontal">
+ <JLabel text="lima.identity.address"/>
+ </cell>
+ <cell fill="horizontal">
+ <JTextField id="addressTextField" text="{getIdentity().getAddress()}"/>
+ <Document javaBean="getAddressTextField().getDocument()"
+ onInsertUpdate='getIdentity().setAddress(getAddressTextField().getText())'
+ onRemoveUpdate='getIdentity().setAddress(getAddressTextField().getText())'/>
+ </cell>
+ <cell fill="horizontal">
+ <JLabel text="lima.identity.address2"/>
+ </cell>
+ <cell fill="horizontal">
+ <JTextField id="address2TextField"
+ text="{getIdentity().getAddress2()}"/>
+ <Document javaBean="getAddress2TextField().getDocument()"
+ onInsertUpdate='getIdentity().setAddress2(getAddress2TextField().getText())'
+ onRemoveUpdate='getIdentity().setAddress2(getAddress2TextField().getText())'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill="horizontal">
+ <JLabel text="lima.identity.zipCode"/>
+ </cell>
+ <cell fill="horizontal">
+ <JTextField id="zipCodeTextField" text="{getIdentity().getZipCode()}"/>
+ <Document javaBean="getZipCodeTextField().getDocument()"
+ onInsertUpdate='getIdentity().setZipCode(getZipCodeTextField().getText())'
+ onRemoveUpdate='getIdentity().setZipCode(getZipCodeTextField().getText())'/>
+ </cell>
+ <cell fill="horizontal">
+ <JLabel text="lima.identity.city"/>
+ </cell>
+ <cell fill="horizontal">
+ <JTextField id="cityTextField" text="{getIdentity().getCity()}"/>
+ <Document javaBean="getCityTextField().getDocument()"
+ onInsertUpdate='getIdentity().setCity(getCityTextField().getText())'
+ onRemoveUpdate='getIdentity().setCity(getCityTextField().getText())'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill="horizontal">
+ <JLabel text="lima.identity.businessNumber"/>
+ </cell>
+ <cell fill="horizontal">
+ <JTextField id="businessNumberTextField"
+ text="{getIdentity().getBusinessNumber()}"/>
+ <Document javaBean="getBusinessNumberTextField().getDocument()"
+ onInsertUpdate='getIdentity().setBusinessNumber(getBusinessNumberTextField().getText())'
+ onRemoveUpdate='getIdentity().setBusinessNumber(getBusinessNumberTextField().getText())'/>
+ </cell>
+ <cell fill="horizontal">
+ <JLabel text="lima.identity.vatNumber"/>
+ </cell>
+ <cell fill="horizontal">
+ <JTextField id="vatNumberTextField"
+ text="{getIdentity().getVatNumber()}"/>
+ <Document javaBean="getVatNumberTextField().getDocument()"
+ onInsertUpdate='getIdentity().setVatNumber(getVatNumberTextField().getText())'
+ onRemoveUpdate='getIdentity().setVatNumber(getVatNumberTextField().getText())'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill="horizontal">
+ <JLabel text="lima.identity.classificationCode"/>
+ </cell>
+ <cell fill="horizontal">
+ <JTextField id="classificationCodeTextField"
+ text="{getIdentity().getClassificationCode()}"/>
+ <Document javaBean="getClassificationCodeTextField().getDocument()"
+ onInsertUpdate='getIdentity().setClassificationCode(getClassificationCodeTextField().getText())'
+ onRemoveUpdate='getIdentity().setClassificationCode(getClassificationCodeTextField().getText())'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill="horizontal">
+ <JLabel text="lima.identity.phoneNumber"/>
+ </cell>
+ <cell fill="horizontal">
+ <JTextField id="phoneNumberTextField"
+ text="{getIdentity().getPhoneNumber()}"/>
+ <Document javaBean="getPhoneNumberTextField().getDocument()"
+ onInsertUpdate='getIdentity().setPhoneNumber(getPhoneNumberTextField().getText())'
+ onRemoveUpdate='getIdentity().setPhoneNumber(getPhoneNumberTextField().getText())'/>
+ </cell>
+ <cell fill="horizontal">
+ <JLabel text="lima.identity.email"/>
+ </cell>
+ <cell fill="horizontal">
+ <JTextField id="emailTextField" text="{getIdentity().getEmail()}"/>
+ <Document javaBean="getEmailTextField().getDocument()"
+ onInsertUpdate='getIdentity().setEmail(getEmailTextField().getText())'
+ onRemoveUpdate='getIdentity().setEmail(getEmailTextField().getText())'/>
+ </cell>
+ </row>
+ </Table>
</JPanel>
\ No newline at end of file
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 2011-09-17 12:59:34 UTC (rev 3291)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/OpeningView.jaxx 2011-09-17 13:50:17 UTC (rev 3292)
@@ -24,15 +24,16 @@
-->
<JDialog modal="true">
- <OpeningViewHandler id="handler" javaBean="new OpeningViewHandler(this)" />
- <script>
+ <import>
+ javax.swing.BorderFactory
+ javax.swing.ImageIcon
+ </import>
+
+ <OpeningViewHandler id="handler" javaBean="new OpeningViewHandler(this)"/>
+
+ <script>
<![CDATA[
- import javax.swing.BorderFactory;
- import javax.swing.ImageIcon;
-
-
-
getRootPane().setDefaultButton(ok);
protected void performNext() {
dispose();
@@ -41,46 +42,57 @@
dispose();
}
]]>
- </script>
+ </script>
- <Table>
- <row weighty="0.9">
- <cell columns="3" fill="both">
- <Table>
- <row>
- <cell weightx="0.1"><JLabel id='identityIcon'
- icon='{new ImageIcon(getClass().getResource("/images/identity.png"))}'/></cell>
- <cell weightx="0.9" rows="4" fill="both">
- <JPanel id='panel'>
- <JLabel text='lima.opening.welcome' />
- <JButton text='lima.opening.import' onActionPerformed="handler.importSave()"/>
- </JPanel>
- </cell>
- </row>
- <row>
- <cell><JLabel id='accountsIcon'
- icon='{new ImageIcon(getClass().getResource("/images/accounts.png"))}'/></cell>
- </row>
- <row>
- <cell><JLabel id='entrybooksIcon'
- icon='{new ImageIcon(getClass().getResource("/images/entrybooks.png"))}'/></cell>
- </row>
- <row>
- <cell><JLabel id='fiscalperiodsIcon'
- icon='{new ImageIcon(getClass().getResource("/images/fiscalperiods.png"))}'/></cell>
- </row>
- </Table>
- </cell>
- </row>
- <row weighty="0.1">
- <cell weightx="0.8"><JLabel text=''/>
+ <Table>
+ <row weighty="0.9">
+ <cell columns="3" fill="both">
+ <Table>
+ <row>
+ <cell weightx="0.1">
+ <JLabel id='identityIcon'
+ icon='{new ImageIcon(getClass().getResource("/images/identity.png"))}'/>
</cell>
- <cell weightx="0.1" fill="none">
- <JButton text="lima.common.close" onActionPerformed="performCancel()"/>
+ <cell weightx="0.9" rows="4" fill="both">
+ <JPanel id='panel'>
+ <JLabel text='lima.opening.welcome'/>
+ <JButton text='lima.opening.import'
+ onActionPerformed="handler.importSave()"/>
+ </JPanel>
</cell>
- <cell weightx="0.1" fill="none">
- <JButton id="ok" text="lima.common.next" onActionPerformed="handler.next()"/>
+ </row>
+ <row>
+ <cell>
+ <JLabel id='accountsIcon'
+ icon='{new ImageIcon(getClass().getResource("/images/accounts.png"))}'/>
</cell>
- </row>
- </Table>
+ </row>
+ <row>
+ <cell>
+ <JLabel id='entrybooksIcon'
+ icon='{new ImageIcon(getClass().getResource("/images/entrybooks.png"))}'/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JLabel id='fiscalperiodsIcon'
+ icon='{new ImageIcon(getClass().getResource("/images/fiscalperiods.png"))}'/>
+ </cell>
+ </row>
+ </Table>
+ </cell>
+ </row>
+ <row weighty="0.1">
+ <cell weightx="0.8">
+ <JLabel text=''/>
+ </cell>
+ <cell weightx="0.1" fill="none">
+ <JButton text="lima.common.close" onActionPerformed="performCancel()"/>
+ </cell>
+ <cell weightx="0.1" fill="none">
+ <JButton id="ok" text="lima.common.next"
+ onActionPerformed="handler.next()"/>
+ </cell>
+ </row>
+ </Table>
</JDialog>
\ No newline at end of file
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartImportForm.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartImportForm.jaxx 2011-09-17 12:59:34 UTC (rev 3291)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartImportForm.jaxx 2011-09-17 13:50:17 UTC (rev 3292)
@@ -26,66 +26,84 @@
defaultCloseOperation="{JDialog.DO_NOTHING_ON_CLOSE}"
onWindowClosing="performCancel();">
- <jaxx.runtime.swing.JAXXButtonGroup id="radioButtons" javaBean='new JAXXButtonGroup()'/>
- <Boolean id="addState" javaBean='true'/>
+ <import>
+ jaxx.runtime.swing.JAXXButtonGroup
+ org.chorem.lima.enums.VatStatementsChartEnum
+ </import>
- <script>
+ <JAXXButtonGroup id="radioButtons" javaBean='new JAXXButtonGroup()'/>
+ <Boolean id="addState" javaBean='true'/>
+
+ <script>
<![CDATA[
- import org.chorem.lima.enums.VatStatementsChartEnum;
+
getRootPane().setDefaultButton(ok);
protected void performCancel() {
getRadioButtons().setSelectedValue(null);
dispose();
}
]]>
- </script>
+ </script>
- <Table>
- <row>
- <cell><JLabel text='lima.charts.vatstatement.nothing' /></cell>
- </row>
- <row>
- <cell>
- <JRadioButton text='lima.charts.vatstatement.shortened' value='{VatStatementsChartEnum.SHORTENED}' buttonGroup="{getRadioButtons()}"
- selected='true'/>
+ <Table>
+ <row>
+ <cell>
+ <JLabel text='lima.charts.vatstatement.nothing'/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JRadioButton text='lima.charts.vatstatement.shortened'
+ value='{VatStatementsChartEnum.SHORTENED}'
+ buttonGroup="{getRadioButtons()}"
+ selected='true'/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JRadioButton text='lima.charts.vatstatement.base'
+ value='{VatStatementsChartEnum.BASE}'
+ buttonGroup="{getRadioButtons()}"
+ selected='true'/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JRadioButton text='lima.charts.vatstatement.developed'
+ value='{VatStatementsChartEnum.DEVELOPED}'
+ buttonGroup="{getRadioButtons()}"
+ selected='true'/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JRadioButton text='lima.importexport.import'
+ value='{VatStatementsChartEnum.IMPORT}'
+ buttonGroup="{getRadioButtons()}"
+ selected='true'/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JCheckBox id='deleteVatStatementChart' text='lima.vatstatement.delete'
+ selected='false'/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <Table>
+ <row>
+ <cell fill="none">
+ <JButton text="lima.common.cancel"
+ onActionPerformed="performCancel()"/>
</cell>
- </row>
- <row>
- <cell>
- <JRadioButton text='lima.charts.vatstatement.base' value='{VatStatementsChartEnum.BASE}' buttonGroup="{getRadioButtons()}"
- selected='true'/>
- </cell>
- </row>
- <row>
- <cell>
- <JRadioButton text='lima.charts.vatstatement.developed' value='{VatStatementsChartEnum.DEVELOPED}' buttonGroup="{getRadioButtons()}"
- selected='true'/>
+ <cell fill="none">
+ <JButton id="ok" text="lima.common.ok"
+ onActionPerformed="dispose()"/>
</cell>
- </row>
- <row>
- <cell>
- <JRadioButton text='lima.importexport.import' value='{VatStatementsChartEnum.IMPORT}' buttonGroup="{getRadioButtons()}"
- selected='true'/>
- </cell>
- </row>
- <row>
- <cell>
- <JCheckBox id='deleteVatStatementChart' text='lima.vatstatement.delete' selected='false'/>
- </cell>
- </row>
- <row>
- <cell>
- <Table>
- <row>
- <cell fill="none">
- <JButton text="lima.common.cancel" onActionPerformed="performCancel()"/>
- </cell>
- <cell fill="none">
- <JButton id="ok" text="lima.common.ok" onActionPerformed="dispose()"/>
- </cell>
- </row>
- </Table>
- </cell>
- </row>
- </Table>
+ </row>
+ </Table>
+ </cell>
+ </row>
+ </Table>
</JDialog>
\ No newline at end of file
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartMovementForm.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartMovementForm.jaxx 2011-09-17 12:59:34 UTC (rev 3291)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartMovementForm.jaxx 2011-09-17 13:50:17 UTC (rev 3292)
@@ -26,14 +26,18 @@
defaultCloseOperation="{JDialog.DO_NOTHING_ON_CLOSE}"
onWindowClosing="performCancel();">
- <org.chorem.lima.entity.VatStatement id="vatStatement" javaBean='null'/>
- <Boolean id="addState" javaBean='true'/>
+ <import>
+ javax.swing.text.Document
+ org.chorem.lima.entity.VatStatement
+ org.chorem.lima.entity.VatStatementImpl
+ </import>
- <script>
+ <VatStatement id="vatStatement" javaBean='null'/>
+ <Boolean id="addState" javaBean='true'/>
+
+ <script>
<![CDATA[
-
- import org.chorem.lima.entity.VatStatementImpl;
-
+
getRootPane().setDefaultButton(ok);
protected void performCancel() {
@@ -42,59 +46,61 @@
}
]]>
- </script>
+ </script>
- <Table>
-
- <row>
- <cell fill="horizontal">
- <JLabel text="lima.vatstatement.label"/>
- </cell>
- <cell fill="horizontal">
- <JTextField id="labelTextField" text="{getVatStatement().getLabel()}"/>
- <javax.swing.text.Document javaBean="getLabelTextField().getDocument()"
- onInsertUpdate='getVatStatement().setLabel(getLabelTextField().getText())'
- onRemoveUpdate='getVatStatement().setLabel(getLabelTextField().getText())' />
- </cell>
- </row>
- <row>
- <cell fill="horizontal">
- <JLabel text="lima.vatstatement.boxname"/>
- </cell>
- <cell fill="horizontal">
- <JTextField id="boxNameTextField" text="{getVatStatement().getBoxName()}"/>
- <javax.swing.text.Document javaBean="getBoxNameTextField().getDocument()"
- onInsertUpdate='getVatStatement().setBoxName(getBoxNameTextField().getText())'
- onRemoveUpdate='getVatStatement().setBoxName(getBoxNameTextField().getText())' />
- </cell>
- </row>
- <row>
- <cell fill="horizontal">
- <JLabel text="lima.vatstatement.accounts"/>
- </cell>
- <cell fill="horizontal">
- <JTextField id="accountsTextField" text="{getVatStatement().getAccounts()}"/>
- <javax.swing.text.Document javaBean="getAccountsTextField().getDocument()"
- onInsertUpdate='getVatStatement().setAccounts(getAccountsTextField().getText())'
- onRemoveUpdate='getVatStatement().setAccounts(getAccountsTextField().getText())' />
- </cell>
- </row>
- <row>
- <cell fill="horizontal">
- <JLabel text="lima.vatstatement.mastervatstatement"/>
- </cell>
- <cell fill="horizontal">
- <JTextField editable="{false}" id="masterVatStatementTextField"
- text="{getVatStatement().getMasterVatStatement().getLabel()}" />
- </cell>
- </row>
- <row>
- <cell fill="none">
- <JButton text="lima.common.cancel" onActionPerformed="performCancel()"/>
- </cell>
- <cell fill="none">
- <JButton id="ok" text="lima.common.ok" onActionPerformed="dispose()"/>
- </cell>
- </row>
- </Table>
+ <Table>
+
+ <row>
+ <cell fill="horizontal">
+ <JLabel text="lima.vatstatement.label"/>
+ </cell>
+ <cell fill="horizontal">
+ <JTextField id="labelTextField" text="{getVatStatement().getLabel()}"/>
+ <Document javaBean="getLabelTextField().getDocument()"
+ onInsertUpdate='getVatStatement().setLabel(getLabelTextField().getText())'
+ onRemoveUpdate='getVatStatement().setLabel(getLabelTextField().getText())'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill="horizontal">
+ <JLabel text="lima.vatstatement.boxname"/>
+ </cell>
+ <cell fill="horizontal">
+ <JTextField id="boxNameTextField"
+ text="{getVatStatement().getBoxName()}"/>
+ <Document javaBean="getBoxNameTextField().getDocument()"
+ onInsertUpdate='getVatStatement().setBoxName(getBoxNameTextField().getText())'
+ onRemoveUpdate='getVatStatement().setBoxName(getBoxNameTextField().getText())'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill="horizontal">
+ <JLabel text="lima.vatstatement.accounts"/>
+ </cell>
+ <cell fill="horizontal">
+ <JTextField id="accountsTextField"
+ text="{getVatStatement().getAccounts()}"/>
+ <Document javaBean="getAccountsTextField().getDocument()"
+ onInsertUpdate='getVatStatement().setAccounts(getAccountsTextField().getText())'
+ onRemoveUpdate='getVatStatement().setAccounts(getAccountsTextField().getText())'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill="horizontal">
+ <JLabel text="lima.vatstatement.mastervatstatement"/>
+ </cell>
+ <cell fill="horizontal">
+ <JTextField editable="{false}" id="masterVatStatementTextField"
+ text="{getVatStatement().getMasterVatStatement().getLabel()}"/>
+ </cell>
+ </row>
+ <row>
+ <cell fill="none">
+ <JButton text="lima.common.cancel" onActionPerformed="performCancel()"/>
+ </cell>
+ <cell fill="none">
+ <JButton id="ok" text="lima.common.ok" onActionPerformed="dispose()"/>
+ </cell>
+ </row>
+ </Table>
</JDialog>
\ No newline at end of file
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartView.jaxx 2011-09-17 12:59:34 UTC (rev 3291)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartView.jaxx 2011-09-17 13:50:17 UTC (rev 3292)
@@ -24,53 +24,58 @@
-->
<Table>
- <VatChartViewHandler id="handler" javaBean="new VatChartViewHandler(this)" />
- <Boolean id="selectedRow" javaBean="false" />
+ <import>
+ javax.swing.ListSelectionModel
+ </import>
- <script>
+ <VatChartViewHandler id="handler" javaBean="new VatChartViewHandler(this)"/>
+ <Boolean id="selectedRow" javaBean="false"/>
+
+ <script>
<![CDATA[
//getHandler().init();
]]>
- </script>
+ </script>
- <row>
- <cell fill="both" weightx="1" weighty="1" rows='6'>
- <JScrollPane>
- <org.chorem.lima.ui.vatchart.VatChartTreeTableModel id="vatTreeTableModel"/>
- <org.chorem.lima.ui.vatchart.VatChartTreeTable id="treeTable"
- constructorParams="getHandler()"
- selectionMode="{ListSelectionModel.SINGLE_SELECTION}"
- treeTableModel="{getVatTreeTableModel()}" />
- <javax.swing.ListSelectionModel
- javaBean="getTreeTable().getSelectionModel()"
- onValueChanged="setSelectedRow(treeTable.getSelectedRow() != -1)"/>
- </JScrollPane>
- </cell>
- </row>
- <row>
- <cell fill="horizontal">
- <JButton id="addVatStatementMovement" text="lima.vatstatement.movement.add"
- onActionPerformed="getHandler().addVatStatementMovement()" />
- </cell>
- </row>
- <row>
- <cell fill="horizontal">
- <JButton id="updateButton" text="lima.common.update"
- onActionPerformed="getHandler().updateVatStatement()"
- enabled="{isSelectedRow()}" />
- </cell>
- </row>
- <row>
- <cell fill="horizontal">
- <JButton id="removeButton" text="lima.common.remove"
- onActionPerformed="getHandler().removeVatStatement()"
- enabled="{isSelectedRow()}" />
- </cell>
- </row>
- <row>
- <cell fill="horizontal">
- <JButton id="importButton" text="lima.importexport.import"
- onActionPerformed="getHandler().importVatStatementChart()" />
- </cell>
- </row>
+ <row>
+ <cell fill="both" weightx="1" weighty="1" rows='6'>
+ <JScrollPane>
+ <VatChartTreeTableModel id="vatTreeTableModel"/>
+ <VatChartTreeTable id="treeTable"
+ constructorParams="getHandler()"
+ selectionMode="{ListSelectionModel.SINGLE_SELECTION}"
+ treeTableModel="{getVatTreeTableModel()}"/>
+ <ListSelectionModel
+ javaBean="getTreeTable().getSelectionModel()"
+ onValueChanged="setSelectedRow(treeTable.getSelectedRow() != -1)"/>
+ </JScrollPane>
+ </cell>
+ </row>
+ <row>
+ <cell fill="horizontal">
+ <JButton id="addVatStatementMovement"
+ text="lima.vatstatement.movement.add"
+ onActionPerformed="getHandler().addVatStatementMovement()"/>
+ </cell>
+ </row>
+ <row>
+ <cell fill="horizontal">
+ <JButton id="updateButton" text="lima.common.update"
+ onActionPerformed="getHandler().updateVatStatement()"
+ enabled="{isSelectedRow()}"/>
+ </cell>
+ </row>
+ <row>
+ <cell fill="horizontal">
+ <JButton id="removeButton" text="lima.common.remove"
+ onActionPerformed="getHandler().removeVatStatement()"
+ enabled="{isSelectedRow()}"/>
+ </cell>
+ </row>
+ <row>
+ <cell fill="horizontal">
+ <JButton id="importButton" text="lima.importexport.import"
+ onActionPerformed="getHandler().importVatStatementChart()"/>
+ </cell>
+ </row>
</Table>
\ No newline at end of file
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/util/ReportDialogView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/util/ReportDialogView.jaxx 2011-09-17 12:59:34 UTC (rev 3291)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/util/ReportDialogView.jaxx 2011-09-17 13:50:17 UTC (rev 3292)
@@ -22,28 +22,29 @@
<http://www.gnu.org/licenses/gpl-3.0.html>.
#L%
-->
-
+
<JDialog modal="true">
- <script>
+ <script>
<![CDATA[
protected void performOk() {
dispose();
}
]]>
- </script>
-
- <Table>
- <row weightx="1" weighty="1">
- <cell fill="both">
- <JScrollPane id="scrollPane">
- <JTextArea id="textArea" editable="false"/>
- </JScrollPane>
- </cell>
- </row>
- <row anchor="east">
- <cell>
- <JButton id="okButton" text="lima.common.ok" onActionPerformed="performOk()"/>
- </cell>
- </row>
- </Table>
+ </script>
+
+ <Table>
+ <row weightx="1" weighty="1">
+ <cell fill="both">
+ <JScrollPane id="scrollPane">
+ <JTextArea id="textArea" editable="false"/>
+ </JScrollPane>
+ </cell>
+ </row>
+ <row anchor="east">
+ <cell>
+ <JButton id="okButton" text="lima.common.ok"
+ onActionPerformed="performOk()"/>
+ </cell>
+ </row>
+ </Table>
</JDialog>
\ No newline at end of file
1
0
Author: tchemit
Date: 2011-09-17 14:59:34 +0200 (Sat, 17 Sep 2011)
New Revision: 3291
Url: http://chorem.org/repositories/revision/lima/3291
Log:
T?\195?\162che #437: Can not launch via jnlp
T?\195?\162che #457: Updates to nuiton-utils 2.3
Evolution #456: Nettoyage du code des ui (debut...)
Evolution #444: [Saisie ?\195?\169criture] Saisie d'une transaction lourde
Evolution #441: [Saisie ?\195?\169criture] Ouvrir un journal et le modifier
Added:
trunk/lima-swing/src/main/java/org/chorem/lima/ui/LimaDecoratorProvider.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/renderers/
trunk/lima-swing/src/main/java/org/chorem/lima/ui/renderers/RendererUtil.java
Modified:
trunk/lima-swing/pom.xml
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/actions/MiscAction.java
trunk/lima-swing/src/main/java/org/chorem/lima/enums/AccountsChartEnum.java
trunk/lima-swing/src/main/java/org/chorem/lima/enums/ComboBoxAccountsEnum.java
trunk/lima-swing/src/main/java/org/chorem/lima/enums/ComboBoxDatesEnum.java
trunk/lima-swing/src/main/java/org/chorem/lima/enums/ComboBoxEntryBooksEnum.java
trunk/lima-swing/src/main/java/org/chorem/lima/enums/ComboBoxLetterEnum.java
trunk/lima-swing/src/main/java/org/chorem/lima/enums/ComboBoxOperatorsEnum.java
trunk/lima-swing/src/main/java/org/chorem/lima/enums/ComboBoxPeriodEnum.java
trunk/lima-swing/src/main/java/org/chorem/lima/enums/EncodingEnum.java
trunk/lima-swing/src/main/java/org/chorem/lima/enums/EntryBooksChartEnum.java
trunk/lima-swing/src/main/java/org/chorem/lima/enums/FinancialStatementsChartEnum.java
trunk/lima-swing/src/main/java/org/chorem/lima/enums/ImportExportEnum.java
trunk/lima-swing/src/main/java/org/chorem/lima/enums/VatStatementsChartEnum.java
trunk/lima-swing/src/main/java/org/chorem/lima/service/LimaServiceFactory.java
trunk/lima-swing/src/main/java/org/chorem/lima/service/ServiceMonitorableHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountTreeTable.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountComboBox.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsPeriodSearchPanel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsTable.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalancePeriodSearchPanel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceTable.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/AccountTableCellEditor.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellEditor.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellRenderer.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/DateTableCellEditor.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/EmptyCellRenderer.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/EntryBookTableCellEditor.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/LetterTableCellEditor.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/AccountComboBoxModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/AccountRenderer.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/EntryBookComboBoxModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/EntryBookRenderer.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FinancialPeriodComboBoxModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FinancialPeriodComboBoxRenderer.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FiscalPeriodComboBoxModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FiscalPeriodComboBoxRenderer.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/LetterComboBoxModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/LetterRenderer.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/SubAccountComboBoxModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookTable.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBookComboBox.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsPeriodSearchPanel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsTable.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodTable.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartTreeTable.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportPeriodSearchPanel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTable.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableCellRenderer.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialPeriodComboBox.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTable.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/AccountSearchComboBox.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/AccountSearchPanel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/AmountSearchPanel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/EntryBookSearchComboBox.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/EntryBookSearchPanel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionPeriodSearchPanel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchTable.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/LetterSearchComboBox.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/LetterSearchPanel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTable.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedViewHandler.java
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/FiscalPeriodViewHandler.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/importexport/ImportExport.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerPeriodSearchPanel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerTable.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringPeriodSearchPanel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTable.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartTreeTable.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartTreeTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportPeriodSearchPanel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/util/DialogHelper.java
trunk/lima-swing/src/main/java/org/chorem/lima/widgets/JWideComboBox.java
trunk/pom.xml
Modified: trunk/lima-swing/pom.xml
===================================================================
--- trunk/lima-swing/pom.xml 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/pom.xml 2011-09-17 12:59:34 UTC (rev 3291)
@@ -59,27 +59,11 @@
<artifactId>nuiton-i18n</artifactId>
</dependency>
- <!-- other dependencies -->
- <!--dependency>
- <groupId>dom4j</groupId>
- <artifactId>dom4j</artifactId>
- </dependency-->
-
- <!--dependency>
- <groupId>net.sf.opencsv</groupId>
- <artifactId>opencsv</artifactId>
- </dependency-->
-
<dependency>
<groupId>org.swinglabs</groupId>
<artifactId>swingx-core</artifactId>
</dependency>
- <!--dependency>
- <groupId>org.jdom</groupId>
- <artifactId>jdom</artifactId>
- </dependency-->
-
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-email</artifactId>
@@ -128,19 +112,17 @@
<properties>
<!--Main class in JAR -->
<maven.jar.main.class>org.chorem.lima.LimaMain</maven.jar.main.class>
- <webstartPluginVersion>1.0-beta-2-SNAPSHOT</webstartPluginVersion>
-
+
<redmine.releaseFiles>
target/lima-${project.version}-bin.zip,
</redmine.releaseFiles>
<license.generateBundle>true</license.generateBundle>
- <license.bundleLicensePath>META-INF/lima-swing-LICENSE.txt</license.bundleLicensePath>
- <license.bundleThirdPartyPath>META-INF/lima-swing-THIRD-PARTY.txt</license.bundleThirdPartyPath>
+ <license.bundleLicensePath>META-INF/lima-LICENSE.txt</license.bundleLicensePath>
+ <license.bundleThirdPartyPath>META-INF/lima-THIRD-PARTY.txt</license.bundleThirdPartyPath>
<i18n.bundles>fr_FR,en_GB</i18n.bundles>
<i18n.bundleOutputName>lima</i18n.bundleOutputName>
- <jnlp.codebase>${project.url}/jnlp</jnlp.codebase>
</properties>
@@ -249,11 +231,14 @@
<plugin>
<groupId>org.codehaus.mojo.webstart</groupId>
<artifactId>webstart-maven-plugin</artifactId>
- <version>${webstartPluginVersion}</version>
<configuration>
<libPath>lib</libPath>
<makeArchive>false</makeArchive>
<verbose>false</verbose>
+ <gzip>true</gzip>
+ <canUnsign>false</canUnsign>
+ <!--<unsign>true</unsign>-->
+ <pack200>true</pack200>
<jnlp>
<mainClass>${maven.jar.main.class}</mainClass>
@@ -294,7 +279,7 @@
<profiles>
<profile>
- <id>reporting</id>
+ <id>myreporting</id>
<activation>
<property>
<name>performRelease</name>
@@ -306,7 +291,7 @@
<plugin>
<groupId>org.codehaus.mojo.webstart</groupId>
<artifactId>webstart-maven-plugin</artifactId>
- <version>${webstartPluginVersion}</version>
+ <version>${jnlpPluginVersion}</version>
</plugin>
</plugins>
</reporting>
@@ -432,7 +417,6 @@
<plugin>
<groupId>org.bluestemsoftware.open.maven.plugin</groupId>
<artifactId>launch4j-plugin</artifactId>
- <version>1.5.0.0</version>
<executions>
<execution>
<id>launch4j</id>
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/LimaContext.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/LimaContext.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/LimaContext.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -26,9 +26,11 @@
package org.chorem.lima;
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;
import org.chorem.lima.ui.MainView;
import org.chorem.lima.ui.MainViewHandler;
import org.nuiton.i18n.I18n;
@@ -36,19 +38,16 @@
import org.nuiton.i18n.init.UserI18nInitializer;
import org.nuiton.util.FileUtil;
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 jaxx.runtime.context.DefaultApplicationContext {
+/** @author chemit */
+public class LimaContext extends DefaultApplicationContext {
- /**
- * to use log facility, just put in your code: log.info(\"...\");
- */
+ /** to use log facility, just put in your code: log.info(\"...\"); */
static private Log log = LogFactory.getLog(LimaContext.class);
/**
@@ -59,6 +58,10 @@
public static JAXXContextEntryDef<MainView> MAIN_UI_ENTRY_DEF = JAXXUtil.newContextEntryDef("mainUI", MainView.class);
+ public static JAXXContextEntryDef<DecoratorProvider> DECORATOR_PROVIDER_DEF = JAXXUtil.newContextEntryDef("decoratorProvider", DecoratorProvider.class);
+
+ public static JAXXContextEntryDef<LimaConfig> CONFIG_DEF = JAXXUtil.newContextEntryDef("limaConfig", LimaConfig.class);
+
/**
* @return <code>true</code> si le context a été initialisé via la méthode
* {@link #init()}, <ocde>false</code> autrement.
@@ -76,14 +79,14 @@
* @return l'instance partagée
* @throws IllegalStateException si un contexte applicatif a déja été positionné.
*/
- public static synchronized LimaContext init() throws IllegalStateException {
+ public static LimaContext init() throws IllegalStateException {
if (isInit()) {
throw new IllegalStateException("there is already a application context registred.");
}
instance = new LimaContext();
- instance.setContextValue(new LimaConfig());
instance.setContextValue(new MainViewHandler());
-
+ CONFIG_DEF.setContextValue(instance, new LimaConfig());
+ DECORATOR_PROVIDER_DEF.setContextValue(instance, new LimaDecoratorProvider());
return instance;
}
@@ -102,11 +105,15 @@
}
public LimaConfig getConfig() {
- return getContextValue(LimaConfig.class);
+ return CONFIG_DEF.getContextValue(this);
}
+ public DecoratorProvider getDecoratorProvider() {
+ return DECORATOR_PROVIDER_DEF.getContextValue(this);
+ }
+
public void initI18n(LimaConfig config) {
-
+
I18n.close();
File i18nDirectory = config.getI18nDirectory();
@@ -126,32 +133,34 @@
new UserI18nInitializer(
i18nDirectory,
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()) {
log.debug("i18n language : " + locale);
log.debug("i18n loading time : " +
- StringUtil.convertTime(t00, System.nanoTime()));
+ StringUtil.convertTime(t00, System.nanoTime()));
}
}
public MainView getMainUI() {
- return (MainView) MAIN_UI_ENTRY_DEF.getContextValue(this);
+ return MAIN_UI_ENTRY_DEF.getContextValue(this);
}
/**
* close the application's context.
*
- * @throws java.lang.Exception if any pb while closing
+ * @throws Exception if any pb while closing
*/
public void close() throws Exception {
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 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -25,9 +25,6 @@
package org.chorem.lima;
-import static org.nuiton.i18n.I18n._;
-import java.util.List;
-import javax.swing.SwingUtilities;
import jaxx.runtime.SwingUtil;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -41,14 +38,18 @@
import org.chorem.lima.ui.opening.OpeningView;
import org.chorem.lima.util.ErrorHelper;
+import javax.swing.SwingUtilities;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.List;
+
+import static org.nuiton.i18n.I18n._;
+
/**
- * Lima main.
- *
+ * Lima GUI main class.
+ *
* @author ore
* @version $Revision$
- *
- * Last update : $Date$
- * By : $Author$
*/
public class LimaMain {
@@ -60,26 +61,26 @@
/** splash */
private static LimaSplash splash;
-
+
/**
* Lima main method.
- *
+ *
* @param args program args
*/
public static void main(String[] args) {
-
+
if (log.isInfoEnabled()) {
- log.info("Lima start at " + new java.util.Date());
- log.info("Args: " + java.util.Arrays.toString(args));
+ log.info("Lima starts at " + new Date());
+ log.info("Args: " + Arrays.toString(args));
}
-
+
try {
-
+
// init root context
- final LimaContext context = init(args);
+ LimaContext context = init(args);
// do actions
- config = context.getContextValue(LimaConfig.class);
+ config = context.getConfig();
config.doAction(LimaConfig.Action.AFTER_INIT_STEP);
// display main ui
@@ -104,35 +105,22 @@
* @return le context de l'application
* @throws Exception pour toute erreur pendant l'init
*/
- public static synchronized LimaContext init(String... args) throws Exception {
+ public static LimaContext init(String... args) throws Exception {
// update splash
splash = new LimaSplash();
splash.initSplash();
-
+
// to enable javassist on webstart, must remove any securityManager,
// see if this can be dangerous (should not be since jnlp is signed ?)
// moreover it speeds up the loading :)
System.setSecurityManager(null);
- // init i18n
- //long t0 = System.nanoTime();
-
- // FIXME cause NPE
- // I18n.setInitializer(new DefaultI18nInitializer("lima-swing-i18n"));
-
- // FIXME echatellier 20110502 duplicated code with context.initI18n();
- //I18n.init(Locale.FRANCE);
- //if (log.isDebugEnabled()) {
- // log.debug("i18n loading time : " + (StringUtil.convertTime(t0, System.nanoTime())));
- //}
-
-
Runtime.getRuntime().addShutdownHook(new ShutdownHook());
// init root context
LimaContext context = LimaContext.init();
- LimaConfig config = context.getContextValue(LimaConfig.class);
+ LimaConfig config = context.getConfig();
config.parse(args);
context.initI18n(config);
@@ -161,10 +149,10 @@
}*/
return context;
}
-
+
protected static void launch(LimaContext context) throws Exception {
-
+
splash.drawVersion(config.getVersion());
splash.updateProgression(0.1, _("lima.splash.1"));
@@ -179,14 +167,14 @@
// load accounts and test if there is an account plan defined
// if not, call #loadDefaultAccount()
splash.updateProgression(0.7, _("lima.splash.2"));
-
+
//start http server
LimaServiceFactory.getInstance().getService(HttpServerServiceMonitorable.class).start();
-
+
AccountService accountService =
- LimaServiceFactory.getInstance().getService(
- AccountServiceMonitorable.class);
-
+ LimaServiceFactory.getInstance().getService(
+ AccountServiceMonitorable.class);
+
List<Account> accounts = accountService.getChildrenAccounts(null);
if (accounts.isEmpty()) {
if (log.isInfoEnabled()) {
@@ -196,8 +184,8 @@
openingView.setSize(800, 400);
openingView.setLocationRelativeTo(null);
openingView.setVisible(true);
- }else {
- splash.updateProgression(1, _("lima.splash.3"));
+ } else {
+ splash.updateProgression(1, _("lima.splash.3"));
}
// show ui
SwingUtilities.invokeLater(new Runnable() {
@@ -206,7 +194,7 @@
ui.setVisible(true);
}
});
-
+
}
public static class ShutdownHook extends Thread {
@@ -225,7 +213,7 @@
// force to kill main thread
if (log.isInfoEnabled()) {
- log.info(_("lima.init.closed", new java.util.Date()));
+ log.info(_("lima.init.closed", new Date()));
}
Runtime.getRuntime().halt(0);
} catch (Exception ex) {
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/actions/MiscAction.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/actions/MiscAction.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/actions/MiscAction.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -30,6 +30,8 @@
import org.chorem.lima.LimaConfig;
import org.chorem.lima.LimaMain;
+import java.util.Arrays;
+
/**
* Les actions appellables via {@link LimaMain}.
*
@@ -56,7 +58,7 @@
System.out.println("Actions:");
for (LimaConfig.Action a : LimaConfig.Action.values()) {
- System.out.println("\t" + java.util.Arrays.toString(a.aliases) + "(" + a.action + "):" + a.description);
+ System.out.println("\t" + Arrays.toString(a.aliases) + "(" + a.action + "):" + a.description);
}
}
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/enums/AccountsChartEnum.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/enums/AccountsChartEnum.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/enums/AccountsChartEnum.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -31,14 +31,14 @@
private final String filePath;
- private AccountsChartEnum(String filePath) {
+ AccountsChartEnum(String filePath) {
this.filePath = filePath;
}
public String getFilePath() {
String result = "";
- if (!this.filePath.equals("")){
- result=getClass().getResource("/import/"+this.filePath).getPath();
+ if (!filePath.equals("")){
+ result=getClass().getResource("/import/"+ filePath).getPath();
}
return result;
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/enums/ComboBoxAccountsEnum.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/enums/ComboBoxAccountsEnum.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/enums/ComboBoxAccountsEnum.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -36,12 +36,12 @@
private final String description;
- private ComboBoxAccountsEnum(String description) {
+ ComboBoxAccountsEnum(String description) {
this.description = description;
}
public String getDescription() {
- return this.description;
+ return description;
}
public static String[] descriptions(){
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/enums/ComboBoxDatesEnum.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/enums/ComboBoxDatesEnum.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/enums/ComboBoxDatesEnum.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -36,12 +36,12 @@
private final String description;
- private ComboBoxDatesEnum(String description) {
+ ComboBoxDatesEnum(String description) {
this.description = description;
}
public String getDescription() {
- return this.description;
+ return description;
}
public static String[] descriptions(){
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/enums/ComboBoxEntryBooksEnum.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/enums/ComboBoxEntryBooksEnum.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/enums/ComboBoxEntryBooksEnum.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -35,12 +35,12 @@
private final String description;
- private ComboBoxEntryBooksEnum(String description) {
+ ComboBoxEntryBooksEnum(String description) {
this.description = description;
}
public String getDescription() {
- return this.description;
+ return description;
}
public static String[] descriptions(){
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/enums/ComboBoxLetterEnum.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/enums/ComboBoxLetterEnum.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/enums/ComboBoxLetterEnum.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -35,12 +35,12 @@
private final String description;
- private ComboBoxLetterEnum(String description) {
+ ComboBoxLetterEnum(String description) {
this.description = description;
}
public String getDescription() {
- return this.description;
+ return description;
}
public static String[] descriptions(){
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/enums/ComboBoxOperatorsEnum.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/enums/ComboBoxOperatorsEnum.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/enums/ComboBoxOperatorsEnum.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -41,17 +41,17 @@
private final String description;
private final String symbol;
- private ComboBoxOperatorsEnum(String description, String symbol) {
+ ComboBoxOperatorsEnum(String description, String symbol) {
this.description = description;
this.symbol = symbol;
}
public String getDescription() {
- return this.description;
+ return description;
}
public String getSymbol(){
- return this.symbol;
+ return symbol;
}
public static String[] descriptions(){
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/enums/ComboBoxPeriodEnum.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/enums/ComboBoxPeriodEnum.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/enums/ComboBoxPeriodEnum.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -37,12 +37,12 @@
private final String description;
- private ComboBoxPeriodEnum(String description) {
+ ComboBoxPeriodEnum(String description) {
this.description = description;
}
public String getDescription() {
- return this.description;
+ return description;
}
public static String[] descriptions(){
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/enums/EncodingEnum.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/enums/EncodingEnum.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/enums/EncodingEnum.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -33,17 +33,17 @@
private final String encoding;
private final String description;
- private EncodingEnum(String encoding, String description) {
+ EncodingEnum(String encoding, String description) {
this.encoding = encoding;
this.description = description;
}
public String getEncoding() {
- return this.encoding;
+ return encoding;
}
public String getDescription(){
- return this.description;
+ return description;
}
public static String[] descriptions(){
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/enums/EntryBooksChartEnum.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/enums/EntryBooksChartEnum.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/enums/EntryBooksChartEnum.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -31,14 +31,14 @@
private final String filePath;
- private EntryBooksChartEnum(String filePath) {
+ EntryBooksChartEnum(String filePath) {
this.filePath = filePath;
}
public String getFilePath() {
String result = "";
- if (!this.filePath.equals("")){
- result=getClass().getResource("/import/"+this.filePath).getPath();
+ if (!filePath.equals("")){
+ result=getClass().getResource("/import/"+ filePath).getPath();
}
return result; }
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/enums/FinancialStatementsChartEnum.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/enums/FinancialStatementsChartEnum.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/enums/FinancialStatementsChartEnum.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -31,15 +31,15 @@
private final String filePath;
- private FinancialStatementsChartEnum(String filePath) {
+ FinancialStatementsChartEnum(String filePath) {
this.filePath = filePath;
}
public String getFilePath() {
String result = "";
- if (!this.filePath.equals("")){
- result=getClass().getResource("/import/"+this.filePath).getPath();
+ if (!filePath.equals("")){
+ result=getClass().getResource("/import/"+ filePath).getPath();
}
return result;
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/enums/ImportExportEnum.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/enums/ImportExportEnum.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/enums/ImportExportEnum.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -47,7 +47,7 @@
* import mode :
* true if import, false if export
*/
- private ImportExportEnum(Boolean importMode, Boolean encodingOption) {
+ ImportExportEnum(Boolean importMode, Boolean encodingOption) {
this.importMode = importMode;
this.encodingOption = encodingOption;
}
@@ -57,10 +57,10 @@
* true if import or export methode let encoding option
*/
public Boolean getEncodingOption(){
- return this.encodingOption;
+ return encodingOption;
}
public Boolean getImportMode() {
- return this.importMode;
+ return importMode;
}
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/enums/VatStatementsChartEnum.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/enums/VatStatementsChartEnum.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/enums/VatStatementsChartEnum.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -31,15 +31,15 @@
private final String filePath;
- private VatStatementsChartEnum(String filePath) {
+ VatStatementsChartEnum(String filePath) {
this.filePath = filePath;
}
public String getFilePath() {
String result = "";
- if (!this.filePath.equals("")){
- result=getClass().getResource("/import/"+this.filePath).getPath();
+ if (!filePath.equals("")){
+ result=getClass().getResource("/import/"+ filePath).getPath();
}
return result;
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/service/LimaServiceFactory.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/service/LimaServiceFactory.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/service/LimaServiceFactory.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -45,9 +45,7 @@
import java.util.Map;
import java.util.Properties;
-/**
- * This class is a service factory based on embedded openejb container.
- */
+/** This class is a service factory based on embedded openejb container. */
public class LimaServiceFactory {
/** Log. */
@@ -55,14 +53,13 @@
/** Single instance. */
private static LimaServiceFactory instance;
+
protected Map<Class<?>, Object> services = new HashMap<Class<?>, Object>();
/** JNDI context used to look for EJB. */
protected static InitialContext ctx;
- /**
- * Init openejb jndi context.
- */
+ /** Init openejb jndi context. */
protected LimaServiceFactory() {
// TODO EC-20100407 maybe put all options in LimaConfig and allow user to configure it (remove getFlatOptions use)
@@ -80,15 +77,15 @@
if (log.isErrorEnabled()) {
log.error("Can't find log4j properties file", ex);
}
- }
- finally {
+ } finally {
IOUtils.closeQuietly(log4jFile);
}
// Context.INITIAL_CONTEXT_FACTORY is a mandatory option
// containsKey() does'nt work :(
if (!props.containsKey(Context.INITIAL_CONTEXT_FACTORY)) {
- throw new RuntimeException("Application configuration is missing mandatory property "
+ throw new IllegalStateException(
+ "Application configuration is missing mandatory property "
+ Context.INITIAL_CONTEXT_FACTORY);
}
@@ -104,9 +101,9 @@
/**
* Return service factory singleton instance.
- *
+ * <p/>
* Init it at first call.
- *
+ *
* @return singleton instance
*/
public static LimaServiceFactory getInstance() {
@@ -115,38 +112,27 @@
}
return instance;
}
-
- public <M> M getService(Class<M> serviceMonitorableClass){
+
+ public <M> M getService(Class<M> serviceMonitorableClass) {
M result = (M) services.get(serviceMonitorableClass);
if (result == null) {
- Object ejbHome;
- String serviceName = serviceMonitorableClass.getSimpleName().replace("Monitorable", "ImplRemote");
- try {
- ejbHome = ctx.lookup(serviceName);
- } catch (NamingException eee) {
- throw new RuntimeException(
- "Can't lookup for service : " + serviceName, eee);
+ result = newService(serviceMonitorableClass);
- }
- InvocationHandler handler = new ServiceMonitorableHandler(ejbHome);
- result = (M) Proxy.newProxyInstance( serviceMonitorableClass.getClassLoader(), new Class[]{serviceMonitorableClass}, handler);
-
services.put(serviceMonitorableClass, result);
}
return result;
}
-
/**
* 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
*/
public void destroy() throws Exception {
-
+
// destroy code (only in embedded mode)
Assembler assembler = SystemInstance.get().getComponent(Assembler.class);
for (AppInfo appInfo : assembler.getDeployedApplications()) {
@@ -154,4 +140,25 @@
}
OpenEJB.destroy();
}
+
+ protected <M> M newService(Class<M> serviceMonitorableClass) {
+ M result;
+ Object ejbHome;
+ String serviceName = serviceMonitorableClass.getSimpleName().replace("Monitorable", "ImplRemote");
+ try {
+ ejbHome = ctx.lookup(serviceName);
+ } catch (NamingException eee) {
+ throw new RuntimeException(
+ "Can't lookup for service : " + serviceName, eee);
+
+ }
+ InvocationHandler handler = new ServiceMonitorableHandler(ejbHome);
+ ClassLoader classLoader = serviceMonitorableClass.getClassLoader();
+ result = (M) Proxy.newProxyInstance(
+ classLoader,
+ new Class[]{serviceMonitorableClass},
+ handler
+ );
+ return result;
+ }
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/service/ServiceMonitorableHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/service/ServiceMonitorableHandler.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/service/ServiceMonitorableHandler.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -25,58 +25,67 @@
package org.chorem.lima.service;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.chorem.lima.business.ServiceListener;
+
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.chorem.lima.business.ServiceListener;
public class ServiceMonitorableHandler implements InvocationHandler {
- private static final Log log = LogFactory.getLog(ServiceMonitorableHandler.class);
-
+ private static final Log log =
+ LogFactory.getLog(ServiceMonitorableHandler.class);
+
+ /** The proxied service. */
private Object service;
+
+ /** Listeners on the service. */
private List<ServiceListener> listeners;
-
- public ServiceMonitorableHandler(Object service){
+
+ public ServiceMonitorableHandler(Object service) {
this.service = service;
listeners = new ArrayList<ServiceListener>();
}
-
- public void addServiceListener(ServiceListener serviceListener){
- listeners.add(serviceListener);
- }
- public void removeServiceListener(ServiceListener serviceListener){
- listeners.remove(serviceListener);
- }
-
@Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
Object result = null;
- if (method.getName().equals("addListener")){
+ if (method.getName().equals("addServiceListener")) {
addServiceListener((ServiceListener) args[0]);
- }
- else if (method.getName().equals("removeListener")){
+ } else if (method.getName().equals("removeServiceListener")) {
removeServiceListener((ServiceListener) args[0]);
- }
- else {
+ } else {
try {
- result = method.invoke(service, args);
- }catch (InvocationTargetException eee){
+ 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());
- log.debug("proxy : " + service.toString() + " " + method.getName());
- }
- }
+ notifyMethod(method);
}
return result;
}
+ protected void addServiceListener(ServiceListener serviceListener) {
+ listeners.add(serviceListener);
+ }
+
+ protected void removeServiceListener(ServiceListener serviceListener) {
+ listeners.remove(serviceListener);
+ }
+
+ protected void notifyMethod(Method method) {
+ String methodName = method.getName();
+ //TODO tchemit-2011-09-16 Could we have an explanation of this test ?
+ if (!methodName.startsWith("get")) {
+ for (ServiceListener serviceListener : listeners) {
+ serviceListener.notifyMethod(service.toString(), methodName);
+ log.debug("proxy : " + service.toString() + " " + methodName);
+ }
+ }
+ }
+
}
Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/LimaDecoratorProvider.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/LimaDecoratorProvider.java (rev 0)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/LimaDecoratorProvider.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -0,0 +1,29 @@
+package org.chorem.lima.ui;
+
+import org.chorem.lima.entity.EntryBook;
+import org.chorem.lima.entity.FinancialPeriod;
+import org.chorem.lima.entity.FiscalPeriod;
+import org.nuiton.util.decorator.DecoratorProvider;
+
+/**
+ * To provide decorations for entities.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.5.2
+ */
+public class LimaDecoratorProvider extends DecoratorProvider {
+
+ @Override
+ protected void loadDecorators() {
+
+ registerJXPathDecorator(EntryBook.class, "${code}$s - ${label}$s");
+
+ registerJXPathDecorator(
+ FiscalPeriod.class,
+ "${beginDate}$td/%1$tm/%1$tY - ${endDate}$td/%1$tm/%1$tY");
+
+ registerJXPathDecorator(
+ FinancialPeriod.class,
+ "${beginDate}$td/%1$tm/%1$tY - ${endDate}$td/%1$tm/%1$tY");
+ }
+}
Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/LimaDecoratorProvider.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
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 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -147,7 +147,7 @@
* @param ui l'ui principale de l'application
* @param fullscreen le nouvel état requis.
*/
- public void changeScreen(MainView ui, final boolean fullscreen) {
+ public void changeScreen(MainView ui, boolean fullscreen) {
boolean canContinue = ensureModification(ui);
if (!canContinue) {
return;
@@ -214,8 +214,8 @@
about.setAboutText(_("lima.title.about.description"));
about.setBottomText(ui.getConfig().getCopyrightText());
about.setIconPath("/icons/lima.png");
- about.setLicenseFile("META-INF/lima-swing-LICENSE.txt");
- about.setThirdpartyFile("META-INF/lima-swing-THIRD-PARTY.txt");
+ about.setLicenseFile("META-INF/lima-LICENSE.txt");
+ about.setThirdpartyFile("META-INF/lima-THIRD-PARTY.txt");
about.init();
about.showInDialog(ui, true);
}
Modified: 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 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountTreeTable.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -1,27 +1,27 @@
-/*
- * #%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%
- */
+/*
+ * #%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 java.awt.event.KeyEvent;
@@ -60,8 +60,8 @@
@Override
public void mousePressed(MouseEvent e) {
- if (this.rowAtPoint(e.getPoint()) == -1) {
- this.clearSelection();
+ if (rowAtPoint(e.getPoint()) == -1) {
+ clearSelection();
}
}
@@ -89,8 +89,8 @@
public void keyPressed(KeyEvent e) {
// clear row selection with the key: escape
if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
- if (!this.isEditing()) {
- this.clearSelection();
+ if (!isEditing()) {
+ clearSelection();
}
}
}
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 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -25,10 +25,6 @@
package org.chorem.lima.ui.account;
-import static org.nuiton.i18n.I18n._;
-
-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.AccountServiceMonitorable;
@@ -41,16 +37,16 @@
import org.chorem.lima.enums.AccountsChartEnum;
import org.chorem.lima.enums.ImportExportEnum;
import org.chorem.lima.service.LimaServiceFactory;
-import org.chorem.lima.ui.account.AccountForm;
-import org.chorem.lima.ui.account.AccountView;
-import org.chorem.lima.ui.account.SubLedgerForm;
-import org.chorem.lima.ui.account.UpdateAccountForm;
-import org.chorem.lima.ui.account.UpdateSubLedgerForm;
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 javax.swing.JOptionPane;
+import javax.swing.tree.TreePath;
+
+import static org.nuiton.i18n.I18n._;
+
/**
* Handler associated with account view.
*
@@ -73,7 +69,7 @@
this.view = view;
// Gets factory service
LimaServiceFactory.getInstance().getService(
- ImportServiceMonitorable.class).addListener(this);
+ ImportServiceMonitorable.class).addServiceListener(this);
accountService =
LimaServiceFactory.getInstance().getService(
AccountServiceMonitorable.class);
@@ -132,7 +128,7 @@
if (log.isErrorEnabled()) {
log.error("Can't add account", eee);
}
- DialogHelper.showMessageDialog(eee.getMessage());
+ DialogHelper.showErrorMessageDialog(view, eee);
}
@@ -191,14 +187,14 @@
if (log.isErrorEnabled()) {
log.error("Can't add subledger", eee);
}
- DialogHelper.showMessageDialog(eee.getMessage());
+ DialogHelper.showErrorMessageDialog(view, eee);
}
catch (LimaException eee) {
if (log.isErrorEnabled()) {
log.error("Can't add subledger", eee);
}
- DialogHelper.showMessageDialog(eee.getMessage());
+ DialogHelper.showErrorMessageDialog(view, eee);
}
}
}
@@ -254,7 +250,7 @@
if (log.isErrorEnabled()) {
log.error("Can't add update", eee);
}
- DialogHelper.showMessageDialog(eee.getMessage());
+ DialogHelper.showErrorMessageDialog(view, eee);
}
}
}
@@ -291,7 +287,7 @@
if (log.isErrorEnabled()) {
log.error("Can't delete account", eee);
}
- DialogHelper.showMessageDialog(eee.getMessage());
+ DialogHelper.showErrorMessageDialog(view, eee);
}
}
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountComboBox.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountComboBox.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountComboBox.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -38,7 +38,7 @@
import org.chorem.lima.util.AccountToString;
import org.jdesktop.swingx.autocomplete.AutoCompleteDecorator;
-public class AccountComboBox extends JComboBox implements KeyListener, ActionListener {
+public class AccountComboBox extends JComboBox implements KeyListener {
private static final long serialVersionUID = 1L;
@@ -55,35 +55,35 @@
setRenderer(accountRenderer);
setEditable(true);
AutoCompleteDecorator.decorate(this, AccountToString.getInstance());
- this.getEditor().getEditorComponent().addKeyListener(this);
- this.addActionListener(this);
+ getEditor().getEditorComponent().addKeyListener(this);
+ addActionListener(this);
}
public void back(){
- int row = this.getSelectedIndex();
+ int row = getSelectedIndex();
log.debug(row);
if (row > 0){
- this.getEditor().setItem(this.getItemAt(row-1));
- handler.setAccount((Account) this.getSelectedItem());
+ getEditor().setItem(getItemAt(row-1));
+ handler.setAccount((Account) getSelectedItem());
}
}
public void next(){
- int size = this.getModel().getSize();
- int row = this.getSelectedIndex();
+ int size = getModel().getSize();
+ int row = getSelectedIndex();
log.debug(row);
if (row < size-1){
- this.getEditor().setItem(this.getItemAt(row+1));
- handler.setAccount((Account) this.getSelectedItem());
+ getEditor().setItem(getItemAt(row+1));
+ handler.setAccount((Account) getSelectedItem());
}
}
@Override
public void actionPerformed(ActionEvent e) {
- Object object = this.getSelectedItem();
+ Object object = getSelectedItem();
if (object instanceof Account){
- handler.setAccount((Account) this.getSelectedItem());
+ handler.setAccount((Account) getSelectedItem());
}
}
@@ -95,9 +95,9 @@
@Override
public void keyReleased(KeyEvent e) {
- Object object = this.getSelectedItem();
+ Object object = getSelectedItem();
if (object instanceof Account){
- handler.setAccount((Account) this.getSelectedItem());
+ handler.setAccount((Account) getSelectedItem());
}
// delegate popup list menu
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsPeriodSearchPanel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsPeriodSearchPanel.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsPeriodSearchPanel.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -100,12 +100,12 @@
handler.setEndDate(endDatePicker.getDate());
endDatePicker.addActionListener(endDateActionListener);
handler.refresh();
-
- this.removeAll();
- this.add(beginDateLabel);
- this.add(beginDatePicker);
- this.add(endDateLabel);
- this.add(endDatePicker);
+
+ removeAll();
+ add(beginDateLabel);
+ add(beginDatePicker);
+ add(endDateLabel);
+ add(endDatePicker);
break;
case FISCAL_PERIOD:
@@ -127,8 +127,8 @@
};
fiscalPeriod.addActionListener(fiscalPeriodActionListener);
- this.removeAll();
- this.add(fiscalPeriod);
+ removeAll();
+ add(fiscalPeriod);
break;
case FINANCIAL_PERIOD:
@@ -149,8 +149,8 @@
}
};
financialPeriod.addActionListener(financialPeriodActionListener);
- this.removeAll();
- this.add(financialPeriod);
+ removeAll();
+ add(financialPeriod);
break;
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsTable.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsTable.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsTable.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -1,27 +1,27 @@
-/*
- * #%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%
- */
+/*
+ * #%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.accountsreports;
import java.awt.event.KeyEvent;
@@ -67,8 +67,8 @@
@Override
public void mousePressed(MouseEvent e) {
- if (this.rowAtPoint(e.getPoint()) == -1) {
- this.clearSelection();
+ if (rowAtPoint(e.getPoint()) == -1) {
+ clearSelection();
}
}
@@ -96,8 +96,8 @@
public void keyPressed(KeyEvent e) {
// clear row selection with the key: escape
if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
- if (!this.isEditing()) {
- this.clearSelection();
+ if (!isEditing()) {
+ clearSelection();
}
}
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsViewHandler.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsViewHandler.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -79,9 +79,9 @@
LimaServiceFactory.getInstance().getService(
ReportServiceMonitorable.class);
LimaServiceFactory.getInstance().getService(
- ImportServiceMonitorable.class).addListener(this);
+ ImportServiceMonitorable.class).addServiceListener(this);
LimaServiceFactory.getInstance().getService(
- FinancialTransactionServiceMonitorable.class).addListener(this);
+ FinancialTransactionServiceMonitorable.class).addServiceListener(this);
}
public void setBeginDate(Date date){
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalancePeriodSearchPanel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalancePeriodSearchPanel.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalancePeriodSearchPanel.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -101,12 +101,12 @@
handler.setEndDate(endDatePicker.getDate());
endDatePicker.addActionListener(endDateActionListener);
handler.refresh();
-
- this.removeAll();
- this.add(beginDateLabel);
- this.add(beginDatePicker);
- this.add(endDateLabel);
- this.add(endDatePicker);
+
+ removeAll();
+ add(beginDateLabel);
+ add(beginDatePicker);
+ add(endDateLabel);
+ add(endDatePicker);
break;
case FISCAL_PERIOD:
@@ -128,8 +128,8 @@
};
fiscalPeriod.addActionListener(fiscalPeriodActionListener);
- this.removeAll();
- this.add(fiscalPeriod);
+ removeAll();
+ add(fiscalPeriod);
break;
case FINANCIAL_PERIOD:
@@ -150,8 +150,8 @@
}
};
financialPeriod.addActionListener(financialPeriodActionListener);
- this.removeAll();
- this.add(financialPeriod);
+ removeAll();
+ add(financialPeriod);
break;
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceTable.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceTable.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceTable.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -1,27 +1,27 @@
-/*
- * #%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%
- */
+/*
+ * #%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.balance;
import java.awt.event.KeyEvent;
@@ -64,8 +64,8 @@
@Override
public void mousePressed(MouseEvent e) {
- if (this.rowAtPoint(e.getPoint()) == -1) {
- this.clearSelection();
+ if (rowAtPoint(e.getPoint()) == -1) {
+ clearSelection();
}
}
@@ -93,8 +93,8 @@
public void keyPressed(KeyEvent e) {
// clear row selection with the key: escape
if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
- if (!this.isEditing()) {
- this.clearSelection();
+ if (!isEditing()) {
+ clearSelection();
}
}
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceViewHandler.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceViewHandler.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -102,9 +102,9 @@
LimaServiceFactory.getInstance().getService(
FiscalPeriodServiceMonitorable.class);
LimaServiceFactory.getInstance().getService(
- ImportServiceMonitorable.class).addListener(this);
+ ImportServiceMonitorable.class).addServiceListener(this);
LimaServiceFactory.getInstance().getService(
- FinancialTransactionServiceMonitorable.class).addListener(this);
+ FinancialTransactionServiceMonitorable.class).addServiceListener(this);
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/AccountTableCellEditor.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/AccountTableCellEditor.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/AccountTableCellEditor.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -25,18 +25,6 @@
package org.chorem.lima.ui.celleditor;
-import java.awt.Component;
-import java.awt.event.KeyEvent;
-import java.awt.event.KeyListener;
-import java.awt.event.MouseEvent;
-import java.util.EventObject;
-
-import javax.swing.AbstractCellEditor;
-import javax.swing.JTable;
-import javax.swing.SwingUtilities;
-import javax.swing.table.TableCellEditor;
-import javax.swing.text.JTextComponent;
-
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.entity.Account;
@@ -46,22 +34,32 @@
import org.chorem.lima.widgets.JWideComboBox;
import org.jdesktop.swingx.autocomplete.AutoCompleteDecorator;
+import javax.swing.AbstractCellEditor;
+import javax.swing.JTable;
+import javax.swing.SwingUtilities;
+import javax.swing.table.TableCellEditor;
+import javax.swing.text.JTextComponent;
+import java.awt.Component;
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
+import java.awt.event.MouseEvent;
+import java.util.EventObject;
+
public class AccountTableCellEditor extends AbstractCellEditor implements TableCellEditor, KeyListener {
protected static final Log log = LogFactory.getLog(EntryBookTableCellEditor.class);
private final JWideComboBox comboBox;
private static final long serialVersionUID = 1L;
- private static AccountTableCellEditor editor;
- private static SubAccountComboBoxModel accountComboBoxModel;
- private static boolean keyPressed = false;
+// private static AccountTableCellEditor editor;
+ private static boolean keyPressed;
+
/**
* constructor
*/
public AccountTableCellEditor() {
- super();
comboBox = new JWideComboBox();
- accountComboBoxModel = new SubAccountComboBoxModel();
+ SubAccountComboBoxModel accountComboBoxModel = new SubAccountComboBoxModel();
comboBox.setModel(accountComboBoxModel);
AccountRenderer accountRenderer = new AccountRenderer();
comboBox.setRenderer(accountRenderer);
@@ -72,7 +70,7 @@
@Override
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
if (value instanceof Account){
- comboBox.setSelectedItem((Account) value);
+ comboBox.setSelectedItem(value);
}
return comboBox;
}
@@ -110,7 +108,7 @@
}
}
keyPressed = false;
- return ( !(evt instanceof MouseEvent) || ((MouseEvent) evt).getClickCount() == 2 );
+ return !(evt instanceof MouseEvent) || ((MouseEvent) evt).getClickCount() == 2;
}
@@ -123,7 +121,7 @@
public void keyReleased(KeyEvent e) {
// Vérifie si c'est la première frappe au clavier
- if ( keyPressed == false )
+ if (!keyPressed)
{
// Récupère l'editor de la comboBox
JTextComponent edit = (JTextComponent) comboBox.getEditor().getEditorComponent();
@@ -144,11 +142,11 @@
}
- public static AccountTableCellEditor getInstance() {
- if (editor == null) {
- editor = new AccountTableCellEditor();
- }
- return editor;
- }
+// public static AccountTableCellEditor getInstance() {
+// if (editor == null) {
+// editor = new AccountTableCellEditor();
+// }
+// return editor;
+// }
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellEditor.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellEditor.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellEditor.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -1,37 +1,32 @@
-/*
- * #%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%
- */
+/*
+ * #%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.celleditor;
-import java.awt.Component;
-import java.awt.event.FocusEvent;
-import java.awt.event.FocusListener;
-import java.awt.event.KeyEvent;
-import java.awt.event.KeyListener;
-import java.awt.event.MouseEvent;
-import java.math.BigDecimal;
-import java.util.EventObject;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.chorem.lima.LimaContext;
import javax.swing.AbstractCellEditor;
import javax.swing.JTable;
@@ -41,12 +36,15 @@
import javax.swing.event.AncestorEvent;
import javax.swing.event.AncestorListener;
import javax.swing.table.TableCellEditor;
+import java.awt.Component;
+import java.awt.event.FocusEvent;
+import java.awt.event.FocusListener;
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
+import java.awt.event.MouseEvent;
+import java.math.BigDecimal;
+import java.util.EventObject;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.chorem.lima.LimaContext;
-import org.chorem.lima.business.LimaException;
-
public class BigDecimalTableCellEditor extends AbstractCellEditor
implements TableCellEditor, FocusListener, AncestorListener, KeyListener {
@@ -82,16 +80,16 @@
textValue = textValue.replaceAll(",", ".");
if (textValue.equals("")) {
return BigDecimal.ZERO;
- } else {
- //set 0 in case the user type in a non number format
- BigDecimal bdValue = BigDecimal.ZERO;
+ } else {
+ //set 0 in case the user type in a non number format
+ BigDecimal bdValue = BigDecimal.ZERO;
try {
- bdValue = new BigDecimal(textValue);
- } catch (NumberFormatException eee) {
- if (log.isErrorEnabled()) {
- log.error("Can't set " + textValue + " to a BigDecimal", eee);
- }
- }
+ bdValue = new BigDecimal(textValue);
+ } catch (NumberFormatException eee) {
+ if (log.isErrorEnabled()) {
+ log.error("Can't set " + textValue + " to a BigDecimal", eee);
+ }
+ }
//round half up the number using the scale given by the configuration
bdValue = bdValue.setScale(LimaContext.getContext().getConfig().getScale(),
BigDecimal.ROUND_HALF_UP);
@@ -122,7 +120,7 @@
}
@Override
- public void ancestorAdded(final AncestorEvent e) {
+ public void ancestorAdded(AncestorEvent e) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
textField.requestFocus();
@@ -148,20 +146,20 @@
}
@Override
- public void keyReleased(KeyEvent e) {
+ public void keyReleased(KeyEvent e) {
// replace all the cell content only if all the text has been selected
- if (keyPressed == false
- && textField.getSelectionStart() == 0
- && textField.getSelectionEnd() == textField.getText().length()) {
- // delete the the cell content
- if (e.getKeyChar() == KeyEvent.VK_BACK_SPACE) {
- textField.setText("");
- keyPressed = true;
- // replace the content by the char typed in
- } else if (String.valueOf(e.getKeyChar()).matches("[a-zA-z0-9]")) {
- textField.setText(String.valueOf(e.getKeyChar()));
- keyPressed = true;
- }
+ if (!keyPressed
+ && textField.getSelectionStart() == 0
+ && textField.getSelectionEnd() == textField.getText().length()) {
+ // delete the the cell content
+ if (e.getKeyChar() == KeyEvent.VK_BACK_SPACE) {
+ textField.setText("");
+ keyPressed = true;
+ // replace the content by the char typed in
+ } else if (String.valueOf(e.getKeyChar()).matches("[a-zA-z0-9]")) {
+ textField.setText(String.valueOf(e.getKeyChar()));
+ keyPressed = true;
+ }
}
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellRenderer.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellRenderer.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellRenderer.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -1,47 +1,40 @@
-/*
- * #%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%
- */
+/*
+ * #%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.celleditor;
+import org.chorem.lima.LimaConfig;
+import org.chorem.lima.LimaContext;
+
+import javax.swing.JTable;
+import javax.swing.SwingConstants;
+import javax.swing.table.DefaultTableCellRenderer;
import java.awt.Component;
-import java.awt.Font;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
-import java.text.NumberFormat;
-import java.util.Locale;
-import javax.swing.JTable;
-import javax.swing.SwingConstants;
-import javax.swing.table.TableCellRenderer;
-import javax.swing.table.DefaultTableCellRenderer;
-
-import org.chorem.lima.LimaConfig;
-import org.chorem.lima.LimaContext;
-import org.chorem.lima.beans.FinancialStatementAmounts;
-import org.chorem.lima.ui.financialstatementreport.FinancialStatementReportTableModel;
-
public class BigDecimalTableCellRenderer extends DefaultTableCellRenderer {
private static final long serialVersionUID = -2499433026151065390L;
@@ -54,7 +47,7 @@
boolean isSelected, boolean hasFocus, int row, int column)
{
- Component cell = super.getTableCellRendererComponent(
+ super.getTableCellRendererComponent(
table, value, isSelected, hasFocus, row, column);
setHorizontalAlignment(SwingConstants.RIGHT);
setValue(value);
@@ -63,7 +56,7 @@
public void setValue(Object aValue) {
Object result = aValue;
- if (( aValue != null) && (aValue instanceof BigDecimal)) {
+ if (aValue != null && aValue instanceof BigDecimal) {
LimaConfig config = LimaContext.getContext().getConfig();
String scale = "";
for (int i = 0; i < config.getScale(); i++) {
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/DateTableCellEditor.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/DateTableCellEditor.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/DateTableCellEditor.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -37,8 +37,6 @@
import java.awt.Component;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
-import java.awt.event.KeyEvent;
-import java.awt.event.KeyListener;
import java.awt.event.MouseEvent;
import java.util.Date;
@@ -52,7 +50,7 @@
private final JXDatePicker datePicker;
private static final long serialVersionUID = 1L;
- private static DateTableCellEditor editor;
+// private static DateTableCellEditor editor;
//used to tell if the user has pressed a key
private Date date;
@@ -106,12 +104,12 @@
return !(evt instanceof MouseEvent) || ((MouseEvent) evt).getClickCount() == 2;
}
- public static DateTableCellEditor getInstance() {
- if (editor == null) {
- editor = new DateTableCellEditor();
- }
- return editor;
- }
+// public static DateTableCellEditor getInstance() {
+// if (editor == null) {
+// editor = new DateTableCellEditor();
+// }
+// return editor;
+// }
/**
* Listeners
@@ -128,7 +126,7 @@
}
@Override
- public void ancestorAdded(final AncestorEvent e) {
+ public void ancestorAdded(AncestorEvent e) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
datePicker.requestFocus();
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/EmptyCellRenderer.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/EmptyCellRenderer.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/EmptyCellRenderer.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -1,42 +1,39 @@
-/*
- * #%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%
- */
+/*
+ * #%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.celleditor;
-import java.awt.Color;
-import java.awt.Component;
+import sun.swing.DefaultLookup;
import javax.swing.JLabel;
import javax.swing.JTable;
import javax.swing.border.Border;
import javax.swing.border.EmptyBorder;
import javax.swing.table.DefaultTableCellRenderer;
+import java.awt.Color;
+import java.awt.Component;
-import org.chorem.lima.entity.EntryBook;
-
-import sun.swing.DefaultLookup;
-
@SuppressWarnings("restriction")
public class EmptyCellRenderer extends DefaultTableCellRenderer {
@@ -74,7 +71,7 @@
// if empty or null, colour background in red
// else setText
if (value instanceof String) {
- if (String.valueOf(value).isEmpty() || (String.valueOf(value) == null)) {
+ if (String.valueOf(value).isEmpty() || String.valueOf(value) == null) {
mycell.setBackground(new Color(255, 198, 209));
} else {
mycell.setText(value.toString());
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/EntryBookTableCellEditor.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/EntryBookTableCellEditor.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/EntryBookTableCellEditor.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -25,16 +25,6 @@
package org.chorem.lima.ui.celleditor;
-import java.awt.Component;
-import java.awt.event.KeyAdapter;
-import java.awt.event.KeyEvent;
-import java.awt.event.MouseEvent;
-import java.util.EventObject;
-import javax.swing.AbstractCellEditor;
-import javax.swing.JTable;
-import javax.swing.SwingUtilities;
-import javax.swing.table.TableCellEditor;
-import javax.swing.text.JTextComponent;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.entity.EntryBook;
@@ -44,17 +34,29 @@
import org.chorem.lima.widgets.JWideComboBox;
import org.jdesktop.swingx.autocomplete.AutoCompleteDecorator;
+import javax.swing.AbstractCellEditor;
+import javax.swing.JTable;
+import javax.swing.SwingUtilities;
+import javax.swing.table.TableCellEditor;
+import javax.swing.text.JTextComponent;
+import java.awt.Component;
+import java.awt.event.KeyAdapter;
+import java.awt.event.KeyEvent;
+import java.awt.event.MouseEvent;
+import java.util.EventObject;
+
public class EntryBookTableCellEditor extends AbstractCellEditor implements TableCellEditor {
protected static final Log log = LogFactory.getLog(EntryBookTableCellEditor.class);
+
private final JWideComboBox comboBox;
+
private static final long serialVersionUID = 1L;
- private static EntryBookTableCellEditor editor;
- private static boolean keyPressed = false;
- /**
- * constructor
- */
+ // private static EntryBookTableCellEditor editor;
+ private static boolean keyPressed;
+
+ /** constructor */
public EntryBookTableCellEditor() {
comboBox = new JWideComboBox();
EntryBookComboBoxModel entryBookComboBoxModel = new EntryBookComboBoxModel();
@@ -64,7 +66,7 @@
// AutoCompletion
AutoCompleteDecorator.decorate(comboBox, EntryBookToString.getInstance());
-
+
/**
* Ajout d'un listener pour la frappe au clavier seulement, permettant
* de déplacer la sélection (et le caret) du fait que la première touche
@@ -75,8 +77,7 @@
@Override
public void keyReleased(KeyEvent e) {
// Vérifie si c'est la première frappe au clavier
- if ( keyPressed == false )
- {
+ if (!keyPressed) {
// Récupère l'editor de la comboBox
JTextComponent edit = (JTextComponent) comboBox.getEditor().getEditorComponent();
// Met en place le curseur et la selection après la première lettre
@@ -84,19 +85,18 @@
keyPressed = true;
}
// Validate editing with enter key
- if ( e.getKeyChar() == KeyEvent.VK_ENTER )
- {
+ if (e.getKeyChar() == KeyEvent.VK_ENTER) {
stopCellEditing();
}
}
});
-
+
}
@Override
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
- if (value instanceof EntryBook){
- comboBox.setSelectedItem((EntryBook) value);
+ if (value instanceof EntryBook) {
+ comboBox.setSelectedItem(value);
}
return comboBox;
}
@@ -105,11 +105,12 @@
public Object getCellEditorValue() {
return comboBox.getSelectedItem();
}
-
-
+
+
/**
* Vérifie si la cellule peut être éditable :
* seulement si il y a une frappe au clavier ou un double clic.
+ *
* @param evt
* @return
*/
@@ -119,16 +120,14 @@
if (evt instanceof KeyEvent) {
final KeyEvent keyEvent = (KeyEvent) evt;
// Empèche la touche echap
- if ( keyEvent.getKeyChar() != KeyEvent.VK_ESCAPE )
- {
+ if (keyEvent.getKeyChar() != KeyEvent.VK_ESCAPE) {
// Permet de placer le focus sur l'editor de la comboBox
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
comboBox.getEditor().getEditorComponent().requestFocus();
JTextComponent edit = (JTextComponent) comboBox.getEditor().getEditorComponent();
- if (!Character.isIdentifierIgnorable(keyEvent.getKeyChar()))
- {
+ if (!Character.isIdentifierIgnorable(keyEvent.getKeyChar())) {
edit.setText(Character.toString(keyEvent.getKeyChar()));
}
}
@@ -137,13 +136,13 @@
}
// Remet à faux pour la premiere lettre tapée au clavier
keyPressed = false;
- return ( !(evt instanceof MouseEvent) || ((MouseEvent) evt).getClickCount() == 2 );
+ return !(evt instanceof MouseEvent) || ((MouseEvent) evt).getClickCount() == 2;
}
- public static EntryBookTableCellEditor getInstance() {
- if (editor == null) {
- editor = new EntryBookTableCellEditor();
- }
- return editor;
- }
+// public static EntryBookTableCellEditor getInstance() {
+// if (editor == null) {
+// editor = new EntryBookTableCellEditor();
+// }
+// return editor;
+// }
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/LetterTableCellEditor.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/LetterTableCellEditor.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/LetterTableCellEditor.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -25,16 +25,6 @@
package org.chorem.lima.ui.celleditor;
-import java.awt.Component;
-import java.awt.event.KeyEvent;
-import java.awt.event.KeyListener;
-import java.awt.event.MouseEvent;
-import java.util.EventObject;
-import javax.swing.AbstractCellEditor;
-import javax.swing.JTable;
-import javax.swing.SwingUtilities;
-import javax.swing.table.TableCellEditor;
-import javax.swing.text.JTextComponent;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.entity.Account;
@@ -44,22 +34,33 @@
import org.chorem.lima.widgets.JWideComboBox;
import org.jdesktop.swingx.autocomplete.AutoCompleteDecorator;
+import javax.swing.AbstractCellEditor;
+import javax.swing.JTable;
+import javax.swing.SwingUtilities;
+import javax.swing.table.TableCellEditor;
+import javax.swing.text.JTextComponent;
+import java.awt.Component;
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
+import java.awt.event.MouseEvent;
+import java.util.EventObject;
+
public class LetterTableCellEditor extends AbstractCellEditor implements TableCellEditor, KeyListener {
protected static final Log log = LogFactory.getLog(EntryBookTableCellEditor.class);
- private final JWideComboBox comboBox;
private static final long serialVersionUID = 1L;
- private static LetterTableCellEditor editor;
- private static LetterComboBoxModel comboBoxModel;
- private static boolean keyPressed = false;
+ private final JWideComboBox comboBox;
+// private static LetterTableCellEditor editor;
+
+ private static boolean keyPressed;
+
/**
* constructor
*/
public LetterTableCellEditor() {
- super();
comboBox = new JWideComboBox();
- comboBoxModel = new LetterComboBoxModel();
+ LetterComboBoxModel comboBoxModel = new LetterComboBoxModel();
comboBox.setModel(comboBoxModel);
LetterRenderer renderer = new LetterRenderer();
comboBox.setRenderer(renderer);
@@ -70,7 +71,7 @@
@Override
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
if (value instanceof Account){
- comboBox.setSelectedItem((Account) value);
+ comboBox.setSelectedItem(value);
}
return comboBox;
}
@@ -108,7 +109,7 @@
}
}
keyPressed = false;
- return ( !(evt instanceof MouseEvent) || ((MouseEvent) evt).getClickCount() == 2 );
+ return !(evt instanceof MouseEvent) || ((MouseEvent) evt).getClickCount() == 2;
}
@@ -121,7 +122,7 @@
public void keyReleased(KeyEvent e) {
// Vérifie si c'est la première frappe au clavier
- if ( keyPressed == false )
+ if (!keyPressed)
{
// Récupère l'editor de la comboBox
JTextComponent edit = (JTextComponent) comboBox.getEditor().getEditorComponent();
@@ -142,11 +143,11 @@
}
- public static LetterTableCellEditor getInstance() {
- if (editor == null) {
- editor = new LetterTableCellEditor();
- }
- return editor;
- }
+// public static LetterTableCellEditor getInstance() {
+// if (editor == null) {
+// editor = new LetterTableCellEditor();
+// }
+// return editor;
+// }
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/AccountComboBoxModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/AccountComboBoxModel.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/AccountComboBoxModel.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -59,9 +59,9 @@
accountService =
LimaServiceFactory.getInstance().getService(
AccountServiceMonitorable.class);
- accountService.addListener(this);
+ accountService.addServiceListener(this);
LimaServiceFactory.getInstance().getService(
- ImportServiceMonitorable.class).addListener(this);
+ ImportServiceMonitorable.class).addServiceListener(this);
datasCache = getDataList();
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/AccountRenderer.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/AccountRenderer.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/AccountRenderer.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -28,6 +28,7 @@
import org.chorem.lima.entity.Account;
import javax.swing.DefaultListCellRenderer;
+import javax.swing.JLabel;
import javax.swing.JList;
import java.awt.Component;
@@ -42,14 +43,20 @@
boolean isSelected,
boolean cellHasFocus) {
- Account account = (Account) value;
- if (account != null) {
+ JLabel label = (JLabel) super.getListCellRendererComponent(list,
+ value,
+ index,
+ isSelected,
+ cellHasFocus
+ );
+ if (value != null) {
+ Account account = (Account) value;
String accountLabel = account.getLabel();
int nbChars = 30;
if (accountLabel != null && accountLabel.length() > nbChars) {
accountLabel = accountLabel.substring(0, nbChars) + "…";
}
- setText(account.getAccountNumber() + " - " + accountLabel);
+ label.setText(account.getAccountNumber() + " - " + accountLabel);
}
return this;
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/EntryBookComboBoxModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/EntryBookComboBoxModel.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/EntryBookComboBoxModel.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -64,9 +64,9 @@
entryBookService =
LimaServiceFactory.getInstance().getService(
EntryBookServiceMonitorable.class);
- entryBookService.addListener(this);
+ entryBookService.addServiceListener(this);
LimaServiceFactory.getInstance().getService(
- ImportServiceMonitorable.class).addListener(this);
+ ImportServiceMonitorable.class).addServiceListener(this);
cacheDatas = getDataList();
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/EntryBookRenderer.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/EntryBookRenderer.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/EntryBookRenderer.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -25,35 +25,40 @@
package org.chorem.lima.ui.combobox;
-import java.awt.Component;
+import org.chorem.lima.entity.EntryBook;
import javax.swing.DefaultListCellRenderer;
import javax.swing.JLabel;
import javax.swing.JList;
+import java.awt.Component;
-import org.chorem.lima.entity.EntryBook;
+public class EntryBookRenderer extends DefaultListCellRenderer {
-public class EntryBookRenderer extends DefaultListCellRenderer {
-
private static final long serialVersionUID = 1L;
@Override
public Component getListCellRendererComponent(JList list,
- Object value,
- int index,
- boolean isSelected,
- boolean cellHasFocus) {
- // TODO Auto-generated method stub
-
- JLabel label = new JLabel();
- EntryBook entrybook = (EntryBook) value;
- if (entrybook != null){
- label.setText(entrybook.getCode()+" - "+entrybook.getLabel());
+ Object value,
+ int index,
+ boolean isSelected,
+ boolean cellHasFocus) {
+
+ JLabel label = (JLabel) super.getListCellRendererComponent(list,
+ value,
+ index,
+ isSelected,
+ cellHasFocus
+ );
+ String text;
+ if (value == null) {
+ text = "\t";
+ } else {
+ EntryBook entrybook = (EntryBook) value;
+ text = entrybook.getCode() + " - " + entrybook.getLabel();
}
- return label;
-
+ label.setText(text);
+ return this;
}
-
-
+
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FinancialPeriodComboBoxModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FinancialPeriodComboBoxModel.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FinancialPeriodComboBoxModel.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -86,11 +86,11 @@
financialPeriodService =
LimaServiceFactory.getInstance().getService(
FinancialPeriodServiceMonitorable.class);
- financialPeriodService.addListener(this);
+ financialPeriodService.addServiceListener(this);
LimaServiceFactory.getInstance().getService(
- FiscalPeriodServiceMonitorable.class).addListener(this);
+ FiscalPeriodServiceMonitorable.class).addServiceListener(this);
LimaServiceFactory.getInstance().getService(
- ImportServiceMonitorable.class).addListener(this);
+ ImportServiceMonitorable.class).addServiceListener(this);
if (displayAllPeriods) {
datasCache=getAllDataList();
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FinancialPeriodComboBoxRenderer.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FinancialPeriodComboBoxRenderer.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FinancialPeriodComboBoxRenderer.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -25,35 +25,41 @@
package org.chorem.lima.ui.combobox;
-import java.awt.Component;
-import java.text.SimpleDateFormat;
+import org.chorem.lima.entity.FinancialPeriod;
+
import javax.swing.DefaultListCellRenderer;
import javax.swing.JLabel;
import javax.swing.JList;
-import org.chorem.lima.entity.FinancialPeriod;
+import java.awt.Component;
+import java.text.SimpleDateFormat;
public class FinancialPeriodComboBoxRenderer extends DefaultListCellRenderer {
private static final long serialVersionUID = 1L;
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd MMM yy");
+
@Override
public Component getListCellRendererComponent(JList list,
- Object value,
- int index,
- boolean isSelected,
- boolean cellHasFocus) {
- // TODO Auto-generated method stub
-
- JLabel label = new JLabel();
- FinancialPeriod financialPeriod = (FinancialPeriod) value;
- if (financialPeriod != null){
- SimpleDateFormat simpleDateFormat
- = new SimpleDateFormat("dd MMM yy");
- label.setText(simpleDateFormat.format(financialPeriod.getBeginDate())+" - "+simpleDateFormat.format(financialPeriod.getEndDate()));
+ Object value,
+ int index,
+ boolean isSelected,
+ boolean cellHasFocus) {
+
+ JLabel label = (JLabel) super.getListCellRendererComponent(list,
+ value,
+ index,
+ isSelected,
+ cellHasFocus
+ );
+ if (value != null) {
+ FinancialPeriod financialPeriod = (FinancialPeriod) value;
+
+ label.setText(simpleDateFormat.format(financialPeriod.getBeginDate()) + " - " + simpleDateFormat.format(financialPeriod.getEndDate()));
}
- return label;
+ return label;
}
-
+
}
\ No newline at end of file
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FiscalPeriodComboBoxModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FiscalPeriodComboBoxModel.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FiscalPeriodComboBoxModel.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -25,9 +25,6 @@
package org.chorem.lima.ui.combobox;
-import java.util.List;
-import javax.swing.AbstractListModel;
-import javax.swing.ComboBoxModel;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.FiscalPeriodServiceMonitorable;
@@ -38,6 +35,10 @@
import org.chorem.lima.service.LimaServiceFactory;
import org.chorem.lima.ui.financialperiod.FinancialPeriodTableModel;
+import javax.swing.AbstractListModel;
+import javax.swing.ComboBoxModel;
+import java.util.List;
+
public class FiscalPeriodComboBoxModel extends AbstractListModel implements ComboBoxModel, ServiceListener{
private static final long serialVersionUID = 1L;
@@ -55,9 +56,9 @@
fiscalPeriodService =
LimaServiceFactory.getInstance().getService(
FiscalPeriodServiceMonitorable.class);
- fiscalPeriodService.addListener(this);
+ fiscalPeriodService.addServiceListener(this);
LimaServiceFactory.getInstance().getService(
- ImportServiceMonitorable.class).addListener(this);
+ ImportServiceMonitorable.class).addServiceListener(this);
datasCache = getDataList();
}
@@ -66,9 +67,9 @@
fiscalPeriodService =
LimaServiceFactory.getInstance().getService(
FiscalPeriodServiceMonitorable.class);
- fiscalPeriodService.addListener(this);
+ fiscalPeriodService.addServiceListener(this);
LimaServiceFactory.getInstance().getService(
- ImportServiceMonitorable.class).addListener(this);
+ ImportServiceMonitorable.class).addServiceListener(this);
datasCache = getAllDataList();
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FiscalPeriodComboBoxRenderer.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FiscalPeriodComboBoxRenderer.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FiscalPeriodComboBoxRenderer.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -25,35 +25,41 @@
package org.chorem.lima.ui.combobox;
-import java.awt.Component;
-import java.text.SimpleDateFormat;
+import org.chorem.lima.entity.FiscalPeriod;
+
import javax.swing.DefaultListCellRenderer;
import javax.swing.JLabel;
import javax.swing.JList;
-import org.chorem.lima.entity.FiscalPeriod;
+import java.awt.Component;
+import java.text.SimpleDateFormat;
public class FiscalPeriodComboBoxRenderer extends DefaultListCellRenderer {
private static final long serialVersionUID = 1L;
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd MMM yy");
+
@Override
public Component getListCellRendererComponent(JList list,
- Object value,
- int index,
- boolean isSelected,
- boolean cellHasFocus) {
- // TODO Auto-generated method stub
-
- JLabel label = new JLabel();
- FiscalPeriod fiscalPeriod = (FiscalPeriod) value;
- if (fiscalPeriod != null){
- SimpleDateFormat simpleDateFormat =
- new SimpleDateFormat("dd MMM yy");
+ Object value,
+ int index,
+ boolean isSelected,
+ boolean cellHasFocus) {
+
+ JLabel label = (JLabel) super.getListCellRendererComponent(list,
+ value,
+ index,
+ isSelected,
+ cellHasFocus
+ );
+ if (value != null) {
+ FiscalPeriod fiscalPeriod = (FiscalPeriod) value;
+
label.setText(simpleDateFormat.format(fiscalPeriod.getBeginDate())
- + " - " + simpleDateFormat.format(fiscalPeriod.getEndDate()));
+ + " - " + simpleDateFormat.format(fiscalPeriod.getEndDate()));
}
- return label;
+ return label;
}
-
+
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/LetterComboBoxModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/LetterComboBoxModel.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/LetterComboBoxModel.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -59,9 +59,9 @@
service =
LimaServiceFactory.getInstance().getService(
FinancialTransactionServiceMonitorable.class);
- service.addListener(this);
+ service.addServiceListener(this);
LimaServiceFactory.getInstance().getService(
- ImportServiceMonitorable.class).addListener(this);
+ ImportServiceMonitorable.class).addServiceListener(this);
datasCache = getDataList();
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/LetterRenderer.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/LetterRenderer.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/LetterRenderer.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -25,25 +25,31 @@
package org.chorem.lima.ui.combobox;
-import java.awt.Component;
+import org.chorem.lima.entity.Letter;
+
import javax.swing.DefaultListCellRenderer;
import javax.swing.JLabel;
import javax.swing.JList;
-import org.chorem.lima.entity.Letter;
+import java.awt.Component;
-public class LetterRenderer extends DefaultListCellRenderer {
+public class LetterRenderer extends DefaultListCellRenderer {
private static final long serialVersionUID = 1L;
@Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
-
- JLabel label = new JLabel();
- Letter letter = (Letter) value;
- if (letter != null){
+
+ JLabel label = (JLabel) super.getListCellRendererComponent(list,
+ value,
+ index,
+ isSelected,
+ cellHasFocus
+ );
+ if (value != null) {
+ Letter letter = (Letter) value;
label.setText(letter.getCode());
}
- return label;
+ return label;
}
-
+
}
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 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/SubAccountComboBoxModel.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -58,9 +58,9 @@
accountService =
LimaServiceFactory.getInstance().getService(
AccountServiceMonitorable.class);
- accountService.addListener(this);
+ accountService.addServiceListener(this);
LimaServiceFactory.getInstance().getService(
- ImportServiceMonitorable.class).addListener(this);
+ ImportServiceMonitorable.class).addServiceListener(this);
datasCache = getDataList();
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookTable.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookTable.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookTable.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -1,27 +1,27 @@
-/*
- * #%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%
- */
+/*
+ * #%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.entrybook;
import java.awt.event.KeyEvent;
@@ -60,8 +60,8 @@
@Override
public void mousePressed(MouseEvent e) {
- if (this.rowAtPoint(e.getPoint()) == -1) {
- this.clearSelection();
+ if (rowAtPoint(e.getPoint()) == -1) {
+ clearSelection();
}
}
@@ -89,8 +89,8 @@
public void keyPressed(KeyEvent e) {
// clear row selection with the key: escape
if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
- if (!this.isEditing()) {
- this.clearSelection();
+ if (!isEditing()) {
+ clearSelection();
}
}
}
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 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookTableModel.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -64,7 +64,7 @@
entryBookService =
LimaServiceFactory.getInstance().getService(
EntryBookServiceMonitorable.class);
- LimaServiceFactory.getInstance().getService(ImportServiceMonitorable.class).addListener(this);
+ LimaServiceFactory.getInstance().getService(ImportServiceMonitorable.class).addServiceListener(this);
}
@Override
@@ -102,7 +102,7 @@
}
public EntryBook getEntryBookAtRow(int row) throws LimaException {
- EntryBook entryBook = null;
+ EntryBook entryBook;
entryBook = entryBookService.getAllEntryBooks().get(row);
return entryBook;
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBookComboBox.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBookComboBox.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBookComboBox.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -38,7 +38,7 @@
import org.chorem.lima.util.EntryBookToString;
import org.jdesktop.swingx.autocomplete.AutoCompleteDecorator;
-public class EntryBookComboBox extends JComboBox implements KeyListener, ActionListener {
+public class EntryBookComboBox extends JComboBox implements KeyListener {
private static final long serialVersionUID = 1L;
@@ -55,35 +55,35 @@
setRenderer(entryBookRenderer);
setEditable(true);
AutoCompleteDecorator.decorate(this, EntryBookToString.getInstance());
- this.getEditor().getEditorComponent().addKeyListener(this);
- this.addActionListener(this);
+ getEditor().getEditorComponent().addKeyListener(this);
+ addActionListener(this);
}
public void back(){
- int row = this.getSelectedIndex();
+ int row = getSelectedIndex();
log.debug(row);
if (row > 0){
- this.getEditor().setItem(this.getItemAt(row-1));
- handler.setEntryBook((EntryBook) this.getSelectedItem());
+ getEditor().setItem(getItemAt(row-1));
+ handler.setEntryBook((EntryBook) getSelectedItem());
}
}
public void next(){
- int size = this.getModel().getSize();
- int row = this.getSelectedIndex();
+ int size = getModel().getSize();
+ int row = getSelectedIndex();
log.debug(row);
if (row < size-1){
- this.getEditor().setItem(this.getItemAt(row+1));
- handler.setEntryBook((EntryBook) this.getSelectedItem());
+ getEditor().setItem(getItemAt(row+1));
+ handler.setEntryBook((EntryBook) getSelectedItem());
}
}
@Override
public void actionPerformed(ActionEvent e) {
- Object object = this.getSelectedItem();
+ Object object = getSelectedItem();
if (object instanceof EntryBook){
- handler.setEntryBook((EntryBook) this.getSelectedItem());
+ handler.setEntryBook((EntryBook) getSelectedItem());
}
}
@@ -95,9 +95,9 @@
@Override
public void keyReleased(KeyEvent e) {
- Object object = this.getSelectedItem();
+ Object object = getSelectedItem();
if (object instanceof EntryBook){
- handler.setEntryBook((EntryBook) this.getSelectedItem());
+ handler.setEntryBook((EntryBook) getSelectedItem());
}
// delegate popup list menu
if ( e.getKeyChar() == KeyEvent.VK_ENTER )
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsPeriodSearchPanel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsPeriodSearchPanel.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsPeriodSearchPanel.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -100,12 +100,12 @@
handler.setEndDate(endDatePicker.getDate());
endDatePicker.addActionListener(endDateActionListener);
handler.refresh();
-
- this.removeAll();
- this.add(beginDateLabel);
- this.add(beginDatePicker);
- this.add(endDateLabel);
- this.add(endDatePicker);
+
+ removeAll();
+ add(beginDateLabel);
+ add(beginDatePicker);
+ add(endDateLabel);
+ add(endDatePicker);
break;
case FISCAL_PERIOD:
@@ -127,8 +127,8 @@
};
fiscalPeriod.addActionListener(fiscalPeriodActionListener);
- this.removeAll();
- this.add(fiscalPeriod);
+ removeAll();
+ add(fiscalPeriod);
break;
case FINANCIAL_PERIOD:
@@ -149,8 +149,8 @@
}
};
financialPeriod.addActionListener(financialPeriodActionListener);
- this.removeAll();
- this.add(financialPeriod);
+ removeAll();
+ add(financialPeriod);
break;
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsTable.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsTable.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsTable.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -113,8 +113,8 @@
@Override
public void mousePressed(MouseEvent e) {
- if (this.rowAtPoint(e.getPoint()) == -1) {
- this.clearSelection();
+ if (rowAtPoint(e.getPoint()) == -1) {
+ clearSelection();
}
}
@@ -142,8 +142,8 @@
public void keyPressed(KeyEvent e) {
// clear row selection with the key: escape
if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
- if (!this.isEditing()) {
- this.clearSelection();
+ if (!isEditing()) {
+ clearSelection();
}
}
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsViewHandler.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsViewHandler.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -107,9 +107,9 @@
LimaServiceFactory.getInstance().getService(
FiscalPeriodServiceMonitorable.class);
LimaServiceFactory.getInstance().getService(
- ImportServiceMonitorable.class).addListener(this);
+ ImportServiceMonitorable.class).addServiceListener(this);
LimaServiceFactory.getInstance().getService(
- FinancialTransactionServiceMonitorable.class).addListener(this);
+ FinancialTransactionServiceMonitorable.class).addServiceListener(this);
}
public void setBeginDate(Date date){
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodTable.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodTable.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodTable.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -97,7 +97,7 @@
int month = Integer.parseInt(simpleDateFormat.format(
closedPeriodicEntryBook.getFinancialPeriod().getBeginDate()));
// true if month is even
- return ((month % 2)==0);
+ return month % 2 ==0;
}
};
@@ -127,7 +127,7 @@
} catch (LimaException eee) {
log.debug("Can't get closePeriodicEntryBook",eee);
}
- return (closedPeriodicEntryBook.getLocked());
+ return closedPeriodicEntryBook.getLocked();
}
};
colorTransaction =
@@ -141,8 +141,8 @@
@Override
public void mousePressed(MouseEvent e) {
- if (this.rowAtPoint(e.getPoint()) == -1) {
- this.clearSelection();
+ if (rowAtPoint(e.getPoint()) == -1) {
+ clearSelection();
}
}
@@ -170,8 +170,8 @@
public void keyPressed(KeyEvent e) {
// clear row selection with the key: escape
if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
- if (!this.isEditing()) {
- this.clearSelection();
+ if (!isEditing()) {
+ clearSelection();
}
}
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodTableModel.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodTableModel.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -72,9 +72,9 @@
LimaServiceFactory.getInstance().getService(
FinancialPeriodServiceMonitorable.class);
LimaServiceFactory.getInstance().getService(
- ImportServiceMonitorable.class).addListener(this);
+ ImportServiceMonitorable.class).addServiceListener(this);
LimaServiceFactory.getInstance().getService(
- FiscalPeriodServiceMonitorable.class).addListener(this);
+ FiscalPeriodServiceMonitorable.class).addServiceListener(this);
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartTreeTable.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartTreeTable.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartTreeTable.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -1,27 +1,27 @@
-/*
- * #%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%
- */
+/*
+ * #%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.financialstatementchart;
import java.awt.event.KeyEvent;
@@ -59,8 +59,8 @@
@Override
public void mousePressed(MouseEvent e) {
- if (this.rowAtPoint(e.getPoint()) == -1) {
- this.clearSelection();
+ if (rowAtPoint(e.getPoint()) == -1) {
+ clearSelection();
}
}
@@ -88,8 +88,8 @@
public void keyPressed(KeyEvent e) {
// clear row selection with the key: escape
if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
- if (!this.isEditing()) {
- this.clearSelection();
+ if (!isEditing()) {
+ clearSelection();
}
}
}
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 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartViewHandler.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -41,8 +41,6 @@
import org.chorem.lima.enums.FinancialStatementsChartEnum;
import org.chorem.lima.enums.ImportExportEnum;
import org.chorem.lima.service.LimaServiceFactory;
-import org.chorem.lima.ui.financialstatementchart.FinancialStatementHeaderForm;
-import org.chorem.lima.ui.financialstatementchart.FinancialStatementMovementForm;
import org.chorem.lima.ui.importexport.ImportExport;
import org.chorem.lima.util.DialogHelper;
import org.chorem.lima.util.ErrorHelper;
@@ -73,7 +71,7 @@
LimaServiceFactory.getInstance().getService(
FinancialStatementServiceMonitorable.class);
LimaServiceFactory.getInstance().getService(
- ImportServiceMonitorable.class).addListener(this);
+ ImportServiceMonitorable.class).addServiceListener(this);
}
/**
@@ -99,7 +97,7 @@
if (newFinancialStatementHeader != null) {
newFinancialStatementHeader.setHeader(true);
// get current selection path
- TreePath treePath = null;
+ TreePath treePath;
int selectedRow = treeTable.getSelectedRow();
if ( selectedRow != -1) {
treePath = treeTable.getPathForRow(selectedRow);
@@ -146,7 +144,7 @@
// null == cancel action
if (newFinancialStatementMovement != null) {
// get current selection path
- TreePath treePath = null;
+ TreePath treePath;
int selectedRow = view.treeTable.getSelectedRow();
treePath = view.treeTable.getPathForRow(selectedRow);
// add it
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportPeriodSearchPanel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportPeriodSearchPanel.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportPeriodSearchPanel.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -100,12 +100,12 @@
model.setEndDate(endDatePicker.getDate());
endDatePicker.addActionListener(endDateActionListener);
model.refresh();
-
- this.removeAll();
- this.add(beginDateLabel);
- this.add(beginDatePicker);
- this.add(endDateLabel);
- this.add(endDatePicker);
+
+ removeAll();
+ add(beginDateLabel);
+ add(beginDatePicker);
+ add(endDateLabel);
+ add(endDatePicker);
break;
case FISCAL_PERIOD:
@@ -127,8 +127,8 @@
};
fiscalPeriod.addActionListener(fiscalPeriodActionListener);
- this.removeAll();
- this.add(fiscalPeriod);
+ removeAll();
+ add(fiscalPeriod);
break;
case FINANCIAL_PERIOD:
@@ -149,8 +149,8 @@
}
};
financialPeriod.addActionListener(financialPeriodActionListener);
- this.removeAll();
- this.add(financialPeriod);
+ removeAll();
+ add(financialPeriod);
break;
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTable.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTable.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTable.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -128,8 +128,8 @@
@Override
public void mousePressed(MouseEvent e) {
- if (this.rowAtPoint(e.getPoint()) == -1) {
- this.clearSelection();
+ if (rowAtPoint(e.getPoint()) == -1) {
+ clearSelection();
}
}
@@ -157,8 +157,8 @@
public void keyPressed(KeyEvent e) {
// clear row selection with the key: escape
if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
- if (!this.isEditing()) {
- this.clearSelection();
+ if (!isEditing()) {
+ clearSelection();
}
}
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableCellRenderer.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableCellRenderer.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableCellRenderer.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -92,7 +92,7 @@
public void setValue(Object aValue) {
Object result = aValue;
- if (( aValue != null) && (aValue instanceof BigDecimal)) {
+ if (aValue != null && aValue instanceof BigDecimal) {
LimaConfig config = LimaContext.getContext().getConfig();
String scale = "";
for (int i = 0; i < config.getScale(); i++) {
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableModel.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableModel.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -96,13 +96,13 @@
LimaServiceFactory.getInstance().getService(
FinancialStatementServiceMonitorable.class);
- financialStatementService.addListener(this);
+ financialStatementService.addServiceListener(this);
port = LimaServiceFactory.getInstance().getService(
HttpServerServiceMonitorable.class).getHttpPort();
LimaServiceFactory.getInstance().getService(
- ImportServiceMonitorable.class).addListener(this);
+ ImportServiceMonitorable.class).addServiceListener(this);
LimaServiceFactory.getInstance().getService(
- FinancialTransactionServiceMonitorable.class).addListener(this);
+ FinancialTransactionServiceMonitorable.class).addServiceListener(this);
documentService = LimaServiceFactory.getInstance().getService(DocumentServiceMonitorable.class);
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportViewHandler.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportViewHandler.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -84,7 +84,7 @@
Date selectedBeginDate = model.getBeginDate();
Date selectedEndDate = model.getEndDate();
- if ((selectedBeginDate != null) && (selectedEndDate != null)) {
+ if (selectedBeginDate != null && selectedEndDate != null) {
//looks for all blocked fiscal periods
List<FiscalPeriod> blockedFiscalPeriods = new ArrayList<FiscalPeriod>();
try {
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialPeriodComboBox.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialPeriodComboBox.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialPeriodComboBox.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -25,44 +25,45 @@
package org.chorem.lima.ui.financialtransaction;
-import javax.swing.JComboBox;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.entity.FinancialPeriod;
+import javax.swing.JComboBox;
+
public class FinancialPeriodComboBox extends JComboBox {
private static final long serialVersionUID = 1L;
private static final Log log =
- LogFactory.getLog(FinancialPeriodComboBox.class);
-
+ LogFactory.getLog(FinancialPeriodComboBox.class);
+
protected FinancialTransactionViewHandler handler;
-
+
public FinancialPeriodComboBox(FinancialTransactionViewHandler handler) {
this.handler = handler;
}
- public void back(){
- int row = this.getSelectedIndex();
+ public void back() {
+ int row = getSelectedIndex();
log.debug(row);
- if (row > 0){
- this.setSelectedItem(this.getItemAt(row-1));
+ if (row > 0) {
+ setSelectedItem(getItemAt(row - 1));
repaint();
- handler.tableModel.setFinancialPeriod( (FinancialPeriod) this.getSelectedItem());
+ handler.tableModel.setFinancialPeriod((FinancialPeriod) getSelectedItem());
}
}
-
- public void next(){
- int size = this.getModel().getSize();
- int row = this.getSelectedIndex();
+
+ public void next() {
+ int size = getModel().getSize();
+ int row = getSelectedIndex();
log.debug(row);
-
- if (row < size-1){
- this.setSelectedItem(this.getItemAt(row+1));
+
+ if (row < size - 1) {
+ setSelectedItem(getItemAt(row + 1));
repaint();
//FIXME
- handler.tableModel.setFinancialPeriod( (FinancialPeriod) this.getSelectedItem());
+ handler.tableModel.setFinancialPeriod((FinancialPeriod) getSelectedItem());
}
}
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTable.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTable.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTable.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -25,15 +25,6 @@
package org.chorem.lima.ui.financialtransaction;
-import java.awt.Color;
-import java.awt.Component;
-import java.awt.event.KeyEvent;
-import java.awt.event.KeyListener;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-import java.math.BigDecimal;
-import java.util.Date;
-import javax.swing.SwingWorker;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.entity.Account;
@@ -41,21 +32,31 @@
import org.chorem.lima.entity.EntryBook;
import org.chorem.lima.entity.FinancialTransaction;
import org.chorem.lima.ui.celleditor.AccountTableCellEditor;
+import org.chorem.lima.ui.celleditor.BigDecimalTableCellEditor;
import org.chorem.lima.ui.celleditor.BigDecimalTableCellRenderer;
import org.chorem.lima.ui.celleditor.DateTableCellEditor;
import org.chorem.lima.ui.celleditor.EmptyCellRenderer;
import org.chorem.lima.ui.celleditor.EntryBookTableCellEditor;
-import org.chorem.lima.ui.celleditor.BigDecimalTableCellEditor;
import org.jdesktop.swingx.JXTable;
import org.jdesktop.swingx.decorator.ColorHighlighter;
import org.jdesktop.swingx.decorator.ComponentAdapter;
import org.jdesktop.swingx.decorator.HighlightPredicate;
import org.jdesktop.swingx.decorator.Highlighter;
+import javax.swing.SwingWorker;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.math.BigDecimal;
+import java.util.Date;
+
/**
* Table des transaction qui ajoute des comportement (keys).
- *
+ *
* @author jpepin
*/
public class FinancialTransactionTable extends JXTable
@@ -63,7 +64,7 @@
/** serialVersionUID. */
private static final long serialVersionUID = 3133690382049594727L;
-
+
/** log. */
private static final Log log = LogFactory
.getLog(FinancialTransactionTable.class);
@@ -73,17 +74,18 @@
private Highlighter colorTransaction;
private ColorHighlighter colorBalance;
-
+
private int x_tab;
+
private int y_tab;
public FinancialTransactionTable(FinancialTransactionViewHandler handler) {
this.handler = handler;
-
+
addKeyListener(this);
addMouseListener(this);
-
+
//Get new date editor
setDefaultEditor(Date.class, new DateTableCellEditor());
//Get new entry book editor
@@ -100,36 +102,35 @@
setDefaultRenderer(Account.class, new EmptyCellRenderer());
//get new EntryBook renderer for empty cells
setDefaultRenderer(EntryBook.class, new EmptyCellRenderer());
-
+
//highlight financial financial transactions
addColorTransaction();
// highlight unbalanced financial transactions
addColorNonBalancedTransaction();
}
-
+
/**
* Cette méthode permet de colorer toutes les transactions dans le tableau
* afin de bien distinguer les transactions et entrées comptables.
* On récupère la première cellule, on vérifie que c'est une date
*/
- protected void addColorTransaction() {
- if (colorTransaction != null) {
- removeHighlighter(colorTransaction);
- }
- HighlightPredicate predicate = new HighlightPredicate() {
- @Override
- public boolean isHighlighted(Component renderer,
- ComponentAdapter adapter) {
- return adapter.getValueAt(adapter.row, 0) instanceof Date;
- }
- };
+ protected void addColorTransaction() {
+ if (colorTransaction != null) {
+ removeHighlighter(colorTransaction);
+ }
+ HighlightPredicate predicate = new HighlightPredicate() {
+ @Override
+ public boolean isHighlighted(Component renderer,
+ ComponentAdapter adapter) {
+ return adapter.getValueAt(adapter.row, 0) instanceof Date;
+ }
+ };
colorTransaction =
- new ColorHighlighter(predicate, new Color(222,222,222), null);
+ new ColorHighlighter(predicate, new Color(222, 222, 222), null);
addHighlighter(colorTransaction);
}
-
-
+
/**
* Permet de surligner une transaction dans le tableau lorsque
* cette dernière n'est pas équilibrée.
@@ -143,7 +144,7 @@
HighlightPredicate predicate = new HighlightPredicate() {
@Override
public boolean isHighlighted(Component renderer,
- ComponentAdapter adapter) {
+ ComponentAdapter adapter) {
boolean isHighlighted = false;
Object value = adapter.getValueAt(adapter.row, 8);
if (value instanceof BigDecimal) {
@@ -157,8 +158,8 @@
return isHighlighted;
}
};
- colorTransaction =
- new ColorHighlighter(predicate, new Color(255, 198, 209), null);
+ colorTransaction =
+ new ColorHighlighter(predicate, new Color(255, 198, 209), null);
addHighlighter(colorTransaction);
}
@@ -170,51 +171,51 @@
public void keyPressed(KeyEvent e) {
//TODO combinaison de touches dans la config
-
+
// delete selected row with the key : delete or ctrl + clear
// ou de l'entree
- if ((e.getKeyCode() == KeyEvent.VK_DELETE )
- || (e.getKeyCode() == KeyEvent.VK_CLEAR
- && e.getModifiers() == KeyEvent.CTRL_MASK)){
+ if (e.getKeyCode() == KeyEvent.VK_DELETE
+ || e.getKeyCode() == KeyEvent.VK_CLEAR
+ && e.getModifiers() == KeyEvent.CTRL_MASK) {
handler.deleteSelectedRow();
}
// add entry with the key combination : insert or ctrl + enter
- if ((e.getKeyCode() == KeyEvent.VK_INSERT )
- || (e.getKeyCode() == KeyEvent.VK_ENTER
- && e.getModifiers() == KeyEvent.CTRL_MASK)) {
+ if (e.getKeyCode() == KeyEvent.VK_INSERT
+ || e.getKeyCode() == KeyEvent.VK_ENTER
+ && e.getModifiers() == KeyEvent.CTRL_MASK) {
handler.addEmptyEntry();
}
-
+
// copy : ctrl + c
// add financial transaction with the key combination : ctrl + c
- if (e.getKeyCode() == KeyEvent.VK_C
+ if (e.getKeyCode() == KeyEvent.VK_C
&& e.getModifiers() == KeyEvent.CTRL_MASK) {
handler.copyRow();
}
-
+
// paste : ctrl + v
-
+
// add financial transaction with the key combination : ctrl + v
- if (e.getKeyCode() == KeyEvent.VK_V
+ if (e.getKeyCode() == KeyEvent.VK_V
&& e.getModifiers() == KeyEvent.CTRL_MASK) {
handler.pasteRow();
}
-
+
// add financial transaction with the key combination : ctrl + tab
- if (e.getKeyCode() == KeyEvent.VK_TAB
+ if (e.getKeyCode() == KeyEvent.VK_TAB
&& e.getModifiers() == KeyEvent.CTRL_MASK) {
handler.addFinancialTransaction();
}
-
+
// clear row selection with the key: escape
if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
- if (!this.isEditing()) {
- this.clearSelection();
- }
+ if (!isEditing()) {
+ clearSelection();
+ }
}
-
+
/**
* Touche tab
* Incrémente le curseur de case tant que la case n'est pas editable
@@ -222,36 +223,36 @@
* la dernière cellule et si la transaction est non équilibré
* sinon rajoute une transaction
*/
-
+
if (e.getKeyChar() == KeyEvent.VK_TAB) {
- int max_x = this.getColumnCount();
- int max_y = this.getRowCount();
- x_tab = this.getSelectedColumn();
- y_tab = this.getSelectedRow();
+ int max_x = getColumnCount();
+ int max_y = getRowCount();
+ x_tab = getSelectedColumn();
+ y_tab = getSelectedRow();
Boolean end = true;
-
- if (x_tab < max_x - 1){
+
+ if (x_tab < max_x - 1) {
x_tab++;
}
//end of row
else {
- x_tab=0;
+ x_tab = 0;
y_tab++;
}
-
+
//skip all cell while not editable or if end of table add entry or transaction or end of table
- while (!isCellEditable(y_tab, x_tab) && end ){
+ while (!isCellEditable(y_tab, x_tab) && end) {
//if end of row
- if (x_tab == max_x-1) {
- Object object = this.handler.tableModel.getElementAt(y_tab);
-
+ if (x_tab == max_x - 1) {
+ Object object = handler.tableModel.getElementAt(y_tab);
+
//if transaction, add entry
- if (object instanceof FinancialTransaction){
+ if (object instanceof FinancialTransaction) {
FinancialTransaction financialTransaction = (FinancialTransaction) object;
- if (financialTransaction.getEntry().size() == 0){
+ if (financialTransaction.getEntry().size() == 0) {
handler.addEmptyEntry();
- this.setColumnSelectionInterval(1, 1);
- }
+ setColumnSelectionInterval(1, 1);
+ }
}
//if entry
else {
@@ -262,58 +263,58 @@
final JXTable table = this;
final int y_t = y_tab;
final int m_t = max_y;
- new SwingWorker<Void,Void>() {
- @Override protected Void doInBackground() throws InterruptedException {
+ new SwingWorker<Void, Void>() {
+ @Override
+ protected Void doInBackground() throws InterruptedException {
Thread.sleep(500);
return null;
}
- @Override protected void done() {
- Object object = handler.tableModel.getElementAt(y_tab-1);
+
+ @Override
+ protected void done() {
+ Object object = handler.tableModel.getElementAt(y_tab - 1);
FinancialTransaction financialTransaction = null;
- if (object instanceof Entry){
+ if (object instanceof Entry) {
financialTransaction = ((Entry) object).getFinancialTransaction();
- }
- else if (object instanceof FinancialTransaction){
+ } else if (object instanceof FinancialTransaction) {
financialTransaction = (FinancialTransaction) object;
}
BigDecimal amountC = financialTransaction.getAmountCredit();
BigDecimal amountD = financialTransaction.getAmountDebit();
- if (amountC == amountD){
- if (y_t == m_t-1){
+ if (amountC == amountD) {
+ if (y_t == m_t - 1) {
handler.addFinancialTransaction();
table.setColumnSelectionInterval(0, 0);
}
- }
- else {
+ } else {
handler.addEmptyEntry();
table.setColumnSelectionInterval(1, 1);
y_tab++;
// positionne la sélection sur la nouvelle ligne créée
table.setRowSelectionInterval(y_tab, y_tab);
- x_tab=0;
+ x_tab = 0;
}
}
}.execute();
}
end = false;
- }
- else {
- if (x_tab < max_x){
- this.setRowSelectionInterval(y_tab, y_tab);
- this.setColumnSelectionInterval(x_tab, x_tab);
+ } else {
+ if (x_tab < max_x) {
+ setRowSelectionInterval(y_tab, y_tab);
+ setColumnSelectionInterval(x_tab, x_tab);
x_tab++;
}
}
}
}
-
-
+
+
}
@Override
public void keyTyped(KeyEvent e) {
-
+
}
@@ -327,8 +328,8 @@
@Override
public void mousePressed(MouseEvent e) {
- if (this.rowAtPoint(e.getPoint()) == -1) {
- this.clearSelection();
+ if (rowAtPoint(e.getPoint()) == -1) {
+ clearSelection();
}
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTableModel.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTableModel.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -25,15 +25,6 @@
package org.chorem.lima.ui.financialtransaction;
-import static org.nuiton.i18n.I18n._;
-
-import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Collections;
-import java.util.Date;
-import java.util.List;
-import javax.swing.table.AbstractTableModel;
import org.apache.commons.lang.time.DateUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -48,27 +39,37 @@
import org.chorem.lima.entity.EntryBook;
import org.chorem.lima.entity.EntryImpl;
import org.chorem.lima.entity.FinancialPeriod;
+import org.chorem.lima.entity.FinancialTransaction;
import org.chorem.lima.entity.FinancialTransactionImpl;
-import org.chorem.lima.entity.FinancialTransaction;
import org.chorem.lima.entity.Letter;
import org.chorem.lima.service.LimaServiceFactory;
import org.chorem.lima.util.DialogHelper;
import org.chorem.lima.util.ErrorHelper;
+import javax.swing.table.AbstractTableModel;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
+
+import static org.nuiton.i18n.I18n._;
+
/**
* Basic transaction table model.
- *
+ * <p/>
* Le modele est filtré sur {@link #selectedFinancialPeriod} et
* {@link #selectedFinancialPeriod} (montée en charge !).
- *
+ *
* @author ore
* @author chatellier
* @version $Revision$
- *
- * Last update : $Date$
- * By : $Author$
+ * <p/>
+ * Last update : $Date$
+ * By : $Author$
*/
-public class FinancialTransactionTableModel extends AbstractTableModel implements ServiceListener{
+public class FinancialTransactionTableModel extends AbstractTableModel implements ServiceListener {
/** serialVersionUID. */
private static final long serialVersionUID = 1L;
@@ -79,62 +80,76 @@
/** Transaction service. */
protected final FinancialTransactionServiceMonitorable financialTransactionService;
-
+
/** selected financial period */
protected FinancialPeriod selectedFinancialPeriod;
-
+
/** data cache */
protected List<Object> cacheDataList;
-
- /** collection
-
+ protected EntryBook selectedEntryBook;
+
/**
+ * collection
+ * <p/>
+ * <p/>
+ * /**
* Model constructor.
- *
+ * <p/>
* Just init service proxies.
*/
public FinancialTransactionTableModel() {
/* Services */
financialTransactionService =
- LimaServiceFactory.getInstance().getService(
- FinancialTransactionServiceMonitorable.class);
- financialTransactionService.addListener(this);
+ LimaServiceFactory.getInstance().getService(
+ FinancialTransactionServiceMonitorable.class);
+ financialTransactionService.addServiceListener(this);
LimaServiceFactory.getInstance().getService(
- ImportServiceMonitorable.class).addListener(this);
+ ImportServiceMonitorable.class).addServiceListener(this);
}
/**
* Le model est une combinaison de Transaction/Entries.
- *
- *
+ *
* @return
*/
protected List<Object> getDataList() {
List<Object> results = new ArrayList<Object>();
- if (selectedFinancialPeriod != null){
+ if (selectedFinancialPeriod != null) {
try {
- List<FinancialTransaction> financialtransactions =
- financialTransactionService.getAllFinancialTransactionsForFinancialPeriod(
+ List<FinancialTransaction> transactions;
+
+ if (selectedEntryBook == null) {
+
+ // get all transactions for all entry books
+ transactions = financialTransactionService.getAllFinancialTransactionsForFinancialPeriod(
selectedFinancialPeriod);
- for (FinancialTransaction financialtransaction : financialtransactions) {
- results.add(financialtransaction);
- List<Entry> entries = (List<Entry>) financialtransaction.getEntry();
+ } else {
+
+ // get all transactions for selected entry book
+ transactions = financialTransactionService.getAllFinancialTransactionsForEntryBookAndFinancialPeriod(
+ selectedEntryBook,
+ selectedFinancialPeriod
+ );
+ }
+
+ for (FinancialTransaction transaction : transactions) {
+ results.add(transaction);
+ List<Entry> entries = (List<Entry>) transaction.getEntry();
Collections.sort(entries, new EntryComparator());
results.addAll(entries);
}
- }
- catch (LimaException eee) {
+ } catch (LimaException eee) {
if (log.isErrorEnabled()) {
- log.debug("Can't update model", eee);
+ log.error("Can't update model", eee);
}
- ErrorHelper.showErrorDialog("Can't get transaction list", eee);
- }
- }
+ ErrorHelper.showErrorDialog("Can't get transaction list", eee);
+ }
+ }
return results;
}
-
- public void refresh(){
+
+ public void refresh() {
cacheDataList = getDataList();
fireTableDataChanged();
}
@@ -150,72 +165,71 @@
Class<?> result = null;
switch (column) {
- case 0:
- result = Date.class;
- break;
- case 1:
- result = EntryBook.class;
- break;
- case 2:
- result = String.class;
- break;
- case 3:
- result = Account.class;
- break;
- case 4:
- result = String.class;
- break;
- case 5:
- result = Letter.class;
- break;
- case 6:
- result = BigDecimal.class;
- break;
- case 7:
- result = BigDecimal.class;
- break;
- case 8:
- result = BigDecimal.class;
- break;
+ case 0:
+ result = Date.class;
+ break;
+ case 1:
+ result = EntryBook.class;
+ break;
+ case 2:
+ result = String.class;
+ break;
+ case 3:
+ result = Account.class;
+ break;
+ case 4:
+ result = String.class;
+ break;
+ case 5:
+ result = Letter.class;
+ break;
+ case 6:
+ result = BigDecimal.class;
+ break;
+ case 7:
+ result = BigDecimal.class;
+ break;
+ case 8:
+ result = BigDecimal.class;
+ break;
}
return result;
}
-
-
+
@Override
public String getColumnName(int column) {
String result = "n/a";
switch (column) {
- case 0:
- result = _("lima.table.date");
- break;
- case 1:
- result = _("lima.table.entrybook");
- break;
- case 2:
- result = _("lima.table.voucher");
- break;
- case 3:
- result = _("lima.table.account");
- break;
- case 4:
- result = _("lima.table.description");
- break;
- case 5:
- result = _("lima.table.letter");
- break;
- case 6:
- result = _("lima.table.debit");
- break;
- case 7:
- result = _("lima.table.credit");
- break;
- case 8:
- result = _("lima.table.balance");
- break;
+ case 0:
+ result = _("lima.table.date");
+ break;
+ case 1:
+ result = _("lima.table.entrybook");
+ break;
+ case 2:
+ result = _("lima.table.voucher");
+ break;
+ case 3:
+ result = _("lima.table.account");
+ break;
+ case 4:
+ result = _("lima.table.description");
+ break;
+ case 5:
+ result = _("lima.table.letter");
+ break;
+ case 6:
+ result = _("lima.table.debit");
+ break;
+ case 7:
+ result = _("lima.table.credit");
+ break;
+ case 8:
+ result = _("lima.table.balance");
+ break;
}
return result;
@@ -224,7 +238,7 @@
@Override
public int getRowCount() {
int result = 0;
-
+
if (cacheDataList != null) {
result = cacheDataList.size();
}
@@ -235,181 +249,189 @@
@Override
public Object getValueAt(int row, int column) {
Object result = null;
-
+
// just prevent too much result
if (cacheDataList != null) {
result = cacheDataList.get(row);
-
+
if (result instanceof FinancialTransaction) {
- FinancialTransaction currentRow = (FinancialTransaction)result;
+ FinancialTransaction currentRow = (FinancialTransaction) result;
BigDecimal amountDebit = currentRow.getAmountDebit();
BigDecimal amountCredit = currentRow.getAmountCredit();
-
+
switch (column) {
- case 0:
- result = currentRow.getTransactionDate();
- break;
- case 1:
- if (currentRow.getEntryBook() != null){
- result = currentRow.getEntryBook().getCode();
- }
- else {
- result = null;
- }
- break;
- case 2:
- result = null; //voucher
- break;
- case 3:
- result = null; // account
- break;
- case 4:
- result = null; // description
- break;
- case 5 :
- result = null; // letter
- break;
- case 6:
- result = amountDebit;
- break;
- case 7:
- result = amountCredit;
- break;
- case 8:
- result = amountDebit.subtract(amountCredit);
- break;
+ case 0:
+ result = currentRow.getTransactionDate();
+ break;
+ case 1:
+ if (currentRow.getEntryBook() != null) {
+ result = currentRow.getEntryBook().getCode();
+ } else {
+ result = null;
+ }
+ break;
+ case 2:
+ result = null; //voucher
+ break;
+ case 3:
+ result = null; // account
+ break;
+ case 4:
+ result = null; // description
+ break;
+ case 5:
+ result = null; // letter
+ break;
+ case 6:
+ result = amountDebit;
+ break;
+ case 7:
+ result = amountCredit;
+ break;
+ case 8:
+ result = amountDebit.subtract(amountCredit);
+ break;
}
- }
- else if (result instanceof Entry) {
- Entry currentEntry = (Entry)result;
+ } else if (result instanceof Entry) {
+ Entry currentEntry = (Entry) result;
switch (column) {
- case 0:
- result = null; // date
- break;
- case 1 : // entry book
- result = null;
- break;
- case 2:
- result = currentEntry.getVoucher();
- break;
- case 3: // account
- if (currentEntry.getAccount() != null){
- result = currentEntry.getAccount().getAccountNumber();
- }
- else {
+ case 0:
+ result = null; // date
+ break;
+ case 1: // entry book
result = null;
- }
- break;
- case 4:
- result = currentEntry.getDescription();
- break;
- case 5 :
- if (currentEntry.getLetter() != null){
- result = currentEntry.getLetter().getCode();
- }
- else {
+ break;
+ case 2:
+ result = currentEntry.getVoucher();
+ break;
+ case 3: // account
+ if (currentEntry.getAccount() != null) {
+ result = currentEntry.getAccount().getAccountNumber();
+ } else {
+ result = null;
+ }
+ break;
+ case 4:
+ result = currentEntry.getDescription();
+ break;
+ case 5:
+ if (currentEntry.getLetter() != null) {
+ result = currentEntry.getLetter().getCode();
+ } else {
+ result = null;
+ }
+ break;
+ case 6:
+ result = currentEntry.getDebit() ? currentEntry.getAmount() : BigDecimal.ZERO;
+ break;
+ case 7:
+ result = currentEntry.getDebit() ? BigDecimal.ZERO : currentEntry.getAmount();
+ break;
+ case 8:
result = null;
- }
- break;
- case 6:
- result = currentEntry.getDebit() ? currentEntry.getAmount() : BigDecimal.ZERO;
- break;
- case 7:
- result = currentEntry.getDebit() ? BigDecimal.ZERO : currentEntry.getAmount();
- break;
- case 8:
- result = null;
- break;
+ break;
}
-
+
}
}
return result;
}
-
-
- public void setFinancialPeriod(FinancialPeriod financialPeriod){
+
+ public void setFinancialPeriod(FinancialPeriod financialPeriod) {
selectedFinancialPeriod = financialPeriod;
refresh();
}
-
+
+ public void setSelectedEntryBook(EntryBook selectedEntryBook) {
+ this.selectedEntryBook = selectedEntryBook;
+ refresh();
+ }
+
/**
* To set cells editable or not
* different condition for entry or financial transaction
*/
@Override
public boolean isCellEditable(int rowIndex, int columnIndex) {
- boolean editableCell=false;
+ boolean editableCell = false;
Object currentRow = cacheDataList.get(rowIndex);
// cells editable for the entry row, all cells exclude the date
- if ((currentRow instanceof Entry) && !((columnIndex==0) || (columnIndex==1) || (columnIndex==8))) {
- editableCell=true;
+ if (currentRow instanceof Entry && !(columnIndex == 0 || columnIndex == 1 || columnIndex == 8)) {
+ editableCell = true;
}
// cells editable for the financialtransaction row, no cells exclude the date
- if ((currentRow instanceof FinancialTransaction) && ((columnIndex==0) || (columnIndex==1))){
- editableCell=true;
+ if (currentRow instanceof FinancialTransaction && (columnIndex == 0 || columnIndex == 1)) {
+
+// if (selectedEntryBook == null || columnIndex == 0) {
+//
+// // can only edit the transaction entry book only if there is
+// // no entry book selected (otherwise we will loose the transaction
+// editableCell = true;
+// }
+ editableCell = true;
}
return editableCell;
}
-
-
/**
* @return int: indexOf new FianancialTransaction
* @throws LimaException
*/
- public int addFinancialTransaction() throws LimaException{
+ public int addFinancialTransaction() throws LimaException {
/* Calling transaction service */
FinancialTransaction financialTransaction = new FinancialTransactionImpl();
financialTransaction.setAmountDebit(BigDecimal.ZERO);
financialTransaction.setAmountCredit(BigDecimal.ZERO);
//if a period is selected
- if (selectedFinancialPeriod != null){
- financialTransaction.setFinancialPeriod(selectedFinancialPeriod);
- // get today
- Calendar actualCalendar = Calendar.getInstance();
- // get the financial period date
- Date transactionDate = selectedFinancialPeriod.getBeginDate();
-
- Calendar calEnd = Calendar.getInstance();
- calEnd.setTime(selectedFinancialPeriod.getEndDate());
- int dayMax = calEnd.get(Calendar.DAY_OF_MONTH);
- Calendar calBegin = Calendar.getInstance();
- calBegin.setTime(selectedFinancialPeriod.getBeginDate());
- int dayMin = calBegin.get(Calendar.DAY_OF_MONTH);
- int toDay = actualCalendar.get(Calendar.DAY_OF_MONTH);
-
- if ((toDay>dayMax) || (toDay<dayMin)){
- // change the day
- transactionDate = DateUtils.setDays(transactionDate, dayMax);
- }
- else{
- // change the day
- transactionDate = DateUtils.setDays(transactionDate, toDay);
- }
-
+ if (selectedFinancialPeriod == null) {
+ throw new LimaBusinessException("No financial period selected");
+ }
- // set date to the financial transaction
- financialTransaction.setTransactionDate(transactionDate);
- // create it
- FinancialTransaction fTransaction =
- financialTransactionService.createFinancialTransaction(financialTransaction);
+ financialTransaction.setFinancialPeriod(selectedFinancialPeriod);
- //on recharge la liste
- cacheDataList = getDataList();
- int row = cacheDataList.indexOf(fTransaction);
- fireTableRowsInserted(row, row);
- return row;
- //fireTableDataChanged();
+ if (selectedEntryBook != null) {
+ financialTransaction.setEntryBook(selectedEntryBook);
}
- else {
- throw new LimaBusinessException("No financial period selected");
+
+ // get today
+ Calendar actualCalendar = Calendar.getInstance();
+
+ // get the financial period date
+ Date transactionDate = selectedFinancialPeriod.getBeginDate();
+
+ Calendar calEnd = Calendar.getInstance();
+ calEnd.setTime(selectedFinancialPeriod.getEndDate());
+ int dayMax = calEnd.get(Calendar.DAY_OF_MONTH);
+ Calendar calBegin = Calendar.getInstance();
+ calBegin.setTime(selectedFinancialPeriod.getBeginDate());
+ int dayMin = calBegin.get(Calendar.DAY_OF_MONTH);
+ int toDay = actualCalendar.get(Calendar.DAY_OF_MONTH);
+
+ if (toDay > dayMax || toDay < dayMin) {
+ // change the day
+ transactionDate = DateUtils.setDays(transactionDate, dayMax);
+ } else {
+ // change the day
+ transactionDate = DateUtils.setDays(transactionDate, toDay);
}
+
+
+ // set date to the financial transaction
+ financialTransaction.setTransactionDate(transactionDate);
+ // create it
+ FinancialTransaction fTransaction =
+ financialTransactionService.createFinancialTransaction(financialTransaction);
+
+ //on recharge la liste
+ cacheDataList = getDataList();
+ int row = cacheDataList.indexOf(fTransaction);
+ fireTableRowsInserted(row, row);
+ return row;
}
-
+
/**
- *
* @param value
+ * @param voucher
* @param description
* @param row
* @return int: indexOf new Entry
@@ -428,10 +450,9 @@
}
//check if current row is a transaction or an entry
if (currentRow instanceof FinancialTransaction) {
- currentTransaction = (FinancialTransaction)currentRow;
- }
- else if (currentRow instanceof Entry) {
- Entry currentEntry = (Entry)currentRow;
+ currentTransaction = (FinancialTransaction) currentRow;
+ } else if (currentRow instanceof Entry) {
+ Entry currentEntry = (Entry) currentRow;
//get back the parent transaction of the entry
currentTransaction = currentEntry.getFinancialTransaction();
}
@@ -445,9 +466,8 @@
fireTableRowsInserted(newrow, newrow);
return newrow;
}
-
+
/**
- *
* @param value
* @param entry
* @param row
@@ -460,24 +480,23 @@
Object currentRow = cacheDataList.get(row);
//check if current row is a transaction or an entry
if (currentRow instanceof FinancialTransaction) {
- currentTransaction = (FinancialTransaction)currentRow;
+ currentTransaction = (FinancialTransaction) currentRow;
//update the financial transaction in entire
- financialTransactionRow =
- getDataList().indexOf(((FinancialTransaction) currentRow));
- }
- else if (currentRow instanceof Entry) {
- Entry currentEntry = (Entry)currentRow;
+ financialTransactionRow =
+ getDataList().indexOf(currentRow);
+ } else if (currentRow instanceof Entry) {
+ Entry currentEntry = (Entry) currentRow;
//get back the parent transaction of the entry
currentTransaction = currentEntry.getFinancialTransaction();
//update the financial transaction in entire
- financialTransactionRow =
- getDataList().indexOf(((Entry) currentRow).
- getFinancialTransaction());
+ financialTransactionRow =
+ getDataList().indexOf(((Entry) currentRow).
+ getFinancialTransaction());
}
//create it
entry.setFinancialTransaction(currentTransaction);
Entry newEntry = financialTransactionService.createEntry(entry);
- fireTableRowsUpdated(financialTransactionRow, getRowCount()-1);
+ fireTableRowsUpdated(financialTransactionRow, getRowCount() - 1);
//on recharge la liste
cacheDataList = getDataList();
@@ -485,10 +504,8 @@
fireTableRowsInserted(newrow, newrow);
return newrow;
}
-
- /**
- * to modifiy financialtransaction or entry
- */
+
+ /** to modifiy financialtransaction or entry */
@Override
public void setValueAt(Object value, int row, int column) {
int financialTransactionRow = 0;
@@ -496,99 +513,106 @@
Object currentRow = cacheDataList.get(row);
if (currentRow instanceof FinancialTransaction) {
FinancialTransaction currentFinancialTransaction =
- (FinancialTransaction)currentRow;
+ (FinancialTransaction) currentRow;
switch (column) {
- case 0:
- //update
- currentFinancialTransaction.setTransactionDate((Date)value);
- break;
- case 1 :
- currentFinancialTransaction.setEntryBook((EntryBook)value);
- break;
+ case 0:
+ //update
+ currentFinancialTransaction.setTransactionDate((Date) value);
+ break;
+ case 1:
+ if (selectedEntryBook != null) {
+
+ // not authorized to change the value
+ return;
+ }
+ currentFinancialTransaction.setEntryBook((EntryBook) value);
+ break;
}
// notify service for modification
try {
financialTransactionService.
- updateFinancialTransaction(currentFinancialTransaction);
+ updateFinancialTransaction(currentFinancialTransaction);
} catch (LimaException eee) {
- if (log.isDebugEnabled()){
+ if (log.isDebugEnabled()) {
log.debug("Can't update financial transaction", eee);
}
- DialogHelper.showMessageDialog(eee.getMessage());
+ DialogHelper.showMessageDialog(eee.getMessage());
}
- //update the financial transaction in entire
- financialTransactionRow =
- getDataList().indexOf(((FinancialTransaction) currentRow));
- }
- else if (currentRow instanceof Entry) {
- Entry currentEntry = (Entry)currentRow;
+ //update the financial transaction in entire
+ financialTransactionRow =
+ getDataList().indexOf(currentRow);
+ } else if (currentRow instanceof Entry) {
+ Entry currentEntry = (Entry) currentRow;
switch (column) {
- case 2 :
- currentEntry.setVoucher(((String)value).trim());
- break;
- case 3:
- currentEntry.setAccount((Account)value);
- break;
- case 4:
- currentEntry.setDescription(((String)value).trim());
- break;
- case 5 :
- currentEntry.setLetter((Letter)value);
- break;
- case 6:
- currentEntry.setAmount((BigDecimal) value);
- currentEntry.setDebit(true);
- break;
- case 7:
- currentEntry.setAmount((BigDecimal) value);
- currentEntry.setDebit(false);
- break;
+ case 2:
+ currentEntry.setVoucher(((String) value).trim());
+ break;
+ case 3:
+ Account account = (Account) value;
+ currentEntry.setAccount(account);
+ // let's copy the account description
+ currentEntry.setDescription(account.getLabel());
+ break;
+ case 4:
+ currentEntry.setDescription(((String) value).trim());
+ break;
+ case 5:
+ currentEntry.setLetter((Letter) value);
+ break;
+ case 6:
+ currentEntry.setAmount((BigDecimal) value);
+ currentEntry.setDebit(true);
+ break;
+ case 7:
+ currentEntry.setAmount((BigDecimal) value);
+ currentEntry.setDebit(false);
+ break;
}
try {
financialTransactionService.updateEntry(currentEntry);
} catch (LimaException eee) {
- if (log.isDebugEnabled()){
+ if (log.isDebugEnabled()) {
log.debug("Can't update entry", eee);
}
DialogHelper.showMessageDialog(eee.getMessage());
}
//update the financial transaction in entire
- financialTransactionRow =
- getDataList().indexOf(((Entry) currentRow).
- getFinancialTransaction());
+ financialTransactionRow =
+ getDataList().indexOf(((Entry) currentRow).
+ getFinancialTransaction());
}
//on recharge la liste
cacheDataList = getDataList();
- fireTableRowsUpdated(financialTransactionRow, getRowCount()-1);
+ fireTableRowsUpdated(financialTransactionRow, getRowCount() - 1);
}
}
-
- public Object getElementAt(int row){
+
+ public Object getElementAt(int row) {
Object result = null;
- if (cacheDataList != null){
+ if (cacheDataList != null) {
result = cacheDataList.get(row);
}
return result;
}
-
/**
* Delete selected row in table (could be transaction or entry).
- *
+ * <p/>
* Called by model.
- * @param Object, int
- * @throws LimaException
+ *
+ * @param object
+ * @param row
+ * @throws LimaException
*/
public void removeObject(Object object, int row) throws LimaException {
Object currentRow = cacheDataList.get(row);
if (currentRow instanceof FinancialTransaction) {
FinancialTransaction currentTransaction =
- (FinancialTransaction)currentRow;
+ (FinancialTransaction) currentRow;
financialTransactionService.removeFinancialTransaction(currentTransaction);
- }
- else if (currentRow instanceof Entry) {
- Entry currentEntry = (Entry)currentRow;
+ } else if (currentRow instanceof Entry) {
+ Entry currentEntry = (Entry) currentRow;
financialTransactionService.removeEntry(currentEntry);
}
//on recharge la liste
@@ -598,9 +622,11 @@
@Override
public void notifyMethod(String serviceName, String methodeName) {
- if (serviceName.contains("FinancialTransaction") || methodeName.contains("importEntries") || methodeName.contains("importAll")){
+ if (serviceName.contains("FinancialTransaction") ||
+ methodeName.contains("importEntries") ||
+ methodeName.contains("importAll")) {
refresh();
}
}
-
+
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionView.jaxx 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionView.jaxx 2011-09-17 12:59:34 UTC (rev 3291)
@@ -24,87 +24,133 @@
-->
<Table>
- <FinancialTransactionViewHandler id="handler" javaBean="new FinancialTransactionViewHandler(this)" />
- <Boolean id="selectedRow" javaBean="false" />
+ <FinancialTransactionViewHandler id="handler"
+ javaBean="new FinancialTransactionViewHandler(this)"/>
- <script>
+ <import>
+ javax.swing.ListSelectionModel
+ org.chorem.lima.entity.FiscalPeriod
+ org.chorem.lima.entity.FinancialPeriod
+ org.chorem.lima.entity.EntryBook
+ org.chorem.lima.LimaContext
+ org.chorem.lima.ui.combobox.FinancialPeriodComboBoxModel
+ org.chorem.lima.ui.combobox.FiscalPeriodComboBoxModel
+ org.chorem.lima.ui.renderers.RendererUtil
+ </import>
+
+ <Boolean id="selectedRow" javaBean="false"/>
+ <FiscalPeriodComboBoxModel id="modelFiscalPeriod"/>
+ <FinancialPeriodComboBoxModel id="modelFinancialPeriod"/>
+
+ <script>
<![CDATA[
- import org.chorem.lima.entity.FiscalPeriod;
- import org.chorem.lima.entity.FinancialPeriod;
- import org.chorem.lima.ui.financialtransaction.FinancialPeriodComboBox;
- import org.chorem.lima.ui.combobox.FinancialPeriodComboBoxRenderer;
-
void $afterCompleteSetup() {
+ getHandler().initEntryBookModel(entryBookComboBox);
getHandler().refresh();
}
]]>
- </script>
-
- <row weightx="1" weighty="0" anchor="center">
- <cell anchor="east">
- <JLabel id="fiscalPeriodLabel" text="lima.charts.fiscalyear"/>
- </cell>
- <cell anchor="west">
- <org.chorem.lima.ui.combobox.FiscalPeriodComboBoxModel id="modelFiscalPeriod"/>
- <JComboBox id="fiscalPeriodComboBox"
- model="{getModelFiscalPeriod()}"
- renderer="{new org.chorem.lima.ui.combobox.FiscalPeriodComboBoxRenderer()}"
- onActionPerformed="getModelFinancialPeriod().setFiscalPeriod((FiscalPeriod)fiscalPeriodComboBox.getSelectedItem())"
- editable="false"/>
- </cell>
- <cell anchor="east">
- <JLabel id="financialPeriodLabel" text="lima.common.period"
- />
- </cell>
- <cell anchor="west">
- <org.chorem.lima.ui.combobox.FinancialPeriodComboBoxModel id="modelFinancialPeriod"/>
- <FinancialPeriodComboBox id="financialPeriodComboBox"
- constructorParams="getHandler()"
- model="{getModelFinancialPeriod()}" renderer="{new FinancialPeriodComboBoxRenderer()}"
- onActionPerformed="financialTransactionTableModel.setFinancialPeriod((FinancialPeriod)financialPeriodComboBox.getSelectedItem())"/>
- </cell>
- <cell>
- <JButton id="back" text="lima.common.buttonback"
- onActionPerformed="financialPeriodComboBox.back()"/>
- </cell>
- <cell>
- <JButton id="next" text="lima.common.buttonnext"
- onActionPerformed="financialPeriodComboBox.next()"/>
- </cell>
- <cell>
- <JButton text="lima.common.copy"
- onActionPerformed="getHandler().copyRow()" enabled="{isSelectedRow()}"/>
- </cell>
- <cell>
- <JButton text="lima.common.paste"
- onActionPerformed="getHandler().pasteRow()" enabled="{isSelectedRow()}"/>
- </cell>
- <cell>
- <JButton text="lima.entries.addTransaction"
- onActionPerformed="getHandler().addFinancialTransaction()"/>
- </cell>
- <cell>
- <JButton text="lima.entries.addEntry" onActionPerformed="getHandler().addEmptyEntry()" enabled="{isSelectedRow()}"/>
- </cell>
- <cell>
- <JButton text="lima.common.remove"
- onActionPerformed="getHandler().deleteSelectedRow()"
- enabled="{isSelectedRow()}"/>
- </cell>
- </row>
- <row>
- <cell fill="both" weightx="1" weighty="1" rows="3" columns="11">
- <JScrollPane>
- <org.chorem.lima.ui.financialtransaction.FinancialTransactionTableModel
- id="financialTransactionTableModel"/>
- <org.chorem.lima.ui.financialtransaction.FinancialTransactionTable
- id="financialTransactionTable" sortable="false" rowHeight="22"
- constructorParams="getHandler()" model="{getFinancialTransactionTableModel()}"
- selectionMode="{ListSelectionModel.SINGLE_SELECTION}" />
- <javax.swing.ListSelectionModel javaBean="getFinancialTransactionTable().getSelectionModel()"
- onValueChanged="setSelectedRow(financialTransactionTable.getSelectedRow() != -1)"/>
- </JScrollPane>
- </cell>
- </row>
+ </script>
+
+ <row weightx="1" weighty="0" anchor="center">
+ <cell anchor="east">
+ <JLabel id="fiscalPeriodLabel" text="lima.charts.fiscalyear"/>
+ </cell>
+ <cell anchor="west">
+
+ <JComboBox id="fiscalPeriodComboBox"
+ model="{getModelFiscalPeriod()}"
+ renderer="{RendererUtil.newDecoratorListCellRenderer(FiscalPeriod.class)}"
+ onActionPerformed="getModelFinancialPeriod().setFiscalPeriod((FiscalPeriod)fiscalPeriodComboBox.getSelectedItem())"
+ editable="false"/>
+ </cell>
+ <cell anchor="east">
+ <JLabel id="financialPeriodLabel" text="lima.common.period"/>
+ </cell>
+ <cell anchor="west">
+ <JPanel>
+ <FinancialPeriodComboBox id="financialPeriodComboBox"
+ constructorParams="getHandler()"
+ model="{getModelFinancialPeriod()}"
+ renderer="{RendererUtil.newDecoratorListCellRenderer(FinancialPeriod.class)}"
+ onActionPerformed="financialTransactionTableModel.setFinancialPeriod((FinancialPeriod)financialPeriodComboBox.getSelectedItem())"/>
+ <JButton id="back" text="lima.common.buttonback"
+ onActionPerformed="financialPeriodComboBox.back()"/>
+ <JButton id="next" text="lima.common.buttonnext"
+ onActionPerformed="financialPeriodComboBox.next()"/>
+ </JPanel>
+ </cell>
+ <!--cell>
+ <JButton id="back" text="lima.common.buttonback"
+ onActionPerformed="financialPeriodComboBox.back()"/>
+ </cell>
+ <cell>
+ <JButton id="next" text="lima.common.buttonnext"
+ onActionPerformed="financialPeriodComboBox.next()"/>
+ </cell-->
+ <cell anchor="east">
+ <JLabel id="entryBookComboBoxLabel" text="lima.common.entrybook"
+ labelFor='{entryBookComboBox}'/>
+ </cell>
+ <cell anchor="west">
+ <JComboBox id="entryBookComboBox"
+ renderer="{RendererUtil.newDecoratorListCellRenderer(EntryBook.class)}"
+ onActionPerformed="financialTransactionTableModel.setSelectedEntryBook((EntryBook)entryBookComboBox.getSelectedItem())"/>
+ </cell>
+ <!--cell>
+ <JButton text="lima.common.copy" enabled="{isSelectedRow()}"
+ onActionPerformed="getHandler().copyRow()"/>
+ </cell>
+ <cell>
+ <JButton text="lima.common.paste" enabled="{isSelectedRow()}"
+ onActionPerformed="getHandler().pasteRow()"/>
+ </cell>
+ <cell>
+ <JButton text="lima.entries.addTransaction"
+ onActionPerformed="getHandler().addFinancialTransaction()"/>
+ </cell>
+ <cell>
+ <JButton text="lima.entries.addEntry" enabled="{isSelectedRow()}"
+ onActionPerformed="getHandler().addEmptyEntry()"/>
+ </cell>
+ <cell>
+ <JButton text="lima.common.remove" enabled="{isSelectedRow()}"
+ onActionPerformed="getHandler().deleteSelectedRow()"/>
+ </cell-->
+ </row>
+ <row>
+ <cell weightx="1" columns="8">
+ <JToolBar floatable="false">
+ <JPanel layout='{new GridLayout(1,0)}'>
+ <JButton text="lima.common.copy" enabled="{isSelectedRow()}"
+ onActionPerformed="getHandler().copyRow()"/>
+ <JButton text="lima.common.paste" enabled="{isSelectedRow()}"
+ onActionPerformed="getHandler().pasteRow()"/>
+ <JButton text="lima.entries.addTransaction"
+ onActionPerformed="getHandler().addFinancialTransaction()"/>
+ <JButton text="lima.entries.addEntry" enabled="{isSelectedRow()}"
+ onActionPerformed="getHandler().addEmptyEntry()"/>
+ <JButton text="lima.common.remove" enabled="{isSelectedRow()}"
+ onActionPerformed="getHandler().deleteSelectedRow()"/>
+
+ </JPanel>
+ </JToolBar>
+ </cell>
+ </row>
+ <row>
+ <cell fill="both" weightx="1" weighty="1" rows="3" columns="8">
+ <JScrollPane>
+ <FinancialTransactionTableModel
+ id="financialTransactionTableModel"/>
+ <FinancialTransactionTable
+ id="financialTransactionTable" sortable="false" rowHeight="22"
+ constructorParams="getHandler()"
+ model="{getFinancialTransactionTableModel()}"
+ selectionMode="{ListSelectionModel.SINGLE_SELECTION}"/>
+ <ListSelectionModel
+ javaBean="getFinancialTransactionTable().getSelectionModel()"
+ onValueChanged="setSelectedRow(financialTransactionTable.getSelectedRow() != -1)"/>
+ </JScrollPane>
+ </cell>
+ </row>
</Table>
\ No newline at end of file
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionViewHandler.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionViewHandler.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -25,93 +25,114 @@
package org.chorem.lima.ui.financialtransaction;
-import static org.nuiton.i18n.I18n._;
-
-
-import javax.swing.JOptionPane;
-import javax.swing.ListSelectionModel;
-
+import jaxx.runtime.SwingUtil;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.chorem.lima.business.EntryBookServiceMonitorable;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.entity.Entry;
+import org.chorem.lima.entity.EntryBook;
import org.chorem.lima.entity.FinancialTransaction;
+import org.chorem.lima.service.LimaServiceFactory;
import org.chorem.lima.ui.combobox.FinancialPeriodComboBoxModel;
import org.chorem.lima.ui.combobox.FiscalPeriodComboBoxModel;
-import org.chorem.lima.ui.financialtransaction.FinancialTransactionView;
import org.chorem.lima.util.DialogHelper;
+import org.chorem.lima.util.ErrorHelper;
+import javax.swing.JComboBox;
+import javax.swing.JOptionPane;
+import javax.swing.ListSelectionModel;
+import java.util.List;
+
+import static org.nuiton.i18n.I18n._;
+
/**
* Handler associated with financial transaction view.
- *
+ *
* @author chatellier
* @version $Revision$
- *
- * Last update : $Date$
- * By : $Author$
+ * <p/>
+ * Last update : $Date$
+ * By : $Author$
*/
public class FinancialTransactionViewHandler {
/** log. */
private static final Log log =
- LogFactory.getLog(FinancialTransactionViewHandler.class);
+ LogFactory.getLog(FinancialTransactionViewHandler.class);
protected FinancialTransactionView view;
-
+
protected FinancialTransactionTable table;
-
+
protected FinancialTransactionTableModel tableModel;
-
+
protected FiscalPeriodComboBoxModel fiscalPeriodComboBoxModel;
-
+
protected FinancialPeriodComboBoxModel financialPeriodComboBoxModel;
-
+
protected Object clipBoard;
protected FinancialTransactionViewHandler(FinancialTransactionView view) {
this.view = view;
- }
-
- //copy entry
- public void copyRow(){
+ }
+
+ public void initEntryBookModel(JComboBox comboBox) {
+ EntryBookServiceMonitorable service =
+ LimaServiceFactory.getInstance().getService(
+ EntryBookServiceMonitorable.class);
+ try {
+ List<EntryBook> allEntryBooks = service.getAllEntryBooks();
+ allEntryBooks.add(0, null);
+ SwingUtil.fillComboBox(comboBox, allEntryBooks, null);
+ } catch (LimaException e) {
+ ErrorHelper.showErrorDialog(view, e.getMessage(), e.getCause());
+ }
+ }
+
+ //copy entry
+ public void copyRow() {
table = view.getFinancialTransactionTable();
int indexSelectedRow = table.getSelectedRow();
-
+
if (indexSelectedRow != -1) {
clipBoard = tableModel.getElementAt(indexSelectedRow);
}
}
-
+
//paste entry
- public void pasteRow(){
+ public void pasteRow() {
table = view.getFinancialTransactionTable();
int indexSelectedRow = table.getSelectedRow();
-
+
if (indexSelectedRow != -1) {
Object selectedValue = tableModel.getElementAt(indexSelectedRow);
if (clipBoard instanceof Entry) {
try {
- int index = tableModel.addEntry(selectedValue, (Entry) clipBoard, indexSelectedRow);
+ int index = tableModel.addEntry(selectedValue,
+ (Entry) clipBoard,
+ indexSelectedRow
+ );
//select the new line
- ListSelectionModel selectionModel =
- table.getSelectionModel();
- selectionModel.setSelectionInterval(
- indexSelectedRow+1, indexSelectedRow+1);
- //focus on second column
- table.changeSelection(index, 1, false, false);
- table.requestFocusInWindow();
- } catch (LimaException eee){
+ ListSelectionModel selectionModel =
+ table.getSelectionModel();
+ selectionModel.setSelectionInterval(
+ indexSelectedRow + 1, indexSelectedRow + 1);
+ //focus on second column
+ table.changeSelection(index, 1, false, false);
+ table.requestFocusInWindow();
+ } catch (LimaException eee) {
if (log.isErrorEnabled()) {
log.error("Can't past entry", eee);
}
- DialogHelper.showMessageDialog(eee.getMessage());
+ DialogHelper.showErrorMessageDialog(view, eee);
}
}
}
-
+
}
-
+
//add a new transaction
public void addFinancialTransaction() {
table = view.getFinancialTransactionTable();
@@ -121,24 +142,25 @@
int index = tableModel.addFinancialTransaction();
//select the new line
int numberRow = table.getRowCount();
- ListSelectionModel selectionModel =
- table.getSelectionModel();
- selectionModel.setSelectionInterval(numberRow-1, numberRow-1);
+ ListSelectionModel selectionModel =
+ table.getSelectionModel();
+ selectionModel.setSelectionInterval(numberRow - 1, numberRow - 1);
//focus on first column
table.changeSelection(index, 0, false, false);
table.requestFocusInWindow();
+ table.scrollCellToVisible(index, 0);
} catch (LimaException eee) {
if (log.isErrorEnabled()) {
log.error("Can't add financialtransaction", eee);
}
- DialogHelper.showMessageDialog(eee.getMessage());
+ DialogHelper.showErrorMessageDialog(view, eee);
}
}
-
+
//implement new transaction button
//add a new entry to the selected transaction
- public void addEmptyEntry(){
-
+ public void addEmptyEntry() {
+
table = view.getFinancialTransactionTable();
tableModel = view.getFinancialTransactionTableModel();
@@ -147,38 +169,42 @@
Object selectedValue = tableModel.getElementAt(indexSelectedRow);
try {
//copy + paste the voucher and the description
- String voucher = (String) tableModel.getValueAt(indexSelectedRow, 2);
- String description = (String) tableModel.getValueAt(indexSelectedRow, 4);
- int index = tableModel.addEmptyEntry(selectedValue, voucher, description, indexSelectedRow);
+ String voucher = (String)
+ tableModel.getValueAt(indexSelectedRow, 2);
+ String description = (String)
+ tableModel.getValueAt(indexSelectedRow, 4);
+ int index = tableModel.addEmptyEntry(selectedValue,
+ voucher,
+ description,
+ indexSelectedRow
+ );
//select the new line
- ListSelectionModel selectionModel =
- table.getSelectionModel();
- selectionModel.setSelectionInterval(
- indexSelectedRow+1, indexSelectedRow+1);
- //focus on second column
- table.changeSelection(index, 1, false, false);
- table.requestFocusInWindow();
- } catch (LimaException eee){
+ ListSelectionModel selectionModel =
+ table.getSelectionModel();
+ selectionModel.setSelectionInterval(
+ indexSelectedRow + 1, indexSelectedRow + 1);
+ //focus on second column
+ table.changeSelection(index, 1, false, false);
+ table.requestFocusInWindow();
+ } catch (LimaException eee) {
if (log.isErrorEnabled()) {
log.error("Can't add emptyentry", eee);
}
- DialogHelper.showMessageDialog(eee.getMessage());
+ DialogHelper.showErrorMessageDialog(view, eee);
}
- }
- else {
+ } else {
if (log.isWarnEnabled()) {
log.warn("Call addentry selected transaction without selection");
}
}
}
-
+
/**
* Delete selected row in table (could be transaction or entry).
- *
+ * <p/>
* Called by model.
- * @throws LimaException
*/
- public void deleteSelectedRow(){
+ public void deleteSelectedRow() {
table = view.getFinancialTransactionTable();
tableModel = view.getFinancialTransactionTableModel();
@@ -187,47 +213,46 @@
if (indexSelectedRow != -1) {
Object selectedValue = tableModel.getElementAt(indexSelectedRow);
- String message = null;
+ String message;
if (selectedValue instanceof FinancialTransaction) {
message = _("lima.charts.financialtransaction.question.removetransaction");
- }
- else {
+ } else {
message = _("lima.charts.financialtransaction.question.removeentry");
}
- int response = JOptionPane.showConfirmDialog(view, message,
+ int response = JOptionPane.showConfirmDialog(
+ view, message,
_("lima.common.confirmation"), JOptionPane.YES_NO_OPTION);
if (response == JOptionPane.YES_OPTION) {
-
+
try {
tableModel.removeObject(selectedValue, indexSelectedRow);
//select the upper line
- ListSelectionModel selectionModel =
- table.getSelectionModel();
+ ListSelectionModel selectionModel =
+ table.getSelectionModel();
selectionModel.setSelectionInterval(
- indexSelectedRow-1, indexSelectedRow-1);
+ indexSelectedRow - 1, indexSelectedRow - 1);
} catch (LimaException eee) {
if (log.isErrorEnabled()) {
log.error("Can't remove transaction or entry", eee);
}
- DialogHelper.showMessageDialog(eee.getMessage());
+ DialogHelper.showErrorMessageDialog(view, eee);
}
}
- }
- else {
+ } else {
if (log.isWarnEnabled()) {
log.warn("Call delete selected row without selection");
}
}
}
-
- public void refresh(){
+
+ public void refresh() {
tableModel = view.getFinancialTransactionTableModel();
- tableModel.refresh();
+ tableModel.refresh();
fiscalPeriodComboBoxModel = view.getModelFiscalPeriod();
fiscalPeriodComboBoxModel.refresh();
-
+
financialPeriodComboBoxModel = view.getModelFinancialPeriod();
financialPeriodComboBoxModel.refresh();
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/AccountSearchComboBox.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/AccountSearchComboBox.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/AccountSearchComboBox.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -25,11 +25,6 @@
package org.chorem.lima.ui.financialtransactionsearch;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.KeyEvent;
-import java.awt.event.KeyListener;
-import javax.swing.JComboBox;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.entity.Account;
@@ -38,15 +33,20 @@
import org.chorem.lima.util.AccountToString;
import org.jdesktop.swingx.autocomplete.AutoCompleteDecorator;
-public class AccountSearchComboBox extends JComboBox implements KeyListener, ActionListener {
+import javax.swing.JComboBox;
+import java.awt.event.ActionEvent;
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
+public class AccountSearchComboBox extends JComboBox implements KeyListener {
+
private static final long serialVersionUID = 1L;
private static final Log log =
- LogFactory.getLog(AccountSearchComboBox.class);
-
+ LogFactory.getLog(AccountSearchComboBox.class);
+
protected FinancialTransactionSearchViewHandler handler;
-
+
public AccountSearchComboBox(FinancialTransactionSearchViewHandler handler) {
this.handler = handler;
AccountComboBoxModel accountComboBoxModel = new AccountComboBoxModel();
@@ -55,48 +55,45 @@
setRenderer(accountRenderer);
setEditable(true);
AutoCompleteDecorator.decorate(this, AccountToString.getInstance());
- this.getEditor().getEditorComponent().addKeyListener(this);
- this.addActionListener(this);
+ getEditor().getEditorComponent().addKeyListener(this);
+ addActionListener(this);
}
-
-
+
@Override
public void actionPerformed(ActionEvent e) {
- Object object = this.getSelectedItem();
- if (object instanceof Account){
- handler.setAccount((Account) this.getSelectedItem());
+ Object object = getSelectedItem();
+ if (object instanceof Account) {
+ handler.setAccount((Account) getSelectedItem());
}
}
-
@Override
public void keyPressed(KeyEvent e) {
-
+
}
@Override
public void keyReleased(KeyEvent e) {
- Object object = this.getSelectedItem();
- if (object instanceof Account){
- Account account = (Account) this.getSelectedItem();
+ Object object = getSelectedItem();
+ if (object instanceof Account) {
+ Account account = (Account) getSelectedItem();
//to prevent useless call to service
- if (!account.equals(handler.getAccount())){
+ if (!account.equals(handler.getAccount())) {
handler.setAccount(account);
}
}
-
+
// delegate popup list menu
- if ( e.getKeyChar() == KeyEvent.VK_ENTER )
- {
+ if (e.getKeyChar() == KeyEvent.VK_ENTER) {
firePopupMenuCanceled();
}
}
@Override
public void keyTyped(KeyEvent e) {
-
+
}
-
+
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/AccountSearchPanel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/AccountSearchPanel.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/AccountSearchPanel.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -25,72 +25,72 @@
package org.chorem.lima.ui.financialtransactionsearch;
-import static org.nuiton.i18n.I18n._;
-import java.awt.event.KeyEvent;
-import java.awt.event.KeyListener;
-import javax.swing.JPanel;
-import javax.swing.JTextField;
import org.chorem.lima.entity.Account;
import org.chorem.lima.enums.ComboBoxAccountsEnum;
+import javax.swing.JPanel;
+import javax.swing.JTextField;
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
+
+import static org.nuiton.i18n.I18n._;
+
public class AccountSearchPanel extends JPanel {
-
+
protected FinancialTransactionSearchViewHandler handler;
-
+
public AccountSearchPanel(FinancialTransactionSearchViewHandler handler) {
this.handler = handler;
}
-
- static final long serialVersionUID = 1L;
- public void refresh(ComboBoxAccountsEnum comboBoxAccountsEnum){
-
+ public void refresh(ComboBoxAccountsEnum comboBoxAccountsEnum) {
+
switch (comboBoxAccountsEnum) {
- case ALL:
- handler.setAccount(null);
- handler.refresh();
- this.removeAll();
- break;
-
- case ACCOUNT:
- final AccountSearchComboBox accountComboBox = new AccountSearchComboBox(handler);
- handler.setAccount((Account) accountComboBox.getSelectedItem());
- handler.refresh();
- this.removeAll();
- this.add(accountComboBox);
- break;
-
- case ACCOUNT_LIST:
- final JTextField accountsList = new JTextField(16);
- accountsList.setMinimumSize(accountsList.getPreferredSize());
- accountsList.setToolTipText(_("lima.tooltip.filter"));
- KeyListener accountsListKeyListener = new KeyListener() {
-
- @Override
- public void keyTyped(KeyEvent e) {
- }
-
- @Override
- public void keyReleased(KeyEvent e) {
- String accounts = accountsList.getText();
- //to prevent useless call to service
- if (!accounts.equals(handler.getAccountsList())){
- handler.setAccountsList(accounts);
+ case ALL:
+ handler.setAccount(null);
+ handler.refresh();
+ removeAll();
+ break;
+
+ case ACCOUNT:
+ AccountSearchComboBox accountComboBox = new AccountSearchComboBox(handler);
+ handler.setAccount((Account) accountComboBox.getSelectedItem());
+ handler.refresh();
+ removeAll();
+ add(accountComboBox);
+ break;
+
+ case ACCOUNT_LIST:
+ final JTextField accountsList = new JTextField(16);
+ accountsList.setMinimumSize(accountsList.getPreferredSize());
+ accountsList.setToolTipText(_("lima.tooltip.filter"));
+ KeyListener accountsListKeyListener = new KeyListener() {
+
+ @Override
+ public void keyTyped(KeyEvent e) {
}
- }
-
- @Override
- public void keyPressed(KeyEvent e) {
- }
- };
- accountsList.addKeyListener(accountsListKeyListener);
- handler.setAccountsList(accountsList.getText());
- handler.setAccount(null);
- this.removeAll();
- this.add(accountsList);
- break;
+
+ @Override
+ public void keyReleased(KeyEvent e) {
+ String accounts = accountsList.getText();
+ //to prevent useless call to service
+ if (!accounts.equals(handler.getAccountsList())) {
+ handler.setAccountsList(accounts);
+ }
+ }
+
+ @Override
+ public void keyPressed(KeyEvent e) {
+ }
+ };
+ accountsList.addKeyListener(accountsListKeyListener);
+ handler.setAccountsList(accountsList.getText());
+ handler.setAccount(null);
+ removeAll();
+ add(accountsList);
+ break;
}
-
+
}
-
+
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/AmountSearchPanel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/AmountSearchPanel.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/AmountSearchPanel.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -25,83 +25,84 @@
package org.chorem.lima.ui.financialtransactionsearch;
+import org.chorem.lima.enums.ComboBoxOperatorsEnum;
+
+import javax.swing.JPanel;
+import javax.swing.JTextField;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
-import javax.swing.JPanel;
-import javax.swing.JTextField;
-import org.chorem.lima.enums.ComboBoxOperatorsEnum;
public class AmountSearchPanel extends JPanel {
-
+
protected FinancialTransactionSearchViewHandler handler;
-
+
public AmountSearchPanel(FinancialTransactionSearchViewHandler handler) {
this.handler = handler;
refresh(ComboBoxOperatorsEnum.EQUAL);
}
-
+
static final long serialVersionUID = 1L;
- public void refresh(ComboBoxOperatorsEnum enums){
-
+ public void refresh(ComboBoxOperatorsEnum enums) {
+
final JTextField amountTextField = new JTextField(16);
amountTextField.setMinimumSize(amountTextField.getPreferredSize());
KeyListener amountKeyListener = new KeyListener() {
-
+
@Override
- public void keyTyped(KeyEvent e) {
+ public void keyTyped(KeyEvent e) {
}
-
+
@Override
public void keyReleased(KeyEvent e) {
String amount = amountTextField.getText();
//to prevent useless call to service
- if (!amount.equals(handler.getAmount())){
+ if (!amount.equals(handler.getAmount())) {
handler.setAmount(amount);
}
}
-
+
@Override
- public void keyPressed(KeyEvent e) {
+ public void keyPressed(KeyEvent e) {
}
};
amountTextField.addKeyListener(amountKeyListener);
handler.setAmount2("");
handler.setOperator(enums.getSymbol());
handler.refresh();
- this.removeAll();
- this.add(amountTextField);
-
+ removeAll();
+ add(amountTextField);
+
switch (enums) {
- case INTERVAL:
- final JTextField amount2TextField = new JTextField(16);
- amount2TextField.setMinimumSize(amount2TextField.getPreferredSize());
- KeyListener amount2KeyListener = new KeyListener() {
-
- @Override
- public void keyTyped(KeyEvent e) {
- }
-
- @Override
- public void keyReleased(KeyEvent e) {
-
- String amount2 = amount2TextField.getText();
- //to prevent useless call to service
- if (!amount2.equals(handler.getAmount2())){
- handler.setAmount2(amount2);
+ case INTERVAL:
+ final JTextField amount2TextField = new JTextField(16);
+ amount2TextField.setMinimumSize(amount2TextField.getPreferredSize());
+ KeyListener amount2KeyListener = new KeyListener() {
+
+ @Override
+ public void keyTyped(KeyEvent e) {
}
- }
-
- @Override
- public void keyPressed(KeyEvent e) {
- }
- };
- amount2TextField.addKeyListener(amount2KeyListener);
- handler.setAmount("");
- this.add(amount2TextField);
- break;
+
+ @Override
+ public void keyReleased(KeyEvent e) {
+
+ String amount2 = amount2TextField.getText();
+ //to prevent useless call to service
+ if (!amount2.equals(handler.getAmount2())) {
+ handler.setAmount2(amount2);
+ }
+ }
+
+ @Override
+ public void keyPressed(KeyEvent e) {
+ }
+ };
+ amount2TextField.addKeyListener(amount2KeyListener);
+ handler.setAmount("");
+ add(amount2TextField);
+ break;
}
- amountTextField.setText(handler.getAmount());
+ amountTextField.setText(handler.getAmount());
}
-
+
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/EntryBookSearchComboBox.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/EntryBookSearchComboBox.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/EntryBookSearchComboBox.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -25,11 +25,6 @@
package org.chorem.lima.ui.financialtransactionsearch;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.KeyEvent;
-import java.awt.event.KeyListener;
-import javax.swing.JComboBox;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.entity.EntryBook;
@@ -38,15 +33,20 @@
import org.chorem.lima.util.EntryBookToString;
import org.jdesktop.swingx.autocomplete.AutoCompleteDecorator;
-public class EntryBookSearchComboBox extends JComboBox implements KeyListener, ActionListener {
+import javax.swing.JComboBox;
+import java.awt.event.ActionEvent;
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
+public class EntryBookSearchComboBox extends JComboBox implements KeyListener {
+
private static final long serialVersionUID = 1L;
private static final Log log =
- LogFactory.getLog(EntryBookSearchComboBox.class);
-
+ LogFactory.getLog(EntryBookSearchComboBox.class);
+
protected FinancialTransactionSearchViewHandler handler;
-
+
public EntryBookSearchComboBox(FinancialTransactionSearchViewHandler handler) {
this.handler = handler;
EntryBookComboBoxModel entryBookComboBoxModel = new EntryBookComboBoxModel();
@@ -55,42 +55,40 @@
setRenderer(entryBookRenderer);
setEditable(true);
AutoCompleteDecorator.decorate(this, EntryBookToString.getInstance());
- this.getEditor().getEditorComponent().addKeyListener(this);
- this.addActionListener(this);
+ getEditor().getEditorComponent().addKeyListener(this);
+ addActionListener(this);
}
-
-
+
@Override
public void actionPerformed(ActionEvent e) {
- Object object = this.getSelectedItem();
- if (object instanceof EntryBook){
- handler.setEntryBook((EntryBook) this.getSelectedItem());
+ Object object = getSelectedItem();
+ if (object instanceof EntryBook) {
+ handler.setEntryBook((EntryBook) getSelectedItem());
}
}
@Override
public void keyPressed(KeyEvent e) {
-
+
}
@Override
public void keyReleased(KeyEvent e) {
- Object object = this.getSelectedItem();
- if (object instanceof EntryBook){
- handler.setEntryBook((EntryBook) this.getSelectedItem());
+ Object object = getSelectedItem();
+ if (object instanceof EntryBook) {
+ handler.setEntryBook((EntryBook) getSelectedItem());
}
// delegate popup list menu
- if ( e.getKeyChar() == KeyEvent.VK_ENTER )
- {
+ if (e.getKeyChar() == KeyEvent.VK_ENTER) {
firePopupMenuCanceled();
}
}
@Override
public void keyTyped(KeyEvent e) {
-
+
}
-
+
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/EntryBookSearchPanel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/EntryBookSearchPanel.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/EntryBookSearchPanel.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -25,35 +25,34 @@
package org.chorem.lima.ui.financialtransactionsearch;
-import javax.swing.JPanel;
import org.chorem.lima.enums.ComboBoxEntryBooksEnum;
+import javax.swing.JPanel;
+
public class EntryBookSearchPanel extends JPanel {
-
+
protected FinancialTransactionSearchViewHandler handler;
-
+
public EntryBookSearchPanel(FinancialTransactionSearchViewHandler handler) {
this.handler = handler;
}
-
- static final long serialVersionUID = 1L;
- public void refresh(ComboBoxEntryBooksEnum enums){
-
+ public void refresh(ComboBoxEntryBooksEnum enums) {
+
switch (enums) {
- case SELECT_ONE:
- EntryBookSearchComboBox entryBookSearchComboBox = new EntryBookSearchComboBox(handler);
- handler.setEntryBook(null);
- this.removeAll();
- this.add(entryBookSearchComboBox);
- break;
-
- case ALL:
- handler.setEntryBook(null);
- this.removeAll();
- break;
+ case SELECT_ONE:
+ EntryBookSearchComboBox entryBookSearchComboBox = new EntryBookSearchComboBox(handler);
+ handler.setEntryBook(null);
+ removeAll();
+ add(entryBookSearchComboBox);
+ break;
+
+ case ALL:
+ handler.setEntryBook(null);
+ removeAll();
+ break;
}
-
+
}
-
+
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionPeriodSearchPanel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionPeriodSearchPanel.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionPeriodSearchPanel.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -25,15 +25,6 @@
package org.chorem.lima.ui.financialtransactionsearch;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.util.Calendar;
-import java.util.Date;
-import static org.nuiton.i18n.I18n._;
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-
import org.apache.commons.lang.time.DateUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -46,131 +37,139 @@
import org.chorem.lima.ui.combobox.FiscalPeriodComboBoxRenderer;
import org.jdesktop.swingx.JXDatePicker;
+import javax.swing.JComboBox;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.Calendar;
+import java.util.Date;
+
+import static org.nuiton.i18n.I18n._;
+
public class FinancialTransactionPeriodSearchPanel extends JPanel {
-
+
private static final Log log =
- LogFactory.getLog(FinancialTransactionPeriodSearchPanel.class);
-
+ LogFactory.getLog(FinancialTransactionPeriodSearchPanel.class);
+
protected FinancialTransactionSearchViewHandler handler;
-
+
public FinancialTransactionPeriodSearchPanel(FinancialTransactionSearchViewHandler handler) {
this.handler = handler;
-
+
//init date
refresh(ComboBoxPeriodEnum.PERIOD);
}
-
- static final long serialVersionUID = 1L;
- public void refresh(ComboBoxPeriodEnum comboBoxPeriodEnum){
-
+ public void refresh(ComboBoxPeriodEnum comboBoxPeriodEnum) {
+
switch (comboBoxPeriodEnum) {
- case DATE:
- Calendar calendar = Calendar.getInstance();
- Date date = calendar.getTime();
- date = DateUtils.truncate(date, Calendar.DATE);
- final JXDatePicker datePicker = new JXDatePicker(date);
- ActionListener dateActionListener = new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- handler.setBeginDate(datePicker.getDate());
- handler.refresh();
- }
- };
- handler.setBeginDate(datePicker.getDate());
- handler.setEndDate(null);
- handler.refresh();
- datePicker.addActionListener(dateActionListener);
- this.removeAll();
- this.add(datePicker);
- break;
-
- case PERIOD:
- // get begin date
- Calendar calendarBegin = Calendar.getInstance();
- // set begindate to JAN 1 - 0:00.000 of this years
- Date beginDate = calendarBegin.getTime();
- beginDate = DateUtils.truncate(beginDate, Calendar.YEAR);
- //handler().setBeginDate(beginDate);
-
- // get end date
- Calendar calendarEnd = Calendar.getInstance();
- Date endDate = calendarEnd.getTime();
- //handler().setEndDate(endDate);
- JLabel beginDateLabel = new JLabel(_("lima.common.begindate"));
- final JXDatePicker beginDatePicker = new JXDatePicker(beginDate);
- ActionListener beginDateActionListener = new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- handler.setBeginDate(beginDatePicker.getDate());
- handler.refresh();
- }
- };
- handler.setBeginDate(beginDatePicker.getDate());
- beginDatePicker.addActionListener(beginDateActionListener);
-
- JLabel endDateLabel = new JLabel(_("lima.common.enddate"));
- final JXDatePicker endDatePicker = new JXDatePicker(endDate);
- ActionListener endDateActionListener = new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- handler.setEndDate(endDatePicker.getDate());
- handler.refresh();
- }
- };
- handler.setEndDate(endDatePicker.getDate());
- endDatePicker.addActionListener(endDateActionListener);
- handler.refresh();
-
- this.removeAll();
- this.add(beginDateLabel);
- this.add(beginDatePicker);
- this.add(endDateLabel);
- this.add(endDatePicker);
- break;
-
- case FISCAL_PERIOD:
- FiscalPeriodComboBoxModel fiscalModel = new FiscalPeriodComboBoxModel();
- FiscalPeriodComboBoxRenderer fiscalRenderer = new FiscalPeriodComboBoxRenderer();
- final JComboBox fiscalPeriod = new JComboBox(fiscalModel);
- fiscalPeriod.setRenderer(fiscalRenderer);
- fiscalPeriod.setEditable(false);
- ActionListener fiscalPeriodActionListener = new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- FiscalPeriod fPeriod = (FiscalPeriod) fiscalPeriod.getSelectedItem();
- handler.setBeginDate(fPeriod.getBeginDate());
- handler.setEndDate(fPeriod.getEndDate());
- handler.refresh();
- }
- };
- fiscalPeriod.addActionListener(fiscalPeriodActionListener);
+ case DATE:
+ Calendar calendar = Calendar.getInstance();
+ Date date = calendar.getTime();
+ date = DateUtils.truncate(date, Calendar.DATE);
+ final JXDatePicker datePicker = new JXDatePicker(date);
+ ActionListener dateActionListener = new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ handler.setBeginDate(datePicker.getDate());
+ handler.refresh();
+ }
+ };
+ handler.setBeginDate(datePicker.getDate());
+ handler.setEndDate(null);
+ handler.refresh();
+ datePicker.addActionListener(dateActionListener);
+ removeAll();
+ add(datePicker);
+ break;
- this.removeAll();
- this.add(fiscalPeriod);
- break;
-
- case FINANCIAL_PERIOD:
- FinancialPeriodComboBoxModel financialModel = new FinancialPeriodComboBoxModel();
- FinancialPeriodComboBoxRenderer financialRenderer = new FinancialPeriodComboBoxRenderer();
- final JComboBox financialPeriod = new JComboBox(financialModel);
- financialPeriod.setRenderer(financialRenderer);
- financialPeriod.setEditable(false);
- ActionListener financialPeriodActionListener = new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- FinancialPeriod fPeriod = (FinancialPeriod) financialPeriod.getSelectedItem();
- handler.setBeginDate(fPeriod.getBeginDate());
- handler.setEndDate(fPeriod.getEndDate());
- handler.refresh();
- }
- };
- financialPeriod.addActionListener(financialPeriodActionListener);
- this.removeAll();
- this.add(financialPeriod);
- break;
+ case PERIOD:
+ // get begin date
+ Calendar calendarBegin = Calendar.getInstance();
+ // set begindate to JAN 1 - 0:00.000 of this years
+ Date beginDate = calendarBegin.getTime();
+ beginDate = DateUtils.truncate(beginDate, Calendar.YEAR);
+ //handler().setBeginDate(beginDate);
+
+ // get end date
+ Calendar calendarEnd = Calendar.getInstance();
+ Date endDate = calendarEnd.getTime();
+ //handler().setEndDate(endDate);
+ JLabel beginDateLabel = new JLabel(_("lima.common.begindate"));
+ final JXDatePicker beginDatePicker = new JXDatePicker(beginDate);
+ ActionListener beginDateActionListener = new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ handler.setBeginDate(beginDatePicker.getDate());
+ handler.refresh();
+ }
+ };
+ handler.setBeginDate(beginDatePicker.getDate());
+ beginDatePicker.addActionListener(beginDateActionListener);
+
+ JLabel endDateLabel = new JLabel(_("lima.common.enddate"));
+ final JXDatePicker endDatePicker = new JXDatePicker(endDate);
+ ActionListener endDateActionListener = new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ handler.setEndDate(endDatePicker.getDate());
+ handler.refresh();
+ }
+ };
+ handler.setEndDate(endDatePicker.getDate());
+ endDatePicker.addActionListener(endDateActionListener);
+ handler.refresh();
+
+ removeAll();
+ add(beginDateLabel);
+ add(beginDatePicker);
+ add(endDateLabel);
+ add(endDatePicker);
+ break;
+
+ case FISCAL_PERIOD:
+ FiscalPeriodComboBoxModel fiscalModel = new FiscalPeriodComboBoxModel();
+ FiscalPeriodComboBoxRenderer fiscalRenderer = new FiscalPeriodComboBoxRenderer();
+ final JComboBox fiscalPeriod = new JComboBox(fiscalModel);
+ fiscalPeriod.setRenderer(fiscalRenderer);
+ fiscalPeriod.setEditable(false);
+ ActionListener fiscalPeriodActionListener = new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ FiscalPeriod fPeriod = (FiscalPeriod) fiscalPeriod.getSelectedItem();
+ handler.setBeginDate(fPeriod.getBeginDate());
+ handler.setEndDate(fPeriod.getEndDate());
+ handler.refresh();
+ }
+ };
+ fiscalPeriod.addActionListener(fiscalPeriodActionListener);
+
+ removeAll();
+ add(fiscalPeriod);
+ break;
+
+ case FINANCIAL_PERIOD:
+ FinancialPeriodComboBoxModel financialModel = new FinancialPeriodComboBoxModel();
+ FinancialPeriodComboBoxRenderer financialRenderer = new FinancialPeriodComboBoxRenderer();
+ final JComboBox financialPeriod = new JComboBox(financialModel);
+ financialPeriod.setRenderer(financialRenderer);
+ financialPeriod.setEditable(false);
+ ActionListener financialPeriodActionListener = new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ FinancialPeriod fPeriod = (FinancialPeriod) financialPeriod.getSelectedItem();
+ handler.setBeginDate(fPeriod.getBeginDate());
+ handler.setEndDate(fPeriod.getEndDate());
+ handler.refresh();
+ }
+ };
+ financialPeriod.addActionListener(financialPeriodActionListener);
+ removeAll();
+ add(financialPeriod);
+ break;
}
-
+
}
-
+
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchTable.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchTable.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchTable.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -25,40 +25,35 @@
package org.chorem.lima.ui.financialtransactionsearch;
-import java.awt.Color;
-import java.awt.Component;
-import java.awt.event.KeyEvent;
-import java.awt.event.KeyListener;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-import java.math.BigDecimal;
-import java.util.Date;
-
-import javax.swing.SwingWorker;
-
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.entity.Account;
-import org.chorem.lima.entity.Entry;
import org.chorem.lima.entity.EntryBook;
-import org.chorem.lima.entity.FinancialTransaction;
import org.chorem.lima.ui.celleditor.AccountTableCellEditor;
import org.chorem.lima.ui.celleditor.BigDecimalTableCellEditor;
import org.chorem.lima.ui.celleditor.BigDecimalTableCellRenderer;
import org.chorem.lima.ui.celleditor.DateTableCellEditor;
import org.chorem.lima.ui.celleditor.EmptyCellRenderer;
import org.chorem.lima.ui.celleditor.EntryBookTableCellEditor;
-import org.chorem.lima.ui.financialtransaction.FinancialTransactionTable;
import org.jdesktop.swingx.JXTable;
import org.jdesktop.swingx.decorator.ColorHighlighter;
import org.jdesktop.swingx.decorator.ComponentAdapter;
import org.jdesktop.swingx.decorator.HighlightPredicate;
import org.jdesktop.swingx.decorator.Highlighter;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.math.BigDecimal;
+import java.util.Date;
+
/**
* Table des transaction qui ajoute des comportement (keys).
- *
+ *
* @author ore
* @author Rémi Chapelet
*/
@@ -67,7 +62,7 @@
/** serialVersionUID. */
private static final long serialVersionUID = 3133690382049594727L;
-
+
/** log. */
private static final Log log = LogFactory
.getLog(FinancialTransactionSearchTable.class);
@@ -77,19 +72,14 @@
private Highlighter colorTransaction;
private ColorHighlighter colorBalance;
-
- private int x_tab;
- private int y_tab;
- /**
- */
public FinancialTransactionSearchTable(FinancialTransactionSearchViewHandler handler) {
this.handler = handler;
-
+
addKeyListener(this);
addMouseListener(this);
-
+
//Get new date editor
setDefaultEditor(Date.class, new DateTableCellEditor());
//Get new entry book editor
@@ -106,7 +96,7 @@
setDefaultRenderer(Account.class, new EmptyCellRenderer());
//get new EntryBook renderer for empty cells
setDefaultRenderer(EntryBook.class, new EmptyCellRenderer());
-
+
//highlight financial financial transactions
addColorTransaction();
// highlight unbalanced financial transactions
@@ -118,24 +108,23 @@
* afin de bien distinguer les transactions et entrées comptables.
* On récupère la première cellule, on vérifie que c'est une date
*/
- protected void addColorTransaction() {
- if (colorTransaction != null) {
- removeHighlighter(colorTransaction);
- }
- HighlightPredicate predicate = new HighlightPredicate() {
- @Override
- public boolean isHighlighted(Component renderer,
- ComponentAdapter adapter) {
- return adapter.getValueAt(adapter.row, 0) instanceof Date;
- }
- };
+ protected void addColorTransaction() {
+ if (colorTransaction != null) {
+ removeHighlighter(colorTransaction);
+ }
+ HighlightPredicate predicate = new HighlightPredicate() {
+ @Override
+ public boolean isHighlighted(Component renderer,
+ ComponentAdapter adapter) {
+ return adapter.getValueAt(adapter.row, 0) instanceof Date;
+ }
+ };
colorTransaction =
- new ColorHighlighter(predicate, new Color(222,222,222), null);
+ new ColorHighlighter(predicate, new Color(222, 222, 222), null);
addHighlighter(colorTransaction);
}
-
-
+
/**
* Permet de surligner une transaction dans le tableau lorsque
* cette dernière n'est pas équilibrée.
@@ -149,7 +138,7 @@
HighlightPredicate predicate = new HighlightPredicate() {
@Override
public boolean isHighlighted(Component renderer,
- ComponentAdapter adapter) {
+ ComponentAdapter adapter) {
boolean isHighlighted = false;
Object value = adapter.getValueAt(adapter.row, 8);
if (value instanceof BigDecimal) {
@@ -163,8 +152,8 @@
return isHighlighted;
}
};
- colorTransaction =
- new ColorHighlighter(predicate, new Color(255, 198, 209), null);
+ colorTransaction =
+ new ColorHighlighter(predicate, new Color(255, 198, 209), null);
addHighlighter(colorTransaction);
}
@@ -178,54 +167,54 @@
*/
@Override
public void keyPressed(KeyEvent e) {
-
+
//TODO combinaison de touches dans la config
-
+
// delete selected row with the key : delete or ctrl + clear
// ou de l'entree
- if ((e.getKeyCode() == KeyEvent.VK_DELETE )
- || (e.getKeyCode() == KeyEvent.VK_CLEAR
- && e.getModifiers() == KeyEvent.CTRL_MASK)){
+ if (e.getKeyCode() == KeyEvent.VK_DELETE
+ || e.getKeyCode() == KeyEvent.VK_CLEAR
+ && e.getModifiers() == KeyEvent.CTRL_MASK) {
handler.deleteSelectedRow();
}
// add entry with the key combination : insert or ctrl + enter
- if ((e.getKeyCode() == KeyEvent.VK_INSERT )
- || (e.getKeyCode() == KeyEvent.VK_ENTER
- && e.getModifiers() == KeyEvent.CTRL_MASK)) {
+ if (e.getKeyCode() == KeyEvent.VK_INSERT
+ || e.getKeyCode() == KeyEvent.VK_ENTER
+ && e.getModifiers() == KeyEvent.CTRL_MASK) {
handler.addEmptyEntry();
}
-
+
// paste : ctrl + c
// add financial transaction with the key combination : ctrl + c
- if (e.getKeyCode() == KeyEvent.VK_C
+ if (e.getKeyCode() == KeyEvent.VK_C
&& e.getModifiers() == KeyEvent.CTRL_MASK) {
handler.copyRow();
}
-
+
// copy : ctrl + v
-
+
// add financial transaction with the key combination : ctrl + v
- if (e.getKeyCode() == KeyEvent.VK_V
+ if (e.getKeyCode() == KeyEvent.VK_V
&& e.getModifiers() == KeyEvent.CTRL_MASK) {
handler.pasteRow();
}
-
+
// add financial transaction with the key combination : ctrl + tab
- if (e.getKeyCode() == KeyEvent.VK_TAB
+ if (e.getKeyCode() == KeyEvent.VK_TAB
&& e.getModifiers() == KeyEvent.CTRL_MASK) {
handler.addFinancialTransaction();
}
-
+
// clear row selection with the key: escape
if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
- if (!this.isEditing()) {
- this.clearSelection();
+ if (!isEditing()) {
+ clearSelection();
}
}
-
-
+
+
//FIXME 2011.06.11
//Needs fixing
//Exception in thread "AWT-EventQueue-0"
@@ -238,7 +227,7 @@
* la dernière cellule et si la transaction est non équilibré
* sinon rajoute une transaction
*/
-
+
/*if (e.getKeyChar() == KeyEvent.VK_TAB) {
int max_x = this.getColumnCount();
int max_y = this.getRowCount();
@@ -323,7 +312,7 @@
}
}
}*/
-
+
}
@Override
@@ -336,8 +325,8 @@
@Override
public void mousePressed(MouseEvent e) {
- if (this.rowAtPoint(e.getPoint()) == -1) {
- this.clearSelection();
+ if (rowAtPoint(e.getPoint()) == -1) {
+ clearSelection();
}
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchTableModel.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchTableModel.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -25,13 +25,6 @@
package org.chorem.lima.ui.financialtransactionsearch;
-import static org.nuiton.i18n.I18n._;
-import java.math.BigDecimal;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.List;
-import javax.swing.table.AbstractTableModel;
-
import org.apache.commons.lang.time.DateUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -41,7 +34,6 @@
import org.chorem.lima.business.LimaBusinessException;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.business.ServiceListener;
-import org.chorem.lima.business.ejb.FinancialPeriodServiceImpl;
import org.chorem.lima.entity.Account;
import org.chorem.lima.entity.Entry;
import org.chorem.lima.entity.EntryBook;
@@ -55,19 +47,27 @@
import org.chorem.lima.util.DialogHelper;
import org.chorem.lima.util.ErrorHelper;
+import javax.swing.table.AbstractTableModel;
+import java.math.BigDecimal;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+
+import static org.nuiton.i18n.I18n._;
+
/**
* Basic transaction table model.
- *
+ * <p/>
* Le modele est filtré sur {@link #selectedFiscalPeriod} (montée en charge !).
- *
+ *
* @author ore
* @author chatellier
* @version $Revision$
- *
- * Last update : $Date$
- * By : $Author$
+ * <p/>
+ * Last update : $Date$
+ * By : $Author$
*/
-public class FinancialTransactionSearchTableModel extends AbstractTableModel implements ServiceListener{
+public class FinancialTransactionSearchTableModel extends AbstractTableModel implements ServiceListener {
/** serialVersionUID. */
private static final long serialVersionUID = 1L;
@@ -78,64 +78,63 @@
/** Transaction service. */
protected final FinancialTransactionServiceMonitorable financialTransactionService;
-
+
/** Financial service */
protected final FinancialPeriodServiceMonitorable financialPeriodService;
-
+
/** selected financial period */
protected FiscalPeriod selectedFiscalPeriod;
-
+
/** data cache */
protected FinancialTransactionSearch financialTransactionSearch;
+
protected List<Object> cacheDataList;
-
+
/**
* Model constructor.
- *
+ * <p/>
* Just init service proxies.
*/
public FinancialTransactionSearchTableModel() {
/* Services */
financialTransactionService =
- LimaServiceFactory.getInstance().getService(
- FinancialTransactionServiceMonitorable.class);
- financialTransactionService.addListener(this);
- financialPeriodService =
- LimaServiceFactory.getInstance().getService(
- FinancialPeriodServiceMonitorable.class);
+ LimaServiceFactory.getInstance().getService(
+ FinancialTransactionServiceMonitorable.class);
+ financialTransactionService.addServiceListener(this);
+ financialPeriodService =
+ LimaServiceFactory.getInstance().getService(
+ FinancialPeriodServiceMonitorable.class);
}
/**
* Le model est une combinaison de Transaction/Entries.
- *
- *
+ *
* @return
*/
protected List<Object> getDataList(FinancialTransactionSearch financialTransactionSearch) {
List<Object> results = null;
//prevent to much result
if (financialTransactionSearch != null && (financialTransactionSearch.getVoucher() != null || financialTransactionSearch.getDescription() != null
- || financialTransactionSearch.getLetter() != null || financialTransactionSearch.getAccountList() != null
- || financialTransactionSearch.getAccount() != null || financialTransactionSearch.getEntryBook() != null
- || (financialTransactionSearch.getAmount() != null && financialTransactionSearch.getOperator() != null)
- || (financialTransactionSearch.getAmount() != null && financialTransactionSearch.getAmount2() != null))){
+ || financialTransactionSearch.getLetter() != null || financialTransactionSearch.getAccountList() != null
+ || financialTransactionSearch.getAccount() != null || financialTransactionSearch.getEntryBook() != null
+ || financialTransactionSearch.getAmount() != null && financialTransactionSearch.getOperator() != null
+ || financialTransactionSearch.getAmount() != null && financialTransactionSearch.getAmount2() != null)) {
try {
results = financialTransactionService.searchFinancialTransaction(financialTransactionSearch);
- }
- catch (LimaException eee) {
+ } catch (LimaException eee) {
if (log.isErrorEnabled()) {
- log.debug("Can't update model", eee);
+ log.error("Can't update model", eee);
}
-
+
ErrorHelper.showErrorDialog("Can't get transaction list", eee);
- }
+ }
}
-
+
return results;
}
-
-
+
+
protected void refresh(FinancialTransactionSearch financialTransactionSearch) {
this.financialTransactionSearch = financialTransactionSearch;
cacheDataList = getDataList(financialTransactionSearch);
@@ -154,33 +153,33 @@
Class<?> result = null;
switch (column) {
- case 0:
- result = Date.class; //Date
- break;
- case 1:
- result = EntryBook.class; //EntryBook
- break;
- case 2:
- result = String.class; //Voucher
- break;
- case 3:
- result = Account.class; //Account
- break;
- case 4:
- result = String.class; //Description
- break;
- case 5:
- result = Letter.class; //Letter
- break;
- case 6:
- result = BigDecimal.class; //Debit
- break;
- case 7:
- result = BigDecimal.class; //Credit
- break;
- case 8:
- result = BigDecimal.class; //Balance
- break;
+ case 0:
+ result = Date.class; //Date
+ break;
+ case 1:
+ result = EntryBook.class; //EntryBook
+ break;
+ case 2:
+ result = String.class; //Voucher
+ break;
+ case 3:
+ result = Account.class; //Account
+ break;
+ case 4:
+ result = String.class; //Description
+ break;
+ case 5:
+ result = Letter.class; //Letter
+ break;
+ case 6:
+ result = BigDecimal.class; //Debit
+ break;
+ case 7:
+ result = BigDecimal.class; //Credit
+ break;
+ case 8:
+ result = BigDecimal.class; //Balance
+ break;
}
@@ -192,33 +191,33 @@
String result = "n/a";
switch (column) {
- case 0:
- result = _("lima.table.date");
- break;
- case 1:
- result = _("lima.table.entrybook");
- break;
- case 2:
- result = _("lima.table.voucher");
- break;
- case 3:
- result = _("lima.table.account");
- break;
- case 4:
- result = _("lima.table.description");
- break;
- case 5:
- result = _("lima.table.letter");
- break;
- case 6:
- result = _("lima.table.debit");
- break;
- case 7:
- result = _("lima.table.credit");
- break;
- case 8:
- result = _("lima.table.balance");
- break;
+ case 0:
+ result = _("lima.table.date");
+ break;
+ case 1:
+ result = _("lima.table.entrybook");
+ break;
+ case 2:
+ result = _("lima.table.voucher");
+ break;
+ case 3:
+ result = _("lima.table.account");
+ break;
+ case 4:
+ result = _("lima.table.description");
+ break;
+ case 5:
+ result = _("lima.table.letter");
+ break;
+ case 6:
+ result = _("lima.table.debit");
+ break;
+ case 7:
+ result = _("lima.table.credit");
+ break;
+ case 8:
+ result = _("lima.table.balance");
+ break;
}
@@ -228,7 +227,7 @@
@Override
public int getRowCount() {
int result = 0;
-
+
// just prevent too much result
if (cacheDataList != null) {
result = cacheDataList.size();
@@ -240,141 +239,135 @@
@Override
public Object getValueAt(int row, int column) {
Object result = null;
-
+
// just prevent too much result
if (cacheDataList != null) {
result = cacheDataList.get(row);
-
+
if (result instanceof FinancialTransaction) {
- FinancialTransaction currentRow = (FinancialTransaction)result;
+ FinancialTransaction currentRow = (FinancialTransaction) result;
BigDecimal amountDebit = currentRow.getAmountDebit();
BigDecimal amountCredit = currentRow.getAmountCredit();
-
+
switch (column) {
- case 0:
- result = currentRow.getTransactionDate();
- break;
- case 1:
- if (currentRow.getEntryBook() != null){
- result = currentRow.getEntryBook().getCode();
- }
- else {
- result = null;
- }
- break;
- case 2:
- result = null; //EntryBook
- break;
- case 3:
- result = null; //Account
- break;
- case 4:
- result = null; //Description
- break;
- case 5:
- result = null; //Letter
- break;
- case 6 :
- result = amountDebit; //Debit
- break;
- case 7:
- result = amountCredit; //Credit
- break;
- case 8:
- result = amountDebit.subtract(amountCredit); //Balance
- break;
+ case 0:
+ result = currentRow.getTransactionDate();
+ break;
+ case 1:
+ if (currentRow.getEntryBook() != null) {
+ result = currentRow.getEntryBook().getCode();
+ } else {
+ result = null;
+ }
+ break;
+ case 2:
+ result = null; //EntryBook
+ break;
+ case 3:
+ result = null; //Account
+ break;
+ case 4:
+ result = null; //Description
+ break;
+ case 5:
+ result = null; //Letter
+ break;
+ case 6:
+ result = amountDebit; //Debit
+ break;
+ case 7:
+ result = amountCredit; //Credit
+ break;
+ case 8:
+ result = amountDebit.subtract(amountCredit); //Balance
+ break;
}
- }
- else if (result instanceof Entry) {
- Entry currentEntry = (Entry)result;
+ } else if (result instanceof Entry) {
+ Entry currentEntry = (Entry) result;
switch (column) {
- case 0:
- result = null; //Date
- break;
- case 1 : //EntryBook
- result = null;
- break;
- case 2:
- result = currentEntry.getVoucher(); //Voucher
- break;
- case 3: // account
- if (currentEntry.getAccount() != null){
- result = currentEntry.getAccount().getAccountNumber();
- }
- else {
+ case 0:
+ result = null; //Date
+ break;
+ case 1: //EntryBook
result = null;
- }
- break;
- case 4:
- result = currentEntry.getDescription(); //Description
- break;
- case 5:
- if (currentEntry.getLetter() != null){
- result = currentEntry.getLetter().getCode();
- }
- else {
- result = null;
- }
- break;
- case 6: //Debit
- result = currentEntry.getDebit() ? currentEntry.getAmount() : BigDecimal.ZERO;
- break;
- case 7: //Credit
- result = currentEntry.getDebit() ? BigDecimal.ZERO : currentEntry.getAmount();
- break;
- case 8:
- result = null; //Balance
- break;
+ break;
+ case 2:
+ result = currentEntry.getVoucher(); //Voucher
+ break;
+ case 3: // account
+ if (currentEntry.getAccount() != null) {
+ result = currentEntry.getAccount().getAccountNumber();
+ } else {
+ result = null;
+ }
+ break;
+ case 4:
+ result = currentEntry.getDescription(); //Description
+ break;
+ case 5:
+ if (currentEntry.getLetter() != null) {
+ result = currentEntry.getLetter().getCode();
+ } else {
+ result = null;
+ }
+ break;
+ case 6: //Debit
+ result = currentEntry.getDebit() ? currentEntry.getAmount() : BigDecimal.ZERO;
+ break;
+ case 7: //Credit
+ result = currentEntry.getDebit() ? BigDecimal.ZERO : currentEntry.getAmount();
+ break;
+ case 8:
+ result = null; //Balance
+ break;
}
-
+
}
}
-
+
return result;
}
-
- public void setFiscalPeriod(FiscalPeriod fiscalPeriod){
+
+ public void setFiscalPeriod(FiscalPeriod fiscalPeriod) {
selectedFiscalPeriod = fiscalPeriod;
}
-
+
/**
* To set cells editable or not
* different condition for entry or financial transaction
*/
@Override
public boolean isCellEditable(int rowIndex, int columnIndex) {
- boolean editableCell=false;
+ boolean editableCell = false;
Object currentRow = cacheDataList.get(rowIndex);
// cells editable for the entry row, all cells exclude the date
- if ((currentRow instanceof Entry) && !((columnIndex==0) || (columnIndex==1))) {
- editableCell=true;
+ if (currentRow instanceof Entry && !(columnIndex == 0 || columnIndex == 1)) {
+ editableCell = true;
}
// cells editable for the financialtransaction row, no cells exclude the date
- if ((currentRow instanceof FinancialTransaction) && ((columnIndex==0) || (columnIndex==1))){
- editableCell=true;
+ if (currentRow instanceof FinancialTransaction && (columnIndex == 0 || columnIndex == 1)) {
+ editableCell = true;
}
return editableCell;
}
-
-
+
/**
- *
* @return int: indexOf new FianancialTransaction
* @throws LimaException
*/
- public int addFinancialTransaction() throws LimaException{
+ public int addFinancialTransaction() throws LimaException {
/* Calling transaction service */
FinancialTransaction financialTransaction = new FinancialTransactionImpl();
financialTransaction.setAmountDebit(BigDecimal.ZERO);
financialTransaction.setAmountCredit(BigDecimal.ZERO);
//if a period is selected
- if (selectedFiscalPeriod != null){
- List<FinancialPeriod> financialPeriodsList =
- financialPeriodService.getFinancialPeriods(selectedFiscalPeriod.getBeginDate(),
- selectedFiscalPeriod.getEndDate());
- FinancialPeriod financialPeriod = null;
+ if (selectedFiscalPeriod != null) {
+ List<FinancialPeriod> financialPeriodsList =
+ financialPeriodService.getFinancialPeriods(selectedFiscalPeriod.getBeginDate(),
+ selectedFiscalPeriod.getEndDate());
+ FinancialPeriod financialPeriod;
if (financialPeriodsList != null) {
financialPeriod = financialPeriodsList.get(0);
} else {
@@ -386,7 +379,7 @@
Calendar actualCalendar = Calendar.getInstance();
// get the financial period date
Date transactionDate = financialPeriod.getBeginDate();
-
+
Calendar calEnd = Calendar.getInstance();
calEnd.setTime(financialPeriod.getEndDate());
int dayMax = calEnd.get(Calendar.DAY_OF_MONTH);
@@ -394,22 +387,21 @@
calBegin.setTime(financialPeriod.getBeginDate());
int dayMin = calBegin.get(Calendar.DAY_OF_MONTH);
int toDay = actualCalendar.get(Calendar.DAY_OF_MONTH);
-
- if ((toDay>dayMax) || (toDay<dayMin)){
+
+ if (toDay > dayMax || toDay < dayMin) {
// change the day
transactionDate = DateUtils.setDays(transactionDate, dayMax);
- }
- else{
+ } else {
// change the day
transactionDate = DateUtils.setDays(transactionDate, toDay);
}
-
+
// set date to the financial transaction
financialTransaction.setTransactionDate(transactionDate);
// create it
- FinancialTransaction fTransaction =
- financialTransactionService.createFinancialTransaction(financialTransaction);
+ FinancialTransaction fTransaction =
+ financialTransactionService.createFinancialTransaction(financialTransaction);
//on recharge la liste
cacheDataList = getDataList(financialTransactionSearch);
@@ -417,14 +409,12 @@
fireTableRowsInserted(row, row);
return row;
//fireTableDataChanged();
- }
- else {
+ } else {
throw new LimaBusinessException("No financial period selected");
}
}
-
+
/**
- *
* @param value
* @param row
* @return int: indexOf new Entry
@@ -437,10 +427,9 @@
entry.setAmount(BigDecimal.ZERO);
//check if current row is a transaction or an entry
if (currentRow instanceof FinancialTransaction) {
- currentTransaction = (FinancialTransaction)currentRow;
- }
- else if (currentRow instanceof Entry) {
- Entry currentEntry = (Entry)currentRow;
+ currentTransaction = (FinancialTransaction) currentRow;
+ } else if (currentRow instanceof Entry) {
+ Entry currentEntry = (Entry) currentRow;
//get back the parent transaction of the entry
currentTransaction = currentEntry.getFinancialTransaction();
}
@@ -453,114 +442,111 @@
fireTableRowsInserted(newrow, newrow);
return newrow;
}
-
- /**
- * to modifiy financialtransaction or entry
- */
+
+ /** to modifiy financialtransaction or entry */
@Override
public void setValueAt(Object value, int row, int column) {
- int financialTransactionRow = 0;
+ int financialTransactionRow;
// just prevent too much result
- Object currentRow = cacheDataList.get(row);
- if (currentRow instanceof FinancialTransaction) {
- FinancialTransaction currentFinancialTransaction =
- (FinancialTransaction)currentRow;
- switch (column) {
+ Object currentRow = cacheDataList.get(row);
+ if (currentRow instanceof FinancialTransaction) {
+ FinancialTransaction currentFinancialTransaction =
+ (FinancialTransaction) currentRow;
+ switch (column) {
case 0:
//update
- currentFinancialTransaction.setTransactionDate((Date)value);
+ currentFinancialTransaction.setTransactionDate((Date) value);
break;
- case 1 :
- currentFinancialTransaction.setEntryBook((EntryBook)value);
+ case 1:
+ currentFinancialTransaction.setEntryBook((EntryBook) value);
break;
- }
- // notify service for modification
- try {
- financialTransactionService.
+ }
+ // notify service for modification
+ try {
+ financialTransactionService.
updateFinancialTransaction(currentFinancialTransaction);
- } catch (LimaException eee) {
- if (log.isDebugEnabled()){
- log.debug("Can't update financial transaction", eee);
- }
- DialogHelper.showMessageDialog(eee.getMessage());
+ } catch (LimaException eee) {
+ if (log.isDebugEnabled()) {
+ log.debug("Can't update financial transaction", eee);
}
- //update the financial transaction in entire
- financialTransactionRow =
- cacheDataList.indexOf(((FinancialTransaction) currentRow));
+ DialogHelper.showMessageDialog(eee.getMessage());
}
- else if (currentRow instanceof Entry) {
- Entry currentEntry = (Entry)currentRow;
- switch (column) {
- case 2 :
- currentEntry.setVoucher((String)value);
+ //update the financial transaction in entire
+ financialTransactionRow =
+ cacheDataList.indexOf(currentRow);
+ } else if (currentRow instanceof Entry) {
+ Entry currentEntry = (Entry) currentRow;
+ switch (column) {
+ case 2:
+ currentEntry.setVoucher((String) value);
break;
case 3:
- currentEntry.setAccount((Account)value);
+ currentEntry.setAccount((Account) value);
break;
case 4:
- currentEntry.setDescription((String)value);
+ currentEntry.setDescription((String) value);
break;
- case 5 :
- currentEntry.setAmount((BigDecimal)value);
+ case 5:
+ currentEntry.setAmount((BigDecimal) value);
currentEntry.setDebit(true);
break;
case 6:
- currentEntry.setAmount((BigDecimal)value);
+ currentEntry.setAmount((BigDecimal) value);
currentEntry.setDebit(false);
break;
case 8:
- currentEntry.setLetter((Letter)value);
+ currentEntry.setLetter((Letter) value);
break;
+ }
+ try {
+ financialTransactionService.updateEntry(currentEntry);
+ } catch (LimaException eee) {
+ if (log.isDebugEnabled()) {
+ log.debug("Can't update entry", eee);
}
- try {
- financialTransactionService.updateEntry(currentEntry);
- } catch (LimaException eee) {
- if (log.isDebugEnabled()){
- log.debug("Can't update entry", eee);
- }
- DialogHelper.showMessageDialog(eee.getMessage());
- }
- //update the financial transaction in entire
- financialTransactionRow =
+ DialogHelper.showMessageDialog(eee.getMessage());
+ }
+ //update the financial transaction in entire
+ financialTransactionRow =
cacheDataList.indexOf(((Entry) currentRow).
getFinancialTransaction());
- }
- //on recharge la liste
- cacheDataList = getDataList(financialTransactionSearch);
- fireTableDataChanged();
+ }
+ //on recharge la liste
+ cacheDataList = getDataList(financialTransactionSearch);
+ fireTableDataChanged();
}
-
- public Object getElementAt(int row){
+
+ public Object getElementAt(int row) {
Object currentRow = cacheDataList.get(row);
return currentRow;
}
-
+
/**
* Delete selected row in table (could be transaction or entry).
- *
+ * <p/>
* Called by model.
- * @param Object, int
- * @throws LimaException
+ *
+ * @param object
+ * @param row
+ * @throws LimaException
*/
public void removeObject(Object object, int row) throws LimaException {
Object currentRow = cacheDataList.get(row);
if (currentRow instanceof FinancialTransaction) {
FinancialTransaction currentTransaction =
- (FinancialTransaction)currentRow;
+ (FinancialTransaction) currentRow;
financialTransactionService.removeFinancialTransaction(currentTransaction);
- }
- else if (currentRow instanceof Entry) {
- Entry currentEntry = (Entry)currentRow;
+ } else if (currentRow instanceof Entry) {
+ Entry currentEntry = (Entry) currentRow;
financialTransactionService.removeEntry(currentEntry);
}
//on recharge la liste
cacheDataList = getDataList(financialTransactionSearch);
fireTableDataChanged();
}
-
+
/**
- *
* @param value
* @param description
* @param row
@@ -577,16 +563,15 @@
}
//check if current row is a transaction or an entry
if (currentRow instanceof FinancialTransaction) {
- currentTransaction = (FinancialTransaction)currentRow;
- }
- else if (currentRow instanceof Entry) {
- Entry currentEntry = (Entry)currentRow;
+ currentTransaction = (FinancialTransaction) currentRow;
+ } else if (currentRow instanceof Entry) {
+ Entry currentEntry = (Entry) currentRow;
//get back the parent transaction of the entry
currentTransaction = currentEntry.getFinancialTransaction();
}
//create it
entry.setFinancialTransaction(currentTransaction);
- Entry newEntry = financialTransactionService.createEntry(entry);
+ Entry newEntry = financialTransactionService.createEntry(entry);
//on recharge la liste
cacheDataList = getDataList(financialTransactionSearch);
@@ -594,9 +579,8 @@
fireTableRowsInserted(newrow, newrow);
return newrow;
}
-
+
/**
- *
* @param value
* @param entry
* @param row
@@ -609,24 +593,23 @@
Object currentRow = cacheDataList.get(row);
//check if current row is a transaction or an entry
if (currentRow instanceof FinancialTransaction) {
- currentTransaction = (FinancialTransaction)currentRow;
+ currentTransaction = (FinancialTransaction) currentRow;
//update the financial transaction in entire
- financialTransactionRow =
- getDataList(financialTransactionSearch).indexOf(((FinancialTransaction) currentRow));
- }
- else if (currentRow instanceof Entry) {
- Entry currentEntry = (Entry)currentRow;
+ financialTransactionRow =
+ getDataList(financialTransactionSearch).indexOf(currentRow);
+ } else if (currentRow instanceof Entry) {
+ Entry currentEntry = (Entry) currentRow;
//get back the parent transaction of the entry
currentTransaction = currentEntry.getFinancialTransaction();
//update the financial transaction in entire
- financialTransactionRow =
- getDataList(financialTransactionSearch).indexOf(((Entry) currentRow).
- getFinancialTransaction());
+ financialTransactionRow =
+ getDataList(financialTransactionSearch).indexOf(((Entry) currentRow).
+ getFinancialTransaction());
}
//create it
entry.setFinancialTransaction(currentTransaction);
Entry newEntry = financialTransactionService.createEntry(entry);
- fireTableRowsUpdated(financialTransactionRow, getRowCount()-1);
+ fireTableRowsUpdated(financialTransactionRow, getRowCount() - 1);
//on recharge la liste
cacheDataList = getDataList(financialTransactionSearch);
@@ -634,15 +617,15 @@
fireTableRowsInserted(newrow, newrow);
return newrow;
}
-
+
@Override
public void notifyMethod(String serviceName, String methodeName) {
if ((serviceName.contains("FinancialTransaction") || methodeName.contains("importEntries")
- || methodeName.contains("importAll")) && !methodeName.contains("search")){
+ || methodeName.contains("importAll")) && !methodeName.contains("search")) {
//on recharge la liste
cacheDataList = getDataList(financialTransactionSearch);
fireTableDataChanged();
}
- }
-
+ }
+
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchView.jaxx 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchView.jaxx 2011-09-17 12:59:34 UTC (rev 3291)
@@ -24,18 +24,25 @@
-->
<Table>
- <FinancialTransactionSearchViewHandler id="handler" javaBean="new FinancialTransactionSearchViewHandler(this)" />
- <Boolean id="selectedRow" javaBean="false" />
- <java.awt.Dimension id="fieldSize" javaBean="new java.awt.Dimension()" />
- <script>
+ <import>
+ java.awt.Dimension
+ javax.swing.ListSelectionModel
+ javax.swing.text.Document
+ org.chorem.lima.enums.ComboBoxPeriodEnum
+ org.chorem.lima.enums.ComboBoxAccountsEnum
+ org.chorem.lima.enums.ComboBoxEntryBooksEnum
+ org.chorem.lima.enums.ComboBoxLetterEnum
+ org.chorem.lima.FinancialStatementWayEnum
+ org.chorem.lima.enums.ComboBoxOperatorsEnum
+ org.chorem.lima.ui.financialtransactionsearch.FinancialTransactionSearchTableModel
+ org.chorem.lima.ui.financialtransactionsearch.FinancialTransactionSearchTable
+ </import>
+ <FinancialTransactionSearchViewHandler id="handler"
+ javaBean="new FinancialTransactionSearchViewHandler(this)"/>
+ <Boolean id="selectedRow" javaBean="false"/>
+ <Dimension id="fieldSize" javaBean="new java.awt.Dimension()"/>
+ <script>
<![CDATA[
- import org.chorem.lima.enums.ComboBoxPeriodEnum;
- import org.chorem.lima.enums.ComboBoxAccountsEnum;
- import org.chorem.lima.enums.ComboBoxEntryBooksEnum;
- import org.chorem.lima.enums.ComboBoxLetterEnum;
- import org.chorem.lima.FinancialStatementWayEnum;
- import org.chorem.lima.enums.ComboBoxOperatorsEnum;
-
AccountSearchPanel accountSearchPanel = new AccountSearchPanel(handler);
AmountSearchPanel amountSearchPanel = new AmountSearchPanel(handler);
EntryBookSearchPanel entryBookSearchPanel = new EntryBookSearchPanel(handler);
@@ -50,75 +57,135 @@
}
]]>
- </script>
-
- <row>
- <cell fill='both'><Table><row>
- <cell anchor="west"><JComboBox id="periodComboBox" javaBean="new JComboBox(ComboBoxPeriodEnum.descriptions())"
- onActionPerformed="periodSearchPanel.refresh(ComboBoxPeriodEnum.valueOfDescription((String) periodComboBox.getSelectedItem()));
- validate(); repaint()"/></cell>
- <cell><FinancialTransactionPeriodSearchPanel javaBean="periodSearchPanel"/></cell>
- </row></Table></cell>
- </row>
- <row>
- <cell fill='both'><Table><row>
- <cell><JLabel text="lima.table.voucher"/></cell>
- <cell><JTextField id='voucher' minimumSize="{voucher.getPreferredSize()}"/>
- <javax.swing.text.Document javaBean="voucher.getDocument()"
- onInsertUpdate='handler.setVoucher(voucher.getText())'
- onRemoveUpdate='handler.setVoucher(voucher.getText())' />
- </cell>
- <cell><JLabel text="lima.table.description"/></cell>
- <cell><JTextField id='description' minimumSize='{description.getPreferredSize()}'/>
- <javax.swing.text.Document javaBean="description.getDocument()"
- onInsertUpdate='handler.setDescription(description.getText())'
- onRemoveUpdate='handler.setDescription(description.getText())' />
- </cell>
- <cell><JComboBox id="letterComboBox" javaBean="new JComboBox(ComboBoxLetterEnum.descriptions())"
- onActionPerformed="letterSearchPanel.refresh(ComboBoxLetterEnum.valueOfDescription((String) letterComboBox.getSelectedItem()));
- validate(); repaint()"/></cell>
- <cell><LetterSearchPanel javaBean="letterSearchPanel"/></cell>
- </row></Table></cell>
- </row>
- <row>
- <cell fill='both'><Table><row>
- <cell><JComboBox id="accountComboBox" javaBean="new JComboBox(ComboBoxAccountsEnum.descriptions())"
- onActionPerformed="accountSearchPanel.refresh(ComboBoxAccountsEnum.valueOfDescription((String) accountComboBox.getSelectedItem()));
- validate(); repaint()"/></cell>
- <cell><AccountSearchPanel javaBean="accountSearchPanel"/></cell>
- <cell><JComboBox id="entryBookComboBox" javaBean="new JComboBox(ComboBoxEntryBooksEnum.descriptions())"
- onActionPerformed="entryBookSearchPanel.refresh(ComboBoxEntryBooksEnum.valueOfDescription((String) entryBookComboBox.getSelectedItem()));
- validate(); repaint()"/></cell>
- <cell><EntryBookSearchPanel javaBean="entryBookSearchPanel"/></cell>
- </row></Table></cell>
- </row>
- <row>
- <cell fill='both'><Table><row>
- <cell><JLabel text="lima.common.amount"/></cell>
- <cell><JComboBox id="amountComboBox" javaBean="new JComboBox(FinancialStatementWayEnum.descriptions())"
- onActionPerformed="handler.setAmountWayEnum(FinancialStatementWayEnum.valueOfDescription((String)amountComboBox.getSelectedItem()));
- handler.refresh()"/></cell>
- <cell><JComboBox id="operatorComboBox" javaBean="new JComboBox(ComboBoxOperatorsEnum.descriptions())"
- onActionPerformed="amountSearchPanel.refresh(ComboBoxOperatorsEnum.valueOfDescription((String) operatorComboBox.getSelectedItem()));
- validate(); repaint()"/></cell>
- <cell><AmountSearchPanel javaBean="amountSearchPanel"/></cell>
- </row></Table></cell>
- </row>
- <row>
- <cell><JButton id="validSearch" text='lima.common.search' onActionPerformed="handler.refresh()"/></cell>
- </row>
- <row>
- <cell fill="both" weightx="1" weighty="1">
- <JScrollPane>
- <org.chorem.lima.ui.financialtransactionsearch.FinancialTransactionSearchTableModel
- id="financialTransactionSearchTableModel" />
- <org.chorem.lima.ui.financialtransactionsearch.FinancialTransactionSearchTable
- id="financialTransactionSearchTable" sortable="false" rowHeight="22"
- constructorParams="getHandler()" model="{getFinancialTransactionSearchTableModel()}"
- selectionMode="{ListSelectionModel.SINGLE_SELECTION}" />
- <javax.swing.ListSelectionModel javaBean="getFinancialTransactionSearchTable().getSelectionModel()"
- onValueChanged="setSelectedRow(financialTransactionSearchTable.getSelectedRow() != -1)"/>
- </JScrollPane>
- </cell>
- </row>
+ </script>
+
+ <row>
+ <cell fill='both'>
+ <Table>
+ <row>
+ <cell anchor="west">
+ <JComboBox id="periodComboBox"
+ javaBean="new JComboBox(ComboBoxPeriodEnum.descriptions())"
+ onActionPerformed="periodSearchPanel.refresh(ComboBoxPeriodEnum.valueOfDescription((String) periodComboBox.getSelectedItem()));
+ validate(); repaint()"/>
+ </cell>
+ <cell>
+ <FinancialTransactionPeriodSearchPanel
+ javaBean="periodSearchPanel"/>
+ </cell>
+ </row>
+ </Table>
+ </cell>
+ </row>
+ <row>
+ <cell fill='both'>
+ <Table>
+ <row>
+ <cell>
+ <JLabel text="lima.table.voucher"/>
+ </cell>
+ <cell>
+ <JTextField id='voucher'
+ minimumSize="{voucher.getPreferredSize()}"/>
+ <Document javaBean="voucher.getDocument()"
+ onInsertUpdate='handler.setVoucher(voucher.getText())'
+ onRemoveUpdate='handler.setVoucher(voucher.getText())'/>
+ </cell>
+ <cell>
+ <JLabel text="lima.table.description"/>
+ </cell>
+ <cell>
+ <JTextField id='description'
+ minimumSize='{description.getPreferredSize()}'/>
+ <Document javaBean="description.getDocument()"
+ onInsertUpdate='handler.setDescription(description.getText())'
+ onRemoveUpdate='handler.setDescription(description.getText())'/>
+ </cell>
+ <cell>
+ <JComboBox id="letterComboBox"
+ javaBean="new JComboBox(ComboBoxLetterEnum.descriptions())"
+ onActionPerformed="letterSearchPanel.refresh(ComboBoxLetterEnum.valueOfDescription((String) letterComboBox.getSelectedItem()));
+ validate(); repaint()"/>
+ </cell>
+ <cell>
+ <LetterSearchPanel javaBean="letterSearchPanel"/>
+ </cell>
+ </row>
+ </Table>
+ </cell>
+ </row>
+ <row>
+ <cell fill='both'>
+ <Table>
+ <row>
+ <cell>
+ <JComboBox id="accountComboBox"
+ javaBean="new JComboBox(ComboBoxAccountsEnum.descriptions())"
+ onActionPerformed="accountSearchPanel.refresh(ComboBoxAccountsEnum.valueOfDescription((String) accountComboBox.getSelectedItem()));
+ validate(); repaint()"/>
+ </cell>
+ <cell>
+ <AccountSearchPanel javaBean="accountSearchPanel"/>
+ </cell>
+ <cell>
+ <JComboBox id="entryBookComboBox"
+ javaBean="new JComboBox(ComboBoxEntryBooksEnum.descriptions())"
+ onActionPerformed="entryBookSearchPanel.refresh(ComboBoxEntryBooksEnum.valueOfDescription((String) entryBookComboBox.getSelectedItem()));
+ validate(); repaint()"/>
+ </cell>
+ <cell>
+ <EntryBookSearchPanel javaBean="entryBookSearchPanel"/>
+ </cell>
+ </row>
+ </Table>
+ </cell>
+ </row>
+ <row>
+ <cell fill='both'>
+ <Table>
+ <row>
+ <cell>
+ <JLabel text="lima.common.amount"/>
+ </cell>
+ <cell>
+ <JComboBox id="amountComboBox"
+ javaBean="new JComboBox(FinancialStatementWayEnum.descriptions())"
+ onActionPerformed="handler.setAmountWayEnum(FinancialStatementWayEnum.valueOfDescription((String)amountComboBox.getSelectedItem()));
+ handler.refresh()"/>
+ </cell>
+ <cell>
+ <JComboBox id="operatorComboBox"
+ javaBean="new JComboBox(ComboBoxOperatorsEnum.descriptions())"
+ onActionPerformed="amountSearchPanel.refresh(ComboBoxOperatorsEnum.valueOfDescription((String) operatorComboBox.getSelectedItem()));
+ validate(); repaint()"/>
+ </cell>
+ <cell>
+ <AmountSearchPanel javaBean="amountSearchPanel"/>
+ </cell>
+ </row>
+ </Table>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JButton id="validSearch" text='lima.common.search'
+ onActionPerformed="handler.refresh()"/>
+ </cell>
+ </row>
+ <row>
+ <cell fill="both" weightx="1" weighty="1">
+ <JScrollPane>
+ <FinancialTransactionSearchTableModel
+ id="financialTransactionSearchTableModel"/>
+ <FinancialTransactionSearchTable
+ id="financialTransactionSearchTable" sortable="false" rowHeight="22"
+ constructorParams="getHandler()"
+ model="{getFinancialTransactionSearchTableModel()}"
+ selectionMode="{ListSelectionModel.SINGLE_SELECTION}"/>
+ <ListSelectionModel
+ javaBean="getFinancialTransactionSearchTable().getSelectionModel()"
+ onValueChanged="setSelectedRow(financialTransactionSearchTable.getSelectedRow() != -1)"/>
+ </JScrollPane>
+ </cell>
+ </row>
</Table>
\ No newline at end of file
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchViewHandler.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchViewHandler.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -25,13 +25,6 @@
package org.chorem.lima.ui.financialtransactionsearch;
-import static org.nuiton.i18n.I18n._;
-
-import java.util.Date;
-
-import javax.swing.JOptionPane;
-import javax.swing.ListSelectionModel;
-
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.FinancialStatementWayEnum;
@@ -49,146 +42,153 @@
import org.chorem.lima.ui.combobox.FiscalPeriodComboBoxModel;
import org.chorem.lima.util.DialogHelper;
+import javax.swing.JOptionPane;
+import javax.swing.ListSelectionModel;
+import java.util.Date;
+
+import static org.nuiton.i18n.I18n._;
+
/**
* Handler associated with financial transaction view.
- *
+ *
* @author chatellier
* @version $Revision$
- *
- * Last update : $Date$
- * By : $Author$
+ * <p/>
+ * Last update : $Date$
+ * By : $Author$
*/
public class FinancialTransactionSearchViewHandler {
/** log. */
private static final Log log =
- LogFactory.getLog(FinancialTransactionSearchViewHandler.class);
+ LogFactory.getLog(FinancialTransactionSearchViewHandler.class);
protected FinancialTransactionSearchView view;
-
+
protected FinancialTransactionSearchTable table;
-
+
protected FinancialTransactionSearchTableModel tableModel;
-
+
protected FiscalPeriodComboBoxModel comboBoxModel;
-
+
/** Transaction service. */
protected final FinancialTransactionService financialTransactionService;
-
+
/** data cache */
protected FinancialTransactionSearch financialTransactionSearch;
-
+
protected Object clipBoard;
protected FinancialTransactionSearchViewHandler(FinancialTransactionSearchView view) {
this.view = view;
-
+
/* Services */
financialTransactionService =
- LimaServiceFactory.getInstance().getService(
- FinancialTransactionServiceMonitorable.class);
-
+ LimaServiceFactory.getInstance().getService(
+ FinancialTransactionServiceMonitorable.class);
+
financialTransactionSearch = new FinancialTransactionSearchImpl();
-
+
}
-
- public void setBeginDate(Date beginDate){
+
+ public void setBeginDate(Date beginDate) {
financialTransactionSearch.setBeginDate(beginDate);
}
-
- public void setEndDate(Date endDate){
+
+ public void setEndDate(Date endDate) {
financialTransactionSearch.setEndDate(endDate);
}
-
- public void setVoucher(String voucher){
+ public void setVoucher(String voucher) {
+
String result = null;
- if (!voucher.equals("")){
+ if (!voucher.equals("")) {
result = voucher;
}
financialTransactionSearch.setVoucher(result);
}
-
- public void setDescription(String description){
+
+ public void setDescription(String description) {
String result = null;
- if (!description.equals("")){
+ if (!description.equals("")) {
result = description;
}
financialTransactionSearch.setDescription(result);
}
-
- public void setLetter(Letter letter){
+
+ public void setLetter(Letter letter) {
financialTransactionSearch.setLetter(letter);
}
-
- public String getAccountsList(){
+
+ public String getAccountsList() {
return financialTransactionSearch.getAccountList();
}
-
- public void setAccountsList(String accountsList){
+
+ public void setAccountsList(String accountsList) {
String result = null;
- if (!accountsList.equals("")){
+ if (!accountsList.equals("")) {
result = accountsList;
}
financialTransactionSearch.setAccountList(result);
}
- public Account getAccount(){
+ public Account getAccount() {
return financialTransactionSearch.getAccount();
}
-
- public void setAccount(Account account){
+
+ public void setAccount(Account account) {
financialTransactionSearch.setAccount(account);
}
-
- public void setEntryBook(EntryBook entryBook){
+
+ public void setEntryBook(EntryBook entryBook) {
financialTransactionSearch.setEntryBook(entryBook);
}
-
- public String getAmount(){
+
+ public String getAmount() {
return financialTransactionSearch.getAmount();
}
-
- public void setAmount(String amount){
+
+ public void setAmount(String amount) {
String result = null;
- if (!amount.equals("")){
+ if (!amount.equals("")) {
result = amount;
}
financialTransactionSearch.setAmount(result);
}
-
- public String getAmount2(){
+
+ public String getAmount2() {
return financialTransactionSearch.getAmount2();
}
-
- public void setAmount2(String amount2){
+
+ public void setAmount2(String amount2) {
String result = null;
- if (!amount2.equals("")){
+ if (!amount2.equals("")) {
result = amount2;
}
financialTransactionSearch.setAmount2(result);
}
-
- public void setAmountWayEnum(FinancialStatementWayEnum amountWayEnum){
+
+ public void setAmountWayEnum(FinancialStatementWayEnum amountWayEnum) {
financialTransactionSearch.setAmountWayEnum(amountWayEnum);
}
- public void setOperator(String operator){
+ public void setOperator(String operator) {
String result = null;
- if (!operator.equals("")){
+ if (!operator.equals("")) {
result = operator;
}
financialTransactionSearch.setOperator(result);
}
-
+
/**
* Delete selected row in table (could be transaction or entry).
- *
+ * <p/>
* Called by model.
- * @throws LimaException
+ *
+ * @throws LimaException
*/
- public void deleteSelectedRow(){
+ public void deleteSelectedRow() {
table = view.getFinancialTransactionSearchTable();
tableModel = view.getFinancialTransactionSearchTableModel();
@@ -197,46 +197,44 @@
if (indexSelectedRow != -1) {
Object selectedValue = tableModel.getElementAt(indexSelectedRow);
- String message = null;
+ String message;
if (selectedValue instanceof FinancialTransaction) {
message = _("lima.charts.financialtransaction.question.removetransaction");
- }
- else {
+ } else {
message = _("lima.charts.financialtransaction.question.removeentry");
}
int response = JOptionPane.showConfirmDialog(view, message,
- _("lima.common.confirmation"), JOptionPane.YES_NO_OPTION);
+ _("lima.common.confirmation"), JOptionPane.YES_NO_OPTION);
if (response == JOptionPane.YES_OPTION) {
-
+
try {
tableModel.removeObject(selectedValue, indexSelectedRow);
//select the upper line
- ListSelectionModel selectionModel =
- table.getSelectionModel();
+ ListSelectionModel selectionModel =
+ table.getSelectionModel();
selectionModel.setSelectionInterval(
- indexSelectedRow-1, indexSelectedRow-1);
+ indexSelectedRow - 1, indexSelectedRow - 1);
} catch (LimaException eee) {
if (log.isErrorEnabled()) {
log.error("Can't remove transaction or entry", eee);
}
- DialogHelper.showMessageDialog(eee.getMessage());
+ DialogHelper.showErrorMessageDialog(view, eee);
}
}
- }
- else {
+ } else {
if (log.isWarnEnabled()) {
log.warn("Call delete selected row without selection");
}
}
}
-
-
+
+
//implement new transaction button
//add a new entry to the selected transaction
- public void addEmptyEntry(){
-
+ public void addEmptyEntry() {
+
table = view.getFinancialTransactionSearchTable();
tableModel = view.getFinancialTransactionSearchTableModel();
@@ -248,69 +246,68 @@
String description = (String) tableModel.getValueAt(indexSelectedRow, 4);
int index = tableModel.addEmptyEntry(selectedValue, description, indexSelectedRow);
//select the new line
- ListSelectionModel selectionModel =
- table.getSelectionModel();
- selectionModel.setSelectionInterval(
- indexSelectedRow+1, indexSelectedRow+1);
- //focus on second column
- table.changeSelection(index, 1, false, false);
- table.requestFocusInWindow();
- } catch (LimaException eee){
+ ListSelectionModel selectionModel =
+ table.getSelectionModel();
+ selectionModel.setSelectionInterval(
+ indexSelectedRow + 1, indexSelectedRow + 1);
+ //focus on second column
+ table.changeSelection(index, 1, false, false);
+ table.requestFocusInWindow();
+ } catch (LimaException eee) {
if (log.isErrorEnabled()) {
log.error("Can't add emptyentry", eee);
}
- DialogHelper.showMessageDialog(eee.getMessage());
+ DialogHelper.showErrorMessageDialog(view, eee);
}
- }
- else {
+ } else {
if (log.isWarnEnabled()) {
log.warn("Call addentry selected transaction without selection");
}
}
}
-
-
+
+
//copy entry
- public void copyRow(){
+ public void copyRow() {
table = view.getFinancialTransactionSearchTable();
int indexSelectedRow = table.getSelectedRow();
-
+
if (indexSelectedRow != -1) {
clipBoard = tableModel.getElementAt(indexSelectedRow);
}
}
-
+
//paste entry
- public void pasteRow(){
+ public void pasteRow() {
table = view.getFinancialTransactionSearchTable();
int indexSelectedRow = table.getSelectedRow();
-
+
if (indexSelectedRow != -1) {
Object selectedValue = tableModel.getElementAt(indexSelectedRow);
if (clipBoard instanceof Entry) {
try {
int index = tableModel.addEntry(selectedValue, (Entry) clipBoard, indexSelectedRow);
//select the new line
- ListSelectionModel selectionModel =
- table.getSelectionModel();
- selectionModel.setSelectionInterval(
- indexSelectedRow+1, indexSelectedRow+1);
- //focus on second column
- table.changeSelection(index, 1, false, false);
- table.requestFocusInWindow();
- } catch (LimaException eee){
+ ListSelectionModel selectionModel =
+ table.getSelectionModel();
+ selectionModel.setSelectionInterval(
+ indexSelectedRow + 1, indexSelectedRow + 1);
+ //focus on second column
+ table.changeSelection(index, 1, false, false);
+ table.requestFocusInWindow();
+ } catch (LimaException eee) {
if (log.isErrorEnabled()) {
log.error("Can't past entry", eee);
}
- DialogHelper.showMessageDialog(eee.getMessage());
+ DialogHelper.showErrorMessageDialog(view, eee);
}
}
}
-
+
}
-
-
+
+
//add a new transaction
public void addFinancialTransaction() {
table = view.getFinancialTransactionSearchTable();
@@ -320,9 +317,9 @@
int index = tableModel.addFinancialTransaction();
//select the new line
int numberRow = table.getRowCount();
- ListSelectionModel selectionModel =
- table.getSelectionModel();
- selectionModel.setSelectionInterval(numberRow-1, numberRow-1);
+ ListSelectionModel selectionModel =
+ table.getSelectionModel();
+ selectionModel.setSelectionInterval(numberRow - 1, numberRow - 1);
//focus on first column
table.changeSelection(index, 0, false, false);
table.requestFocusInWindow();
@@ -330,14 +327,14 @@
if (log.isErrorEnabled()) {
log.error("Can't add financialtransaction", eee);
}
- DialogHelper.showMessageDialog(eee.getMessage());
+ DialogHelper.showErrorMessageDialog(view, eee);
}
}
- public void refresh(){
+ public void refresh() {
tableModel = view.getFinancialTransactionSearchTableModel();
- if (tableModel != null){
+ if (tableModel != null) {
tableModel.refresh(financialTransactionSearch);
}
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/LetterSearchComboBox.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/LetterSearchComboBox.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/LetterSearchComboBox.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -25,11 +25,6 @@
package org.chorem.lima.ui.financialtransactionsearch;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.KeyEvent;
-import java.awt.event.KeyListener;
-import javax.swing.JComboBox;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.entity.Letter;
@@ -38,15 +33,20 @@
import org.chorem.lima.util.LetterToString;
import org.jdesktop.swingx.autocomplete.AutoCompleteDecorator;
-public class LetterSearchComboBox extends JComboBox implements KeyListener, ActionListener {
+import javax.swing.JComboBox;
+import java.awt.event.ActionEvent;
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
+public class LetterSearchComboBox extends JComboBox implements KeyListener {
+
private static final long serialVersionUID = 1L;
private static final Log log =
- LogFactory.getLog(LetterSearchComboBox.class);
-
+ LogFactory.getLog(LetterSearchComboBox.class);
+
protected FinancialTransactionSearchViewHandler handler;
-
+
public LetterSearchComboBox(FinancialTransactionSearchViewHandler handler) {
this.handler = handler;
LetterComboBoxModel letterComboBoxModel = new LetterComboBoxModel();
@@ -55,40 +55,39 @@
setRenderer(letterRenderer);
setEditable(true);
AutoCompleteDecorator.decorate(this, LetterToString.getInstance());
- this.getEditor().getEditorComponent().addKeyListener(this);
- this.addActionListener(this);
+ getEditor().getEditorComponent().addKeyListener(this);
+ addActionListener(this);
}
-
+
@Override
public void actionPerformed(ActionEvent e) {
- Object object = this.getSelectedItem();
- if (object instanceof Letter){
- handler.setLetter((Letter) this.getSelectedItem());
+ Object object = getSelectedItem();
+ if (object instanceof Letter) {
+ handler.setLetter((Letter) getSelectedItem());
}
}
@Override
public void keyPressed(KeyEvent e) {
-
+
}
@Override
public void keyReleased(KeyEvent e) {
- Object object = this.getSelectedItem();
- if (object instanceof Letter){
- handler.setLetter((Letter) this.getSelectedItem());
+ Object object = getSelectedItem();
+ if (object instanceof Letter) {
+ handler.setLetter((Letter) getSelectedItem());
}
// delegate popup list menu
- if ( e.getKeyChar() == KeyEvent.VK_ENTER )
- {
+ if (e.getKeyChar() == KeyEvent.VK_ENTER) {
firePopupMenuCanceled();
}
}
@Override
public void keyTyped(KeyEvent e) {
-
+
}
-
+
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/LetterSearchPanel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/LetterSearchPanel.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/LetterSearchPanel.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -25,36 +25,35 @@
package org.chorem.lima.ui.financialtransactionsearch;
-import javax.swing.JPanel;
import org.chorem.lima.enums.ComboBoxLetterEnum;
+import javax.swing.JPanel;
+
public class LetterSearchPanel extends JPanel {
-
+
protected FinancialTransactionSearchViewHandler handler;
-
+
public LetterSearchPanel(FinancialTransactionSearchViewHandler handler) {
this.handler = handler;
}
-
- static final long serialVersionUID = 1L;
- public void refresh(ComboBoxLetterEnum comboBoxEnum){
-
+ public void refresh(ComboBoxLetterEnum comboBoxEnum) {
+
switch (comboBoxEnum) {
- case ALL:
- handler.setLetter(null);
- handler.refresh();
- this.removeAll();
- break;
-
- case SELECT_ONE:
- LetterSearchComboBox comboBox = new LetterSearchComboBox(handler);
- this.removeAll();
- this.add(comboBox);
- break;
-
+ case ALL:
+ handler.setLetter(null);
+ handler.refresh();
+ removeAll();
+ break;
+
+ case SELECT_ONE:
+ LetterSearchComboBox comboBox = new LetterSearchComboBox(handler);
+ removeAll();
+ add(comboBox);
+ break;
+
}
-
+
}
-
+
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTable.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTable.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTable.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -25,14 +25,6 @@
package org.chorem.lima.ui.financialtransactionunbalanced;
-import java.awt.Color;
-import java.awt.Component;
-import java.awt.event.KeyEvent;
-import java.awt.event.KeyListener;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-import java.math.BigDecimal;
-import java.util.Date;
import org.chorem.lima.entity.Account;
import org.chorem.lima.entity.EntryBook;
import org.chorem.lima.ui.celleditor.AccountTableCellEditor;
@@ -41,17 +33,25 @@
import org.chorem.lima.ui.celleditor.DateTableCellEditor;
import org.chorem.lima.ui.celleditor.EmptyCellRenderer;
import org.chorem.lima.ui.celleditor.EntryBookTableCellEditor;
-import org.chorem.lima.ui.financialtransactionunbalanced.FinancialTransactionUnbalancedViewHandler;
import org.jdesktop.swingx.JXTable;
import org.jdesktop.swingx.decorator.ColorHighlighter;
import org.jdesktop.swingx.decorator.ComponentAdapter;
import org.jdesktop.swingx.decorator.HighlightPredicate;
import org.jdesktop.swingx.decorator.Highlighter;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.math.BigDecimal;
+import java.util.Date;
+
/**
* Table des transaction qui ajoute des comportement (keys).
- *
+ *
* @author ore
* @author Rémi Chapelet
*/
@@ -67,15 +67,13 @@
private ColorHighlighter colorBalance;
- /**
- */
public FinancialTransactionUnbalancedTable(FinancialTransactionUnbalancedViewHandler handler) {
this.handler = handler;
addKeyListener(this);
addMouseListener(this);
-
+
//Get new date editor
setDefaultEditor(Date.class, new DateTableCellEditor());
//Get new entry book editor
@@ -92,7 +90,7 @@
setDefaultRenderer(Account.class, new EmptyCellRenderer());
//get new EntryBook renderer for empty cells
setDefaultRenderer(EntryBook.class, new EmptyCellRenderer());
-
+
//highlight financial financial transactions
addColorTransaction();
// highlight unbalanced financial transactions
@@ -104,24 +102,23 @@
* afin de bien distinguer les transactions et entrées comptables.
* On récupère la première cellule, on vérifie que c'est une date
*/
- protected void addColorTransaction() {
- if (colorTransaction != null) {
- removeHighlighter(colorTransaction);
- }
- HighlightPredicate predicate = new HighlightPredicate() {
- @Override
- public boolean isHighlighted(Component renderer,
- ComponentAdapter adapter) {
- return adapter.getValueAt(adapter.row, 0) instanceof Date;
- }
- };
+ protected void addColorTransaction() {
+ if (colorTransaction != null) {
+ removeHighlighter(colorTransaction);
+ }
+ HighlightPredicate predicate = new HighlightPredicate() {
+ @Override
+ public boolean isHighlighted(Component renderer,
+ ComponentAdapter adapter) {
+ return adapter.getValueAt(adapter.row, 0) instanceof Date;
+ }
+ };
colorTransaction =
- new ColorHighlighter(predicate, new Color(222,222,222), null);
+ new ColorHighlighter(predicate, new Color(222, 222, 222), null);
addHighlighter(colorTransaction);
}
-
-
+
/**
* Permet de surligner une transaction dans le tableau lorsque
* cette dernière n'est pas équilibrée.
@@ -135,7 +132,7 @@
HighlightPredicate predicate = new HighlightPredicate() {
@Override
public boolean isHighlighted(Component renderer,
- ComponentAdapter adapter) {
+ ComponentAdapter adapter) {
boolean isHighlighted = false;
Object value = adapter.getValueAt(adapter.row, 8);
if (value instanceof BigDecimal) {
@@ -149,8 +146,8 @@
return isHighlighted;
}
};
- colorTransaction =
- new ColorHighlighter(predicate, new Color(255, 198, 209), null);
+ colorTransaction =
+ new ColorHighlighter(predicate, new Color(255, 198, 209), null);
addHighlighter(colorTransaction);
}
@@ -162,27 +159,27 @@
public void keyPressed(KeyEvent e) {
//TODO combinaison de touches dans la config
-
+
// delete selected row with the key : delete or ctrl clear
// ou de l'entree
- if ((e.getKeyCode() == KeyEvent.VK_DELETE )
- || (e.getKeyCode() == KeyEvent.VK_CLEAR
- && e.getModifiers() == KeyEvent.CTRL_MASK)){
+ if (e.getKeyCode() == KeyEvent.VK_DELETE
+ || e.getKeyCode() == KeyEvent.VK_CLEAR
+ && e.getModifiers() == KeyEvent.CTRL_MASK) {
handler.deleteSelectedRow();
}
// add entry with the key combination : insert or ctrl + enter
- if ((e.getKeyCode() == KeyEvent.VK_INSERT )
- || (e.getKeyCode() == KeyEvent.VK_ENTER
- && e.getModifiers() == KeyEvent.CTRL_MASK)) {
+ if (e.getKeyCode() == KeyEvent.VK_INSERT
+ || e.getKeyCode() == KeyEvent.VK_ENTER
+ && e.getModifiers() == KeyEvent.CTRL_MASK) {
handler.addEmptyEntry();
}
-
+
// clear row selection with the key: escape
if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
- if (!this.isEditing()) {
- this.clearSelection();
- }
+ if (!isEditing()) {
+ clearSelection();
+ }
}
/**
@@ -190,21 +187,21 @@
* Ajoute une entrée comptable si tab est sur
* la dernière cellule.
*/
-
+
//TODO 2010-08-19 verifier si la transaction est équilibré
// cf. FinancialTransactionTable.java comme modèle
if (e.getKeyChar() == KeyEvent.VK_TAB) {
// Vérifie si la cellule sélectionnée est la dernière
- int x = this.getSelectedColumn();
- int y = this.getSelectedRow();
- int max_x = this.getColumnCount() - 1;
- int max_y = this.getRowCount() - 1;
+ int x = getSelectedColumn();
+ int y = getSelectedRow();
+ int max_x = getColumnCount() - 1;
+ int max_y = getRowCount() - 1;
if (x == max_x && y == max_y) {
- handler.addEmptyEntry();
+ handler.addEmptyEntry();
// positionne la sélection sur la nouvelle ligne créée
- this.setColumnSelectionInterval(0, 0);
- this.setRowSelectionInterval(max_y + 1, max_y + 1);
+ setColumnSelectionInterval(0, 0);
+ setRowSelectionInterval(max_y + 1, max_y + 1);
}
}
@@ -215,7 +212,7 @@
*/
@Override
public void keyTyped(KeyEvent e) {
-
+
}
@Override
@@ -228,8 +225,8 @@
@Override
public void mousePressed(MouseEvent e) {
- if (this.rowAtPoint(e.getPoint()) == -1) {
- this.clearSelection();
+ if (rowAtPoint(e.getPoint()) == -1) {
+ clearSelection();
}
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTableModel.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTableModel.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -42,13 +42,6 @@
package org.chorem.lima.ui.financialtransactionunbalanced;
-import static org.nuiton.i18n.I18n._;
-import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Date;
-import java.util.List;
-import javax.swing.table.AbstractTableModel;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.FinancialTransactionServiceMonitorable;
@@ -66,19 +59,28 @@
import org.chorem.lima.util.DialogHelper;
import org.chorem.lima.util.ErrorHelper;
+import javax.swing.table.AbstractTableModel;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
+
+import static org.nuiton.i18n.I18n._;
+
/**
* Basic transaction table model.
- *
+ * <p/>
* Le modele est filtré sur {@link #selectedFiscalPeriod}(montée en charge !).
- *
+ *
* @author ore
* @author chatellier
* @version $Revision$
- *
- * Last update : $Date$
- * By : $Author$
+ * <p/>
+ * Last update : $Date$
+ * By : $Author$
*/
-public class FinancialTransactionUnbalancedTableModel extends AbstractTableModel implements ServiceListener{
+public class FinancialTransactionUnbalancedTableModel extends AbstractTableModel implements ServiceListener {
/** serialVersionUID. */
private static final long serialVersionUID = 3914954536809622358L;
@@ -89,61 +91,60 @@
/** Transaction service. */
protected final FinancialTransactionServiceMonitorable financialTransactionService;
-
+
/** selected financial period */
protected FiscalPeriod selectedFiscalPeriod;
-
+
/** data cache */
protected List<Object> cacheDataList;
-
- /** collection
-
/**
+ * collection
+ * <p/>
+ * <p/>
+ * /**
* Model constructor.
- *
+ * <p/>
* Just init service proxies.
*/
public FinancialTransactionUnbalancedTableModel() {
/* Services */
financialTransactionService =
- LimaServiceFactory.getInstance().getService(
- FinancialTransactionServiceMonitorable.class);
- financialTransactionService.addListener(this);
+ LimaServiceFactory.getInstance().getService(
+ FinancialTransactionServiceMonitorable.class);
+ financialTransactionService.addServiceListener(this);
}
/**
* Le model est une combinaison de Transaction/Entries.
- *
- *
+ *
* @return
*/
protected List<Object> getDataList() {
List<Object> results = new ArrayList<Object>();
- if(selectedFiscalPeriod != null){
+ if (selectedFiscalPeriod != null) {
try {
List<FinancialTransaction> financialtransactions =
- financialTransactionService.getAllInexactFinancialTransactions(selectedFiscalPeriod);
+ financialTransactionService.getAllInexactFinancialTransactions(selectedFiscalPeriod);
for (FinancialTransaction financialtransaction : financialtransactions) {
results.add(financialtransaction);
List<Entry> entries = (List<Entry>) financialtransaction.getEntry();
Collections.sort(entries, new EntryComparator());
results.addAll(entries);
}
- }
- catch (LimaException eee) {
+ } catch (LimaException eee) {
if (log.isErrorEnabled()) {
- log.debug("Can't update model", eee);
+ log.error("Can't update model", eee);
}
-
+
ErrorHelper.showErrorDialog("Can't get transaction list", eee);
- }
+ }
}
-
+
return results;
}
-
- public void refresh(){
+
+ public void refresh() {
cacheDataList = getDataList();
fireTableDataChanged();
}
@@ -159,33 +160,33 @@
Class<?> result = null;
switch (column) {
- case 0:
- result = Date.class;
- break;
- case 1:
- result = EntryBook.class;
- break;
- case 2:
- result = String.class;
- break;
- case 3:
- result = Account.class;
- break;
- case 4:
- result = String.class;
- break;
- case 5:
- result = BigDecimal.class;
- break;
- case 6:
- result = BigDecimal.class;
- break;
- case 7:
- result = BigDecimal.class;
- break;
- case 8:
- result = Letter.class;
- break;
+ case 0:
+ result = Date.class;
+ break;
+ case 1:
+ result = EntryBook.class;
+ break;
+ case 2:
+ result = String.class;
+ break;
+ case 3:
+ result = Account.class;
+ break;
+ case 4:
+ result = String.class;
+ break;
+ case 5:
+ result = BigDecimal.class;
+ break;
+ case 6:
+ result = BigDecimal.class;
+ break;
+ case 7:
+ result = BigDecimal.class;
+ break;
+ case 8:
+ result = Letter.class;
+ break;
}
return result;
@@ -196,33 +197,33 @@
String result = "n/a";
switch (column) {
- case 0:
- result = _("lima.table.date");
- break;
- case 1:
- result = _("lima.table.entrybook");
- break;
- case 2:
- result = _("lima.table.voucher");
- break;
- case 3:
- result = _("lima.table.account");
- break;
- case 4:
- result = _("lima.table.description");
- break;
- case 5:
- result = _("lima.table.debit");
- break;
- case 6:
- result = _("lima.table.credit");
- break;
- case 7:
- result = _("lima.table.balance");
- break;
- case 8:
- result = _("lima.table.letter");
- break;
+ case 0:
+ result = _("lima.table.date");
+ break;
+ case 1:
+ result = _("lima.table.entrybook");
+ break;
+ case 2:
+ result = _("lima.table.voucher");
+ break;
+ case 3:
+ result = _("lima.table.account");
+ break;
+ case 4:
+ result = _("lima.table.description");
+ break;
+ case 5:
+ result = _("lima.table.debit");
+ break;
+ case 6:
+ result = _("lima.table.credit");
+ break;
+ case 7:
+ result = _("lima.table.balance");
+ break;
+ case 8:
+ result = _("lima.table.letter");
+ break;
}
return result;
@@ -231,7 +232,7 @@
@Override
public int getRowCount() {
int result = 0;
-
+
// just prevent too much result
if (cacheDataList != null) {
result = cacheDataList.size();
@@ -243,126 +244,120 @@
@Override
public Object getValueAt(int row, int column) {
Object result = null;
-
+
// just prevent too much result
if (cacheDataList != null) {
result = cacheDataList.get(row);
-
+
if (result instanceof FinancialTransaction) {
- FinancialTransaction currentRow = (FinancialTransaction)result;
+ FinancialTransaction currentRow = (FinancialTransaction) result;
BigDecimal amountDebit = currentRow.getAmountDebit();
BigDecimal amountCredit = currentRow.getAmountCredit();
-
+
switch (column) {
- case 0:
- result = currentRow.getTransactionDate();
- break;
- case 1:
- if (currentRow.getEntryBook() != null){
- result = currentRow.getEntryBook().getCode();
- }
- else {
+ case 0:
+ result = currentRow.getTransactionDate();
+ break;
+ case 1:
+ if (currentRow.getEntryBook() != null) {
+ result = currentRow.getEntryBook().getCode();
+ } else {
+ result = null;
+ }
+ break;
+ case 2:
+ result = null; //entrybook
+ break;
+ case 3:
+ result = null; // account
+ break;
+ case 4:
+ result = null; // description
+ break;
+ case 5:
+ result = amountDebit;
+ break;
+ case 6:
+ result = amountCredit;
+ break;
+ case 7:
+ result = amountDebit.subtract(amountCredit);
+ break;
+ case 8:
result = null;
- }
- break;
- case 2:
- result = null; //entrybook
- break;
- case 3:
- result = null; // account
- break;
- case 4:
- result = null; // description
- break;
- case 5 :
- result = amountDebit;
- break;
- case 6:
- result = amountCredit;
- break;
- case 7:
- result = amountDebit.subtract(amountCredit);
- break;
- case 8:
- result = null;
- break;
+ break;
}
- }
- else if (result instanceof Entry) {
- Entry currentEntry = (Entry)result;
+ } else if (result instanceof Entry) {
+ Entry currentEntry = (Entry) result;
switch (column) {
- case 0:
- result = null; // date
- break;
- case 1 : // entry book
- result = null;
- break;
- case 2:
- result = currentEntry.getVoucher();
- break;
- case 3: // account
- if (currentEntry.getAccount() != null){
- result = currentEntry.getAccount().getAccountNumber();
- }
- else {
+ case 0:
+ result = null; // date
+ break;
+ case 1: // entry book
result = null;
- }
- break;
- case 4:
- result = currentEntry.getDescription();
- break;
- case 5 :
- result = currentEntry.getDebit() ? currentEntry.getAmount() : BigDecimal.ZERO;
- break;
- case 6:
- result = currentEntry.getDebit() ? BigDecimal.ZERO : currentEntry.getAmount();
- break;
- case 7:
- result = null;
- break;
- case 8:
- if (currentEntry.getLetter() != null){
- result = currentEntry.getLetter().getCode();
- }
- else {
+ break;
+ case 2:
+ result = currentEntry.getVoucher();
+ break;
+ case 3: // account
+ if (currentEntry.getAccount() != null) {
+ result = currentEntry.getAccount().getAccountNumber();
+ } else {
+ result = null;
+ }
+ break;
+ case 4:
+ result = currentEntry.getDescription();
+ break;
+ case 5:
+ result = currentEntry.getDebit() ? currentEntry.getAmount() : BigDecimal.ZERO;
+ break;
+ case 6:
+ result = currentEntry.getDebit() ? BigDecimal.ZERO : currentEntry.getAmount();
+ break;
+ case 7:
result = null;
- }
- break;
+ break;
+ case 8:
+ if (currentEntry.getLetter() != null) {
+ result = currentEntry.getLetter().getCode();
+ } else {
+ result = null;
+ }
+ break;
}
-
+
}
}
-
+
return result;
}
-
- public void setFiscalPeriod(FiscalPeriod fiscalPeriod){
+
+ public void setFiscalPeriod(FiscalPeriod fiscalPeriod) {
selectedFiscalPeriod = fiscalPeriod;
}
-
+
/**
* To set cells editable or not
* different condition for entry or financial transaction
*/
@Override
public boolean isCellEditable(int rowIndex, int columnIndex) {
- boolean editableCell=false;
+ boolean editableCell = false;
Object currentRow = cacheDataList.get(rowIndex);
// cells editable for the entry row, all cells exclude the date
- if ((currentRow instanceof Entry) && !((columnIndex==0) || (columnIndex==1))) {
- editableCell=true;
+ if (currentRow instanceof Entry && !(columnIndex == 0 || columnIndex == 1)) {
+ editableCell = true;
}
// cells editable for the financialtransaction row, no cells exclude the date
- if ((currentRow instanceof FinancialTransaction) && ((columnIndex==0) || (columnIndex==1))){
- editableCell=true;
+ if (currentRow instanceof FinancialTransaction && (columnIndex == 0 || columnIndex == 1)) {
+ editableCell = true;
}
return editableCell;
}
-
-
+
/**
- *
* @param value
* @param description
* @param row
@@ -379,10 +374,9 @@
}
//check if current row is a transaction or an entry
if (currentRow instanceof FinancialTransaction) {
- currentTransaction = (FinancialTransaction)currentRow;
- }
- else if (currentRow instanceof Entry) {
- Entry currentEntry = (Entry)currentRow;
+ currentTransaction = (FinancialTransaction) currentRow;
+ } else if (currentRow instanceof Entry) {
+ Entry currentEntry = (Entry) currentRow;
//get back the parent transaction of the entry
currentTransaction = currentEntry.getFinancialTransaction();
}
@@ -394,118 +388,116 @@
fireTableRowsInserted(row, row);
return newrow;
}
-
- /**
- * to modifiy financialtransaction or entry
- */
+
+ /** to modifiy financialtransaction or entry */
@Override
public void setValueAt(Object value, int row, int column) {
- int financialTransactionRow=0;
+ int financialTransactionRow = 0;
// just prevent too much result
if (selectedFiscalPeriod != null) {
Object currentRow = cacheDataList.get(row);
if (currentRow instanceof FinancialTransaction) {
FinancialTransaction currentFinancialTransaction =
- (FinancialTransaction)currentRow;
+ (FinancialTransaction) currentRow;
switch (column) {
- case 0:
- //update
- currentFinancialTransaction.setTransactionDate((Date)value);
- break;
- case 1 :
- currentFinancialTransaction.setEntryBook((EntryBook)value);
- break;
+ case 0:
+ //update
+ currentFinancialTransaction.setTransactionDate((Date) value);
+ break;
+ case 1:
+ currentFinancialTransaction.setEntryBook((EntryBook) value);
+ break;
}
// notify service for modification
try {
financialTransactionService.
- updateFinancialTransaction(currentFinancialTransaction);
+ updateFinancialTransaction(currentFinancialTransaction);
} catch (LimaException eee) {
- if (log.isDebugEnabled()){
+ if (log.isDebugEnabled()) {
log.debug("Can't update financial transaction", eee);
}
DialogHelper.showMessageDialog(eee.getMessage());
}
- //update the financial transaction in entire
- financialTransactionRow =
- cacheDataList.indexOf(((FinancialTransaction) currentRow));
- }
- else if (currentRow instanceof Entry) {
- Entry currentEntry = (Entry)currentRow;
+ //update the financial transaction in entire
+ financialTransactionRow =
+ cacheDataList.indexOf(currentRow);
+ } else if (currentRow instanceof Entry) {
+ Entry currentEntry = (Entry) currentRow;
switch (column) {
- case 2 :
- currentEntry.setVoucher((String)value);
- break;
- case 3:
- currentEntry.setAccount((Account)value);
- break;
- case 4:
- currentEntry.setDescription((String)value);
- break;
- case 5 :
- currentEntry.setAmount((BigDecimal) value);
- currentEntry.setDebit(true);
- break;
- case 6:
- currentEntry.setAmount((BigDecimal) value);
- currentEntry.setDebit(false);
- break;
- case 8:
- currentEntry.setLetter((Letter)value);
- break;
+ case 2:
+ currentEntry.setVoucher((String) value);
+ break;
+ case 3:
+ currentEntry.setAccount((Account) value);
+ break;
+ case 4:
+ currentEntry.setDescription((String) value);
+ break;
+ case 5:
+ currentEntry.setAmount((BigDecimal) value);
+ currentEntry.setDebit(true);
+ break;
+ case 6:
+ currentEntry.setAmount((BigDecimal) value);
+ currentEntry.setDebit(false);
+ break;
+ case 8:
+ currentEntry.setLetter((Letter) value);
+ break;
}
try {
financialTransactionService.updateEntry(currentEntry);
} catch (LimaException eee) {
- if (log.isDebugEnabled()){
+ if (log.isDebugEnabled()) {
log.debug("Can't update entry", eee);
}
DialogHelper.showMessageDialog(eee.getMessage());
}
//update the financial transaction in entire
- financialTransactionRow =
- cacheDataList.indexOf(((Entry) currentRow).
- getFinancialTransaction());
+ financialTransactionRow =
+ cacheDataList.indexOf(((Entry) currentRow).
+ getFinancialTransaction());
}
//on recharge la liste
cacheDataList = getDataList();
fireTableDataChanged();
}
}
-
- public Object getElementAt(int row){
-
+
+ public Object getElementAt(int row) {
+
Object currentRow = cacheDataList.get(row);
return currentRow;
}
-
+
/**
* Delete selected row in table (could be transaction or entry).
- *
+ * <p/>
* Called by model.
- * @param Object, int
- * @throws LimaException
+ *
+ * @param object
+ * @param row
+ * @throws LimaException
*/
public void removeObject(Object object, int row) throws LimaException {
Object currentRow = cacheDataList.get(row);
if (currentRow instanceof FinancialTransaction) {
FinancialTransaction currentTransaction =
- (FinancialTransaction)currentRow;
+ (FinancialTransaction) currentRow;
financialTransactionService.removeFinancialTransaction(currentTransaction);
- }
- else if (currentRow instanceof Entry) {
- Entry currentEntry = (Entry)currentRow;
+ } else if (currentRow instanceof Entry) {
+ Entry currentEntry = (Entry) currentRow;
financialTransactionService.removeEntry(currentEntry);
}
//on recharge la liste
refresh();
}
-
+
@Override
public void notifyMethod(String serviceName, String methodeName) {
- if (serviceName.contains("FinancialTransaction") || methodeName.contains("importEntries") || methodeName.contains("importAll")){
+ if (serviceName.contains("FinancialTransaction") || methodeName.contains("importEntries") || methodeName.contains("importAll")) {
refresh();
}
- }
+ }
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedViewHandler.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedViewHandler.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -25,12 +25,6 @@
package org.chorem.lima.ui.financialtransactionunbalanced;
-import static org.nuiton.i18n.I18n._;
-
-
-import javax.swing.JOptionPane;
-import javax.swing.ListSelectionModel;
-
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.LimaException;
@@ -38,37 +32,42 @@
import org.chorem.lima.ui.combobox.FiscalPeriodComboBoxModel;
import org.chorem.lima.util.DialogHelper;
+import javax.swing.JOptionPane;
+import javax.swing.ListSelectionModel;
+
+import static org.nuiton.i18n.I18n._;
+
/**
* Handler associated with financial transaction view.
- *
+ *
* @author chatellier
* @version $Revision$
- *
- * Last update : $Date$
- * By : $Author$
+ * <p/>
+ * Last update : $Date$
+ * By : $Author$
*/
public class FinancialTransactionUnbalancedViewHandler {
/** log. */
private static final Log log =
- LogFactory.getLog(FinancialTransactionUnbalancedViewHandler.class);
+ LogFactory.getLog(FinancialTransactionUnbalancedViewHandler.class);
protected FinancialTransactionUnbalancedView view;
-
+
protected FinancialTransactionUnbalancedTable table;
-
+
protected FinancialTransactionUnbalancedTableModel tableModel;
-
+
protected FiscalPeriodComboBoxModel comboBoxModel;
protected FinancialTransactionUnbalancedViewHandler(FinancialTransactionUnbalancedView view) {
this.view = view;
- }
-
+ }
+
//implement new transaction button
//add a new entry to the selected transaction
- public void addEmptyEntry(){
-
+ public void addEmptyEntry() {
+
table = view.getFinancialTransactionUnbalancedTable();
tableModel = view.getFinancialTransactionUnbalancedTableModel();
@@ -76,38 +75,38 @@
if (indexSelectedRow != -1) {
Object selectedValue = tableModel.getElementAt(indexSelectedRow);
try {
- //copy + paste the description
+ //copy + paste the description
String description = (String) tableModel.getValueAt(indexSelectedRow, 4);
int index = tableModel.addEmptyEntry(selectedValue, description, indexSelectedRow);
//select the new line
- ListSelectionModel selectionModel =
- table.getSelectionModel();
- selectionModel.setSelectionInterval(indexSelectedRow+1, indexSelectedRow+1);
- //focus on second column
- table.changeSelection(index, 1, false, false);
- table.requestFocusInWindow();
- } catch (LimaException eee){
+ ListSelectionModel selectionModel =
+ table.getSelectionModel();
+ selectionModel.setSelectionInterval(indexSelectedRow + 1, indexSelectedRow + 1);
+ //focus on second column
+ table.changeSelection(index, 1, false, false);
+ table.requestFocusInWindow();
+ } catch (LimaException eee) {
if (log.isErrorEnabled()) {
log.error("Can't add emptyentry", eee);
}
- DialogHelper.showMessageDialog(eee.getMessage());
+ DialogHelper.showErrorMessageDialog(view, eee);
}
- }
- else {
+ } else {
if (log.isWarnEnabled()) {
log.warn("Call addentry selected transaction without selection");
}
}
}
-
+
/**
* Delete selected row in table (could be transaction or entry).
- *
+ * <p/>
* Called by tableModel.
- * @throws LimaException
+ *
+ * @throws LimaException
*/
- public void deleteSelectedRow(){
+ public void deleteSelectedRow() {
table = view.getFinancialTransactionUnbalancedTable();
tableModel = view.getFinancialTransactionUnbalancedTableModel();
@@ -116,44 +115,42 @@
if (indexSelectedRow != -1) {
Object selectedValue = tableModel.getElementAt(indexSelectedRow);
- String message = null;
+ String message;
if (selectedValue instanceof FinancialTransaction) {
message = _("lima.charts.financialtransaction.question.removetransaction");
- }
- else {
+ } else {
message = _("lima.charts.financialtransaction.question.removeentry");
}
int response = JOptionPane.showConfirmDialog(view, message,
- _("lima.common.confirmation"), JOptionPane.YES_NO_OPTION);
+ _("lima.common.confirmation"), JOptionPane.YES_NO_OPTION);
if (response == JOptionPane.YES_OPTION) {
-
+
try {
tableModel.removeObject(selectedValue, indexSelectedRow);
//select the upper line
- ListSelectionModel selectionModel =
- table.getSelectionModel();
- selectionModel.setSelectionInterval(indexSelectedRow-1, indexSelectedRow-1);
+ ListSelectionModel selectionModel =
+ table.getSelectionModel();
+ selectionModel.setSelectionInterval(indexSelectedRow - 1, indexSelectedRow - 1);
} catch (LimaException eee) {
if (log.isErrorEnabled()) {
log.error("Can't remove transaction or entry", eee);
}
- DialogHelper.showMessageDialog(eee.getMessage());
+ DialogHelper.showErrorMessageDialog(view, eee);
}
}
- }
- else {
+ } else {
if (log.isWarnEnabled()) {
log.warn("Call delete selected row without selection");
}
}
}
-
- public void refresh(){
+
+ public void refresh() {
tableModel = view.getFinancialTransactionUnbalancedTableModel();
tableModel.refresh();
-
+
comboBoxModel = view.getModelFiscalPeriod();
comboBoxModel.refresh();
}
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 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodTable.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -70,7 +70,7 @@
ComponentAdapter adapter) {
FiscalPeriod fiscalPeriod = (FiscalPeriod) model.getElementAt(adapter.row);
// true if locked
- return (fiscalPeriod.getLocked());
+ return fiscalPeriod.getLocked();
}
};
colorTransaction =
@@ -84,8 +84,8 @@
@Override
public void mousePressed(MouseEvent e) {
- if (this.rowAtPoint(e.getPoint()) == -1) {
- this.clearSelection();
+ if (rowAtPoint(e.getPoint()) == -1) {
+ clearSelection();
}
}
@@ -113,8 +113,8 @@
public void keyPressed(KeyEvent e) {
// clear row selection with the key: escape
if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
- if (!this.isEditing()) {
- this.clearSelection();
+ if (!isEditing()) {
+ clearSelection();
}
}
}
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 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodTableModel.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -76,13 +76,13 @@
fiscalPeriodService =
LimaServiceFactory.getInstance().getService(
FiscalPeriodServiceMonitorable.class);
- fiscalPeriodService.addListener(this);
+ fiscalPeriodService.addServiceListener(this);
LimaServiceFactory.getInstance().getService(
- ImportServiceMonitorable.class).addListener(this);
+ ImportServiceMonitorable.class).addServiceListener(this);
financialTransactionService =
LimaServiceFactory.getInstance().getService(
FinancialTransactionServiceMonitorable.class);
- financialTransactionService.addListener(this);
+ financialTransactionService.addServiceListener(this);
cacheDataList = null;
}
@@ -199,7 +199,7 @@
}
public FiscalPeriod getFiscalPeriodAtRow(int row) throws LimaException {
- FiscalPeriod fiscalPeriod = null;
+ FiscalPeriod fiscalPeriod;
fiscalPeriod = (FiscalPeriod) cacheDataList.get(row);
return fiscalPeriod;
}
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 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodViewHandler.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -25,16 +25,6 @@
package org.chorem.lima.ui.fiscalperiod;
-import static org.nuiton.i18n.I18n._;
-
-import java.math.BigDecimal;
-import java.util.Collection;
-import java.util.List;
-
-
-import javax.swing.JOptionPane;
-import org.jdesktop.swingx.JXTable;
-import org.nuiton.util.DateUtil;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.FinancialTransactionServiceMonitorable;
@@ -46,10 +36,17 @@
import org.chorem.lima.entity.FinancialTransaction;
import org.chorem.lima.entity.FiscalPeriod;
import org.chorem.lima.service.LimaServiceFactory;
-import org.chorem.lima.ui.fiscalperiod.AddPeriod;
-import org.chorem.lima.ui.fiscalperiod.FiscalPeriodView;
import org.chorem.lima.util.DialogHelper;
+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.
*
@@ -118,7 +115,7 @@
if (log.isErrorEnabled()) {
log.error("Can't add fiscal period", eee);
}
- DialogHelper.showMessageDialog(eee.getMessage());
+ DialogHelper.showErrorMessageDialog(view, eee);
}
}
}
@@ -165,19 +162,21 @@
if (log.isErrorEnabled()) {
log.error("Can't block fiscalperiod", eee);
}
- DialogHelper.showMessageDialog(eee.getMessage());
+ DialogHelper.showErrorMessageDialog(view, eee);
}
}
/**
*
* Sets EntryBook and Date to use
+ * @param selectedFiscalPeriod
+ * @param newyear
*/
public void addRetainedEarnings(FiscalPeriod selectedFiscalPeriod, boolean newyear) {
- JXTable fiscalPeriodeTable = getView().getFiscalPeriodTable();
- int selectedRow = fiscalPeriodeTable.getSelectedRow();
- FiscalPeriodTableModel model =
- (FiscalPeriodTableModel)getView().getFiscalPeriodTable().getModel();
+// JXTable fiscalPeriodeTable = getView().getFiscalPeriodTable();
+// int selectedRow = fiscalPeriodeTable.getSelectedRow();
+// FiscalPeriodTableModel model =
+// (FiscalPeriodTableModel)getView().getFiscalPeriodTable().getModel();
try {
boolean found = false;
List<FinancialTransaction> financialTransactionsList =
@@ -227,7 +226,7 @@
if (log.isErrorEnabled()) {
log.error("Can't set net income", eee);
}
- DialogHelper.showMessageDialog(eee.getMessage());
+ DialogHelper.showErrorMessageDialog(view, 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 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/AccountsPane.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -64,9 +64,9 @@
accountService =
LimaServiceFactory.getInstance().getService(
AccountServiceMonitorable.class);
- accountService.addListener(this);
+ accountService.addServiceListener(this);
LimaServiceFactory.getInstance().getService(
- ImportServiceMonitorable.class).addListener(this);
+ ImportServiceMonitorable.class).addServiceListener(this);
//init
setOpaque(true);
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 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/EntryBooksPane.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -62,9 +62,9 @@
entryBookService =
LimaServiceFactory.getInstance().getService(
EntryBookServiceMonitorable.class);
- entryBookService.addListener(this);
+ entryBookService.addServiceListener(this);
LimaServiceFactory.getInstance().getService(
- ImportServiceMonitorable.class).addListener(this);
+ ImportServiceMonitorable.class).addServiceListener(this);
//init
setOpaque(true);
@@ -99,7 +99,7 @@
int ebSize = entryBooks.size();
if (ebSize>0){
setBackground(greenBackground);
- String entryBooksString="";
+ String entryBooksString;
if (ebSize == 1){
entryBooksString = _("lima.home.entrybooks.state.single")
+ "<br/>" + entryBooks.get(0).getLabel()
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 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/FinancialTransactionsPane.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -64,12 +64,12 @@
financialTransactionService =
LimaServiceFactory.getInstance().getService(FinancialTransactionServiceMonitorable.class);
- financialTransactionService.addListener(this);
+ financialTransactionService.addServiceListener(this);
fiscalPeriodService =
LimaServiceFactory.getInstance().getService(FiscalPeriodServiceMonitorable.class);
- fiscalPeriodService.addListener(this);
+ fiscalPeriodService.addServiceListener(this);
LimaServiceFactory.getInstance().getService(
- ImportServiceMonitorable.class).addListener(this);
+ ImportServiceMonitorable.class).addServiceListener(this);
//init
setOpaque(true);
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 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/FiscalPeriodsPane.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -61,9 +61,9 @@
fiscalPeriodService =
LimaServiceFactory.getInstance().getService(FiscalPeriodServiceMonitorable.class);
- fiscalPeriodService.addListener(this);
+ fiscalPeriodService.addServiceListener(this);
LimaServiceFactory.getInstance().getService(
- ImportServiceMonitorable.class).addListener(this);
+ ImportServiceMonitorable.class).addServiceListener(this);
//init
setOpaque(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 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -25,8 +25,26 @@
package org.chorem.lima.ui.importexport;
-import static org.nuiton.i18n.I18n._;
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.chorem.lima.business.ExportServiceMonitorable;
+import org.chorem.lima.business.ImportServiceMonitorable;
+import org.chorem.lima.business.LimaException;
+import org.chorem.lima.business.utils.ImportExportEntityEnum;
+import org.chorem.lima.enums.EncodingEnum;
+import org.chorem.lima.enums.ImportExportEnum;
+import org.chorem.lima.service.LimaServiceFactory;
+import org.chorem.lima.ui.account.AccountViewHandler;
+import org.chorem.lima.util.DialogHelper;
+import org.jdesktop.swingx.painter.BusyPainter;
+import javax.swing.JComboBox;
+import javax.swing.JFileChooser;
+import javax.swing.JLabel;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.SwingWorker;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
@@ -43,27 +61,8 @@
import java.io.StringWriter;
import java.util.concurrent.ExecutionException;
-import javax.swing.JComboBox;
-import javax.swing.JFileChooser;
-import javax.swing.JLabel;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.SwingWorker;
+import static org.nuiton.i18n.I18n._;
-import org.apache.commons.io.IOUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.chorem.lima.business.ExportServiceMonitorable;
-import org.chorem.lima.business.ImportServiceMonitorable;
-import org.chorem.lima.business.LimaException;
-import org.chorem.lima.business.utils.ImportExportEntityEnum;
-import org.chorem.lima.enums.EncodingEnum;
-import org.chorem.lima.enums.ImportExportEnum;
-import org.chorem.lima.service.LimaServiceFactory;
-import org.chorem.lima.ui.account.AccountViewHandler;
-import org.chorem.lima.util.DialogHelper;
-import org.jdesktop.swingx.painter.BusyPainter;
-
public class ImportExport {
private static ImportExport exchanger;
@@ -119,7 +118,7 @@
final Boolean importMode = importExportMethode.getImportMode();
new SwingWorker<String,Void>() {
@Override protected String doInBackground() throws LimaException {
- String datas = "";
+ String datas;
String result = "";
switch (importExportMethodeF) {
case CSV_ALL_EXPORT:
@@ -177,7 +176,7 @@
_("lima.importexport.usevatpdf"),
_("lima.common.confirmation"), JOptionPane.YES_NO_OPTION);
datas = extractFile(filePath, charset.getEncoding());
- result = importService.importAsPDF(filePath, ImportExportEntityEnum.VATPDF, (response == JOptionPane.YES_OPTION));
+ result = importService.importAsPDF(filePath, ImportExportEntityEnum.VATPDF, response == JOptionPane.YES_OPTION);
break;
case EBP_ACCOUNTCHARTS_IMPORT:
//For windows ebp
@@ -309,7 +308,7 @@
StringWriter sw = new StringWriter();
BufferedReader in = null;
try {
- InputStream is = null;
+ InputStream is;
// FIXME echatellier 20101129 remove this hack and modify resources reading mecanism
if (filePath != null && filePath.indexOf(".jar!") > 0) {
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerPeriodSearchPanel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerPeriodSearchPanel.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerPeriodSearchPanel.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -100,12 +100,12 @@
handler.setEndDate(endDatePicker.getDate());
endDatePicker.addActionListener(endDateActionListener);
handler.refresh();
-
- this.removeAll();
- this.add(beginDateLabel);
- this.add(beginDatePicker);
- this.add(endDateLabel);
- this.add(endDatePicker);
+
+ removeAll();
+ add(beginDateLabel);
+ add(beginDatePicker);
+ add(endDateLabel);
+ add(endDatePicker);
break;
case FISCAL_PERIOD:
@@ -127,8 +127,8 @@
};
fiscalPeriod.addActionListener(fiscalPeriodActionListener);
- this.removeAll();
- this.add(fiscalPeriod);
+ removeAll();
+ add(fiscalPeriod);
break;
case FINANCIAL_PERIOD:
@@ -149,8 +149,8 @@
}
};
financialPeriod.addActionListener(financialPeriodActionListener);
- this.removeAll();
- this.add(financialPeriod);
+ removeAll();
+ add(financialPeriod);
break;
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerTable.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerTable.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerTable.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -86,7 +86,7 @@
@Override
public boolean isHighlighted(Component renderer,
ComponentAdapter adapter) {
- return (adapter.getValueAt(adapter.row, 0) != null);
+ return adapter.getValueAt(adapter.row, 0) != null;
}
};
colorReportsDatas =
@@ -100,8 +100,8 @@
@Override
public void mousePressed(MouseEvent e) {
- if (this.rowAtPoint(e.getPoint()) == -1) {
- this.clearSelection();
+ if (rowAtPoint(e.getPoint()) == -1) {
+ clearSelection();
}
}
@@ -129,8 +129,8 @@
public void keyPressed(KeyEvent e) {
// clear row selection with the key: escape
if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
- if (!this.isEditing()) {
- this.clearSelection();
+ if (!isEditing()) {
+ clearSelection();
}
}
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerTableModel.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerTableModel.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -38,7 +38,6 @@
import org.chorem.lima.entity.Account;
import org.chorem.lima.entity.Entry;
import org.chorem.lima.entity.EntryBook;
-import org.chorem.lima.entity.Letter;
/**
* Entry book table model.
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerViewHandler.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerViewHandler.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -103,7 +103,7 @@
reportService =
LimaServiceFactory.getInstance().getService(
ReportServiceMonitorable.class);
- reportService.addListener(this);
+ reportService.addServiceListener(this);
port = LimaServiceFactory.getInstance().getService(
HttpServerServiceMonitorable.class).getHttpPort();
documentService =
@@ -113,9 +113,9 @@
LimaServiceFactory.getInstance().getService(
FiscalPeriodServiceMonitorable.class);
LimaServiceFactory.getInstance().getService(
- ImportServiceMonitorable.class).addListener(this);
+ ImportServiceMonitorable.class).addServiceListener(this);
LimaServiceFactory.getInstance().getService(
- FinancialTransactionServiceMonitorable.class).addListener(this);
+ FinancialTransactionServiceMonitorable.class).addServiceListener(this);
}
public void setBeginDate(Date date){
@@ -144,7 +144,7 @@
if (balanceTrialCache.getReportsDatas() != null){
for (ReportsDatas reportsDatas : balanceTrialCache.getReportsDatas()) {
results.add(reportsDatas);
- List<Entry> entries = (List<Entry>) reportsDatas.getListEntry();
+ List<Entry> entries = reportsDatas.getListEntry();
if (entries != null){
Collections.sort(entries, new EntryComparator());
results.addAll(entries);
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringPeriodSearchPanel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringPeriodSearchPanel.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringPeriodSearchPanel.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -1,27 +1,27 @@
-/*
- * #%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%
- */
+/*
+ * #%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.lettering;
import java.awt.event.ActionEvent;
@@ -100,12 +100,12 @@
handler.setEndDate(endDatePicker.getDate());
endDatePicker.addActionListener(endDateActionListener);
handler.refresh();
-
- this.removeAll();
- this.add(beginDateLabel);
- this.add(beginDatePicker);
- this.add(endDateLabel);
- this.add(endDatePicker);
+
+ removeAll();
+ add(beginDateLabel);
+ add(beginDatePicker);
+ add(endDateLabel);
+ add(endDatePicker);
break;
case FISCAL_PERIOD:
@@ -127,8 +127,8 @@
};
fiscalPeriod.addActionListener(fiscalPeriodActionListener);
- this.removeAll();
- this.add(fiscalPeriod);
+ removeAll();
+ add(fiscalPeriod);
break;
case FINANCIAL_PERIOD:
@@ -149,8 +149,8 @@
}
};
financialPeriod.addActionListener(financialPeriodActionListener);
- this.removeAll();
- this.add(financialPeriod);
+ removeAll();
+ add(financialPeriod);
break;
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTable.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTable.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTable.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -172,8 +172,8 @@
// clear row selection with the key: escape
if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
- if (!this.isEditing()) {
- this.clearSelection();
+ if (!isEditing()) {
+ clearSelection();
}
}
@@ -195,8 +195,8 @@
@Override
public void mousePressed(MouseEvent e) {
- if (this.rowAtPoint(e.getPoint()) == -1) {
- this.clearSelection();
+ if (rowAtPoint(e.getPoint()) == -1) {
+ clearSelection();
}
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTableModel.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTableModel.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -99,9 +99,9 @@
financialTransactionService =
LimaServiceFactory.getInstance().getService(
FinancialTransactionServiceMonitorable.class);
- financialTransactionService.addListener(this);
+ financialTransactionService.addServiceListener(this);
LimaServiceFactory.getInstance().getService(
- ImportServiceMonitorable.class).addListener(this);
+ ImportServiceMonitorable.class).addServiceListener(this);
}
public void setSelectedBeginDate(Date date) {
@@ -379,7 +379,7 @@
boolean editableCell=false;
Object currentRow = cacheDataList.get(rowIndex);
// cells editable for the entry row, all cells exclude the date
- if ((currentRow instanceof Entry) && ((columnIndex==5))) {
+ if (currentRow instanceof Entry && columnIndex==5) {
editableCell=true;
}
return editableCell; }
Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/renderers/RendererUtil.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/renderers/RendererUtil.java (rev 0)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/renderers/RendererUtil.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -0,0 +1,31 @@
+package org.chorem.lima.ui.renderers;
+
+import jaxx.runtime.swing.renderer.DecoratorListCellRenderer;
+import jaxx.runtime.swing.renderer.DecoratorProviderListCellRenderer;
+import org.chorem.lima.LimaContext;
+import org.nuiton.util.decorator.Decorator;
+import org.nuiton.util.decorator.DecoratorProvider;
+
+import javax.swing.ListCellRenderer;
+
+/**
+ * Helper class to deal with renderers.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.5.2
+ */
+public class RendererUtil {
+
+ public static ListCellRenderer newDecoratorProviderListCellRenderer() {
+ DecoratorProvider decoratorProvider = LimaContext.get().getDecoratorProvider();
+ return new DecoratorProviderListCellRenderer(decoratorProvider);
+ }
+
+ public static ListCellRenderer newDecoratorListCellRenderer(Class<?> type) {
+
+ DecoratorProvider decoratorProvider = LimaContext.get().getDecoratorProvider();
+ Decorator<?> decorator = decoratorProvider.getDecoratorByType(type);
+ return new DecoratorListCellRenderer(decorator);
+ }
+
+}
Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/renderers/RendererUtil.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartTreeTable.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartTreeTable.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartTreeTable.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -105,8 +105,8 @@
@Override
public void mousePressed(MouseEvent e) {
- if (this.rowAtPoint(e.getPoint()) == -1) {
- this.clearSelection();
+ if (rowAtPoint(e.getPoint()) == -1) {
+ clearSelection();
}
}
@@ -134,8 +134,8 @@
public void keyPressed(KeyEvent e) {
// clear row selection with the key: escape
if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
- if (!this.isEditing()) {
- this.clearSelection();
+ if (!isEditing()) {
+ clearSelection();
}
}
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartTreeTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartTreeTableModel.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartTreeTableModel.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -170,7 +170,7 @@
@Override
public boolean isCellEditable(Object node, int column) {
- return ((column == 1) && (isLeaf(node)));
+ return column == 1 && isLeaf(node);
}
@Override
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 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartViewHandler.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -62,7 +62,7 @@
LimaServiceFactory.getInstance().getService(
VatStatementServiceMonitorable.class);
LimaServiceFactory.getInstance().getService(
- ImportServiceMonitorable.class).addListener(this);
+ ImportServiceMonitorable.class).addServiceListener(this);
}
public void addVatStatementMovement(){
@@ -72,7 +72,7 @@
int selectedRow = view.getTreeTable().getSelectedRow();
// get current selection path
- TreePath treePath = null;
+ TreePath treePath;
if (selectedRow == -1) {
treePath = null;
} else {
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportPeriodSearchPanel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportPeriodSearchPanel.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportPeriodSearchPanel.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -103,12 +103,12 @@
handler.tableModel.setEndDate(endDatePicker.getDate());
endDatePicker.addActionListener(endDateActionListener);
handler.refresh();
-
- this.removeAll();
- this.add(beginDateLabel);
- this.add(beginDatePicker);
- this.add(endDateLabel);
- this.add(endDatePicker);
+
+ removeAll();
+ add(beginDateLabel);
+ add(beginDatePicker);
+ add(endDateLabel);
+ add(endDatePicker);
break;
case FISCAL_PERIOD:
@@ -130,8 +130,8 @@
};
fiscalPeriod.addActionListener(fiscalPeriodActionListener);
- this.removeAll();
- this.add(fiscalPeriod);
+ removeAll();
+ add(fiscalPeriod);
break;
case FINANCIAL_PERIOD:
@@ -152,8 +152,8 @@
}
};
financialPeriod.addActionListener(financialPeriodActionListener);
- this.removeAll();
- this.add(financialPeriod);
+ removeAll();
+ add(financialPeriod);
break;
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportTableModel.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportTableModel.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -84,15 +84,15 @@
vatStatementService =
LimaServiceFactory.getInstance().getService(
VatStatementServiceMonitorable.class);
- vatStatementService.addListener(this);
+ vatStatementService.addServiceListener(this);
financialTransactionService =
LimaServiceFactory.getInstance().getService(
FinancialTransactionServiceMonitorable.class);
- financialTransactionService.addListener(this);
+ financialTransactionService.addServiceListener(this);
importService =
LimaServiceFactory.getInstance().getService(
ImportServiceMonitorable.class);
- importService.addListener(this);
+ importService.addServiceListener(this);
//sets autocomplete mode to true on start
autocomplete = "true";
@@ -102,7 +102,7 @@
List<VatStatementAmounts> list = null;
- if ((selectedBeginDate != null ) || (selectedEndDate != null)) {
+ if (selectedBeginDate != null || selectedEndDate != null) {
try {
list = vatStatementService.vatStatementReport(
getBeginDate(),
@@ -195,7 +195,7 @@
result = value.getLabel();
break;
case 1:
- if ((value.getAmount() != null) && (!value.isHeader())) {
+ if (value.getAmount() != null && !value.isHeader()) {
result = value.getAmount();
} else {
result = null;
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportViewHandler.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportViewHandler.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -78,7 +78,7 @@
* Edit VAT document
*/
public void editVat() {
- if ((tableModel.getBeginDate() != null) || (tableModel.getEndDate() != null)){
+ if (tableModel.getBeginDate() != null || tableModel.getEndDate() != null){
String address = LimaConfig.getInstance().getHostAdress();
try {
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/util/DialogHelper.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/util/DialogHelper.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/util/DialogHelper.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -25,43 +25,47 @@
package org.chorem.lima.util;
-import static org.nuiton.i18n.I18n._;
-import java.awt.Component;
+import org.nuiton.util.Resource;
+
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JTextArea;
-import org.nuiton.util.Resource;
+import java.awt.Component;
+import static org.nuiton.i18n.I18n._;
+
/**
* @author ore
- * @author Rémi Chapelet
+ * @author Rémi Chapelet
*/
public class DialogHelper {
public static int showConfirmDialog(String message) {
String[] response = {_("lima.response.yes"), _("lima.response.no")};
return JOptionPane.showOptionDialog(null,
- message,
- _("lima.common.question"),
- JOptionPane.YES_NO_OPTION,
- JOptionPane.QUESTION_MESSAGE,
- null, //do not use a custom Icon
- response, //the titles of buttons
- response[0]); //default button title
+ message,
+ _("lima.common.question"),
+ JOptionPane.YES_NO_OPTION,
+ JOptionPane.QUESTION_MESSAGE,
+ null, //do not use a custom Icon
+ response, //the titles of buttons
+ response[0]); //default button title
}
- /** @deprecated */
- /*
+ /**
* Use instead: JOptionPane.showMessageDialog (String message,String titre,int type)
- *
+ * <p/>
* for e.g:
- * JOptionPane.showMessageDialog(
- view,
- _("lima.importexport.export.terminated"),
- _("lima.importexport.export"),
- JOptionPane.INFORMATION_MESSAGE);
- *
+ * JOptionPane.showMessageDialog(
+ * view,
+ * _("lima.importexport.export.terminated"),
+ * _("lima.importexport.export"),
+ * JOptionPane.INFORMATION_MESSAGE);
+ *
+ * @param message
+ * @deprecated since 0.5, prefer use the method {@link #showErrorMessageDialog(Component, Exception)}
*/
+ @Deprecated
public static void showMessageDialog(String message) {
JFrame f = new JFrame();
f.setIconImage(Resource.getIcon("icons/lima.png").getImage());
@@ -73,13 +77,22 @@
f.dispose();
}
+ public static void showErrorMessageDialog(Component view, Exception e) {
+ JOptionPane.showMessageDialog(
+ view,
+ e.getMessage(),
+ _("lima.common.error"),
+ JOptionPane.ERROR_MESSAGE);
+ }
+
/**
* Permet d'afficher une boite de dialogue.
+ *
* @param message
* @param titre
* @param type
*/
- public static void showMessageDialog (String message,String titre,int type) {
+ public static void showMessageDialog(String message, String titre, int type) {
JFrame f = new JFrame();
f.setIconImage(Resource.getIcon("icons/lima.png").getImage());
JOptionPane.showMessageDialog(
@@ -89,23 +102,24 @@
type);
f.dispose();
}
-
+
/**
* Permet d'afficher une boite de dialogue avec rapport
+ *
* @param message
- * @param titre
- * @param type
+ * @param parent
+ * @param title
*/
- public static void showReportDialog (String message, String title, Component parent) {
+ public static void showReportDialog(String message, String title, Component parent) {
ReportDialogView reportDialogView = new ReportDialogView();
reportDialogView.setIconImage(Resource.getIcon("icons/lima.png").getImage());
- JTextArea textArea = reportDialogView.getTextArea();
+ JTextArea textArea = reportDialogView.getTextArea();
textArea.setText(message);
- reportDialogView.setSize(600,400);
+ reportDialogView.setSize(600, 400);
reportDialogView.setTitle(title);
reportDialogView.setLocationRelativeTo(parent);
reportDialogView.setVisible(true);
}
-
+
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/widgets/JWideComboBox.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/widgets/JWideComboBox.java 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/widgets/JWideComboBox.java 2011-09-17 12:59:34 UTC (rev 3291)
@@ -72,14 +72,13 @@
/** serialVersionUID. */
private static final long serialVersionUID = -6715271536163434385L;
- private boolean layingOut = false;
+ private boolean layingOut;
public JWideComboBox() {
- super();
setUI(new ScrollMetalComboUI());
}
- public JWideComboBox(final Object items[]) {
+ public JWideComboBox(Object items[]) {
super(items);
}
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2011-09-17 12:55:34 UTC (rev 3290)
+++ trunk/pom.xml 2011-09-17 12:59:34 UTC (rev 3291)
@@ -310,10 +310,10 @@
<projectId>lima</projectId>
<!-- customized libs version -->
- <nuitonUtilsVersion>2.2</nuitonUtilsVersion>
+ <nuitonUtilsVersion>2.3</nuitonUtilsVersion>
<eugenePluginVersion>2.3.5</eugenePluginVersion>
- <topiaVersion>2.5.4</topiaVersion>
- <jaxxVersion>2.4.2</jaxxVersion>
+ <topiaVersion>2.6.2-SNAPSHOT</topiaVersion>
+ <jaxxVersion>2.5-SNAPSHOT</jaxxVersion>
<nuitonI18nVersion>2.4.1</nuitonI18nVersion>
<openEjbVersion>3.1.4</openEjbVersion>
<slf4jVersion>1.6.1</slf4jVersion>
@@ -321,6 +321,8 @@
<!-- 1.4 and 1.4.1 breaks jnlp with corrupt jar
<axis.version>1.3</axis.version>-->
+ <jnlpPluginVersion>1.0-beta-2</jnlpPluginVersion>
+
<!-- license to use -->
<license.licenseName>gpl_v3</license.licenseName>
</properties>
@@ -362,6 +364,18 @@
</dependencies>
</plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo.webstart</groupId>
+ <artifactId>webstart-maven-plugin</artifactId>
+ <version>${jnlpPluginVersion}</version>
+ </plugin>
+
+ <plugin>
+ <groupId>org.bluestemsoftware.open.maven.plugin</groupId>
+ <artifactId>launch4j-plugin</artifactId>
+ <version>1.5.0.0</version>
+ </plugin>
+
</plugins>
</pluginManagement>
1
0
17 Sep '11
Author: tchemit
Date: 2011-09-17 14:55:34 +0200 (Sat, 17 Sep 2011)
New Revision: 3290
Url: http://chorem.org/repositories/revision/lima/3290
Log:
utilisation du prefixe sur les constantes g?\195?\169n?\195?\169r?\195?\169es + reformat du code
Modified:
trunk/lima-business/src/main/java/org/chorem/lima/LimaServer.java
trunk/lima-business/src/main/java/org/chorem/lima/business/AccountingRules.java
trunk/lima-business/src/main/java/org/chorem/lima/business/LimaBusinessException.java
trunk/lima-business/src/main/java/org/chorem/lima/business/LimaConfig.java
trunk/lima-business/src/main/java/org/chorem/lima/business/LimaException.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ServiceMonitorable.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/AbstractLimaService.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/DocumentServiceImpl.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/FinancialPeriodServiceImpl.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/FinancialTransactionServiceImpl.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/HttpServerServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ReportServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/VatStatementServiceImpl.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/FinancialTransactionServiceLocal.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/ReportService.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/VatStatementServiceLocal.java
trunk/lima-business/src/main/java/org/chorem/lima/business/migration/DatabaseMigrationClass.java
trunk/lima-business/src/main/java/org/chorem/lima/business/migration/MigrationV0V0_5.java
trunk/lima-business/src/main/java/org/chorem/lima/business/utils/AccountComparator.java
trunk/lima-business/src/main/java/org/chorem/lima/business/utils/AccountEBPComparator.java
trunk/lima-business/src/main/java/org/chorem/lima/business/utils/DocumentsEnum.java
trunk/lima-business/src/main/java/org/chorem/lima/business/utils/EntryComparator.java
trunk/lima-business/src/main/java/org/chorem/lima/business/utils/EntryEBPComparator.java
trunk/lima-business/src/main/java/org/chorem/lima/business/utils/FinancialPeriodComparator.java
trunk/lima-business/src/main/java/org/chorem/lima/business/utils/FiscalPeriodComparator.java
trunk/lima-business/src/main/java/org/chorem/lima/business/utils/FormatsEnum.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/EntryBookServiceImplTest.java
trunk/lima-business/src/test/java/org/chorem/lima/business/FinancialPeriodServiceImplTest.java
trunk/lima-business/src/test/java/org/chorem/lima/business/FiscalPeriodServiceImplTest.java
trunk/lima-business/src/test/java/org/chorem/lima/business/GeneratorTest.java
trunk/lima-business/src/test/java/org/chorem/lima/business/LimaTestConfig.java
Modified: trunk/lima-business/src/main/java/org/chorem/lima/LimaServer.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/LimaServer.java 2011-09-17 12:55:16 UTC (rev 3289)
+++ trunk/lima-business/src/main/java/org/chorem/lima/LimaServer.java 2011-09-17 12:55:34 UTC (rev 3290)
@@ -23,30 +23,29 @@
package org.chorem.lima;
-import java.util.Properties;
+import org.apache.openejb.client.LocalInitialContextFactory;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
+import java.util.Properties;
-import org.apache.openejb.client.LocalInitialContextFactory;
-
/**
* Lima server class.
- *
+ * <p/>
* Starts openejb server.
- *
+ *
* @author chatellier
* @version $Revision$
- *
- * Last update : $Date$
- * By : $Author$
+ * <p/>
+ * Last update : $Date$
+ * By : $Author$
*/
public class LimaServer {
/**
* Lima server.
- *
+ *
* @param args
* @throws NamingException
*/
@@ -69,7 +68,7 @@
properties.wait();
} catch (InterruptedException e) {
e.printStackTrace();
- }
+ }
}
System.out.println("Server shutdown");
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 2011-09-17 12:55:16 UTC (rev 3289)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/AccountingRules.java 2011-09-17 12:55:34 UTC (rev 3290)
@@ -25,7 +25,6 @@
package org.chorem.lima.business;
-import java.util.List;
import org.chorem.lima.entity.Account;
import org.chorem.lima.entity.ClosedPeriodicEntryBook;
import org.chorem.lima.entity.Entry;
@@ -35,56 +34,71 @@
import org.chorem.lima.entity.FiscalPeriod;
import org.nuiton.topia.TopiaContext;
+import java.util.List;
+
/**
* Service for localized rules
+ *
* @author joe
- *
*/
public interface AccountingRules {
-
+
/**
* Accounts rules
+ *
* @param masterAccount
* @param account
* @throws LimaException
*/
void createAccountRules(Account masterAccount, Account account) throws LimaException;
+
void createSubLedgerRules(Account masterAccount, 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
+ *
* @param entryBook
* @param topiaTransaction
* @throws LimaException
*/
void removeEntryBookRules(EntryBook entryBook, TopiaContext topiaTransaction) throws LimaException;
-
+
/**
* Fiscal Period rules
+ *
* @param fiscalPeriod
* @param transaction
* @throws LimaException
*/
List<FinancialPeriod> createFiscalPeriodRules(FiscalPeriod fiscalPeriod, TopiaContext transaction) throws LimaException;
+
void blockFiscalPeriodRules(FiscalPeriod fiscalPeriod, TopiaContext transaction) throws LimaException;
-
+
/**
* Entry rules
+ *
* @param entry
* @param topiaTransaction
* @throws LimaException
*/
- void updateEntryRules(Entry entry, Entry entryOld, TopiaContext topiaTransaction) throws LimaException;
+ void updateEntryRules(Entry entry, Entry entryOld, TopiaContext topiaTransaction) throws LimaException;
+
void updateFinancialTransactionDateRules(FinancialTransaction financialTransaction, FinancialTransaction financialTransactionOld, TopiaContext topiaContext) throws LimaException;
+
/**
* Financialperiod/entrybook rules
+ *
* @param financialTransaction
* @param topiaContext
* @throws LimaException
*/
void checkFinancialPeriodBlockedWithFinancialTransaction(FinancialTransaction financialTransaction, TopiaContext topiaContext) throws LimaException;
+
void blockClosedPeriodicEntryBookRules(ClosedPeriodicEntryBook closedPeriodicEntryBook, TopiaContext topiaContext) throws LimaException;
}
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/LimaBusinessException.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/LimaBusinessException.java 2011-09-17 12:55:16 UTC (rev 3289)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/LimaBusinessException.java 2011-09-17 12:55:34 UTC (rev 3290)
@@ -28,12 +28,12 @@
/**
* Lima business exception throw by a business service method
* that cannot execute successfully.
- *
+ *
* @author chatellier
* @version $Revision$
- *
- * Last update : $Date$
- * By : $Author$
+ * <p/>
+ * Last update : $Date$
+ * By : $Author$
*/
public class LimaBusinessException extends LimaException {
@@ -42,18 +42,18 @@
/**
* Constructs a new exception with the specified detail message.
- *
+ *
* @param message message
*/
public LimaBusinessException(String message) {
super(message);
}
-
+
/**
* Constructs a new exception with the specified detail message and cause.
- *
+ *
* @param message message
- * @param cause cause
+ * @param cause cause
*/
public LimaBusinessException(String message, Throwable cause) {
super(message, cause);
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 2011-09-17 12:55:16 UTC (rev 3289)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/LimaConfig.java 2011-09-17 12:55:34 UTC (rev 3290)
@@ -43,26 +43,26 @@
/**
* Configuration pour le business.
- *
+ * <p/>
* A voir comment le lier avec celui de lima swing.
- *
+ *
* @author chatellier
* @version $Revision$
- *
- * Last update : $Date$
- * By : $Author$
+ * <p/>
+ * Last update : $Date$
+ * By : $Author$
*/
public class LimaConfig extends ApplicationConfig {
private static final Log log = LogFactory.getLog(LimaConfig.class);
protected static LimaConfig instance;
-
+
protected static final String CONFIGFILE = "lima.properties";
-
+
protected AccountingRules accountingRules;
-
- public LimaConfig(){
+
+ public LimaConfig() {
// set defaut option (included configuration file name : important)
for (Option o : Option.values()) {
setDefaultOption(o.key, o.defaultValue);
@@ -73,7 +73,7 @@
setOption(TopiaMigrationService.MIGRATION_SHOW_SQL, Boolean.TRUE.toString());
setOption(TopiaMigrationService.MIGRATION_SHOW_PROGRESSION, Boolean.TRUE.toString());
}
-
+
public static LimaConfig getInstance() {
if (instance == null) {
instance = new LimaConfig();
@@ -81,14 +81,14 @@
}
return instance;
}
-
+
/**
* instancie la bonne classe de nationalite en fonction du fichier de configuration
- *
+ *
* @return
*/
public AccountingRules getAccountingRules() {
-
+
if (accountingRules == null) {
Class<?> accountingRulesClass = getOptionAsClass(Option.RULES_NATIONALTY.key);
if (accountingRulesClass == null) {
@@ -101,7 +101,7 @@
}
}
}
-
+
return accountingRules;
}
@@ -109,38 +109,38 @@
File datadir = getOptionAsFile(Option.DATA_DIR.getKey());
return datadir;
}
-
- public File getReportsDir(){
+
+ public File getReportsDir() {
File reportsDir = getOptionAsFile(Option.REPORTS_DIR.getKey());
return reportsDir;
}
- public String getAddressServer(){
+ public String getAddressServer() {
String serverAddress = getOption(Option.SERVER_ADRESS.getKey());
return serverAddress;
}
-
- public int getHttpPort(){
+
+ public int getHttpPort() {
String httpPort = getOption(Option.HTTP_PORT.getKey());
Integer port = Integer.valueOf(httpPort);
return port;
}
-
+
public String getScale() {
String scale = getOption(Option.SCALE.getKey());
return scale;
}
-
+
public void setScale(String locale) {
setOption(Option.SCALE.key, locale);
saveForUser();
}
-
+
public String getVatPDFUrl() {
String vatPDFUrl = getOption(Option.VAT_PDF_URL.getKey());
return vatPDFUrl;
}
-
+
public void setVatPDFUrl(String url) {
setOption(Option.VAT_PDF_URL.key, url);
saveForUser();
@@ -148,7 +148,7 @@
/**
* Load configuration with custom file name.
- *
+ *
* @param configFileName file name to read
*/
protected void loadConfiguration(String configFileName) {
@@ -163,10 +163,10 @@
instance.setOption(TopiaContextFactory.CONFIG_PERSISTENCE_CLASSES,
LimaCallaoDAOHelper.getImplementationClassesAsString());
}
-
+
/**
* Lima option definition.
- *
+ * <p/>
* Contains all lima configuration key, with defaut value and
* information for jaxx configuration frame ({@link #type},
* {@link #transientBoolean}, {@link #finalBoolean}...)
@@ -183,14 +183,19 @@
VAT_PDF_URL("lima.report.vatpdfurl", _("lima.config.reportvatpdfurl.description"), "default", String.class, false, false);
private final String key;
+
private final String description;
+
private String defaultValue;
+
private final Class<?> type;
+
private boolean transientBoolean;
+
private boolean finalBoolean;
Option(String key, String description, String defaultValue,
- Class<?> type, boolean transientBoolean, boolean finalBoolean) {
+ Class<?> type, boolean transientBoolean, boolean finalBoolean) {
this.key = key;
this.description = description;
this.defaultValue = defaultValue;
@@ -203,27 +208,27 @@
public boolean isFinal() {
return finalBoolean;
}
-
+
@Override
- public void setFinal(boolean finalBoolean){
- this.finalBoolean=finalBoolean;
+ public void setFinal(boolean finalBoolean) {
+ this.finalBoolean = finalBoolean;
}
@Override
public boolean isTransient() {
return transientBoolean;
}
-
+
@Override
public void setTransient(boolean transientBoolean) {
- this.transientBoolean = transientBoolean;
+ this.transientBoolean = transientBoolean;
}
@Override
public String getDefaultValue() {
return defaultValue;
}
-
+
@Override
public void setDefaultValue(String defaultValue) {
this.defaultValue = defaultValue;
@@ -244,5 +249,5 @@
return type;
}
}
-
+
}
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/LimaException.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/LimaException.java 2011-09-17 12:55:16 UTC (rev 3289)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/LimaException.java 2011-09-17 12:55:34 UTC (rev 3290)
@@ -27,12 +27,12 @@
/**
* Lima exception.
- *
+ *
* @author chatellier
* @version $Revision$
- *
- * Last update : $Date$
- * By : $Author$
+ * <p/>
+ * Last update : $Date$
+ * By : $Author$
*/
public class LimaException extends Exception {
@@ -41,18 +41,18 @@
/**
* Constructs a new exception with the specified detail message.
- *
+ *
* @param message message
*/
public LimaException(String message) {
super(message);
}
-
+
/**
* Constructs a new exception with the specified detail message and cause.
- *
+ *
* @param message message
- * @param cause cause
+ * @param cause cause
*/
public LimaException(String message, Throwable cause) {
super(message, cause);
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ServiceMonitorable.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ServiceMonitorable.java 2011-09-17 12:55:16 UTC (rev 3289)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ServiceMonitorable.java 2011-09-17 12:55:34 UTC (rev 3290)
@@ -26,6 +26,7 @@
package org.chorem.lima.business;
public interface ServiceMonitorable {
- void addListener(ServiceListener l);
- void removeListener(ServiceListener l);
+ void addServiceListener(ServiceListener l);
+
+ void removeServiceListener(ServiceListener l);
}
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 2011-09-17 12:55:16 UTC (rev 3289)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/DefaultAccountingRules.java 2011-09-17 12:55:34 UTC (rev 3290)
@@ -25,11 +25,6 @@
package org.chorem.lima.business.accountingrules;
-import static org.nuiton.i18n.I18n._;
-
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -52,67 +47,65 @@
import org.nuiton.topia.TopiaContext;
import org.nuiton.topia.TopiaException;
import org.nuiton.topia.framework.TopiaQuery;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import static org.nuiton.i18n.I18n._;
+
/**
* Defaults rules, if no localized rules classes is instantiated
* this default class contain the strict minimum rules to check the data integrity
- * @author joe
*
+ * @author joe
*/
public class DefaultAccountingRules implements AccountingRules {
-
+
protected static final Log log =
- LogFactory.getLog(DefaultAccountingRules.class);
+ LogFactory.getLog(DefaultAccountingRules.class);
- /**
- * Rules to check before create accounts
- */
+ /** Rules to check before create accounts */
@Override
public void createAccountRules(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()));
+ account.getAccountNumber()));
}
}
- /**
- * Rules to check before create subledger
- */
+ /** Rules to check before create subledger */
@Override
public void createSubLedgerRules(Account masterAccount, 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()));
+ account.getAccountNumber()));
}
//check if parentaccount have no subaccount
- if (masterAccount.getSubAccounts().size() > 0){
+ if (masterAccount.getSubAccounts().size() > 0) {
throw new LimaBusinessException(_("lima-business.defaultaccountingrules.subledgererror"));
- }
+ }
}
-
- /**
- * Rules to check before create fiscals periods
- */
+
+ /** Rules to check before create fiscals periods */
@Override
public List<FinancialPeriod> createFiscalPeriodRules(FiscalPeriod fiscalPeriod, TopiaContext transaction) throws LimaException {
//check if the enddate period is after the begindate period
- if (fiscalPeriod.getEndDate().before(fiscalPeriod.getBeginDate())){
+ if (fiscalPeriod.getEndDate().before(fiscalPeriod.getBeginDate())) {
throw new LimaBusinessException(_("lima-business.defaultaccountingrules.enddateerror"));
}
return null;
}
-
-
- /**
- * Rules to check before block fiscals periods
- */
+
+ /** Rules to check before block fiscals periods */
@Override
public void blockFiscalPeriodRules(FiscalPeriod fiscalPeriod, TopiaContext transaction) throws LimaException {
-
+
}
/**
@@ -120,23 +113,20 @@
* Recursive function
*/
@Override
- public void removeAccountRules(Account account, TopiaContext transaction) throws LimaException {
- try{
+ public void removeAccountRules(Account account, TopiaContext transaction) throws LimaException {
+ try {
EntryDAO entryDAO = LimaCallaoDAOHelper.getEntryDAO(transaction);
// Check if account have entries
int nbentries = entryDAO.findAllByAccount(account).size();
if (nbentries != 0) {
throw new LimaBusinessException(_("lima-business.defaultaccountingrules.deleteaccounterror"));
}
- }
- catch (TopiaException ex) {
+ } catch (TopiaException ex) {
doCatch(transaction, ex, log);
}
}
- /**
- * Check if entrybook have financial transaction
- */
+ /** Check if entrybook have financial transaction */
@Override
public void removeEntryBookRules(EntryBook entryBook, TopiaContext topiaTransaction) throws LimaException {
try {
@@ -146,54 +136,52 @@
if (nbfinancialtransaction != 0) {
throw new LimaBusinessException(_("lima-business.defaultaccountingrules.deleteentrybookerror"));
}
- }
- catch (TopiaException ex) {
+ } catch (TopiaException ex) {
doCatch(topiaTransaction, ex, log);
}
-
+
}
/**
- * check if financial period of a financial transaction is blocked
- * check if all entrybook of his financial period are blocked
+ * check if financial period of a financial transaction is blocked
+ * check if all entrybook of his financial period are blocked
*/
@Override
public void checkFinancialPeriodBlockedWithFinancialTransaction(FinancialTransaction financialTransaction, TopiaContext topiaContext) throws LimaException {
//check financial period locked
- if (financialTransaction.getFinancialPeriod().getLocked()){
+ if (financialTransaction.getFinancialPeriod().getLocked()) {
throw new LimaBusinessException(_("lima-business.defaultaccountingrules.financialperiodblocked"));
}
-
+
//check all entrybook of his financial period are blocked
//FIXME Make this check by topia query ?
List<EntryBook> entryBooks = new ArrayList<EntryBook>();
List<EntryBook> closedEntryBooks = new ArrayList<EntryBook>();
try {
EntryBookDAO entryBookDAO =
- LimaCallaoDAOHelper.getEntryBookDAO(topiaContext);
+ LimaCallaoDAOHelper.getEntryBookDAO(topiaContext);
ClosedPeriodicEntryBookDAO closedPeriodicEntryBookDAO =
- LimaCallaoDAOHelper.getClosedPeriodicEntryBookDAO(topiaContext);
+ LimaCallaoDAOHelper.getClosedPeriodicEntryBookDAO(topiaContext);
FinancialPeriod financialPeriod =
- financialTransaction.getFinancialPeriod();
+ financialTransaction.getFinancialPeriod();
entryBooks = entryBookDAO.findAll();
-
+
for (EntryBook entryBook : entryBooks) {
ClosedPeriodicEntryBook closedPeriodicEntryBook =
- closedPeriodicEntryBookDAO.findByEntryBookAndFinancialPeriod(
- entryBook, financialPeriod);
- if(closedPeriodicEntryBook.getLocked()){
+ closedPeriodicEntryBookDAO.findByEntryBookAndFinancialPeriod(
+ entryBook, financialPeriod);
+ if (closedPeriodicEntryBook.getLocked()) {
closedEntryBooks.add(entryBook);
}
}
- if (entryBooks.size() == closedEntryBooks.size()){
+ if (entryBooks.size() == closedEntryBooks.size()) {
throw new LimaBusinessException(_("lima-business.defaultaccountingrules.allentrybookclosed"));
}
- }
- catch (TopiaException eee) {
+ } catch (TopiaException eee) {
doCatch(topiaContext, eee, log);
}
}
-
+
/**
* Check if all financial transactions of closedperiodicentrybook are equilibrate
* Check if all financial transactions of this closedperiodicentrybook/financialPeriod are well filled in
@@ -207,21 +195,20 @@
// Check if all financial transactions of closedperiodicentrybook are equilibrate
try {
FinancialTransactionDAO financialTransactionDAO =
- LimaCallaoDAOHelper.getFinancialTransactionDAO(topiaContext);
-
+ LimaCallaoDAOHelper.getFinancialTransactionDAO(topiaContext);
+
TopiaQuery query = financialTransactionDAO.createQuery("E");
query.addWhere("E.amountCredit != E.amountDebit")
- .addEquals(FinancialTransaction.ENTRY_BOOK,
- closedPeriodicEntryBook.getEntryBook())
- .addEquals(FinancialTransaction.FINANCIAL_PERIOD,
- closedPeriodicEntryBook.getFinancialPeriod());
+ .addEquals(FinancialTransaction.PROPERTY_ENTRY_BOOK,
+ closedPeriodicEntryBook.getEntryBook())
+ .addEquals(FinancialTransaction.PROPERTY_FINANCIAL_PERIOD,
+ closedPeriodicEntryBook.getFinancialPeriod());
result = financialTransactionDAO.findAllByQuery(query);
- if (result.size()>0){
+ if (result.size() > 0) {
throw new LimaBusinessException(_("lima-business.defaultaccountingrules.blockerrorequillibrate"));
}
- }
- catch (TopiaException ex) {
+ } catch (TopiaException ex) {
doCatch(topiaContext, ex, log);
}
result = null;
@@ -229,56 +216,54 @@
// Check if all financial transactions of this closedperiodicentrybook/financialPeriod are well filled in
try {
FinancialTransactionDAO financialTransactionDAO =
- LimaCallaoDAOHelper.getFinancialTransactionDAO(topiaContext);
-
+ LimaCallaoDAOHelper.getFinancialTransactionDAO(topiaContext);
+
TopiaQuery query = financialTransactionDAO.createQuery("T");
query.addDistinct()
- .addOrder("T."+FinancialTransaction.TOPIA_CREATE_DATE)
- .addFrom(FiscalPeriod.class, "F")
- .addLeftJoin("T."+FinancialTransaction.ENTRY, "E", true)
- .addWhere("T.amountCredit != T.amountDebit OR E.account = null OR E.voucher = null OR E.voucher = '' OR E.description = null OR E.description = ''")
- .addEquals(FinancialTransaction.ENTRY_BOOK,
- closedPeriodicEntryBook.getEntryBook())
- .addEquals(FinancialTransaction.FINANCIAL_PERIOD,
- closedPeriodicEntryBook.getFinancialPeriod());
+ .addOrder("T." + FinancialTransaction.TOPIA_CREATE_DATE)
+ .addFrom(FiscalPeriod.class, "F")
+ .addLeftJoin("T." + FinancialTransaction.PROPERTY_ENTRY, "E", true)
+ .addWhere("T.amountCredit != T.amountDebit OR E.account = null OR E.voucher = null OR E.voucher = '' OR E.description = null OR E.description = ''")
+ .addEquals(FinancialTransaction.PROPERTY_ENTRY_BOOK,
+ closedPeriodicEntryBook.getEntryBook())
+ .addEquals(FinancialTransaction.PROPERTY_FINANCIAL_PERIOD,
+ closedPeriodicEntryBook.getFinancialPeriod());
result = financialTransactionDAO.findAllByQuery(query);
- if (result.size()>0){
+ if (result.size() > 0) {
throw new LimaBusinessException(_("lima-business.defaultaccountingrules.missingelements"));
}
- }
- catch (TopiaException ex) {
+ } catch (TopiaException ex) {
doCatch(topiaContext, ex, log);
}
-
+
result = null;
// Check if all financial transactions have EntryBooks
try {
FinancialTransactionDAO financialTransactionDAO =
- LimaCallaoDAOHelper.getFinancialTransactionDAO(topiaContext);
-
+ LimaCallaoDAOHelper.getFinancialTransactionDAO(topiaContext);
+
TopiaQuery query = financialTransactionDAO.createQuery("T");
query.addDistinct()
- .addOrder("T."+FinancialTransaction.TOPIA_CREATE_DATE)
- .addFrom(FiscalPeriod.class, "F")
- .addLeftJoin("T."+FinancialTransaction.ENTRY, "E", true)
- .addWhere("T.amountCredit != T.amountDebit OR E.account = null OR E.voucher = null OR E.voucher = '' OR E.description = null OR E.description = ''")
- .addNull(FinancialTransaction.ENTRY_BOOK);
+ .addOrder("T." + FinancialTransaction.TOPIA_CREATE_DATE)
+ .addFrom(FiscalPeriod.class, "F")
+ .addLeftJoin("T." + FinancialTransaction.PROPERTY_ENTRY, "E", true)
+ .addWhere("T.amountCredit != T.amountDebit OR E.account = null OR E.voucher = null OR E.voucher = '' OR E.description = null OR E.description = ''")
+ .addNull(FinancialTransaction.PROPERTY_ENTRY_BOOK);
result = financialTransactionDAO.findAllByQuery(query);
- if (result.size()>0){
+ if (result.size() > 0) {
throw new LimaBusinessException(_("lima-business.defaultaccountingrules.missingentrybook"));
}
- }
- catch (TopiaException ex) {
+ } catch (TopiaException ex) {
doCatch(topiaContext, ex, log);
}
}
/**
* Rules on update entry :
- *
+ * <p/>
* Two case :
* - second, the actual entry belong to a blocked closedPeriodicEntryBook
* - third, the new choice entrybook belong to a blocked closedPeriodicEntryBook
@@ -287,38 +272,37 @@
public void updateEntryRules(Entry entry, Entry entryOld, TopiaContext topiaTransaction) throws LimaException {
try {
-
+
FinancialPeriod financialPeriod =
- entry.getFinancialTransaction().getFinancialPeriod();
-
+ entry.getFinancialTransaction().getFinancialPeriod();
+
ClosedPeriodicEntryBookDAO closedPeriodicEntryBookDAO =
- LimaCallaoDAOHelper.getClosedPeriodicEntryBookDAO(topiaTransaction);
-
+ LimaCallaoDAOHelper.getClosedPeriodicEntryBookDAO(topiaTransaction);
+
//second case
ClosedPeriodicEntryBook closedPeriodicEntryBook =
- closedPeriodicEntryBookDAO.findByEntryBookAndFinancialPeriod(
- entryOld.getFinancialTransaction().getEntryBook(), financialPeriod);
- if (closedPeriodicEntryBook.getLocked()){
+ closedPeriodicEntryBookDAO.findByEntryBookAndFinancialPeriod(
+ entryOld.getFinancialTransaction().getEntryBook(), financialPeriod);
+ if (closedPeriodicEntryBook.getLocked()) {
throw new LimaBusinessException(_("lima-Business.defaultaccountingrules.updateentryerror"));
}
-
+
//third case
ClosedPeriodicEntryBook closedPeriodicEntryBook2 =
- closedPeriodicEntryBookDAO.findByEntryBookAndFinancialPeriod(
- entry.getFinancialTransaction().getEntryBook(), financialPeriod);
-
+ closedPeriodicEntryBookDAO.findByEntryBookAndFinancialPeriod(
+ entry.getFinancialTransaction().getEntryBook(), financialPeriod);
+
// Check 2 & 3 cases
- if (closedPeriodicEntryBook2.getLocked()){
+ if (closedPeriodicEntryBook2.getLocked()) {
throw new LimaBusinessException(_("lima-Business.defaultaccountingrules.updateentryerror"));
}
-
- }
- catch (TopiaException eee) {
+
+ } catch (TopiaException eee) {
doCatch(topiaTransaction, eee, log);
}
}
-
-
+
+
/**
* Check :
* 1. if old financialtransaction date are on periodblocked
@@ -331,79 +315,79 @@
@Override
public void updateFinancialTransactionDateRules(
FinancialTransaction financialTransaction, FinancialTransaction financialTransactionOld, TopiaContext topiaContext) throws LimaException {
-
+
FinancialPeriod financialPeriod = financialTransaction.getFinancialPeriod();
FinancialPeriod financialPeriodOld = financialTransactionOld.getFinancialPeriod();
-
+
//1. check old financial period locked
- if (financialPeriodOld.getLocked()){
+ if (financialPeriodOld.getLocked()) {
throw new LimaBusinessException(_("lima-business.defaultaccountingrules.financialtransactionblocked"));
}
-
+
//2. check new financial period locked
- if (financialPeriod.getLocked()){
+ if (financialPeriod.getLocked()) {
throw new LimaBusinessException(_("lima-business.defaultaccountingrules.financialnewdateblocked"));
}
-
+
try {
-
+
ClosedPeriodicEntryBookDAO closedPeriodicEntryBookDAO =
- LimaCallaoDAOHelper.getClosedPeriodicEntryBookDAO(topiaContext);
-
+ LimaCallaoDAOHelper.getClosedPeriodicEntryBookDAO(topiaContext);
+
//3. the actual entrybook belong to a blocked closedPeriodicEntryBook
ClosedPeriodicEntryBook closedPeriodicEntryBookOld =
- closedPeriodicEntryBookDAO.findByEntryBookAndFinancialPeriod(
- financialTransactionOld.getEntryBook(), financialPeriod);
- if (closedPeriodicEntryBookOld.getLocked()){
+ closedPeriodicEntryBookDAO.findByEntryBookAndFinancialPeriod(
+ financialTransactionOld.getEntryBook(), financialPeriod);
+ if (closedPeriodicEntryBookOld.getLocked()) {
throw new LimaBusinessException(_("lima-Business.defaultaccountingrules.updateentryerror"));
}
-
+
//4. the new entrybook belong to a blocked closedPeriodicEntryBook
ClosedPeriodicEntryBook closedPeriodicEntryBook =
- closedPeriodicEntryBookDAO.findByEntryBookAndFinancialPeriod(
- financialTransaction.getEntryBook(), financialPeriod);
- if (closedPeriodicEntryBook.getLocked()){
+ closedPeriodicEntryBookDAO.findByEntryBookAndFinancialPeriod(
+ financialTransaction.getEntryBook(), financialPeriod);
+ if (closedPeriodicEntryBook.getLocked()) {
throw new LimaBusinessException(_("lima-Business.defaultaccountingrules.updatenewentryerror"));
}
-
+
//5. the actual entrybook belong to a blocked closedPeriodicEntryBook
ClosedPeriodicEntryBook closedPeriodicEntryBookOld2 =
- closedPeriodicEntryBookDAO.findByEntryBookAndFinancialPeriod(
- financialTransactionOld.getEntryBook(), financialPeriodOld);
- if (closedPeriodicEntryBookOld2.getLocked()){
+ closedPeriodicEntryBookDAO.findByEntryBookAndFinancialPeriod(
+ financialTransactionOld.getEntryBook(), financialPeriodOld);
+ if (closedPeriodicEntryBookOld2.getLocked()) {
throw new LimaBusinessException(_("lima-Business.defaultaccountingrules.updatefinancialtransactionperioderror"));
}
-
+
//6. the new entrybook belong to a blocked closedPeriodicEntryBook
ClosedPeriodicEntryBook closedPeriodicEntryBook2 =
- closedPeriodicEntryBookDAO.findByEntryBookAndFinancialPeriod(
- financialTransaction.getEntryBook(), financialPeriodOld);
- if (closedPeriodicEntryBook2.getLocked()){
+ closedPeriodicEntryBookDAO.findByEntryBookAndFinancialPeriod(
+ financialTransaction.getEntryBook(), financialPeriodOld);
+ if (closedPeriodicEntryBook2.getLocked()) {
throw new LimaBusinessException(_("lima-Business.defaultaccountingrules.updatefinancialtransactionnewperioderror"));
}
-
-
+
+
//7. check if date are on fiscal period
FiscalPeriodDAO fiscalPeriodDAO =
- LimaCallaoDAOHelper.getFiscalPeriodDAO(topiaContext);
-
+ LimaCallaoDAOHelper.getFiscalPeriodDAO(topiaContext);
+
//search fiscalperiod have financialperiod in params
TopiaQuery query = fiscalPeriodDAO.createQuery()
- .addInElements(":financialPeriod", "financialPeriod")
- .addParam("financialPeriod", financialPeriod);
+ .addInElements(":financialPeriod", "financialPeriod")
+ .addParam("financialPeriod", financialPeriod);
FiscalPeriod fiscalPeriod = fiscalPeriodDAO.findByQuery(query);
-
+
Date beginDateFiscalPeriod = fiscalPeriod.getBeginDate();
Date endDateFiscalPeriod = fiscalPeriod.getEndDate();
Date financialTransactionDate =
- financialTransaction.getTransactionDate();
- if (financialTransactionDate.before(beginDateFiscalPeriod)){
+ financialTransaction.getTransactionDate();
+ if (financialTransactionDate.before(beginDateFiscalPeriod)) {
throw new LimaBusinessException(_("lima-business.defaultaccountingrules.datebeforeerror"));
}
- if (financialTransactionDate.after(endDateFiscalPeriod)){
+ if (financialTransactionDate.after(endDateFiscalPeriod)) {
throw new LimaBusinessException(_("lima-business.defaultaccountingrules.dateaftererror"));
}
-
+
/*
//6. check all entrybook of old and new financial period are blocked
//FIXME Make this check by topia query ?
@@ -437,20 +421,19 @@
if (newClosedEntryBooks.size() >0){
throw new LimaBusinessException("All EntryBook of old financialperiod are not open");
}*/
-
-
- }
- catch (TopiaException eee) {
+
+
+ } catch (TopiaException eee) {
doCatch(topiaContext, eee, log);
}
}
-
-
-
+
+
/**
* Generic code used to rollback a transaction.
- *
+ * <p/>
* TODO : replace this by JTA
+ *
* @throws LimaException
*/
protected void doCatch(TopiaContext transaction, Exception cause, Log log) throws LimaException {
@@ -474,8 +457,8 @@
// Check if the numberaccount is not blank
if (StringUtils.isBlank(account.getAccountNumber())) {
throw new LimaBusinessException(_("lima-business.defaultaccountingrules.invalidaccountnumber",
- account.getAccountNumber()));
- }
+ account.getAccountNumber()));
+ }
}
@Override
@@ -483,8 +466,8 @@
// check the number account is not empty
if (StringUtils.isBlank(account.getAccountNumber())) {
throw new LimaBusinessException(_("lima-business.defaultaccountingrules.invalidaccountnumber",
- account.getAccountNumber()));
- }
+ 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 2011-09-17 12:55:16 UTC (rev 3289)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/FranceAccountingRules.java 2011-09-17 12:55:34 UTC (rev 3290)
@@ -25,12 +25,6 @@
package org.chorem.lima.business.accountingrules;
-import static org.nuiton.i18n.I18n._;
-
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.List;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.time.DateUtils;
import org.apache.commons.logging.Log;
@@ -51,131 +45,132 @@
import org.nuiton.topia.framework.TopiaQuery;
import org.nuiton.topia.framework.TopiaQuery.Op;
-public class FranceAccountingRules extends DefaultAccountingRules {
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+import static org.nuiton.i18n.I18n._;
+
+public class FranceAccountingRules extends DefaultAccountingRules {
+
protected static final Log log =
- LogFactory.getLog(DefaultAccountingRules.class);
+ LogFactory.getLog(DefaultAccountingRules.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 */
public void createAccountRules(Account masterAccount, Account account) throws LimaException {
- super.createAccountRules(masterAccount, account);
+ super.createAccountRules(masterAccount, account);
- // 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]")){
- throw new LimaBusinessException(_("lima-business.franceaccountingrules.accountstartnumbererror",
- 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]")) {
+ throw new LimaBusinessException(_("lima-business.franceaccountingrules.accountstartnumbererror",
+ account.getAccountNumber()));
+ }
+
}
public void updateAccountRules(Account masterAccount, Account account) throws LimaException {
super.updateAccountRules(masterAccount, account);
-
+
// Check if the number account is type numeric
- if (!StringUtils.isNumeric(account.getAccountNumber())){
+ if (!StringUtils.isNumeric(account.getAccountNumber())) {
throw new LimaBusinessException(_("lima-business.franceaccountingrules.accountnumbernotnumeric",
- account.getAccountNumber()));
+ account.getAccountNumber()));
}
-
+
// Check if the number account start with the number of the master account
- if (masterAccount!=null && !account.getAccountNumber().startsWith(
- masterAccount.getAccountNumber())){
+ if (masterAccount != null && !account.getAccountNumber().startsWith(
+ masterAccount.getAccountNumber())) {
throw new LimaBusinessException(_("lima-business.franceaccountingrules.accountnumbernotmaster",
- account.getAccountNumber()));
+ account.getAccountNumber()));
}
-
+
// Check if master account have a number between 1 to 8
- if (masterAccount==null && !account.getAccountNumber().matches("[1-8]")){
+ if (masterAccount == null && !account.getAccountNumber().matches("[1-8]")) {
throw new LimaBusinessException(_("lima-business.franceaccountingrules.accountstartnumbererror",
- account.getAccountNumber()));
+ account.getAccountNumber()));
}
}
- /**
- * Rules to check before create subledger
- */
+ /** Rules to check before create subledger */
public void createSubLedgerRules(Account masterAccount, Account account) throws LimaException {
super.createSubLedgerRules(masterAccount, account);
-
+
// check if the master account number is begin with 4
- if (!masterAccount.getAccountNumber().startsWith("4")){
+ if (!masterAccount.getAccountNumber().startsWith("4")) {
throw new LimaBusinessException(_("lima-business.franceaccountingrules.masteraccountnumbererror",
- account.getAccountNumber()));
+ account.getAccountNumber()));
}
}
-
+
public void updateSubLedgerRules(Account account) throws LimaException {
super.updateSubLedgerRules(account);
}
/**
* Règles de vérification d'ouverture d'un exercice, appliquées à la comptabilité française
- *
+ * <p/>
* Permet de créer un exercice.
- *
+ * <p/>
* Elle a une durée de un an, composées de 12 périodes mensuelles.
* Elle peut aussi être plus courte ou plus longue si l'entreprise
* se constitu ou entre en liquidation ou que l'entreprise decide
* de changer
- *
+ * <p/>
* Elle correspond à l'exercice comptable.
* Pas plus de deux exercices fiscaux ne peuvent-être ouvert en même temps
- *
*/
public List<FinancialPeriod> createFiscalPeriodRules(FiscalPeriod fiscalPeriod, TopiaContext transaction) throws LimaException {
super.createFiscalPeriodRules(fiscalPeriod, transaction);
List<FinancialPeriod> financialPeriods = new ArrayList<FinancialPeriod>();
try {
- FiscalPeriodDAO fiscalPeriodDAO =
- LimaCallaoDAOHelper.getFiscalPeriodDAO(transaction);
-
+ FiscalPeriodDAO fiscalPeriodDAO =
+ LimaCallaoDAOHelper.getFiscalPeriodDAO(transaction);
+
//Checks if is not the first fiscalperiod to create
- if (fiscalPeriodDAO.findAll().size()!=0){
-
+ if (fiscalPeriodDAO.findAll().size() != 0) {
+
TopiaQuery query = fiscalPeriodDAO.createQuery();
- query.addOrderDesc(FiscalPeriod.END_DATE);
+ query.addOrderDesc(FiscalPeriod.PROPERTY_END_DATE);
//get the last fiscal period
FiscalPeriod lastFiscalPeriod = fiscalPeriodDAO.findByQuery(query);
-
+
//check the new fiscal period adjoining the last
Date dateLastFiscalPeriod = lastFiscalPeriod.getEndDate();
dateLastFiscalPeriod = DateUtils.
- addDays(dateLastFiscalPeriod, 1);
+ addDays(dateLastFiscalPeriod, 1);
dateLastFiscalPeriod = DateUtils.truncate(dateLastFiscalPeriod, Calendar.DATE);
- Date dateFiscalPeriod=fiscalPeriod.getBeginDate();
- if(dateLastFiscalPeriod.compareTo(dateFiscalPeriod)!=0){
+ Date dateFiscalPeriod = fiscalPeriod.getBeginDate();
+ if (dateLastFiscalPeriod.compareTo(dateFiscalPeriod) != 0) {
throw new LimaBusinessException(_("lima-business.franceaccountingrules.newfiscalperiodadjoiningerror"));
}
-
+
//We can create a new fiscal period meantime the last fiscal period was not locked
//But not the ante periodfiscal
int unblockedFiscalPeriod =
- fiscalPeriodDAO.findAllByLocked(false).size();
- if (unblockedFiscalPeriod>1){
+ fiscalPeriodDAO.findAllByLocked(false).size();
+ if (unblockedFiscalPeriod > 1) {
throw new LimaBusinessException(_("lima-business.franceaccountingrules.antefiscalperiodnotblocked"));
}
}
-
+
// FinancialPeriods of 1 month are created
Date endDate = fiscalPeriod.getEndDate();
Date loopDate = fiscalPeriod.getBeginDate();
- while(loopDate.before(endDate)){
+ while (loopDate.before(endDate)) {
FinancialPeriod financialPeriod = new FinancialPeriodImpl();
//important for fiscalperiod created from import, it can be locked, so financialperiods must be locked
financialPeriod.setLocked(fiscalPeriod.getLocked());
@@ -183,10 +178,9 @@
loopDate = DateUtils.addMonths(loopDate, 1);
loopDate = DateUtils.truncate(loopDate, Calendar.MONTH);
loopDate = DateUtils.addMilliseconds(loopDate, -1);
- if (loopDate.after(endDate)){
+ if (loopDate.after(endDate)) {
financialPeriod.setEndDate(endDate);
- }
- else {
+ } else {
financialPeriod.setEndDate(loopDate);
}
//create it
@@ -196,48 +190,45 @@
//loop incremente
loopDate = DateUtils.addMilliseconds(loopDate, 1);
}
- }
- catch (TopiaException ex) {
+ } catch (TopiaException ex) {
doCatch(transaction, ex, log);
}
return financialPeriods;
}
- /**
- * Règles de vérification de fermeture d'un exercice, appliquées à la comptabilité française
- */
+ /** Règles de vérification de fermeture d'un exercice, appliquées à la comptabilité française */
public void blockFiscalPeriodRules(FiscalPeriod fiscalPeriod, TopiaContext transaction) throws LimaException {
- try{
+ try {
FiscalPeriodDAO fiscalPeriodDAO =
- LimaCallaoDAOHelper.getFiscalPeriodDAO(transaction);
-
+ LimaCallaoDAOHelper.getFiscalPeriodDAO(transaction);
+
TopiaQuery query = fiscalPeriodDAO.createQuery();
fiscalPeriodDAO.findAllByQuery(query);
- query.addWhere(FiscalPeriod.LOCKED, Op.EQ, false);
- query.addOrder(FiscalPeriod.END_DATE);
-
+ query.addWhere(FiscalPeriod.PROPERTY_LOCKED, Op.EQ, false);
+ query.addOrder(FiscalPeriod.PROPERTY_END_DATE);
+
FiscalPeriod oldestUnBlockedFiscalPeriod =
- fiscalPeriodDAO.findByQuery(query);
+ fiscalPeriodDAO.findByQuery(query);
//Check if the fiscal period to block is the oldest
- if (!oldestUnBlockedFiscalPeriod.equals(fiscalPeriod)){
+ if (!oldestUnBlockedFiscalPeriod.equals(fiscalPeriod)) {
throw new LimaBusinessException(_("lima-business.franceaccountingrules.antefiscalperiodnotblocked"));
}
} catch (TopiaException ex) {
doCatch(transaction, ex, log);
}
}
-
-
+
+
/**
* Check if old financialperiod for a an entrybook are closed before bock the asked closedperiodicentrybook
- *
+ * <p/>
* get all closedperiodicentrybook between the first financial period of fiscalperiod
* and the last financial period of the closedperiodicentrybook in param
* return the number
- *
+ * <p/>
* get all blocked closedperiodicentrybook while his same period, return the number
- *
+ * <p/>
* compare there
*/
public void blockClosedPeriodicEntryBookRules(ClosedPeriodicEntryBook closedPeriodicEntryBook, TopiaContext topiaTransaction) throws LimaException {
@@ -246,67 +237,66 @@
FinancialPeriod financialPeriod = closedPeriodicEntryBook.getFinancialPeriod();
List<ClosedPeriodicEntryBook> closedPeriodicEntryBooks =
- new ArrayList<ClosedPeriodicEntryBook>();
+ new ArrayList<ClosedPeriodicEntryBook>();
try {
-
+
// Get all closedperiod between for the period and entrybook
Date endDate = closedPeriodicEntryBook.
- getFinancialPeriod().getBeginDate();
+ getFinancialPeriod().getBeginDate();
endDate = DateUtils.addMonths(endDate, -1);
-
+
FiscalPeriodDAO fiscalPeriodDAO =
- LimaCallaoDAOHelper.getFiscalPeriodDAO(topiaTransaction);
-
+ LimaCallaoDAOHelper.getFiscalPeriodDAO(topiaTransaction);
+
//search fiscalperiod have financialperiod in params
TopiaQuery query1 = fiscalPeriodDAO.createQuery()
- .addInElements(":financialPeriod", "financialPeriod")
- .addParam("financialPeriod", financialPeriod);
+ .addInElements(":financialPeriod", "financialPeriod")
+ .addParam("financialPeriod", financialPeriod);
FiscalPeriod fiscalPeriod = fiscalPeriodDAO.findByQuery(query1);
Date beginDate = fiscalPeriod.getBeginDate();
-
+
EntryBook entryBook = closedPeriodicEntryBook.getEntryBook();
-
+
ClosedPeriodicEntryBookDAO closedPeriodicEntryBookDAO =
- LimaCallaoDAOHelper.getClosedPeriodicEntryBookDAO(topiaTransaction);
- TopiaQuery query = closedPeriodicEntryBookDAO.createQuery();
+ LimaCallaoDAOHelper.getClosedPeriodicEntryBookDAO(topiaTransaction);
+ TopiaQuery query = closedPeriodicEntryBookDAO.createQuery();
String closedPeriodicEntryBookDateProperty =
- TopiaQuery.getProperty(ClosedPeriodicEntryBook.FINANCIAL_PERIOD,
- FinancialPeriod.BEGIN_DATE);
+ TopiaQuery.getProperty(ClosedPeriodicEntryBook.PROPERTY_FINANCIAL_PERIOD,
+ FinancialPeriod.PROPERTY_BEGIN_DATE);
query.addWhere(closedPeriodicEntryBookDateProperty
- +" BETWEEN :beginDate AND :endDate")
- .addEquals(ClosedPeriodicEntryBook.ENTRY_BOOK, entryBook)
- .addParam("beginDate", beginDate)
- .addParam("endDate", endDate);
-
+ + " BETWEEN :beginDate AND :endDate")
+ .addEquals(ClosedPeriodicEntryBook.PROPERTY_ENTRY_BOOK, entryBook)
+ .addParam("beginDate", beginDate)
+ .addParam("endDate", endDate);
+
closedPeriodicEntryBooks.
- addAll(closedPeriodicEntryBookDAO.findAllByQuery(query));
-
+ addAll(closedPeriodicEntryBookDAO.findAllByQuery(query));
+
int nbClosedPeriodicEntryBooks = closedPeriodicEntryBooks.size();
-
+
// Get all closed between for the period, entrybook and are blocked
- query.addEquals(ClosedPeriodicEntryBook.LOCKED, true);
+ query.addEquals(ClosedPeriodicEntryBook.PROPERTY_LOCKED, true);
closedPeriodicEntryBooks.clear();
closedPeriodicEntryBooks.
- addAll(closedPeriodicEntryBookDAO.findAllByQuery(query));
+ addAll(closedPeriodicEntryBookDAO.findAllByQuery(query));
int nbBlockedClosedPeriodicEntryBooks =
- closedPeriodicEntryBooks.size();
-
+ closedPeriodicEntryBooks.size();
+
//Check if the fiscal period to block is the oldest
- if (nbClosedPeriodicEntryBooks != nbBlockedClosedPeriodicEntryBooks){
+ if (nbClosedPeriodicEntryBooks != nbBlockedClosedPeriodicEntryBooks) {
throw new LimaBusinessException(_("lima-business.franceaccountingrules.antefinancialperiodnotblockedentrybook"));
}
-
- }
- catch (TopiaException ex) {
+
+ } catch (TopiaException ex) {
doCatch(topiaTransaction, ex, log);
}
}
-
+
/**
* Generic code used to rollback a transaction.
- *
+ *
* @throws LimaException
*/
protected void doCatch(TopiaContext transaction, Exception cause, Log log) throws LimaException {
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AbstractLimaService.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AbstractLimaService.java 2011-09-17 12:55:16 UTC (rev 3289)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AbstractLimaService.java 2011-09-17 12:55:34 UTC (rev 3290)
@@ -44,9 +44,6 @@
*
* @author chatellier
* @version $Revision$
- * <p/>
- * Last update : $Date$
- * By : $Author$
*/
public abstract class AbstractLimaService {
@@ -104,7 +101,8 @@
if (log.isErrorEnabled()) {
log.error("Can't close transaction", ex);
}
- throw new LimaException(_("lima-business.common.close.transactionerror", ex));
+ throw new LimaException(
+ _("lima-business.common.close.transactionerror", ex));
}
}
}
@@ -120,7 +118,8 @@
log.trace("beginTransaction" + topiaContext);
return topiaContext;
} catch (TopiaException e) {
- throw new LimaException(_("lima-business.common.open.transactionerror", e));
+ throw new LimaException(
+ _("lima-business.common.open.transactionerror", e));
}
}
@@ -131,7 +130,8 @@
if (log.isErrorEnabled()) {
log.error("Error during commit context", eee);
}
- throw new LimaException(_("lima-business.common.commit.transactionerror", eee));
+ throw new LimaException(
+ _("lima-business.common.commit.transactionerror", eee));
}
}
}
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 2011-09-17 12:55:16 UTC (rev 3289)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java 2011-09-17 12:55:34 UTC (rev 3290)
@@ -82,7 +82,9 @@
Account existAccount =
accountDAO.findByAccountNumber(account.getAccountNumber());
if (existAccount != null) {
- throw new LimaBusinessException(_("lima-business.account.accountalreardyexist", account.getAccountNumber()));
+ throw new LimaBusinessException(
+ _("lima-business.account.accountalreardyexist",
+ account.getAccountNumber()));
}
//create it
@@ -90,7 +92,8 @@
Account masterAccountUpdate = null;
if (masterAccount != null) {
- masterAccountUpdate = accountDAO.findByAccountNumber(masterAccount.getAccountNumber());
+ masterAccountUpdate = accountDAO.findByAccountNumber(
+ masterAccount.getAccountNumber());
}
// check if parent account exist;
@@ -160,7 +163,8 @@
Account masterAccountUpdate = null;
if (masterAccount != null) {
- masterAccountUpdate = accountDAO.findByAccountNumber(masterAccount.getAccountNumber());
+ masterAccountUpdate = accountDAO.findByAccountNumber(
+ masterAccount.getAccountNumber());
}
// check if the masteraccount exist;
@@ -220,7 +224,7 @@
public Account getAccountByNumber(String number) throws LimaException {
List<Account> accountsList = getAllAccountByProperty(
- Account.ACCOUNT_NUMBER, number);
+ Account.PROPERTY_ACCOUNT_NUMBER, number);
Account account = null;
if (accountsList.size() > 0) {
@@ -293,10 +297,12 @@
TopiaQuery query = accountDAO.createQuery();
if (masterAccount == null) {
- query.addEquals("masterAccount", masterAccount);
- query.addWhere("generalLedger", TopiaQuery.Op.EQ, null);
+ query.addEquals(Account.PROPERTY_MASTER_ACCOUNT, masterAccount);
+ query.addWhere(Account.PROPERTY_GENERAL_LEDGER, TopiaQuery.Op.EQ, null);
} else {
- query.addWhere("masterAccount = :value or generalLedger = :value")
+ query.addWhere(Account.PROPERTY_MASTER_ACCOUNT +
+ " = :value or " +
+ Account.PROPERTY_GENERAL_LEDGER + " = :value")
.addParam("value", masterAccount);
}
accountsList.addAll(accountDAO.findAllByQuery(query));
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 2011-09-17 12:55:16 UTC (rev 3289)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/DocumentServiceImpl.java 2011-09-17 12:55:34 UTC (rev 3290)
@@ -775,11 +775,11 @@
TopiaQuery query = entryDAO.createQuery();
String financialPeriodProperty =
- TopiaQuery.getProperty(Entry.FINANCIAL_TRANSACTION,
- FinancialTransaction.FINANCIAL_PERIOD);
+ TopiaQuery.getProperty(Entry.PROPERTY_FINANCIAL_TRANSACTION,
+ FinancialTransaction.PROPERTY_FINANCIAL_PERIOD);
String entryBookProperty =
- TopiaQuery.getProperty(Entry.FINANCIAL_TRANSACTION,
- FinancialTransaction.ENTRY_BOOK);
+ TopiaQuery.getProperty(Entry.PROPERTY_FINANCIAL_TRANSACTION,
+ FinancialTransaction.PROPERTY_ENTRY_BOOK);
query.addWhere(financialPeriodProperty, Op.EQ,
closedPeriodicEntryBook.getFinancialPeriod())
.addWhere(entryBookProperty, Op.EQ,
@@ -790,8 +790,8 @@
List<Object[]> results;
BigDecimal debit = new BigDecimal(0);
BigDecimal credit = new BigDecimal(0);
- query.setSelect(Entry.DEBIT, "SUM(" + Entry.AMOUNT + ")");
- query.addGroup(Entry.DEBIT);
+ query.setSelect(Entry.PROPERTY_DEBIT, "SUM(" + Entry.PROPERTY_AMOUNT + ")");
+ query.addGroup(Entry.PROPERTY_DEBIT);
results = query.execute(transaction);
int nbAmount = results.size();
if (nbAmount == 2) {
@@ -1216,8 +1216,8 @@
TopiaQuery financialPeriodsQuery = financialPeriodDAO.createQuery();
- String beginDateProperty = TopiaQuery.getProperty(FinancialPeriod.BEGIN_DATE);
- String endDateProperty = TopiaQuery.getProperty(FinancialPeriod.BEGIN_DATE);
+ String beginDateProperty = TopiaQuery.getProperty(FinancialPeriod.PROPERTY_BEGIN_DATE);
+ String endDateProperty = TopiaQuery.getProperty(FinancialPeriod.PROPERTY_BEGIN_DATE);
financialPeriodsQuery.addWhere(beginDateProperty, Op.GE, beginDate)
.addWhere(endDateProperty, Op.LE, endDate)
.addOrder(beginDateProperty);
@@ -1242,17 +1242,17 @@
BigDecimal credit = new BigDecimal(0);
String financialPeriodProperty = TopiaQuery.getProperty(
- Entry.FINANCIAL_TRANSACTION,
- FinancialTransaction.FINANCIAL_PERIOD);
+ Entry.PROPERTY_FINANCIAL_TRANSACTION,
+ FinancialTransaction.PROPERTY_FINANCIAL_PERIOD);
String entryBookProperty = TopiaQuery.getProperty(
- Entry.FINANCIAL_TRANSACTION,
- FinancialTransaction.ENTRY_BOOK);
+ Entry.PROPERTY_FINANCIAL_TRANSACTION,
+ FinancialTransaction.PROPERTY_ENTRY_BOOK);
query.addWhere(financialPeriodProperty, Op.EQ,
closedPeriodicEntryBook.getFinancialPeriod())
.addWhere(entryBookProperty, Op.EQ,
closedPeriodicEntryBook.getEntryBook())
- .setSelect(Entry.DEBIT, "SUM(" + Entry.AMOUNT + ")")
- .addGroup(Entry.DEBIT);
+ .setSelect(Entry.PROPERTY_DEBIT, "SUM(" + Entry.PROPERTY_AMOUNT + ")")
+ .addGroup(Entry.PROPERTY_DEBIT);
results = query.execute(transaction);
int nbAmount = results.size();
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 2011-09-17 12:55:16 UTC (rev 3289)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ExportServiceImpl.java 2011-09-17 12:55:34 UTC (rev 3290)
@@ -172,7 +172,9 @@
TopiaContext topiaContext = beginTransaction(rootContext);
try {
- csvWriter = new CSVWriter(out, CSVWriter.DEFAULT_SEPARATOR, CSVWriter.NO_QUOTE_CHARACTER);
+ csvWriter = new CSVWriter(out,
+ CSVWriter.DEFAULT_SEPARATOR,
+ CSVWriter.NO_QUOTE_CHARACTER);
//export accounts
String[] nextLine = new String[10];
// Récupère tous les comptes
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialPeriodServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialPeriodServiceImpl.java 2011-09-17 12:55:16 UTC (rev 3289)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialPeriodServiceImpl.java 2011-09-17 12:55:34 UTC (rev 3290)
@@ -138,7 +138,7 @@
getFinancialPeriodDAO(transaction);
TopiaQuery query = financialPeriodDAO.createQuery()
- .addOrder(FinancialPeriod.BEGIN_DATE);
+ .addOrder(FinancialPeriod.PROPERTY_BEGIN_DATE);
result = financialPeriodDAO.findAllByQuery(query);
} catch (Exception ex) {
@@ -163,8 +163,8 @@
getFinancialPeriodDAO(transaction);
TopiaQuery query = financialPeriodDAO.createQuery()
- .addEquals(FinancialPeriod.LOCKED, Boolean.FALSE)
- .addOrder(FinancialPeriod.BEGIN_DATE);
+ .addEquals(FinancialPeriod.PROPERTY_LOCKED, Boolean.FALSE)
+ .addOrder(FinancialPeriod.PROPERTY_BEGIN_DATE);
result = financialPeriodDAO.findAllByQuery(query);
} catch (Exception ex) {
@@ -188,8 +188,8 @@
getFinancialPeriodDAO(transaction);
TopiaQuery query = financialPeriodDAO.createQuery()
- .addBetween(FinancialPeriod.BEGIN_DATE, beginDate, endDate)
- .addOrder(FinancialPeriod.BEGIN_DATE);
+ .addBetween(FinancialPeriod.PROPERTY_BEGIN_DATE, beginDate, endDate)
+ .addOrder(FinancialPeriod.PROPERTY_BEGIN_DATE);
result = financialPeriodDAO.findAllByQuery(query);
} catch (Exception ex) {
@@ -280,22 +280,22 @@
//Get closedperiodicentrybook from unlocked fiscalperiod
TopiaQuery query = closedPeriodicEntryBookDAO.createQuery("E");
query.addFrom(FiscalPeriod.class, "F")
- .addInElements("E." + ClosedPeriodicEntryBook.FINANCIAL_PERIOD,
- "F." + FiscalPeriod.FINANCIAL_PERIOD)
- .addEquals("F." + FiscalPeriod.LOCKED, Boolean.FALSE);
+ .addInElements("E." + ClosedPeriodicEntryBook.PROPERTY_FINANCIAL_PERIOD,
+ "F." + FiscalPeriod.PROPERTY_FINANCIAL_PERIOD)
+ .addEquals("F." + FiscalPeriod.PROPERTY_LOCKED, Boolean.FALSE);
String orderProperty =
- TopiaQuery.getProperty("E", ClosedPeriodicEntryBook.FINANCIAL_PERIOD,
- FinancialPeriod.BEGIN_DATE);
+ TopiaQuery.getProperty("E", ClosedPeriodicEntryBook.PROPERTY_FINANCIAL_PERIOD,
+ FinancialPeriod.PROPERTY_BEGIN_DATE);
query.addOrder(orderProperty);
//IMPORTANT : LOADING ClosedPeriodicEntryBook AND IS COLUMN FOR NO LAZY EXCEPTION
String loadEntryBookProperty =
- TopiaQuery.getProperty(ClosedPeriodicEntryBook.ENTRY_BOOK,
- EntryBook.LABEL);
+ TopiaQuery.getProperty(ClosedPeriodicEntryBook.PROPERTY_ENTRY_BOOK,
+ EntryBook.PROPERTY_LABEL);
query.addLoad(loadEntryBookProperty);
String loadFinancialPeriodProperty =
- TopiaQuery.getProperty(ClosedPeriodicEntryBook.FINANCIAL_PERIOD,
- FinancialPeriod.BEGIN_DATE);
+ TopiaQuery.getProperty(ClosedPeriodicEntryBook.PROPERTY_FINANCIAL_PERIOD,
+ FinancialPeriod.PROPERTY_BEGIN_DATE);
query.addLoad(loadFinancialPeriodProperty);
//call query
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 2011-09-17 12:55:16 UTC (rev 3289)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialStatementServiceImpl.java 2011-09-17 12:55:34 UTC (rev 3290)
@@ -208,7 +208,7 @@
LimaCallaoDAOHelper.getFinancialStatementDAO(transaction);
TopiaQuery query = financialStatementDAO.createQuery();
- query.addEquals(FinancialStatement.MASTER_FINANCIAL_STATEMENT, masterFinancialStatement)
+ query.addEquals(FinancialStatement.PROPERTY_MASTER_FINANCIAL_STATEMENT, masterFinancialStatement)
.addOrder(FinancialStatement.TOPIA_CREATE_DATE);
financialStatements = financialStatementDAO.findAllByQuery(query);
} catch (Exception ex) {
@@ -260,14 +260,17 @@
return result;
}
- /** Créé la liste de postes contenant les calculs de comptes
+ /**
+ * Créé la liste de postes contenant les calculs de comptes
+ *
* @param financialStatement
* @param selectedBeginDate
* @param selectedEndDate
* @param result
* @param topiaContext
* @return
- * @throws LimaException*/
+ * @throws LimaException
+ */
public FinancialStatementDatas financialStatementReport(FinancialStatement financialStatement,
Date selectedBeginDate,
Date selectedEndDate,
@@ -373,13 +376,16 @@
}
- /** Permet de calculer le montant de tous les comptes contenu dans un mouvement
+ /**
+ * Permet de calculer le montant de tous les comptes contenu dans un mouvement
+ *
* @param financialStatement
* @param selectedBeginDate
* @param selectedEndDate
* @param topiaContext
* @return
- * @throws LimaException*/
+ * @throws LimaException
+ */
public FinancialStatementAmounts financialStatementAmounts(FinancialStatement financialStatement,
Date selectedBeginDate,
Date selectedEndDate,
@@ -567,13 +573,13 @@
TopiaQuery query = financialStatementDAO.createQuery();
String accountProperty =
- TopiaQuery.getProperty(FinancialStatement.ACCOUNTS);
+ TopiaQuery.getProperty(FinancialStatement.PROPERTY_ACCOUNTS);
String creditAccountProperty =
- TopiaQuery.getProperty(FinancialStatement.CREDIT_ACCOUNTS);
+ TopiaQuery.getProperty(FinancialStatement.PROPERTY_CREDIT_ACCOUNTS);
String debitAccountProperty =
- TopiaQuery.getProperty(FinancialStatement.DEBIT_ACCOUNTS);
+ TopiaQuery.getProperty(FinancialStatement.PROPERTY_DEBIT_ACCOUNTS);
String provisionDeprecationProperty =
- TopiaQuery.getProperty(FinancialStatement.PROVISION_DEPRECATION_ACCOUNTS);
+ TopiaQuery.getProperty(FinancialStatement.PROPERTY_PROVISION_DEPRECATION_ACCOUNTS);
String likeCondition = " " + Op.LIKE + " '%" + accountNumber + "%'";
query.addWhere(accountProperty + likeCondition
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java 2011-09-17 12:55:16 UTC (rev 3289)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java 2011-09-17 12:55:34 UTC (rev 3290)
@@ -151,23 +151,23 @@
FinancialTransactionDAO transactionDAO =
LimaCallaoDAOHelper.getFinancialTransactionDAO(topiaTransaction);
- String financialPeriodProperty = TopiaQuery.getProperty(FinancialTransaction.FINANCIAL_PERIOD);
- String entryBookLabelProperty = TopiaQuery.getProperty(FinancialTransaction.ENTRY_BOOK);
+ String financialPeriodProperty = TopiaQuery.getProperty(FinancialTransaction.PROPERTY_FINANCIAL_PERIOD);
+ String entryBookLabelProperty = TopiaQuery.getProperty(FinancialTransaction.PROPERTY_ENTRY_BOOK);
// filter with topia query
TopiaQuery query = transactionDAO.createQuery("T")
- .addBetween(FinancialTransaction.TRANSACTION_DATE, beginDate, endDate)
+ .addBetween(FinancialTransaction.PROPERTY_TRANSACTION_DATE, beginDate, endDate)
.addDistinct()
- .addOrder("T." + FinancialTransaction.TRANSACTION_DATE)
+ .addOrder("T." + FinancialTransaction.PROPERTY_TRANSACTION_DATE)
.addOrder("T." + FinancialTransaction.TOPIA_CREATE_DATE)
//load for lazy
.addLoad(financialPeriodProperty)
.addLoad(entryBookLabelProperty)
- .addLeftJoin("T." + FinancialTransaction.ENTRY, "E", true)
- .addFetch("E." + Entry.ACCOUNT)
- .addFetch("E." + Entry.LETTER);
+ .addLeftJoin("T." + FinancialTransaction.PROPERTY_ENTRY, "E", true)
+ .addFetch("E." + Entry.PROPERTY_ACCOUNT)
+ .addFetch("E." + Entry.PROPERTY_LETTER);
financialTransactions = transactionDAO.findAllByQuery(query);
} catch (Exception ex) {
doCatch(topiaTransaction, ex);
@@ -187,28 +187,28 @@
FinancialTransactionDAO transactionDAO =
LimaCallaoDAOHelper.getFinancialTransactionDAO(topiaTransaction);
- String financialPeriodProperty = TopiaQuery.getProperty(FinancialTransaction.FINANCIAL_PERIOD);
- String entryBookLabelProperty = TopiaQuery.getProperty(FinancialTransaction.ENTRY_BOOK);
+ String financialPeriodProperty = TopiaQuery.getProperty(FinancialTransaction.PROPERTY_FINANCIAL_PERIOD);
+ String entryBookLabelProperty = TopiaQuery.getProperty(FinancialTransaction.PROPERTY_ENTRY_BOOK);
// filter with topia query
TopiaQuery query = transactionDAO.createQuery("T");
if (entryBook != null) {
- query.addEquals(FinancialTransaction.ENTRY_BOOK, entryBook);
+ query.addEquals(FinancialTransaction.PROPERTY_ENTRY_BOOK, entryBook);
}
if (financialPeriod != null) {
- query.addEquals(FinancialTransaction.FINANCIAL_PERIOD, financialPeriod);
+ query.addEquals(FinancialTransaction.PROPERTY_FINANCIAL_PERIOD, financialPeriod);
}
query.addDistinct()
- .addOrder("T." + FinancialTransaction.TRANSACTION_DATE)
+ .addOrder("T." + FinancialTransaction.PROPERTY_TRANSACTION_DATE)
.addOrder("T." + FinancialTransaction.TOPIA_CREATE_DATE)
//load for lazy
.addLoad(financialPeriodProperty)
.addLoad(entryBookLabelProperty)
- .addLeftJoin("T." + FinancialTransaction.ENTRY, "E", true)
- .addFetch("E." + Entry.ACCOUNT)
- .addFetch("E." + Entry.LETTER);
+ .addLeftJoin("T." + FinancialTransaction.PROPERTY_ENTRY, "E", true)
+ .addFetch("E." + Entry.PROPERTY_ACCOUNT)
+ .addFetch("E." + Entry.PROPERTY_LETTER);
financialTransactions = transactionDAO.findAllByQuery(query);
} catch (Exception ex) {
doCatch(topiaTransaction, ex);
@@ -230,22 +230,22 @@
FinancialTransactionDAO financialTransactionDAO =
LimaCallaoDAOHelper.getFinancialTransactionDAO(topiaContext);
- String financialPeriodProperty = TopiaQuery.getProperty(FinancialTransaction.FINANCIAL_PERIOD);
- String entryBookLabelProperty = TopiaQuery.getProperty(FinancialTransaction.ENTRY_BOOK);
+ String financialPeriodProperty = TopiaQuery.getProperty(FinancialTransaction.PROPERTY_FINANCIAL_PERIOD);
+ String entryBookLabelProperty = TopiaQuery.getProperty(FinancialTransaction.PROPERTY_ENTRY_BOOK);
TopiaQuery query = financialTransactionDAO.createQuery("T");
query.addDistinct()
- .addOrder("T." + FinancialTransaction.TRANSACTION_DATE)
+ .addOrder("T." + FinancialTransaction.PROPERTY_TRANSACTION_DATE)
.addOrder("T." + FinancialTransaction.TOPIA_CREATE_DATE)
.addFrom(FiscalPeriod.class, "F")
- .addLeftJoin("T." + FinancialTransaction.ENTRY, "E", true)
+ .addLeftJoin("T." + FinancialTransaction.PROPERTY_ENTRY, "E", true)
.addWhere("T.amountCredit != T.amountDebit OR E.account = null OR T.entryBook = null OR E.voucher = null OR E.voucher = '' OR E.description = null OR E.description = ''")
.addInElements("T.financialPeriod", "F.financialPeriod")
.addEquals("F", fiscalPeriod)
// load lazy
- .addFetch("E." + Entry.ACCOUNT)
- .addFetch("E." + Entry.LETTER)
+ .addFetch("E." + Entry.PROPERTY_ACCOUNT)
+ .addFetch("E." + Entry.PROPERTY_LETTER)
.addLoad(financialPeriodProperty)
.addLoad(entryBookLabelProperty);
@@ -303,7 +303,7 @@
// WARN No load lazy, modify query with addLoad or addFetch if loading is necessary
TopiaQuery query = financialTransactionDAO.createQuery("T");
query.addFrom(FiscalPeriod.class, "F")
- .addLeftJoin("T." + FinancialTransaction.ENTRY, "E", false)
+ .addLeftJoin("T." + FinancialTransaction.PROPERTY_ENTRY, "E", false)
.addWhere("T.amountCredit = T.amountDebit")
.addNotNull("E.account")
.addNotNull("T.entryBook")
@@ -751,14 +751,14 @@
LimaCallaoDAOHelper.getFinancialTransactionDAO(topiaContext);
TopiaQuery query = financialTransactionDAO.createQuery("T");
- String dateProperty = TopiaQuery.getProperty(FinancialTransaction.TRANSACTION_DATE);
- String accountNumberProperty = TopiaQuery.getProperty(Entry.ACCOUNT, Account.ACCOUNT_NUMBER);
+ String dateProperty = TopiaQuery.getProperty(FinancialTransaction.PROPERTY_TRANSACTION_DATE);
+ String accountNumberProperty = TopiaQuery.getProperty(Entry.PROPERTY_ACCOUNT, Account.PROPERTY_ACCOUNT_NUMBER);
query.addDistinct();
- query.addLeftJoin("T." + FinancialTransaction.ENTRY, "E", true);
+ query.addLeftJoin("T." + FinancialTransaction.PROPERTY_ENTRY, "E", true);
//Load for lazy
- query.addLoad(FinancialTransaction.ENTRY_BOOK)
- .addLoad(FinancialTransaction.FINANCIAL_PERIOD);
+ query.addLoad(FinancialTransaction.PROPERTY_ENTRY_BOOK)
+ .addLoad(FinancialTransaction.PROPERTY_FINANCIAL_PERIOD);
Date beginDate = financialTransactionSearch.getBeginDate();
Date endDate = financialTransactionSearch.getEndDate();
@@ -806,7 +806,7 @@
String operator = financialTransactionSearch.getOperator();
FinancialStatementWayEnum fStWayEnum = financialTransactionSearch.getAmountWayEnum();
if (entryBook != null) {
- query.addEquals("T." + FinancialTransaction.ENTRY_BOOK, entryBook);
+ query.addEquals("T." + FinancialTransaction.PROPERTY_ENTRY_BOOK, entryBook);
}
if (amount != null) {
if (amount2 != null) {
@@ -832,9 +832,9 @@
result.add(financialTransaction);
TopiaQuery query2 = entryDAO.createQuery();
- query2.addEquals(Entry.FINANCIAL_TRANSACTION, financialTransaction);
+ query2.addEquals(Entry.PROPERTY_FINANCIAL_TRANSACTION, financialTransaction);
//Load for lazy
- query2.addLoad(Entry.ACCOUNT, Entry.LETTER);
+ query2.addLoad(Entry.PROPERTY_ACCOUNT, Entry.PROPERTY_LETTER);
List<Entry> entries = entryDAO.findAllByQuery(query2);
result.addAll(entries);
}
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 2011-09-17 12:55:16 UTC (rev 3289)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java 2011-09-17 12:55:34 UTC (rev 3290)
@@ -229,7 +229,7 @@
FiscalPeriodDAO fiscalPeriodDAO =
LimaCallaoDAOHelper.getFiscalPeriodDAO(transaction);
TopiaQuery query = fiscalPeriodDAO.createQuery();
- query.addOrderDesc(FiscalPeriod.END_DATE);
+ query.addOrderDesc(FiscalPeriod.PROPERTY_END_DATE);
//get the last fiscal period
result = fiscalPeriodDAO.findByQuery(query);
Modified: 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 2011-09-17 12:55:16 UTC (rev 3289)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/HttpServerServiceImpl.java 2011-09-17 12:55:34 UTC (rev 3290)
@@ -179,7 +179,7 @@
log.error("Can't call document service for create html document", eeeLE);
} catch (ParseException eeePE) {
log.error("Can't parse date", eeePE);
- }
+ }
resp.setContentType(formatsEnum.getMimeType());
InputStream in = doc.openStream();
OutputStream out = resp.getOutputStream();
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 2011-09-17 12:55:16 UTC (rev 3289)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ReportServiceImpl.java 2011-09-17 12:55:34 UTC (rev 3290)
@@ -180,13 +180,13 @@
TopiaQuery query = entryDAO.createQuery(queryAlias);
String transactionDateProperty = TopiaQuery.getProperty(
- Entry.FINANCIAL_TRANSACTION, FinancialTransaction.TRANSACTION_DATE);
+ Entry.PROPERTY_FINANCIAL_TRANSACTION, FinancialTransaction.PROPERTY_TRANSACTION_DATE);
String amountCreditProperty = TopiaQuery.getProperty(
- Entry.FINANCIAL_TRANSACTION, FinancialTransaction.AMOUNT_CREDIT);
+ Entry.PROPERTY_FINANCIAL_TRANSACTION, FinancialTransaction.PROPERTY_AMOUNT_CREDIT);
String amountDebitProperty = TopiaQuery.getProperty(
- Entry.FINANCIAL_TRANSACTION, FinancialTransaction.AMOUNT_DEBIT);
+ Entry.PROPERTY_FINANCIAL_TRANSACTION, FinancialTransaction.PROPERTY_AMOUNT_DEBIT);
String entryBookProperty = TopiaQuery.getProperty(
- Entry.FINANCIAL_TRANSACTION, FinancialTransaction.ENTRY_BOOK);
+ Entry.PROPERTY_FINANCIAL_TRANSACTION, FinancialTransaction.PROPERTY_ENTRY_BOOK);
query
.addWhere(amountCreditProperty + " = " + amountDebitProperty)
@@ -194,7 +194,7 @@
.addNotNull(entryBookProperty)
.addParam("beginDate", beginDate)
.addParam("endDate", endDate)
- .addEquals(Entry.ACCOUNT, account);
+ .addEquals(Entry.PROPERTY_ACCOUNT, account);
return query;
}
@@ -228,16 +228,16 @@
createEntryQuery(account, beginDate, endDate, entryDAO, queryAlias);
//IMPORTANT : LOADING ENTRIES AND IS COLUMN FOR NO LAZY EXCEPTION
String loadEntryBookProperty =
- TopiaQuery.getProperty(Entry.FINANCIAL_TRANSACTION,
- FinancialTransaction.ENTRY_BOOK);
- entriesQuery.addLoad(Entry.ACCOUNT, Entry.FINANCIAL_TRANSACTION, Entry.LETTER)
+ TopiaQuery.getProperty(Entry.PROPERTY_FINANCIAL_TRANSACTION,
+ FinancialTransaction.PROPERTY_ENTRY_BOOK);
+ entriesQuery.addLoad(Entry.PROPERTY_ACCOUNT, Entry.PROPERTY_FINANCIAL_TRANSACTION, Entry.PROPERTY_LETTER)
.addLoad(loadEntryBookProperty);
reportsDatas.setListEntry(entryDAO.findAllByQuery(entriesQuery));
TopiaQuery amountsQuery =
createEntryQuery(account, beginDate, endDate, entryDAO, queryAlias);
- amountsQuery.setSelect("E." + Entry.DEBIT, "SUM(E." + Entry.AMOUNT + ")");
- amountsQuery.addGroup("E." + Entry.DEBIT);
+ amountsQuery.setSelect("E." + Entry.PROPERTY_DEBIT, "SUM(E." + Entry.PROPERTY_AMOUNT + ")");
+ amountsQuery.addGroup("E." + Entry.PROPERTY_DEBIT);
results = amountsQuery.execute(topiaContext);
int nbAmount = results.size();
if (nbAmount == 2) {
@@ -301,18 +301,18 @@
TopiaQuery entriesQuery =
createEntryQuery(account, beginDate, endDate, entryDAO, queryAlias);
//IMPORTANT : LOADING ENTRIES AND IS COLUMN FOR NO LAZY EXCEPTION
- entriesQuery.addLoad(Entry.FINANCIAL_TRANSACTION);
+ entriesQuery.addLoad(Entry.PROPERTY_FINANCIAL_TRANSACTION);
String loadEntryBookProperty =
- TopiaQuery.getProperty(Entry.FINANCIAL_TRANSACTION,
- FinancialTransaction.ENTRY_BOOK);
+ TopiaQuery.getProperty(Entry.PROPERTY_FINANCIAL_TRANSACTION,
+ FinancialTransaction.PROPERTY_ENTRY_BOOK);
entriesQuery.addLoad(loadEntryBookProperty);
reportsDatas.setListEntry(entryDAO.findAllByQuery(entriesQuery));
}
TopiaQuery amountsQuery =
createEntryQuery(account, beginDate, endDate, entryDAO, queryAlias);
- amountsQuery.setSelect("E." + Entry.DEBIT, "SUM(E." + Entry.AMOUNT + ")");
- amountsQuery.addGroup("E." + Entry.DEBIT);
+ amountsQuery.setSelect("E." + Entry.PROPERTY_DEBIT, "SUM(E." + Entry.PROPERTY_AMOUNT + ")");
+ amountsQuery.addGroup("E." + Entry.PROPERTY_DEBIT);
results = amountsQuery.execute(topiaContext);
int nbAmount = results.size();
if (nbAmount == 2) {
@@ -376,19 +376,19 @@
TopiaQuery entriesQuery = createEntryBookReportsQuery(
entryBook, beginDate, endDate, entryDAO, "E");
//IMPORTANT : LOADING ENTRIES AND IS COLUMN FOR NO LAZY EXCEPTION
- entriesQuery.addLoad(Entry.ACCOUNT, Entry.FINANCIAL_TRANSACTION, Entry.LETTER);
+ entriesQuery.addLoad(Entry.PROPERTY_ACCOUNT, Entry.PROPERTY_FINANCIAL_TRANSACTION, Entry.PROPERTY_LETTER);
String orderDateProperty =
- TopiaQuery.getProperty("E", Entry.FINANCIAL_TRANSACTION, FinancialTransaction.TRANSACTION_DATE);
+ TopiaQuery.getProperty("E", Entry.PROPERTY_FINANCIAL_TRANSACTION, FinancialTransaction.PROPERTY_TRANSACTION_DATE);
String orderIdProperty =
- TopiaQuery.getProperty("E", Entry.FINANCIAL_TRANSACTION, FinancialTransaction.TOPIA_ID);
+ TopiaQuery.getProperty("E", Entry.PROPERTY_FINANCIAL_TRANSACTION, FinancialTransaction.TOPIA_ID);
entriesQuery.addOrder(orderDateProperty)
.addOrder(orderIdProperty);
reportsDatas.setListEntry(entryDAO.findAllByQuery(entriesQuery));
TopiaQuery amountsQuery =
createEntryBookReportsQuery(entryBook, beginDate, endDate, entryDAO, "E");
- amountsQuery.setSelect("E." + Entry.DEBIT, "SUM(E." + Entry.AMOUNT + ")");
- amountsQuery.addGroup("E." + Entry.DEBIT);
+ amountsQuery.setSelect("E." + Entry.PROPERTY_DEBIT, "SUM(E." + Entry.PROPERTY_AMOUNT + ")");
+ amountsQuery.addGroup("E." + Entry.PROPERTY_DEBIT);
results = amountsQuery.execute(topiaTransaction);
int nbAmount = results.size();
if (nbAmount == 2) {
@@ -446,17 +446,17 @@
String queryAlias) throws LimaException {
TopiaQuery query = entryDAO.createQuery(queryAlias);
String transactionDateProperty =
- TopiaQuery.getProperty(Entry.FINANCIAL_TRANSACTION,
- FinancialTransaction.TRANSACTION_DATE);
+ TopiaQuery.getProperty(Entry.PROPERTY_FINANCIAL_TRANSACTION,
+ FinancialTransaction.PROPERTY_TRANSACTION_DATE);
String amountCreditProperty =
- TopiaQuery.getProperty(Entry.FINANCIAL_TRANSACTION,
- FinancialTransaction.AMOUNT_CREDIT);
+ TopiaQuery.getProperty(Entry.PROPERTY_FINANCIAL_TRANSACTION,
+ FinancialTransaction.PROPERTY_AMOUNT_CREDIT);
String amountDebitProperty =
- TopiaQuery.getProperty(Entry.FINANCIAL_TRANSACTION,
- FinancialTransaction.AMOUNT_DEBIT);
+ TopiaQuery.getProperty(Entry.PROPERTY_FINANCIAL_TRANSACTION,
+ FinancialTransaction.PROPERTY_AMOUNT_DEBIT);
String entryBookProperty =
- TopiaQuery.getProperty(Entry.FINANCIAL_TRANSACTION,
- FinancialTransaction.ENTRY_BOOK);
+ TopiaQuery.getProperty(Entry.PROPERTY_FINANCIAL_TRANSACTION,
+ FinancialTransaction.PROPERTY_ENTRY_BOOK);
query
.addWhere(amountCreditProperty + " = " + amountDebitProperty)
.addEquals(entryBookProperty, entryBook)
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/VatStatementServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/VatStatementServiceImpl.java 2011-09-17 12:55:16 UTC (rev 3289)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/VatStatementServiceImpl.java 2011-09-17 12:55:34 UTC (rev 3290)
@@ -266,7 +266,7 @@
TopiaQuery query = vatStatementDAO.createQuery();
String labelProperty =
- TopiaQuery.getProperty(VatStatement.LABEL);
+ TopiaQuery.getProperty(VatStatement.PROPERTY_LABEL);
//not to be used causing query exception with ' character
//query.addWhere(labelProperty + " " + Op.LIKE + " '%" +
@@ -357,7 +357,7 @@
TopiaQuery query = vatStatementDAO.createQuery();
String labelProperty =
- TopiaQuery.getProperty(VatStatement.LABEL);
+ TopiaQuery.getProperty(VatStatement.PROPERTY_LABEL);
//not to be used causing query exception with ' character
//query.addWhere(labelProperty + " " + Op.LIKE + " '%" +
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 2011-09-17 12:55:16 UTC (rev 3289)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/EntryBookService.java 2011-09-17 12:55:34 UTC (rev 3290)
@@ -45,8 +45,10 @@
public interface EntryBookService {
- /** @return all entrybook
- * @throws LimaException*/
+ /**
+ * @return all entrybook
+ * @throws LimaException
+ */
List<EntryBook> getAllEntryBooks() throws LimaException;
List<EntryBook> getAllEntryByProperty(String propertyName, String value) throws LimaException;
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/FinancialTransactionServiceLocal.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/FinancialTransactionServiceLocal.java 2011-09-17 12:55:16 UTC (rev 3289)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/FinancialTransactionServiceLocal.java 2011-09-17 12:55:34 UTC (rev 3290)
@@ -29,7 +29,6 @@
import org.chorem.lima.entity.Entry;
import org.chorem.lima.entity.FinancialTransaction;
import org.nuiton.topia.TopiaContext;
-import org.nuiton.topia.TopiaException;
import javax.ejb.Local;
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/ReportService.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/ReportService.java 2011-09-17 12:55:16 UTC (rev 3289)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/ReportService.java 2011-09-17 12:55:34 UTC (rev 3290)
@@ -90,8 +90,8 @@
* @param endDate
* @param selectedAccounts
* @param movementedFilter
+ * @return
* @throws LimaException
- * @return
*/
BalanceTrial generateLedger(Date beginDate,
Date endDate,
@@ -99,13 +99,16 @@
Boolean movementedFilter) throws LimaException;
- /** Generation du rapports des comptes
+ /**
+ * Generation du rapports des comptes
+ *
* @param account
* @param thirdPartAccountsMode
* @param beginDate
* @param endDate
+ * @return
* @throws LimaException
- * @return*/
+ */
ReportsDatas generateAccountsReports(Account account,
Boolean thirdPartAccountsMode,
Date beginDate,
@@ -116,6 +119,7 @@
* Calculate all credit, debit and solde amounts for the balance
* <p/>
* Get all entries if true
+ *
* @param account
* @param beginDate
* @param endDate
@@ -130,20 +134,26 @@
Boolean getEntries,
TopiaContext topiaContext) throws LimaException;
- /** Generation du rapports des journaux
+ /**
+ * Generation du rapports des journaux
+ *
* @param entryBook
* @param beginDate
* @param endDate
+ * @return
* @throws LimaException
- * @return*/
+ */
ReportsDatas generateEntryBooksReports(EntryBook entryBook,
Date beginDate,
Date endDate) throws LimaException;
- /** Generate VAT
+ /**
+ * Generate VAT
+ *
* @param fiscalPeriod
* @return
- * @throws LimaException*/
+ * @throws LimaException
+ */
List<Object> generateVat(FiscalPeriod fiscalPeriod) throws LimaException;
}
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/VatStatementServiceLocal.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/VatStatementServiceLocal.java 2011-09-17 12:55:16 UTC (rev 3289)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/VatStatementServiceLocal.java 2011-09-17 12:55:34 UTC (rev 3290)
@@ -40,15 +40,15 @@
VatStatement masterVatStatement, VatStatement vatStatement,
TopiaContext transaction) throws LimaException;
- public VatStatementAmounts vatStatementAmounts(VatStatement vatStatement,
- Date selectedBeginDate,
- Date selectedEndDate,
- TopiaContext topiacontext) throws LimaException;
+ VatStatementAmounts vatStatementAmounts(VatStatement vatStatement,
+ Date selectedBeginDate,
+ Date selectedEndDate,
+ TopiaContext topiacontext) throws LimaException;
- public VatStatementDatas vatStatementReport(VatStatement vatStatement,
- Date selectedBeginDate,
- Date selectedEndDate,
- VatStatementDatas result,
- TopiaContext topiaContext) throws LimaException;
+ VatStatementDatas vatStatementReport(VatStatement vatStatement,
+ Date selectedBeginDate,
+ Date selectedEndDate,
+ VatStatementDatas result,
+ TopiaContext topiaContext) throws LimaException;
}
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/migration/DatabaseMigrationClass.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/migration/DatabaseMigrationClass.java 2011-09-17 12:55:16 UTC (rev 3289)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/migration/DatabaseMigrationClass.java 2011-09-17 12:55:34 UTC (rev 3290)
@@ -1,73 +1,72 @@
-/*
- * #%L
- * Lima :: business
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2011 CodeLutin, Victor Salaun
- * %%
- * 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%
- */
+/*
+ * #%L
+ * Lima :: business
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2011 CodeLutin, Victor Salaun
+ * %%
+ * 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.migration;
-import java.util.List;
-
import org.chorem.lima.entity.LimaCallaoDAOHelper;
import org.nuiton.topia.migration.TopiaMigrationCallbackByClass;
import org.nuiton.util.Version;
+import java.util.List;
+
public class DatabaseMigrationClass extends TopiaMigrationCallbackByClass {
- protected static final Version VERSION_0_5 = new Version("0.5");
+ protected static final Version VERSION_0_5 = new Version("0.5");
- public DatabaseMigrationClass() {
- super(new MigrationResolver());
- }
+ public DatabaseMigrationClass() {
+ super(new MigrationResolver());
+ }
- protected static class MigrationResolver implements MigrationCallBackForVersionResolver {
+ protected static class MigrationResolver implements MigrationCallBackForVersionResolver {
- @Override
- public Class<? extends MigrationCallBackForVersion> getCallBack(Version version) {
- Class<? extends MigrationCallBackForVersion> result = null;
+ @Override
+ public Class<? extends MigrationCallBackForVersion> getCallBack(Version version) {
+ Class<? extends MigrationCallBackForVersion> result = null;
- if (version.equals(VERSION_0_5)) {
- result = MigrationV0V0_5.class;
- }
- return result;
- }
+ if (version.equals(VERSION_0_5)) {
+ result = MigrationV0V0_5.class;
+ }
+ return result;
+ }
- }
+ }
- @Override
- public Version[] getAvailableVersions() {
- Version[] result = new Version[] { VERSION_0_5 };
- return result;
- }
+ @Override
+ public Version[] getAvailableVersions() {
+ Version[] result = new Version[]{VERSION_0_5};
+ return result;
+ }
- @Override
- public Version getApplicationVersion() {
- Version appVersion = new Version(LimaCallaoDAOHelper.getModelVersion());
- return appVersion;
- }
+ @Override
+ public Version getApplicationVersion() {
+ Version appVersion = new Version(LimaCallaoDAOHelper.getModelVersion());
+ return appVersion;
+ }
- @Override
- public boolean askUser(Version dbVersion, List<Version> versions) {
- return true;
- }
-
- }
+ @Override
+ public boolean askUser(Version dbVersion, List<Version> versions) {
+ return true;
+ }
+}
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/migration/MigrationV0V0_5.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/migration/MigrationV0V0_5.java 2011-09-17 12:55:16 UTC (rev 3289)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/migration/MigrationV0V0_5.java 2011-09-17 12:55:34 UTC (rev 3290)
@@ -22,27 +22,28 @@
* <http://www.gnu.org/licenses/gpl-3.0.html>.
* #L%
*/
-package org.chorem.lima.business.migration;
-
-import java.util.List;
-
-import org.nuiton.topia.TopiaException;
-import org.nuiton.topia.framework.TopiaContextImplementor;
-import org.nuiton.topia.migration.TopiaMigrationCallbackByClass;
-import org.nuiton.topia.migration.TopiaMigrationCallbackByClass.MigrationCallBackForVersion;
-import org.nuiton.util.Version;
-
-public class MigrationV0V0_5 extends MigrationCallBackForVersion {
-
- public MigrationV0V0_5(Version version, TopiaMigrationCallbackByClass callBack) {
- super(version, callBack);
- // TODO Auto-generated constructor stub
- }
-
- @Override
- protected void prepareMigrationScript(TopiaContextImplementor tx,
- List<String> queries, boolean showSql, boolean showProgression)
- throws TopiaException {
- queries.add("Alter table record alter AMOUNT clob;");
- }
-}
+package org.chorem.lima.business.migration;
+
+import org.nuiton.topia.TopiaException;
+import org.nuiton.topia.framework.TopiaContextImplementor;
+import org.nuiton.topia.migration.TopiaMigrationCallbackByClass;
+import org.nuiton.topia.migration.TopiaMigrationCallbackByClass.MigrationCallBackForVersion;
+import org.nuiton.util.Version;
+
+import java.util.List;
+
+public class MigrationV0V0_5 extends MigrationCallBackForVersion {
+
+ public MigrationV0V0_5(Version version, TopiaMigrationCallbackByClass callBack) {
+ super(version, callBack);
+ }
+
+ @Override
+ protected void prepareMigrationScript(TopiaContextImplementor tx,
+ List<String> queries,
+ boolean showSql,
+ boolean showProgression)
+ throws TopiaException {
+ queries.add("Alter table record alter AMOUNT clob;");
+ }
+}
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/utils/AccountComparator.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/utils/AccountComparator.java 2011-09-17 12:55:16 UTC (rev 3289)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/utils/AccountComparator.java 2011-09-17 12:55:34 UTC (rev 3290)
@@ -25,17 +25,16 @@
package org.chorem.lima.business.utils;
+import org.chorem.lima.entity.Account;
+
import java.io.Serializable;
import java.util.Comparator;
-import org.chorem.lima.entity.Account;
-public class AccountComparator implements Serializable, Comparator<Account>{
+public class AccountComparator implements Serializable, Comparator<Account> {
private static final long serialVersionUID = 1L;
- /**
- * sort by accout number in lexicographical order
- */
+ /** sort by accout number in lexicographical order */
@Override
public int compare(Account o1, Account o2) {
return o1.getAccountNumber().compareTo(o2.getAccountNumber());
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/utils/AccountEBPComparator.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/utils/AccountEBPComparator.java 2011-09-17 12:55:16 UTC (rev 3289)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/utils/AccountEBPComparator.java 2011-09-17 12:55:34 UTC (rev 3290)
@@ -25,15 +25,15 @@
package org.chorem.lima.business.utils;
+import org.chorem.lima.beans.AccountEBP;
+
import java.io.Serializable;
import java.util.Comparator;
-import org.chorem.lima.beans.AccountEBP;
-
public class AccountEBPComparator implements Serializable, Comparator<AccountEBP> {
private static final long serialVersionUID = 1L;
-
+
@Override
public int compare(AccountEBP o1, AccountEBP o2) {
return o1.getNumero().compareTo(o2.getNumero());
Modified: 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 2011-09-17 12:55:16 UTC (rev 3289)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/utils/DocumentsEnum.java 2011-09-17 12:55:34 UTC (rev 3290)
@@ -29,41 +29,41 @@
public enum DocumentsEnum {
-
- GENERAL_ENTRYBOOK(_("lima-business.document.generalentrybook"),"lima_general_entybook"),
- ENTRYBOOKS(_("lima-business.document.entrybook"),"lima_entrybooks"),
- BALANCE(_("lima-business.document.balance"),"lima_balance"),
- LEDGER(_("lima-business.document.ledger"),"lima_ledger"),
- FINANCIALSTATEMENT(_("lima-business.document.financialstatement"),"lima_financialstatements"),
- VAT(_("lima-business.document.vat"),"lima_vat");
-
+
+ GENERAL_ENTRYBOOK(_("lima-business.document.generalentrybook"), "lima_general_entybook"),
+ ENTRYBOOKS(_("lima-business.document.entrybook"), "lima_entrybooks"),
+ BALANCE(_("lima-business.document.balance"), "lima_balance"),
+ LEDGER(_("lima-business.document.ledger"), "lima_ledger"),
+ FINANCIALSTATEMENT(_("lima-business.document.financialstatement"), "lima_financialstatements"),
+ VAT(_("lima-business.document.vat"), "lima_vat");
+
private final String fileName;
-
+
private final String description;
-
+
private DocumentsEnum(String description, String fileName) {
this.description = description;
this.fileName = fileName;
}
-
+
public String getFileName() {
return fileName;
}
-
+
public String getDescription() {
return description;
}
-
- public static DocumentsEnum valueOfLink(String label){
+
+ public static DocumentsEnum valueOfLink(String label) {
DocumentsEnum value = null;
-
+
for (DocumentsEnum documentsEnum : DocumentsEnum.values()) {
- if (label.equals(documentsEnum.fileName)){
+ if (label.equals(documentsEnum.fileName)) {
value = documentsEnum;
break;
}
}
return value;
}
-
+
}
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/utils/EntryComparator.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/utils/EntryComparator.java 2011-09-17 12:55:16 UTC (rev 3289)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/utils/EntryComparator.java 2011-09-17 12:55:34 UTC (rev 3290)
@@ -25,11 +25,12 @@
package org.chorem.lima.business.utils;
+import org.chorem.lima.entity.Entry;
+
import java.io.Serializable;
import java.util.Comparator;
-import org.chorem.lima.entity.Entry;
-public class EntryComparator implements Serializable, Comparator<Entry>{
+public class EntryComparator implements Serializable, Comparator<Entry> {
private static final long serialVersionUID = 1L;
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/utils/EntryEBPComparator.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/utils/EntryEBPComparator.java 2011-09-17 12:55:16 UTC (rev 3289)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/utils/EntryEBPComparator.java 2011-09-17 12:55:34 UTC (rev 3290)
@@ -25,22 +25,23 @@
package org.chorem.lima.business.utils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.chorem.lima.beans.EntryEBP;
+
import java.io.Serializable;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Comparator;
import java.util.Date;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.chorem.lima.beans.EntryEBP;
-public class EntryEBPComparator implements Serializable, Comparator<EntryEBP>{
+public class EntryEBPComparator implements Serializable, Comparator<EntryEBP> {
- private static final Log log =
+ private static final Log log =
LogFactory.getLog(EntryEBPComparator.class);
private static final long serialVersionUID = 1L;
-
+
@Override
public int compare(EntryEBP o1, EntryEBP o2) {
int result = 0;
@@ -49,17 +50,15 @@
Date date1 = sdf.parse(o1.getDatEcr());
Date date2 = sdf.parse(o2.getDatEcr());
result = date1.compareTo(date2);
- if(result==0){
+ if (result == 0) {
result = o1.getJournal().compareTo(o2.getJournal());
}
} catch (ParseException eee) {
log.error("Can't parse date", eee);
}
-
-
-
- return result;
+
+ return result;
}
}
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/utils/FinancialPeriodComparator.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/utils/FinancialPeriodComparator.java 2011-09-17 12:55:16 UTC (rev 3289)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/utils/FinancialPeriodComparator.java 2011-09-17 12:55:34 UTC (rev 3290)
@@ -1,42 +1,42 @@
-/*
- * #%L
- * Lima :: business
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2011 CodeLutin, Victor Salaun
- * %%
- * 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%
- */
+/*
+ * #%L
+ * Lima :: business
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2011 CodeLutin, Victor Salaun
+ * %%
+ * 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.utils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.chorem.lima.entity.ClosedPeriodicEntryBook;
+
import java.io.Serializable;
import java.util.Comparator;
-import org.apache.commons.logging.LogFactory;
-import org.chorem.lima.entity.ClosedPeriodicEntryBook;
-import org.apache.commons.logging.Log;
+public class FinancialPeriodComparator implements Serializable, Comparator<ClosedPeriodicEntryBook> {
-public class FinancialPeriodComparator implements Serializable, Comparator<ClosedPeriodicEntryBook> {
-
private static final long serialVersionUID = 1L;
-
+
private static final Log log =
- LogFactory.getLog(FinancialPeriodComparator.class);
+ LogFactory.getLog(FinancialPeriodComparator.class);
@Override
public int compare(ClosedPeriodicEntryBook o1, ClosedPeriodicEntryBook o2) {
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/utils/FiscalPeriodComparator.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/utils/FiscalPeriodComparator.java 2011-09-17 12:55:16 UTC (rev 3289)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/utils/FiscalPeriodComparator.java 2011-09-17 12:55:34 UTC (rev 3290)
@@ -25,17 +25,16 @@
package org.chorem.lima.business.utils;
+import org.chorem.lima.entity.FiscalPeriod;
+
import java.io.Serializable;
import java.util.Comparator;
-import org.chorem.lima.entity.FiscalPeriod;
-public class FiscalPeriodComparator implements Serializable, Comparator<FiscalPeriod>{
+public class FiscalPeriodComparator implements Serializable, Comparator<FiscalPeriod> {
private static final long serialVersionUID = 1L;
-
- /**
- * sort by fiscal begin date
- */
+
+ /** sort by fiscal begin date */
@Override
public int compare(FiscalPeriod o1, FiscalPeriod o2) {
return o1.getBeginDate().compareTo(o2.getBeginDate());
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/utils/FormatsEnum.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/utils/FormatsEnum.java 2011-09-17 12:55:16 UTC (rev 3289)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/utils/FormatsEnum.java 2011-09-17 12:55:34 UTC (rev 3290)
@@ -27,42 +27,44 @@
public enum FormatsEnum {
- HTML(".html","text/html", "Page Html"),
- PDF(".pdf","application/pdf", "Document PDF");
-
+ HTML(".html", "text/html", "Page Html"),
+ PDF(".pdf", "application/pdf", "Document PDF");
+
private final String extension;
+
private final String mimeType;
+
private final String description;
-
+
private FormatsEnum(String extension, String mimeType, String description) {
this.extension = extension;
this.mimeType = mimeType;
this.description = description;
}
-
+
public String getExtension() {
return extension;
}
-
+
public String getMimeType() {
return mimeType;
}
-
- public String getDescription(){
+
+ public String getDescription() {
return description;
}
-
- public static FormatsEnum valueOfExtension(String extension){
+
+ public static FormatsEnum valueOfExtension(String extension) {
FormatsEnum value = null;
-
+
for (FormatsEnum formatsEnum : FormatsEnum.values()) {
- if (extension.equals(formatsEnum.getExtension())){
+ if (extension.equals(formatsEnum.getExtension())) {
value = formatsEnum;
break;
}
}
return value;
}
-
-
+
+
}
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 2011-09-17 12:55:16 UTC (rev 3289)
+++ trunk/lima-business/src/test/java/org/chorem/lima/business/AbstractLimaTest.java 2011-09-17 12:55:34 UTC (rev 3290)
@@ -23,20 +23,20 @@
package org.chorem.lima.business;
-import java.util.Locale;
-
import org.junit.BeforeClass;
import org.nuiton.i18n.I18n;
import org.nuiton.i18n.init.ClassPathI18nInitializer;
+import java.util.Locale;
+
/**
* Common initialization code for all lima tests.
- *
+ *
* @author chatellier
* @version $Revision$
- *
- * Last update : $Date$
- * By : $Author$
+ * <p/>
+ * Last update : $Date$
+ * By : $Author$
*/
public abstract class AbstractLimaTest {
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 2011-09-17 12:55:16 UTC (rev 3289)
+++ trunk/lima-business/src/test/java/org/chorem/lima/business/AccountServiceImplTest.java 2011-09-17 12:55:34 UTC (rev 3290)
@@ -27,9 +27,10 @@
// tchemit-2011-08-11 This test must be redone thinks it does not respect
// See http://chorem.org/issues/428
+
/**
* Tests pour la gestion des comptes dans le plan comptable
- *
+ * <p/>
* Vérification sur l'ajout, la modification et suppression d'un compte.
* Il existe également des tests sur des actions à partir de DTO. La classe
* AccountServiceImplTest possède une méthode upload qui, à partir d'un DTO,
Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/EntryBookServiceImplTest.java
===================================================================
--- trunk/lima-business/src/test/java/org/chorem/lima/business/EntryBookServiceImplTest.java 2011-09-17 12:55:16 UTC (rev 3289)
+++ trunk/lima-business/src/test/java/org/chorem/lima/business/EntryBookServiceImplTest.java 2011-09-17 12:55:34 UTC (rev 3290)
@@ -120,7 +120,7 @@
*/
@Test
public void searchJournalWithLabelTest() throws LimaException {
- List<EntryBook> result = instance.getAllEntryByProperty(EntryBook.LABEL, JOURNAL_DES_VENTES);
+ List<EntryBook> result = instance.getAllEntryByProperty(EntryBook.PROPERTY_LABEL, JOURNAL_DES_VENTES);
Assert.assertNotNull(result);
Assert.assertEquals(1, result.size());
@@ -129,7 +129,7 @@
Assert.assertEquals("Journal des ventes", entryBook.getLabel());
// On ne sait pas ici si ça existe ?!
- result = instance.getAllEntryByProperty(EntryBook.LABEL, "Journal des achats");
+ result = instance.getAllEntryByProperty(EntryBook.PROPERTY_LABEL, "Journal des achats");
Assert.assertNotNull(result);
Assert.assertTrue(result.isEmpty());
// TODO Il faut que ca soit vide : cette entree n'existe pas (pas créée dans le test)
@@ -147,7 +147,7 @@
EntryBook entryBook;
List<EntryBook> entryBooksList;
- entryBooksList = instance.getAllEntryByProperty(EntryBook.LABEL, JOURNAL_DES_VENTES);
+ entryBooksList = instance.getAllEntryByProperty(EntryBook.PROPERTY_LABEL, JOURNAL_DES_VENTES);
Assert.assertNotNull(entryBooksList);
Assert.assertEquals(1, entryBooksList.size());
entryBook = entryBooksList.get(0);
@@ -157,7 +157,7 @@
instance.updateEntryBook(entryBook);
// Recherche du journal dans la bdd
- entryBooksList = instance.getAllEntryByProperty(EntryBook.LABEL, JOURNAL_DES_VENTES);
+ entryBooksList = instance.getAllEntryByProperty(EntryBook.PROPERTY_LABEL, JOURNAL_DES_VENTES);
Assert.assertNotNull(entryBooksList);
Assert.assertEquals(1, entryBooksList.size());
entryBook = entryBooksList.get(0);
Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/FinancialPeriodServiceImplTest.java
===================================================================
--- trunk/lima-business/src/test/java/org/chorem/lima/business/FinancialPeriodServiceImplTest.java 2011-09-17 12:55:16 UTC (rev 3289)
+++ trunk/lima-business/src/test/java/org/chorem/lima/business/FinancialPeriodServiceImplTest.java 2011-09-17 12:55:34 UTC (rev 3290)
@@ -30,18 +30,17 @@
import org.chorem.lima.business.ejb.FinancialPeriodServiceImpl;
import org.junit.AfterClass;
import org.junit.Before;
-import org.junit.BeforeClass;
import org.junit.Test;
/**
* Tests pour la gestion des timespans
- *
+ * <p/>
* Fonctions :
- * _ création d'un timespan
- * _ bloquer un timespan
- * _ débloquer un timespan
- * _ rechercher un timespan
- * _ rechercher une période à partir d'un timespan
+ * _ création d'un timespan
+ * _ bloquer un timespan
+ * _ débloquer un timespan
+ * _ rechercher un timespan
+ * _ rechercher une période à partir d'un timespan
*
* @author Rémi Chapelet
*/
@@ -54,7 +53,8 @@
/**
* On nettoie la base de données
- * @throws java.lang.Exception
+ *
+ * @throws Exception
*/
@AfterClass
public static void tearDownClass() throws Exception {
@@ -71,9 +71,7 @@
public FinancialPeriodServiceImplTest() {
}
- /**
- * Permet de tester l'ajout d'un timspan
- */
+ /** Permet de tester l'ajout d'un timspan */
@Test
public void createTimeSpanTest() {
/*// debut 1 janvier 2011
Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/FiscalPeriodServiceImplTest.java
===================================================================
--- trunk/lima-business/src/test/java/org/chorem/lima/business/FiscalPeriodServiceImplTest.java 2011-09-17 12:55:16 UTC (rev 3289)
+++ trunk/lima-business/src/test/java/org/chorem/lima/business/FiscalPeriodServiceImplTest.java 2011-09-17 12:55:34 UTC (rev 3290)
@@ -25,23 +25,10 @@
package org.chorem.lima.business;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.List;
-
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.chorem.lima.business.ejb.FinancialPeriodServiceImpl;
import org.chorem.lima.business.ejb.FiscalPeriodServiceImpl;
-import org.chorem.lima.business.ejbinterface.FiscalPeriodService;
-import org.chorem.lima.entity.FinancialPeriod;
-import org.chorem.lima.entity.FinancialPeriodImpl;
-import org.chorem.lima.entity.FiscalPeriod;
-import org.chorem.lima.entity.FiscalPeriodDAO;
-import org.chorem.lima.entity.FiscalPeriodImpl;
-import org.chorem.lima.entity.LimaCallaoDAOHelper;
import org.junit.AfterClass;
-import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import org.nuiton.topia.TopiaContext;
@@ -51,13 +38,13 @@
/**
* Tests pour la gestion des périodes
- *
+ * <p/>
* Fonctions :
- * _ création d'une période
- * _ valider une période (si elle est correcte)
- * _ bloquer une période (ATTENTION : on ne peut débloquer une période !)
- * _ rechercher une période
- *
+ * _ création d'une période
+ * _ valider une période (si elle est correcte)
+ * _ bloquer une période (ATTENTION : on ne peut débloquer une période !)
+ * _ rechercher une période
+ *
* @author Rémi Chapelet
*/
public class FiscalPeriodServiceImplTest extends AbstractLimaTest {
@@ -67,9 +54,9 @@
.getLog(FiscalPeriodServiceImplTest.class);
private static FiscalPeriodServiceImpl instance;
-
+
private TopiaContext rootContext;
-
+
public FiscalPeriodServiceImplTest() {
LimaConfig config = LimaTestConfig.getInstance();
try {
@@ -88,7 +75,8 @@
/**
* On nettoie la base de données
- * @throws java.lang.Exception
+ *
+ * @throws Exception
*/
@AfterClass
public static void tearDownClass() throws Exception {
@@ -100,11 +88,10 @@
instance.removePeriod(periodDTO);*/
}
-
-
+
@Test
public void blockFiscalPeriodTest() throws Exception {
-
+
/*TopiaContext transaction = null;
FiscalPeriod recentFiscalPeriod = new FiscalPeriodImpl();
FiscalPeriod oldestFiscalPeriod = new FiscalPeriodImpl();
@@ -169,11 +156,9 @@
Assert.assertEquals(LimaBusinessException.class, ex.getClass());
}*/
}
-
-
- /**
- * Permet de tester l'ajout d'une période.
- */
+
+
+ /** Permet de tester l'ajout d'une période. */
@Test
public void createPeriodTest() {
/*String result;
@@ -310,7 +295,7 @@
// Nombre 12 timeSpans mensuels
Assert.assertEquals(12, listTimeSpanDTO.size());*/
}
-
+
protected TopiaContext beginTransaction() throws TopiaException {
// basic check done, make check in database
// TODO move it into JTA
Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/GeneratorTest.java
===================================================================
--- trunk/lima-business/src/test/java/org/chorem/lima/business/GeneratorTest.java 2011-09-17 12:55:16 UTC (rev 3289)
+++ trunk/lima-business/src/test/java/org/chorem/lima/business/GeneratorTest.java 2011-09-17 12:55:34 UTC (rev 3290)
@@ -25,14 +25,6 @@
package org.chorem.lima.business;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.List;
-
-import javax.transaction.Transaction;
-
-import org.apache.activeio.journal.Journal;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.ejb.AccountServiceImpl;
@@ -42,31 +34,34 @@
import org.chorem.lima.business.ejb.FiscalPeriodServiceImpl;
import org.chorem.lima.entity.Account;
import org.chorem.lima.entity.AccountImpl;
-import org.chorem.lima.entity.Entry;
import org.chorem.lima.entity.EntryBook;
import org.chorem.lima.entity.EntryBookImpl;
-import org.chorem.lima.entity.EntryImpl;
-import org.chorem.lima.entity.FinancialTransaction;
-import org.chorem.lima.entity.FinancialTransactionImpl;
import org.chorem.lima.entity.FiscalPeriod;
import org.chorem.lima.entity.FiscalPeriodImpl;
import org.junit.Before;
import org.junit.Test;
-/**
- *
- * @author Rémi Chapelet
- */
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+
+/** @author Rémi Chapelet */
public class GeneratorTest extends AbstractLimaTest {
/** log. */
private static final Log log = LogFactory.getLog(FinancialTransactionServiceImpl.class);
private static FinancialTransactionServiceImpl instanceTransaction;
+
private static FiscalPeriodServiceImpl instanceFiscalPeriod;
+
private static FinancialPeriodServiceImpl instanceFinancialPeriod;
+
private static EntryBookServiceImpl instanceJournal;
+
private static AccountServiceImpl instanceAccount;
+
private static String topiaIDTransaction;
@Before
@@ -77,15 +72,16 @@
instanceJournal = new EntryBookServiceImpl();
instanceAccount = new AccountServiceImpl();
}
-
+
/**
* Permet de tester l'ajout d'un timspan
- * @throws LimaException
+ *
+ * @throws LimaException
*/
@Test
- public void generate () throws LimaException {
-
+ public void generate() throws LimaException {
+
// Création Journal
EntryBook entryBook1 = new EntryBookImpl();
entryBook1.setLabel("Journal des ventes");
@@ -149,7 +145,7 @@
instanceAccount.createAccount(201, "Frais d'établissement", 20);
instanceAccount.createAccount(207, "Fonds commercial", 20);
instanceAccount.createAccount(21, "Immobilisations corporelles", 2);*/
-
+
Date beginDate;
Date endDate;
Date dateSearch;
@@ -157,16 +153,16 @@
Calendar cal2 = Calendar.getInstance();
Calendar cal3 = Calendar.getInstance();
List<EntryBook> entryBooksList = new ArrayList<EntryBook>();
-
+
// create 5 fiscal years
- for (int annee = 2009 ; annee < 2015 ; annee++) {
-
+ for (int annee = 2009; annee < 2015; annee++) {
+
cal1.set(annee, 0, 1);
beginDate = cal1.getTime();
-
+
cal2.set(annee, 11, 31);
endDate = cal2.getTime();
-
+
FiscalPeriod fiscalPeriod = new FiscalPeriodImpl();
fiscalPeriod.setBeginDate(beginDate);
fiscalPeriod.setEndDate(endDate);
@@ -220,6 +216,6 @@
//instanceFiscalPeriod.blockPeriod(period);
}
}
-
-
+
+
}
Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/LimaTestConfig.java
===================================================================
--- trunk/lima-business/src/test/java/org/chorem/lima/business/LimaTestConfig.java 2011-09-17 12:55:16 UTC (rev 3289)
+++ trunk/lima-business/src/test/java/org/chorem/lima/business/LimaTestConfig.java 2011-09-17 12:55:34 UTC (rev 3290)
@@ -25,23 +25,23 @@
package org.chorem.lima.business;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.chorem.lima.entity.LimaCallaoDAOHelper;
+
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.chorem.lima.entity.LimaCallaoDAOHelper;
-
/**
* Application config instance used it tests. (load custom test configuration)
- *
+ *
* @author chatellier
* @version $Revision$
- *
- * Last update : $Date$
- * By : $Author$
+ * <p/>
+ * Last update : $Date$
+ * By : $Author$
*/
public class LimaTestConfig extends LimaConfig {
1
0
r3289 - in trunk/lima-callao/src/main: java/org/chorem/lima java/org/chorem/lima/entity xmi
by tchemit@users.chorem.org 17 Sep '11
by tchemit@users.chorem.org 17 Sep '11
17 Sep '11
Author: tchemit
Date: 2011-09-17 14:55:16 +0200 (Sat, 17 Sep 2011)
New Revision: 3289
Url: http://chorem.org/repositories/revision/lima/3289
Log:
utilisation du prefixe sur les constantes g?\195?\169n?\195?\169r?\195?\169es + reformat du code
Modified:
trunk/lima-callao/src/main/java/org/chorem/lima/FinancialStatementWayEnum.java
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-callao/src/main/java/org/chorem/lima/entity/FinancialTransactionImpl.java
trunk/lima-callao/src/main/java/org/chorem/lima/entity/VatStatementImpl.java
trunk/lima-callao/src/main/xmi/accounting.properties
Modified: trunk/lima-callao/src/main/java/org/chorem/lima/FinancialStatementWayEnum.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/FinancialStatementWayEnum.java 2011-09-09 16:14:41 UTC (rev 3288)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/FinancialStatementWayEnum.java 2011-09-17 12:55:16 UTC (rev 3289)
@@ -35,12 +35,12 @@
private final String description;
- private FinancialStatementWayEnum(String description) {
+ FinancialStatementWayEnum(String description) {
this.description = description;
}
public String getDescription() {
- return this.description;
+ return description;
}
public static String[] descriptions(){
Modified: trunk/lima-callao/src/main/java/org/chorem/lima/entity/AccountDAOImpl.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/entity/AccountDAOImpl.java 2011-09-09 16:14:41 UTC (rev 3288)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/entity/AccountDAOImpl.java 2011-09-17 12:55:16 UTC (rev 3289)
@@ -25,10 +25,6 @@
package org.chorem.lima.entity;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.StringTokenizer;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -36,10 +32,15 @@
import org.nuiton.topia.framework.TopiaQuery;
import org.nuiton.topia.framework.TopiaQuery.Op;
-public class AccountDAOImpl <E extends Account> extends AccountDAOAbstract<E> {
+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
@@ -47,102 +48,100 @@
@Override
public List<Account> findAllSubAccounts() throws TopiaException {
TopiaQuery query = createQuery();
- String subAccountsProperty = TopiaQuery.getProperty(Account.SUB_ACCOUNTS);
- query.addWhere("not exists elements ("+subAccountsProperty+")")
- .addOrder(Account.ACCOUNT_NUMBER);
+ 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.SUB_ACCOUNTS);
- String subLedgersProperty = TopiaQuery.getProperty(Account.SUB_LEDGERS);
- query.addWhere("not exists elements ("+subAccountsProperty+")")
- .addWhere("not exists elements ("+subLedgersProperty+")")
- .addEquals(Account.ACCOUNT_NUMBER, number);
+ 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 {
+
+ public List<Account> findIntervalAccountByNumber(String accountNumberLow,
+ String accountNumberHigh) throws TopiaException {
TopiaQuery query = createQuery();
- query.addBetween(Account.ACCOUNT_NUMBER, accountNumberLow, accountNumberHigh);
+ query.addBetween(Account.PROPERTY_ACCOUNT_NUMBER,
+ accountNumberLow, accountNumberHigh);
return (List<Account>) findAllByQuery(query);
}
-
+
@Override
public List<Account> stringToListAccounts(String selectedAccounts,
- Boolean subAccountsMode) throws TopiaException {
+ Boolean subAccountsMode) throws TopiaException {
HashSet<Account> accounts = new HashSet<Account>();
- if (selectedAccounts != null){
- //Remove Spaces
- String result = StringUtils.deleteWhitespace(selectedAccounts);
+ 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 =
+ 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);
- }
+
+ //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 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);
}
- else {
- account = findByAccountNumber(s);
- }
- //if exist
- if (account != null){
+ }
+ //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.add(account);
+ if (first) {
+ accounts.addAll(accountsResult);
+ } else {
+ accounts.removeAll(accountsResult);
}
- else {
- accounts.remove(account);
- }
}
- //search all account start with accountnumber
- else {
- TopiaQuery query = createQuery();
- String subAccountsProperty = TopiaQuery.getProperty(Account.SUB_ACCOUNTS);
- query.addWhere("not exists elements ("+subAccountsProperty+")")
- .addWhere(Account.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;
}
+ first = false;
+ }
}
return new ArrayList(accounts);
}
Modified: trunk/lima-callao/src/main/java/org/chorem/lima/entity/ClosedPeriodicEntryBookDAOImpl.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/entity/ClosedPeriodicEntryBookDAOImpl.java 2011-09-09 16:14:41 UTC (rev 3288)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/entity/ClosedPeriodicEntryBookDAOImpl.java 2011-09-17 12:55:16 UTC (rev 3289)
@@ -25,53 +25,47 @@
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.chorem.lima.entity.ClosedPeriodicEntryBook;
-import org.chorem.lima.entity.ClosedPeriodicEntryBookDAOAbstract;
-import org.chorem.lima.entity.EntryBook;
-import org.chorem.lima.entity.FinancialPeriod;
import org.nuiton.topia.TopiaException;
import org.nuiton.topia.framework.TopiaQuery;
import org.nuiton.topia.framework.TopiaQuery.Op;
-public class ClosedPeriodicEntryBookDAOImpl <E extends ClosedPeriodicEntryBook> extends ClosedPeriodicEntryBookDAOAbstract<E>{
+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
- */
+
+ /** 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.ENTRY_BOOK, entryBook);
+ if (entryBook != null) {
+ query.addEquals(ClosedPeriodicEntryBook.PROPERTY_ENTRY_BOOK, entryBook);
}
- if (financialPeriod != null){
- query.addEquals(ClosedPeriodicEntryBook.FINANCIAL_PERIOD, financialPeriod);
+ if (financialPeriod != null) {
+ query.addEquals(ClosedPeriodicEntryBook.PROPERTY_FINANCIAL_PERIOD, financialPeriod);
}
return findByQuery(query);
}
@Override
public List<ClosedPeriodicEntryBook> findAllByDates(Date beginDate,
- Date endDate) throws TopiaException {
+ Date endDate) throws TopiaException {
TopiaQuery query = createQuery();
- if (beginDate != null && endDate != null){
- String beginDateProperty = TopiaQuery.getProperty(ClosedPeriodicEntryBook.FINANCIAL_PERIOD, FinancialPeriod.BEGIN_DATE);
- String endDateProperty = TopiaQuery.getProperty(ClosedPeriodicEntryBook.FINANCIAL_PERIOD, FinancialPeriod.BEGIN_DATE);
- String entrybookProperty = TopiaQuery.getProperty(ClosedPeriodicEntryBook.ENTRY_BOOK, EntryBook.CODE);
+ 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);
+ .addWhere(endDateProperty, Op.LE, endDate)
+ .addOrder(beginDateProperty, entrybookProperty);
}
return (List<ClosedPeriodicEntryBook>) findAllByQuery(query);
}
Modified: trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialPeriodDAOImpl.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialPeriodDAOImpl.java 2011-09-09 16:14:41 UTC (rev 3288)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialPeriodDAOImpl.java 2011-09-17 12:55:16 UTC (rev 3289)
@@ -25,13 +25,13 @@
package org.chorem.lima.entity;
-import java.util.Date;
-
import org.nuiton.topia.TopiaException;
import org.nuiton.topia.framework.TopiaQuery;
-public class FinancialPeriodDAOImpl <E extends FinancialPeriod> extends FinancialPeriodDAOAbstract<E>{
+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
@@ -40,10 +40,10 @@
public FinancialPeriod findByDate(Date date) throws TopiaException {
TopiaQuery query = createQuery();
- if (date != null){
- query.addWhere("beginDate <= :value")
- .addWhere("endDate >= :value")
- .addParam("value", date);
+ if (date != null) {
+ query.addWhere(FinancialPeriod.PROPERTY_BEGIN_DATE + " <= :value")
+ .addWhere(FinancialPeriod.PROPERTY_END_DATE + " >= :value")
+ .addParam("value", date);
}
return findByQuery(query);
}
Modified: trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialStatementImpl.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialStatementImpl.java 2011-09-09 16:14:41 UTC (rev 3288)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialStatementImpl.java 2011-09-17 12:55:16 UTC (rev 3289)
@@ -25,14 +25,16 @@
package org.chorem.lima.entity;
-public class FinancialStatementImpl extends FinancialStatementAbstract{
+public class FinancialStatementImpl extends FinancialStatementAbstract {
+ private static final long serialVersionUID = 1L;
+
protected Integer level;
-
+
@Override
public int getLevel() {
if (level == null) {
- if (masterFinancialStatement != null){
+ if (masterFinancialStatement != null) {
level = masterFinancialStatement.getLevel() + 1;
} else {
level = 1;
Modified: trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialTransactionImpl.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialTransactionImpl.java 2011-09-09 16:14:41 UTC (rev 3288)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialTransactionImpl.java 2011-09-17 12:55:16 UTC (rev 3289)
@@ -35,17 +35,16 @@
@Override
public void setAmounts() {
- if (amountDebit == null){
+ if (amountDebit == null) {
amountDebit = new BigDecimal(0);
}
- if (amountCredit == null){
- amountCredit = new BigDecimal(0);
+ if (amountCredit == null) {
+ amountCredit = new BigDecimal(0);
}
for (Entry entryFT : entry) {
- if (entryFT.getDebit()){
+ if (entryFT.getDebit()) {
amountDebit = amountDebit.add(entryFT.getAmount());
- }
- else {
+ } else {
amountCredit = amountCredit.add(entryFT.getAmount());
}
}
Modified: trunk/lima-callao/src/main/java/org/chorem/lima/entity/VatStatementImpl.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/entity/VatStatementImpl.java 2011-09-09 16:14:41 UTC (rev 3288)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/entity/VatStatementImpl.java 2011-09-17 12:55:16 UTC (rev 3289)
@@ -26,12 +26,14 @@
public class VatStatementImpl extends VatStatementAbstract {
+ private static final long serialVersionUID = 1L;
+
protected Integer level;
-
+
@Override
public int getLevel() {
if (level == null) {
- if (masterVatStatement != null){
+ if (masterVatStatement != null) {
level = masterVatStatement.getLevel() + 1;
} else {
level = 1;
Modified: trunk/lima-callao/src/main/xmi/accounting.properties
===================================================================
--- trunk/lima-callao/src/main/xmi/accounting.properties 2011-09-09 16:14:41 UTC (rev 3288)
+++ trunk/lima-callao/src/main/xmi/accounting.properties 2011-09-17 12:55:16 UTC (rev 3289)
@@ -24,6 +24,7 @@
###
# Precise l'entete de l'ensemble des fichiers generes
model.tagvalue.copyright=/*\n Copyright (C) 2009-2010 Lima Callao\n */
+model.tagvalue.constantPrefix=PROPERTY_
# natural id
org.chorem.lima.entity.Account.class.tagvalue.naturalIdMutable=false
1
0
Author: tchemit
Date: 2011-09-09 18:14:41 +0200 (Fri, 09 Sep 2011)
New Revision: 3288
Url: http://chorem.org/repositories/revision/lima/3288
Log:
use new site deployment configuration
Modified:
trunk/lima-business/pom.xml
trunk/lima-swing/pom.xml
trunk/pom.xml
Modified: trunk/lima-business/pom.xml
===================================================================
--- trunk/lima-business/pom.xml 2011-09-09 16:10:08 UTC (rev 3287)
+++ trunk/lima-business/pom.xml 2011-09-09 16:14:41 UTC (rev 3288)
@@ -1,4 +1,6 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<!-- ************************************************************* -->
@@ -18,7 +20,7 @@
<groupId>org.apache.openejb</groupId>
<artifactId>javaee-api</artifactId>
<scope>provided</scope>
- </dependency>
+ </dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>lima-callao</artifactId>
@@ -104,7 +106,7 @@
<properties>
<!--Main class in JAR -->
<maven.jar.main.class>org.chorem.lima.LimaServer</maven.jar.main.class>
-
+
<redmine.releaseFiles>
target/lima-server-${project.version}-bin.zip,
</redmine.releaseFiles>
@@ -173,7 +175,7 @@
</plugin>
</plugins>
</build>
-
+
<profiles>
<profile>
<id>assembly-profile</id>
@@ -189,9 +191,9 @@
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<finalName>lima-server-${project.version}</finalName>
- <descriptors>
- <descriptor>src/main/assembly/bin.xml</descriptor>
- </descriptors>
+ <descriptors>
+ <descriptor>src/main/assembly/bin.xml</descriptor>
+ </descriptors>
<attach>false</attach>
</configuration>
<executions>
Modified: trunk/lima-swing/pom.xml
===================================================================
--- trunk/lima-swing/pom.xml 2011-09-09 16:10:08 UTC (rev 3287)
+++ trunk/lima-swing/pom.xml 2011-09-09 16:14:41 UTC (rev 3288)
@@ -128,7 +128,8 @@
<properties>
<!--Main class in JAR -->
<maven.jar.main.class>org.chorem.lima.LimaMain</maven.jar.main.class>
-
+ <webstartPluginVersion>1.0-beta-2-SNAPSHOT</webstartPluginVersion>
+
<redmine.releaseFiles>
target/lima-${project.version}-bin.zip,
</redmine.releaseFiles>
@@ -139,7 +140,8 @@
<i18n.bundles>fr_FR,en_GB</i18n.bundles>
<i18n.bundleOutputName>lima</i18n.bundleOutputName>
-
+ <jnlp.codebase>${project.url}/jnlp</jnlp.codebase>
+
</properties>
<build>
@@ -245,18 +247,31 @@
</plugin>
<plugin>
- <groupId>org.nuiton.thirdparty</groupId>
+ <groupId>org.codehaus.mojo.webstart</groupId>
<artifactId>webstart-maven-plugin</artifactId>
+ <version>${webstartPluginVersion}</version>
<configuration>
+ <libPath>lib</libPath>
+ <makeArchive>false</makeArchive>
+ <verbose>false</verbose>
+
+ <jnlp>
+ <mainClass>${maven.jar.main.class}</mainClass>
+ <allPermissions>true</allPermissions>
+ <offlineAllowed>true</offlineAllowed>
+ </jnlp>
+ <sign>
+ <keystore>${keystorepath}</keystore>
+ <storepass>${keystorepass}</storepass>
+ <alias>${keyalias}</alias>
+ <keypass>${keypass}</keypass>
+ <verify>true</verify>
+ <keystoreConfig>
+ <delete>false</delete>
+ <gen>false</gen>
+ </keystoreConfig>
+ </sign>
<jnlpExtensions>
- <!--jnlpExtension>
- <name>sun</name>
- <title>Sun MicroSystems</title>
- <vendor>Sun MicroSystems, Inc.</vendor>
- <includes>
- <include>javax.help:javahelp</include>
- </includes>
- </jnlpExtension-->
<jnlpExtension>
<name>jxlayer</name>
<title>Swing labs JXLayer</title>
@@ -289,9 +304,9 @@
<reporting>
<plugins>
<plugin>
- <groupId>org.nuiton.thirdparty</groupId>
+ <groupId>org.codehaus.mojo.webstart</groupId>
<artifactId>webstart-maven-plugin</artifactId>
- <version>1.0-alpha-2-cl_20091001</version>
+ <version>${webstartPluginVersion}</version>
</plugin>
</plugins>
</reporting>
@@ -332,7 +347,7 @@
</plugin>
<!-- make webstart -->
<plugin>
- <groupId>org.nuiton.thirdparty</groupId>
+ <groupId>org.codehaus.mojo.webstart</groupId>
<artifactId>webstart-maven-plugin</artifactId>
<executions>
<execution>
@@ -348,7 +363,62 @@
</build>
</profile>
+ <!-- just add to buil the local webstart (codebase will be in target/jnlp) -->
<profile>
+ <id>local-jnlp-profile</id>
+ <activation>
+ <property>
+ <name>doLocalWebstart</name>
+ <value>true</value>
+ </property>
+ </activation>
+ <properties>
+ <jnlp.codebase>file://${project.build.directory}/jnlp</jnlp.codebase>
+ </properties>
+ <build>
+ <plugins>
+
+ <plugin>
+ <groupId>org.nuiton</groupId>
+ <artifactId>maven-helper-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>get-keystore</id>
+ <goals>
+ <goal>share-server-secret</goal>
+ </goals>
+ <phase>package</phase>
+ <configuration>
+ <serverId>codelutin-keystore</serverId>
+ <privateKeyOut>keystorepath</privateKeyOut>
+ <passwordOut>keystorepass</passwordOut>
+ <usernameOut>keyalias</usernameOut>
+ <passphraseOut>keypass</passphraseOut>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.codehaus.mojo.webstart</groupId>
+ <artifactId>webstart-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>generate-jnlp-local</id>
+ <phase>package</phase>
+ <goals>
+ <goal>jnlp-inline</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ </plugins>
+ </build>
+ </profile>
+
+
+ <profile>
<id>assembly-profile</id>
<activation>
<property>
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2011-09-09 16:10:08 UTC (rev 3287)
+++ trunk/pom.xml 2011-09-09 16:14:41 UTC (rev 3288)
@@ -210,7 +210,6 @@
<version>1.5.0</version>
</dependency>
-
</dependencies>
</dependencyManagement>
@@ -378,6 +377,13 @@
<url>http://www.chorem.org/repositories/browse/lima/trunk</url>
</scm>
+ <distributionManagement>
+ <site>
+ <id>${platform}</id>
+ <url>${our.site.repository}/${projectId}</url>
+ </site>
+ </distributionManagement>
+
<repositories>
<!-- depot des releases nuiton -->
<!--repository>
1
0
Author: tchemit
Date: 2011-09-09 18:10:08 +0200 (Fri, 09 Sep 2011)
New Revision: 3287
Url: http://chorem.org/repositories/revision/lima/3287
Log:
Update mavenpom4redmine to 3.0.3.
Modified:
trunk/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2011-08-19 16:31:43 UTC (rev 3286)
+++ trunk/pom.xml 2011-09-09 16:10:08 UTC (rev 3287)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>mavenpom4redmine</artifactId>
- <version>3.0.2</version>
+ <version>3.0.3</version>
</parent>
<groupId>org.chorem</groupId>
1
0