branch develop updated (e4156a9 -> 0a3db77)
This is an automated email from the git hooks/post-receive script. New change to branch develop in repository tutti. See https://gitlab.nuiton.org/codelutin/tutti.git from e4156a9 Ajout étape lors du chargement de la saisie des captures new aad91f9 Ne pas changer de ligne en appuyant sur Entrée dans le tableau des observations individuelles (See #8230) new 0a3db77 Livrable #8230 Merge branch 'feature/8230' into develop The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit 0a3db77da3fef3a40ec9b7252b557dd7a0516acd Merge: e4156a9 aad91f9 Author: Tony CHEMIT <chemit@codelutin.com> Date: Tue Apr 12 03:51:14 2016 +0200 Livrable #8230 Merge branch 'feature/8230' into develop commit aad91f965ee698caa32583fb3cd165f79435dd7a Author: Tony CHEMIT <chemit@codelutin.com> Date: Tue Apr 12 03:51:11 2016 +0200 Ne pas changer de ligne en appuyant sur Entrée dans le tableau des observations individuelles (See #8230) Summary of changes: .../frequency/SpeciesFrequencyUIHandler.java | 3 +- .../util/table/AbstractTuttiTableUIHandler.java | 109 ++++++++++++--------- 2 files changed, 65 insertions(+), 47 deletions(-) -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository tutti. See https://gitlab.nuiton.org/codelutin/tutti.git commit aad91f965ee698caa32583fb3cd165f79435dd7a Author: Tony CHEMIT <chemit@codelutin.com> Date: Tue Apr 12 03:51:11 2016 +0200 Ne pas changer de ligne en appuyant sur Entrée dans le tableau des observations individuelles (See #8230) --- .../frequency/SpeciesFrequencyUIHandler.java | 3 +- .../util/table/AbstractTuttiTableUIHandler.java | 109 ++++++++++++--------- 2 files changed, 65 insertions(+), 47 deletions(-) diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUIHandler.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUIHandler.java index 5762aef..0239e67 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUIHandler.java +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUIHandler.java @@ -130,6 +130,7 @@ import java.util.Optional; import java.util.Set; import static org.nuiton.i18n.I18n.t; +import static org.nuiton.i18n.LanguageEnum.fa; /** * @author Tony Chemit - chemit@codelutin.com @@ -1334,7 +1335,7 @@ public class SpeciesFrequencyUIHandler extends AbstractTuttiTableUIHandler<Speci }), cellWithValueColor); obsTable.addHighlighter(commentHighlighter); - installTableKeyListener(columnModel, obsTable); + installTableKeyListener(columnModel, obsTable, false); tableModel.addTableModelListener(e -> { diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIHandler.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIHandler.java index 09d66be..85d5e59 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIHandler.java +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIHandler.java @@ -43,6 +43,7 @@ import org.nuiton.jaxx.application.swing.table.MoveToNextEditableRowAction; import org.nuiton.jaxx.application.swing.table.MoveToPreviousEditableCellAction; import org.nuiton.jaxx.application.swing.table.MoveToPreviousEditableRowAction; +import javax.swing.AbstractAction; import javax.swing.JTable; import javax.swing.ListSelectionModel; import javax.swing.event.ListSelectionEvent; @@ -181,7 +182,7 @@ public abstract class AbstractTuttiTableUIHandler<R extends AbstractTuttiBeanUIM R newValue = (R) evt.getNewValue(); if (log.isDebugEnabled()) { log.debug("Monitor row changed from " + - oldValue + " to " + newValue); + oldValue + " to " + newValue); } if (oldValue != null) { oldValue.removePropertyChangeListener(l); @@ -204,7 +205,7 @@ public abstract class AbstractTuttiTableUIHandler<R extends AbstractTuttiBeanUIM protected void onModelRowsChanged(List<R> rows) { if (log.isDebugEnabled()) { log.debug("Will set " + (rows == null ? 0 : rows.size()) + - " rows on model."); + " rows on model."); } if (CollectionUtils.isNotEmpty(rows)) { @@ -222,7 +223,7 @@ public abstract class AbstractTuttiTableUIHandler<R extends AbstractTuttiBeanUIM Boolean newValue) { if (log.isDebugEnabled()) { log.debug("row [" + rowIndex + "] modify state changed from " + - oldValue + " to " + newValue); + oldValue + " to " + newValue); } } @@ -233,7 +234,7 @@ public abstract class AbstractTuttiTableUIHandler<R extends AbstractTuttiBeanUIM if (log.isDebugEnabled()) { log.debug("row [" + rowIndex + "] valid state changed from " + - oldValue + " to " + newValue); + oldValue + " to " + newValue); } if (rowIndex > -1) { @@ -247,7 +248,7 @@ public abstract class AbstractTuttiTableUIHandler<R extends AbstractTuttiBeanUIM R newRow) { if (log.isDebugEnabled()) { log.debug("Selected row changed from [" + oldRowIndex + "] to [" + - newRowIndex + "]"); + newRowIndex + "]"); } } @@ -288,7 +289,7 @@ public abstract class AbstractTuttiTableUIHandler<R extends AbstractTuttiBeanUIM Preconditions.checkState( tableSelectionListener == null, "There is already a tableSelectionListener registred, " + - "remove it before invoking this method."); + "remove it before invoking this method."); // create new listener // save when row chaged and was modified @@ -365,24 +366,23 @@ public abstract class AbstractTuttiTableUIHandler<R extends AbstractTuttiBeanUIM } } - protected void installTableKeyListener(TableColumnModel columnModel, - final JTable table) { + protected void installTableKeyListener(TableColumnModel columnModel, final JTable table) { + installTableKeyListener(columnModel, table, true); + } + + protected void installTableKeyListener(TableColumnModel columnModel, JTable table, boolean enterToChangeRow) { Preconditions.checkState( keyAdapters.get(table) == null, "There is already a tableSelectionListener registred, " + - "remove it before invoking this method."); + "remove it before invoking this method."); - final AbstractApplicationTableModel model = (AbstractApplicationTableModel) table.getModel(); - final MoveToNextEditableCellAction nextCellAction = - MoveToNextEditableCellAction.newAction(model, table); - final MoveToPreviousEditableCellAction previousCellAction = - MoveToPreviousEditableCellAction.newAction(model, table); + AbstractApplicationTableModel model = (AbstractApplicationTableModel) table.getModel(); - final MoveToNextEditableRowAction nextRowAction = - MoveToNextEditableRowAction.newAction(model, table); - final MoveToPreviousEditableRowAction previousRowAction = - MoveToPreviousEditableRowAction.newAction(model, table); + MoveToNextEditableCellAction nextCellAction = MoveToNextEditableCellAction.newAction(model, table); + MoveToPreviousEditableCellAction previousCellAction = MoveToPreviousEditableCellAction.newAction(model, table); + MoveToNextEditableRowAction nextRowAction = MoveToNextEditableRowAction.newAction(model, table); + MoveToPreviousEditableRowAction previousRowAction = MoveToPreviousEditableRowAction.newAction(model, table); KeyAdapter keyAdapter = new KeyAdapter() { @@ -391,39 +391,56 @@ public abstract class AbstractTuttiTableUIHandler<R extends AbstractTuttiBeanUIM TableCellEditor editor = table.getCellEditor(); int keyCode = e.getKeyCode(); - if (keyCode == KeyEvent.VK_LEFT || - (keyCode == KeyEvent.VK_TAB && e.isShiftDown())) { - e.consume(); - if (editor != null) { - editor.stopCellEditing(); - } - previousCellAction.actionPerformed(null); + boolean shiftDown = e.isShiftDown(); - } else if (keyCode == KeyEvent.VK_RIGHT || - keyCode == KeyEvent.VK_TAB) { - e.consume(); - if (editor != null) { - editor.stopCellEditing(); - } - nextCellAction.actionPerformed(null); + if (gotoPreviousCell(keyCode, shiftDown)) { - } else if (keyCode == KeyEvent.VK_UP || - (keyCode == KeyEvent.VK_ENTER && e.isShiftDown())) { - e.consume(); - if (editor != null) { - editor.stopCellEditing(); - } - previousRowAction.actionPerformed(null); + consumeAction(e, editor, previousCellAction); - } else if (e.getKeyCode() == KeyEvent.VK_ENTER || - keyCode == KeyEvent.VK_DOWN) { - e.consume(); - if (editor != null) { - editor.stopCellEditing(); - } - nextRowAction.actionPerformed(null); + } else if (gotoNextCell(keyCode)) { + consumeAction(e, editor, nextCellAction); + + } else if (gotoPreviousRow(keyCode, shiftDown)) { + + consumeAction(e, editor, previousRowAction); + + } else if (gotoNextRow(keyCode)) { + + consumeAction(e, editor, nextRowAction); + + } + } + + protected void consumeAction(KeyEvent e, TableCellEditor editor, AbstractAction action) { + e.consume(); + if (editor != null) { + editor.stopCellEditing(); } + action.actionPerformed(null); } + + protected boolean gotoPreviousCell(int keyCode, boolean shiftDown) { + return keyCode == KeyEvent.VK_LEFT + || (keyCode == KeyEvent.VK_TAB && shiftDown) + || (!enterToChangeRow && keyCode == KeyEvent.VK_ENTER && shiftDown); + } + + protected boolean gotoNextCell(int keyCode) { + return keyCode == KeyEvent.VK_RIGHT + || keyCode == KeyEvent.VK_TAB + || (!enterToChangeRow && keyCode == KeyEvent.VK_ENTER); + } + + protected boolean gotoPreviousRow(int keyCode, boolean shiftDown) { + return keyCode == KeyEvent.VK_UP + || (enterToChangeRow && keyCode == KeyEvent.VK_ENTER && shiftDown); + } + + protected boolean gotoNextRow(int keyCode) { + return keyCode == KeyEvent.VK_DOWN + || (enterToChangeRow && keyCode == KeyEvent.VK_ENTER); + } + }; keyAdapters.put(table, keyAdapter); -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository tutti. See https://gitlab.nuiton.org/codelutin/tutti.git commit 0a3db77da3fef3a40ec9b7252b557dd7a0516acd Merge: e4156a9 aad91f9 Author: Tony CHEMIT <chemit@codelutin.com> Date: Tue Apr 12 03:51:14 2016 +0200 Livrable #8230 Merge branch 'feature/8230' into develop .../frequency/SpeciesFrequencyUIHandler.java | 3 +- .../util/table/AbstractTuttiTableUIHandler.java | 109 ++++++++++++--------- 2 files changed, 65 insertions(+), 47 deletions(-) -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
participants (1)
-
codelutin.com scm