branch develop updated (6a3a870 -> 43d2cac)
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 6a3a870 inversion du chargement des observations et du changement de mode pour que les lignes soient validées avec le bon mode de copie new f1f2086 - passage à jaxx 2.29 - désactivation de la suppresion des maturités sélectionnées si elles sont utilisées (RAF : gérer la suppression des lignes d'espèce ou de benthos) (refs #8238) new 4abf531 - Quand on supprime des lignes d'espece ou benthos du protocole, on enlève leur maturité des maturités utilisées. - On met à jour l'état des boutons de la double liste de maturité quand on arrive sur l'onglet des caractéristiques. Sinon, si la maturité sélectionné a été ajoutée ou supprimée, le bouton n'est plus dans le bon état. fixes #8238 new 66878ed idem pour les classes de taille (fixes #8238) new e0bb2d6 Revue de code et suppression de code statique et pas très jolie à regarder :( (See #8238) new 7f024b9 up-up-up libraries new 43d2cac Livrable #8238 Merge branch 'feature/8238' into develop The 6 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 43d2cac35bf3ddeb7a386e665978e892224fe487 Merge: 6a3a870 7f024b9 Author: Tony CHEMIT <chemit@codelutin.com> Date: Wed Apr 27 20:04:11 2016 +0200 Livrable #8238 Merge branch 'feature/8238' into develop commit 7f024b9f589d6d0bd9c6ad5b3f1e3470f0328642 Author: Tony CHEMIT <chemit@codelutin.com> Date: Wed Apr 27 20:04:06 2016 +0200 up-up-up libraries commit e0bb2d6e3f2fc3685dd06ef39c7dd26e24b5fedd Author: Tony CHEMIT <chemit@codelutin.com> Date: Wed Apr 27 18:57:23 2016 +0200 Revue de code et suppression de code statique et pas très jolie à regarder :( (See #8238) commit 66878ed0b38bc52d539def0ccd2e8bdef8d3ca61 Author: Kevin Morin <morin@codelutin.com> Date: Mon Apr 25 18:43:59 2016 +0200 idem pour les classes de taille (fixes #8238) commit 4abf5315dc0036980e3ec7cd9528ff4e03de42d2 Author: Kevin Morin <morin@codelutin.com> Date: Mon Apr 25 17:48:36 2016 +0200 - Quand on supprime des lignes d'espece ou benthos du protocole, on enlève leur maturité des maturités utilisées. - On met à jour l'état des boutons de la double liste de maturité quand on arrive sur l'onglet des caractéristiques. Sinon, si la maturité sélectionné a été ajoutée ou supprimée, le bouton n'est plus dans le bon état. fixes #8238 commit f1f20868bfaa7d2fb18f8d964afcfdcb8a89fc5a Author: Kevin Morin <morin@codelutin.com> Date: Fri Apr 22 15:44:36 2016 +0200 - passage à jaxx 2.29 - désactivation de la suppresion des maturités sélectionnées si elles sont utilisées (RAF : gérer la suppression des lignes d'espèce ou de benthos) (refs #8238) Summary of changes: pom.xml | 14 +- .../content/protocol/CaracteristicsCount.java | 81 ++++++++++ .../protocol/EditProtocolSpeciesTableModel.java | 38 +---- .../content/protocol/EditProtocolUIHandler.java | 176 ++++++++++++--------- .../content/protocol/EditProtocolUIModel.java | 67 +++++++- .../actions/RemoveBenthosProtocolAction.java | 18 ++- .../actions/RemoveSpeciesProtocolAction.java | 18 ++- 7 files changed, 292 insertions(+), 120 deletions(-) create mode 100644 tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/CaracteristicsCount.java -- 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 f1f20868bfaa7d2fb18f8d964afcfdcb8a89fc5a Author: Kevin Morin <morin@codelutin.com> Date: Fri Apr 22 15:44:36 2016 +0200 - passage à jaxx 2.29 - désactivation de la suppresion des maturités sélectionnées si elles sont utilisées (RAF : gérer la suppression des lignes d'espèce ou de benthos) (refs #8238) --- pom.xml | 2 +- .../protocol/EditProtocolSpeciesTableModel.java | 30 ++++++++++++++++++++++ .../content/protocol/EditProtocolUIHandler.java | 14 ++++++++-- 3 files changed, 43 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index b68d3ea..15d4871 100644 --- a/pom.xml +++ b/pom.xml @@ -128,7 +128,7 @@ <nuitonI18nVersion>3.4.1</nuitonI18nVersion> <nuitonValidatorVersion>3.0</nuitonValidatorVersion> <eugenePluginVersion>2.14</eugenePluginVersion> - <jaxxVersion>2.28.2</jaxxVersion> + <jaxxVersion>2.29-SNAPSHOT</jaxxVersion> <swingXVersion>1.6.4</swingXVersion> <slf4jVersion>1.7.13</slf4jVersion> <!-- Can't use now adagio previous to 3.9.1 after this version --> diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolSpeciesTableModel.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolSpeciesTableModel.java index 4b0e7ee..3c0ab77 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolSpeciesTableModel.java +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolSpeciesTableModel.java @@ -24,11 +24,14 @@ package fr.ifremer.tutti.ui.swing.content.protocol; import com.google.common.collect.Lists; import fr.ifremer.tutti.persistence.entities.data.SampleCategoryModel; +import fr.ifremer.tutti.persistence.entities.referential.Caracteristic; import fr.ifremer.tutti.persistence.entities.referential.Species; import org.jdesktop.swingx.table.TableColumnModelExt; import org.nuiton.jaxx.application.swing.table.AbstractApplicationTableModel; import org.nuiton.jaxx.application.swing.table.ColumnIdentifier; +import java.util.ArrayList; +import java.util.Collection; import java.util.List; import static org.nuiton.i18n.I18n.n; @@ -81,6 +84,9 @@ public class EditProtocolSpeciesTableModel extends AbstractApplicationTableModel protected final SampleCategoryModel sampleCategoryModel; + // FIXME check if ok to add benthos AND species together + private static final List<Caracteristic> maturitiesUsed = new ArrayList<>(); + private static final long serialVersionUID = 1L; public EditProtocolSpeciesTableModel(SampleCategoryModel sampleCategoryModel, @@ -88,6 +94,16 @@ public class EditProtocolSpeciesTableModel extends AbstractApplicationTableModel super(columnModel, false, false); this.sampleCategoryModel = sampleCategoryModel; setNoneEditableCols(SPECIES_ID); + +// addTableModelListener(new TableModelListener() { +// +// @Override +// public void tableChanged(TableModelEvent e) { +// if (e.getType() == TableModelEvent.DELETE) { +// e.getFirstRow(); +// } +// } +// }); } public static EditProtocolSpeciesRowModel newRow(SampleCategoryModel sampleCategoryModel) { @@ -116,6 +132,17 @@ public class EditProtocolSpeciesTableModel extends AbstractApplicationTableModel }); + //FIXME gérer les maturités des lignes suprpimées + result.addPropertyChangeListener(EditProtocolSpeciesRowModel.PROPERTY_MATURITY_PMFM, + evt -> { + if (evt.getOldValue() != null) { + maturitiesUsed.remove(evt.getOldValue()); + } + if (evt.getNewValue() != null) { + maturitiesUsed.add((Caracteristic) evt.getNewValue()); + } + }); + return result; } @@ -170,4 +197,7 @@ public class EditProtocolSpeciesTableModel extends AbstractApplicationTableModel return result; } + public static boolean isNoneOfTheMaturitiesUsed(Collection<Caracteristic> caracteristics) { + return maturitiesUsed.stream().noneMatch(caracteristics::contains); + } } diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUIHandler.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUIHandler.java index bfeca14..ef52875 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUIHandler.java +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUIHandler.java @@ -551,6 +551,9 @@ public class EditProtocolUIHandler extends AbstractTuttiUIHandler<EditProtocolUI model.getCaracteristics().stream().filter(caracteristic -> !caracteristic.isQualitativeValueEmpty()).collect(Collectors.toList()), model.getMaturityPmfmId()); + maturityList.getModel().addCanRemoveItemsPredicate( + input -> EditProtocolSpeciesTableModel.isNoneOfTheMaturitiesUsed(maturityList.getSelectedList().getSelectedValuesList())); + JMenuItem editMaturity = ui.getEditMaturityCaracteristicAction(); maturityList.getSelectedListPopup().add(editMaturity); @@ -1662,11 +1665,18 @@ public class EditProtocolUIHandler extends AbstractTuttiUIHandler<EditProtocolUI public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { Component result = defaultRenderer.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); Caracteristic maturityCaracteristic = (Caracteristic) value; + + Color backgroud; if (!EditProtocolUIHandler.this.getModel().isMaturityValid(maturityCaracteristic)) { - result.setBackground(invalidColor); + backgroud= invalidColor; } else { - result.setBackground(validColor); + backgroud = validColor; } + if (isSelected) { + backgroud = backgroud.darker(); + } + result.setBackground(backgroud); + if (result instanceof JComponent) { ((JComponent) result).setToolTipText(createToolTipText(maturityCaracteristic)); -- 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 4abf5315dc0036980e3ec7cd9528ff4e03de42d2 Author: Kevin Morin <morin@codelutin.com> Date: Mon Apr 25 17:48:36 2016 +0200 - Quand on supprime des lignes d'espece ou benthos du protocole, on enlève leur maturité des maturités utilisées. - On met à jour l'état des boutons de la double liste de maturité quand on arrive sur l'onglet des caractéristiques. Sinon, si la maturité sélectionné a été ajoutée ou supprimée, le bouton n'est plus dans le bon état. fixes #8238 --- .../protocol/EditProtocolSpeciesTableModel.java | 42 ++++++++++++++++------ .../content/protocol/EditProtocolUIHandler.java | 16 ++++++++- .../actions/RemoveBenthosProtocolAction.java | 5 +++ .../actions/RemoveSpeciesProtocolAction.java | 5 +++ 4 files changed, 56 insertions(+), 12 deletions(-) diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolSpeciesTableModel.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolSpeciesTableModel.java index 3c0ab77..936aab4 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolSpeciesTableModel.java +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolSpeciesTableModel.java @@ -95,15 +95,6 @@ public class EditProtocolSpeciesTableModel extends AbstractApplicationTableModel this.sampleCategoryModel = sampleCategoryModel; setNoneEditableCols(SPECIES_ID); -// addTableModelListener(new TableModelListener() { -// -// @Override -// public void tableChanged(TableModelEvent e) { -// if (e.getType() == TableModelEvent.DELETE) { -// e.getFirstRow(); -// } -// } -// }); } public static EditProtocolSpeciesRowModel newRow(SampleCategoryModel sampleCategoryModel) { @@ -135,11 +126,12 @@ public class EditProtocolSpeciesTableModel extends AbstractApplicationTableModel //FIXME gérer les maturités des lignes suprpimées result.addPropertyChangeListener(EditProtocolSpeciesRowModel.PROPERTY_MATURITY_PMFM, evt -> { + // update the used maturities if (evt.getOldValue() != null) { - maturitiesUsed.remove(evt.getOldValue()); + removeUsedMaturity((Caracteristic) evt.getOldValue()); } if (evt.getNewValue() != null) { - maturitiesUsed.add((Caracteristic) evt.getNewValue()); + addUsedMaturity((Caracteristic) evt.getNewValue()); } }); @@ -197,7 +189,35 @@ public class EditProtocolSpeciesTableModel extends AbstractApplicationTableModel return result; } + // operations on the used maturities + + public static void addUsedMaturity(Caracteristic maturity) { + maturitiesUsed.add(maturity); + } + + public static void removeUsedMaturity(Caracteristic maturity) { + maturitiesUsed.remove(maturity); + } + + public static void removeUsedMaturities(Collection<Caracteristic> maturities) { + maturitiesUsed.removeAll(maturities); + } + + /** + * Check if the caracteristics are used in the maturity caracteristics of the species or benthos + * @param caracteristics the list of caracteristics to check + * @return true if none of the maturities are used + */ public static boolean isNoneOfTheMaturitiesUsed(Collection<Caracteristic> caracteristics) { return maturitiesUsed.stream().noneMatch(caracteristics::contains); } + + /** + * Check if the caracteristic is used in the maturity caracteristics of the species or benthos + * @param caracteristic the caracteristic to check + * @return true if the maturity is used + */ + public static boolean isMaturityUsed(Caracteristic caracteristic) { + return maturitiesUsed.contains(caracteristic); + } } diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUIHandler.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUIHandler.java index ef52875..58ea42d 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUIHandler.java +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUIHandler.java @@ -554,6 +554,15 @@ public class EditProtocolUIHandler extends AbstractTuttiUIHandler<EditProtocolUI maturityList.getModel().addCanRemoveItemsPredicate( input -> EditProtocolSpeciesTableModel.isNoneOfTheMaturitiesUsed(maturityList.getSelectedList().getSelectedValuesList())); + // update maturity list button states when the user goes back to the caracteristic panel + // to update the remove state in case the selected maturity has been added or removed from the species or benthos + ui.getTabPanel().addChangeListener(e -> { + JTabbedPane source = (JTabbedPane) e.getSource(); + if (ui.getCaracteristicPanel().equals(source.getSelectedComponent())) { + maturityList.getHandler().recomputeButtonStates(); + } + }); + JMenuItem editMaturity = ui.getEditMaturityCaracteristicAction(); maturityList.getSelectedListPopup().add(editMaturity); @@ -1657,6 +1666,8 @@ public class EditProtocolUIHandler extends AbstractTuttiUIHandler<EditProtocolUI private Color invalidColor = getConfig().getColorRowInvalid(); + private Color notRemovableColor = getConfig().getColorWarningRow(); + MaturityCaracteristicCellRenderer(ListCellRenderer defaultRenderer) { this.defaultRenderer = defaultRenderer; } @@ -1667,7 +1678,10 @@ public class EditProtocolUIHandler extends AbstractTuttiUIHandler<EditProtocolUI Caracteristic maturityCaracteristic = (Caracteristic) value; Color backgroud; - if (!EditProtocolUIHandler.this.getModel().isMaturityValid(maturityCaracteristic)) { + if (isSelected && EditProtocolSpeciesTableModel.isMaturityUsed((Caracteristic) value)) { + backgroud= notRemovableColor; + + } else if (!EditProtocolUIHandler.this.getModel().isMaturityValid(maturityCaracteristic)) { backgroud= invalidColor; } else { backgroud = validColor; diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/actions/RemoveBenthosProtocolAction.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/actions/RemoveBenthosProtocolAction.java index ea0a8d5..0568fe2 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/actions/RemoveBenthosProtocolAction.java +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/actions/RemoveBenthosProtocolAction.java @@ -153,6 +153,11 @@ public class RemoveBenthosProtocolAction extends LongActionSupport<EditProtocolU // remove all rows from model getModel().getBenthosRow().removeAll(removedRows); + // remove the maturities of the rows from the used maturities + EditProtocolSpeciesTableModel.removeUsedMaturities(removedRows.stream() + .map(EditProtocolSpeciesRowModel::getMaturityPmfm) + .collect(Collectors.toList())); + // remove the protocolSpecies from the cps table or combobox if (!cpsRowsToDelete.isEmpty()) { handler.deleteCpsRows(cpsRowsToDelete); diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/actions/RemoveSpeciesProtocolAction.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/actions/RemoveSpeciesProtocolAction.java index e9bff10..049f602 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/actions/RemoveSpeciesProtocolAction.java +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/actions/RemoveSpeciesProtocolAction.java @@ -150,6 +150,11 @@ public class RemoveSpeciesProtocolAction extends LongActionSupport<EditProtocolU // remove all rows from model getModel().getSpeciesRow().removeAll(removedRows); + // remove the maturities of the rows from the used maturities + EditProtocolSpeciesTableModel.removeUsedMaturities(removedRows.stream() + .map(EditProtocolSpeciesRowModel::getMaturityPmfm) + .collect(Collectors.toList())); + // remove the protocolSpecies from the cps table or combobox if (!cpsRowsToDelete.isEmpty()) { handler.deleteCpsRows(cpsRowsToDelete); -- 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 66878ed0b38bc52d539def0ccd2e8bdef8d3ca61 Author: Kevin Morin <morin@codelutin.com> Date: Mon Apr 25 18:43:59 2016 +0200 idem pour les classes de taille (fixes #8238) --- .../protocol/EditProtocolSpeciesTableModel.java | 69 +++++++++++++++++----- .../content/protocol/EditProtocolUIHandler.java | 65 +++++++++++++++----- .../actions/RemoveBenthosProtocolAction.java | 8 ++- .../actions/RemoveSpeciesProtocolAction.java | 7 ++- 4 files changed, 115 insertions(+), 34 deletions(-) diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolSpeciesTableModel.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolSpeciesTableModel.java index 936aab4..356e7ba 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolSpeciesTableModel.java +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolSpeciesTableModel.java @@ -85,7 +85,8 @@ public class EditProtocolSpeciesTableModel extends AbstractApplicationTableModel protected final SampleCategoryModel sampleCategoryModel; // FIXME check if ok to add benthos AND species together - private static final List<Caracteristic> maturitiesUsed = new ArrayList<>(); + private static final List<Caracteristic> lengthStepPmfmUsed = new ArrayList<>(); + private static final List<Caracteristic> maturitiesPmfmUsed = new ArrayList<>(); private static final long serialVersionUID = 1L; @@ -111,7 +112,10 @@ public class EditProtocolSpeciesTableModel extends AbstractApplicationTableModel result.addPropertyChangeListener(EditProtocolSpeciesRowModel.PROPERTY_LENGTH_STEP_PMFM, evt -> { - + // update the used lengthstep caracteristic + if (evt.getOldValue() != null) { + removeUsedLengthStepPmfm((Caracteristic) evt.getOldValue()); + } if (evt.getNewValue() == null) { EditProtocolSpeciesRowModel rowModel = (EditProtocolSpeciesRowModel) evt.getSource(); @@ -119,19 +123,20 @@ public class EditProtocolSpeciesTableModel extends AbstractApplicationTableModel rowModel.setRtpFemale(null); rowModel.setRtpUndefined(null); + } else { + addUsedLengthStepPmfm((Caracteristic) evt.getNewValue()); } }); - //FIXME gérer les maturités des lignes suprpimées result.addPropertyChangeListener(EditProtocolSpeciesRowModel.PROPERTY_MATURITY_PMFM, evt -> { // update the used maturities if (evt.getOldValue() != null) { - removeUsedMaturity((Caracteristic) evt.getOldValue()); + removeUsedMaturityPmfm((Caracteristic) evt.getOldValue()); } if (evt.getNewValue() != null) { - addUsedMaturity((Caracteristic) evt.getNewValue()); + addUsedMaturityPmfm((Caracteristic) evt.getNewValue()); } }); @@ -189,18 +194,50 @@ public class EditProtocolSpeciesTableModel extends AbstractApplicationTableModel return result; } - // operations on the used maturities + // operations on the used lengthstep pmfms + + public static void addUsedLengthStepPmfm(Caracteristic maturity) { + lengthStepPmfmUsed.add(maturity); + } + + public static void removeUsedLengthStepPmfm(Caracteristic maturity) { + lengthStepPmfmUsed.remove(maturity); + } + + public static void removeUsedLengthStepPmfms(Collection<Caracteristic> maturities) { + lengthStepPmfmUsed.removeAll(maturities); + } + + /** + * Check if the caracteristics are used in the maturity caracteristics of the species or benthos + * @param caracteristics the list of caracteristics to check + * @return true if none of the maturities are used + */ + public static boolean isNoneOfTheLengthStepPmfmsUsed(Collection<Caracteristic> caracteristics) { + return lengthStepPmfmUsed.stream().noneMatch(caracteristics::contains); + } + + /** + * Check if the caracteristic is used in the maturity caracteristics of the species or benthos + * @param caracteristic the caracteristic to check + * @return true if the maturity is used + */ + public static boolean isLengthStepPmfmUsed(Caracteristic caracteristic) { + return lengthStepPmfmUsed.contains(caracteristic); + } + + // operations on the used maturity pfmfs - public static void addUsedMaturity(Caracteristic maturity) { - maturitiesUsed.add(maturity); + public static void addUsedMaturityPmfm(Caracteristic maturity) { + maturitiesPmfmUsed.add(maturity); } - public static void removeUsedMaturity(Caracteristic maturity) { - maturitiesUsed.remove(maturity); + public static void removeUsedMaturityPmfm(Caracteristic maturity) { + maturitiesPmfmUsed.remove(maturity); } - public static void removeUsedMaturities(Collection<Caracteristic> maturities) { - maturitiesUsed.removeAll(maturities); + public static void removeUsedMaturityPmfms(Collection<Caracteristic> maturities) { + maturitiesPmfmUsed.removeAll(maturities); } /** @@ -208,8 +245,8 @@ public class EditProtocolSpeciesTableModel extends AbstractApplicationTableModel * @param caracteristics the list of caracteristics to check * @return true if none of the maturities are used */ - public static boolean isNoneOfTheMaturitiesUsed(Collection<Caracteristic> caracteristics) { - return maturitiesUsed.stream().noneMatch(caracteristics::contains); + public static boolean isNoneOfTheMaturityPmfmsUsed(Collection<Caracteristic> caracteristics) { + return maturitiesPmfmUsed.stream().noneMatch(caracteristics::contains); } /** @@ -217,7 +254,7 @@ public class EditProtocolSpeciesTableModel extends AbstractApplicationTableModel * @param caracteristic the caracteristic to check * @return true if the maturity is used */ - public static boolean isMaturityUsed(Caracteristic caracteristic) { - return maturitiesUsed.contains(caracteristic); + public static boolean isMaturityPmfmUsed(Caracteristic caracteristic) { + return maturitiesPmfmUsed.contains(caracteristic); } } diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUIHandler.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUIHandler.java index 58ea42d..b00f796 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUIHandler.java +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUIHandler.java @@ -530,17 +530,26 @@ public class EditProtocolUIHandler extends AbstractTuttiUIHandler<EditProtocolUI } BeanDoubleList<Caracteristic> maturityList = this.ui.getMaturityList(); + BeanDoubleList<Caracteristic> lengthClassesList = this.ui.getLengthClassesList(); + allDoubleLists = Lists.newArrayList( - this.ui.getLengthClassesList(), + lengthClassesList, this.ui.getIndividualObservationList(), maturityList ); initDoubleList(EditProtocolUIModel.PROPERTY_LENGTH_CLASSES_PMFM_ID, - this.ui.getLengthClassesList(), + lengthClassesList, Lists.newArrayList(model.getCaracteristics()), model.getLengthClassesPmfmId()); + JList lengthClassesSelectedList = lengthClassesList.getSelectedList(); + lengthClassesList.getModel().addCanRemoveItemsPredicate( + input -> EditProtocolSpeciesTableModel.isNoneOfTheLengthStepPmfmsUsed(lengthClassesSelectedList.getSelectedValuesList())); + + ListCellRenderer lengthClassesDefaultRenderer = lengthClassesSelectedList.getCellRenderer(); + lengthClassesSelectedList.setCellRenderer(new LengthStepCaracteristicCellRenderer(lengthClassesDefaultRenderer)); + initDoubleList(EditProtocolUIModel.PROPERTY_INDIVIDUAL_OBSERVATION_PMFM_ID, this.ui.getIndividualObservationList(), Lists.newArrayList(model.getCaracteristics()), @@ -551,30 +560,32 @@ public class EditProtocolUIHandler extends AbstractTuttiUIHandler<EditProtocolUI model.getCaracteristics().stream().filter(caracteristic -> !caracteristic.isQualitativeValueEmpty()).collect(Collectors.toList()), model.getMaturityPmfmId()); + JList maturitySelectedList = maturityList.getSelectedList(); maturityList.getModel().addCanRemoveItemsPredicate( - input -> EditProtocolSpeciesTableModel.isNoneOfTheMaturitiesUsed(maturityList.getSelectedList().getSelectedValuesList())); - - // update maturity list button states when the user goes back to the caracteristic panel - // to update the remove state in case the selected maturity has been added or removed from the species or benthos - ui.getTabPanel().addChangeListener(e -> { - JTabbedPane source = (JTabbedPane) e.getSource(); - if (ui.getCaracteristicPanel().equals(source.getSelectedComponent())) { - maturityList.getHandler().recomputeButtonStates(); - } - }); + input -> EditProtocolSpeciesTableModel.isNoneOfTheMaturityPmfmsUsed(maturityList.getSelectedList().getSelectedValuesList())); JMenuItem editMaturity = ui.getEditMaturityCaracteristicAction(); maturityList.getSelectedListPopup().add(editMaturity); // add listener to enable the maturity edition - JList maturitySelectedList = maturityList.getSelectedList(); maturitySelectedList.addListSelectionListener(e -> { boolean editMaturityEnabled = maturitySelectedList.getSelectedIndices().length == 1; editMaturity.setEnabled(editMaturityEnabled); }); - ListCellRenderer defaultRenderer = maturitySelectedList.getCellRenderer(); - maturitySelectedList.setCellRenderer(new MaturityCaracteristicCellRenderer(defaultRenderer)); + ListCellRenderer maturityDefaultRenderer = maturitySelectedList.getCellRenderer(); + maturitySelectedList.setCellRenderer(new MaturityCaracteristicCellRenderer(maturityDefaultRenderer)); + + + // update lengthstep and maturity list button states when the user goes back to the caracteristic panel + // to update the remove state in case the selected maturity has been added or removed from the species or benthos + ui.getTabPanel().addChangeListener(e -> { + JTabbedPane source = (JTabbedPane) e.getSource(); + if (ui.getCaracteristicPanel().equals(source.getSelectedComponent())) { + lengthClassesList.getHandler().recomputeButtonStates(); + maturityList.getHandler().recomputeButtonStates(); + } + }); // init caracteristics mappingtable { @@ -1656,6 +1667,28 @@ public class EditProtocolUIHandler extends AbstractTuttiUIHandler<EditProtocolUI } + private class LengthStepCaracteristicCellRenderer implements ListCellRenderer { + + private final ListCellRenderer defaultRenderer; + + private Color notRemovableColor = getConfig().getColorWarningRow(); + + LengthStepCaracteristicCellRenderer(ListCellRenderer defaultRenderer) { + this.defaultRenderer = defaultRenderer; + } + + @Override + public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { + Component result = defaultRenderer.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); + Caracteristic caracteristic = (Caracteristic) value; + + if (isSelected && EditProtocolSpeciesTableModel.isLengthStepPmfmUsed(caracteristic)) { + result.setBackground(notRemovableColor.darker()); + } + return result; + } + } + private class MaturityCaracteristicCellRenderer implements ListCellRenderer { public static final String TEXT_PATTERN = "<html><body><strong>%s</strong> :<ul><li>%s</li></ul><strong>%s</strong> :<ul><li>%s</li></ul></body></html>"; @@ -1678,7 +1711,7 @@ public class EditProtocolUIHandler extends AbstractTuttiUIHandler<EditProtocolUI Caracteristic maturityCaracteristic = (Caracteristic) value; Color backgroud; - if (isSelected && EditProtocolSpeciesTableModel.isMaturityUsed((Caracteristic) value)) { + if (isSelected && EditProtocolSpeciesTableModel.isMaturityPmfmUsed(maturityCaracteristic)) { backgroud= notRemovableColor; } else if (!EditProtocolUIHandler.this.getModel().isMaturityValid(maturityCaracteristic)) { diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/actions/RemoveBenthosProtocolAction.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/actions/RemoveBenthosProtocolAction.java index 0568fe2..171f7d4 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/actions/RemoveBenthosProtocolAction.java +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/actions/RemoveBenthosProtocolAction.java @@ -153,8 +153,14 @@ public class RemoveBenthosProtocolAction extends LongActionSupport<EditProtocolU // remove all rows from model getModel().getBenthosRow().removeAll(removedRows); + + // remove the lengthstep pmfm of the rows from the used lengthstep pmfm + EditProtocolSpeciesTableModel.removeUsedLengthStepPmfms(removedRows.stream() + .map(EditProtocolSpeciesRowModel::getLengthStepPmfm) + .collect(Collectors.toList())); + // remove the maturities of the rows from the used maturities - EditProtocolSpeciesTableModel.removeUsedMaturities(removedRows.stream() + EditProtocolSpeciesTableModel.removeUsedMaturityPmfms(removedRows.stream() .map(EditProtocolSpeciesRowModel::getMaturityPmfm) .collect(Collectors.toList())); diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/actions/RemoveSpeciesProtocolAction.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/actions/RemoveSpeciesProtocolAction.java index 049f602..7bd7624 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/actions/RemoveSpeciesProtocolAction.java +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/actions/RemoveSpeciesProtocolAction.java @@ -150,8 +150,13 @@ public class RemoveSpeciesProtocolAction extends LongActionSupport<EditProtocolU // remove all rows from model getModel().getSpeciesRow().removeAll(removedRows); + // remove the lengthstep pmfm of the rows from the used lengthstep pmfm + EditProtocolSpeciesTableModel.removeUsedLengthStepPmfms(removedRows.stream() + .map(EditProtocolSpeciesRowModel::getLengthStepPmfm) + .collect(Collectors.toList())); + // remove the maturities of the rows from the used maturities - EditProtocolSpeciesTableModel.removeUsedMaturities(removedRows.stream() + EditProtocolSpeciesTableModel.removeUsedMaturityPmfms(removedRows.stream() .map(EditProtocolSpeciesRowModel::getMaturityPmfm) .collect(Collectors.toList())); -- 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 e0bb2d6e3f2fc3685dd06ef39c7dd26e24b5fedd Author: Tony CHEMIT <chemit@codelutin.com> Date: Wed Apr 27 18:57:23 2016 +0200 Revue de code et suppression de code statique et pas très jolie à regarder :( (See #8238) --- .../content/protocol/CaracteristicsCount.java | 81 +++++++++++ .../protocol/EditProtocolSpeciesTableModel.java | 125 +---------------- .../content/protocol/EditProtocolUIHandler.java | 151 ++++++++------------- .../content/protocol/EditProtocolUIModel.java | 67 ++++++++- .../actions/RemoveBenthosProtocolAction.java | 21 +-- .../actions/RemoveSpeciesProtocolAction.java | 20 +-- 6 files changed, 236 insertions(+), 229 deletions(-) diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/CaracteristicsCount.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/CaracteristicsCount.java new file mode 100644 index 0000000..ab643d9 --- /dev/null +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/CaracteristicsCount.java @@ -0,0 +1,81 @@ +package fr.ifremer.tutti.ui.swing.content.protocol; + +import com.google.common.base.Predicate; +import fr.ifremer.tutti.persistence.entities.referential.Caracteristic; +import jaxx.runtime.swing.editor.bean.BeanDoubleList; +import org.apache.commons.lang3.mutable.MutableInt; + +import javax.swing.JList; +import java.util.Collection; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.TreeMap; + +/** + * Un compteur de caractéristiques. + * + * Created on 27/04/16. + * + * @author Tony Chemit - chemit@codelutin.com + * @since 4.5 + */ +public class CaracteristicsCount { + + public void attachPredicateToUi(BeanDoubleList<Caracteristic> ui) { + Predicate<List<Caracteristic>> listPredicate = input -> { + JList<Caracteristic> selectedList = ui.getSelectedList(); + List<Caracteristic> selectedValuesList = selectedList.getSelectedValuesList(); + for (Caracteristic caracteristic : selectedValuesList) { + if (isCaracteristicUsed(caracteristic)) { + return false; + } + } + return true; + }; + ui.getModel().addCanRemoveItemsPredicate(listPredicate); + + } + + private final MutableInt ZERO = new MutableInt(); + + private final Map<Integer, MutableInt> counts = new TreeMap<>(); + + public boolean isCaracteristicUsed(Caracteristic caracteristic) { + Objects.requireNonNull(caracteristic); + MutableInt result = counts.getOrDefault(caracteristic.getIdAsInt(), ZERO); + return result.intValue() > 0; + } + + public void addCaracteristic(Caracteristic caracteristic) { + Objects.requireNonNull(caracteristic); + counts.compute(caracteristic.getIdAsInt(), (k, v) -> { + if (v == null) { + return new MutableInt(1); + } else { + v.increment(); + return v; + } + }); + + } + + public void removeCaracteristic(Caracteristic caracteristic) { + Objects.requireNonNull(caracteristic); + counts.compute(caracteristic.getIdAsInt(), (k, v) -> { + if (v == null || v.intValue() == 1) { + return null; + } else { + v.decrement(); + return v; + } + }); + + } + + public void removeCaracteristics(Collection<Caracteristic> caracteristics) { + Objects.requireNonNull(caracteristics); + caracteristics.forEach(this::removeCaracteristic); + } + +} diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolSpeciesTableModel.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolSpeciesTableModel.java index 356e7ba..2e909d9 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolSpeciesTableModel.java +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolSpeciesTableModel.java @@ -23,16 +23,13 @@ package fr.ifremer.tutti.ui.swing.content.protocol; */ import com.google.common.collect.Lists; -import fr.ifremer.tutti.persistence.entities.data.SampleCategoryModel; -import fr.ifremer.tutti.persistence.entities.referential.Caracteristic; import fr.ifremer.tutti.persistence.entities.referential.Species; import org.jdesktop.swingx.table.TableColumnModelExt; import org.nuiton.jaxx.application.swing.table.AbstractApplicationTableModel; import org.nuiton.jaxx.application.swing.table.ColumnIdentifier; -import java.util.ArrayList; -import java.util.Collection; import java.util.List; +import java.util.function.Supplier; import static org.nuiton.i18n.I18n.n; @@ -82,70 +79,21 @@ public class EditProtocolSpeciesTableModel extends AbstractApplicationTableModel n("tutti.editProtocol.table.header.useRtp"), n("tutti.editProtocol.table.header.useRtp.tip")); - protected final SampleCategoryModel sampleCategoryModel; - - // FIXME check if ok to add benthos AND species together - private static final List<Caracteristic> lengthStepPmfmUsed = new ArrayList<>(); - private static final List<Caracteristic> maturitiesPmfmUsed = new ArrayList<>(); + protected final Supplier<EditProtocolSpeciesRowModel> rowSupplier; private static final long serialVersionUID = 1L; - public EditProtocolSpeciesTableModel(SampleCategoryModel sampleCategoryModel, + public EditProtocolSpeciesTableModel(Supplier<EditProtocolSpeciesRowModel> rowSupplier, TableColumnModelExt columnModel) { super(columnModel, false, false); - this.sampleCategoryModel = sampleCategoryModel; + this.rowSupplier = rowSupplier; setNoneEditableCols(SPECIES_ID); } - public static EditProtocolSpeciesRowModel newRow(SampleCategoryModel sampleCategoryModel) { - EditProtocolSpeciesRowModel result = new EditProtocolSpeciesRowModel(); - - List<Integer> mandatoryIds = - Lists.newArrayList(sampleCategoryModel.getSamplingOrder()); - // always remove the first category (V/HV) - mandatoryIds.remove(0); - result.setMandatorySampleCategoryId(mandatoryIds); - - result.setWeightEnabled(true); - result.setValid(true); - - result.addPropertyChangeListener(EditProtocolSpeciesRowModel.PROPERTY_LENGTH_STEP_PMFM, - evt -> { - // update the used lengthstep caracteristic - if (evt.getOldValue() != null) { - removeUsedLengthStepPmfm((Caracteristic) evt.getOldValue()); - } - if (evt.getNewValue() == null) { - - EditProtocolSpeciesRowModel rowModel = (EditProtocolSpeciesRowModel) evt.getSource(); - rowModel.setRtpMale(null); - rowModel.setRtpFemale(null); - rowModel.setRtpUndefined(null); - - } else { - addUsedLengthStepPmfm((Caracteristic) evt.getNewValue()); - } - - }); - - result.addPropertyChangeListener(EditProtocolSpeciesRowModel.PROPERTY_MATURITY_PMFM, - evt -> { - // update the used maturities - if (evt.getOldValue() != null) { - removeUsedMaturityPmfm((Caracteristic) evt.getOldValue()); - } - if (evt.getNewValue() != null) { - addUsedMaturityPmfm((Caracteristic) evt.getNewValue()); - } - }); - - return result; - } - @Override public EditProtocolSpeciesRowModel createNewRow() { - return newRow(sampleCategoryModel); + return rowSupplier.get(); } @Override @@ -194,67 +142,4 @@ public class EditProtocolSpeciesTableModel extends AbstractApplicationTableModel return result; } - // operations on the used lengthstep pmfms - - public static void addUsedLengthStepPmfm(Caracteristic maturity) { - lengthStepPmfmUsed.add(maturity); - } - - public static void removeUsedLengthStepPmfm(Caracteristic maturity) { - lengthStepPmfmUsed.remove(maturity); - } - - public static void removeUsedLengthStepPmfms(Collection<Caracteristic> maturities) { - lengthStepPmfmUsed.removeAll(maturities); - } - - /** - * Check if the caracteristics are used in the maturity caracteristics of the species or benthos - * @param caracteristics the list of caracteristics to check - * @return true if none of the maturities are used - */ - public static boolean isNoneOfTheLengthStepPmfmsUsed(Collection<Caracteristic> caracteristics) { - return lengthStepPmfmUsed.stream().noneMatch(caracteristics::contains); - } - - /** - * Check if the caracteristic is used in the maturity caracteristics of the species or benthos - * @param caracteristic the caracteristic to check - * @return true if the maturity is used - */ - public static boolean isLengthStepPmfmUsed(Caracteristic caracteristic) { - return lengthStepPmfmUsed.contains(caracteristic); - } - - // operations on the used maturity pfmfs - - public static void addUsedMaturityPmfm(Caracteristic maturity) { - maturitiesPmfmUsed.add(maturity); - } - - public static void removeUsedMaturityPmfm(Caracteristic maturity) { - maturitiesPmfmUsed.remove(maturity); - } - - public static void removeUsedMaturityPmfms(Collection<Caracteristic> maturities) { - maturitiesPmfmUsed.removeAll(maturities); - } - - /** - * Check if the caracteristics are used in the maturity caracteristics of the species or benthos - * @param caracteristics the list of caracteristics to check - * @return true if none of the maturities are used - */ - public static boolean isNoneOfTheMaturityPmfmsUsed(Collection<Caracteristic> caracteristics) { - return maturitiesPmfmUsed.stream().noneMatch(caracteristics::contains); - } - - /** - * Check if the caracteristic is used in the maturity caracteristics of the species or benthos - * @param caracteristic the caracteristic to check - * @return true if the maturity is used - */ - public static boolean isMaturityPmfmUsed(Caracteristic caracteristic) { - return maturitiesPmfmUsed.contains(caracteristic); - } } diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUIHandler.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUIHandler.java index b00f796..d622ee3 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUIHandler.java +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUIHandler.java @@ -209,7 +209,7 @@ public class EditProtocolUIHandler extends AbstractTuttiUIHandler<EditProtocolUI getDataContext().resetValidationDataContext(); - EditProtocolUIModel model = new EditProtocolUIModel(); + EditProtocolUIModel model = new EditProtocolUIModel(sampleCategoryModel); // load cache data @@ -246,7 +246,7 @@ public class EditProtocolUIHandler extends AbstractTuttiUIHandler<EditProtocolUI locationLabelCacheBuilder.put(strata.getId(), strata.getLabel()); programStratasAndSubstratas.get(strata).stream().filter(Objects::nonNull) - .forEach(subStrata -> locationLabelCacheBuilder.put(subStrata.getId(), subStrata.getLabel())); + .forEach(subStrata -> locationLabelCacheBuilder.put(subStrata.getId(), subStrata.getLabel())); }); @@ -340,7 +340,7 @@ public class EditProtocolUIHandler extends AbstractTuttiUIHandler<EditProtocolUI } if (model.getLengthClassesPmfmId() == null) { - model.setLengthClassesPmfmId(Lists.<String>newArrayList()); + model.setLengthClassesPmfmId(new ArrayList<>()); } model.setProgramId(getDataContext().getProgramId()); @@ -352,8 +352,8 @@ public class EditProtocolUIHandler extends AbstractTuttiUIHandler<EditProtocolUI Collection<Species> referents = model.getAllReferentSpeciesByTaxonId().values(); - initBeanFilterableComboBox(this.ui.getSpeciesComboBox(), Lists.newArrayList(referents), null); - initBeanFilterableComboBox(this.ui.getBenthosComboBox(), Lists.newArrayList(referents), null); + initBeanFilterableComboBox(this.ui.getSpeciesComboBox(), new ArrayList<>(referents), null); + initBeanFilterableComboBox(this.ui.getBenthosComboBox(), new ArrayList<>(referents), null); initBeanFilterableComboBox(ui.getCaracteristicMappingComboBox(), new ArrayList<>(model.getCaracteristics()), null); List<EditProtocolCaracteristicsRowModel> caracteristicMappingRows; @@ -369,10 +369,10 @@ public class EditProtocolUIHandler extends AbstractTuttiUIHandler<EditProtocolUI // build protocolSpecies and benthos rows if (protocol == null) { - caracteristicMappingRows = Lists.newArrayList(); - operationFieldMappingRows = Lists.newArrayList(); - speciesRows = Lists.newArrayList(); - benthosRows = Lists.newArrayList(); + caracteristicMappingRows = new ArrayList<>(); + operationFieldMappingRows = new ArrayList<>(); + speciesRows = new ArrayList<>(); + benthosRows = new ArrayList<>(); } else { @@ -427,7 +427,7 @@ public class EditProtocolUIHandler extends AbstractTuttiUIHandler<EditProtocolUI addLengthClassesColumnToModel(columnModel, model.getLengthClassesPmfmId()); addMaturityColumnToModel(columnModel, model.getMaturityPmfmId()); - addCpsPmfmColumnToModel(columnModel, EditProtocolSpeciesTableModel.CALCIFIED_PIECES_SAMPLING_TYPE_PMFM_ID); + addCpsPmfmColumnToModel(columnModel); addBooleanColumnToModel(columnModel, EditProtocolSpeciesTableModel.WEIGHT_ENABLED, table); @@ -490,7 +490,7 @@ public class EditProtocolUIHandler extends AbstractTuttiUIHandler<EditProtocolUI addLengthClassesColumnToModel(columnModel, model.getLengthClassesPmfmId()); addMaturityColumnToModel(columnModel, model.getMaturityPmfmId()); - addCpsPmfmColumnToModel(columnModel, EditProtocolSpeciesTableModel.CALCIFIED_PIECES_SAMPLING_TYPE_PMFM_ID); + addCpsPmfmColumnToModel(columnModel); addBooleanColumnToModel(columnModel, EditProtocolSpeciesTableModel.WEIGHT_ENABLED, table); @@ -530,25 +530,24 @@ public class EditProtocolUIHandler extends AbstractTuttiUIHandler<EditProtocolUI } BeanDoubleList<Caracteristic> maturityList = this.ui.getMaturityList(); + model.getMaturityPmfmUsed().attachPredicateToUi(maturityList); + BeanDoubleList<Caracteristic> lengthClassesList = this.ui.getLengthClassesList(); + model.getLengthStepPmfmUsed().attachPredicateToUi(lengthClassesList); - allDoubleLists = Lists.newArrayList( - lengthClassesList, - this.ui.getIndividualObservationList(), - maturityList - ); + allDoubleLists = new ArrayList<>(); + allDoubleLists.add(lengthClassesList); + allDoubleLists.add(ui.getIndividualObservationList()); + allDoubleLists.add(maturityList); initDoubleList(EditProtocolUIModel.PROPERTY_LENGTH_CLASSES_PMFM_ID, lengthClassesList, Lists.newArrayList(model.getCaracteristics()), model.getLengthClassesPmfmId()); - JList lengthClassesSelectedList = lengthClassesList.getSelectedList(); - lengthClassesList.getModel().addCanRemoveItemsPredicate( - input -> EditProtocolSpeciesTableModel.isNoneOfTheLengthStepPmfmsUsed(lengthClassesSelectedList.getSelectedValuesList())); - - ListCellRenderer lengthClassesDefaultRenderer = lengthClassesSelectedList.getCellRenderer(); - lengthClassesSelectedList.setCellRenderer(new LengthStepCaracteristicCellRenderer(lengthClassesDefaultRenderer)); + JList<Caracteristic> lengthClassesSelectedList = lengthClassesList.getSelectedList(); + ListCellRenderer<? super Caracteristic> lengthClassesDefaultRenderer = lengthClassesSelectedList.getCellRenderer(); + lengthClassesSelectedList.setCellRenderer(new LengthStepCaracteristicCellRenderer(getConfig().getColorWarningRow(), model.getLengthStepPmfmUsed(), lengthClassesDefaultRenderer)); initDoubleList(EditProtocolUIModel.PROPERTY_INDIVIDUAL_OBSERVATION_PMFM_ID, this.ui.getIndividualObservationList(), @@ -560,10 +559,7 @@ public class EditProtocolUIHandler extends AbstractTuttiUIHandler<EditProtocolUI model.getCaracteristics().stream().filter(caracteristic -> !caracteristic.isQualitativeValueEmpty()).collect(Collectors.toList()), model.getMaturityPmfmId()); - JList maturitySelectedList = maturityList.getSelectedList(); - maturityList.getModel().addCanRemoveItemsPredicate( - input -> EditProtocolSpeciesTableModel.isNoneOfTheMaturityPmfmsUsed(maturityList.getSelectedList().getSelectedValuesList())); - + JList<Caracteristic> maturitySelectedList = maturityList.getSelectedList(); JMenuItem editMaturity = ui.getEditMaturityCaracteristicAction(); maturityList.getSelectedListPopup().add(editMaturity); @@ -573,8 +569,8 @@ public class EditProtocolUIHandler extends AbstractTuttiUIHandler<EditProtocolUI editMaturity.setEnabled(editMaturityEnabled); }); - ListCellRenderer maturityDefaultRenderer = maturitySelectedList.getCellRenderer(); - maturitySelectedList.setCellRenderer(new MaturityCaracteristicCellRenderer(maturityDefaultRenderer)); + ListCellRenderer<? super Caracteristic> maturityDefaultRenderer = maturitySelectedList.getCellRenderer(); + maturitySelectedList.setCellRenderer(new MaturityCaracteristicCellRenderer(model.getMaturityPmfmUsed(), maturityDefaultRenderer)); // update lengthstep and maturity list button states when the user goes back to the caracteristic panel @@ -1012,7 +1008,8 @@ public class EditProtocolUIHandler extends AbstractTuttiUIHandler<EditProtocolUI } public EditProtocolSpeciesRowModel createNewProtocolSpeciesRow() { - EditProtocolSpeciesRowModel result = EditProtocolSpeciesTableModel.newRow(sampleCategoryModel); + + EditProtocolSpeciesRowModel result = getModel().newRow(); result.addPropertyChangeListener(EditProtocolSpeciesRowModel.PROPERTY_LENGTH_STEP_PMFM, evt -> { @@ -1254,8 +1251,7 @@ public class EditProtocolUIHandler extends AbstractTuttiUIHandler<EditProtocolUI List<Caracteristic> availableCaracteristics, List<String> selectedCaracteristics) { - initBeanList(widget, availableCaracteristics, - Lists.<Caracteristic>newArrayList()); + initBeanList(widget, availableCaracteristics, new ArrayList<>()); UpdateSelectedList listener = new UpdateSelectedList(widget, getModel().getAllCaracteristic()); widget.putClientProperty("_updateListener", listener); @@ -1263,7 +1259,7 @@ public class EditProtocolUIHandler extends AbstractTuttiUIHandler<EditProtocolUI listener.select(selectedCaracteristics); // add a filter to keep only in universe everything except what is selected by other double lists - List<BeanDoubleList<Caracteristic>> list = Lists.newArrayList(allDoubleLists); + List<BeanDoubleList<Caracteristic>> list = new ArrayList<>(allDoubleLists); list.remove(widget); widget.getHandler().addFilter(new SelectValuePredicate(list)); widget.getHandler().addFilter(caracteristic -> !getModel().isCaracteristicUsedInMapping(caracteristic)); @@ -1274,14 +1270,14 @@ public class EditProtocolUIHandler extends AbstractTuttiUIHandler<EditProtocolUI protected void selectCaracteristics(List<String> ids, JComboBox comboBox) { Map<String, Caracteristic> allCaracteristic = getModel().getAllCaracteristic(); - List<Caracteristic> selection = Lists.newArrayList(); + List<Caracteristic> selection = new ArrayList<>(); if (CollectionUtils.isNotEmpty(ids)) { for (String id : ids) { selection.add(allCaracteristic.get(id)); } } - List<Caracteristic> dataToList = Lists.newArrayList(selection); + List<Caracteristic> dataToList = new ArrayList<>(selection); // add a null value at first position if (!dataToList.isEmpty() && dataToList.get(0) != null) { @@ -1290,13 +1286,11 @@ public class EditProtocolUIHandler extends AbstractTuttiUIHandler<EditProtocolUI SwingUtil.fillComboBox(comboBox, dataToList, null); } - protected void addLengthClassesColumnToModel(TableColumnModel model, - List<String> selectedIds) { + protected void addLengthClassesColumnToModel(TableColumnModel model, List<String> selectedIds) { - Decorator<Caracteristic> decorator = - getDecorator(Caracteristic.class, null); + Decorator<Caracteristic> decorator = getDecorator(Caracteristic.class, null); - final JComboBox comboBox = new JComboBox(); + JComboBox<Caracteristic> comboBox = new JComboBox<>(); getModel().addPropertyChangeListener(EditProtocolUIModel.PROPERTY_LENGTH_CLASSES_PMFM_ID, evt -> { List<String> ids = (List<String>) evt.getNewValue(); @@ -1315,13 +1309,11 @@ public class EditProtocolUIHandler extends AbstractTuttiUIHandler<EditProtocolUI EditProtocolSpeciesTableModel.LENGTH_STEP_PMFM_ID); } - protected void addMaturityColumnToModel(TableColumnModel model, - List<String> selectedIds) { + protected void addMaturityColumnToModel(TableColumnModel model, List<String> selectedIds) { - Decorator<Caracteristic> decorator = - getDecorator(Caracteristic.class, null); + Decorator<Caracteristic> decorator = getDecorator(Caracteristic.class, null); - final JComboBox comboBox = new JComboBox(); + JComboBox<Caracteristic> comboBox = new JComboBox(); getModel().addPropertyChangeListener(EditProtocolUIModel.PROPERTY_MATURITY_PMFM_ID, evt -> { List<String> ids = (List<String>) evt.getNewValue(); @@ -1341,8 +1333,7 @@ public class EditProtocolUIHandler extends AbstractTuttiUIHandler<EditProtocolUI EditProtocolSpeciesTableModel.MATURITY_PMFM_ID); } - protected void addCpsPmfmColumnToModel(TableColumnModel model, - ColumnIdentifier<EditProtocolSpeciesRowModel> column) { + protected void addCpsPmfmColumnToModel(TableColumnModel model) { Decorator<CaracteristicQualitativeValue> caracteristicQualitativeValueDecorator = getDecorator(CaracteristicQualitativeValue.class, null); @@ -1352,29 +1343,6 @@ public class EditProtocolUIHandler extends AbstractTuttiUIHandler<EditProtocolUI caracteristicQualitativeValueDecorator, getDataContext().getCpsTypeValues()); -// Decorator<Caracteristic> decorator = -// getDecorator(Caracteristic.class, null); -// -// final JComboBox comboBox = new JComboBox(); -// -// comboBox.setRenderer(newListCellRender(decorator)); -// -// List<Caracteristic> dataToList = Lists.newArrayList(getModel().getCaracteristics()); -// -// // add a null value at first position -// if (!dataToList.isEmpty() && dataToList.get(0) != null) { -// dataToList.add(0, null); -// } -// SwingUtil.fillComboBox(comboBox, dataToList, null); -// -// ObjectToStringConverter converter = BeanUIUtil.newDecoratedObjectToStringConverter(decorator); -// BeanUIUtil.decorate(comboBox, converter); -// ComboBoxCellEditor editor = new ComboBoxCellEditor(comboBox); -// -// addColumnToModel(model, -// editor, -// newTableCellRender(decorator), -// column); } protected void initTable(final JXTable table, @@ -1384,8 +1352,7 @@ public class EditProtocolUIHandler extends AbstractTuttiUIHandler<EditProtocolUI List<EditProtocolSpeciesRowModel> rows, ListSelectionListener selectionListener) { - final EditProtocolSpeciesTableModel tableModel = - new EditProtocolSpeciesTableModel(sampleCategoryModel, columnModel); + EditProtocolSpeciesTableModel tableModel = new EditProtocolSpeciesTableModel(getModel()::newRow, columnModel); table.setModel(tableModel); table.setColumnModel(columnModel); @@ -1415,8 +1382,7 @@ public class EditProtocolUIHandler extends AbstractTuttiUIHandler<EditProtocolUI e.getLastRow() == Integer.MAX_VALUE) { // get species column - TableColumnExt tableColumn = - (TableColumnExt) table.getColumns().get(0); + TableColumnExt tableColumn = (TableColumnExt) table.getColumns().get(0); // get column comparator TuttiDecorator.TuttiDecoratorComparator<Species> comparator = @@ -1667,33 +1633,36 @@ public class EditProtocolUIHandler extends AbstractTuttiUIHandler<EditProtocolUI } - private class LengthStepCaracteristicCellRenderer implements ListCellRenderer { + private static class LengthStepCaracteristicCellRenderer implements ListCellRenderer<Caracteristic> { - private final ListCellRenderer defaultRenderer; + private final CaracteristicsCount caracteristicsCount; + private final Color notRemovableColor; - private Color notRemovableColor = getConfig().getColorWarningRow(); + private final ListCellRenderer<? super Caracteristic> defaultRenderer; - LengthStepCaracteristicCellRenderer(ListCellRenderer defaultRenderer) { + LengthStepCaracteristicCellRenderer(Color notRemovableColor, CaracteristicsCount caracteristicsCount, ListCellRenderer<? super Caracteristic> defaultRenderer) { + this.notRemovableColor = notRemovableColor; + this.caracteristicsCount = caracteristicsCount; this.defaultRenderer = defaultRenderer; } @Override - public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { + public Component getListCellRendererComponent(JList<? extends Caracteristic> list, Caracteristic value, int index, boolean isSelected, boolean cellHasFocus) { Component result = defaultRenderer.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); - Caracteristic caracteristic = (Caracteristic) value; - if (isSelected && EditProtocolSpeciesTableModel.isLengthStepPmfmUsed(caracteristic)) { + if (isSelected && caracteristicsCount.isCaracteristicUsed(value)) { result.setBackground(notRemovableColor.darker()); } return result; } } - private class MaturityCaracteristicCellRenderer implements ListCellRenderer { + private class MaturityCaracteristicCellRenderer implements ListCellRenderer<Caracteristic> { public static final String TEXT_PATTERN = "<html><body><strong>%s</strong> :<ul><li>%s</li></ul><strong>%s</strong> :<ul><li>%s</li></ul></body></html>"; - private final ListCellRenderer defaultRenderer; + private final CaracteristicsCount caracteristicsCount; + private final ListCellRenderer<? super Caracteristic> defaultRenderer; private Color validColor = getConfig().getColorCellWithValue(); @@ -1701,21 +1670,21 @@ public class EditProtocolUIHandler extends AbstractTuttiUIHandler<EditProtocolUI private Color notRemovableColor = getConfig().getColorWarningRow(); - MaturityCaracteristicCellRenderer(ListCellRenderer defaultRenderer) { + MaturityCaracteristicCellRenderer(CaracteristicsCount caracteristicsCount, ListCellRenderer<? super Caracteristic> defaultRenderer) { + this.caracteristicsCount = caracteristicsCount; this.defaultRenderer = defaultRenderer; } @Override - public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { + public Component getListCellRendererComponent(JList<? extends Caracteristic> list, Caracteristic value, int index, boolean isSelected, boolean cellHasFocus) { Component result = defaultRenderer.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); - Caracteristic maturityCaracteristic = (Caracteristic) value; Color backgroud; - if (isSelected && EditProtocolSpeciesTableModel.isMaturityPmfmUsed(maturityCaracteristic)) { - backgroud= notRemovableColor; + if (isSelected && caracteristicsCount.isCaracteristicUsed(value)) { + backgroud = notRemovableColor; - } else if (!EditProtocolUIHandler.this.getModel().isMaturityValid(maturityCaracteristic)) { - backgroud= invalidColor; + } else if (!EditProtocolUIHandler.this.getModel().isMaturityValid(value)) { + backgroud = invalidColor; } else { backgroud = validColor; } @@ -1726,7 +1695,7 @@ public class EditProtocolUIHandler extends AbstractTuttiUIHandler<EditProtocolUI if (result instanceof JComponent) { - ((JComponent) result).setToolTipText(createToolTipText(maturityCaracteristic)); + ((JComponent) result).setToolTipText(createToolTipText(value)); } return result; } @@ -1749,7 +1718,7 @@ public class EditProtocolUIHandler extends AbstractTuttiUIHandler<EditProtocolUI }); tooltip = String.format(TEXT_PATTERN, t("tutti.editProtocol.field.maturity.immature.tip"), StringUtils.join(immatureStates, "</li><li>"), - t("tutti.editProtocol.field.maturity.mature.tip"), StringUtils.join(matureStates, "</li><li>")); + t("tutti.editProtocol.field.maturity.mature.tip"), StringUtils.join(matureStates, "</li><li>")); } return tooltip; diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUIModel.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUIModel.java index 58b5b02..622a3a3 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUIModel.java +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUIModel.java @@ -29,6 +29,7 @@ import com.google.common.collect.Maps; import com.google.common.collect.Multimap; import com.google.common.collect.Multimaps; import fr.ifremer.tutti.persistence.entities.TuttiEntities; +import fr.ifremer.tutti.persistence.entities.data.SampleCategoryModel; import fr.ifremer.tutti.persistence.entities.protocol.CaracteristicMappingRow; import fr.ifremer.tutti.persistence.entities.protocol.MaturityCaracteristic; import fr.ifremer.tutti.persistence.entities.protocol.MaturityCaracteristics; @@ -110,6 +111,7 @@ public class EditProtocolUIModel extends AbstractTuttiBeanUIModel<TuttiProtocol, * @since 1.3 */ protected final TuttiProtocol editObject = TuttiProtocols.newTuttiProtocol(); + private final SampleCategoryModel sampleCategoryModel; /** * Flag when a incoming protocol is imported. @@ -211,8 +213,19 @@ public class EditProtocolUIModel extends AbstractTuttiBeanUIModel<TuttiProtocol, private boolean modifyingZones; - public EditProtocolUIModel() { + /** + * Le compteur de méthode de mensuration utilisées par les espèces et benthos. + */ + private final CaracteristicsCount lengthStepPmfmUsed = new CaracteristicsCount(); + + /** + * Le compteur de méthode de maturité utilisées par les espèces et benthos. + */ + private final CaracteristicsCount maturityPmfmUsed = new CaracteristicsCount(); + + public EditProtocolUIModel(SampleCategoryModel sampleCategoryModel) { super(fromBeanBinder, toBeanBinder); + this.sampleCategoryModel = sampleCategoryModel; // reset the list of maturity pmfm id when the list of maturity caracteristic changes addPropertyChangeListener(PROPERTY_MATURITY_CARACTERISTICS, new PropertyChangeListener() { @@ -244,6 +257,58 @@ public class EditProtocolUIModel extends AbstractTuttiBeanUIModel<TuttiProtocol, }); } + public CaracteristicsCount getLengthStepPmfmUsed() { + return lengthStepPmfmUsed; + } + + public CaracteristicsCount getMaturityPmfmUsed() { + return maturityPmfmUsed; + } + + public EditProtocolSpeciesRowModel newRow() { + EditProtocolSpeciesRowModel result = new EditProtocolSpeciesRowModel(); + + List<Integer> mandatoryIds = Lists.newArrayList(sampleCategoryModel.getSamplingOrder()); + // always remove the first category (V/HV) + mandatoryIds.remove(0); + result.setMandatorySampleCategoryId(mandatoryIds); + + result.setWeightEnabled(true); + result.setValid(true); + + result.addPropertyChangeListener(EditProtocolSpeciesRowModel.PROPERTY_LENGTH_STEP_PMFM, + evt -> { + // update the used lengthstep caracteristic + if (evt.getOldValue() != null) { + lengthStepPmfmUsed.removeCaracteristic((Caracteristic) evt.getOldValue()); + } + if (evt.getNewValue() == null) { + + EditProtocolSpeciesRowModel rowModel = (EditProtocolSpeciesRowModel) evt.getSource(); + rowModel.setRtpMale(null); + rowModel.setRtpFemale(null); + rowModel.setRtpUndefined(null); + + } else { + lengthStepPmfmUsed.addCaracteristic((Caracteristic) evt.getNewValue()); + } + + }); + + result.addPropertyChangeListener(EditProtocolSpeciesRowModel.PROPERTY_MATURITY_PMFM, + evt -> { + // update the used maturities + if (evt.getOldValue() != null) { + maturityPmfmUsed.removeCaracteristic((Caracteristic) evt.getOldValue()); + } + if (evt.getNewValue() != null) { + maturityPmfmUsed.addCaracteristic((Caracteristic) evt.getNewValue()); + } + }); + + return result; + } + @Override protected TuttiProtocol newEntity() { return TuttiProtocols.newTuttiProtocol(); diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/actions/RemoveBenthosProtocolAction.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/actions/RemoveBenthosProtocolAction.java index 171f7d4..c3e210c 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/actions/RemoveBenthosProtocolAction.java +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/actions/RemoveBenthosProtocolAction.java @@ -40,6 +40,7 @@ import javax.swing.JTable; import java.util.Collection; import java.util.Collections; import java.util.List; +import java.util.Objects; import java.util.Set; import java.util.stream.Collectors; @@ -70,6 +71,7 @@ public class RemoveBenthosProtocolAction extends LongActionSupport<EditProtocolU /** * calcified pieces sampling rows to delete + * * @since 4.5 */ protected Collection<CalcifiedPiecesSamplingEditorRowModel> cpsRowsToDelete; @@ -119,8 +121,8 @@ public class RemoveBenthosProtocolAction extends LongActionSupport<EditProtocolU List<CalcifiedPiecesSamplingEditorRowModel> cpsRows = getModel().getCpsRows(); cpsRowsToDelete = cpsRows.stream() - .filter(r -> removedSpecies.contains(r.getProtocolSpecies().getSpecies())) - .collect(Collectors.toList()); + .filter(r -> removedSpecies.contains(r.getProtocolSpecies().getSpecies())) + .collect(Collectors.toList()); if (!cpsRowsToDelete.isEmpty()) { @@ -153,16 +155,17 @@ public class RemoveBenthosProtocolAction extends LongActionSupport<EditProtocolU // remove all rows from model getModel().getBenthosRow().removeAll(removedRows); - // remove the lengthstep pmfm of the rows from the used lengthstep pmfm - EditProtocolSpeciesTableModel.removeUsedLengthStepPmfms(removedRows.stream() - .map(EditProtocolSpeciesRowModel::getLengthStepPmfm) - .collect(Collectors.toList())); + getModel().getLengthStepPmfmUsed().removeCaracteristics(removedRows.stream() + .map(EditProtocolSpeciesRowModel::getLengthStepPmfm) + .filter(Objects::nonNull) + .collect(Collectors.toList())); // remove the maturities of the rows from the used maturities - EditProtocolSpeciesTableModel.removeUsedMaturityPmfms(removedRows.stream() - .map(EditProtocolSpeciesRowModel::getMaturityPmfm) - .collect(Collectors.toList())); + getModel().getMaturityPmfmUsed().removeCaracteristics(removedRows.stream() + .map(EditProtocolSpeciesRowModel::getMaturityPmfm) + .filter(Objects::nonNull) + .collect(Collectors.toList())); // remove the protocolSpecies from the cps table or combobox if (!cpsRowsToDelete.isEmpty()) { diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/actions/RemoveSpeciesProtocolAction.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/actions/RemoveSpeciesProtocolAction.java index 7bd7624..f218cfe 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/actions/RemoveSpeciesProtocolAction.java +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/actions/RemoveSpeciesProtocolAction.java @@ -40,6 +40,7 @@ import javax.swing.JTable; import java.util.Collection; import java.util.Collections; import java.util.List; +import java.util.Objects; import java.util.Set; import java.util.stream.Collectors; @@ -69,6 +70,7 @@ public class RemoveSpeciesProtocolAction extends LongActionSupport<EditProtocolU /** * calcified pieces sampling rows to delete + * * @since 4.5 */ protected Collection<CalcifiedPiecesSamplingEditorRowModel> cpsRowsToDelete; @@ -117,8 +119,8 @@ public class RemoveSpeciesProtocolAction extends LongActionSupport<EditProtocolU List<CalcifiedPiecesSamplingEditorRowModel> cpsRows = getModel().getCpsRows(); cpsRowsToDelete = cpsRows.stream() - .filter(r -> removedSpecies.contains(r.getProtocolSpecies().getSpecies())) - .collect(Collectors.toList()); + .filter(r -> removedSpecies.contains(r.getProtocolSpecies().getSpecies())) + .collect(Collectors.toList()); if (!cpsRowsToDelete.isEmpty()) { @@ -151,14 +153,16 @@ public class RemoveSpeciesProtocolAction extends LongActionSupport<EditProtocolU getModel().getSpeciesRow().removeAll(removedRows); // remove the lengthstep pmfm of the rows from the used lengthstep pmfm - EditProtocolSpeciesTableModel.removeUsedLengthStepPmfms(removedRows.stream() - .map(EditProtocolSpeciesRowModel::getLengthStepPmfm) - .collect(Collectors.toList())); + getModel().getLengthStepPmfmUsed().removeCaracteristics(removedRows.stream() + .map(EditProtocolSpeciesRowModel::getLengthStepPmfm) + .filter(Objects::nonNull) + .collect(Collectors.toList())); // remove the maturities of the rows from the used maturities - EditProtocolSpeciesTableModel.removeUsedMaturityPmfms(removedRows.stream() - .map(EditProtocolSpeciesRowModel::getMaturityPmfm) - .collect(Collectors.toList())); + getModel().getMaturityPmfmUsed().removeCaracteristics(removedRows.stream() + .map(EditProtocolSpeciesRowModel::getMaturityPmfm) + .filter(Objects::nonNull) + .collect(Collectors.toList())); // remove the protocolSpecies from the cps table or combobox if (!cpsRowsToDelete.isEmpty()) { -- 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 7f024b9f589d6d0bd9c6ad5b3f1e3470f0328642 Author: Tony CHEMIT <chemit@codelutin.com> Date: Wed Apr 27 20:04:06 2016 +0200 up-up-up libraries --- pom.xml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/pom.xml b/pom.xml index 15d4871..4d19a07 100644 --- a/pom.xml +++ b/pom.xml @@ -27,7 +27,7 @@ <parent> <groupId>org.nuiton</groupId> <artifactId>codelutinpom</artifactId> - <version>9</version> + <version>10</version> </parent> <groupId>fr.ifremer</groupId> @@ -128,7 +128,7 @@ <nuitonI18nVersion>3.4.1</nuitonI18nVersion> <nuitonValidatorVersion>3.0</nuitonValidatorVersion> <eugenePluginVersion>2.14</eugenePluginVersion> - <jaxxVersion>2.29-SNAPSHOT</jaxxVersion> + <jaxxVersion>2.29</jaxxVersion> <swingXVersion>1.6.4</swingXVersion> <slf4jVersion>1.7.13</slf4jVersion> <!-- Can't use now adagio previous to 3.9.1 after this version --> @@ -227,12 +227,12 @@ <dependency> <groupId>org.nuiton</groupId> <artifactId>nuiton-version</artifactId> - <version>1.0-rc-1</version> + <version>1.0-rc-2</version> </dependency> <dependency> <groupId>org.nuiton</groupId> <artifactId>nuiton-utils</artifactId> - <version>3.0-rc-11</version> + <version>3.0-rc-12</version> </dependency> <dependency> <groupId>org.nuiton</groupId> @@ -242,7 +242,7 @@ <dependency> <groupId>org.nuiton</groupId> <artifactId>nuiton-config</artifactId> - <version>3.0-rc-3</version> + <version>3.0-rc-4</version> </dependency> <dependency> <groupId>org.nuiton</groupId> @@ -314,14 +314,14 @@ <dependency> <groupId>commons-io</groupId> <artifactId>commons-io</artifactId> - <version>2.4</version> + <version>2.5</version> </dependency> <!-- Guava --> <dependency> <groupId>com.google.guava</groupId> <artifactId>guava</artifactId> - <version>18.0</version> + <version>19.0</version> </dependency> <!-- XWorks (validation) --> -- 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 43d2cac35bf3ddeb7a386e665978e892224fe487 Merge: 6a3a870 7f024b9 Author: Tony CHEMIT <chemit@codelutin.com> Date: Wed Apr 27 20:04:11 2016 +0200 Livrable #8238 Merge branch 'feature/8238' into develop pom.xml | 14 +- .../content/protocol/CaracteristicsCount.java | 81 ++++++++++ .../protocol/EditProtocolSpeciesTableModel.java | 38 +---- .../content/protocol/EditProtocolUIHandler.java | 176 ++++++++++++--------- .../content/protocol/EditProtocolUIModel.java | 67 +++++++- .../actions/RemoveBenthosProtocolAction.java | 18 ++- .../actions/RemoveSpeciesProtocolAction.java | 18 ++- 7 files changed, 292 insertions(+), 120 deletions(-) -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
participants (1)
-
codelutin.com scm