Tony CHEMIT pushed to branch develop-9.0.x at ultreiaio / ird-observe

Commits:

3 changed files:

Changes:

  • client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/data/table/actions/entry/ResetEntry.java
    ... ... @@ -59,7 +59,12 @@ public final class ResetEntry extends ContentTableUIActionSupport<ContentTableUI
    59 59
                 }
    
    60 60
             } else {
    
    61 61
                 // reset existing entry
    
    62
    -            tableModel.resetEditBean();
    
    62
    +            ui.getStates().setResetEdit(true);
    
    63
    +            try {
    
    64
    +                tableModel.resetEditBean();
    
    65
    +            } finally {
    
    66
    +                ui.getStates().setResetEdit(false);
    
    67
    +            }
    
    63 68
             }
    
    64 69
         }
    
    65 70
     
    

  • client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/observation/SampleUIHandler.java
    ... ... @@ -51,7 +51,7 @@ public class SampleUIHandler extends GeneratedSampleUIHandler {
    51 51
          *
    
    52 52
          * @since 3.0
    
    53 53
          */
    
    54
    -    private final PropertyChangeListener weightChanged;
    
    54
    +    private final PropertyChangeListener weightChanged = evt -> onWeightChanged((Float) evt.getNewValue(), !ui.getStates().isResetEdit());
    
    55 55
     
    
    56 56
         /**
    
    57 57
          * Ecoute les modifications de la propriété {@link SampleMeasureDto#getLength()},
    
    ... ... @@ -60,7 +60,7 @@ public class SampleUIHandler extends GeneratedSampleUIHandler {
    60 60
          *
    
    61 61
          * @since 3.0
    
    62 62
          */
    
    63
    -    private final PropertyChangeListener lengthChanged;
    
    63
    +    private final PropertyChangeListener lengthChanged = evt -> onLengthChanged((Float) evt.getNewValue(), !ui.getStates().isResetEdit());
    
    64 64
     
    
    65 65
         /**
    
    66 66
          * Ecoute les modifications de la propriété {@link SampleMeasureDto#getLength()},
    
    ... ... @@ -69,14 +69,7 @@ public class SampleUIHandler extends GeneratedSampleUIHandler {
    69 69
          *
    
    70 70
          * @since 3.0
    
    71 71
          */
    
    72
    -    private final PropertyChangeListener speciesChanged;
    
    73
    -
    
    74
    -    public SampleUIHandler() {
    
    75
    -        weightChanged = evt -> onWeightChanged((Float) evt.getNewValue());
    
    76
    -        lengthChanged = evt -> onLengthChanged((Float) evt.getNewValue());
    
    77
    -        speciesChanged = evt -> onSpeciesChanged((SpeciesReference) evt.getNewValue());
    
    78
    -    }
    
    79
    -
    
    72
    +    private final PropertyChangeListener speciesChanged = evt -> onSpeciesChanged((SpeciesReference) evt.getNewValue());
    
    80 73
     
    
    81 74
         @Override
    
    82 75
         public void onInit(SampleUI ui) {
    
    ... ... @@ -97,8 +90,8 @@ public class SampleUIHandler extends GeneratedSampleUIHandler {
    97 90
     
    
    98 91
         public void onSelectedRowChanged(SampleMeasureDto tableEditBean, SampleMeasureDto previousRowBean, boolean notPersisted, boolean newRow) {
    
    99 92
     
    
    100
    -        onLengthChanged(tableEditBean.getLength());
    
    101
    -        onWeightChanged(tableEditBean.getWeight());
    
    93
    +        onLengthChanged(tableEditBean.getLength(), false);
    
    94
    +        onWeightChanged(tableEditBean.getWeight(), false);
    
    102 95
     
    
    103 96
             SampleUIModel sampleModel = getModel();
    
    104 97
     
    
    ... ... @@ -209,6 +202,9 @@ public class SampleUIHandler extends GeneratedSampleUIHandler {
    209 202
         }
    
    210 203
     
    
    211 204
         public void startEditTableEditBean(SampleMeasureDto tableEditBean) {
    
    205
    +        tableEditBean.removePropertyChangeListener(SampleMeasureDto.PROPERTY_WEIGHT, weightChanged);
    
    206
    +        tableEditBean.removePropertyChangeListener(SampleMeasureDto.PROPERTY_LENGTH, lengthChanged);
    
    207
    +        tableEditBean.removePropertyChangeListener(SampleMeasureDto.PROPERTY_SPECIES, speciesChanged);
    
    212 208
             tableEditBean.addPropertyChangeListener(SampleMeasureDto.PROPERTY_WEIGHT, weightChanged);
    
    213 209
             tableEditBean.addPropertyChangeListener(SampleMeasureDto.PROPERTY_LENGTH, lengthChanged);
    
    214 210
             tableEditBean.addPropertyChangeListener(SampleMeasureDto.PROPERTY_SPECIES, speciesChanged);
    
    ... ... @@ -249,9 +245,9 @@ public class SampleUIHandler extends GeneratedSampleUIHandler {
    249 245
             acquisitionModeGroup.setSelectedValue(acquisitionMode);
    
    250 246
         }
    
    251 247
     
    
    252
    -    protected void onWeightChanged(Float newValue) {
    
    248
    +    protected void onWeightChanged(Float newValue, boolean realChange) {
    
    253 249
             SampleMeasureDto tableEditBean = ui.getModel().getStates().getTableEditBean();
    
    254
    -        if (tableEditBean.getAcquisitionMode() == 1) {
    
    250
    +        if (realChange && tableEditBean.getAcquisitionMode() == 1) {
    
    255 251
                 tableEditBean.setIsWeightComputed(false);
    
    256 252
             }
    
    257 253
             if (newValue == null) {
    
    ... ... @@ -259,9 +255,11 @@ public class SampleUIHandler extends GeneratedSampleUIHandler {
    259 255
             }
    
    260 256
         }
    
    261 257
     
    
    262
    -    protected void onLengthChanged(Float newValue) {
    
    258
    +    protected void onLengthChanged(Float newValue, boolean realChange) {
    
    263 259
             SampleMeasureDto tableEditBean = ui.getModel().getStates().getTableEditBean();
    
    264
    -        tableEditBean.setIsLengthComputed(false);
    
    260
    +        if (realChange) {
    
    261
    +            tableEditBean.setIsLengthComputed(false);
    
    262
    +        }
    
    265 263
             if (newValue == null) {
    
    266 264
                 tableEditBean.setLengthMeasureMethod(null);
    
    267 265
             }
    

  • core/api/dto/src/main/resources/observe-reports.properties
    ... ... @@ -697,26 +697,26 @@ report.psObservationTargetDiscardedByAssociation.request.19=0,3|row|\
    697 697
           and os.topiaId = 'fr.ird.referential.ps.common.ObservedSystem#1239832686428#0.9217864901728908' \
    
    698 698
           and os not in elements(a.observedSystem)
    
    699 699
     ################################################################################
    
    700
    -## Captures accessoires observées
    
    700
    +## Captures observées
    
    701 701
     ################################################################################
    
    702
    -report.psObservationAccessoryCatch.modelType=PS
    
    703
    -report.psObservationAccessoryCatch.name=Observations - Liste des captures accessoires selon le type de banc, filtrées par groupe
    
    704
    -report.psObservationAccessoryCatch.description=Afficher les captures accessoires par groupe d'espèce\nLes poids sont exprimés en tonnes.
    
    705
    -report.psObservationAccessoryCatch.columns=Espèce, Banc libre, Banc objet
    
    706
    -report.psObservationAccessoryCatch.variable.speciesGroup=fr.ird.observe.dto.referential.common.SpeciesGroupDto|From SpeciesGroupImpl ge Order By ge.code
    
    707
    -report.psObservationAccessoryCatch.repeatVariable.speciesId=java.lang.String|\
    
    702
    +report.psObservationCatch.modelType=PS
    
    703
    +report.psObservationCatch.name=Observations - Liste des captures selon le type de banc, filtrées par groupe
    
    704
    +report.psObservationCatch.description=Afficher les captures par groupe d'espèce\nLes poids sont exprimés en tonnes.
    
    705
    +report.psObservationCatch.columns=Espèce, Banc libre, Banc objet
    
    706
    +report.psObservationCatch.variable.speciesGroup=fr.ird.observe.dto.referential.common.SpeciesGroupDto|From SpeciesGroupImpl ge Order By ge.code
    
    707
    +report.psObservationCatch.repeatVariable.speciesId=java.lang.String|\
    
    708 708
       Select e.id From SpeciesImpl e \
    
    709 709
       Where e.speciesGroup.id = :speciesGroup \
    
    710 710
       Order By e.homeId
    
    711
    -report.psObservationAccessoryCatch.request.1=0,0|row|\
    
    711
    +report.psObservationCatch.request.1=0,0|row|\
    
    712 712
       Select \
    
    713 713
         concat('[FAO]', (case when e.faoCode is not null then e.faoCode else '-' end), \
    
    714 714
                ' [sc]', (case when e.scientificLabel is not null then e.scientificLabel else '-' end), \
    
    715 715
                ' [fr]', (case when e.label2 is not null then e.label2 else '-' end)) \
    
    716 716
       From SpeciesImpl e \
    
    717 717
       Where e.id = :speciesId
    
    718
    -report.psObservationAccessoryCatch.request.1.repeat=speciesId|column
    
    719
    -report.psObservationAccessoryCatch.request.2=1,0|row|\
    
    718
    +report.psObservationCatch.request.1.repeat=speciesId|column
    
    719
    +report.psObservationCatch.request.2=1,0|row|\
    
    720 720
       Select \
    
    721 721
         case when Count(ca) > 0 then \
    
    722 722
             concat('+', \
    
    ... ... @@ -731,8 +731,8 @@ report.psObservationAccessoryCatch.request.2=1,0|row|\
    731 731
       Join c.catches ca \
    
    732 732
            with ca.species.id = :speciesId \
    
    733 733
       Where m.id In :tripId
    
    734
    -report.psObservationAccessoryCatch.request.2.repeat=speciesId|column
    
    735
    -report.psObservationAccessoryCatch.request.3=2,0|row|\
    
    734
    +report.psObservationCatch.request.2.repeat=speciesId|column
    
    735
    +report.psObservationCatch.request.3=2,0|row|\
    
    736 736
       Select \
    
    737 737
         case when Count(ca) > 0 then \
    
    738 738
             concat('+', \
    
    ... ... @@ -747,7 +747,7 @@ report.psObservationAccessoryCatch.request.3=2,0|row|\
    747 747
       Join c.catches ca \
    
    748 748
            with ca.species.id = :speciesId \
    
    749 749
       Where m.id In :tripId
    
    750
    -report.psObservationAccessoryCatch.request.3.repeat=speciesId|column
    
    750
    +report.psObservationCatch.request.3.repeat=speciesId|column
    
    751 751
     ################################################################################
    
    752 752
     ## Captures accessoires par speciesGroup d'espèces
    
    753 753
     ################################################################################