Author: mallon Date: 2012-06-21 14:49:13 +0200 (Thu, 21 Jun 2012) New Revision: 3468 Url: http://chorem.org/repositories/revision/lima/3468 Log: Une transaction ne peut maintenant plus ?\195?\170tre ajout?\195?\169e sans avoir s?\195?\169lectionn?\195?\169e de p?\195?\169riode comptable (P?\195?\169riode comptable par d?\195?\169faut.). Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/common/FinancialPeriodComboBoxModel.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionViewHandler.java Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/common/FinancialPeriodComboBoxModel.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/common/FinancialPeriodComboBoxModel.java 2012-06-21 12:36:51 UTC (rev 3467) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/common/FinancialPeriodComboBoxModel.java 2012-06-21 12:49:13 UTC (rev 3468) @@ -37,4 +37,17 @@ /** serialVersionUID. */ private static final long serialVersionUID = 6991293987668268456L; + + + /*By default, selection of the first financial period (Because a + * transaction concern one financial period) + */ + @Override + public Object getElementAt(int index) { + if (getSelectedItem() == null){ + setSelectedItem(objects.get(0)); + return objects.get(0); + } + return objects.get(index); + } } Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionViewHandler.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionViewHandler.java 2012-06-21 12:36:51 UTC (rev 3467) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionViewHandler.java 2012-06-21 12:49:13 UTC (rev 3468) @@ -283,16 +283,16 @@ /** * Add new transaction. */ - public void addFinancialTransaction() { - FinancialTransactionTable table = view.getFinancialTransactionTable(); - ListSelectionModel selectionModel = table.getSelectionModel(); - addFinancialTransactionAfterService(); - //select the new line - int numberRow = table.getRowCount(); - selectionModel.setSelectionInterval(numberRow - 1, numberRow - 1); - //focus on first column - table.changeSelection(numberRow, 0, false, false); - table.scrollCellToVisible(numberRow, 0); + public void addFinancialTransaction() { + FinancialTransactionTable table = view.getFinancialTransactionTable(); + ListSelectionModel selectionModel = table.getSelectionModel(); + addFinancialTransactionAfterService(); + //select the new line + int numberRow = table.getRowCount()-1; + selectionModel.setSelectionInterval(numberRow, numberRow); + //focus on first column + table.changeSelection(numberRow, 0, false, false); + table.scrollCellToVisible(numberRow, 0); } /** @@ -302,8 +302,8 @@ FinancialPeriod financialPeriod = (FinancialPeriod)view.getFinancialPeriodComboBox().getSelectedItem(); EntryBook entryBook = (EntryBook)view.getEntryBookComboBox().getSelectedItem(); - FinancialTransactionTableModel tableModel = view.getFinancialTransactionTableModel(); - + FinancialTransactionTableModel tableModel = view.getFinancialTransactionTableModel(); + FinancialTransaction financialTransaction = new FinancialTransactionImpl(); // can be defined later by user if (entryBook != null) {