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

Commits:

6 changed files:

Changes:

  • client-core/src/main/java/fr/ird/observe/client/ui/content/ContentUIHandler.java
    ... ... @@ -179,7 +179,7 @@ public abstract class ContentUIHandler<E extends IdDto, U extends ContentUI<E, U
    179 179
             if (model.isCreatingMode()) {
    
    180 180
     
    
    181 181
                 // on peut quitter le mode creation si le modele est non modifie et valide
    
    182
    -            if (!(model.isEnabled() && model.isEditing() && (model.isModified() || !model.isValid()))) {
    
    182
    +            if (!(model.isEnabled() && model.isEditing() && (model.isGlobalModified() || !model.isValid()))) {
    
    183 183
                     if (model.isEditing()) {
    
    184 184
                         ui.stopEdit();
    
    185 185
                     }
    
    ... ... @@ -189,8 +189,8 @@ public abstract class ContentUIHandler<E extends IdDto, U extends ContentUI<E, U
    189 189
                 }
    
    190 190
             } else {
    
    191 191
     
    
    192
    -            // on peut quiiter le mode mise a jour si le modele est non modifie
    
    193
    -            if (!(model.isEnabled() && model.isEditing() && model.isModified())) {
    
    192
    +            // on peut quitter le mode mise a jour si le modele est non modifie
    
    193
    +            if (!(model.isEnabled() && model.isEditing() && model.isGlobalModified())) {
    
    194 194
                     if (model.isEditing()) {
    
    195 195
                         ui.stopEdit();
    
    196 196
                     }
    

  • client-core/src/main/java/fr/ird/observe/client/ui/content/ContentUIModel.java
    ... ... @@ -230,6 +230,9 @@ public abstract class ContentUIModel<E extends IdDto> extends AbstractSerializab
    230 230
             return modified;
    
    231 231
         }
    
    232 232
     
    
    233
    +    public boolean isGlobalModified() {
    
    234
    +        return isModified();
    
    235
    +    }
    
    233 236
         public void setModified(boolean modified) {
    
    234 237
             Object oldValue = this.modified;
    
    235 238
             this.modified = modified;
    

  • client-core/src/main/java/fr/ird/observe/client/ui/content/table/ContentTableUIHandler.java
    ... ... @@ -40,8 +40,8 @@ import fr.ird.observe.dto.data.seine.ActivitySeineDto;
    40 40
     import fr.ird.observe.dto.data.seine.TargetCatchDto;
    
    41 41
     import fr.ird.observe.dto.referential.SpeciesReference;
    
    42 42
     import fr.ird.observe.dto.referential.seine.WeightCategoryReference;
    
    43
    -import org.apache.logging.log4j.Logger;
    
    44 43
     import org.apache.logging.log4j.LogManager;
    
    44
    +import org.apache.logging.log4j.Logger;
    
    45 45
     import org.nuiton.validator.NuitonValidatorScope;
    
    46 46
     
    
    47 47
     import javax.swing.JButton;
    
    ... ... @@ -331,6 +331,12 @@ public abstract class ContentTableUIHandler<E extends IdDto, D extends IdDto, U
    331 331
     
    
    332 332
             U ui = getUi();
    
    333 333
     
    
    334
    +        if (getModel().isModified() || getModel().isCanSaveRow()) {
    
    335
    +
    
    336
    +            // flush modified line to model
    
    337
    +            getTableModel().updateRowFromEditBean();
    
    338
    +        }
    
    339
    +
    
    334 340
             List<D> objets = ui.getTableModel().getData();
    
    335 341
     
    
    336 342
             boolean canContinue;
    

  • client-core/src/main/java/fr/ird/observe/client/ui/content/table/ContentTableUIModel.java
    ... ... @@ -6,15 +6,15 @@
    6 6
      * %%
    
    7 7
      * This program is free software: you can redistribute it and/or modify
    
    8 8
      * it under the terms of the GNU General Public License as
    
    9
    - * published by the Free Software Foundation, either version 3 of the 
    
    9
    + * published by the Free Software Foundation, either version 3 of the
    
    10 10
      * License, or (at your option) any later version.
    
    11
    - * 
    
    11
    + *
    
    12 12
      * This program is distributed in the hope that it will be useful,
    
    13 13
      * but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    14 14
      * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    
    15 15
      * GNU General Public License for more details.
    
    16
    - * 
    
    17
    - * You should have received a copy of the GNU General Public 
    
    16
    + *
    
    17
    + * You should have received a copy of the GNU General Public
    
    18 18
      * License along with this program.  If not, see
    
    19 19
      * <http://www.gnu.org/licenses/gpl-3.0.html>.
    
    20 20
      * #L%
    
    ... ... @@ -25,8 +25,8 @@ import fr.ird.observe.client.ObserveSwingTechnicalException;
    25 25
     import fr.ird.observe.client.ui.content.ContentUIModel;
    
    26 26
     import fr.ird.observe.dto.IdDto;
    
    27 27
     import org.apache.commons.lang3.reflect.ConstructorUtils;
    
    28
    -import org.apache.logging.log4j.Logger;
    
    29 28
     import org.apache.logging.log4j.LogManager;
    
    29
    +import org.apache.logging.log4j.Logger;
    
    30 30
     import org.nuiton.util.beans.BinderModelBuilder;
    
    31 31
     
    
    32 32
     import javax.swing.DefaultListSelectionModel;
    
    ... ... @@ -165,6 +165,10 @@ public abstract class ContentTableUIModel<E extends IdDto, D extends IdDto> exte
    165 165
             }
    
    166 166
         }
    
    167 167
     
    
    168
    +    public boolean isGlobalModified() {
    
    169
    +        return super.isGlobalModified() || getTableModel().isModified() || isCanSaveRow();
    
    170
    +    }
    
    171
    +
    
    168 172
         public boolean isCanSaveRow() {
    
    169 173
             return canSaveRow;
    
    170 174
         }
    

  • services/src/main/java/fr/ird/observe/services/service/actions/consolidate/dcp/ConsolidateFloatingObjectResultBuilder.java
    ... ... @@ -70,20 +70,20 @@ public class ConsolidateFloatingObjectResultBuilder {
    70 70
                     }
    
    71 71
                     case FloatingObjectDto.PROPERTY_COMPUTED_WHEN_LEAVING_BIODEGRADABLE: {
    
    72 72
     
    
    73
    -                    FloatingObjectModification element = new FloatingObjectModification(dcp.getId(), modifiedProperty, dcp.getComputedWhenArrivingBiodegradable());
    
    73
    +                    FloatingObjectModification element = new FloatingObjectModification(dcp.getId(), modifiedProperty, dcp.getComputedWhenLeavingBiodegradable());
    
    74 74
                         modificationsBuilder.add(element);
    
    75 75
                         break;
    
    76 76
                     }
    
    77 77
                     case FloatingObjectDto.PROPERTY_COMPUTED_WHEN_LEAVING_NON_ENTANGLING: {
    
    78 78
     
    
    79
    -                    FloatingObjectModification element = new FloatingObjectModification(dcp.getId(), FloatingObjectDto.PROPERTY_COMPUTED_WHEN_LEAVING_NON_ENTANGLING, dcp.getComputedWhenLeavingNonEntangling());
    
    79
    +                    FloatingObjectModification element = new FloatingObjectModification(dcp.getId(), modifiedProperty, dcp.getComputedWhenLeavingNonEntangling());
    
    80 80
                         modificationsBuilder.add(element);
    
    81 81
     
    
    82 82
                         break;
    
    83 83
                     }
    
    84 84
                     case FloatingObjectDto.PROPERTY_COMPUTED_WHEN_LEAVING_SIMPLIFIED_OBJECT_TYPE: {
    
    85 85
     
    
    86
    -                    FloatingObjectModification element = new FloatingObjectModification(dcp.getId(), FloatingObjectDto.PROPERTY_COMPUTED_WHEN_LEAVING_SIMPLIFIED_OBJECT_TYPE, dcp.getComputedWhenLeavingSimplifiedObjectType());
    
    86
    +                    FloatingObjectModification element = new FloatingObjectModification(dcp.getId(), modifiedProperty, dcp.getComputedWhenLeavingSimplifiedObjectType());
    
    87 87
                         modificationsBuilder.add(element);
    
    88 88
                         break;
    
    89 89
                     }
    

  • services/src/main/java/fr/ird/observe/services/service/actions/consolidate/dcp/FloatingObjectConsolidateEngine.java
    ... ... @@ -122,19 +122,20 @@ public class FloatingObjectConsolidateEngine {
    122 122
         }
    
    123 123
     
    
    124 124
         private DcpComputedValue computeDcpBiodegradable0(Set<FloatingObjectPartDto> FloatingObjectPartDtos) {
    
    125
    -        DcpComputedValue result = DcpComputedValue.UNKNOWN;
    
    126
    -        if (!FloatingObjectPartDtos.isEmpty()) {
    
    127
    -            for (FloatingObjectPartDto FloatingObjectPartDto : FloatingObjectPartDtos) {
    
    128
    -                Boolean biodegradable = FloatingObjectPartDto.getObjectMaterial().getBiodegradable();
    
    129
    -                if (biodegradable==null) {
    
    130
    -                    continue;
    
    131
    -                }
    
    132
    -                if (!biodegradable) {
    
    133
    -                    result = DcpComputedValue.FALSE;
    
    134
    -                    break;
    
    135
    -                }
    
    136
    -                result = DcpComputedValue.TRUE;
    
    125
    +        if (FloatingObjectPartDtos.isEmpty()) {
    
    126
    +            return null;
    
    127
    +        }
    
    128
    +            DcpComputedValue result = DcpComputedValue.UNKNOWN;
    
    129
    +        for (FloatingObjectPartDto FloatingObjectPartDto : FloatingObjectPartDtos) {
    
    130
    +            Boolean biodegradable = FloatingObjectPartDto.getObjectMaterial().getBiodegradable();
    
    131
    +            if (biodegradable==null) {
    
    132
    +                continue;
    
    133
    +            }
    
    134
    +            if (!biodegradable) {
    
    135
    +                result = DcpComputedValue.FALSE;
    
    136
    +                break;
    
    137 137
                 }
    
    138
    +            result = DcpComputedValue.TRUE;
    
    138 139
             }
    
    139 140
             return result;
    
    140 141
         }
    
    ... ... @@ -148,19 +149,20 @@ public class FloatingObjectConsolidateEngine {
    148 149
         }
    
    149 150
     
    
    150 151
         private DcpComputedValue computeDcpNonEntangling0(Set<FloatingObjectPartDto> FloatingObjectPartDtos) {
    
    152
    +        if (FloatingObjectPartDtos.isEmpty()) {
    
    153
    +            return null;
    
    154
    +        }
    
    151 155
             DcpComputedValue result = DcpComputedValue.UNKNOWN;
    
    152
    -        if (!FloatingObjectPartDtos.isEmpty()) {
    
    153
    -            for (FloatingObjectPartDto FloatingObjectPartDto : FloatingObjectPartDtos) {
    
    154
    -                Boolean nonEntangling = FloatingObjectPartDto.getObjectMaterial().getNonEntangling();
    
    155
    -                if (nonEntangling==null) {
    
    156
    -                    continue;
    
    157
    -                }
    
    158
    -                if (!nonEntangling) {
    
    159
    -                    result = DcpComputedValue.FALSE;
    
    160
    -                    break;
    
    161
    -                }
    
    162
    -                result = DcpComputedValue.TRUE;
    
    156
    +        for (FloatingObjectPartDto FloatingObjectPartDto : FloatingObjectPartDtos) {
    
    157
    +            Boolean nonEntangling = FloatingObjectPartDto.getObjectMaterial().getNonEntangling();
    
    158
    +            if (nonEntangling==null) {
    
    159
    +                continue;
    
    160
    +            }
    
    161
    +            if (!nonEntangling) {
    
    162
    +                result = DcpComputedValue.FALSE;
    
    163
    +                break;
    
    163 164
                 }
    
    165
    +            result = DcpComputedValue.TRUE;
    
    164 166
             }
    
    165 167
             return result;
    
    166 168
         }