Author: jpepin Date: 2010-06-02 12:54:31 +0200 (Wed, 02 Jun 2010) New Revision: 2925 Url: http://chorem.org/repositories/revision/lima/2925 Log: Modification de l'UI : s?\195?\169lection automatique de ligne apr?\195?\168s ajout/suppression de transactions ou entr?\195?\169es. Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionViewHandler.java 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 2010-06-02 10:31:20 UTC (rev 2924) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionViewHandler.java 2010-06-02 10:54:31 UTC (rev 2925) @@ -22,6 +22,7 @@ import javax.swing.JOptionPane; +import javax.swing.ListSelectionModel; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -61,6 +62,11 @@ try { model.addFinancialTransaction(); + //select the new line + int numberRow = table.getRowCount(); + ListSelectionModel selectionModel = + table.getSelectionModel(); + selectionModel.setSelectionInterval(numberRow-1, numberRow-1); } catch (LimaException ex) { if (log.isErrorEnabled()) { log.error("Can't add financialtransaction", ex); @@ -84,6 +90,10 @@ Object selectedValue = model.getElementAt(indexSelectedRow); try { model.addEmptyEntry(selectedValue, indexSelectedRow); + //select the new line + ListSelectionModel selectionModel = + table.getSelectionModel(); + selectionModel.setSelectionInterval(indexSelectedRow+1, indexSelectedRow+1); } catch (LimaException ex){ if (log.isErrorEnabled()) { log.error("Can't add emptyentry", ex); @@ -131,6 +141,10 @@ try { model.removeObject(selectedValue, indexSelectedRow); + //select the upper line + ListSelectionModel selectionModel = + table.getSelectionModel(); + selectionModel.setSelectionInterval(indexSelectedRow-1, indexSelectedRow-1); } catch (LimaException ex) { if (log.isErrorEnabled()) { log.error("Can't remove transaction or entry", ex);