Author: jpepin Date: 2010-06-17 18:15:50 +0200 (Thu, 17 Jun 2010) New Revision: 2943 Url: http://chorem.org/repositories/revision/lima/2943 Log: Modification UI G?\195?\169n?\195?\169ration Compte de r?\195?\169sultat et Bilan : ajout de style de police, identation en fonction du nombre de niveau, et surbrillance. Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialStatementServiceImpl.java trunk/lima-callao/src/main/xmi/accounting.properties trunk/lima-callao/src/main/xmi/accounting.zargo trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTable.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableCellRenderer.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableModel.java Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialStatementServiceImpl.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialStatementServiceImpl.java 2010-06-17 11:08:41 UTC (rev 2942) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialStatementServiceImpl.java 2010-06-17 16:15:50 UTC (rev 2943) @@ -400,6 +400,7 @@ financialStatementAmounts.setGrossAmount(amount+creditAmount+debitAmount); financialStatementAmounts.setLabel(financialStatementMovement.getLabel()); financialStatementAmounts.setProvisionDeprecationAmount(provisionDeprecationAmount); + financialStatementAmounts.setHeaderLevel(financialStatementMovement.getFinancialStatementHeader().getLevel()); } Modified: trunk/lima-callao/src/main/xmi/accounting.properties =================================================================== --- trunk/lima-callao/src/main/xmi/accounting.properties 2010-06-17 11:08:41 UTC (rev 2942) +++ trunk/lima-callao/src/main/xmi/accounting.properties 2010-06-17 16:15:50 UTC (rev 2943) @@ -7,7 +7,9 @@ org.chorem.lima.entity.FinancialStatementHeader.attribute.subFinancialStatementHeaders.tagvalue.lazy=false org.chorem.lima.entity.FinancialStatementHeader.attribute.financialStatementMovement.tagvalue.lazy=false org.chorem.lima.entity.FinancialStatementHeader.attribute.masterFinancialStatementHeader.tagvalue.lazy=false +org.chorem.lima.entity.FinancialStatementMovement.attribute.financialStatementHeader.tagvalue.lazy=false + #model.tagvalue.dbSchema=Callao model.tagvalue.String=text \ No newline at end of file Modified: trunk/lima-callao/src/main/xmi/accounting.zargo =================================================================== (Binary files differ) Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTable.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTable.java 2010-06-17 11:08:41 UTC (rev 2942) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTable.java 2010-06-17 16:15:50 UTC (rev 2943) @@ -20,16 +20,22 @@ import java.awt.Color; import java.awt.Component; +import java.awt.Font; import java.text.SimpleDateFormat; +import javax.swing.border.LineBorder; + import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.lima.business.FinancialPeriodService; import org.chorem.lima.business.LimaException; import org.chorem.lima.entity.ClosedPeriodicEntryBook; import org.chorem.lima.entity.ClosedPeriodicEntryBookImpl; +import org.chorem.lima.entity.FinancialStatementHeader; +import org.chorem.lima.entity.FinancialStatementHeaderImpl; import org.chorem.lima.service.LimaServiceFactory; import org.jdesktop.swingx.JXTable; +import org.jdesktop.swingx.decorator.BorderHighlighter; import org.jdesktop.swingx.decorator.ColorHighlighter; import org.jdesktop.swingx.decorator.ComponentAdapter; import org.jdesktop.swingx.decorator.HighlightPredicate; @@ -52,52 +58,47 @@ * Constructor, call highlighter */ public FinancialStatementReportTable(FinancialStatementReportViewHandler handler) { - + super(handler.getView().modelTable); this.handler = handler; model = this.handler.getView().modelTable; financialPeriodService = LimaServiceFactory.getInstance().getFinancialPeriodService(); //highlight financial financial transactions - // addTitle1(); + colorTitle1(); // addTitle2(); - + //Renderer for font - - log.debug(getColumnCount()); - /* FinancialStatementReportTableCellRenderer renderer = new FinancialStatementReportTableCellRenderer(); - for (int i = 1; i <= model.getColumnCount(); i++) { - - getColumn(-1).setCellRenderer(renderer); - //getColumnModel().getColumn(i).setCellRenderer(renderer); - }*/ + for (int i = 0; i < getColumnModel().getColumnCount(); i++) { + getColumnModel().getColumn(i).setCellRenderer(renderer); + } } /* * Color the background row in grey if the month number is even (pair in french) */ - protected void addTitle1() { -/* + protected void colorTitle1() { HighlightPredicate predicate = new HighlightPredicate() { @Override public boolean isHighlighted(Component renderer, ComponentAdapter adapter) { - ClosedPeriodicEntryBook closedPeriodicEntryBook - = (ClosedPeriodicEntryBook) model.getElementAt(adapter.row); - SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MM"); - int month = Integer.parseInt(simpleDateFormat.format( - closedPeriodicEntryBook.getFinancialPeriod().getBeginDate())); - // true if month is even - return ((month % 2)==0); + Boolean result = false; + FinancialStatementHeader financialStatementHeader = new FinancialStatementHeaderImpl(); + Object object = model.getElementAt(adapter.row); + if (model.getElementAt(adapter.row) instanceof FinancialStatementHeader){ + financialStatementHeader = (FinancialStatementHeader) object; + result = financialStatementHeader.getLevel() == 1; + } + return result; } }; colorTransaction = new ColorHighlighter(predicate, new Color(222,222,222), null); - addHighlighter(colorTransaction);*/ + addHighlighter(colorTransaction); } /* Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableCellRenderer.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableCellRenderer.java 2010-06-17 11:08:41 UTC (rev 2942) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableCellRenderer.java 2010-06-17 16:15:50 UTC (rev 2943) @@ -37,15 +37,15 @@ public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { - super.getTableCellRendererComponent(table, value, isSelected, hasFocus, - row, column); // Get table - FinancialStatementReportTable financialStatementReportTable = (FinancialStatementReportTable) table; FinancialStatementReportTableModel financialStatementReportTableModel = (FinancialStatementReportTableModel) table.getModel(); // Récupère le bilan de la ligne Object object = financialStatementReportTableModel.getElementAt(row); + Component cell = super.getTableCellRendererComponent( + table, value, isSelected, hasFocus, row, column); + // Si le bilan est un soustotal, alors la ligne est en gras if (object instanceof FinancialStatementHeader){ FinancialStatementHeader financialStatementHeader = (FinancialStatementHeader) object; @@ -60,9 +60,14 @@ setFont(new Font("Verdana", Font.BOLD, 12)); } } + else { + if (column == 0){ + cell.setFont(new Font("Verdana", Font.ITALIC, 12)); + } + } // Alignement des cellules - switch (column) { + /* switch (column) { case 0: this.setHorizontalAlignment(JLabel.LEFT); break; @@ -78,7 +83,7 @@ case 4: this.setHorizontalAlignment(JLabel.RIGHT); break; - } + }*/ return this; } Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableModel.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableModel.java 2010-06-17 11:08:41 UTC (rev 2942) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableModel.java 2010-06-17 16:15:50 UTC (rev 2943) @@ -127,7 +127,11 @@ FinancialStatementHeader currentRow = (FinancialStatementHeader) result; switch (column) { case 0: - result = currentRow.getLabel(); + result = ""; + for (int i = 0; i < currentRow.getLevel(); i++) { + result = result+"\t"; + } + result = result+currentRow.getLabel(); break; case 1: result = null; @@ -145,8 +149,12 @@ Double grossAmount = currentRow.getGrossAmount(); Double provisionDeprecationAmount = currentRow.getProvisionDeprecationAmount(); switch (column) { - case 0: - result = currentRow.getLabel(); + case 0: + result = ""; + for (int i = 0; i <= currentRow.getHeaderLevel(); i++) { + result = result+"\t"; + } + result = result+currentRow.getLabel(); break; case 1: result = grossAmount;