r3124 - in trunk/lima-swing/src/main/java/org/chorem/lima/ui: celleditor financialtransaction financialtransactionsearch financialtransactionunbalanced
Author: vsalaun Date: 2011-05-13 16:59:57 +0200 (Fri, 13 May 2011) New Revision: 3124 Url: http://chorem.org/repositories/revision/lima/3124 Log: #286 mise a jour dans la prise en charge des champs invalides Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/EmptyCellRenderer.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTable.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchTable.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTable.java Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/EmptyCellRenderer.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/EmptyCellRenderer.java 2011-05-13 12:17:45 UTC (rev 3123) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/EmptyCellRenderer.java 2011-05-13 14:59:57 UTC (rev 3124) @@ -9,6 +9,8 @@ import javax.swing.border.EmptyBorder; import javax.swing.table.DefaultTableCellRenderer; +import org.chorem.lima.entity.EntryBook; + import sun.swing.DefaultLookup; @SuppressWarnings("restriction") @@ -19,8 +21,8 @@ public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { - //Create a new JLabel to avoid colouring only when row is selected - JLabel mycell = new JLabel(); + //Create a new JLabel to avoid colouring only when row is selected + JLabel mycell = new JLabel(); mycell.setOpaque(true); setBorder(new EmptyBorder(1, 1, 1, 1)); setName("Table.cellRenderer"); @@ -30,10 +32,10 @@ if (isSelected) { mycell.setForeground(table.getSelectionForeground()); mycell.setBackground(table.getSelectionBackground()); - } + } //Setting default foreGround and backGround colours when hasFocus if (hasFocus) { - Border border = null; + Border border = null; if (isSelected) { border = DefaultLookup.getBorder(this, ui, "Table.focusSelectedCellHighlightBorder"); } @@ -42,19 +44,21 @@ } mycell.setBorder(border); } - // true for voucher and description - // false for Account Class - // if empty or null, colour background in red - // else setText - if (value instanceof String) { - if (String.valueOf(value).isEmpty() || (String.valueOf(value) == null)) { - mycell.setBackground(new Color(255, 198, 209)); - } else { - mycell.setText(value.toString()); - } - } else { - mycell.setBackground(new Color(255, 198, 209)); - } + if (table.isCellEditable(row, column)) { + // true for voucher and description + // false for Account Class + // if empty or null, colour background in red + // else setText + if (value instanceof String) { + if (String.valueOf(value).isEmpty() || (String.valueOf(value) == null)) { + mycell.setBackground(new Color(255, 198, 209)); + } else { + mycell.setText(value.toString()); + } + } else { + mycell.setBackground(new Color(255, 198, 209)); + } + } return mycell; } Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTable.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTable.java 2011-05-13 12:17:45 UTC (rev 3123) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTable.java 2011-05-13 14:59:57 UTC (rev 3124) @@ -94,6 +94,8 @@ setDefaultRenderer(String.class, new EmptyCellRenderer()); //get new Account renderer for empty cells setDefaultRenderer(Account.class, new EmptyCellRenderer()); + //get new EntryBook renderer for empty cells + setDefaultRenderer(EntryBook.class, new EmptyCellRenderer()); //highlight financial financial transactions addColorTransaction(); Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchTable.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchTable.java 2011-05-13 12:17:45 UTC (rev 3123) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchTable.java 2011-05-13 14:59:57 UTC (rev 3124) @@ -81,6 +81,8 @@ setDefaultRenderer(String.class, new EmptyCellRenderer()); //get new Account renderer for empty cells setDefaultRenderer(Account.class, new EmptyCellRenderer()); + //get new EntryBook renderer for empty cells + setDefaultRenderer(EntryBook.class, new EmptyCellRenderer()); //highlight financial financial transactions addColorTransaction(); Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTable.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTable.java 2011-05-13 12:17:45 UTC (rev 3123) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTable.java 2011-05-13 14:59:57 UTC (rev 3124) @@ -86,6 +86,8 @@ setDefaultRenderer(String.class, new EmptyCellRenderer()); //get new Account renderer for empty cells setDefaultRenderer(Account.class, new EmptyCellRenderer()); + //get new EntryBook renderer for empty cells + setDefaultRenderer(EntryBook.class, new EmptyCellRenderer()); //highlight financial financial transactions addColorTransaction();
participants (1)
-
vsalaun@users.chorem.org