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 9149fbce4ea03f2fc03043b36318e57326db2696 Author: Tony CHEMIT <chemit@codelutin.com> Date: Mon Apr 25 15:25:17 2016 +0200 femrer l'écran des mensuration dès que l'on quitte son onglet (See #8272) --- .../operation/catches/EditCatchesUIHandler.java | 75 +++++++++++----------- 1 file changed, 36 insertions(+), 39 deletions(-) diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIHandler.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIHandler.java index 07fbed4..f26682b 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIHandler.java +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIHandler.java @@ -42,6 +42,7 @@ import javax.swing.JComponent; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JTabbedPane; +import java.awt.Component; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.util.Set; @@ -250,6 +251,11 @@ public class EditCatchesUIHandler extends AbstractTuttiTabContainerUIHandler<Edi if (result && currentIndex != newIndex) { + result = blockIfNotLeavingFrequencyScreen(); + if (!result) { + return false; + } + boolean showMainActions; if (currentIndex == 0) { @@ -286,32 +292,10 @@ public class EditCatchesUIHandler extends AbstractTuttiTabContainerUIHandler<Edi closeAttachments(); - //FIXME 20130203 kmorin: cannot change tab if model is modified - // (I do not even know why it is set to modified and have no time - // before the demo) EditCatchesUIModel model = getModel(); - boolean result; - - if (isEditingSpeciesFrequencies()) { - - if (log.isInfoEnabled()) { - log.info("Species frequencies model was modified, ask user confirmation."); - } - result = getUI().getSpeciesTabPanel().getEditFrequenciesUI().leaveIfConfirmed(); - if( !result) { - return false; - } - } - - if (isEditingBenthosFrequencies()) { - - if (log.isInfoEnabled()) { - log.info("Benthos frequencies model was modified, ask user confirmation."); - } - result = getUI().getBenthosTabPanel().getEditFrequenciesUI().leaveIfConfirmed(); - if( !result) { - return false; - } + boolean result = blockIfNotLeavingFrequencyScreen(); + if (!result) { + return false; } if (model.isModify()) { @@ -501,35 +485,48 @@ public class EditCatchesUIHandler extends AbstractTuttiTabContainerUIHandler<Edi } - public boolean isEditingSpeciesFrequencies() { + private boolean blockIfNotLeavingFrequencyScreen() { - boolean result = false; + Component selectedComponent = getUI().getTabPane().getSelectedComponent(); - boolean speciesTabSelected = getUI().getSpeciesTabPanel().equals(getUI().getTabPane().getSelectedComponent()); + if (selectedComponent != null) { - if (speciesTabSelected) { + EditSpeciesBatchPanelUI speciesTabPanel = getUI().getSpeciesTabPanel(); + EditSpeciesBatchPanelUI benthosTabPanel = getUI().getBenthosTabPanel(); - result = getUI().getSpeciesTabPanel().getTopPanelLayout().getSelected().equals(EditSpeciesBatchPanelUI.EDIT_FREQUENCY_CARD); + if (speciesTabPanel.equals(selectedComponent)) { - } + if (EditSpeciesBatchPanelUI.EDIT_FREQUENCY_CARD.equals(speciesTabPanel.getTopPanelLayout().getSelected())) { - return result; + if (log.isInfoEnabled()) { + log.info("Species frequencies screen on, try to leave it."); + } + boolean canContinue = speciesTabPanel.getEditFrequenciesUI().leaveIfConfirmed(); + if (!canContinue) { + return false; + } - } + } - public boolean isEditingBenthosFrequencies() { + } else if (benthosTabPanel.equals(selectedComponent)) { - boolean result = false; + if (EditSpeciesBatchPanelUI.EDIT_FREQUENCY_CARD.equals(benthosTabPanel.getTopPanelLayout().getSelected())) { - boolean speciesTabSelected = getUI().getBenthosTabPanel().equals(getUI().getTabPane().getSelectedComponent()); + if (log.isInfoEnabled()) { + log.info("Benthos frequencies screen on, try to leave it."); + } + boolean canContinue = benthosTabPanel.getEditFrequenciesUI().leaveIfConfirmed(); + if (!canContinue) { + return false; + } - if (speciesTabSelected) { + } - result = getUI().getBenthosTabPanel().getTopPanelLayout().getSelected().equals(EditSpeciesBatchPanelUI.EDIT_FREQUENCY_CARD); + } } - return result; + return true; } -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.