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
r3306 - in trunk/lima-swing: . src/main/java/org/chorem/lima src/main/java/org/chorem/lima/ui/account src/main/resources src/main/resources/META-INF src/main/resources/i18n
by tchemit@users.chorem.org 27 Sep '11
by tchemit@users.chorem.org 27 Sep '11
27 Sep '11
Author: tchemit
Date: 2011-09-27 10:38:55 +0200 (Tue, 27 Sep 2011)
New Revision: 3306
Url: http://chorem.org/repositories/revision/lima/3306
Log:
Evolution #448: [Plan comptable] Ouverture longue
Evolution #446: [Plan comptable] Cr?\195?\169ation des num?\195?\169ros de compte interm?\195?\169diaires lors de la cr?\195?\169ation d'un nouveau compte
Ajout de la configuration pour auditer l'application via nuiton-profiling
Added:
trunk/lima-swing/src/main/resources/META-INF/
trunk/lima-swing/src/main/resources/META-INF/aop.xml
Modified:
trunk/lima-swing/pom.xml
trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountForm.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountTreeTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/SubLedgerForm.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/UpdateAccountForm.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/UpdateSubLedgerForm.jaxx
trunk/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties
trunk/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties
Modified: trunk/lima-swing/pom.xml
===================================================================
--- trunk/lima-swing/pom.xml 2011-09-27 08:28:48 UTC (rev 3305)
+++ trunk/lima-swing/pom.xml 2011-09-27 08:38:55 UTC (rev 3306)
@@ -48,6 +48,11 @@
<groupId>org.nuiton</groupId>
<artifactId>nuiton-utils</artifactId>
</dependency>
+
+ <dependency>
+ <groupId>org.nuiton</groupId>
+ <artifactId>nuiton-profiling</artifactId>
+ </dependency>
<dependency>
<groupId>org.nuiton.topia</groupId>
@@ -341,6 +346,7 @@
<jnlp.codebase>file://${project.build.directory}/jnlp</jnlp.codebase>
</properties>
<build>
+ <defaultGoal>verify</defaultGoal>
<plugins>
<plugin>
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-27 08:28:48 UTC (rev 3305)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java 2011-09-27 08:38:55 UTC (rev 3306)
@@ -37,8 +37,12 @@
import org.chorem.lima.ui.MainViewHandler;
import org.chorem.lima.ui.opening.OpeningView;
import org.chorem.lima.util.ErrorHelper;
+import org.nuiton.profiling.NuitonTrace;
+import org.nuiton.util.FileUtil;
import javax.swing.SwingUtilities;
+import java.io.File;
+import java.io.IOException;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
@@ -134,11 +138,9 @@
log.warn(_("lima.warning.nimbus.landf"));
}
}
-
return context;
}
-
protected static void launch(LimaContext context) throws Exception {
splash.drawVersion(config.getVersion());
@@ -181,7 +183,17 @@
ui.setVisible(true);
}
});
+ }
+ protected static void saveTraces(File file) {
+ String stats = NuitonTrace.getStatisticsCSVAndClear();
+ try {
+ FileUtil.writeString(file, stats, "utf-8");
+ } catch (IOException e) {
+ if (log.isErrorEnabled()) {
+ log.error("Could not save traces to file " + file, e);
+ }
+ }
}
public static class ShutdownHook extends Thread {
@@ -194,6 +206,12 @@
public void run() {
try {
super.run();
+ File file = new File("lima-trace.csv");
+ saveTraces(file);
+ String stats = NuitonTrace.getStatisticsCSVAndClear();
+ if (log.isInfoEnabled()) {
+ log.info(stats);
+ }
LimaContext.get().close();
LimaServiceFactory.destroy();
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-27 08:28:48 UTC (rev 3305)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountForm.jaxx 2011-09-27 08:38:55 UTC (rev 3306)
@@ -23,23 +23,27 @@
#L%
-->
-<JDialog modal="true"
- defaultCloseOperation="{JDialog.DO_NOTHING_ON_CLOSE}"
- onWindowClosing="performCancel();">
+<JDialog modal="true" defaultCloseOperation="{JDialog.DO_NOTHING_ON_CLOSE}"
+ onWindowClosing="dispose()">
<import>
javax.swing.text.Document
org.chorem.lima.entity.Account
</import>
+ <AccountViewHandler id='handler'
+ initializer='getContextValue(AccountView.class,JAXXUtil.PARENT).getHandler()'/>
+
<Account id="account" javaBean='null'/>
<script>
<![CDATA[
getRootPane().setDefaultButton(ok);
- protected void performCancel() {
- setAccount(null);
- dispose();
+
+ @Override
+ public void dispose() {
+ setAccount(null);
+ super.dispose();
}
]]>
</script>
@@ -48,34 +52,35 @@
<row>
<cell fill="horizontal">
- <JLabel text="lima.charts.account.number"/>
+ <JLabel text="lima.charts.account.number" labelFor='{numberTextField}'/>
</cell>
<cell fill="horizontal">
<JTextField id="numberTextField"
- text="{getAccount().getAccountNumber()}"/>
- <Document javaBean="getNumberTextField().getDocument()"
- onInsertUpdate='getAccount().setAccountNumber(getNumberTextField().getText())'
- onRemoveUpdate='getAccount().setAccountNumber(getNumberTextField().getText())'/>
+ text="{account.getAccountNumber()}"/>
+ <Document initializer="numberTextField.getDocument()"
+ onInsertUpdate='account.setAccountNumber(numberTextField.getText())'
+ onRemoveUpdate='account.setAccountNumber(numberTextField.getText())'/>
</cell>
</row>
<row>
<cell fill="horizontal">
- <JLabel text="lima.common.label"/>
+ <JLabel text="lima.common.label" labelFor='{descriptionTextField}'/>
</cell>
<cell fill="horizontal">
<JTextField id="descriptionTextField" text="{getAccount().getLabel()}"/>
- <Document javaBean="getDescriptionTextField().getDocument()"
- onInsertUpdate='getAccount().setLabel(getDescriptionTextField().getText())'
- onRemoveUpdate='getAccount().setLabel(getDescriptionTextField().getText())'/>
+ <Document initializer="descriptionTextField.getDocument()"
+ onInsertUpdate='account.setLabel(descriptionTextField.getText())'
+ onRemoveUpdate='account.setLabel(descriptionTextField.getText())'/>
</cell>
</row>
<row>
- <cell fill="none">
- <JButton text="lima.common.cancel" onActionPerformed="performCancel()"/>
+ <cell columns="2">
+ <JPanel layout='{new GridLayout(1,0)}'>
+ <JButton text="lima.common.cancel" onActionPerformed="dispose()"/>
+ <JButton id="ok" text="lima.common.ok"
+ onActionPerformed="handler.doAddAccount(this)"/>
+ </JPanel>
</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/AccountTreeTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountTreeTableModel.java 2011-09-27 08:28:48 UTC (rev 3305)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountTreeTableModel.java 2011-09-27 08:38:55 UTC (rev 3306)
@@ -142,26 +142,26 @@
break;
case 1:
result = account.getLabel();
- if (log.isInfoEnabled()) {
- log.info("Get label '" + result +
- "' for account [" +
- account.getAccountNumber() + "]");
- }
break;
}
}
return result;
}
+
+ @Override
+ public int getColumnCount() {
+ return 2;
+ }
}
/** Model constructor. Init account service used here. */
public AccountTreeTableModel() {
setColumnIdentifiers(Arrays.asList(_("lima.table.number"),
- _("lima.table.label"))
- );
+ _("lima.table.label")));
setRoot(new AccountTreeTableNode(null));
+
// Gets factory service
accountService =
LimaServiceFactory.getService(AccountServiceMonitorable.class);
@@ -339,7 +339,7 @@
}
/** Refresh accountschart. */
- public void refreshTree() throws LimaException {
+ public void refreshTree() {
modelSupport.fireNewRoot();
}
@@ -348,15 +348,27 @@
* Remove account.
*
* @param path
- * @param account
* @throws LimaException
*/
- public void removeAccount(TreePath path,
- Account account) throws LimaException {
+ public void removeAccount(TreePath path) throws LimaException {
+
// Calling account service
+ AccountTreeTableNode node = getLastPathComponent(path);
+ Account account = node.getUserObject();
int index = getIndexOfChild(
- path.getParentPath().getLastPathComponent(), account);
+ path.getParentPath().getLastPathComponent(), node);
accountService.removeAccount(account);
- modelSupport.fireChildRemoved(path.getParentPath(), index, account);
+ modelSupport.fireChildRemoved(path.getParentPath(), index, node);
}
+
+ public Account getAccount(TreePath path) {
+ AccountTreeTableNode lastPathComponent = getLastPathComponent(path);
+ Account account = lastPathComponent.getUserObject();
+ return account;
+ }
+
+ public AccountTreeTableNode getLastPathComponent(TreePath path) {
+ AccountTreeTableNode lastPathComponent = (AccountTreeTableNode) path.getLastPathComponent();
+ return lastPathComponent;
+ }
}
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-27 08:28:48 UTC (rev 3305)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountView.jaxx 2011-09-27 08:38:55 UTC (rev 3306)
@@ -24,7 +24,6 @@
-->
<Table>
-
<import>
javax.swing.ListSelectionModel
org.jdesktop.swingx.JXTreeTable
@@ -38,7 +37,7 @@
<script>
<![CDATA[
void $afterCompleteSetup() {
- getHandler().init();
+ handler.init();
}
]]>
</script>
@@ -56,33 +55,33 @@
</cell>
<cell fill="horizontal">
<JButton id="addButton" text="lima.charts.account.addAccount"
- onActionPerformed="handler.addAccount()"/>
+ onActionPerformed="handler.launchAddAccountForm()"/>
</cell>
</row>
<row>
<cell fill="horizontal">
<JButton id="addSubLedger" text="lima.charts.account.addSubLedger"
- onActionPerformed="handler.addSubLedger()"/>
+ onActionPerformed="handler.launchAddSubLedgerForm()"/>
</cell>
</row>
<row>
<cell fill="horizontal">
<JButton id="updateButton" text="lima.common.update"
- onActionPerformed="handler.updateAccount()"
+ onActionPerformed="handler.launchUpdateAccountForm()"
enabled="{isSelectedRow()}"/>
</cell>
</row>
<row>
<cell fill="horizontal">
<JButton id="removeButton" text="lima.common.remove"
- onActionPerformed="handler.removeAccount()"
+ onActionPerformed="handler.doRemoveAccount()"
enabled="{isSelectedRow()}"/>
</cell>
</row>
<row>
<cell fill="horizontal">
<JButton id="importButton" text="lima.importexport.import"
- onActionPerformed="handler.importAccountsChart()"/>
+ onActionPerformed="handler.doImportAccountsChart()"/>
</cell>
</row>
</Table>
\ No newline at end of file
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java 2011-09-27 08:28:48 UTC (rev 3305)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java 2011-09-27 08:38:55 UTC (rev 3306)
@@ -30,7 +30,6 @@
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.AccountServiceMonitorable;
import org.chorem.lima.business.ImportServiceMonitorable;
-import org.chorem.lima.business.LimaBusinessException;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.business.ServiceListener;
import org.chorem.lima.business.ejbinterface.AccountService;
@@ -75,11 +74,12 @@
this.view = view;
// Gets factory service
LimaServiceFactory.addServiceListener(ImportServiceMonitorable.class, this);
- accountService = LimaServiceFactory.getService(AccountServiceMonitorable.class);
+ accountService =
+ LimaServiceFactory.getService(AccountServiceMonitorable.class);
}
public void init() {
- JXTreeTable table = view.getAccountsTreeTable();
+ JXTreeTable table = getTreeTable();
table.addKeyListener(new KeyAdapter() {
/**
* for each action combination key are think
@@ -107,192 +107,184 @@
});
}
- /** Add new account with account form. */
- public void addAccount() {
+ public void launchAddAccountForm() {
- JXTreeTable accountsTreeTable = view.getAccountsTreeTable();
- AccountTreeTableModel accountsTreeTableModel =
- (AccountTreeTableModel) accountsTreeTable.getTreeTableModel();
-
Account newAccount = new AccountImpl();
AccountForm accountForm = new AccountForm(view);
accountForm.setAccount(newAccount);
// jaxx constructor don't call super() ?
accountForm.setLocationRelativeTo(view);
accountForm.setVisible(true);
+ }
+ public void launchAddSubLedgerForm() {
- // null == cancel action
- newAccount = accountForm.getAccount();
- Account parentAccount = new AccountImpl();
- if (newAccount != null) {
- //get the account number been created
- String number = newAccount.getAccountNumber();
+ Account newAccount = new AccountImpl();
+ SubLedgerForm subledgerForm = new SubLedgerForm(view);
+ subledgerForm.setAccount(newAccount);
+ // jaxx constructor don't call super() ?
+ subledgerForm.setLocationRelativeTo(view);
+ subledgerForm.setVisible(true);
+ }
- //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++) {
- try {
- //get the parent account from the new account subnumber
- parentAccount = accountService.getAccountByNumber(number.substring(0, i));
- } catch (LimaException eee) {
- log.debug("Can't search account : " + number.substring(0, i), eee);
+ /**
+ * Open update account (or subledger) form with selected account
+ * from the tree.
+ */
+ public void launchUpdateAccountForm() {
+
+ Account selectedObject = getSelectedAccount();
+
+ if (selectedObject != null) {
+
+ if (selectedObject.getGeneralLedger() == null) {
+ UpdateAccountForm accountForm = new UpdateAccountForm(view);
+ accountForm.setAccount(selectedObject);
+ // jaxx constructor don't call super() ?
+ accountForm.setLocationRelativeTo(view);
+ accountForm.setVisible(true);
+ } else {
+ UpdateSubLedgerForm subLedgerForm = new UpdateSubLedgerForm(view);
+ subLedgerForm.setAccount(selectedObject);
+ // jaxx constructor don't call super() ?
+ subLedgerForm.setLocationRelativeTo(view);
+ subLedgerForm.setVisible(true);
+ }
+ }
+ }
+
+ /**
+ * Add new account with account form.
+ *
+ * @param dialog the account form
+ */
+ public void doAddAccount(AccountForm dialog) {
+ try {
+ Account newAccount = dialog.getAccount();
+
+ Account masterAccount = null;
+
+ if (newAccount.getAccountNumber().length() > 1) {
+
+ // a master account is required
+ masterAccount = getMasterAccount(newAccount);
+
+ if (masterAccount == null) {
+
+ // bye-bye :(
+ return;
}
- 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));
- break;
- } catch (LimaException eee) {
- log.debug("Can't search account : " + number.substring(0, i - 1), eee);
- }
- }
}
// add it
try {
- accountsTreeTableModel.addAccount(parentAccount, newAccount);
- } catch (LimaBusinessException eee) {
- if (log.isErrorEnabled()) {
- log.error("Can't add account", eee);
- }
- DialogHelper.showErrorMessageDialog(view, eee);
-
+ getTreeTableModel().addAccount(masterAccount, newAccount);
} catch (LimaException ex) {
if (log.isErrorEnabled()) {
log.error("Can't add account", ex);
}
- ErrorHelper.showErrorDialog(_("lima.account.addaccounterror"), ex);
+ ErrorHelper.showErrorDialog(view, _("lima.account.addaccounterror"), ex);
}
+ } finally {
+ dialog.dispose();
}
}
- public void addSubLedger() {
+ public void doAddSubLedger(SubLedgerForm dialog) {
- JXTreeTable accountsTreeTable = view.getAccountsTreeTable();
- AccountTreeTableModel accountsTreeTableModel =
- (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();
+ try {
+ Account newAccount = dialog.getAccount();
- // null == cancel action
- if (newAccount != null) {
- Account parentAccount = new AccountImpl();
- String number = newAccount.getAccountNumber();
+ Account masterAccount = null;
- //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++) {
- try {
- //get the parent account from the new account subnumber
- parentAccount = accountService.getAccountByNumber(number.substring(0, i));
- } catch (LimaException eee) {
- log.debug("Can't search account : " + number.substring(0, i), eee);
+ if (newAccount.getAccountNumber().length() > 1) {
+
+ // a master account is required
+ masterAccount = getMasterAccount(newAccount);
+
+ if (masterAccount == null) {
+
+ // bye-bye :(
+ return;
}
- 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));
- break;
- } catch (LimaException eee) {
- log.debug("Can't search account : " + number.substring(0, i - 1), eee);
- }
- }
}
// add it
try {
- accountsTreeTableModel.addSubLedger(parentAccount, newAccount);
- } catch (LimaBusinessException eee) {
- if (log.isErrorEnabled()) {
- log.error("Can't add subledger", eee);
- }
- DialogHelper.showErrorMessageDialog(view, eee);
+ getTreeTableModel().addSubLedger(masterAccount, newAccount);
} catch (LimaException eee) {
if (log.isErrorEnabled()) {
log.error("Can't add subledger", eee);
}
- DialogHelper.showErrorMessageDialog(view, eee);
+ ErrorHelper.showErrorDialog(view, "Can't add subledger", eee);
}
+ } finally {
+ dialog.dispose();
}
}
- /**
- * Open account form with selected account.
- * Verifiy if it's an account or a subledger
- */
- public void updateAccount() {
- JXTreeTable table = view.getAccountsTreeTable();
- AccountTreeTableModel tableModel =
- (AccountTreeTableModel) table.getTreeTableModel();
+ public void doUpdateAccount(UpdateAccountForm dialog) {
- // get selected account
- int selectedRow = table.getSelectedRow();
- TreePath treePath = table.getPathForRow(selectedRow); // not null
- AccountTreeTableModel.AccountTreeTableNode lastPathComponent =
- (AccountTreeTableModel.AccountTreeTableNode) treePath.getLastPathComponent();
- Account selectedObject = lastPathComponent.getUserObject();
- //update Account or update SubLedger
- if (selectedObject != null) {
- // get current selection path
- if (selectedRow != -1) {
- treePath = table.getPathForRow(selectedRow);
- } else {
- treePath = new TreePath(tableModel.getRoot());
+ Account account = dialog.getAccount();
+
+ String newMasterAccountNumber =
+ dialog.getMasterAccountTextField().getText();
+ String newLabel = dialog.getDescriptionTextField().getText();
+
+ boolean hasChanged =
+ updateMasterAccount(account, newMasterAccountNumber);
+ hasChanged |= updateLabel(account, newLabel);
+
+ try {
+ if (hasChanged) {
+
+ // can update account
+ updateAccount(account);
}
- //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();
+
+ } finally {
+
+ // close dialog
+ dialog.dispose();
+ }
+ }
+
+ public void doUpdateSubLedger(UpdateSubLedgerForm dialog) {
+
+ Account account = dialog.getAccount();
+
+ String newMasterAccountNumber =
+ dialog.getMasterAccountTextField().getText();
+ String newLabel = dialog.getDescriptionTextField().getText();
+ String newThirdParty = dialog.getThirdPartyTextField().getText();
+
+ boolean hasChanged = updateMasterAccount(account,
+ newMasterAccountNumber);
+ hasChanged |= updateLabel(account, newLabel);
+ hasChanged |= updateThirdParty(account, newThirdParty);
+
+ try {
+ if (hasChanged) {
+
+ // can update subLedger
+ updateAccount(account);
}
- // 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 {
- tableModel.
- updateAccount(selectedObject);
- } catch (LimaException eee) {
- if (log.isErrorEnabled()) {
- log.error("Can't add update", eee);
- }
- DialogHelper.showErrorMessageDialog(view, eee);
- }
- }
+
+ } finally {
+
+ // close dialog
+ dialog.dispose();
}
}
/** Ask for user to remove for selected account, and remove it if confirmed. */
- public void removeAccount() {
+ public void doRemoveAccount() {
// maybe this code can be factorised
- JXTreeTable accountsTreeTable = view.getAccountsTreeTable();
- AccountTreeTableModel accountsTreeTableModel =
- (AccountTreeTableModel) accountsTreeTable.getTreeTableModel();
+ JXTreeTable treeTable = getTreeTable();
// Any row selected
- int selectedRow = view.getAccountsTreeTable().getSelectedRow();
+ int selectedRow = treeTable.getSelectedRow();
if (selectedRow != -1) {
int n = JOptionPane.showConfirmDialog(view,
_("lima.charts.account.question.remove"),
@@ -301,12 +293,11 @@
JOptionPane.QUESTION_MESSAGE);
if (n == JOptionPane.YES_OPTION) {
// update view of treetable
- TreePath treePath = view.getAccountsTreeTable().
- getPathForRow(selectedRow);
- Account account = (Account) treePath.getLastPathComponent();
+ TreePath treePath =
+ treeTable.getPathForRow(selectedRow);
try {
- accountsTreeTableModel.removeAccount(treePath, account);
+ getTreeTableModel().removeAccount(treePath);
} catch (LimaException eee) {
if (log.isErrorEnabled()) {
log.error("Can't delete account", eee);
@@ -317,23 +308,8 @@
}
}
- public void refresh() {
- JXTreeTable accountsTreeTable = view.getAccountsTreeTable();
- AccountTreeTableModel accountsTreeTableModel =
- (AccountTreeTableModel) accountsTreeTable.getTreeTableModel();
- try {
- accountsTreeTableModel.refreshTree();
- } catch (LimaException eee) {
- if (log.isDebugEnabled()) {
- log.debug("Can't refresh model", eee);
- }
- }
- //refresh view
- view.repaint();
- }
+ public void doImportAccountsChart() {
- public void importAccountsChart() {
-
AccountImportForm form = new AccountImportForm();
//
form.setLocationRelativeTo(view);
@@ -367,65 +343,17 @@
if (methodeName.contains("importAccounts") ||
methodeName.contains("importAll") ||
methodeName.contains("importAsCSV")) {
- refresh();
- }
- }
+ // refresh model
+ getTreeTableModel().refreshTree();
- public void performOk(UpdateAccountForm dialog) {
-
-
- Account account = dialog.getAccount();
-
- String newMasterAccountNumber =
- dialog.getMasterAccountTextField().getText();
- String newLabel = dialog.getDescriptionTextField().getText();
-
- boolean hasChanged =
- updateMasterAccount(account, newMasterAccountNumber);
- hasChanged |= updateLabel(account, newLabel);
-
- if (!hasChanged) {
-
- // nothing has changed
- dialog.setAccount(null);
+ //FIXME tchemit-2011-09-23 Should never do this... refresh view
+ view.repaint();
}
- dialog.dispose();
}
- public void performCancel(UpdateAccountForm dialog) {
- dialog.setAccount(null);
- dialog.dispose();
- }
-
- public void performOk(UpdateSubLedgerForm dialog) {
-
-
- Account account = dialog.getAccount();
-
- String newMasterAccountNumber =
- dialog.getMasterAccountTextField().getText();
- String newLabel = dialog.getDescriptionTextField().getText();
- String newThirdParty = dialog.getThirdPartyTextField().getText();
-
- boolean hasChanged = updateMasterAccount(account, newMasterAccountNumber);
- hasChanged |= updateLabel(account, newLabel);
- hasChanged |= updateThirdParty(account, newThirdParty);
-
- if (!hasChanged) {
-
- // nothing has changed
- dialog.setAccount(null);
- }
- dialog.dispose();
- }
-
- public void performCancel(UpdateSubLedgerForm dialog) {
- dialog.setAccount(null);
- dialog.dispose();
- }
-
- protected boolean updateMasterAccount(Account account, String newMasterAccountNumber) {
+ protected boolean updateMasterAccount(Account account,
+ String newMasterAccountNumber) {
boolean hasChanged = false;
String oldMasterAccountNumber = account.getMasterAccount() == null ?
"" :
@@ -478,4 +406,69 @@
return hasChanged;
}
+
+ protected void updateAccount(Account selectedObject) {
+ try {
+ getTreeTableModel().updateAccount(selectedObject);
+ } catch (LimaException eee) {
+ if (log.isErrorEnabled()) {
+ log.error("Can't add update", eee);
+ }
+ DialogHelper.showErrorMessageDialog(view, eee);
+ }
+ }
+
+ protected JXTreeTable getTreeTable() {
+ return view.getAccountsTreeTable();
+ }
+
+ protected AccountTreeTableModel getTreeTableModel() {
+ AccountTreeTableModel model =
+ (AccountTreeTableModel) getTreeTable().getTreeTableModel();
+ return model;
+ }
+
+ protected Account getMasterAccount(Account account) {
+
+ String number = account.getAccountNumber();
+
+ Account masterAccount;
+
+
+ //search for the nearest account from the one been created
+ //e.g.: for 41019 search for 4, 41, 410, 4101
+ //and stop when the account doesn't exist, use last account found instead
+ try {
+
+ masterAccount = accountService.getMasterAccount(number);
+
+ } catch (LimaException eee) {
+ if (log.isErrorEnabled()) {
+ log.error("Can't obtain master account for account number " + number, eee);
+ }
+ ErrorHelper.showErrorDialog(view, "Can't obtain master account for account number " + number, eee);
+ return null;
+ }
+
+ if (masterAccount == null) {
+ ErrorHelper.showErrorDialog(_("lima.error.no.masteraccount", number));
+ return null;
+ }
+ return masterAccount;
+ }
+
+ protected Account getSelectedAccount() {
+
+ JXTreeTable table = getTreeTable();
+
+ Account selectedObject = null;
+ int selectedRow = table.getSelectedRow();
+ if (selectedRow > -1) {
+ TreePath treePath = table.getPathForRow(selectedRow);
+ AccountTreeTableModel.AccountTreeTableNode lastPathComponent =
+ (AccountTreeTableModel.AccountTreeTableNode) treePath.getLastPathComponent();
+ selectedObject = lastPathComponent.getUserObject();
+ }
+ return selectedObject;
+ }
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/SubLedgerForm.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/SubLedgerForm.jaxx 2011-09-27 08:28:48 UTC (rev 3305)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/SubLedgerForm.jaxx 2011-09-27 08:38:55 UTC (rev 3306)
@@ -23,23 +23,27 @@
#L%
-->
-<JDialog modal="true"
- defaultCloseOperation="{JDialog.DO_NOTHING_ON_CLOSE}"
- onWindowClosing="performCancel();">
+<JDialog modal="true" defaultCloseOperation="{JDialog.DO_NOTHING_ON_CLOSE}"
+ onWindowClosing="dispose()">
<import>
javax.swing.text.Document
org.chorem.lima.entity.Account
</import>
+ <AccountViewHandler id='handler'
+ initializer='getContextValue(AccountView.class,JAXXUtil.PARENT).getHandler()'/>
+
<Account id="account" javaBean='null'/>
<script>
<![CDATA[
getRootPane().setDefaultButton(ok);
- protected void performCancel() {
- setAccount(null);
- dispose();
+
+ @Override
+ public void dispose() {
+ setAccount(null);
+ super.dispose();
}
]]>
</script>
@@ -47,49 +51,48 @@
<Table>
<row>
<cell fill="horizontal">
- <JLabel text="lima.common.code"/>
+ <JLabel text="lima.common.code" labelFor='{numberTextField}'/>
</cell>
<cell fill="horizontal">
<JTextField id="numberTextField"
- text="{getAccount().getAccountNumber()}"/>
- <Document javaBean="getNumberTextField().getDocument()"
- onInsertUpdate='getAccount().setAccountNumber(getNumberTextField().getText())'
- onRemoveUpdate='getAccount().setAccountNumber(getNumberTextField().getText())'/>
+ text="{account.getAccountNumber()}"/>
+ <Document initializer="numberTextField.getDocument()"
+ onInsertUpdate='account.setAccountNumber(numberTextField.getText())'
+ onRemoveUpdate='account.setAccountNumber(numberTextField.getText())'/>
</cell>
</row>
<row>
<cell fill="horizontal">
- <JLabel text="lima.common.label"/>
+ <JLabel text="lima.common.label" labelFor='{descriptionTextField}'/>
</cell>
<cell fill="horizontal">
- <JTextField id="descriptionTextField" text="{getAccount().getLabel()}"/>
- <Document
- javaBean="getDescriptionTextField().getDocument()"
- onInsertUpdate='getAccount().setLabel(getDescriptionTextField().getText())'
- onRemoveUpdate='getAccount().setLabel(getDescriptionTextField().getText())'/>
+ <JTextField id="descriptionTextField" text="{account.getLabel()}"/>
+ <Document initializer="descriptionTextField.getDocument()"
+ onInsertUpdate='account.setLabel(descriptionTextField.getText())'
+ onRemoveUpdate='account.setLabel(descriptionTextField.getText())'/>
</cell>
</row>
- <!-- Lien Fiche contact-->
<row>
<cell fill="horizontal">
- <JLabel text="lima.identity.contact"/>
+ <JLabel text="lima.identity.contact" labelFor='{thirdPartyTextField}'/>
</cell>
<cell fill="horizontal">
<JTextField id="thirdPartyTextField"
- text="{getAccount().getThirdParty()}"/>
+ text="{account.getThirdParty()}"/>
<Document
- javaBean="getThirdPartyTextField().getDocument()"
- onInsertUpdate='getAccount().setThirdParty(getThirdPartyTextField().getText())'
- onRemoveUpdate='getAccount().setThirdParty(getThirdPartyTextField().getText())'/>
+ javaBean="thirdPartyTextField.getDocument()"
+ onInsertUpdate='account.setThirdParty(thirdPartyTextField.getText())'
+ onRemoveUpdate='account.setThirdParty(thirdPartyTextField.getText())'/>
</cell>
</row>
<row>
- <cell fill="none">
- <JButton text="lima.common.cancel" onActionPerformed="performCancel()"/>
+ <cell columns="2">
+ <JPanel layout='{new GridLayout(1,0)}'>
+ <JButton text="lima.common.cancel" onActionPerformed="dispose()"/>
+ <JButton id="ok" text="lima.common.ok"
+ onActionPerformed="handler.doAddSubLedger(this)"/>
+ </JPanel>
</cell>
- <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-27 08:28:48 UTC (rev 3305)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/UpdateAccountForm.jaxx 2011-09-27 08:38:55 UTC (rev 3306)
@@ -22,17 +22,11 @@
<http://www.gnu.org/licenses/gpl-3.0.html>.
#L%
-->
-<JDialog modal="true"
- defaultCloseOperation="{JDialog.DO_NOTHING_ON_CLOSE}"
- onWindowClosing="getHandler().performCancel(this);">
+<JDialog modal="true" defaultCloseOperation="{JDialog.DO_NOTHING_ON_CLOSE}"
+ onWindowClosing="dispose()">
<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>
<Account id="account" javaBean='null'/>
@@ -41,44 +35,13 @@
initializer='getContextValue(AccountView.class,JAXXUtil.PARENT).getHandler()'/>
<script>
<![CDATA[
-
getRootPane().setDefaultButton(ok);
- /*protected void performCancel() {
- setAccount(null);
- dispose();
+ @Override
+ public void dispose() {
+ setAccount(null);
+ super.dispose();
}
-
- public AccountViewHandler getHandler() {
- return getContextValue(AccountView.class,JAXXUtil.PARENT).getHandler();
- }
-
- protected void performOk() {
- if (getMasterAccountTextField().getText().length() != 0) {
- AccountServiceMonitorable accountService =
- LimaServiceFactory.getService(
- AccountServiceMonitorable.class);
- Account masterAccount = new AccountImpl();
- try {
- System.out.println("setMaster : "
- + getMasterAccountTextField().getText() + " to : "
- + getAccount().getAccountNumber());
- masterAccount = accountService
- .getAccountByNumber(getMasterAccountTextField().getText());
- } catch (LimaException eee) {
- log.debug("Can't search account for update : "
- + getMasterAccountTextField().getText(), eee);
- }
- if (masterAccount != null) {
- getAccount().setMasterAccount(masterAccount);
- } else {
- getAccount().setMasterAccount(null);
- }
- } else {
- setAccount(null);
- }
- dispose();
- }*/
]]>
</script>
@@ -86,7 +49,7 @@
<row>
<cell fill="horizontal">
- <JLabel text="lima.charts.account.number" labelFor='{numberTextField}'/>
+ <JLabel text="lima.charts.account.number" labelFor='{numberTextField}'/>
</cell>
<cell fill="horizontal">
<JTextField id="numberTextField" editable='{false}'
@@ -95,18 +58,16 @@
</row>
<row>
<cell fill="horizontal">
- <JLabel text="lima.common.label" labelFor='{descriptionTextField}'/>
+ <JLabel text="lima.common.label" labelFor='{descriptionTextField}'/>
</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" labelFor='{masterAccountTextField}'/>
+ <JLabel text="lima.common.masteraccount"
+ labelFor='{masterAccountTextField}'/>
</cell>
<cell fill="horizontal">
<JTextField id="masterAccountTextField"
@@ -114,12 +75,13 @@
</cell>
</row>
<row>
- <cell fill="none">
- <JButton text="lima.common.cancel" onActionPerformed="getHandler().performCancel(this)"/>
+ <cell columns="2">
+ <JPanel layout='{new GridLayout(1,0)}'>
+ <JButton text="lima.common.cancel" onActionPerformed="dispose()"/>
+ <JButton id="ok" text="lima.common.ok"
+ onActionPerformed="handler.doUpdateAccount(this)"/>
+ </JPanel>
</cell>
- <cell fill="none">
- <JButton id="ok" text="lima.common.ok" onActionPerformed="getHandler().performOk(this)"/>
- </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-27 08:28:48 UTC (rev 3305)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/UpdateSubLedgerForm.jaxx 2011-09-27 08:38:55 UTC (rev 3306)
@@ -22,17 +22,11 @@
<http://www.gnu.org/licenses/gpl-3.0.html>.
#L%
-->
-<JDialog modal="true"
- defaultCloseOperation="{JDialog.DO_NOTHING_ON_CLOSE}"
- onWindowClosing="getHandler().performCancel(this);">
+<JDialog modal="true" defaultCloseOperation="{JDialog.DO_NOTHING_ON_CLOSE}"
+ onWindowClosing="dispose()">
<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>
<Account id="account" javaBean='null'/>
@@ -42,39 +36,13 @@
<script>
<![CDATA[
-
getRootPane().setDefaultButton(ok);
- /*protected void performCancel() {
- setAccount(null);
- dispose();
+ @Override
+ public void dispose() {
+ setAccount(null);
+ super.dispose();
}
- protected void performOk() {
- if (getMasterAccountTextField().getText().length() != 0) {
- AccountServiceMonitorable accountService =
- LimaServiceFactory.getService(
- AccountServiceMonitorable.class);
- Account masterAccount = new AccountImpl();
- try {
- System.out.println("setMaster : "
- + getMasterAccountTextField().getText() + " to : "
- + getAccount().getAccountNumber());
- masterAccount = accountService
- .getAccountByNumber(getMasterAccountTextField().getText());
- } catch (LimaException eee) {
- log.debug("Can't search account for update : "
- + getMasterAccountTextField().getText(), eee);
- }
- if (masterAccount != null) {
- getAccount().setMasterAccount(masterAccount);
- } else {
- getAccount().setMasterAccount(null);
- }
- } else {
- setAccount(null);
- }
- dispose();
- }*/
]]>
</script>
@@ -84,11 +52,8 @@
<JLabel text="lima.common.code" labelFor='{numberTextField}'/>
</cell>
<cell fill="horizontal">
- <JTextField id="numberTextField"
- text="{getAccount().getAccountNumber()}"/>
- <Document javaBean="getNumberTextField().getDocument()"
- onInsertUpdate='getAccount().setAccountNumber(getNumberTextField().getText())'
- onRemoveUpdate='getAccount().setAccountNumber(getNumberTextField().getText())'/>
+ <JTextField id="numberTextField" editable='{false}'
+ text="{account.getAccountNumber()}"/>
</cell>
</row>
<row>
@@ -97,10 +62,6 @@
</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-->
@@ -109,17 +70,13 @@
<JLabel text="lima.identity.contact" labelFor='{thirdPartyTextField}'/>
</cell>
<cell fill="horizontal">
- <JTextField id="thirdPartyTextField"
- text="{getAccount().getThirdParty()}"/>
- <!--Document
- javaBean="getThirdPartyTextField().getDocument()"
- onInsertUpdate='getAccount().setThirdParty(getThirdPartyTextField().getText())'
- onRemoveUpdate='getAccount().setThirdParty(getThirdPartyTextField().getText())'/-->
+ <JTextField id="thirdPartyTextField" text="{getAccount().getThirdParty()}"/>
</cell>
</row>
<row>
<cell fill="horizontal">
- <JLabel text="lima.common.masteraccount" labelFor='{masterAccountTextField}'/>
+ <JLabel text="lima.common.masteraccount"
+ labelFor='{masterAccountTextField}'/>
</cell>
<cell fill="horizontal">
<JTextField id="masterAccountTextField"
@@ -127,12 +84,13 @@
</cell>
</row>
<row>
- <cell fill="none">
- <JButton text="lima.common.cancel" onActionPerformed="getHandler().performCancel(this)"/>
+ <cell columns="2">
+ <JPanel layout='{new GridLayout(1,0)}'>
+ <JButton text="lima.common.cancel" onActionPerformed="dispose()"/>
+ <JButton id="ok" text="lima.common.ok"
+ onActionPerformed="handler.doUpdateSubLedger(this)"/>
+ </JPanel>
</cell>
- <cell fill="none">
- <JButton id="ok" text="lima.common.ok" onActionPerformed="getHandler().performOk(this)"/>
- </cell>
</row>
</Table>
</JDialog>
\ No newline at end of file
Added: trunk/lima-swing/src/main/resources/META-INF/aop.xml
===================================================================
--- trunk/lima-swing/src/main/resources/META-INF/aop.xml (rev 0)
+++ trunk/lima-swing/src/main/resources/META-INF/aop.xml 2011-09-27 08:38:55 UTC (rev 3306)
@@ -0,0 +1,16 @@
+<!DOCTYPE aspectj PUBLIC
+ "-//AspectJ//DTD//EN"
+ "http://www.eclipse.org/aspectj/dtd/aspectj.dtd">
+<aspectj>
+ <weaver options="-verbose"/>
+ <aspects>
+ <concrete-aspect name="org.nuiton.profiling.NuitonTraceTestAspect"
+ extends="org.nuiton.profiling.NuitonTrace">
+ <pointcut name="executeMethod"
+ expression="
+ execution(* org.nuiton..*(..))
+ || execution(* org.chorem..*(..))
+ || execution(* org.hibernate..*(..))"/>
+ </concrete-aspect>
+ </aspects>
+</aspectj>
\ No newline at end of file
Property changes on: trunk/lima-swing/src/main/resources/META-INF/aop.xml
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Modified: trunk/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties
===================================================================
--- trunk/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties 2011-09-27 08:28:48 UTC (rev 3305)
+++ trunk/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties 2011-09-27 08:38:55 UTC (rev 3306)
@@ -142,6 +142,7 @@
lima.enum.comboboxperiod.fiscalperiod=Fiscal period
lima.enum.comboboxperiod.period=Period
lima.error.errorpane.htmlmessage=<html><body><b>An application error happened</b>\:<br/>%s</body></html>
+lima.error.no.masteraccount=there is no master account for account with number %s
lima.financialstatement.accounts=Account list on debit and on credit
lima.financialstatement.addfinancialStatementHeadererror=Can't add financialStatementHeader
lima.financialstatement.check=Check accounts passing to movement
Modified: trunk/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties
===================================================================
--- trunk/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties 2011-09-27 08:28:48 UTC (rev 3305)
+++ trunk/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties 2011-09-27 08:38:55 UTC (rev 3306)
@@ -1,5 +1,5 @@
=
-lima.account.addaccounterror=Erreur lors l'ajout d'un compte
+lima.account.addaccounterror=Erreur lors de l'ajout d'un compte
lima.accountsreports.listerror=Erreur lors de la récupération des données de la liste
lima.action.commandline.help=Afficher l'aide en console
lima.action.fullscreen=Plein Ecran
@@ -142,6 +142,7 @@
lima.enum.comboboxperiod.fiscalperiod=Exercice
lima.enum.comboboxperiod.period=Période
lima.error.errorpane.htmlmessage=<html><body><b>Une erreur s'est produite</b>\:<br/>%s</body></html>
+lima.error.no.masteraccount=Il n'existe pas de compte parent pour le numéro de compte %s
lima.financialstatement.accounts=Liste de comptes au crédit et au débit
lima.financialstatement.addfinancialStatementHeadererror=Erreur lors de l'ajout de l'entête sur la déclaration financière
lima.financialstatement.check=Vérification des comptes aux postes
1
0
r3305 - in trunk/lima-swing/src/main/java/org/chorem/lima: . actions
by tchemit@users.chorem.org 27 Sep '11
by tchemit@users.chorem.org 27 Sep '11
27 Sep '11
Author: tchemit
Date: 2011-09-27 10:28:48 +0200 (Tue, 27 Sep 2011)
New Revision: 3305
Url: http://chorem.org/repositories/revision/lima/3305
Log:
fix i18n issues : do NOT put any hardcoded translation in static code :(
Modified:
trunk/lima-swing/src/main/java/org/chorem/lima/LimaConfig.java
trunk/lima-swing/src/main/java/org/chorem/lima/actions/MiscAction.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-27 08:21:40 UTC (rev 3304)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/LimaConfig.java 2011-09-27 08:28:48 UTC (rev 3305)
@@ -51,6 +51,7 @@
import java.util.Properties;
import static org.nuiton.i18n.I18n._;
+import static org.nuiton.i18n.I18n.n_;
/**
* La configuration de l'application.
@@ -271,7 +272,7 @@
/**
* Change the currency displaying
*
- * @param currency
+ * @param currency the new currency to set in configuration
*/
public void setCurrency(String currency) {
setOption(Option.CURRENCY.key, currency);
@@ -385,20 +386,20 @@
*/
public enum Option implements OptionDef {
- CONFIG_FILE(CONFIG_FILE_NAME, _("lima.config.configFileName.description"), "lima-config.properties", String.class, true, true),
- DATA_DIR("lima.data.dir", _("lima.config.data.dir.description"), "${user.home}/.lima", File.class, false, false),
- RESOURCES_DIRECTORY("lima.resources.dir", _("lima.config.resources.dir.description"), "${lima.data.dir}/resources-${application.version}", String.class, false, false),
- I18N_DIRECTORY("lima.i18n.dir", _("lima.config.i18n.dir.description"), "${lima.resources.dir}/i18n", String.class, false, false),
- LOCALE("locale", _("lima.config.locale.description"), "fr_FR", Locale.class, false, false),
- DECIMAL_SEPARATOR("lima.config.decimalseparator", _("lima.config.decimalseparator.description"), ",", String.class, false, false),
- SCALE("scale", _("lima.config.scale.description"), "2", Integer.class, false, false),
- THOUSAND_SEPARATOR("thousandSeparator", _("limma.config.thousandseparator.description"), " ", String.class, false, false),
- CURRENCY("currency", _("lima.config.currency.description"), "none", Boolean.class, false, false),
- FULL_SCREEN("lima.ui.fullscreen", _("lima.config.ui.fullscreen.description"), "false", Boolean.class, false, false),
- LAUNCH_UI("lima.ui.launchui", _("lima.config.ui.flaunchui.description"), "true", Boolean.class, true, true),
- SUPPORT_EMAIL("lima.misc.supportemail", _("lima.misc.supportemail.description"), "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);
+ CONFIG_FILE(CONFIG_FILE_NAME, n_("lima.config.configFileName.description"), "lima-config.properties", String.class, true, true),
+ DATA_DIR("lima.data.dir", n_("lima.config.data.dir.description"), "${user.home}/.lima", File.class, false, false),
+ RESOURCES_DIRECTORY("lima.resources.dir", n_("lima.config.resources.dir.description"), "${lima.data.dir}/resources-${application.version}", String.class, false, false),
+ I18N_DIRECTORY("lima.i18n.dir", n_("lima.config.i18n.dir.description"), "${lima.resources.dir}/i18n", String.class, false, false),
+ LOCALE("locale", n_("lima.config.locale.description"), "fr_FR", Locale.class, false, false),
+ DECIMAL_SEPARATOR("lima.config.decimalseparator", n_("lima.config.decimalseparator.description"), ",", String.class, false, false),
+ SCALE("scale", n_("lima.config.scale.description"), "2", Integer.class, false, false),
+ THOUSAND_SEPARATOR("thousandSeparator", n_("limma.config.thousandseparator.description"), " ", String.class, false, false),
+ CURRENCY("currency", n_("lima.config.currency.description"), "none", Boolean.class, false, false),
+ FULL_SCREEN("lima.ui.fullscreen", n_("lima.config.ui.fullscreen.description"), "false", Boolean.class, false, false),
+ LAUNCH_UI("lima.ui.launchui", n_("lima.config.ui.flaunchui.description"), "true", Boolean.class, true, true),
+ SUPPORT_EMAIL("lima.misc.supportemail", n_("lima.misc.supportemail.description"), "support(a)codelutin.com", String.class, false, false),
+ OPENEJB_REMOTEMODE("lima.openejb.remotemode", n_("lima.openejb.remotemode.description"), "false", String.class, false, false),
+ LIMA_HOST_ADDRESS("lima.host.address", n_("lima.config.host.adress"), "localhost", String.class, false, false);
public final String key;
@@ -454,7 +455,7 @@
@Override
public String getDescription() {
- return description;
+ return _(description);
}
@Override
@@ -471,7 +472,7 @@
/** Lima action definition. */
public enum Action {
- HELP(_("lima.action.commandline.help"), MiscAction.class.getName() + "#help", "-h", "--help");
+ HELP(n_("lima.action.commandline.help"), MiscAction.class.getName() + "#help", "-h", "--help");
/** Before init action step. */
public static final int BEFORE_EXIT_STEP = 0;
@@ -490,6 +491,10 @@
this.action = action;
this.aliases = aliases;
}
+
+ public String getDescription() {
+ return _(description);
+ }
}
/**
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-27 08:21:40 UTC (rev 3304)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/actions/MiscAction.java 2011-09-27 08:28:48 UTC (rev 3305)
@@ -53,12 +53,12 @@
public void help() {
System.out.println(_("lima.message.help.usage"));
for (LimaConfig.Option o : LimaConfig.Option.values()) {
- System.out.println("\t" + o.key + "(" + o.defaultValue + "):" + o.description);
+ System.out.println("\t" + o.key + "(" + o.defaultValue + "):" + o.getDescription());
}
System.out.println("Actions:");
for (LimaConfig.Action a : LimaConfig.Action.values()) {
- System.out.println("\t" + Arrays.toString(a.aliases) + "(" + a.action + "):" + a.description);
+ System.out.println("\t" + Arrays.toString(a.aliases) + "(" + a.action + "):" + a.getDescription());
}
}
}
1
0
Author: tchemit
Date: 2011-09-27 10:21:40 +0200 (Tue, 27 Sep 2011)
New Revision: 3304
Url: http://chorem.org/repositories/revision/lima/3304
Log:
add nuiton-profiling dep
Modified:
trunk/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2011-09-27 08:21:18 UTC (rev 3303)
+++ trunk/pom.xml 2011-09-27 08:21:40 UTC (rev 3304)
@@ -53,6 +53,12 @@
</dependency>
<dependency>
+ <groupId>org.nuiton</groupId>
+ <artifactId>nuiton-profiling</artifactId>
+ <version>${nuitonUtilsVersion}</version>
+ </dependency>
+
+ <dependency>
<groupId>org.nuiton.i18n</groupId>
<artifactId>nuiton-i18n</artifactId>
<version>${nuitonI18nVersion}</version>
1
0
r3303 - in trunk/lima-business/src/main/java/org/chorem/lima/business: ejb ejbinterface
by tchemit@users.chorem.org 27 Sep '11
by tchemit@users.chorem.org 27 Sep '11
27 Sep '11
Author: tchemit
Date: 2011-09-27 10:21:18 +0200 (Tue, 27 Sep 2011)
New Revision: 3303
Url: http://chorem.org/repositories/revision/lima/3303
Log:
add getMasterAccount service method
Modified:
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/AccountService.java
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-22 17:31:55 UTC (rev 3302)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java 2011-09-27 08:21:18 UTC (rev 3303)
@@ -136,7 +136,6 @@
}
}
-
@Override
public void createSubLedgerWithTransaction(Account masterAccount,
Account account,
@@ -219,6 +218,29 @@
return account;
}
+ @Override
+ public Account getMasterAccount(String accountNumber) throws LimaException {
+ Account account = null;
+ TopiaContext transaction = beginTransaction(rootContext);
+ try {
+
+ AccountDAO accountDAO =
+ LimaCallaoDAOHelper.getAccountDAO(transaction);
+
+ while (account == null && accountNumber.length() > 1) {
+
+ accountNumber = accountNumber.substring(0, accountNumber.length() - 1);
+ account = accountDAO.findByAccountNumber(accountNumber);
+ }
+
+ } catch (Exception ex) {
+ doCatch(transaction, ex);
+ } finally {
+ doFinally(transaction);
+ }
+ return account;
+ }
+
/** Permet d'obtenir un compte suivant son numero */
@Override
public Account getAccountByNumber(String number) throws LimaException {
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/AccountService.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/AccountService.java 2011-09-22 17:31:55 UTC (rev 3302)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/AccountService.java 2011-09-27 08:21:18 UTC (rev 3303)
@@ -47,6 +47,19 @@
List<Account> getAllAccountByProperty(String propertyName,
String value) throws LimaException;
+ /**
+ * Obtain the master account for the given account number.
+ *
+ * the master account if the account with the longer account number prefixing the given account number.
+ *
+ * Example: for account number 401AB, it could be 4, 40, 401,...
+ *
+ * @param accountNumber the account number
+ * @return the master account number
+ * @throws LimaException if any pb while loading account
+ */
+ Account getMasterAccount(String accountNumber) throws LimaException;
+
Account getAccountByNumber(String number) throws LimaException;
List<Account> getAllAccounts() throws LimaException;
1
0
Author: maven-release
Date: 2011-09-22 19:31:55 +0200 (Thu, 22 Sep 2011)
New Revision: 3302
Url: http://chorem.org/repositories/revision/lima/3302
Log:
Update mavenpom4redmine to 3.0.4.
Modified:
trunk/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2011-09-22 15:26:44 UTC (rev 3301)
+++ trunk/pom.xml 2011-09-22 17:31:55 UTC (rev 3302)
@@ -1,7 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<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>
@@ -12,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>mavenpom4redmine</artifactId>
- <version>3.0.4-SNAPSHOT</version>
+ <version>3.0.4</version>
</parent>
<groupId>org.chorem</groupId>
1
0
r3301 - in trunk/lima-swing/src: license main/java/org/chorem/lima/ui main/java/org/chorem/lima/ui/account main/java/org/chorem/lima/widgets main/resources
by tchemit@users.chorem.org 22 Sep '11
by tchemit@users.chorem.org 22 Sep '11
22 Sep '11
Author: tchemit
Date: 2011-09-22 17:26:44 +0200 (Thu, 22 Sep 2011)
New Revision: 3301
Url: http://chorem.org/repositories/revision/lima/3301
Log:
Continue to simplify and make working account screen...
Reformat code
optimize third parties
add a lots of log (for the moment...)
Modified:
trunk/lima-swing/src/license/THIRD-PARTY.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/account/AccountTreeTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/UpdateAccountForm.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/UpdateSubLedgerForm.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/widgets/ScrollBasicComboPopup.java
trunk/lima-swing/src/main/java/org/chorem/lima/widgets/ScrollMetalComboUI.java
trunk/lima-swing/src/main/resources/log4j.properties
Modified: trunk/lima-swing/src/license/THIRD-PARTY.properties
===================================================================
--- trunk/lima-swing/src/license/THIRD-PARTY.properties 2011-09-22 15:24:35 UTC (rev 3300)
+++ trunk/lima-swing/src/license/THIRD-PARTY.properties 2011-09-22 15:26:44 UTC (rev 3301)
@@ -6,6 +6,7 @@
# - Apache Software License - Version 2.0
# - Apache Software License 2.0
# - BSD License
+# - BSD style
# - Bouncy Castle Licence
# - Bouncy Castle License
# - COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0
@@ -23,6 +24,7 @@
# - License Agreement for Java Transaction API Classes
# - License Agreement for JavaMail(TM) API
# - MIT License
+# - MPL 1.1
# - Mozilla Public License
# - The Apache Software License, Version 2.0
# - The H2 License, Version 1.0
@@ -33,14 +35,13 @@
# Please fill the missing licenses for dependencies :
#
#
-#Thu Aug 18 08:57:41 CEST 2011
+#Thu Sep 22 16:27:42 CEST 2011
antlr--antlr--2.7.6=ANTLR 2 License
com.sun.xml.bind--jaxb-impl--2.1.9=Common Development and Distribution License (CDDL) v1.0 / GPLv2 + classpath exception dual license
commons-jxpath--commons-jxpath--1.3=The Apache Software License, Version 2.0
commons-net--commons-net--2.0=The Apache Software License, Version 2.0
commons-primitives--commons-primitives--1.0=The Apache Software License, Version 2.0
dom4j--dom4j--1.6.1=jdomlicence
-javassist--javassist--3.8.0.GA=GNU Lesser General Public License
javax.mail--mail--1.4.1=License Agreement for JavaMail(TM) API
javax.transaction--jta--1.1=License Agreement for Java Transaction API Classes
org.apache.commons--commons-email--1.2=The Apache Software License, Version 2.0
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-22 15:24:35 UTC (rev 3300)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/LimaDecoratorProvider.java 2011-09-22 15:26:44 UTC (rev 3301)
@@ -1,3 +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%
+ */
package org.chorem.lima.ui;
import org.chorem.lima.entity.EntryBook;
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/LimaModelUtil.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/LimaModelUtil.java 2011-09-22 15:24:35 UTC (rev 3300)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/LimaModelUtil.java 2011-09-22 15:26:44 UTC (rev 3301)
@@ -1,3 +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%
+ */
package org.chorem.lima.ui;
/**
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/LimaRendererUtil.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/LimaRendererUtil.java 2011-09-22 15:24:35 UTC (rev 3300)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/LimaRendererUtil.java 2011-09-22 15:26:44 UTC (rev 3301)
@@ -1,3 +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%
+ */
package org.chorem.lima.ui;
import jaxx.runtime.swing.renderer.DecoratorListCellRenderer;
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-22 15:24:35 UTC (rev 3300)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountTreeTable.java 2011-09-22 15:26:44 UTC (rev 3301)
@@ -33,6 +33,7 @@
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
+@Deprecated
public class AccountTreeTable extends JXTreeTable
implements KeyListener, MouseListener {
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-22 15:24:35 UTC (rev 3300)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountTreeTableModel.java 2011-09-22 15:26:44 UTC (rev 3301)
@@ -30,12 +30,18 @@
import org.chorem.lima.business.AccountServiceMonitorable;
import org.chorem.lima.business.LimaBusinessException;
import org.chorem.lima.business.LimaException;
+import org.chorem.lima.business.ejbinterface.AccountService;
import org.chorem.lima.entity.Account;
-import org.chorem.lima.entity.AccountImpl;
import org.chorem.lima.service.LimaServiceFactory;
-import org.jdesktop.swingx.treetable.AbstractTreeTableModel;
+import org.chorem.lima.util.ErrorHelper;
+import org.jdesktop.swingx.treetable.DefaultMutableTreeTableNode;
+import org.jdesktop.swingx.treetable.DefaultTreeTableModel;
+import org.jdesktop.swingx.treetable.MutableTreeTableNode;
+import org.jdesktop.swingx.treetable.TreeTableNode;
import javax.swing.tree.TreePath;
+import java.util.Arrays;
+import java.util.Enumeration;
import java.util.List;
import static org.nuiton.i18n.I18n._;
@@ -50,143 +56,236 @@
* Last update : $Date$
* By : $Author$
*/
-public class AccountTreeTableModel extends AbstractTreeTableModel {
+public class AccountTreeTableModel extends DefaultTreeTableModel {
/** log. */
private static final Log log = LogFactory.getLog(AccountViewHandler.class);
/** Account service. */
- protected final AccountServiceMonitorable accountService;
+ protected final AccountService accountService;
- /** Model constructor. Init account service used here. */
- public AccountTreeTableModel() {
- // root
- super(new AccountImpl());
- // Gets factory service
- accountService =
- LimaServiceFactory.getService(AccountServiceMonitorable.class);
- }
+ public class AccountTreeTableNode extends DefaultMutableTreeTableNode {
+ protected boolean loaded;
- @Override
- public int getColumnCount() {
- return 2;
- }
+ AccountTreeTableNode(Account userObject) {
+ super(userObject);
+ }
- @Override
- public String getColumnName(int column) {
- String res = null;
- switch (column) {
- case 0:
- res = _("lima.table.number");
- break;
- case 1:
- res = _("lima.table.label");
- break;
+ @Override
+ public Account getUserObject() {
+ return (Account) super.getUserObject();
}
- return res;
- }
- @Override
- public int getChildCount(Object node) {
- int result = 0;
- if (node == getRoot()) {
- try {
- result = accountService.getChildrenAccounts(null).size();
- } catch (LimaException eee) {
- log.debug("Can't count child", eee);
- }
- } else {
- Account parentAccount = (Account) node;
- try {
- result = accountService.getChildrenAccounts(parentAccount).size();
- } catch (LimaException eee) {
- log.debug("Can't count child", eee);
- }
+ @Override
+ public int getChildCount() {
+ loadChildrenIfRequired();
+ return super.getChildCount();
}
- return result;
- }
- @Override
- public Object getChild(Object parent, int index) {
- Object result = null;
- if (parent == getRoot()) {
- try {
- List<Account> allAccounts =
- accountService.getChildrenAccounts(null);
- result = allAccounts.get(index);
- } catch (LimaException eee) {
- log.debug("Can't get child", eee);
+ private void loadChildrenIfRequired() {
+ if (!loaded) {
+ loaded = true;
+ loadChilds(getUserObject());
}
- } else {
- Account parentAccount = (Account) parent;
+ }
- // FIXME sub account is a collection ?
+ @Override
+ public void setParent(MutableTreeTableNode newParent) {
+ parent = newParent;
+ }
+
+ private void loadChilds(Account account) {
try {
- List<Account> subaccounts =
- accountService.getChildrenAccounts(parentAccount);
- result = subaccounts.get(index);
- } catch (LimaException eee) {
- log.debug("Can't get child", eee);
+ if (log.isInfoEnabled()) {
+ log.info("Loading childs for account " + (account == null ? "Root node" : account.getAccountNumber()));
+ }
+ List<Account> childs =
+ accountService.getChildrenAccounts(account);
+ for (Account child : childs) {
+ add(new AccountTreeTableNode(child));
+ }
+ } catch (LimaException e) {
+ ErrorHelper.showErrorDialog(
+ "Could not load child of account " + account, e);
+ } finally {
+ loaded = true;
}
}
- return result;
- }
- @Override
- public int getIndexOfChild(Object parent, Object child) {
- int result = 0;
- Account parentAccount = (Account) parent;
- Account childAccount = (Account) child;
+ @Override
+ public Enumeration<? extends MutableTreeTableNode> children() {
+ loadChildrenIfRequired();
+ return super.children();
+ }
- if (parent == getRoot()) {
- try {
- List<Account> allAccounts =
- accountService.getChildrenAccounts(null);
- result = allAccounts.indexOf(child);
- } catch (LimaException eee) {
- log.debug("Can't get index child", eee);
- }
- } else {
- // FIXME sub account is a collection ?
- try {
- List<Account> subaccounts =
- accountService.getChildrenAccounts(parentAccount);
- result = subaccounts.indexOf(childAccount);
- } catch (LimaException eee) {
- log.debug("Can't get index child", eee);
- }
+ @Override
+ public TreeTableNode getChildAt(int childIndex) {
+ loadChildrenIfRequired();
+ return super.getChildAt(childIndex);
}
- return result;
- }
- @Override
- public Object getValueAt(Object node, int column) {
- Object result = "n/a";
- if (node instanceof Account) {
- Account account = (Account) node;
- switch (column) {
- case 0:
- result = account.getAccountNumber();
- break;
- case 1:
- result = account.getLabel();
- break;
+ @Override
+ public boolean isEditable(int column) {
+ return false;
+ }
+
+ @Override
+ public Object getValueAt(int column) {
+ Account account = getUserObject();
+
+ Object result = null;
+ if (account != null) {
+ switch (column) {
+ case 0:
+ result = account.getAccountNumber();
+ break;
+ case 1:
+ result = account.getLabel();
+ if (log.isInfoEnabled()) {
+ log.info("Get label '" + result +
+ "' for account [" +
+ account.getAccountNumber() + "]");
+ }
+ break;
+ }
}
+ return result;
}
- return result;
}
- @Override
- public boolean isCellEditable(Object node, int column) {
- return false;
- }
+ /** Model constructor. Init account service used here. */
+ public AccountTreeTableModel() {
- @Override
- public boolean isLeaf(Object node) {
- return getChildCount(node) == 0;
+ setColumnIdentifiers(Arrays.asList(_("lima.table.number"),
+ _("lima.table.label"))
+ );
+
+ setRoot(new AccountTreeTableNode(null));
+ // Gets factory service
+ accountService =
+ LimaServiceFactory.getService(AccountServiceMonitorable.class);
}
+// @Override
+// public int getColumnCount() {
+// return 2;
+// }
+
+// @Override
+// public String getColumnName(int column) {
+// String res = null;
+// switch (column) {
+// case 0:
+// res = _("lima.table.number");
+// break;
+// case 1:
+// res = _("lima.table.label");
+// break;
+// }
+// return res;
+// }
+
+// @Override
+// public int getChildCount(Object node) {
+// int result = 0;
+// if (node == getRoot()) {
+// try {
+// result = accountService.getChildrenAccounts(null).size();
+// } catch (LimaException eee) {
+// log.debug("Can't count child", eee);
+// }
+// } else {
+// Account parentAccount = (Account) node;
+// try {
+// result = accountService.getChildrenAccounts(parentAccount).size();
+// } catch (LimaException eee) {
+// log.debug("Can't count child", eee);
+// }
+// }
+// return result;
+// }
+
+// @Override
+// public Object getChild(Object parent, int index) {
+// Object result = null;
+// if (parent == getRoot()) {
+// try {
+// List<Account> allAccounts =
+// accountService.getChildrenAccounts(null);
+// result = allAccounts.get(index);
+// } catch (LimaException eee) {
+// log.debug("Can't get child", eee);
+// }
+// } else {
+// Account parentAccount = (Account) parent;
+//
+// // FIXME sub account is a collection ?
+// try {
+// List<Account> subaccounts =
+// accountService.getChildrenAccounts(parentAccount);
+// result = subaccounts.get(index);
+// } catch (LimaException eee) {
+// log.debug("Can't get child", eee);
+// }
+// }
+// return result;
+// }
+
+// @Override
+// public int getIndexOfChild(Object parent, Object child) {
+// int result = 0;
+// Account parentAccount = (Account) parent;
+// Account childAccount = (Account) child;
+//
+// if (parent == getRoot()) {
+// try {
+// List<Account> allAccounts =
+// accountService.getChildrenAccounts(null);
+// result = allAccounts.indexOf(child);
+// } catch (LimaException eee) {
+// log.debug("Can't get index child", eee);
+// }
+// } else {
+// // FIXME sub account is a collection ?
+// try {
+// List<Account> subaccounts =
+// accountService.getChildrenAccounts(parentAccount);
+// result = subaccounts.indexOf(childAccount);
+// } catch (LimaException eee) {
+// log.debug("Can't get index child", eee);
+// }
+// }
+// return result;
+// }
+
+// @Override
+// public Object getValueAt(Object node, int column) {
+// Object result = "n/a";
+// if (node instanceof Account) {
+// Account account = (Account) node;
+// switch (column) {
+// case 0:
+// result = account.getAccountNumber();
+// break;
+// case 1:
+// result = account.getLabel();
+// break;
+// }
+// }
+// return result;
+// }
+
+// @Override
+// public boolean isCellEditable(Object node, int column) {
+// return false;
+// }
+
+// @Override
+// public boolean isLeaf(Object node) {
+// return getChildCount(node) == 0;
+// }
+
/**
* Add account
*
@@ -194,7 +293,8 @@
* @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);
@@ -208,7 +308,8 @@
* @param account
* @throws LimaException
*/
- public void addSubLedger(Account parentAccount, Account account) throws LimaException {
+ public void addSubLedger(Account parentAccount,
+ Account account) throws LimaException {
accountService.createSubLedger(parentAccount, account);
//FIXME 2011.08.09 vsalaun quick tree refresh, it should refresh only the path changed
//modelSupport.fireTreeStructureChanged(path);
@@ -226,7 +327,7 @@
//FIXME Force fire for no update if error. Where is the cache ?
try {
accountService.updateAccount(account);
- } catch (LimaBusinessException eee) {
+ } catch (LimaException eee) {
//modelSupport.fireTreeStructureChanged(path);
throw new LimaBusinessException("Can't update account : "
+ account.getAccountNumber(), eee);
@@ -250,7 +351,8 @@
* @param account
* @throws LimaException
*/
- public void removeAccount(TreePath path, Account account) throws LimaException {
+ public void removeAccount(TreePath path,
+ Account account) throws LimaException {
// Calling account service
int index = getIndexOfChild(
path.getParentPath().getLastPathComponent(), account);
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-22 15:24:35 UTC (rev 3300)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountView.jaxx 2011-09-22 15:26:44 UTC (rev 3301)
@@ -27,60 +27,62 @@
<import>
javax.swing.ListSelectionModel
+ org.jdesktop.swingx.JXTreeTable
org.jdesktop.swingx.decorator.HighlighterFactory
</import>
- <AccountViewHandler id="handler" javaBean="new AccountViewHandler(this)"/>
+ <AccountViewHandler id="handler" constructorParams="this"/>
+
<Boolean id="selectedRow" javaBean="false"/>
<script>
<![CDATA[
-
+ void $afterCompleteSetup() {
+ getHandler().init();
+ }
]]>
</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)"/>
+ <JXTreeTable id="accountsTreeTable"
+ selectionMode="{ListSelectionModel.SINGLE_SELECTION}"
+ treeTableModel="{new AccountTreeTableModel()}"
+ highlighters="{HighlighterFactory.createSimpleStriping(new java.awt.Color(222,222,222))}"/>
+ <ListSelectionModel initializer='accountsTreeTable.getSelectionModel()'
+ onValueChanged="setSelectedRow(accountsTreeTable.getSelectedRow() != -1)"/>
</JScrollPane>
</cell>
<cell fill="horizontal">
<JButton id="addButton" text="lima.charts.account.addAccount"
- onActionPerformed="getHandler().addAccount()"/>
+ onActionPerformed="handler.addAccount()"/>
</cell>
</row>
<row>
<cell fill="horizontal">
<JButton id="addSubLedger" text="lima.charts.account.addSubLedger"
- onActionPerformed="getHandler().addSubLedger()"/>
+ onActionPerformed="handler.addSubLedger()"/>
</cell>
</row>
<row>
<cell fill="horizontal">
<JButton id="updateButton" text="lima.common.update"
- onActionPerformed="getHandler().updateAccount()"
+ onActionPerformed="handler.updateAccount()"
enabled="{isSelectedRow()}"/>
</cell>
</row>
<row>
<cell fill="horizontal">
<JButton id="removeButton" text="lima.common.remove"
- onActionPerformed="getHandler().removeAccount()"
+ onActionPerformed="handler.removeAccount()"
enabled="{isSelectedRow()}"/>
</cell>
</row>
<row>
<cell fill="horizontal">
<JButton id="importButton" text="lima.importexport.import"
- onActionPerformed="getHandler().importAccountsChart()"/>
+ onActionPerformed="handler.importAccountsChart()"/>
</cell>
</row>
</Table>
\ No newline at end of file
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java 2011-09-22 15:24:35 UTC (rev 3300)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java 2011-09-22 15:26:44 UTC (rev 3301)
@@ -25,6 +25,7 @@
package org.chorem.lima.ui.account;
+import org.apache.commons.lang.ObjectUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.AccountServiceMonitorable;
@@ -32,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.AccountService;
import org.chorem.lima.entity.Account;
import org.chorem.lima.entity.AccountImpl;
import org.chorem.lima.enums.AccountsChartEnum;
@@ -44,6 +46,10 @@
import javax.swing.JOptionPane;
import javax.swing.tree.TreePath;
+import java.awt.event.KeyAdapter;
+import java.awt.event.KeyEvent;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
import static org.nuiton.i18n.I18n._;
@@ -61,9 +67,9 @@
/** log. */
private static final Log log = LogFactory.getLog(AccountViewHandler.class);
- protected AccountView view;
+ protected final AccountView view;
- protected AccountServiceMonitorable accountService;
+ protected AccountService accountService;
protected AccountViewHandler(AccountView view) {
this.view = view;
@@ -72,9 +78,36 @@
accountService = LimaServiceFactory.getService(AccountServiceMonitorable.class);
}
- /**
- * Add new account with account form.
- */
+ public void init() {
+ JXTreeTable table = view.getAccountsTreeTable();
+ table.addKeyListener(new KeyAdapter() {
+ /**
+ * for each action combination key are think
+ * for extend keyboard and laptop keyboard
+ */
+ @Override
+ public void keyPressed(KeyEvent e) {
+ JXTreeTable source = (JXTreeTable) e.getSource();
+ // clear row selection with the key: escape
+ if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
+ if (!source.isEditing()) {
+ source.clearSelection();
+ }
+ }
+ }
+ });
+ table.addMouseListener(new MouseAdapter() {
+ @Override
+ public void mousePressed(MouseEvent e) {
+ JXTreeTable source = (JXTreeTable) e.getSource();
+ if (source.rowAtPoint(e.getPoint()) == -1) {
+ source.clearSelection();
+ }
+ }
+ });
+ }
+
+ /** Add new account with account form. */
public void addAccount() {
JXTreeTable accountsTreeTable = view.getAccountsTreeTable();
@@ -196,21 +229,23 @@
* Verifiy if it's an account or a subledger
*/
public void updateAccount() {
- JXTreeTable accountsTreeTable = view.getAccountsTreeTable();
- AccountTreeTableModel accountsTreeTableModel =
- (AccountTreeTableModel) accountsTreeTable.getTreeTableModel();
+ JXTreeTable table = view.getAccountsTreeTable();
+ AccountTreeTableModel tableModel =
+ (AccountTreeTableModel) table.getTreeTableModel();
// get selected account
- int selectedRow = view.getAccountsTreeTable().getSelectedRow();
- TreePath treePath = view.getAccountsTreeTable().getPathForRow(selectedRow); // not null
- Account selectedObject = (Account) treePath.getLastPathComponent();
+ int selectedRow = table.getSelectedRow();
+ TreePath treePath = table.getPathForRow(selectedRow); // not null
+ AccountTreeTableModel.AccountTreeTableNode lastPathComponent =
+ (AccountTreeTableModel.AccountTreeTableNode) treePath.getLastPathComponent();
+ Account selectedObject = lastPathComponent.getUserObject();
//update Account or update SubLedger
if (selectedObject != null) {
// get current selection path
if (selectedRow != -1) {
- treePath = view.getAccountsTreeTable().getPathForRow(selectedRow);
+ treePath = table.getPathForRow(selectedRow);
} else {
- treePath = new TreePath(accountsTreeTableModel.getRoot());
+ treePath = new TreePath(tableModel.getRoot());
}
//test if selectedrow is account or ledger
if (selectedObject.getGeneralLedger() == null) {
@@ -236,7 +271,7 @@
if (selectedObject != null) {
// update it
try {
- accountsTreeTableModel.
+ tableModel.
updateAccount(selectedObject);
} catch (LimaException eee) {
if (log.isErrorEnabled()) {
@@ -246,7 +281,6 @@
}
}
}
-
}
/** Ask for user to remove for selected account, and remove it if confirmed. */
@@ -330,9 +364,118 @@
@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();
}
}
+
+ public void performOk(UpdateAccountForm dialog) {
+
+
+ Account account = dialog.getAccount();
+
+ String newMasterAccountNumber =
+ dialog.getMasterAccountTextField().getText();
+ String newLabel = dialog.getDescriptionTextField().getText();
+
+ boolean hasChanged =
+ updateMasterAccount(account, newMasterAccountNumber);
+ hasChanged |= updateLabel(account, newLabel);
+
+ if (!hasChanged) {
+
+ // nothing has changed
+ dialog.setAccount(null);
+ }
+ dialog.dispose();
+ }
+
+ public void performCancel(UpdateAccountForm dialog) {
+ dialog.setAccount(null);
+ dialog.dispose();
+ }
+
+ public void performOk(UpdateSubLedgerForm dialog) {
+
+
+ Account account = dialog.getAccount();
+
+ String newMasterAccountNumber =
+ dialog.getMasterAccountTextField().getText();
+ String newLabel = dialog.getDescriptionTextField().getText();
+ String newThirdParty = dialog.getThirdPartyTextField().getText();
+
+ boolean hasChanged = updateMasterAccount(account, newMasterAccountNumber);
+ hasChanged |= updateLabel(account, newLabel);
+ hasChanged |= updateThirdParty(account, newThirdParty);
+
+ if (!hasChanged) {
+
+ // nothing has changed
+ dialog.setAccount(null);
+ }
+ dialog.dispose();
+ }
+
+ public void performCancel(UpdateSubLedgerForm dialog) {
+ dialog.setAccount(null);
+ dialog.dispose();
+ }
+
+ protected boolean updateMasterAccount(Account account, String newMasterAccountNumber) {
+ boolean hasChanged = false;
+ String oldMasterAccountNumber = account.getMasterAccount() == null ?
+ "" :
+ account.getMasterAccount().getAccountNumber();
+
+ if (ObjectUtils.notEqual(oldMasterAccountNumber, newMasterAccountNumber)) {
+
+ // master account has changed
+ hasChanged = true;
+
+ // obtain new master account
+ try {
+ if (log.isInfoEnabled()) {
+ log.info("setMaster : "
+ + newMasterAccountNumber + " to : "
+ + account.getAccountNumber());
+ }
+ Account masterAccount = accountService
+ .getAccountByNumber(newMasterAccountNumber);
+ account.setMasterAccount(masterAccount);
+ } catch (LimaException eee) {
+ log.debug("Can't search account for update : "
+ + newMasterAccountNumber, eee);
+ }
+ }
+ return hasChanged;
+ }
+
+ protected boolean updateLabel(Account account, String newLabel) {
+ boolean hasChanged = false;
+ String oldLabel = account.getLabel();
+ if (ObjectUtils.notEqual(oldLabel, newLabel)) {
+
+ // label has changed
+ hasChanged = true;
+ account.setLabel(newLabel);
+ }
+ return hasChanged;
+ }
+
+ protected boolean updateThirdParty(Account account, String newThirdParty) {
+ boolean hasChanged = false;
+ String oldThirdParty = account.getThirdParty();
+ if (ObjectUtils.notEqual(oldThirdParty, newThirdParty)) {
+
+ // thirdparty has changed
+ hasChanged = true;
+ account.setThirdParty(newThirdParty);
+ }
+
+ return hasChanged;
+ }
}
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-22 15:24:35 UTC (rev 3300)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/UpdateAccountForm.jaxx 2011-09-22 15:26:44 UTC (rev 3301)
@@ -24,7 +24,7 @@
-->
<JDialog modal="true"
defaultCloseOperation="{JDialog.DO_NOTHING_ON_CLOSE}"
- onWindowClosing="performCancel();">
+ onWindowClosing="getHandler().performCancel(this);">
<import>
javax.swing.text.Document
@@ -37,14 +37,22 @@
<Account id="account" javaBean='null'/>
+ <AccountViewHandler id='handler'
+ initializer='getContextValue(AccountView.class,JAXXUtil.PARENT).getHandler()'/>
<script>
<![CDATA[
getRootPane().setDefaultButton(ok);
- protected void performCancel() {
+
+ /*protected void performCancel() {
setAccount(null);
dispose();
}
+
+ public AccountViewHandler getHandler() {
+ return getContextValue(AccountView.class,JAXXUtil.PARENT).getHandler();
+ }
+
protected void performOk() {
if (getMasterAccountTextField().getText().length() != 0) {
AccountServiceMonitorable accountService =
@@ -70,7 +78,7 @@
setAccount(null);
}
dispose();
- }
+ }*/
]]>
</script>
@@ -78,7 +86,7 @@
<row>
<cell fill="horizontal">
- <JLabel text="lima.charts.account.number"/>
+ <JLabel text="lima.charts.account.number" labelFor='{numberTextField}'/>
</cell>
<cell fill="horizontal">
<JTextField id="numberTextField" editable='{false}'
@@ -87,18 +95,18 @@
</row>
<row>
<cell fill="horizontal">
- <JLabel text="lima.common.label"/>
+ <JLabel text="lima.common.label" labelFor='{descriptionTextField}'/>
</cell>
<cell fill="horizontal">
<JTextField id="descriptionTextField" text="{getAccount().getLabel()}"/>
- <Document javaBean="getDescriptionTextField().getDocument()"
+ <!--Document javaBean="getDescriptionTextField().getDocument()"
onInsertUpdate='getAccount().setLabel(getDescriptionTextField().getText())'
- onRemoveUpdate='getAccount().setLabel(getDescriptionTextField().getText())'/>
+ onRemoveUpdate='getAccount().setLabel(getDescriptionTextField().getText())'/-->
</cell>
</row>
<row>
<cell fill="horizontal">
- <JLabel text="lima.common.masteraccount"/>
+ <JLabel text="lima.common.masteraccount" labelFor='{masterAccountTextField}'/>
</cell>
<cell fill="horizontal">
<JTextField id="masterAccountTextField"
@@ -107,10 +115,10 @@
</row>
<row>
<cell fill="none">
- <JButton text="lima.common.cancel" onActionPerformed="performCancel()"/>
+ <JButton text="lima.common.cancel" onActionPerformed="getHandler().performCancel(this)"/>
</cell>
<cell fill="none">
- <JButton id="ok" text="lima.common.ok" onActionPerformed="performOk()"/>
+ <JButton id="ok" text="lima.common.ok" onActionPerformed="getHandler().performOk(this)"/>
</cell>
</row>
</Table>
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-22 15:24:35 UTC (rev 3300)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/UpdateSubLedgerForm.jaxx 2011-09-22 15:26:44 UTC (rev 3301)
@@ -24,7 +24,7 @@
-->
<JDialog modal="true"
defaultCloseOperation="{JDialog.DO_NOTHING_ON_CLOSE}"
- onWindowClosing="performCancel();">
+ onWindowClosing="getHandler().performCancel(this);">
<import>
javax.swing.text.Document
@@ -37,11 +37,15 @@
<Account id="account" javaBean='null'/>
+ <AccountViewHandler id='handler'
+ initializer='getContextValue(AccountView.class,JAXXUtil.PARENT).getHandler()'/>
+
<script>
<![CDATA[
getRootPane().setDefaultButton(ok);
- protected void performCancel() {
+
+ /*protected void performCancel() {
setAccount(null);
dispose();
}
@@ -70,14 +74,14 @@
setAccount(null);
}
dispose();
- }
+ }*/
]]>
</script>
<Table>
<row>
<cell fill="horizontal">
- <JLabel text="lima.common.code"/>
+ <JLabel text="lima.common.code" labelFor='{numberTextField}'/>
</cell>
<cell fill="horizontal">
<JTextField id="numberTextField"
@@ -89,33 +93,33 @@
</row>
<row>
<cell fill="horizontal">
- <JLabel text="lima.common.label"/>
+ <JLabel text="lima.common.label" labelFor='{descriptionTextField}'/>
</cell>
<cell fill="horizontal">
<JTextField id="descriptionTextField" text="{getAccount().getLabel()}"/>
- <Document
+ <!--Document
javaBean="getDescriptionTextField().getDocument()"
onInsertUpdate='getAccount().setLabel(getDescriptionTextField().getText())'
- onRemoveUpdate='getAccount().setLabel(getDescriptionTextField().getText())'/>
+ onRemoveUpdate='getAccount().setLabel(getDescriptionTextField().getText())'/-->
</cell>
</row>
<!-- Lien Fiche contact-->
<row>
<cell fill="horizontal">
- <JLabel text="lima.identity.contact"/>
+ <JLabel text="lima.identity.contact" labelFor='{thirdPartyTextField}'/>
</cell>
<cell fill="horizontal">
<JTextField id="thirdPartyTextField"
text="{getAccount().getThirdParty()}"/>
- <Document
+ <!--Document
javaBean="getThirdPartyTextField().getDocument()"
onInsertUpdate='getAccount().setThirdParty(getThirdPartyTextField().getText())'
- onRemoveUpdate='getAccount().setThirdParty(getThirdPartyTextField().getText())'/>
+ onRemoveUpdate='getAccount().setThirdParty(getThirdPartyTextField().getText())'/-->
</cell>
</row>
<row>
<cell fill="horizontal">
- <JLabel text="lima.common.masteraccount"/>
+ <JLabel text="lima.common.masteraccount" labelFor='{masterAccountTextField}'/>
</cell>
<cell fill="horizontal">
<JTextField id="masterAccountTextField"
@@ -124,10 +128,10 @@
</row>
<row>
<cell fill="none">
- <JButton text="lima.common.cancel" onActionPerformed="performCancel()"/>
+ <JButton text="lima.common.cancel" onActionPerformed="getHandler().performCancel(this)"/>
</cell>
<cell fill="none">
- <JButton id="ok" text="lima.common.ok" onActionPerformed="performOk()"/>
+ <JButton id="ok" text="lima.common.ok" onActionPerformed="getHandler().performOk(this)"/>
</cell>
</row>
</Table>
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/widgets/ScrollBasicComboPopup.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/widgets/ScrollBasicComboPopup.java 2011-09-22 15:24:35 UTC (rev 3300)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/widgets/ScrollBasicComboPopup.java 2011-09-22 15:26:44 UTC (rev 3301)
@@ -1,3 +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%
+ */
package org.chorem.lima.widgets;
import javax.swing.JComboBox;
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/widgets/ScrollMetalComboUI.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/widgets/ScrollMetalComboUI.java 2011-09-22 15:24:35 UTC (rev 3300)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/widgets/ScrollMetalComboUI.java 2011-09-22 15:26:44 UTC (rev 3301)
@@ -1,3 +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%
+ */
package org.chorem.lima.widgets;
import javax.swing.plaf.basic.ComboPopup;
Modified: trunk/lima-swing/src/main/resources/log4j.properties
===================================================================
--- trunk/lima-swing/src/main/resources/log4j.properties 2011-09-22 15:24:35 UTC (rev 3300)
+++ trunk/lima-swing/src/main/resources/log4j.properties 2011-09-22 15:26:44 UTC (rev 3301)
@@ -37,4 +37,5 @@
log4j.appender.file.layout.ConversionPattern=%5p [%t] (%F:%L) %M - %m%n
# package level
-log4j.logger.org.chorem.lima=INFO
\ No newline at end of file
+log4j.logger.org.chorem.lima=INFO
+log4j.logger.org.nuiton.topia=INFO
\ No newline at end of file
1
0
r3300 - trunk/lima-business/src/main/java/org/chorem/lima/business/ejb
by tchemit@users.chorem.org 22 Sep '11
by tchemit@users.chorem.org 22 Sep '11
22 Sep '11
Author: tchemit
Date: 2011-09-22 17:24:35 +0200 (Thu, 22 Sep 2011)
New Revision: 3300
Url: http://chorem.org/repositories/revision/lima/3300
Log:
fix request to obtain master account childs (no link with ledger account here) + fix lazy attribute
Modified:
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java
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-22 15:23:12 UTC (rev 3299)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java 2011-09-22 15:24:35 UTC (rev 3300)
@@ -277,7 +277,6 @@
return accountsList;
}
-
/**
* Permet de recuperer la liste des comptes fils d'un compte en particulier.
*
@@ -296,15 +295,18 @@
LimaCallaoDAOHelper.getAccountDAO(transaction);
TopiaQuery query = accountDAO.createQuery();
- if (masterAccount == null) {
- query.addEquals(Account.PROPERTY_MASTER_ACCOUNT, masterAccount);
- query.addWhere(Account.PROPERTY_GENERAL_LEDGER, TopiaQuery.Op.EQ, null);
- } else {
- query.addWhere(Account.PROPERTY_MASTER_ACCOUNT +
- " = :value or " +
- Account.PROPERTY_GENERAL_LEDGER + " = :value")
- .addParam("value", masterAccount);
- }
+ //tchemit 2011-09-21 Only consider account childs from the master account
+ // link otherwise account can be found from different masterAccount
+ query.addEquals(Account.PROPERTY_MASTER_ACCOUNT, masterAccount);
+// if (masterAccount == null) {
+// query.addEquals(Account.PROPERTY_MASTER_ACCOUNT, masterAccount);
+// query.addWhere(Account.PROPERTY_GENERAL_LEDGER, TopiaQuery.Op.EQ, null);
+// } else {
+// query.addWhere(Account.PROPERTY_MASTER_ACCOUNT +
+// " = :value or " +
+// Account.PROPERTY_GENERAL_LEDGER + " = :value")
+// .addParam("value", masterAccount);
+// }
accountsList.addAll(accountDAO.findAllByQuery(query));
Collections.sort(accountsList, new AccountComparator());
@@ -317,6 +319,7 @@
}
t.sizeSubAccounts();
t.sizeSubLedgers();
+ t.getGeneralLedger();
}
} catch (Exception ex) {
1
0
Author: tchemit
Date: 2011-09-22 17:23:12 +0200 (Thu, 22 Sep 2011)
New Revision: 3299
Url: http://chorem.org/repositories/revision/lima/3299
Log:
T?\195?\162che #437: Can not launch via jnlp
T?\195?\162che #460: Updates to mavenpom4remine 3.0.4
Modified:
trunk/lima-swing/pom.xml
trunk/pom.xml
Modified: trunk/lima-swing/pom.xml
===================================================================
--- trunk/lima-swing/pom.xml 2011-09-22 15:21:31 UTC (rev 3298)
+++ trunk/lima-swing/pom.xml 2011-09-22 15:23:12 UTC (rev 3299)
@@ -232,30 +232,10 @@
<groupId>org.codehaus.mojo.webstart</groupId>
<artifactId>webstart-maven-plugin</artifactId>
<configuration>
- <libPath>lib</libPath>
- <makeArchive>false</makeArchive>
- <verbose>false</verbose>
<gzip>true</gzip>
+ <unsign>true</unsign>
<canUnsign>false</canUnsign>
- <!--<unsign>true</unsign>-->
<pack200>true</pack200>
-
- <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>jxlayer</name>
@@ -279,7 +259,7 @@
<profiles>
<profile>
- <id>myreporting</id>
+ <id>jnlp-reporting</id>
<activation>
<property>
<name>performRelease</name>
@@ -291,7 +271,7 @@
<plugin>
<groupId>org.codehaus.mojo.webstart</groupId>
<artifactId>webstart-maven-plugin</artifactId>
- <version>${jnlpPluginVersion}</version>
+ <version>${webstartPluginVersion}</version>
</plugin>
</plugins>
</reporting>
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2011-09-22 15:21:31 UTC (rev 3298)
+++ trunk/pom.xml 2011-09-22 15:23:12 UTC (rev 3299)
@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
-<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>
@@ -10,7 +12,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>mavenpom4redmine</artifactId>
- <version>3.0.3</version>
+ <version>3.0.4-SNAPSHOT</version>
</parent>
<groupId>org.chorem</groupId>
@@ -121,10 +123,10 @@
</dependency>
<dependency>
- <groupId>org.apache.openejb</groupId>
- <artifactId>javaee-api</artifactId>
- <version>5.0-3</version>
- <scope>runtime</scope>
+ <groupId>org.apache.openejb</groupId>
+ <artifactId>javaee-api</artifactId>
+ <version>5.0-3</version>
+ <scope>runtime</scope>
</dependency>
<dependency>
@@ -152,7 +154,7 @@
<artifactId>openejb-loader</artifactId>
<version>${openEjbVersion}</version>
</dependency>
-
+
<!-- autres libraires -->
<dependency>
<groupId>org.swinglabs</groupId>
@@ -188,6 +190,20 @@
<groupId>com.lowagie</groupId>
<artifactId>itext</artifactId>
<version>2.1.7</version>
+ <exclusions>
+ <exclusion>
+ <groupId>bouncycastle</groupId>
+ <artifactId>bcmail-jdk14</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>bouncycastle</groupId>
+ <artifactId>bcprov-jdk14</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.bouncycastle</groupId>
+ <artifactId>bctsp-jdk14</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
@@ -201,9 +217,9 @@
<version>2.5-6.0.1</version>
<scope>runtime</scope>
</dependency>
-
+
<!-- pdfbox to create pdf document -->
-
+
<dependency>
<groupId>org.apache.pdfbox</groupId>
<artifactId>pdfbox</artifactId>
@@ -289,7 +305,7 @@
</roles>
</contributor>
<contributor>
- <name>Victor Salaun</name>
+ <name>vsalaun</name>
<email>salaun(a)codelutin.com</email>
<organization>Code Lutin</organization>
<organizationUrl>http://www.codelutin.com</organizationUrl>
@@ -321,15 +337,12 @@
<!-- 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>
<build>
- <defaultGoal>install</defaultGoal>
<pluginManagement>
<plugins>
@@ -365,17 +378,11 @@
</plugin>
<plugin>
- <groupId>org.codehaus.mojo.webstart</groupId>
- <artifactId>webstart-maven-plugin</artifactId>
- <version>${jnlpPluginVersion}</version>
+ <groupId>org.bluestemsoftware.open.maven.plugin</groupId>
+ <artifactId>launch4j-plugin</artifactId>
+ <version>1.5.0.0</version>
</plugin>
- <plugin>
- <groupId>org.bluestemsoftware.open.maven.plugin</groupId>
- <artifactId>launch4j-plugin</artifactId>
- <version>1.5.0.0</version>
- </plugin>
-
</plugins>
</pluginManagement>
@@ -386,7 +393,8 @@
<!-- ************************************************************* -->
<scm>
<connection>scm:svn:http://svn.chorem.org/svn/lima/trunk</connection>
- <developerConnection>scm:svn:http://svn.chorem.org/svn/lima/trunk
+ <developerConnection>
+ scm:svn:http://svn.chorem.org/svn/lima/trunk
</developerConnection>
<url>http://www.chorem.org/repositories/browse/lima/trunk</url>
</scm>
@@ -399,69 +407,36 @@
</distributionManagement>
<repositories>
- <!-- depot des releases nuiton -->
- <!--repository>
- <id>nuiton.release</id>
- <name>NuitonReleaseRepository</name>
- <url>http://maven.nuiton.org/release</url>
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- <releases>
- <enabled>true</enabled>
- <checksumPolicy>warn</checksumPolicy>
- </releases>
- </repository-->
- <!-- depot des snapshots nuiton -->
- <!--repository>
- <id>nuiton.snapshot</id>
- <name>NuitonSnapshotRepository</name>
- <url>http://maven.nuiton.org/snapshot</url>
- <snapshots>
- <enabled>true</enabled>
- <checksumPolicy>fail</checksumPolicy>
- </snapshots>
- <releases>
- <enabled>false</enabled>
- </releases>
- </repository-->
- <!-- jboss -->
- <!--repository>
- <id>jboss.repo</id>
- <url>http://repository.jboss.org/maven2</url>
- </repository>
+ <!-- nuiton nexus repository -->
<repository>
- <id>apache.snapshot</id>
- <url>http://repository.apache.org/snapshots</url>
- </repository-->
+ <id>nexus.nuiton</id>
+ <name>NuitonNexusRepository</name>
+ <url>http://nexus.nuiton.org/nexus/content/groups/public</url>
+ <snapshots>
+ <enabled>true</enabled>
+ <updatePolicy>daily</updatePolicy>
+ </snapshots>
+ <releases>
+ <enabled>true</enabled>
+ <checksumPolicy>warn</checksumPolicy>
+ </releases>
+ </repository>
</repositories>
<pluginRepositories>
- <!-- depot des releases nuiton -->
- <!--pluginRepository>
- <id>nuiton.release</id>
- <name>NuitonReleaseRepository</name>
- <url>http://maven.nuiton.org/release</url>
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- <releases>
- <enabled>true</enabled>
- <checksumPolicy>warn</checksumPolicy>
- </releases>
- </pluginRepository-->
- <!-- depot des snapshots nuiton -->
- <!--pluginRepository>
- <id>nuiton.snapshot</id>
- <name>NuitonSnapshotRepository</name>
- <url>http://maven.nuiton.org/snapshot</url>
- <snapshots>
- <enabled>true</enabled>
- <checksumPolicy>fail</checksumPolicy>
- </snapshots>
- <releases>
- <enabled>false</enabled>
- </releases>
- </pluginRepository-->
+ <!-- nuiton nexus repository -->
+ <pluginRepository>
+ <id>nexus.nuiton</id>
+ <name>NuitonNexusRepository</name>
+ <url>http://nexus.nuiton.org/nexus/content/groups/public</url>
+ <snapshots>
+ <enabled>true</enabled>
+ <updatePolicy>daily</updatePolicy>
+ </snapshots>
+ <releases>
+ <enabled>true</enabled>
+ <checksumPolicy>warn</checksumPolicy>
+ </releases>
+ </pluginRepository>
</pluginRepositories>
</project>
1
0
r3298 - trunk/lima-business/src/main/java/org/chorem/lima/business/migration
by tchemit@users.chorem.org 22 Sep '11
by tchemit@users.chorem.org 22 Sep '11
22 Sep '11
Author: tchemit
Date: 2011-09-22 17:21:31 +0200 (Thu, 22 Sep 2011)
New Revision: 3298
Url: http://chorem.org/repositories/revision/lima/3298
Log:
improve migration code
Modified:
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/MigrationV0_5_2.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/migration/MigrationV0_5_2.java 2011-09-22 12:59:51 UTC (rev 3297)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/migration/MigrationV0_5_2.java 2011-09-22 15:21:31 UTC (rev 3298)
@@ -33,8 +33,9 @@
boolean showSql,
boolean showProgression)
throws TopiaException {
+
if (log.isInfoEnabled()) {
- log.info("Migrates to version 0.6");
+ log.info("Migrates to version 0.5.2");
}
// find all account with no master account and attach them to a master
@@ -66,55 +67,46 @@
// this is a master account, nothing to do
return;
}
+ String masterAccountNumber = null;
+
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;
- }
+ masterAccountNumber = accountNumber.substring(0, 3);
+ } else if (length == 3) {
- if (length == 3) {
+ // fill with master account with 2 digits
+ masterAccountNumber = accountNumber.substring(0, 2);
+ } else if (length == 2) {
- // 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;
+ // fill with master account with 1 digits
+ masterAccountNumber = accountNumber.substring(0, 1);
}
+ if (masterAccountNumber != null) {
- if (length == 2) {
-
- // fill with master account with 3 digits
- String masterAccountNumber = accountNumber.substring(0, 1);
Account masterAccount = getMasterAccount(accountDAO, account, masterAccountNumber);
+
+ if (log.isInfoEnabled()) {
+ log.info("Set masterAccount [" + masterAccountNumber + "] to account [" + accountNumber + "]");
+ }
account.setMasterAccount(masterAccount);
// let's fill master account
fillMasterAccountNumber(accountDAO, masterAccount);
- return;
}
-
-
}
protected Account getMasterAccount(AccountDAO accountDAO,
Account subAccount,
- String masterAccountNumber) throws TopiaException {
+ String accountNumber) throws TopiaException {
Account masterAccount =
- accountDAO.findByAccountNumber(masterAccountNumber);
+ accountDAO.findByAccountNumber(accountNumber);
if (masterAccount == null) {
// creates it
- masterAccount = accountDAO.create(Account.PROPERTY_ACCOUNT_NUMBER, masterAccountNumber);
+ masterAccount = accountDAO.create(Account.PROPERTY_ACCOUNT_NUMBER, accountNumber);
}
masterAccount.addSubAccounts(subAccount);
return masterAccount;
1
0
Author: tchemit
Date: 2011-09-22 14:59:51 +0200 (Thu, 22 Sep 2011)
New Revision: 3297
Url: http://chorem.org/repositories/revision/lima/3297
Log:
T?\195?\162che #458: Updates to topia 2.6.2 and eugene 2.4
Modified:
trunk/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2011-09-20 17:49:06 UTC (rev 3296)
+++ trunk/pom.xml 2011-09-22 12:59:51 UTC (rev 3297)
@@ -311,8 +311,8 @@
<!-- customized libs version -->
<nuitonUtilsVersion>2.3</nuitonUtilsVersion>
- <eugenePluginVersion>2.3.5</eugenePluginVersion>
- <topiaVersion>2.6.2-SNAPSHOT</topiaVersion>
+ <eugenePluginVersion>2.4</eugenePluginVersion>
+ <topiaVersion>2.6.2</topiaVersion>
<jaxxVersion>2.5-SNAPSHOT</jaxxVersion>
<nuitonI18nVersion>2.4.1</nuitonI18nVersion>
<openEjbVersion>3.1.4</openEjbVersion>
1
0