This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository lima. See https://gitlab.nuiton.org/chorem/lima.git commit 5da06cc2c3f01f0dbc08277be1bad7634172d85d Author: dcosse <cosse@codelutin.com> Date: Sat Feb 20 17:43:00 2016 +0100 refs #1316 changement de comportement, il est possible de rechercher un compte tant qu'aucune correspondance a été trouvée, une fois une correspondance unique trouvée la recherche est intérompue (peut-être reprise avec F12) et l'utilisateur peut alors passer sur une autre cellule --- .../lima/ui/celleditor/AccountTableCellEditor.java | 37 ++++++++++++++++++---- 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/AccountTableCellEditor.java b/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/AccountTableCellEditor.java index 5d6e734..799a1d0 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/AccountTableCellEditor.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/AccountTableCellEditor.java @@ -61,29 +61,52 @@ public class AccountTableCellEditor extends AbstractCellEditor implements TableC accountComboBox.setShowDecorator(false); final JComboBox comboBox = accountComboBox.getCombobox(); - comboBox.getEditor().getEditorComponent().addKeyListener(new KeyAdapter() { + final ComboBoxEditor editor = comboBox.getEditor(); + + editor.getEditorComponent().addKeyListener(new KeyAdapter() { + @Override public void keyReleased(KeyEvent e) { + if (log.isDebugEnabled()) { + log.debug("keyReleased:" + e.getKeyCode()); + log.debug("items:" + comboBox.getItemCount()); + } + // in case of unique chose available this one is auto-selected if (accountComboBox.isEnterToSelectUniqueUniverse() && comboBox.getItemCount() == 1) { - // auto-select the account + if (log.isDebugEnabled()) { - log.debug("Auto-select unique result with *ENTER* or *TAB* key"); + log.debug("Auto-select unique result"); } e.consume(); - // edition is done + if (log.isDebugEnabled()) { + log.debug("setEditable false"); + } + + // set the account into the combobox + // disabled edition to avoid user taping other chars and unvolontary start a new research + // User can press Tab or Enter to leave the combo or F12 to edit it again + comboBox.getItemAt(0); comboBox.setSelectedIndex(0); - comboBox.getModel().setSelectedItem(comboBox.getSelectedItem()); - comboBox.hidePopup(); + editor.setItem(comboBox.getSelectedItem()); + comboBox.setEditable(false); + } } }); + } @Override public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { - if (value instanceof Account) { + // focus reach the combo by either coming into it or pressing F12 + // cell is set editable for user to be able to start a new research + accountComboBox.getCombobox().setEditable(true); + if (value != null && (value instanceof Account)) { + if (log.isDebugEnabled()) { + log.debug("set account:" + ((Account) value).getAccountNumber()); + } accountComboBox.setSelectedItem(value); } return accountComboBox; -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.