This is an automated email from the git hooks/post-receive script. New change to branch develop in repository lima. See http://git.chorem.org/lima.git from 19a980d [jgitflow-maven-plugin]Updating develop poms back to pre merge state new 34f7074 refs #1240 ajout de controles The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit 34f7074a2979ef27bb195fe4f03daecdc37a7f55 Author: dcosse <cosse@codelutin.com> Date: Mon Jun 29 14:25:13 2015 +0200 refs #1240 ajout de controles Summary of changes: .../ui/financialtransaction/AccountColumn.java | 27 ++++++++++++++++------ 1 file changed, 20 insertions(+), 7 deletions(-) -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository lima. See http://git.chorem.org/lima.git commit 34f7074a2979ef27bb195fe4f03daecdc37a7f55 Author: dcosse <cosse@codelutin.com> Date: Mon Jun 29 14:25:13 2015 +0200 refs #1240 ajout de controles --- .../ui/financialtransaction/AccountColumn.java | 27 ++++++++++++++++------ 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/AccountColumn.java b/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/AccountColumn.java index c38a68b..ec431f3 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/AccountColumn.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/AccountColumn.java @@ -48,22 +48,35 @@ public class AccountColumn extends AbstractColumn<FinancialTransactionTableModel @Override public boolean setValueAt(Object value, int row) { Entry entry = tableModel.get(row); - Account account = (Account) value; + // In case of Account field being feed up but no account was selected + // the value is a String instead of Account. + Account account = value == null ? null : value instanceof Account ? (Account) value : null; boolean update = ((entry.getAccount()) == null != (account == null)) || (entry.getAccount() != null - && !entry.getAccount().getAccountNumber().equals(account.getAccountNumber())); + && !entry.getAccount().getAccountNumber().equals(account.getAccountNumber())); if (update) { Account previousAccount = entry.getAccount(); entry.setAccount(account); if (!tableModel.updateEntry(entry)) { - entry.setAccount(previousAccount); - update = false; + update = revertAccountChange(entry, previousAccount); } else { - if (StringUtils.isBlank(entry.getDescription()) && StringUtils.isNotBlank(account.getLabel())) { - entry.setDescription(account.getLabel()); - } + setDescripntionFieldIfNone(entry, account); } } + + return update; + } + + protected void setDescripntionFieldIfNone(Entry entry, Account account) { + if (StringUtils.isBlank(entry.getDescription()) && account != null && StringUtils.isNotBlank(account.getLabel())) { + entry.setDescription(account.getLabel()); + } + } + + protected boolean revertAccountChange(Entry entry, Account previousAccount) { + boolean update; + entry.setAccount(previousAccount); + update = false; return update; } } -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
participants (1)
-
chorem.org scm