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

Commits:

7 changed files:

Changes:

  • client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/ContentUIManager.java
    ... ... @@ -90,7 +90,7 @@ public class ContentUIManager {
    90 90
                 // no content ui
    
    91 91
                 return true;
    
    92 92
             }
    
    93
    -        log.info(String.format("[%s] Will close ui", ui.getClass().getSimpleName()));
    
    93
    +        log.info(String.format("%sWill close ui", ui.getModel().getPrefix()));
    
    94 94
             boolean closed;
    
    95 95
             try {
    
    96 96
                 closed = ui.close();
    

  • client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/ContentUIModelStates.java
    ... ... @@ -170,7 +170,12 @@ public class ContentUIModelStates extends AbstractJavaBean implements Closeable,
    170 170
             return Objects.requireNonNull(mode).getValidationContext();
    
    171 171
         }
    
    172 172
     
    
    173
    -    public boolean canQuit() {
    
    173
    +    /**
    
    174
    +     * Test if we can qui the form.
    
    175
    +     *
    
    176
    +     * @return {@code null} if was canceled, {@code true} if form can be quit, {@code false} otherwise.
    
    177
    +     */
    
    178
    +    public Boolean canQuit() {
    
    174 179
             if (!isEnabled()) {
    
    175 180
                 // model disabled, no check
    
    176 181
                 return true;
    
    ... ... @@ -183,12 +188,8 @@ public class ContentUIModelStates extends AbstractJavaBean implements Closeable,
    183 188
                 // model in reading mode, no check
    
    184 189
                 return true;
    
    185 190
             }
    
    186
    -        if (!isGlobalModified()) {
    
    187
    -            // model not modified, no check
    
    188
    -            return true;
    
    189
    -        }
    
    190
    -        // check model is valid
    
    191
    -        return isValid();
    
    191
    +        // can quit only if model not modified
    
    192
    +        return !isGlobalModified();
    
    192 193
         }
    
    193 194
     
    
    194 195
         public boolean isEnabled() {
    

  • client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/actions/open/ContentOpen.java
    ... ... @@ -339,7 +339,11 @@ public class ContentOpen<U extends ContentUI> {
    339 339
             String prefix = ui.getModel().getPrefix();
    
    340 340
             log.info(String.format("%s Try to close content...", prefix));
    
    341 341
             ContentUIModelStates states = ui.getModel().getStates();
    
    342
    -        boolean canQuit = states.canQuit();
    
    342
    +        Boolean canQuit = states.canQuit();
    
    343
    +        if (canQuit == null) {
    
    344
    +            // cancel
    
    345
    +            return Close.CANCEL;
    
    346
    +        }
    
    343 347
             if (canQuit) {
    
    344 348
                 // simple close
    
    345 349
                 return Close.CLOSE;
    

  • client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/data/table/ContentTableUIModelStates.java
    ... ... @@ -124,8 +124,14 @@ public class ContentTableUIModelStates<D extends DataDto, C extends ContainerChi
    124 124
         }
    
    125 125
     
    
    126 126
         @Override
    
    127
    -    public boolean canQuit() {
    
    128
    -        return isReadingMode() || (getTableModel().isCanQuitEditingRow() && super.canQuit());
    
    127
    +    public Boolean canQuit() {
    
    128
    +        if (isReadingMode()) {
    
    129
    +            return true;
    
    130
    +        }
    
    131
    +        if (!getTableModel().isCanQuitEditingRow()) {
    
    132
    +            return null;
    
    133
    +        }
    
    134
    +        return super.canQuit();
    
    129 135
         }
    
    130 136
     
    
    131 137
         public boolean isCanSaveRow() {
    

  • client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/referential/ContentReferentialUIModelStates.java
    ... ... @@ -98,24 +98,6 @@ public abstract class ContentReferentialUIModelStates<D extends ReferentialDto,
    98 98
             }
    
    99 99
         }
    
    100 100
     
    
    101
    -    @Override
    
    102
    -    public boolean canQuit() {
    
    103
    -        if (!isEnabled()) {
    
    104
    -            // model disabled, no check
    
    105
    -            return true;
    
    106
    -        }
    
    107
    -        if (!isEditing()) {
    
    108
    -            // model not editing, no check
    
    109
    -            return true;
    
    110
    -        }
    
    111
    -        if (isReadingMode()) {
    
    112
    -            // model in reading mode, no check
    
    113
    -            return true;
    
    114
    -        }
    
    115
    -        // can quit only if model not modified
    
    116
    -        return !isGlobalModified();
    
    117
    -    }
    
    118
    -
    
    119 101
         public D getBeanToSave() {
    
    120 102
             return getBean();
    
    121 103
         }
    

  • client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/localmarket/TripBatchUI.jaxx
    ... ... @@ -123,7 +123,7 @@
    123 123
       <Table id='extraZone' fill='both' weightx='1' insets='0'>
    
    124 124
         <row>
    
    125 125
           <cell weighty='1'>
    
    126
    -        <BigTextEditor id="comment"/>
    
    126
    +        <BigTextEditor id="comment" title="observe.Common.logbookComment" styleClass="skipI18n"/>
    
    127 127
           </cell>
    
    128 128
         </row>
    
    129 129
       </Table>
    

  • core/persistence/java/src/main/java/fr/ird/observe/entities/data/ps/common/TripBatchSpi.java
    ... ... @@ -24,6 +24,7 @@ package fr.ird.observe.entities.data.ps.common;
    24 24
     
    
    25 25
     import fr.ird.observe.dto.data.ps.localmarket.TripBatchDto;
    
    26 26
     import fr.ird.observe.dto.form.Form;
    
    27
    +import fr.ird.observe.dto.referential.ReferentialLocale;
    
    27 28
     import fr.ird.observe.dto.referential.ps.localmarket.PackagingReference;
    
    28 29
     import fr.ird.observe.entities.referential.common.Harbour;
    
    29 30
     import fr.ird.observe.entities.referential.ps.localmarket.Packaging;
    
    ... ... @@ -42,6 +43,18 @@ public class TripBatchSpi extends GeneratedTripBatchSpi {
    42 43
             form.getObject().setAvailablePackagings(availablePackaging);
    
    43 44
         }
    
    44 45
     
    
    46
    +    @Override
    
    47
    +    public void toDto(ReferentialLocale referentialLocale, Trip entity, TripBatchDto dto) {
    
    48
    +        super.toDto(referentialLocale, entity, dto);
    
    49
    +        dto.setComment(entity.getLogbookComment());
    
    50
    +    }
    
    51
    +
    
    52
    +    @Override
    
    53
    +    public void fromDto(ReferentialLocale referentialLocale, Trip entity, TripBatchDto dto) {
    
    54
    +        super.fromDto(referentialLocale, entity, dto);
    
    55
    +        entity.setLogbookComment(dto.getComment());
    
    56
    +    }
    
    57
    +
    
    45 58
         protected LinkedHashSet<PackagingReference> getPackaging(ServiceContext context, Trip trip) {
    
    46 59
             Harbour landingHarbour = trip.getLandingHarbour();
    
    47 60
             Date date = trip.getEndDate();