Author: vsalaun Date: 2011-05-12 10:42:07 +0200 (Thu, 12 May 2011) New Revision: 3112 Url: http://chorem.org/repositories/revision/lima/3112 Log: #267 ajout du renderer pour les objets de type BigDecimal dans l'edition du grand livre Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerTable.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerTableModel.java Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerTable.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerTable.java 2011-05-12 08:40:28 UTC (rev 3111) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerTable.java 2011-05-12 08:42:07 UTC (rev 3112) @@ -27,6 +27,9 @@ import java.awt.Color; import java.awt.Component; +import java.math.BigDecimal; + +import org.chorem.lima.ui.celleditor.BigDecimalTableCellRenderer; import org.jdesktop.swingx.JXTable; import org.jdesktop.swingx.decorator.ColorHighlighter; import org.jdesktop.swingx.decorator.ComponentAdapter; @@ -54,6 +57,10 @@ public LedgerTable(LedgerViewHandler handler) { this.handler = handler; + + //Get new BigDecimal renderer + setDefaultRenderer(BigDecimal.class, new BigDecimalTableCellRenderer()); + //highlight financial financial transactions addColorReportsDatas(); Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerTableModel.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerTableModel.java 2011-05-12 08:40:28 UTC (rev 3111) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerTableModel.java 2011-05-12 08:42:07 UTC (rev 3112) @@ -29,12 +29,16 @@ import java.math.BigDecimal; import java.text.SimpleDateFormat; +import java.util.Date; import java.util.List; import javax.swing.table.AbstractTableModel; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.lima.beans.ReportsDatas; +import org.chorem.lima.entity.Account; import org.chorem.lima.entity.Entry; +import org.chorem.lima.entity.EntryBook; +import org.chorem.lima.entity.Letter; /** * Entry book table model. @@ -73,7 +77,44 @@ public int getColumnCount() { return 8; } + + @Override + public Class<?> getColumnClass(int column) { + Class<?> result = null; + + switch (column) { + case 0: + result = Account.class; + break; + case 1: + result = Date.class; + break; + case 2: + result = EntryBook.class; + break; + case 3: + result = String.class; + break; + case 4: + result = String.class; + break; + case 5: + result = BigDecimal.class; + break; + case 6: + result = BigDecimal.class; + break; + case 7: + result = BigDecimal.class; + break; + } + + return result; + } + + + @Override public String getColumnName(int column) { String res = "n/a"; @@ -155,8 +196,8 @@ } else if (result instanceof Entry) { Entry currentRow = (Entry)result; - BigDecimal amountDebit = new BigDecimal(0), - amountCredit = new BigDecimal(0); + BigDecimal amountDebit = BigDecimal.ZERO, + amountCredit = BigDecimal.ZERO; if (currentRow.getDebit()){ amountDebit = currentRow.getAmount(); }
participants (1)
-
vsalaun@users.chorem.org