Author: echatellier Date: 2012-04-12 18:37:45 +0200 (Thu, 12 Apr 2012) New Revision: 3365 Url: http://chorem.org/repositories/revision/lima/3365 Log: Remove Letter entity and VatStatement#amount from model Removed: trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/LetterTableCellEditor.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/LetterComboBoxModel.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/LetterSearchComboBox.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetterComboBox.java trunk/lima-swing/src/main/java/org/chorem/lima/util/LetterToString.java Modified: trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/FinancialTransactionService.java trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ExportServiceImpl.java trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ReportServiceImpl.java trunk/lima-business/src/main/java/org/chorem/lima/business/migration/MigrationV0_6.java trunk/lima-callao/src/main/xmi/accounting.zargo trunk/lima-swing/src/main/java/org/chorem/lima/ui/LimaDecoratorProvider.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsTableModel.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsTableModel.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTableModel.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchTableModel.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchViewHandler.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/LetterSearchPanel.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTableModel.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/AddLetterForm.jaxx trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/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/LetteringViewHandler.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartViewHandler.java Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ExportServiceImpl.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ExportServiceImpl.java 2012-04-12 14:24:21 UTC (rev 3364) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ExportServiceImpl.java 2012-04-12 16:37:45 UTC (rev 3365) @@ -545,7 +545,7 @@ nextLine[2] = entry.getDescription(); nextLine[3] = entry.getAmount().toString(); nextLine[4] = Boolean.toString(entry.getDebit()); - nextLine[5] = entry.getLetter().getCode(); + nextLine[5] = entry.getLettering(); nextLine[6] = entry.getDetail(); nextLine[7] = entry.getVoucher(); nextLine[8] = entry.getPosition(); 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-04-12 14:24:21 UTC (rev 3364) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java 2012-04-12 16:37:45 UTC (rev 3365) @@ -25,6 +25,16 @@ package org.chorem.lima.business.ejb; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.ejb.EJB; +import javax.ejb.Local; +import javax.ejb.Remote; +import javax.ejb.Stateless; + import org.chorem.lima.FinancialStatementWayEnum; import org.chorem.lima.beans.FinancialTransactionSearch; import org.chorem.lima.business.AccountingRules; @@ -46,24 +56,12 @@ import org.chorem.lima.entity.FinancialTransaction; import org.chorem.lima.entity.FinancialTransactionDAO; import org.chorem.lima.entity.FiscalPeriod; -import org.chorem.lima.entity.Letter; -import org.chorem.lima.entity.LetterDAO; -import org.chorem.lima.entity.LetterImpl; import org.chorem.lima.entity.LimaCallaoDAOHelper; import org.nuiton.topia.TopiaContext; import org.nuiton.topia.TopiaException; import org.nuiton.topia.framework.TopiaQuery; import org.nuiton.topia.framework.TopiaQuery.Op; -import javax.ejb.EJB; -import javax.ejb.Local; -import javax.ejb.Remote; -import javax.ejb.Stateless; -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - /** * Cette classe permet la création d'une transaction comptable dans l'application. * Toute action sur une transaction entraîne automatiquement une création de log. @@ -168,8 +166,7 @@ .addLoad(financialPeriodProperty) .addLoad(entryBookLabelProperty) .addLeftJoin("T." + FinancialTransaction.PROPERTY_ENTRY, "E", true) - .addFetch("E." + Entry.PROPERTY_ACCOUNT) - .addFetch("E." + Entry.PROPERTY_LETTER); + .addFetch("E." + Entry.PROPERTY_ACCOUNT); financialTransactions = transactionDAO.findAllByQuery(query); } catch (Exception ex) { doCatch(topiaTransaction, ex); @@ -209,8 +206,7 @@ .addLoad(financialPeriodProperty) .addLoad(entryBookLabelProperty) .addLeftJoin("T." + FinancialTransaction.PROPERTY_ENTRY, "E", true) - .addFetch("E." + Entry.PROPERTY_ACCOUNT) - .addFetch("E." + Entry.PROPERTY_LETTER); + .addFetch("E." + Entry.PROPERTY_ACCOUNT); financialTransactions = transactionDAO.findAllByQuery(query); } catch (Exception ex) { doCatch(topiaTransaction, ex); @@ -258,7 +254,6 @@ .addEquals("F", fiscalPeriod) // load lazy .addFetch("E." + Entry.PROPERTY_ACCOUNT) - .addFetch("E." + Entry.PROPERTY_LETTER) .addLoad(financialPeriodProperty) .addLoad(entryBookLabelProperty); @@ -505,7 +500,7 @@ entryOld.setVoucher(entry.getVoucher()); entryOld.setFinancialTransaction(entry.getFinancialTransaction()); entryOld.setPosition(entry.getPosition()); - entryOld.setLetter(entry.getLetter()); + entryOld.setLettering(entry.getLettering()); //update entry entryDAO.update(entryOld); @@ -542,139 +537,7 @@ } } - /** - * Get letter from count of existing letter - * 1 -> A, 2 -> B, 26 -> Z, 27 -> AA, 28 -> AB, ... - */ @Override - public Letter getNewLetter() throws LimaException { - Letter letter = new LetterImpl(); - TopiaContext topiaContext = beginTransaction(rootContext); - try { - LetterDAO letterDAO = LimaCallaoDAOHelper.getLetterDAO(topiaContext); - long n = letterDAO.count(); - String res = numberToString(n, null); - - //if already exist - while (letterDAO.findByCode(res) != null) { - res = numberToString(n++, null); - } - letter.setCode(res); - } catch (Exception ex) { - doCatch(topiaContext, ex); - } finally { - doFinally(topiaContext); - } - return letter; - } - - public String numberToString(long n, StringBuffer result) { - if (result == null) { - result = new StringBuffer(); - } - long mod = (n - 1) % 26; - long div = (n - 1) / 26; - if (div > 0) { - result.append(numberToString(div, result)); - } - return result.append((char) (mod + 65)).toString(); - } - - @Override - public void createLetter(Letter letter) throws LimaException { - TopiaContext topiaContext = beginTransaction(rootContext); - try { - createLetterWithTransaction(letter, topiaContext); - } catch (Exception ex) { - doCatch(topiaContext, ex); - } finally { - doFinally(topiaContext); - } - } - - public void createLetterWithTransaction(Letter letter, - TopiaContext topiaContext) throws LimaException { - try { - LetterDAO letterDAO = LimaCallaoDAOHelper.getLetterDAO(topiaContext); - letterDAO.create(letter); - commitTransaction(topiaContext); - } catch (TopiaException ex) { - doCatch(topiaContext, ex); - } - } - - @Override - public void removeLetter(Letter letter) throws LimaException { - TopiaContext topiaContext = beginTransaction(rootContext); - try { - LetterDAO letterDAO = LimaCallaoDAOHelper.getLetterDAO(topiaContext); - letterDAO.delete(letter); - commitTransaction(topiaContext); - } catch (Exception ex) { - doCatch(topiaContext, ex); - } finally { - doFinally(topiaContext); - } - } - - - @Override - public List<Letter> getAllLetters() throws LimaException { - List<Letter> letters = null; - TopiaContext topiaContext = beginTransaction(rootContext); - try { - LetterDAO letterDAO = LimaCallaoDAOHelper.getLetterDAO(topiaContext); - letters = letterDAO.findAll(); - } catch (Exception ex) { - doCatch(topiaContext, ex); - } finally { - doFinally(topiaContext); - } - return letters; - } - - - @Override - public void setEntryLetter(Entry entry, - Letter letter) throws LimaException { - - TopiaContext topiaContext = beginTransaction(rootContext); - try { - LetterDAO letterDAO = LimaCallaoDAOHelper.getLetterDAO(topiaContext); - Letter letterOld = letterDAO.findByCode(letter.getCode()); - if (letterOld == null) { - createLetterWithTransaction(letter, topiaContext); - letterOld = letter; - } - EntryDAO entryDAO = LimaCallaoDAOHelper.getEntryDAO(topiaContext); - Entry entryOld = entryDAO.findByTopiaId(entry.getTopiaId()); - entryOld.setLetter(letterOld); - commitTransaction(topiaContext); - } catch (Exception ex) { - doCatch(topiaContext, ex); - } finally { - doFinally(topiaContext); - } - } - - @Override - public void removeEntryLetter(Entry entry) throws LimaException { - - TopiaContext topiaContext = beginTransaction(rootContext); - try { - - EntryDAO entryDAO = LimaCallaoDAOHelper.getEntryDAO(topiaContext); - Entry entryOld = entryDAO.findByTopiaId(entry.getTopiaId()); - entryOld.setLetter(null); - commitTransaction(topiaContext); - } catch (Exception ex) { - doCatch(topiaContext, ex); - } finally { - doFinally(topiaContext); - } - } - - @Override public List<Object> searchFinancialTransaction(FinancialTransactionSearch financialTransactionSearch) throws LimaException { List<Object> result = new ArrayList<Object>(); List<FinancialTransaction> financialTransactions; @@ -708,9 +571,9 @@ if (description != null) { query.addWhere("E.description", Op.LIKE, "%" + description + "%"); } - Letter letter = financialTransactionSearch.getLetter(); + String letter = financialTransactionSearch.getLettering(); if (letter != null) { - query.addEquals("E.letter", letter); + query.addEquals("E.lettering", letter); } Account account = financialTransactionSearch.getAccount(); String accountsList = financialTransactionSearch.getAccountList(); @@ -766,8 +629,6 @@ TopiaQuery query2 = entryDAO.createQuery(); query2.addEquals(Entry.PROPERTY_FINANCIAL_TRANSACTION, financialTransaction); - //Load for lazy - query2.addLoad(Entry.PROPERTY_ACCOUNT, Entry.PROPERTY_LETTER); List<Entry> entries = entryDAO.findAllByQuery(query2); result.addAll(entries); } Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java 2012-04-12 14:24:21 UTC (rev 3364) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java 2012-04-12 16:37:45 UTC (rev 3365) @@ -93,9 +93,6 @@ import org.chorem.lima.entity.FiscalPeriodImpl; import org.chorem.lima.entity.Identity; import org.chorem.lima.entity.IdentityImpl; -import org.chorem.lima.entity.Letter; -import org.chorem.lima.entity.LetterDAO; -import org.chorem.lima.entity.LetterImpl; import org.chorem.lima.entity.LimaCallaoDAOHelper; import org.chorem.lima.entity.VatStatement; import org.chorem.lima.entity.VatStatementDAO; @@ -263,9 +260,7 @@ entry.setDescription(entryEBP.getLibelle()); entry.setVoucher(entryEBP.getPiece()); - Letter letter = createLetter( - entryEBP.getLettre(), topiaContext); - entry.setLetter(letter); + entry.setLettering(entryEBP.getLettre()); String entryBookCode = entryEBP.getJournal(); EntryBook entryBook = entryBookDAO @@ -767,41 +762,7 @@ return result.toString(); } - /** - * Import and create Letter : TYPE | Code - * - * @param nextLine - * @param topiaContext - * @return - * @throws LimaException - */ - protected String importLetterCSV(String[] nextLine, - TopiaContext topiaContext) throws LimaException { - StringBuilder result = new StringBuilder(); - try { - - LetterDAO letterDAO = LimaCallaoDAOHelper.getLetterDAO(topiaContext); - - Letter letter = new LetterImpl(); - String code = nextLine[1]; - letter.setCode(code); - - // if exist, skip - if (letterDAO.findByCode(code) != null) { - result.append(_("lima-business.import.letteralreadyexist", code)); - } else { - // create it - financialTransactionService.createLetter(letter); - result.append(_("lima-business.import.letteradded", code)); - } - } catch (TopiaException eeeTE) { - doCatch(topiaContext, eeeTE); - } - return result.toString(); - } - - /** * Import and create closedperiodicentrybook import Structure : TYPE | * BeginDate | EndDate | Locked * @@ -1135,7 +1096,7 @@ vatStatement.setHeader(Boolean .parseBoolean(vatStatementImport .getHeader())); - vatStatement.setAmount(BigDecimal.ZERO); + vatStatementService .createVatStatementWithTransaction( masterVatStatement, @@ -1182,33 +1143,6 @@ return result.toString(); } - - /** - * Dynamic letter creation used by CSV and EBP Import - * - * @param letterCode - * @param topiaContext - * @return - * @throws LimaException - */ - protected Letter createLetter(String letterCode, - TopiaContext topiaContext) throws LimaException { - Letter letter = null; - try { - LetterDAO letterDAO = LimaCallaoDAOHelper.getLetterDAO(topiaContext); - letter = letterDAO.findByCode(letterCode); - // if letter not exist create it ! - if (letter == null) { - letter = new LetterImpl(); - letter.setCode(letterCode); - financialTransactionService.createLetter(letter); - } - } catch (TopiaException eeeTE) { - doCatch(topiaContext, eeeTE); - } - return letter; - } - protected String createAccounts(Map<String, AccountImport> accounts, TopiaContext topiaContext) throws LimaException { StringBuilder result = new StringBuilder(); @@ -1355,9 +1289,7 @@ entry.setAmount(new BigDecimal(entryImport.getAmount())); entry.setDebit(Boolean.parseBoolean(entryImport.getDebit())); - Letter letter = createLetter( - entryImport.getLettering(), topiaContext); - entry.setLetter(letter); + entry.setLettering(entryImport.getLettering()); entry.setDetail(entryImport.getDetail()); entry.setVoucher(entryImport.getVoucher()); Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ReportServiceImpl.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ReportServiceImpl.java 2012-04-12 14:24:21 UTC (rev 3364) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ReportServiceImpl.java 2012-04-12 16:37:45 UTC (rev 3365) @@ -232,8 +232,7 @@ String loadEntryBookProperty = TopiaQuery.getProperty(Entry.PROPERTY_FINANCIAL_TRANSACTION, FinancialTransaction.PROPERTY_ENTRY_BOOK); - entriesQuery.addLoad(Entry.PROPERTY_ACCOUNT, Entry.PROPERTY_FINANCIAL_TRANSACTION, Entry.PROPERTY_LETTER) - .addLoad(loadEntryBookProperty); + entriesQuery.addLoad(loadEntryBookProperty); reportsDatas.setListEntry(entryDAO.findAllByQuery(entriesQuery)); TopiaQuery amountsQuery = @@ -377,8 +376,6 @@ EntryDAO entryDAO = LimaCallaoDAOHelper.getEntryDAO(topiaTransaction); TopiaQuery entriesQuery = createEntryBookReportsQuery( entryBook, beginDate, endDate, entryDAO, "E"); - //IMPORTANT : LOADING ENTRIES AND IS COLUMN FOR NO LAZY EXCEPTION - entriesQuery.addLoad(Entry.PROPERTY_ACCOUNT, Entry.PROPERTY_FINANCIAL_TRANSACTION, Entry.PROPERTY_LETTER); String orderDateProperty = TopiaQuery.getProperty("E", Entry.PROPERTY_FINANCIAL_TRANSACTION, FinancialTransaction.PROPERTY_TRANSACTION_DATE); String orderIdProperty = Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/migration/MigrationV0_6.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/migration/MigrationV0_6.java 2012-04-12 14:24:21 UTC (rev 3364) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/migration/MigrationV0_6.java 2012-04-12 16:37:45 UTC (rev 3365) @@ -63,11 +63,18 @@ // delete computed fields queries.add("Alter table FINANCIALTRANSACTION drop column AMOUNTDEBIT"); queries.add("Alter table FINANCIALTRANSACTION drop column AMOUNTCREDIT"); - + // modele refactoring queries.add("drop table record"); + queries.add("alter table account drop column masteraccount"); queries.add("alter table account drop column generalledger"); + + queries.add("alter table entry add column lettering varchar(30)"); + queries.add("update entry e set lettering = (select l.code from Letter l where l.topiaid = e.letter)"); + queries.add("alter table entry drop column letter"); + queries.add("drop table letter"); + + queries.add("alter table vatstatement drop column amount"); } - } Modified: trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/FinancialTransactionService.java =================================================================== --- trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/FinancialTransactionService.java 2012-04-12 14:24:21 UTC (rev 3364) +++ trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/FinancialTransactionService.java 2012-04-12 16:37:45 UTC (rev 3365) @@ -32,7 +32,6 @@ import org.chorem.lima.entity.FinancialPeriod; import org.chorem.lima.entity.FinancialTransaction; import org.chorem.lima.entity.FiscalPeriod; -import org.chorem.lima.entity.Letter; import java.util.Date; import java.util.List; @@ -75,17 +74,4 @@ void updateEntry(Entry entry) throws LimaException; void removeEntry(Entry entry) throws LimaException; - - Letter getNewLetter() throws LimaException; - - void createLetter(Letter letter) throws LimaException; - - void removeLetter(Letter letter) throws LimaException; - - List<Letter> getAllLetters() throws LimaException; - - void setEntryLetter(Entry entry, Letter letter) throws LimaException; - - void removeEntryLetter(Entry entry) throws LimaException; - } Modified: trunk/lima-callao/src/main/xmi/accounting.zargo =================================================================== (Binary files differ) 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 2012-04-12 14:24:21 UTC (rev 3364) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/LimaDecoratorProvider.java 2012-04-12 16:37:45 UTC (rev 3365) @@ -27,7 +27,6 @@ import org.chorem.lima.entity.EntryBook; import org.chorem.lima.entity.FinancialPeriod; import org.chorem.lima.entity.FiscalPeriod; -import org.chorem.lima.entity.Letter; import org.nuiton.util.decorator.DecoratorProvider; /** @@ -43,8 +42,6 @@ registerJXPathDecorator(EntryBook.class, "${code}$s - ${label}$s"); - registerJXPathDecorator(Letter.class, "${code}$s"); - registerJXPathDecorator( FiscalPeriod.class, "${beginDate}$td/%1$tm/%1$tY - ${endDate}$td/%1$tm/%1$tY"); Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsTableModel.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsTableModel.java 2012-04-12 14:24:21 UTC (rev 3364) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsTableModel.java 2012-04-12 16:37:45 UTC (rev 3365) @@ -30,7 +30,6 @@ import org.chorem.lima.beans.ReportsDatas; import org.chorem.lima.entity.Account; import org.chorem.lima.entity.Entry; -import org.chorem.lima.entity.Letter; import javax.swing.table.AbstractTableModel; import java.math.BigDecimal; @@ -96,7 +95,7 @@ result = String.class; break; case 5: - result = Letter.class; + result = String.class; break; case 6: result = BigDecimal.class; @@ -172,11 +171,7 @@ result = currentRow.getDescription(); break; case 5: - if (currentRow.getLetter() != null) { - result = currentRow.getLetter().getCode(); - } else { - result = null; - } + result = currentRow.getLettering(); break; case 6: result = currentRow.getDebit() ? currentRow.getAmount() : BigDecimal.ZERO; Deleted: trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/LetterTableCellEditor.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/LetterTableCellEditor.java 2012-04-12 14:24:21 UTC (rev 3364) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/LetterTableCellEditor.java 2012-04-12 16:37:45 UTC (rev 3365) @@ -1,153 +0,0 @@ -/* - * #%L - * Lima Swing - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2008 - 2010 CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -package org.chorem.lima.ui.celleditor; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.chorem.lima.entity.Account; -import org.chorem.lima.entity.Letter; -import org.chorem.lima.ui.LimaRendererUtil; -import org.chorem.lima.ui.combobox.LetterComboBoxModel; -import org.chorem.lima.util.LetterToString; -import org.chorem.lima.widgets.JWideComboBox; -import org.jdesktop.swingx.autocomplete.AutoCompleteDecorator; - -import javax.swing.AbstractCellEditor; -import javax.swing.JTable; -import javax.swing.ListCellRenderer; -import javax.swing.SwingUtilities; -import javax.swing.table.TableCellEditor; -import javax.swing.text.JTextComponent; -import java.awt.Component; -import java.awt.event.KeyEvent; -import java.awt.event.KeyListener; -import java.awt.event.MouseEvent; -import java.util.EventObject; - -public class LetterTableCellEditor extends AbstractCellEditor implements TableCellEditor, KeyListener { - - protected static final Log log = LogFactory.getLog(EntryBookTableCellEditor.class); - - private static final long serialVersionUID = 1L; - - private final JWideComboBox comboBox; -// private static LetterTableCellEditor editor; - - private static boolean keyPressed; - - /** constructor */ - public LetterTableCellEditor() { - comboBox = new JWideComboBox(); - LetterComboBoxModel comboBoxModel = new LetterComboBoxModel(); - comboBox.setModel(comboBoxModel); - ListCellRenderer renderer = - LimaRendererUtil.newDecoratorListCellRenderer(Letter.class); - comboBox.setRenderer(renderer); - AutoCompleteDecorator.decorate(comboBox, LetterToString.getInstance()); - comboBox.getEditor().getEditorComponent().addKeyListener(this); - } - - @Override - public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { - if (value instanceof Account) { - comboBox.setSelectedItem(value); - } - return comboBox; - } - - @Override - public Object getCellEditorValue() { - return comboBox.getSelectedItem(); - } - - /** - * Vérifie si la cellule peut être éditable : - * seulement si il y a une frappe au clavier ou un double clic. - * - * @param evt - * @return - */ - @Override - public boolean isCellEditable(EventObject evt) { - // Si il y a une frappe au clavier - if (evt instanceof KeyEvent) { - final KeyEvent keyEvent = (KeyEvent) evt; - // Empèche la touche echap - if (keyEvent.getKeyChar() != KeyEvent.VK_ESCAPE) { - // Permet de placer le focus sur l'editor de la comboBox - SwingUtilities.invokeLater(new Runnable() { - @Override - public void run() { - comboBox.getEditor().getEditorComponent().requestFocus(); - JTextComponent edit = (JTextComponent) comboBox.getEditor().getEditorComponent(); - if (!Character.isIdentifierIgnorable(keyEvent.getKeyChar())) { - edit.setText(Character.toString(keyEvent.getKeyChar())); - } - } - }); - } - } - keyPressed = false; - return !(evt instanceof MouseEvent) || ((MouseEvent) evt).getClickCount() == 2; - } - - - @Override - public void keyPressed(KeyEvent e) { - - } - - @Override - public void keyReleased(KeyEvent e) { - - // Vérifie si c'est la première frappe au clavier - if (!keyPressed) { - // Récupère l'editor de la comboBox - JTextComponent edit = (JTextComponent) comboBox.getEditor().getEditorComponent(); - // Met en place le curseur et la selection après la première lettre - edit.select(1, edit.getText().length()); - keyPressed = true; - } - - // delegate popup list menu - if (e.getKeyChar() == KeyEvent.VK_ENTER) { - fireEditingStopped(); - } - } - - @Override - public void keyTyped(KeyEvent e) { - - } - -// public static LetterTableCellEditor getInstance() { -// if (editor == null) { -// editor = new LetterTableCellEditor(); -// } -// return editor; -// } - -} Deleted: trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/LetterComboBoxModel.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/LetterComboBoxModel.java 2012-04-12 14:24:21 UTC (rev 3364) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/LetterComboBoxModel.java 2012-04-12 16:37:45 UTC (rev 3365) @@ -1,115 +0,0 @@ -/* - * #%L - * Lima Swing - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2008 - 2012 CodeLutin, Chatellier Eric - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -package org.chorem.lima.ui.combobox; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.chorem.lima.business.LimaException; -import org.chorem.lima.business.ServiceListener; -import org.chorem.lima.business.api.FinancialTransactionService; -import org.chorem.lima.business.monitorable.FinancialTransactionServiceMonitorable; -import org.chorem.lima.business.monitorable.ImportServiceMonitorable; -import org.chorem.lima.entity.Letter; -import org.chorem.lima.service.LimaServiceFactory; -import org.chorem.lima.ui.financialperiod.FinancialPeriodTableModel; - -import javax.swing.AbstractListModel; -import javax.swing.ComboBoxModel; -import java.util.List; - -/** Account combo box model. */ - -public class LetterComboBoxModel extends AbstractListModel implements ComboBoxModel, ServiceListener { - - private static final long serialVersionUID = 1L; - - private static final Log log = - LogFactory.getLog(FinancialPeriodTableModel.class); - - protected Object selectedAccount; - - protected List<Letter> datasCache; - - protected FinancialTransactionService service; - - public LetterComboBoxModel() { - service = - LimaServiceFactory.getService( - FinancialTransactionServiceMonitorable.class); - LimaServiceFactory.addServiceListener(service, this); - LimaServiceFactory.addServiceListener(ImportServiceMonitorable.class, this); - datasCache = getDataList(); - } - - @Override - public Object getSelectedItem() { - return selectedAccount; - } - - @Override - public void setSelectedItem(Object anItem) { - selectedAccount = anItem; - fireContentsChanged(this, -1, -1); - } - - - @Override - public Object getElementAt(int index) { - return datasCache.get(index); - } - - @Override - public int getSize() { - return datasCache.size(); - } - - public List<Letter> getDataList() { - List<Letter> result = null; - try { - result = service.getAllLetters(); - } catch (LimaException eee) { - if (log.isDebugEnabled()) { - log.debug("Can't get list letters", eee); - } - } - return result; - - } - - public void refresh() { - datasCache = getDataList(); - fireContentsChanged(this, 0, datasCache.size()); - } - - @Override - public void notifyMethod(String serviceName, String methodeName) { - if (methodeName.contains("Letter") || methodeName.contains("importAll")) { - refresh(); - } - } - - -} Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsTableModel.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsTableModel.java 2012-04-12 14:24:21 UTC (rev 3364) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsTableModel.java 2012-04-12 16:37:45 UTC (rev 3365) @@ -5,7 +5,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2008 - 2010 CodeLutin + * Copyright (C) 2008 - 2012 CodeLutin, Chatellier Eric * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as @@ -30,7 +30,6 @@ import org.chorem.lima.beans.ReportsDatas; import org.chorem.lima.entity.Account; import org.chorem.lima.entity.Entry; -import org.chorem.lima.entity.Letter; import javax.swing.table.AbstractTableModel; import java.math.BigDecimal; @@ -91,7 +90,7 @@ result = String.class; break; case 4: - result = Letter.class; + result = String.class; break; case 5: result = BigDecimal.class; @@ -160,11 +159,7 @@ result = currentRow.getDescription(); break; case 4: - if (currentRow.getLetter() != null) { - result = currentRow.getLetter().getCode(); - } else { - result = null; - } + result = currentRow.getLettering(); break; case 5: result = currentRow.getDebit() ? currentRow.getAmount() : BigDecimal.ZERO; Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTableModel.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTableModel.java 2012-04-12 14:24:21 UTC (rev 3364) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTableModel.java 2012-04-12 16:37:45 UTC (rev 3365) @@ -42,7 +42,6 @@ import org.chorem.lima.entity.FinancialPeriod; import org.chorem.lima.entity.FinancialTransaction; import org.chorem.lima.entity.FinancialTransactionImpl; -import org.chorem.lima.entity.Letter; import org.chorem.lima.service.LimaServiceFactory; import org.chorem.lima.util.ErrorHelper; @@ -166,7 +165,7 @@ result = String.class; break; case 5: - result = Letter.class; + result = String.class; break; case 6: result = BigDecimal.class; @@ -299,11 +298,7 @@ result = currentEntry.getDescription(); break; case 5: - if (currentEntry.getLetter() != null) { - result = currentEntry.getLetter().getCode(); - } else { - result = null; - } + result = currentEntry.getLettering(); break; case 6: result = currentEntry.getDebit() ? currentEntry.getAmount() : BigDecimal.ZERO; @@ -619,7 +614,7 @@ } break; case 5: - currentEntry.setLetter((Letter) value); + currentEntry.setLettering((String) value); break; case 6: currentEntry.setAmount((BigDecimal) value); Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchTableModel.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchTableModel.java 2012-04-12 14:24:21 UTC (rev 3364) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchTableModel.java 2012-04-12 16:37:45 UTC (rev 3365) @@ -44,7 +44,6 @@ import org.chorem.lima.entity.FinancialTransaction; import org.chorem.lima.entity.FinancialTransactionImpl; import org.chorem.lima.entity.FiscalPeriod; -import org.chorem.lima.entity.Letter; import org.chorem.lima.service.LimaServiceFactory; import org.chorem.lima.util.DialogHelper; import org.chorem.lima.util.ErrorHelper; @@ -118,7 +117,7 @@ List<Object> results = null; //prevent to much result if (financialTransactionSearch != null && (financialTransactionSearch.getVoucher() != null || financialTransactionSearch.getDescription() != null - || financialTransactionSearch.getLetter() != null || financialTransactionSearch.getAccountList() != null + || financialTransactionSearch.getLettering() != null || financialTransactionSearch.getAccountList() != null || financialTransactionSearch.getAccount() != null || financialTransactionSearch.getEntryBook() != null || financialTransactionSearch.getAmount() != null && financialTransactionSearch.getOperator() != null || financialTransactionSearch.getAmount() != null && financialTransactionSearch.getAmount2() != null)) { @@ -171,7 +170,7 @@ result = String.class; //Description break; case 5: - result = Letter.class; //Letter + result = String.class; //Letter break; case 6: result = BigDecimal.class; //Debit @@ -308,11 +307,7 @@ result = currentEntry.getDescription(); //Description break; case 5: - if (currentEntry.getLetter() != null) { - result = currentEntry.getLetter().getCode(); - } else { - result = null; - } + result = currentEntry.getLettering(); break; case 6: //Debit result = currentEntry.getDebit() ? currentEntry.getAmount() : BigDecimal.ZERO; @@ -496,7 +491,7 @@ currentEntry.setDebit(false); break; case 8: - currentEntry.setLetter((Letter) value); + currentEntry.setLettering((String) value); break; } try { Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchViewHandler.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchViewHandler.java 2012-04-12 14:24:21 UTC (rev 3364) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchViewHandler.java 2012-04-12 16:37:45 UTC (rev 3365) @@ -37,7 +37,6 @@ import org.chorem.lima.entity.Entry; import org.chorem.lima.entity.EntryBook; import org.chorem.lima.entity.FinancialTransaction; -import org.chorem.lima.entity.Letter; import org.chorem.lima.service.LimaServiceFactory; import org.chorem.lima.ui.combobox.FiscalPeriodComboBoxModel; import org.chorem.lima.util.DialogHelper; @@ -116,8 +115,8 @@ financialTransactionSearch.setDescription(result); } - public void setLetter(Letter letter) { - financialTransactionSearch.setLetter(letter); + public void setLetter(String lettering) { + financialTransactionSearch.setLettering(lettering); } public String getAccountsList() { Deleted: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/LetterSearchComboBox.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/LetterSearchComboBox.java 2012-04-12 14:24:21 UTC (rev 3364) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/LetterSearchComboBox.java 2012-04-12 16:37:45 UTC (rev 3365) @@ -1,95 +0,0 @@ -/* - * #%L - * Lima Swing - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2008 - 2010 CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -package org.chorem.lima.ui.financialtransactionsearch; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.chorem.lima.entity.Letter; -import org.chorem.lima.ui.LimaRendererUtil; -import org.chorem.lima.ui.combobox.LetterComboBoxModel; -import org.chorem.lima.util.LetterToString; -import org.jdesktop.swingx.autocomplete.AutoCompleteDecorator; - -import javax.swing.JComboBox; -import javax.swing.ListCellRenderer; -import java.awt.event.ActionEvent; -import java.awt.event.KeyEvent; -import java.awt.event.KeyListener; - -public class LetterSearchComboBox extends JComboBox implements KeyListener { - - private static final long serialVersionUID = 1L; - - private static final Log log = - LogFactory.getLog(LetterSearchComboBox.class); - - protected FinancialTransactionSearchViewHandler handler; - - public LetterSearchComboBox(FinancialTransactionSearchViewHandler handler) { - this.handler = handler; - LetterComboBoxModel letterComboBoxModel = new LetterComboBoxModel(); - ListCellRenderer renderer = - LimaRendererUtil.newDecoratorListCellRenderer(Letter.class); - setModel(letterComboBoxModel); - setRenderer(renderer); - setEditable(true); - AutoCompleteDecorator.decorate(this, LetterToString.getInstance()); - getEditor().getEditorComponent().addKeyListener(this); - addActionListener(this); - } - - @Override - public void actionPerformed(ActionEvent e) { - Object object = getSelectedItem(); - if (object instanceof Letter) { - handler.setLetter((Letter) getSelectedItem()); - } - } - - - @Override - public void keyPressed(KeyEvent e) { - - } - - @Override - public void keyReleased(KeyEvent e) { - Object object = getSelectedItem(); - if (object instanceof Letter) { - handler.setLetter((Letter) getSelectedItem()); - } - // delegate popup list menu - if (e.getKeyChar() == KeyEvent.VK_ENTER) { - firePopupMenuCanceled(); - } - } - - @Override - public void keyTyped(KeyEvent e) { - - } - -} Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/LetterSearchPanel.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/LetterSearchPanel.java 2012-04-12 14:24:21 UTC (rev 3364) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/LetterSearchPanel.java 2012-04-12 16:37:45 UTC (rev 3365) @@ -5,7 +5,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2008 - 2010 CodeLutin + * Copyright (C) 2008 - 2012 CodeLutin, Chatellier Eric * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as @@ -31,6 +31,9 @@ public class LetterSearchPanel extends JPanel { + /** serialVersionUID. */ + private static final long serialVersionUID = 7682668138031148237L; + protected FinancialTransactionSearchViewHandler handler; public LetterSearchPanel(FinancialTransactionSearchViewHandler handler) { @@ -47,9 +50,9 @@ break; case SELECT_ONE: - LetterSearchComboBox comboBox = new LetterSearchComboBox(handler); + /*LetterSearchComboBox comboBox = new LetterSearchComboBox(handler); removeAll(); - add(comboBox); + add(comboBox);*/ break; } Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTableModel.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTableModel.java 2012-04-12 14:24:21 UTC (rev 3364) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTableModel.java 2012-04-12 16:37:45 UTC (rev 3365) @@ -38,7 +38,6 @@ import org.chorem.lima.entity.EntryImpl; import org.chorem.lima.entity.FinancialTransaction; import org.chorem.lima.entity.FiscalPeriod; -import org.chorem.lima.entity.Letter; import org.chorem.lima.service.LimaServiceFactory; import org.chorem.lima.util.DialogHelper; import org.chorem.lima.util.ErrorHelper; @@ -169,7 +168,7 @@ result = BigDecimal.class; break; case 8: - result = Letter.class; + result = String.class; break; } @@ -303,11 +302,7 @@ result = null; break; case 8: - if (currentEntry.getLetter() != null) { - result = currentEntry.getLetter().getCode(); - } else { - result = null; - } + result = currentEntry.getLettering(); break; } @@ -426,7 +421,7 @@ currentEntry.setDebit(false); break; case 8: - currentEntry.setLetter((Letter) value); + currentEntry.setLettering((String) value); break; } try { Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/AddLetterForm.jaxx =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/AddLetterForm.jaxx 2012-04-12 14:24:21 UTC (rev 3364) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/AddLetterForm.jaxx 2012-04-12 16:37:45 UTC (rev 3365) @@ -66,7 +66,7 @@ </cell> <cell> <JComboBox id='LetterListComboBox' visible="{listLetter.isSelected()}" - javaBean="new LetterComboBox()"/> + javaBean="new JComboBox()"/> </cell> </row> <row> Deleted: trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetterComboBox.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetterComboBox.java 2012-04-12 14:24:21 UTC (rev 3364) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetterComboBox.java 2012-04-12 16:37:45 UTC (rev 3365) @@ -1,58 +0,0 @@ -/* - * #%L - * Lima Swing - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2008 - 2010 CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -package org.chorem.lima.ui.lettering; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.chorem.lima.entity.Letter; -import org.chorem.lima.ui.LimaRendererUtil; -import org.chorem.lima.ui.combobox.LetterComboBoxModel; -import org.chorem.lima.util.LetterToString; -import org.jdesktop.swingx.autocomplete.AutoCompleteDecorator; - -import javax.swing.JComboBox; -import javax.swing.ListCellRenderer; - -public class LetterComboBox extends JComboBox { - - private static final long serialVersionUID = 1L; - - private static final Log log = - LogFactory.getLog(LetterComboBox.class); - - - public LetterComboBox() { - - LetterComboBoxModel letterComboBoxModel = new LetterComboBoxModel(); - ListCellRenderer renderer = - LimaRendererUtil.newDecoratorListCellRenderer(Letter.class); - setModel(letterComboBoxModel); - setRenderer(renderer); - setEditable(true); - AutoCompleteDecorator.decorate(this, LetterToString.getInstance()); - } - -} 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-04-12 14:24:21 UTC (rev 3364) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTable.java 2012-04-12 16:37:45 UTC (rev 3365) @@ -29,13 +29,11 @@ import org.apache.commons.logging.LogFactory; import org.chorem.lima.entity.Account; import org.chorem.lima.entity.EntryBook; -import org.chorem.lima.entity.Letter; import org.chorem.lima.ui.celleditor.AccountTableCellEditor; import org.chorem.lima.ui.celleditor.BigDecimalTableCellEditor; import org.chorem.lima.ui.celleditor.BigDecimalTableCellRenderer; import org.chorem.lima.ui.celleditor.DateTableCellEditor; import org.chorem.lima.ui.celleditor.EntryBookTableCellEditor; -import org.chorem.lima.ui.celleditor.LetterTableCellEditor; import org.jdesktop.swingx.JXTable; import org.jdesktop.swingx.decorator.ColorHighlighter; import org.jdesktop.swingx.decorator.ComponentAdapter; @@ -86,8 +84,7 @@ setDefaultEditor(EntryBook.class, new EntryBookTableCellEditor()); //Get new account editor setDefaultEditor(Account.class, new AccountTableCellEditor()); - //Get new letter editor - setDefaultEditor(Letter.class, new LetterTableCellEditor()); + //Get new amount editor setDefaultEditor(BigDecimal.class, new BigDecimalTableCellEditor()); //Get new BigDecimal renderer 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-04-12 14:24:21 UTC (rev 3364) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTableModel.java 2012-04-12 16:37:45 UTC (rev 3365) @@ -37,7 +37,6 @@ import org.chorem.lima.entity.Entry; import org.chorem.lima.entity.EntryBook; import org.chorem.lima.entity.FinancialTransaction; -import org.chorem.lima.entity.Letter; import org.chorem.lima.service.LimaServiceFactory; import org.chorem.lima.util.DialogHelper; import org.chorem.lima.util.ErrorHelper; @@ -142,7 +141,7 @@ return results; } - public void setLetter(int row, Letter letter) { + /*public void setLetter(int row, Letter letter) { Object currentRow = cacheDataList.get(row); if (currentRow instanceof Entry) { Entry entry = (Entry) currentRow; @@ -163,10 +162,10 @@ f.dispose(); } } - } + }*/ public void removeLetter(int row) { - try { + /*try { Object currentRow = cacheDataList.get(row); if (currentRow instanceof Entry) { Entry entry = (Entry) currentRow; @@ -174,7 +173,7 @@ } } catch (LimaException eee) { log.error("Can't remove letter", eee); - } + }*/ } public void refresh() { @@ -209,7 +208,7 @@ result = String.class; break; case 5: - result = Letter.class; + result = String.class; break; case 6: result = BigDecimal.class; @@ -343,11 +342,7 @@ result = currentEntry.getDescription(); break; case 5: - if (currentEntry.getLetter() != null) { - result = currentEntry.getLetter().getCode(); - } else { - result = null; - } + result = currentEntry.getLettering(); break; case 6: result = currentEntry.getDebit() ? currentEntry.getAmount() : BigDecimal.ZERO; @@ -400,7 +395,7 @@ Entry currentEntry = (Entry) currentRow; switch (column) { case 5: - currentEntry.setLetter((Letter) value); + currentEntry.setLettering((String) value); break; } try { 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-04-12 14:24:21 UTC (rev 3364) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java 2012-04-12 16:37:45 UTC (rev 3365) @@ -29,7 +29,6 @@ import org.apache.commons.logging.LogFactory; import org.chorem.lima.business.LimaException; import org.chorem.lima.business.monitorable.FinancialTransactionServiceMonitorable; -import org.chorem.lima.entity.Letter; import org.chorem.lima.service.LimaServiceFactory; import org.chorem.lima.ui.combobox.FinancialPeriodComboBoxModel; import org.chorem.lima.ui.combobox.FiscalPeriodComboBoxModel; @@ -92,8 +91,7 @@ } public void addLetter() { - Letter letter = null; - Boolean valid = true; + /*Boolean valid = true; table = view.getTable(); tableModel = view.getTableModel(); @@ -132,7 +130,7 @@ } tableModel.refresh(); } - } + }*/ } public void removeLetter() { Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartViewHandler.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartViewHandler.java 2012-04-12 14:24:21 UTC (rev 3364) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartViewHandler.java 2012-04-12 16:37:45 UTC (rev 3365) @@ -93,7 +93,7 @@ // null == cancel action if (newVatChartMovement != null) { - newVatChartMovement.setAmount(BigDecimal.ZERO); + // add it try { treeTableModel.addVatStatement(treePath, newVatChartMovement); Deleted: trunk/lima-swing/src/main/java/org/chorem/lima/util/LetterToString.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/util/LetterToString.java 2012-04-12 14:24:21 UTC (rev 3364) +++ trunk/lima-swing/src/main/java/org/chorem/lima/util/LetterToString.java 2012-04-12 16:37:45 UTC (rev 3365) @@ -1,65 +0,0 @@ -/* - * #%L - * Lima Swing - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2008 - 2010 CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -package org.chorem.lima.util; - -import org.chorem.lima.LimaContext; -import org.chorem.lima.entity.Letter; -import org.jdesktop.swingx.autocomplete.ObjectToStringConverter; -import org.nuiton.util.decorator.Decorator; -import org.nuiton.util.decorator.DecoratorProvider; - -public class LetterToString extends ObjectToStringConverter { - - private static LetterToString converter; - - protected Decorator<Letter> decorator; - - public LetterToString() { - - DecoratorProvider provider = LimaContext.get().getDecoratorProvider(); - decorator = provider.getDecoratorByType(Letter.class); - } - - @Override - public String getPreferredStringForItem(Object item) { - String result = null; - if (item != null) { - if (item instanceof Letter) { - Letter letter = (Letter) item; - result = decorator.toString(letter); - } - } - return result; - } - - public static LetterToString getInstance() { - if (converter == null) { - converter = new LetterToString(); - } - return converter; - } - -}