r3485 - in trunk: lima-business/src/main/java/org/chorem/lima/business/ejb lima-business-api/src/main/java/org/chorem/lima/business/api lima-callao/src/main/java/org/chorem/lima lima-callao/src/main/java/org/chorem/lima/beans lima-swing/src/main/java/org/chorem/lima/ui/common lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction lima-swing/src/main/java/org/chorem/lima/ui/lettering lima-swing/src/main/resources lima-swing/src/main/resources/i18n
Author: mallon Date: 2012-07-03 13:54:09 +0200 (Tue, 03 Jul 2012) New Revision: 3485 Url: http://chorem.org/repositories/revision/lima/3485 Log: - Interface, via jaxx, r?\195?\169alis?\195?\169e; - Chargement du tableau des ?\195?\169critures, ?\195?\160 l'ouverture, selon les deux dates par d?\195?\169faut, le compte et le filtre sur le lettrage; - Mod?\195?\168le d'UI cr?\195?\169?\195?\169 : gestion de l'affichage des composants en cours; - Chargement de la date et du journal, auparavant absents, de chaque ?\195?\169criture dans le tableau; - Affichage selon le compte et les dates s?\195?\169lectionn?\195?\169es; - Affichage par d?\195?\169faut des ?\195?\169critures non-lettr?\195?\169es et du compte 4; Added: trunk/lima-callao/src/main/java/org/chorem/lima/beans/ trunk/lima-callao/src/main/java/org/chorem/lima/beans/FiscalPeriodOpenClose.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringModelUI.java Removed: trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringPeriodSearchPanel.java Modified: trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/FiscalPeriodService.java trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/common/AccountComboBoxModel.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionView.jaxx trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTable.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTableModel.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringView.jaxx trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java trunk/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties trunk/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties trunk/lima-swing/src/main/resources/log4j.properties 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 2012-07-02 15:44:23 UTC (rev 3484) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java 2012-07-03 11:54:09 UTC (rev 3485) @@ -42,6 +42,8 @@ import org.chorem.lima.business.utils.AccountComparator; import org.chorem.lima.entity.Account; import org.chorem.lima.entity.AccountDAO; +import org.chorem.lima.entity.FiscalPeriod; +import org.chorem.lima.entity.FiscalPeriodDAO; import org.nuiton.topia.TopiaException; /** @@ -154,11 +156,11 @@ AccountDAO accountDAO = getDaoHelper().getAccountDAO(); accountsList = accountDAO.findAll(); Collections.sort(accountsList, new AccountComparator()); - + } catch (Exception ex) { throw new LimaException("Can't get all accounts", ex); } - + return accountsList; } Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java 2012-07-02 15:44:23 UTC (rev 3484) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java 2012-07-03 11:54:09 UTC (rev 3485) @@ -42,6 +42,7 @@ import org.chorem.lima.business.api.EntryBookService; import org.chorem.lima.business.api.FinancialPeriodService; import org.chorem.lima.business.api.FinancialTransactionService; +import org.chorem.lima.business.api.FiscalPeriodService; import org.chorem.lima.business.api.OptionsService; import org.chorem.lima.business.api.ReportService; import org.chorem.lima.entity.Account; @@ -71,7 +72,7 @@ @EJB protected FinancialPeriodService financialPeriodService; - + @EJB protected ReportService reportService; Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java 2012-07-02 15:44:23 UTC (rev 3484) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java 2012-07-03 11:54:09 UTC (rev 3485) @@ -157,8 +157,7 @@ return result; } - - + /** * return all blocked fiscal periods. */ @@ -195,6 +194,12 @@ return result; } + public String findLastActualLetters() throws LimaException { + List<FiscalPeriod> fiscalPeriods = getAllUnblockedFiscalPeriods(); + + return null; + } + @Override public FiscalPeriod getLastFiscalPeriod() throws LimaException { FiscalPeriod result = null; Modified: trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/FiscalPeriodService.java =================================================================== --- trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/FiscalPeriodService.java 2012-07-02 15:44:23 UTC (rev 3484) +++ trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/FiscalPeriodService.java 2012-07-03 11:54:09 UTC (rev 3485) @@ -59,4 +59,6 @@ void addRetainedEarnings(FiscalPeriod fiscalPeriod, boolean newyear, EntryBook entryBook) throws LimaException; + + String findLastActualLetters()throws LimaException; } Added: trunk/lima-callao/src/main/java/org/chorem/lima/beans/FiscalPeriodOpenClose.java =================================================================== --- trunk/lima-callao/src/main/java/org/chorem/lima/beans/FiscalPeriodOpenClose.java (rev 0) +++ trunk/lima-callao/src/main/java/org/chorem/lima/beans/FiscalPeriodOpenClose.java 2012-07-03 11:54:09 UTC (rev 3485) @@ -0,0 +1,26 @@ +package org.chorem.lima.beans; + +import org.apache.commons.lang3.tuple.Pair; + +public class FiscalPeriodOpenClose extends Pair<Object, Object>{ + + @Override + public Object setValue(Object value) { + // TODO Auto-generated method stub + return null; + } + + @Override + public Object getLeft() { + // TODO Auto-generated method stub + return null; + } + + @Override + public Object getRight() { + // TODO Auto-generated method stub + return null; + } + + +} Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/common/AccountComboBoxModel.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/common/AccountComboBoxModel.java 2012-07-02 15:44:23 UTC (rev 3484) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/common/AccountComboBoxModel.java 2012-07-03 11:54:09 UTC (rev 3485) @@ -37,4 +37,21 @@ /** serialVersionUID. */ private static final long serialVersionUID = 6991293987668268456L; + + /*By default, selection of the account 4*/ + @Override + public Object getElementAt(int index) { + if (getSelectedItem() == null){ + int indexAccountFour = 0; + for (Account compte : objects){ + if (compte.getAccountNumber().equals("4")){ + indexAccountFour = objects.indexOf(compte); + break; + } + } + setSelectedItem(objects.get(indexAccountFour)); + return objects.get(indexAccountFour); + } + return objects.get(index); + } } Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionView.jaxx =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionView.jaxx 2012-07-02 15:44:23 UTC (rev 3484) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionView.jaxx 2012-07-03 11:54:09 UTC (rev 3485) @@ -26,6 +26,7 @@ <import> javax.swing.ListSelectionModel + javax.swing.DefaultListSelectionModel org.chorem.lima.entity.FiscalPeriod org.chorem.lima.entity.FinancialPeriod org.chorem.lima.entity.EntryBook @@ -33,6 +34,13 @@ </import> <FinancialTransactionViewHandler id="handler" constructorParams="this"/> + + <ListSelectionModel + id='selectionModel' + initializer="new DefaultListSelectionModel()" + selectionMode='{ListSelectionModel.SINGLE_SELECTION}' + onValueChanged="setSelectedRow(financialTransactionTable.getSelectedRow() != -1)"/> + <Boolean id="selectedRow" javaBean="false"/> <script> @@ -105,11 +113,8 @@ <FinancialTransactionTable id="financialTransactionTable" sortable="false" rowHeight="22" constructorParams='handler' - model='{financialTransactionTableModel}' - selectionMode='{ListSelectionModel.SINGLE_SELECTION}'/> - <ListSelectionModel - initializer="financialTransactionTable.getSelectionModel()" - onValueChanged="setSelectedRow(financialTransactionTable.getSelectedRow() != -1)"/> + selectionModel='{selectionModel}' + model='{financialTransactionTableModel}'/> </JScrollPane> </cell> </row> Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringModelUI.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringModelUI.java (rev 0) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringModelUI.java 2012-07-03 11:54:09 UTC (rev 3485) @@ -0,0 +1,172 @@ +package org.chorem.lima.ui.lettering; + +import java.beans.PropertyChangeListener; +import java.beans.PropertyChangeSupport; +import java.math.BigDecimal; + +import javax.swing.DefaultListSelectionModel; + +import org.chorem.lima.entity.Entry; +import org.eclipse.jetty.util.log.Log; + +public class LetteringModelUI extends DefaultListSelectionModel{ + + public static final String SELECTED_ENTRY_PROPERTY = "selectedEntry"; + + public static final String DEBIT_PROPERTY = "debit"; + + public static final String CREDIT_PROPERTY = "credit"; + + public static final String SOLDE_PROPERTY = "solde"; + + public static final String LETTRER_PROPERTY = "lettrer"; + + public static final String DELETTRER_PROPERTY = "delettrer"; + + public static final String TEXTENABLE_PROPERTY = "textEnable"; + + private static final long serialVersionUID = 1L; + + protected final PropertyChangeSupport pcs = new PropertyChangeSupport(this); + + protected LetteringTableModel model; + + protected Entry selectedEntry; + protected BigDecimal debit; + protected BigDecimal credit; + protected String solde; + protected boolean lettrer; + protected boolean delettrer; + protected BigDecimal debitTotal; + protected BigDecimal creditTotal; + + public BigDecimal getDebitTotal() { + return debitTotal; + } + + public void setDebitTotal(BigDecimal debitTotal) { + this.debitTotal = debitTotal; + } + + public BigDecimal getCreditTotal() { + return creditTotal; + } + + public void setCreditTotal(BigDecimal creditTotal) { + this.creditTotal = creditTotal; + } + + public String getSoldeTotal() { + return soldeTotal; + } + + public void setSoldeTotal(String soldeTotal) { + this.soldeTotal = soldeTotal; + } + + protected String soldeTotal; + + public Entry getSelectedEntry() { + return selectedEntry; + } + + public void setSelectedEntry(Entry selectedEntry) { + Entry oldSelectedEntry = getSelectedEntry(); + this.selectedEntry = selectedEntry; + firePropertyChange(SELECTED_ENTRY_PROPERTY, oldSelectedEntry, selectedEntry); + } + + public boolean isLettrer() { + return lettrer; + } + + public void setLettrer(boolean lettrer) { + boolean oldLettrer = isLettrer(); + this.lettrer = lettrer; + firePropertyChange(LETTRER_PROPERTY, oldLettrer, lettrer); + } + + public boolean isDelettrer() { + return delettrer; + } + + public void setDelettrer(boolean delettrer) { + boolean oldLettrer = isLettrer(); + this.delettrer = delettrer; + firePropertyChange(LETTRER_PROPERTY, oldLettrer, delettrer); + } + + public LetteringModelUI(LetteringTableModel model) { + this.model = model; + } + + public String getDebit() { + if (debit == null){ + return "0"; + } + return String.valueOf(debit); + } + + public void setDebit(BigDecimal debit) { + BigDecimal oldDebit = BigDecimal.valueOf(Double.valueOf(getDebit())); + this.debit = debit; + firePropertyChange(DEBIT_PROPERTY, oldDebit, debit); + } + + public String getCredit() { + if (credit == null){ + return "0"; + } + return String.valueOf(credit); + } + + public void setCredit(BigDecimal credit) { + BigDecimal oldCredit = BigDecimal.valueOf(Double.valueOf(getCredit())); + this.credit = credit; + firePropertyChange(CREDIT_PROPERTY, oldCredit, credit); + } + + public String getSolde() { + if (solde == null){ + return "0"; + } + return solde; + } + + public void setSolde(String solde) { + String oldSolde = getSolde(); + this.solde = solde; + firePropertyChange(SOLDE_PROPERTY, oldSolde, solde); + } + + 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); + } + + @Override + public void setSelectionInterval(int row, int column) { + super.setSelectionInterval(row, column); + setSelectedEntry(model.getEntryAt(row)); + } + + @Override + public int getSelectionMode() { + return SINGLE_SELECTION; + } +} Deleted: trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringPeriodSearchPanel.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringPeriodSearchPanel.java 2012-07-02 15:44:23 UTC (rev 3484) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringPeriodSearchPanel.java 2012-07-03 11:54:09 UTC (rev 3485) @@ -1,160 +0,0 @@ -/* - * #%L - * Lima :: Swing - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2008 - 2011 CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ -package org.chorem.lima.ui.lettering; - -import org.apache.commons.lang3.time.DateUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.chorem.lima.entity.FinancialPeriod; -import org.chorem.lima.entity.FiscalPeriod; -import org.chorem.lima.enums.ComboBoxDatesEnum; -import org.chorem.lima.ui.LimaRendererUtil; -import org.chorem.lima.ui.combobox.FinancialPeriodComboBoxModel; -import org.chorem.lima.ui.combobox.FiscalPeriodComboBoxModel; -import org.jdesktop.swingx.JXDatePicker; - -import javax.swing.JComboBox; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.ListCellRenderer; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.util.Calendar; -import java.util.Date; - -import static org.nuiton.i18n.I18n._; - -public class LetteringPeriodSearchPanel extends JPanel { - - private static final Log log = - LogFactory.getLog(LetteringPeriodSearchPanel.class); - - protected LetteringViewHandler handler; - - public LetteringPeriodSearchPanel(LetteringViewHandler handler) { - this.handler = handler; - - //init date - refresh(ComboBoxDatesEnum.FISCAL_PERIOD); - } - - public void refresh(ComboBoxDatesEnum comboBoxPeriodEnum) { - - switch (comboBoxPeriodEnum) { - case PERIOD: - // get begin date - Calendar calendarBegin = Calendar.getInstance(); - // set begindate to JAN 1 - 0:00.000 of this years - Date beginDate = calendarBegin.getTime(); - beginDate = DateUtils.truncate(beginDate, Calendar.YEAR); - //handler().setBeginDate(beginDate); - - // get end date - Calendar calendarEnd = Calendar.getInstance(); - Date endDate = calendarEnd.getTime(); - //handler().setEndDate(endDate); - JLabel beginDateLabel = new JLabel(_("lima.common.begindate")); - final JXDatePicker beginDatePicker = new JXDatePicker(beginDate); - ActionListener beginDateActionListener = new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - handler.setBeginDate(beginDatePicker.getDate()); - handler.refresh(); - } - }; - handler.setBeginDate(beginDatePicker.getDate()); - beginDatePicker.addActionListener(beginDateActionListener); - - JLabel endDateLabel = new JLabel(_("lima.common.enddate")); - final JXDatePicker endDatePicker = new JXDatePicker(endDate); - ActionListener endDateActionListener = new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - handler.setEndDate(endDatePicker.getDate()); - handler.refresh(); - } - }; - handler.setEndDate(endDatePicker.getDate()); - endDatePicker.addActionListener(endDateActionListener); - handler.refresh(); - - removeAll(); - add(beginDateLabel); - add(beginDatePicker); - add(endDateLabel); - add(endDatePicker); - break; - - case FISCAL_PERIOD: - FiscalPeriodComboBoxModel fiscalModel = new FiscalPeriodComboBoxModel(true); - ListCellRenderer renderer = - LimaRendererUtil.newDecoratorListCellRenderer(FiscalPeriod.class); - final JComboBox fiscalPeriod = new JComboBox(fiscalModel); - fiscalPeriod.setRenderer(renderer); - fiscalPeriod.setEditable(false); - ActionListener fiscalPeriodActionListener = new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - FiscalPeriod fPeriod = (FiscalPeriod) fiscalPeriod.getSelectedItem(); - if (fPeriod != null) { - handler.setBeginDate(fPeriod.getBeginDate()); - handler.setEndDate(fPeriod.getEndDate()); - handler.refresh(); - } - } - }; - fiscalPeriod.addActionListener(fiscalPeriodActionListener); - - removeAll(); - add(fiscalPeriod); - break; - - case FINANCIAL_PERIOD: - FinancialPeriodComboBoxModel financialModel = new FinancialPeriodComboBoxModel(true); - renderer = - LimaRendererUtil.newDecoratorListCellRenderer(FinancialPeriod.class); - final JComboBox financialPeriod = new JComboBox(financialModel); - financialPeriod.setRenderer(renderer); - financialPeriod.setEditable(false); - ActionListener financialPeriodActionListener = new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - FinancialPeriod fPeriod = (FinancialPeriod) financialPeriod.getSelectedItem(); - if (fPeriod != null) { - handler.setBeginDate(fPeriod.getBeginDate()); - handler.setEndDate(fPeriod.getEndDate()); - handler.refresh(); - } - } - }; - financialPeriod.addActionListener(financialPeriodActionListener); - removeAll(); - add(financialPeriod); - break; - } - - } - -} Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTable.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTable.java 2012-07-02 15:44:23 UTC (rev 3484) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTable.java 2012-07-03 11:54:09 UTC (rev 3485) @@ -25,6 +25,13 @@ package org.chorem.lima.ui.lettering; +import java.awt.event.KeyEvent; +import java.awt.event.KeyListener; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.math.BigDecimal; +import java.util.Date; + import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.lima.entity.Account; @@ -35,21 +42,8 @@ import org.chorem.lima.ui.celleditor.DateTableCellEditor; import org.chorem.lima.ui.celleditor.EntryBookTableCellEditor; import org.jdesktop.swingx.JXTable; -import org.jdesktop.swingx.decorator.ColorHighlighter; -import org.jdesktop.swingx.decorator.ComponentAdapter; -import org.jdesktop.swingx.decorator.HighlightPredicate; -import org.jdesktop.swingx.decorator.Highlighter; -import java.awt.Color; -import java.awt.Component; -import java.awt.event.KeyEvent; -import java.awt.event.KeyListener; -import java.awt.event.MouseEvent; -import java.awt.event.MouseListener; -import java.math.BigDecimal; -import java.util.Date; - /** * Table des transaction qui ajoute des comportement (keys). * @@ -62,19 +56,20 @@ private static final long serialVersionUID = 3133690382049594727L; /** log. */ - private static final Log log = LogFactory - .getLog(LetteringTable.class); + private static final Log log = LogFactory.getLog(LetteringTable.class); protected LetteringViewHandler handler; - private Highlighter colorTransaction; + /*private Highlighter colorTransaction; - private ColorHighlighter colorBalance; + private ColorHighlighter colorBalance;*/ - public LetteringTable(LetteringViewHandler handler) { + protected LetteringTableModel letteringTableModel; + + public LetteringTable(LetteringTableModel letteringTableModel) { + super(letteringTableModel); + this.letteringTableModel = letteringTableModel; - this.handler = handler; - addKeyListener(this); addMouseListener(this); @@ -91,11 +86,9 @@ setDefaultRenderer(BigDecimal.class, new BigDecimalTableCellRenderer()); //highlight financial financial transactions - addColorTransaction(); + /*addColorTransaction(); // highlight unbalanced financial transactions - addColorNonBalancedTransaction(); - - + addColorNonBalancedTransaction();*/ } /** @@ -103,7 +96,7 @@ * afin de bien distinguer les transactions et entrées comptables. * On récupère la première cellule, on vérifie que c'est une date */ - protected void addColorTransaction() { + /*protected void addColorTransaction() { if (colorTransaction != null) { removeHighlighter(colorTransaction); } @@ -117,7 +110,7 @@ colorTransaction = new ColorHighlighter(predicate, new Color(222, 222, 222), null); addHighlighter(colorTransaction); - } + }*/ /** @@ -126,7 +119,7 @@ * On récupère la dernière cellule de la ligne * et on vérifie si la valeur est différente de 0 */ - protected void addColorNonBalancedTransaction() { + /* protected void addColorNonBalancedTransaction() { if (colorBalance != null) { removeHighlighter(colorBalance); } @@ -150,7 +143,7 @@ colorTransaction = new ColorHighlighter(predicate, new Color(255, 198, 209), null); addHighlighter(colorTransaction); - } + }*/ /** * for each action combination key are think Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTableModel.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTableModel.java 2012-07-02 15:44:23 UTC (rev 3484) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTableModel.java 2012-07-03 11:54:09 UTC (rev 3485) @@ -45,6 +45,7 @@ import org.chorem.lima.entity.Entry; import org.chorem.lima.entity.EntryBook; import org.chorem.lima.entity.FinancialTransaction; +import org.chorem.lima.entity.FiscalPeriod; import org.chorem.lima.service.LimaServiceFactory; /** @@ -66,8 +67,7 @@ private static final long serialVersionUID = 1L; /** log. */ - private static final Log log = LogFactory - .getLog(LetteringTableModel.class); + private static final Log log = LogFactory.getLog(LetteringTableModel.class); /** Transaction service. */ protected final FinancialTransactionService financialTransactionService; @@ -77,10 +77,11 @@ /** EndDate. */ protected Date selectedEndDate; + + protected List<Entry> entries; + protected List<Date> datesEntree; + protected List<String> entryBooks; - /** data cache */ - protected List<Object> cacheDataList; - /** * collection * <p/> @@ -98,7 +99,27 @@ LimaServiceFactory.addServiceListener(FinancialTransactionService.class,this); LimaServiceFactory.addServiceListener(ImportService.class, this); } - + + public List<Entry> getEntries(){ + return entries; + } + + public void updateEntries(List<Entry> entries,List<Date> datesEntree, List<String> entryBooks) { + + this.entries = entries; + setDate(datesEntree); + setJournal(entryBooks); + fireTableDataChanged(); + } + + protected void setDate(List<Date> datesEntree){ + this.datesEntree=datesEntree; + } + + protected void setJournal(List<String> entryBooks){ + this.entryBooks = entryBooks; + } + public void setSelectedBeginDate(Date date) { selectedBeginDate = date; } @@ -107,85 +128,33 @@ selectedEndDate = date; } - /** - * Le model est une combinaison de Transaction/Entries. - * - * @return - */ - protected List<Object> getDataList() { - List<Object> results = new ArrayList<Object>(); - if (selectedBeginDate != null && selectedEndDate != null) { - List<FinancialTransaction> financialtransactions = - financialTransactionService.getAllFinancialTransactions( - selectedBeginDate, selectedEndDate); - for (FinancialTransaction financialtransaction : financialtransactions) { - results.add(financialtransaction); - List<Entry> entries = (List<Entry>) financialtransaction.getEntry(); - Collections.sort(entries, new EntryComparator()); - results.addAll(entries); - } - } - return results; - } - - /*public void setLetter(int row, Letter letter) { - Object currentRow = cacheDataList.get(row); - if (currentRow instanceof Entry) { - Entry entry = (Entry) currentRow; - entry.setLetter(letter); - try { - financialTransactionService.updateEntry(entry); - } catch (LimaException eee) { - if (log.isDebugEnabled()) { - log.debug("Can't set letter", eee); - } - JFrame f = new JFrame(); - f.setIconImage(Resource.getIcon("icons/lima.png").getImage()); - JOptionPane.showMessageDialog( - f, - eee.getMessage(), - _("lima.common.error"), - JOptionPane.ERROR_MESSAGE); - f.dispose(); - } - } - }*/ - public void removeLetter(int row) { - /*try { - Object currentRow = cacheDataList.get(row); - if (currentRow instanceof Entry) { - Entry entry = (Entry) currentRow; - financialTransactionService.removeEntryLetter(entry); - } - } catch (LimaException eee) { - log.error("Can't remove letter", eee); - }*/ + //TODO } - public void refresh() { - cacheDataList = getDataList(); - fireTableDataChanged(); - } - @Override public int getColumnCount() { - return 9; + return 7; } + public Entry getEntryAt(int row) { + if (row == -1) { + return null; + } + Entry result = entries.get(row); + return result; + } + @Override public Class<?> getColumnClass(int column) { - Class<?> result = null; + Class<?> result = String.class; switch (column) { case 0: result = Date.class; break; case 1: - result = EntryBook.class; - break; - case 2: result = String.class; break; case 3: @@ -195,17 +164,11 @@ result = String.class; break; case 5: - result = String.class; + result = BigDecimal.class; break; case 6: result = BigDecimal.class; break; - case 7: - result = BigDecimal.class; - break; - case 8: - result = BigDecimal.class; - break; } return result; @@ -227,176 +190,116 @@ result = _("lima.table.voucher"); break; case 3: - result = _("lima.table.account"); - break; - case 4: result = _("lima.table.description"); break; - case 5: + case 4: result = _("lima.table.letter"); break; - case 6: + case 5: result = _("lima.table.debit"); break; - case 7: + case 6: result = _("lima.table.credit"); break; - case 8: - result = _("lima.table.balance"); - break; } return result; } @Override - public int getRowCount() { - int result = 0; - - if (cacheDataList != null) { - result = cacheDataList.size(); + public int getRowCount() { + if (entries != null){ + return entries.size(); } - - return result; + return 0; } @Override public Object getValueAt(int row, int column) { Object result = null; - // just prevent too much result - if (cacheDataList != null) { - result = cacheDataList.get(row); - - if (result instanceof FinancialTransaction) { - FinancialTransaction currentRow = (FinancialTransaction) result; - BigDecimal amountDebit = currentRow.getAmountDebit(); - BigDecimal amountCredit = currentRow.getAmountCredit(); - - switch (column) { - case 0: - result = currentRow.getTransactionDate(); - break; - case 1: - if (currentRow.getEntryBook() != null) { - result = currentRow.getEntryBook().getCode(); - } else { - result = null; - } - break; - case 2: - result = null; //voucher - break; - case 3: - result = null; // account - break; - case 4: - result = null; // description - break; - case 5: - result = null; // letter - break; - case 6: - result = amountDebit; - break; - case 7: - result = amountCredit; - break; - case 8: - result = amountDebit.subtract(amountCredit); - break; - } - } else if (result instanceof Entry) { - Entry currentEntry = (Entry) result; - switch (column) { - case 0: - result = null; // date - break; - case 1: // entry book - result = null; - break; - case 2: - result = currentEntry.getVoucher(); - break; - case 3: // account - if (currentEntry.getAccount() != null) { - result = currentEntry.getAccount().getAccountNumber(); - } else { - result = null; - } - break; - case 4: - result = currentEntry.getDescription(); - break; - case 5: - result = currentEntry.getLettering(); - break; - case 6: - result = currentEntry.getDebit() ? currentEntry.getAmount() : BigDecimal.ZERO; - break; - case 7: - result = currentEntry.getDebit() ? BigDecimal.ZERO : currentEntry.getAmount(); - break; - case 8: - result = null; - break; - } - + if (entries.size() > 0){ + Entry currentEntry = entries.get(row); + switch (column) { + case 0: + result = datesEntree.get(row); // date + break; + case 1: // entry book + result = entryBooks.get(row); + break; + case 2: + result = currentEntry.getVoucher(); + break; + case 3: + result = currentEntry.getDescription(); + break; + case 4: + result = currentEntry.getLettering(); + break; + case 5: + result = currentEntry.getDebit() ? currentEntry.getAmount() : BigDecimal.ZERO; + break; + case 6: + result = currentEntry.getDebit() ? BigDecimal.ZERO : currentEntry.getAmount(); + break; } } return result; } /** - * To set cells editable or not - * different condition for entry or financial transaction + * Only cell of "Letter" could be editable */ @Override public boolean isCellEditable(int rowIndex, int columnIndex) { - boolean editableCell = false; - Object currentRow = cacheDataList.get(rowIndex); - // cells editable for the entry row, all cells exclude the date - if (currentRow instanceof Entry && columnIndex == 5) { - editableCell = true; - } - return editableCell; + + return false; } public Object getElementAt(int row) { - Object result = null; - if (cacheDataList != null) { - result = cacheDataList.get(row); - } - return result; + return entries.get(row); } + + //add one entry + public void addEntry(Entry entry) { + entries.add(entry); + int row = entries.indexOf(entry); + fireTableRowsInserted(row, row); + } - + //add a list of Entry + public void addEntries(List<Entry> entries) { + for (Entry entry : entries){ + addEntry(entry); + } + } + /** to modifiy letter entry */ @Override public void setValueAt(Object value, int row, int column) { - int financialTransactionRow = 0; + //TODO + /*int financialTransactionRow = 0; if (cacheDataList != null) { Object currentRow = cacheDataList.get(row); if (currentRow instanceof Entry) { Entry currentEntry = (Entry) currentRow; switch (column) { - case 5: + case 4: currentEntry.setLettering((String) value); break; } - financialTransactionService.updateEntry(currentEntry); + financialTransactionService.updateEntry(currentEntry);*/ //update the financial transaction in entire - financialTransactionRow = + /*financialTransactionRow = getDataList().indexOf(((Entry) currentRow). - getFinancialTransaction()); - } + getFinancialTransaction());*/ + /* } //on recharge la liste - cacheDataList = getDataList(); fireTableRowsUpdated(financialTransactionRow, getRowCount() - 1); - } + }*/ } @Override @@ -404,7 +307,7 @@ if (serviceName.contains("FinancialTransaction") || methodeName.contains("importEntries") || methodeName.contains("importAll")) { - refresh(); + fireTableDataChanged(); } } Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringView.jaxx =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringView.jaxx 2012-07-02 15:44:23 UTC (rev 3484) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringView.jaxx 2012-07-03 11:54:09 UTC (rev 3485) @@ -26,57 +26,167 @@ <Table> <import> - javax.swing.ListSelectionModel + org.chorem.lima.ui.common.AccountComboBoxModel + org.chorem.lima.ui.common.FinancialPeriodComboBoxModel org.chorem.lima.entity.FiscalPeriod org.chorem.lima.entity.FinancialPeriod - org.chorem.lima.enums.ComboBoxDatesEnum + javax.swing.ListSelectionModel + org.jdesktop.swingx.JXDatePicker; </import> + + <LetteringViewHandler id="handler" constructorParams="this"/> + <LetteringTableModel id="tableModel"/> + <LetteringModelUI id='modelUi' constructorParams='tableModel'/> + + <!-- <Boolean id="selectedRow" javaBean="false"/> --> - <LetteringViewHandler id="handler" javaBean="new LetteringViewHandler(this)"/> - <Boolean id="selectedRow" javaBean="false"/> + <script> + <![CDATA[ + void $afterCompleteSetup() { + handler.init(); + } + ]]> + </script> - <row weightx="1" weighty="0" anchor="center"> - <cell fill='both'> - <Table> - <row> - <cell anchor="west"> - <JComboBox id="periodComboBox" - javaBean="new JComboBox(ComboBoxDatesEnum.descriptions())" - onActionPerformed="periodSearchPanel.refresh(ComboBoxDatesEnum.valueOfDescription((String) periodComboBox.getSelectedItem())); - validate(); repaint()"/> - </cell> - <cell> - <LetteringPeriodSearchPanel id='periodSearchPanel' - constructorParams='handler'/> - </cell> - </row> - </Table> + <row> + <cell anchor="center" weightx="1" columns="2"> + <JLabel text="lima.ui.lettering.account" labelFor='{panelAccountComboBox}'/> + </cell> + <cell anchor="center" weightx="1"> + <JLabel text="lima.ui.lettering.period" labelFor='{panelFinancialPeriodComboBox}'/> + </cell> + <cell anchor="center" weightx="1"> + <JLabel text="lima.ui.lettering.entry" labelFor='{entryPanel}'/> + </cell> + </row> + <row> + <cell anchor="center" weightx="1" columns="2"> + <JPanel id="panelAccountComboBox"> + <org.chorem.lima.ui.common.AccountComboBoxModel id="accountComboBoxModel"/> + <JComboBox id="accountComboBox" model="{accountComboBoxModel}" + renderer="{new org.chorem.lima.ui.common.AccountListRenderer()}" + onActionPerformed="handler.updateAllEntries(pickerDebut.getDate(), pickerFin.getDate(), accountComboBox.getSelectedItem(), letteredCheckGroup.getSelectedButton().getName())"/> + <JButton id="backCount" text="lima.ui.account.buttonback" + onActionPerformed="handler.back(accountComboBox)"/> + <JButton id="nextCount" text="lima.ui.account.buttonnext" + onActionPerformed="handler.next(accountComboBox)"/> + </JPanel> + </cell> + <cell anchor="center" weightx="1"> + <JPanel id="panelFinancialPeriodComboBox"> + <Table> + <row> + <cell> + <JLabel text="lima.ui.lettering.beginFinancialPeriod"/> + </cell> + <cell> + <JXDatePicker id="pickerDebut" + onActionPerformed="handler.updateAllEntries(pickerDebut.getDate(), pickerFin.getDate(), accountComboBox.getSelectedItem(), letteredCheckGroup.getSelectedButton().getName())"/> + </cell> + </row> + <row> + <cell> + <JLabel text="lima.ui.lettering.endFinancialPeriod"/> + </cell> + <cell> + <JXDatePicker id="pickerFin" + onActionPerformed="handler.updateAllEntries(pickerDebut.getDate(), pickerFin.getDate(), accountComboBox.getSelectedItem(), letteredCheckGroup.getSelectedButton().getName())"/> + </cell> + </row> + </Table> + </JPanel> + </cell> + <cell anchor="center" weightx="1"> + <JPanel id="entryPanel"> + <Table> + <row> + <cell> + <JRadioButton id="lettredEntryCheckBox" buttonGroup="letteredCheckGroup" + onActionPerformed="handler.updateAllEntries(pickerDebut.getDate(), pickerFin.getDate(), accountComboBox.getSelectedItem(), letteredCheckGroup.getSelectedButton().getName())"/> + </cell> + <cell> + <JLabel text="lima.ui.lettering.checkLettredEntry"/> + </cell> + </row> + <row> + <cell> + <JRadioButton id="noLettredEntryCheckBox" selected="true" buttonGroup="letteredCheckGroup" + onActionPerformed="handler.updateAllEntries(pickerDebut.getDate(), pickerFin.getDate(), accountComboBox.getSelectedItem(), letteredCheckGroup.getSelectedButton().getName())"/> + </cell> + <cell> + <JLabel text="lima.ui.lettering.checkNoLettredEntry"/> + </cell> + </row> + <row> + <cell> + <JRadioButton id="allCheckBox" buttonGroup="letteredCheckGroup" + onActionPerformed="handler.updateAllEntries(pickerDebut.getDate(), pickerFin.getDate(), accountComboBox.getSelectedItem(), letteredCheckGroup.getSelectedButton().getName())"/> + </cell> + <cell> + <JLabel text="lima.ui.lettering.checkAll"/> + </cell> + </row> + </Table> + </JPanel> + </cell> + </row> + <row> + <cell anchor="center" weightx="0.25"> + <JLabel/> </cell> - <cell> - <JButton text="lima.entries.lettering.add" - onActionPerformed="handler.addLetter()" - toolTipText="lima.tooltip.lettering" - enabled="{isSelectedRow()}"/> + <cell anchor="center" weightx="0.25"> + <JLabel text="lima.ui.lettering.selectDebit" labelFor='{debitTexttField}'/> </cell> - <cell> - <JButton text="lima.entries.lettering.remove" - onActionPerformed="handler.removeLetter()" - enabled="{isSelectedRow()}"/> + <cell anchor="center" weightx="0.25"> + <JLabel text="lima.ui.lettering.selectCredit" labelFor='{creditTextField}'/> </cell> - + <cell anchor="center" weightx="0.25"> + <JLabel text="lima.ui.lettering.selectSolde" labelFor='{soldeTextField}'/> + </cell> + </row> + <row> + <cell anchor='center' weightx="0.25"> + <JLabel text="lima.ui.lettering.selectEntry"/> + </cell> + <cell fill="horizontal" weightx="0.25"> + <JTextField id="debitTexttField" editable="false" text="{getModelUi().getDebit()}" + focusable="false"/> + </cell> + <cell fill="horizontal" weightx="0.25"> + <JTextField id="creditTextField" editable="false" text="{getModelUi().getCredit()}" + focusable="false"/> + </cell> + <cell fill="horizontal" weightx="0.25"> + <JTextField id="soldeTextField" editable="false" text="{getModelUi().getSolde()}" + focusable="false"/> + </cell> + </row> + <row> + <cell anchor="center" columns='4'> + <JLabel text="lima.ui.lettering.actions" labelFor='{actionsPanel}'/> + </cell> </row> <row> - <cell fill="both" weightx="1" weighty="1" rows="3" columns="11"> - <JScrollPane> - <LetteringTableModel - id="tableModel"/> - <LetteringTable - id="table" sortable="false" rowHeight="22" - constructorParams="getHandler()" model="{getTableModel()}" - selectionMode="{ListSelectionModel.MULTIPLE_INTERVAL_SELECTION }"/> - <ListSelectionModel javaBean="getTable().getSelectionModel()" - onValueChanged="setSelectedRow(table.getSelectedRow() != -1)"/> - </JScrollPane> - </cell> + <cell anchor="center" columns='4'> + <JPanel id="actionsPanel"> + <JButton id="lettered" text="lima.ui.lettering.buttonLettered" + enabled="{getModelUi().isLettrer()}" + onActionPerformed="handler.lettrer()"/> + <JButton id="noLettered" text="lima.ui.lettering.buttonNoLettered" + enabled="{getModelUi().isDelettrer()}" + onActionPerformed="handler.delettrer()"/> + </JPanel> + </cell> </row> + <row> + <cell fill="both" weightx="1" weighty="1" columns="4"> + <JScrollPane> + <LetteringTable + id="table" sortable="false" rowHeight="22" + constructorParams="getTableModel()" + selectionModel="{modelUi}" + /> + </JScrollPane> + </cell> + </row> </Table> \ No newline at end of file Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java 2012-07-02 15:44:23 UTC (rev 3484) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java 2012-07-03 11:54:09 UTC (rev 3485) @@ -25,16 +25,33 @@ package org.chorem.lima.ui.lettering; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Calendar; import java.util.Date; +import java.util.List; +import javax.swing.JComboBox; + +import org.apache.commons.lang3.time.DateUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.chorem.lima.business.ServiceListener; +import org.chorem.lima.business.api.AccountService; +import org.chorem.lima.business.api.EntryBookService; +import org.chorem.lima.business.api.FinancialPeriodService; import org.chorem.lima.business.api.FinancialTransactionService; +import org.chorem.lima.business.api.FiscalPeriodService; +import org.chorem.lima.entity.Account; +import org.chorem.lima.entity.Entry; +import org.chorem.lima.entity.FinancialTransaction; +import org.chorem.lima.entity.FiscalPeriod; import org.chorem.lima.service.LimaServiceFactory; import org.chorem.lima.ui.combobox.FinancialPeriodComboBoxModel; import org.chorem.lima.ui.combobox.FiscalPeriodComboBoxModel; - /** * Handler associated with financial transaction view. * @@ -44,7 +61,7 @@ * Last update : $Date$ * By : $Author$ */ -public class LetteringViewHandler { +public class LetteringViewHandler implements ServiceListener{ /** log. */ private static final Log log = @@ -61,25 +78,210 @@ protected FinancialPeriodComboBoxModel financialPeriodComboBoxModel; /** Transaction service. */ - protected final FinancialTransactionService financialTransactionService; + protected FiscalPeriodService fiscalPeriodService; + protected FinancialPeriodService financialPeriodService; + protected AccountService accountService; + protected FinancialTransactionService financialTransactionService; + protected EntryBookService entryBookService; protected Object clipBoard; - protected LetteringViewHandler(LetteringView view) { + public LetteringViewHandler(LetteringView view) { this.view = view; - - /* Services */ + + financialPeriodService = LimaServiceFactory.getService(FinancialPeriodService.class); + fiscalPeriodService = LimaServiceFactory.getService(FiscalPeriodService.class); + accountService = LimaServiceFactory.getService(AccountService.class); financialTransactionService = LimaServiceFactory.getService(FinancialTransactionService.class); + entryBookService = LimaServiceFactory.getService(EntryBookService.class); + } + + /** + * Init all combo box in view. + */ + public void init() { + loadComboAndRows(); + LetteringModelUI modelUi = view.getModelUi(); + modelUi.addPropertyChangeListener(LetteringModelUI.SELECTED_ENTRY_PROPERTY, new PropertyChangeListener() { + @Override + public void propertyChange(PropertyChangeEvent evt) { + LetteringModelUI modelUiPropChange = (LetteringModelUI)evt.getSource(); + Entry selectedEntry = (Entry)evt.getNewValue(); + loadCurrentSelection(modelUiPropChange, selectedEntry); + } + }); + } + + public void loadComboAndRows(){ + log.debug("loadComboAndRows"); + + List<Account> allAccounts = accountService.getAllAccounts(); + view.getAccountComboBoxModel().setObjects(allAccounts); + + log.debug("loadComboAndRows"); + + if (!allAccounts.isEmpty()) { + + view.getAccountComboBox().setSelectedItem(allAccounts.get(0)); + } + + if (log.isDebugEnabled()) { + log.debug("1er item comptes : " + allAccounts.get(0)); + } + + //By default, we have the beginning of the fiscal period (Or of current + //date if no fiscal period) and the end of the current date + FiscalPeriod fiscalPeriod = fiscalPeriodService.getLastFiscalPeriod(); + Date defaultDateBegFiscalPeriod; + + Calendar calendar = Calendar.getInstance(); + int dernierJourMoisCourant = calendar.getActualMaximum(Calendar.DATE); + int premierJourMoisCourant = calendar.getActualMinimum(Calendar.DATE); + + if (fiscalPeriod != null){ + defaultDateBegFiscalPeriod = fiscalPeriodService.getLastFiscalPeriod().getBeginDate(); + }else{ + defaultDateBegFiscalPeriod = DateUtils.setDays(new Date(), premierJourMoisCourant); + } + + Date defaultDateEndCurrent = DateUtils.setDays(new Date(), dernierJourMoisCourant); + + if (log.isDebugEnabled()) { + log.debug("Date de debut : " + defaultDateBegFiscalPeriod); + log.debug("Date de fin : " + defaultDateEndCurrent); + } + + view.getPickerDebut().setDate(defaultDateBegFiscalPeriod); + view.getPickerFin().setDate(defaultDateEndCurrent); + + log.debug("Val select letter : " + view.getLetteredCheckGroup().getSelectedButton().getName()); + + //Load entry with the default dates, default account 4 and with no letter + updateAllEntries(defaultDateBegFiscalPeriod, defaultDateEndCurrent, view.getAccountComboBoxModel().getSelectedItem(), view.getLetteredCheckGroup().getSelectedButton().getName()); + } + + protected List<Entry> findAllEntries(Date selectedBeginDate, Date selectedEndDate, Object compte, String filtreLettre){ + + List<Entry> entries = new ArrayList<Entry>(); + List<Entry> entriesAccount = new ArrayList<Entry>(); + if (selectedBeginDate != null && selectedEndDate != null) { + List<FinancialTransaction> financialtransactions = + financialTransactionService.getAllFinancialTransactions(selectedBeginDate, selectedEndDate); + for (FinancialTransaction financialtransaction : financialtransactions) { + entries = (List<Entry>) financialtransaction.getEntry(); + } + if (compte != null){ + for(Entry entry : entries){ + log.debug("entry.getLettering() : " + entry.getLettering()); + log.debug("name radioButton : " + filtreLettre); + //0 for lettered, 1 for no-lettered and 2 for all entries + if (compte.equals(entry.getAccount()) && ( (filtreLettre.equals("noLettredEntryCheckBox") & entry.getLettering() == null)) + || (filtreLettre.equals("lettredEntryCheckBox") & entry.getLettering() != null) || filtreLettre.equals("allCheckBox")){ + entriesAccount.add(entry); + } + } + log.debug("entriesAccount size : " + entriesAccount.size()); + return entriesAccount; + } + } + return entries; + } + + public void updateAllEntries(Date selectedBeginDate, Date selectedEndDate, Object compte, String filtreLettre) { + + if (selectedBeginDate != null && selectedEndDate != null){ + log.debug("updateAllEntries"); + List<Entry> entries = findAllEntries(selectedBeginDate, selectedEndDate, compte, filtreLettre); + List<String> journalEntrees = new ArrayList<String>(); + List<Date> datesEntree = new ArrayList<Date>(); + + for (Entry entry : entries){ + datesEntree.add(entry.getFinancialTransaction().getTransactionDate()); + journalEntrees.add(entry.getFinancialTransaction().getEntryBook().getLabel()); + } + + view.getTableModel().updateEntries(entries, datesEntree, journalEntrees); + } + } + + public void loadCurrentSelection(LetteringModelUI modelUi, Entry selectedEntry){ + financialTransactionService = LimaServiceFactory.getService(FinancialTransactionService.class); + + boolean enableLettring = false; + boolean enableDelettring = false; + + if (selectedEntry != null){ + modelUi.setDebit(selectedEntry.getDebit() ? selectedEntry.getAmount() : BigDecimal.ZERO); + modelUi.setCredit(selectedEntry.getDebit() ? BigDecimal.ZERO : selectedEntry.getAmount()); + + if (modelUi.getDebit().equals("0")){ + modelUi.setSolde(modelUi.getCredit()); + }else{ + modelUi.setSolde(modelUi.getDebit()); + } + modelUi.setSolde(modelUi.getSolde()); + if (selectedEntry.getLettering() != null && ! selectedEntry.getLettering().isEmpty()){ + enableDelettring = true; + }else{ + enableLettring = true; + } + } + modelUi.setLettrer(enableLettring); + modelUi.setDelettrer(enableDelettring); + } + + /**Add a group of three letters to n entries*/ + public void lettrer(){ + + + int[] entrieSelected = view.getTable().getSelectedRows(); + for (int rowEntry : entrieSelected){ + view.getTableModel().getEntryAt(rowEntry); + + } + + //String lastActualLetters = fiscalPeriodService.findLastActualLetters(); + } + + /**Remove a group of three letters to n entries*/ + public void delettrer(List<Entry> entries){ + + } + + /** + * Select previous value in combo box. + * + * @param comboBox combo box + */ + public void back(JComboBox comboBox) { + int row = comboBox.getSelectedIndex(); + if (row > 0) { + comboBox.setSelectedIndex(row - 1); + } + } + + /** + * Select next value in combo box. + * + * @param comboBox combo box + */ + public void next(JComboBox comboBox) { + int size = comboBox.getModel().getSize(); + int row = comboBox.getSelectedIndex(); + + if (row < size - 1) { + comboBox.setSelectedIndex(row + 1); + } + } + public void setBeginDate(Date date) { - tableModel = view.getTableModel(); - tableModel.setSelectedBeginDate(date); + view.getTableModel().setSelectedBeginDate(date); } public void setEndDate(Date date) { - tableModel = view.getTableModel(); - tableModel.setSelectedEndDate(date); + view.getTableModel().setSelectedEndDate(date); } public void addLetter() { @@ -126,20 +328,16 @@ } public void removeLetter() { - - table = view.getTable(); - tableModel = view.getTableModel(); - + //TODO //removeLetters - int[] rows = table.getSelectedRows(); + /*int[] rows = table.getSelectedRows(); for (int i : rows) { - tableModel.removeLetter(i); + view.getTableModel().removeLetter(i); } - tableModel.refresh(); + view.getTableModel().updateRows();*/ } - - public void refresh() { - tableModel = view.getTableModel(); - tableModel.refresh(); + + @Override + public void notifyMethod(String serviceName, String methodeName) { } } 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 2012-07-02 15:44:23 UTC (rev 3484) +++ trunk/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties 2012-07-03 11:54:09 UTC (rev 3485) @@ -196,6 +196,7 @@ lima.table.solde=Solder lima.table.solde.credit=Credit solde lima.table.solde.debit=Debit solde +lima.table.sum=Sums lima.table.voucher=Voucher lima.title.about=About Lima... lima.title.about.description=Open sources accounting software @@ -204,6 +205,8 @@ lima.ui.account.addaccount= lima.ui.account.addaccounttitle= lima.ui.account.base= +lima.ui.account.buttonback=← +lima.ui.account.buttonnext=→ lima.ui.account.developed= lima.ui.account.importtitle= lima.ui.account.label= @@ -255,6 +258,8 @@ lima.ui.financialtransaction.titleremoveentry= lima.ui.financialtransaction.titleremovetransaction= lima.ui.financialtransaction.voucher= +lima.ui.fiscalPeriod.buttonback= +lima.ui.fiscalPeriod.buttonnext= lima.ui.fiscalperiod.addfiscalperiod.morethan12= lima.ui.fiscalperiod.addfiscalperiodtitle= lima.ui.fiscalperiod.block.addretainedearnings= @@ -262,6 +267,8 @@ lima.ui.fiscalperiod.block.newyear= lima.ui.fiscalperiod.block.retainedearningstitle= lima.ui.fiscalperiod.block.title= +lima.ui.fiscalperiod.buttonback=← +lima.ui.fiscalperiod.buttonnext=→ lima.ui.fiscalperiod.closed= lima.ui.fiscalperiod.closure= lima.ui.fiscalperiod.delete.confirmation= @@ -314,6 +321,22 @@ lima.ui.importexport.vatstatements=VAT chart lima.ui.importexport.wait=Job in progress… lima.ui.importexport.waittitle= +lima.ui.lettering.account=Accounts +lima.ui.lettering.actions=Actions +lima.ui.lettering.beginFinancialPeriod=From +lima.ui.lettering.buttonAuto=Auto +lima.ui.lettering.buttonLettered=To Letter +lima.ui.lettering.buttonNoLettered=To Unletter +lima.ui.lettering.checkAll=All +lima.ui.lettering.checkLettredEntry=Lettered +lima.ui.lettering.checkNoLettredEntry=Unlettered +lima.ui.lettering.endFinancialPeriod=To +lima.ui.lettering.entry=Entries +lima.ui.lettering.period=Periods +lima.ui.lettering.selectCredit= +lima.ui.lettering.selectDebit= +lima.ui.lettering.selectEntry=Actual selection +lima.ui.lettering.selectSolde=Balance lima.ui.mainview.title=Lutin Invoice Monitoring and Accounting lima.ui.opening.accounts=<html><center>Select a default, <br/>import your personnal<br/> or cancel to create your own account chart.</center></html> lima.ui.opening.close= 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 2012-07-02 15:44:23 UTC (rev 3484) +++ trunk/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties 2012-07-03 11:54:09 UTC (rev 3485) @@ -178,7 +178,7 @@ lima.structure=Structure lima.tab.home=Accueil lima.table.account=Compte -lima.table.balance=Balance +lima.table.balance=Solde lima.table.credit=Crédit lima.table.date=Date lima.table.debit=Débit @@ -196,6 +196,7 @@ lima.table.solde=Solde lima.table.solde.credit=Solde crédit lima.table.solde.debit=Solde débit +lima.table.sum=Totaux lima.table.voucher=Pièce comptable lima.title.about=À propos de Lima... lima.title.about.description=Logiciel de comptabilité Libre @@ -204,6 +205,8 @@ lima.ui.account.addaccount=Nouveau compte lima.ui.account.addaccounttitle=Ajout d'un compte lima.ui.account.base=Plan comptable de base +lima.ui.account.buttonback=← +lima.ui.account.buttonnext=→ lima.ui.account.developed=Plan comptable développé lima.ui.account.importtitle=Importer lima.ui.account.label=Libellé @@ -255,6 +258,8 @@ lima.ui.financialtransaction.titleremoveentry=Suppression lima.ui.financialtransaction.titleremovetransaction=Suppression lima.ui.financialtransaction.voucher=Pièce comptable +lima.ui.fiscalPeriod.buttonback= +lima.ui.fiscalPeriod.buttonnext= lima.ui.fiscalperiod.addfiscalperiod.morethan12=La période sélectionnée n'est pas de 12 mois, voulez-vous continuer ? lima.ui.fiscalperiod.addfiscalperiodtitle=Nouvel exercice lima.ui.fiscalperiod.block.addretainedearnings=Reporter à nouveau? @@ -262,6 +267,8 @@ lima.ui.fiscalperiod.block.newyear=Voulez vous créer un nouvel exercice? lima.ui.fiscalperiod.block.retainedearningstitle=Report à nouveau lima.ui.fiscalperiod.block.title=Cloture de l'exercice +lima.ui.fiscalperiod.buttonback=← +lima.ui.fiscalperiod.buttonnext=→ lima.ui.fiscalperiod.closed=Cloturé lima.ui.fiscalperiod.closure=Cloture lima.ui.fiscalperiod.delete.confirmation=Ètes vous sûre de vouloir supprimer cette période ? Cette action est irréversible \! @@ -314,6 +321,22 @@ lima.ui.importexport.vatstatements=Plan TVA lima.ui.importexport.wait=Traitement en cours… lima.ui.importexport.waittitle=Traitement en cours +lima.ui.lettering.account=Comptes +lima.ui.lettering.actions=Actions +lima.ui.lettering.beginFinancialPeriod=De +lima.ui.lettering.buttonAuto=Auto +lima.ui.lettering.buttonLettered=Lettrer +lima.ui.lettering.buttonNoLettered=Délettrer +lima.ui.lettering.checkAll=Toutes +lima.ui.lettering.checkLettredEntry=Lettrées +lima.ui.lettering.checkNoLettredEntry=Non-lettrées +lima.ui.lettering.endFinancialPeriod=A +lima.ui.lettering.entry=Ecritures +lima.ui.lettering.period=Périodes +lima.ui.lettering.selectCredit=Crédit +lima.ui.lettering.selectDebit=Débit +lima.ui.lettering.selectEntry=Sélection courante +lima.ui.lettering.selectSolde=Solde lima.ui.mainview.title=Lutin Invoice Monitoring and Accounting lima.ui.opening.accounts=<html><center>Veuillez sélectionner un plan par défault, <br/>importer un plan personnalisé<br/> ou annuler pour créer votre propre plan.</center></html> lima.ui.opening.close=Fermer Modified: trunk/lima-swing/src/main/resources/log4j.properties =================================================================== --- trunk/lima-swing/src/main/resources/log4j.properties 2012-07-02 15:44:23 UTC (rev 3484) +++ trunk/lima-swing/src/main/resources/log4j.properties 2012-07-03 11:54:09 UTC (rev 3485) @@ -41,4 +41,6 @@ log4j.logger.org.chorem.lima.business.ejb=DEBUG log4j.logger.org.chorem.lima.ui.account=DEBUG log4j.logger.org.chorem.lima.ui.home=DEBUG -log4j.logger.org.chorem.lima.business.accountingrules.DefaultAccountingRules=DEBUG \ No newline at end of file +log4j.logger.org.chorem.lima.business.accountingrules.DefaultAccountingRules=DEBUG +log4j.logger.org.chorem.lima.ui.lettering.LetteringViewHandler=DEBUG +log4j.logger.org.chorem.lima.ui.lettering.LetteringTableModel=DEBUG \ No newline at end of file
participants (1)
-
mallon@users.chorem.org