This is an automated email from the git hooks/post-receive script. New change to branch feature/1158-NotEditableTableForClose in repository lima. See http://git.chorem.org/lima.git from d5544bc refs #1158 Ajout de commentaires + désactivation du boutton de création d'une transaction new dfe90c3 refs #1158 Sur l'onglet lettrage il n'est pas possible de modifier une selection comportant une entrée vérouillée. Ajout d'une colonne 'clos' indiquant les entrées vérouillées. 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 dfe90c3e3a7edd89dffffb6d592d54147f27aefe Author: dcosse <cosse@codelutin.com> Date: Mon Sep 28 16:24:18 2015 +0200 refs #1158 Sur l'onglet lettrage il n'est pas possible de modifier une selection comportant une entrée vérouillée. Ajout d'une colonne 'clos' indiquant les entrées vérouillées. Summary of changes: .../business/api/FinancialTransactionService.java | 7 ++ .../ejb/FinancialTransactionServiceImpl.java | 12 +++ .../java/org/chorem/lima/entity/EntryTopiaDao.java | 24 ++++++ .../lima/ui/lettering/LetteringEditModel.java | 80 +++++++++---------- ...tionModel.java => LetteringSelectionModel.java} | 31 ++------ .../lima/ui/lettering/LetteringTableModel.java | 38 +++++++++ .../org/chorem/lima/ui/lettering/LetteringView.css | 6 +- .../chorem/lima/ui/lettering/LetteringView.jaxx | 2 +- .../lima/ui/lettering/LetteringViewHandler.java | 85 +++++++++++---------- .../resources/i18n/lima-swing_en_GB.properties | 1 + .../resources/i18n/lima-swing_fr_FR.properties | 1 + .../icons/action-financialPeriod-close.png | Bin 715 -> 452 bytes lima-swing/src/main/resources/log4j.properties | 2 +- 13 files changed, 179 insertions(+), 110 deletions(-) rename lima-swing/src/main/java/org/chorem/lima/ui/lettering/{LettringSelectionModel.java => LetteringSelectionModel.java} (82%) -- 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 feature/1158-NotEditableTableForClose in repository lima. See http://git.chorem.org/lima.git commit dfe90c3e3a7edd89dffffb6d592d54147f27aefe Author: dcosse <cosse@codelutin.com> Date: Mon Sep 28 16:24:18 2015 +0200 refs #1158 Sur l'onglet lettrage il n'est pas possible de modifier une selection comportant une entrée vérouillée. Ajout d'une colonne 'clos' indiquant les entrées vérouillées. --- .../business/api/FinancialTransactionService.java | 7 ++ .../ejb/FinancialTransactionServiceImpl.java | 12 +++ .../java/org/chorem/lima/entity/EntryTopiaDao.java | 24 ++++++ .../lima/ui/lettering/LetteringEditModel.java | 80 +++++++++---------- ...tionModel.java => LetteringSelectionModel.java} | 31 ++------ .../lima/ui/lettering/LetteringTableModel.java | 38 +++++++++ .../org/chorem/lima/ui/lettering/LetteringView.css | 6 +- .../chorem/lima/ui/lettering/LetteringView.jaxx | 2 +- .../lima/ui/lettering/LetteringViewHandler.java | 85 +++++++++++---------- .../resources/i18n/lima-swing_en_GB.properties | 1 + .../resources/i18n/lima-swing_fr_FR.properties | 1 + .../icons/action-financialPeriod-close.png | Bin 715 -> 452 bytes lima-swing/src/main/resources/log4j.properties | 2 +- 13 files changed, 179 insertions(+), 110 deletions(-) diff --git a/lima-business-api/src/main/java/org/chorem/lima/business/api/FinancialTransactionService.java b/lima-business-api/src/main/java/org/chorem/lima/business/api/FinancialTransactionService.java index d268005..d46ef99 100644 --- a/lima-business-api/src/main/java/org/chorem/lima/business/api/FinancialTransactionService.java +++ b/lima-business-api/src/main/java/org/chorem/lima/business/api/FinancialTransactionService.java @@ -126,6 +126,13 @@ public interface FinancialTransactionService { List<Entry> getAllEntrieByDatesAndAccountAndLettering(LetteringFilter filter); /** + * + * @param filter filter define: starting date, ending date, account + * @return All Entries related to an unclosed entry book according to the filter. + */ + List<Entry> getAllUnlockEntriesByFilter(LetteringFilter filter); + + /** * Retourne la dernière entrée d'une transaction * @param financialTransaction transaction sur laquelle la derniere entree est selectionnee * */ diff --git a/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java b/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java index 274781a..48086b8 100644 --- a/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java +++ b/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java @@ -474,6 +474,18 @@ public class FinancialTransactionServiceImpl extends AbstractLimaService impleme } @Override + public List<Entry> getAllUnlockEntriesByFilter(LetteringFilter filter) { + EntryTopiaDao entryTopiaDao = getDaoHelper().getEntryDao(); + List<Entry> entries = entryTopiaDao.findAllUnlockEntriesByFilter(filter); + + if (log.isDebugEnabled()) { + log.debug("Entries size : " + entries.size()); + } + + return entries; + } + + @Override public Entry getLastEntry(FinancialTransaction financialTransaction) { EntryTopiaDao entryTopiaDao = getDaoHelper().getEntryDao(); diff --git a/lima-business/src/main/java/org/chorem/lima/entity/EntryTopiaDao.java b/lima-business/src/main/java/org/chorem/lima/entity/EntryTopiaDao.java index 4c44ba6..8956f41 100644 --- a/lima-business/src/main/java/org/chorem/lima/entity/EntryTopiaDao.java +++ b/lima-business/src/main/java/org/chorem/lima/entity/EntryTopiaDao.java @@ -29,7 +29,9 @@ import org.chorem.lima.beans.LetteringFilter; import org.nuiton.topia.persistence.HqlAndParametersBuilder; import java.util.Date; +import java.util.HashMap; import java.util.List; +import java.util.Map; public class EntryTopiaDao extends AbstractEntryTopiaDao<Entry> { @@ -230,6 +232,28 @@ public class EntryTopiaDao extends AbstractEntryTopiaDao<Entry> { return entries; } + public List<Entry> findAllUnlockEntriesByFilter(LetteringFilter filter) { + Map<String, Object> params = new HashMap<>(); + String req = "SELECT E FROM " + Entry.class.getName() + " E, " + ClosedPeriodicEntryBook.class.getName() + " CPEB " + + " WHERE E." + PROPERTY_TRANSACTION_DATE + ">= :ds " + + " AND E." + PROPERTY_TRANSACTION_DATE + "<= :de "; + Account account = filter.getAccount(); + if (account == null || account.getTopiaId() != null) { + req += " AND E." + Entry.PROPERTY_ACCOUNT + " = :a"; + params.put("a", account); + } + req +=" AND E." + Entry.PROPERTY_FINANCIAL_TRANSACTION + "." + FinancialTransaction.PROPERTY_ENTRY_BOOK + " = CPEB." + ClosedPeriodicEntryBook.PROPERTY_ENTRY_BOOK + + " AND CPEB." + ClosedPeriodicEntryBook.PROPERTY_LOCKED + " = FALSE" + + " AND CPEB." + ClosedPeriodicEntryBook.PROPERTY_FINANCIAL_PERIOD + "." + FinancialPeriod.PROPERTY_BEGIN_DATE + " <= E." + Entry.PROPERTY_FINANCIAL_TRANSACTION + "." + FinancialTransaction.PROPERTY_TRANSACTION_DATE + + " AND CPEB." + ClosedPeriodicEntryBook.PROPERTY_FINANCIAL_PERIOD + "." + FinancialPeriod.PROPERTY_END_DATE + " >= E." + Entry.PROPERTY_FINANCIAL_TRANSACTION + "." + FinancialTransaction.PROPERTY_TRANSACTION_DATE; + params.put("ds", filter.getDateStart()); + params.put("de", filter.getDateEnd()); + + List<Entry> entries = findAll(req, params); + + return entries; + } + /** * Retourne la dernière entrée d'une transaction * @param financialTransaction transaction sur laquelle la derniere entree est selectionnee diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringEditModel.java b/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringEditModel.java index c400009..35e6237 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringEditModel.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringEditModel.java @@ -31,24 +31,27 @@ import java.math.BigDecimal; */ public class LetteringEditModel implements Serializable { + public static final String PROPERTY_EDITABLE = "editable"; + public static final String PROPERTY_DEBIT = "debit"; public static final String PROPERTY_CREDIT = "credit"; public static final String PROPERTY_SOLD = "sold"; - public static final String PROPERTY_LETTRED = "lettred"; + public static final String PROPERTY_LETTERED = "lettered"; - public static final String PROPERTY_UNLETTRED = "unLettred"; + public static final String PROPERTY_UNLETTERED = "unLettered"; public static final String PROPERTY_EQUALIZED = "equalized"; protected final PropertyChangeSupport pcs = new PropertyChangeSupport(this); protected LetteringTableModel model; - protected boolean lettred; - protected boolean unLettred; + protected boolean lettered; + protected boolean unLettered; protected boolean equalized; + protected boolean editable; protected BigDecimal debit = BigDecimal.ZERO; protected BigDecimal credit = BigDecimal.ZERO; protected BigDecimal sold = BigDecimal.ZERO; @@ -63,28 +66,24 @@ public class LetteringEditModel implements Serializable { firePropertyChange(PROPERTY_EQUALIZED, oldEqualized, this.equalized); } - public boolean isLettred() { - return lettred; + public boolean isLettered() { + return lettered; } - public void setLettred(boolean lettred) { - boolean oldLettrer = isLettred(); - if(lettred && (sold == BigDecimal.ZERO || sold.doubleValue() == 0)){ - this.lettred = lettred; - }else{ - this.lettred = false; - } - firePropertyChange(PROPERTY_LETTRED, oldLettrer, this.lettred); + public void setLettered(boolean lettered) { + boolean oldLettrer = isLettered(); + this.lettered = lettered && (BigDecimal.ZERO.equals(sold) || sold.doubleValue() == 0) && lettered; + firePropertyChange(PROPERTY_LETTERED, oldLettrer, this.lettered); } - public boolean isUnLettred() { - return unLettred; + public boolean isUnLettered() { + return unLettered; } - public void setUnLettred(boolean unLettred) { - boolean oldDelettrer = isUnLettred(); - this.unLettred = unLettred; - firePropertyChange(PROPERTY_UNLETTRED, oldDelettrer, this.unLettred); + public void setUnLettered(boolean unLettered) { + boolean oldDeletterer = isUnLettered(); + this.unLettered = unLettered; + firePropertyChange(PROPERTY_UNLETTERED, oldDeletterer, this.unLettered); } public BigDecimal getDebit() { @@ -94,9 +93,9 @@ public class LetteringEditModel implements Serializable { public void setDebit(BigDecimal debit) { BigDecimal oldDebit = getDebit(); - if (debit != BigDecimal.ZERO){ + if (!BigDecimal.ZERO.equals(debit)){ this.debit = debit.add(oldDebit); - }else{ + } else { this.debit = BigDecimal.ZERO; } @@ -110,7 +109,7 @@ public class LetteringEditModel implements Serializable { public void setCredit(BigDecimal credit) { BigDecimal oldCredit = getCredit(); - if (credit != BigDecimal.ZERO){ + if (!BigDecimal.ZERO.equals(credit)){ this.credit = credit.add(oldCredit); }else{ this.credit=BigDecimal.ZERO; @@ -123,39 +122,26 @@ public class LetteringEditModel implements Serializable { return sold; } - public void setSolde(BigDecimal solde, boolean credit) { - BigDecimal oldSolde = getSold(); + public void setSold(BigDecimal solde, boolean credit) { + BigDecimal oldSold = getSold(); - if (solde != BigDecimal.ZERO){ + if (!BigDecimal.ZERO.equals(solde)){ if (credit){ - this.sold = oldSolde.subtract(solde); + this.sold = oldSold.subtract(solde); }else{ - this.sold = oldSolde.add(solde); + this.sold = oldSold.add(solde); } }else{ this.sold =BigDecimal.ZERO; } - firePropertyChange(PROPERTY_SOLD, oldSolde, this.sold); - } - - public void resetDebitCreditBalance(){ - setDebit(BigDecimal.ZERO); - setCredit(BigDecimal.ZERO); - setSolde(BigDecimal.ZERO, false); - } - - public void addPropertyChangeListener(PropertyChangeListener listener) { - pcs.addPropertyChangeListener(listener); + firePropertyChange(PROPERTY_SOLD, oldSold, this.sold); } public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) { pcs.addPropertyChangeListener(propertyName, listener); } - public void removePropertyChangeListener(PropertyChangeListener listener) { - pcs.removePropertyChangeListener(listener); - } public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) { pcs.removePropertyChangeListener(propertyName, listener); @@ -168,4 +154,14 @@ public class LetteringEditModel implements Serializable { protected void firePropertyChange(String propertyName, Object newValue) { firePropertyChange(propertyName, null, newValue); } + + public boolean isEditable() { + return editable; + } + + public void setEditable(boolean editable) { + boolean oldEditable = this.editable; + this.editable = editable; + firePropertyChange(PROPERTY_EDITABLE, oldEditable, this.editable); + } } diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LettringSelectionModel.java b/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringSelectionModel.java similarity index 82% rename from lima-swing/src/main/java/org/chorem/lima/ui/lettering/LettringSelectionModel.java rename to lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringSelectionModel.java index 8fae31a..d4b2f53 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LettringSelectionModel.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringSelectionModel.java @@ -25,21 +25,20 @@ import org.apache.commons.lang3.StringUtils; import org.chorem.lima.entity.Entry; import javax.swing.*; -import java.beans.PropertyChangeListener; import java.beans.PropertyChangeSupport; import java.util.List; /** * @author sletellier <letellier@codelutin.com> */ -public class LettringSelectionModel extends DefaultListSelectionModel{ +public class LetteringSelectionModel extends DefaultListSelectionModel{ protected LetteringTableModel letteringTableModel; protected Entry entry; protected int lineSelected; protected final PropertyChangeSupport pcs = new PropertyChangeSupport(this); - public LettringSelectionModel(LetteringTableModel letteringTableModel){ + public LetteringSelectionModel(LetteringTableModel letteringTableModel){ this.letteringTableModel = letteringTableModel; } @@ -52,16 +51,16 @@ public class LettringSelectionModel extends DefaultListSelectionModel{ public void setSelectionInterval(int row, int column) { if (!letteringNotExist(row)) { - //lettred entries + //lettered entries if ( isSelectionEmpty() || !isSelectedIndex(row)){ clearSelection(); lineSelected = row; - String currentLettring = getCurrentLettring(); + String currentLettering = getCurrentLettering(); //select entries with the same letter of the selected entry for(Entry entry : getEntries()){ if (StringUtils.isNotBlank(entry.getLettering())){ - if (entry.getLettering().equals(currentLettring)){ + if (entry.getLettering().equals(currentLettering)){ int entryToSelect = letteringTableModel.indexOf(entry); super.addSelectionInterval(entryToSelect, entryToSelect); } @@ -71,7 +70,7 @@ public class LettringSelectionModel extends DefaultListSelectionModel{ } else { - //unlettred entries + //unlettered entries //To clear the selection when it changes from lettered entry to unlettered for(Entry entry : getEntries()){ if (!StringUtils.isBlank(entry.getLettering())) { @@ -105,7 +104,7 @@ public class LettringSelectionModel extends DefaultListSelectionModel{ return letteringTableModel.getValues(); } - public String getCurrentLettring(){ + public String getCurrentLettering(){ return getCurrentEntrySelected().getLettering(); } @@ -132,22 +131,6 @@ public class LettringSelectionModel extends DefaultListSelectionModel{ return MULTIPLE_INTERVAL_SELECTION; } - public void addPropertyChangeListener(PropertyChangeListener listener) { - pcs.addPropertyChangeListener(listener); - } - - public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) { - pcs.addPropertyChangeListener(propertyName, listener); - } - - public void removePropertyChangeListener(PropertyChangeListener listener) { - pcs.removePropertyChangeListener(listener); - } - - public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) { - pcs.removePropertyChangeListener(propertyName, listener); - } - protected void firePropertyChange(String propertyName, Object oldValue, Object newValue) { pcs.firePropertyChange(propertyName, oldValue, newValue); } diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTableModel.java b/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTableModel.java index c89fffa..d209b32 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTableModel.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTableModel.java @@ -28,8 +28,14 @@ import org.chorem.lima.entity.EntryBook; import org.chorem.lima.ui.common.AbstractColumn; import org.chorem.lima.ui.common.AbstractLimaTableModel; +import javax.imageio.ImageIO; +import javax.swing.*; +import java.awt.*; +import java.io.IOException; +import java.io.InputStream; import java.math.BigDecimal; import java.util.Date; +import java.util.List; import static org.nuiton.i18n.I18n.t; @@ -44,9 +50,20 @@ public class LetteringTableModel extends AbstractLimaTableModel<Entry> { /** serialVersionUID. */ private static final long serialVersionUID = 1L; + protected ImageIcon lockedImageIcon; + protected List<Entry> unlockedEntries; @Override protected void initColumn() { + addColumn(new AbstractColumn<LetteringTableModel>(ImageIcon.class, t("lima.table.locked"), false) { + @Override + public Object getValueAt(int row) { + Entry entry = tableModel.get(row); + ImageIcon imageIcon = unlockedEntries.contains(entry) ? null: getLockedImageIcon(); + return imageIcon; + } + }); + addColumn(new AbstractColumn<LetteringTableModel>(Date.class, t("lima.table.date"), false) { @Override public Object getValueAt(int row) { @@ -113,4 +130,25 @@ public class LetteringTableModel extends AbstractLimaTableModel<Entry> { } + public List<Entry> getUnlockedEntries() { + return unlockedEntries; + } + + public void setUnlockedEntries(List<Entry> unlockedEntries) { + this.unlockedEntries = unlockedEntries; + } + + protected ImageIcon getLockedImageIcon() { + if (lockedImageIcon == null) { + InputStream stream = LetteringTableModel.class.getResourceAsStream("/icons/action-financialPeriod-close.png"); + Image lockedIcon; + try { + lockedIcon = ImageIO.read(stream); + lockedImageIcon = new ImageIcon(lockedIcon); + } catch (IOException e) { + e.printStackTrace(); + } + } + return lockedImageIcon; + } } diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringView.css b/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringView.css index 2663ad9..f5c7736 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringView.css +++ b/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringView.css @@ -25,19 +25,19 @@ #lettered { toolTipText : "lima.lettering.lettered"; - enabled : {editModel.isLettred()}; + enabled : {editModel.isLettered() && editModel.isEditable()}; actionIcon : "lettering"; } #noLettered { toolTipText : "lima.lettering.unLettered"; - enabled : {editModel.isUnLettred()}; + enabled : {editModel.isUnLettered() && editModel.isEditable()}; actionIcon : "un-lettering"; } #round { toolTipText : "lima.lettering.equalize"; - enabled : {editModel.isEqualized()}; + enabled : {editModel.isEqualized() && editModel.isEditable()}; actionIcon : "balance"; } diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringView.jaxx b/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringView.jaxx index 76ee663..9491b8f 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringView.jaxx +++ b/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringView.jaxx @@ -98,7 +98,7 @@ </JToolBar> <JScrollPane constraints="BorderLayout.CENTER"> <LetteringTableModel id="tableModel"/> - <LettringSelectionModel id='letteringSelectionModel' constructorParams='tableModel' + <LetteringSelectionModel id='letteringSelectionModel' constructorParams='tableModel' onValueChanged="handler.balanceAndActions()"/> <LetteringTable id="table" diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java b/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java index fd77b1a..68fa963 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java @@ -25,6 +25,7 @@ package org.chorem.lima.ui.lettering; import com.google.common.base.Predicate; import com.google.common.collect.Iterables; import com.google.common.collect.Lists; +import jaxx.runtime.SwingUtil; import org.apache.commons.lang3.time.DateUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -77,7 +78,6 @@ import static org.nuiton.i18n.I18n.t; public class LetteringViewHandler{ protected LetteringView view; - protected LetteringTable table; /** Transaction service. */ protected FiscalPeriodService fiscalPeriodService; @@ -88,15 +88,14 @@ public class LetteringViewHandler{ protected LetteringFilterImpl filter; - protected BigDecimal debit = BigDecimal.ZERO; - protected BigDecimal credit = BigDecimal.ZERO; - protected BigDecimal solde = BigDecimal.ZERO; - protected LettringSelectionModel lettringSelectionModel; + protected LetteringSelectionModel letteringSelectionModel; protected LetteringEditModel editModel; + protected List<Entry> unlockedEntries; + protected ErrorHelper errorHelper; - protected enum ButtonMode {DELETTRED, LETTRED, EQUALIZED, ALL} + protected enum ButtonMode {DELETTERED, LETTERED, EQUALIZED, ALL} private static final Log log = LogFactory.getLog(LetteringViewHandler.class); @@ -120,7 +119,7 @@ public class LetteringViewHandler{ public void init() { filter = new LetteringFilterImpl(); editModel = view.getEditModel(); - lettringSelectionModel = view.getLetteringSelectionModel(); + letteringSelectionModel = view.getLetteringSelectionModel(); loadComboAndRows(); editModel.addPropertyChangeListener(LetteringEditModel.PROPERTY_DEBIT, new PropertyChangeListener() { @@ -145,10 +144,11 @@ public class LetteringViewHandler{ }); initializationComplete = true; + SwingUtil.fixTableColumnWidth(view.getTable(), 0, 40); + updateSoldStatus(); updateAllEntries(); - } public void updateSoldStatus() { @@ -225,15 +225,15 @@ public class LetteringViewHandler{ onBalanceChanged(null); } else if (!letteringNotExist(view.getTable().getSelectedRow())) { - //lettred entries + //lettered entries onBalanceChanged(null); setValuesForSelectedEntries(); //For U.I. buttons (Lettering and unlettering) - onButtonModeChanged(ButtonMode.DELETTRED); + onButtonModeChanged(ButtonMode.DELETTERED); } else { if (log.isDebugEnabled()) { - log.debug("unlettred entries"); + log.debug("unlettered entries"); } int[] selectedRows = view.getTable().getSelectedRows(); if (selectedRows.length == 2) { @@ -261,15 +261,15 @@ public class LetteringViewHandler{ onButtonModeChanged(ButtonMode.ALL); } - //Unlettred entries + //Unlettered entries onBalanceChanged(null); - //treatment unuseful if no rows are selected + //treatment useful if no rows are selected if (!view.getLetteringSelectionModel().isSelectionEmpty()) { if (log.isDebugEnabled()) { log.debug("Rows selected"); } setValuesForSelectedEntries(); - onButtonModeChanged(ButtonMode.LETTRED); + onButtonModeChanged(ButtonMode.LETTERED); } else { if (log.isDebugEnabled()) { log.debug("No Rows selected"); @@ -296,41 +296,46 @@ public class LetteringViewHandler{ public void onButtonModeChanged(ButtonMode buttonMode) { switch (buttonMode) { - case DELETTRED : - editModel.setLettred(false); - editModel.setUnLettred(true); + case DELETTERED: + editModel.setLettered(false); + editModel.setUnLettered(true); break; - case LETTRED: - editModel.setUnLettred(false); - editModel.setLettred(true); + case LETTERED: + editModel.setUnLettered(false); + editModel.setLettered(true); break; case EQUALIZED: editModel.setEqualized(true); break; default: - editModel.setLettred(false); - editModel.setUnLettred(false); + editModel.setLettered(false); + editModel.setUnLettered(false); editModel.setEqualized(false); } } public void setValuesForSelectedEntries() { + boolean isEditable = true; Entry selectedEntry; LetteringTableModel tableModel = view.getTableModel(); for (int i = 0; i < tableModel.getRowCount(); i ++){ if (view.getLetteringSelectionModel().isSelectedIndex(i)){ selectedEntry = tableModel.get(i); //Set values for calculation (By LetteringEditModel) of balance + if (!view.getTableModel().getUnlockedEntries().contains(selectedEntry)) { + isEditable = false; + } onBalanceChanged(selectedEntry); } } + editModel.setEditable(isEditable); } public void onBalanceChanged(Entry balance) { if (balance == null) { editModel.setCredit(BigDecimal.ZERO); editModel.setDebit(BigDecimal.ZERO); - editModel.setSolde(BigDecimal.ZERO, false); + editModel.setSold(BigDecimal.ZERO, false); } else { balanceCalculation(balance.getAmount(), balance.isDebit()); } @@ -354,11 +359,11 @@ public class LetteringViewHandler{ if (!creditVal.equals(BigDecimal.ZERO)){ editModel.setCredit(creditVal); - editModel.setSolde(creditVal, true); + editModel.setSold(creditVal, true); } }else if (creditVal.equals(BigDecimal.ZERO)){ editModel.setDebit(debitVal); - editModel.setSolde(debitVal, false); + editModel.setSold(debitVal, false); }else{ onBalanceChanged(null); } @@ -372,16 +377,16 @@ public class LetteringViewHandler{ Date defaultDateBegFiscalPeriod; Calendar calendar = Calendar.getInstance(); - int dernierJourMoisCourant = calendar.getActualMaximum(Calendar.DATE); - int premierJourMoisCourant = calendar.getActualMinimum(Calendar.DATE); + int lastCurrentMonthDay = calendar.getActualMaximum(Calendar.DATE); + int firstCurrentMonthDay = calendar.getActualMinimum(Calendar.DATE); if (fiscalPeriod != null){ defaultDateBegFiscalPeriod = fiscalPeriod.getBeginDate(); } else{ - defaultDateBegFiscalPeriod = DateUtils.setDays(new Date(), premierJourMoisCourant); + defaultDateBegFiscalPeriod = DateUtils.setDays(new Date(), firstCurrentMonthDay); } - Date defaultDateEndCurrent = DateUtils.setDays(new Date(), dernierJourMoisCourant); + Date defaultDateEndCurrent = DateUtils.setDays(new Date(), lastCurrentMonthDay); view.getBeginPeriodPicker().setDate(defaultDateBegFiscalPeriod); @@ -433,7 +438,9 @@ public class LetteringViewHandler{ && filter.getDateEnd() != null) { List<Entry> entries = financialTransactionService.getAllEntrieByDatesAndAccountAndLettering(filter); - + List<Entry> unlockEntries = financialTransactionService.getAllUnlockEntriesByFilter(filter); + view.getTableModel().setUnlockedEntries(unlockEntries); + this.unlockedEntries = unlockEntries; view.getTableModel().setValues(entries); } @@ -520,14 +527,14 @@ public class LetteringViewHandler{ /**Add a group of three letters to n entries*/ public void addLetter() { - if (editModel.isLettred()) { - int[] entrieSelected = view.getTable().getSelectedRows(); + if (editModel.isLettered()) { + int[] entriesSelected = view.getTable().getSelectedRows(); LetteringTableModel tableModel = view.getTableModel(); List<Entry> entries = Lists.newLinkedList(); - for (int indexEntry : entrieSelected) { + for (int indexEntry : entriesSelected) { Entry entry = tableModel.get(indexEntry); @@ -556,21 +563,21 @@ public class LetteringViewHandler{ errorHelper.showErrorMessage(t("lima.entries.letter.unbalanced.error")); } - onButtonModeChanged(ButtonMode.DELETTRED); + onButtonModeChanged(ButtonMode.DELETTERED); } } /**Remove a group of three letters to n entries*/ public void removeLetter() { - if (editModel.isUnLettred()) { + if (editModel.isUnLettered()) { - int[] entrieSelected = view.getTable().getSelectedRows(); + int[] entriesSelected = view.getTable().getSelectedRows(); LetteringTableModel tableModel = view.getTableModel(); - if (entrieSelected.length > 0) { + if (entriesSelected.length > 0) { - Entry firstEntry = tableModel.get(entrieSelected[0]); + Entry firstEntry = tableModel.get(entriesSelected[0]); String letter = firstEntry.getLettering(); @@ -579,7 +586,7 @@ public class LetteringViewHandler{ updateEntries(entries); } - onButtonModeChanged(ButtonMode.LETTRED); + onButtonModeChanged(ButtonMode.LETTERED); } } diff --git a/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties b/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties index d51bbba..89adeaa 100644 --- a/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties +++ b/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties @@ -500,6 +500,7 @@ lima.table.description=Description lima.table.entryBook=Entry book lima.table.label=Label lima.table.letter=Letter +lima.table.locked=Loked lima.table.number=Account Number lima.table.provisionDeprecation=Provision Deprecation lima.table.voucher=Voucher diff --git a/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties b/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties index b560fe4..5b103cd 100644 --- a/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties +++ b/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties @@ -507,6 +507,7 @@ lima.table.description=Description lima.table.entryBook=Journal lima.table.label=Libellé lima.table.letter=Lettre +lima.table.locked=Clos lima.table.number=Numéro de compte lima.table.provisionDeprecation=Amortissements et provisions lima.table.voucher=Pièce comptable diff --git a/lima-swing/src/main/resources/icons/action-financialPeriod-close.png b/lima-swing/src/main/resources/icons/action-financialPeriod-close.png index 08f2493..ac2fd6f 100644 Binary files a/lima-swing/src/main/resources/icons/action-financialPeriod-close.png and b/lima-swing/src/main/resources/icons/action-financialPeriod-close.png differ diff --git a/lima-swing/src/main/resources/log4j.properties b/lima-swing/src/main/resources/log4j.properties index 4581abe..48b1758 100644 --- a/lima-swing/src/main/resources/log4j.properties +++ b/lima-swing/src/main/resources/log4j.properties @@ -55,7 +55,7 @@ log4j.appender.C.layout=org.apache.log4j.SimpleLayout log4j.logger.org.chorem.lima=INFO log4j.logger.org.chorem.lima.ui.financialtransaction.FinancialTransactionTable=INFO log4j.logger.org.chorem.lima.ui.lettering.LetteringViewHandler=INFO -log4j.logger.org.chorem.lima.ui.lettering.LettringSelectionModel=INFO +log4j.logger.org.chorem.lima.ui.lettering.LetteringSelectionModel=INFO log4j.logger.org.chorem.lima.ui.lettering.LetteringEditModel=INFO log4j.logger.org.chorem.lima.ui.common.FinancialTransactionTableModel=INFO log4j.logger.org.chorem.lima.ui.celleditor.BigDecimalTableCellEditor=INFO -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
participants (1)
-
chorem.org scm