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

Commits:

16 changed files:

Changes:

  • client-core/src/main/i18n/getters/java.getter
    ... ... @@ -730,6 +730,10 @@ observe.common.TripDto.action.goToOpen.tip
    730 730
     observe.common.TripDto.action.moves
    
    731 731
     observe.common.TripDto.action.moves.tip
    
    732 732
     observe.common.TripLonglineDto.message.not.open
    
    733
    +observe.common.TripLonglineDto.with.logbooks.message
    
    734
    +observe.common.TripLonglineDto.with.logbooks.title
    
    735
    +observe.common.TripLonglineDto.with.observations.message
    
    736
    +observe.common.TripLonglineDto.with.observations.title
    
    733 737
     observe.common.TripLonglineLandingDto.action.delete.tip
    
    734 738
     observe.common.TripLonglineLandingDto.action.goToOpen.short
    
    735 739
     observe.common.TripLonglineLandingDto.action.goToOpen.tip
    

  • client-core/src/main/java/fr/ird/observe/client/ui/content/data/ll/common/TripLonglineUI.jaxx
    ... ... @@ -69,16 +69,6 @@
    69 69
         <field name='activityLonglineObs' component='{actionDown}'/>
    
    70 70
       </BeanValidator>
    
    71 71
     
    
    72
    -  <script><![CDATA[
    
    73
    -
    
    74
    -protected boolean canEditOcean(java.util.LinkedHashSet<TripLonglineActivityObsDto> activities) {
    
    75
    -    return activities == null || activities.isEmpty();
    
    76
    -}
    
    77
    -
    
    78
    -]]>
    
    79
    -  </script>
    
    80
    -
    
    81
    -  <!-- formulaire -->
    
    82 72
       <JPanel id="body" layout='{new BorderLayout()}'>
    
    83 73
         <JScrollPane id='bodyScrollPane' constraints='BorderLayout.CENTER'>
    
    84 74
         <JTabbedPane id='mainTabbedPane'>
    
    ... ... @@ -226,7 +216,7 @@ protected boolean canEditOcean(java.util.LinkedHashSet<TripLonglineActivityObsDt
    226 216
                   <JLabel id='availableDataLabel'/>
    
    227 217
                 </cell>
    
    228 218
                 <cell anchor='west' weightx="0.5">
    
    229
    -              <JPanel layout="{new GridLayout(1,0)}">
    
    219
    +              <JPanel layout="{new GridLayout(1,0)}" beanScope="model">
    
    230 220
                     <BeanCheckBox id='observationsAvailability'/>
    
    231 221
                     <BeanCheckBox id='logbookAvailability'/>
    
    232 222
                   </JPanel>
    

  • client-core/src/main/java/fr/ird/observe/client/ui/content/data/ll/common/TripLonglineUI.jcss
    ... ... @@ -46,13 +46,9 @@
    46 46
     }
    
    47 47
     
    
    48 48
     /* ***************************************************************************** */
    
    49
    -/*  CARACTERISTICS TAB ********************************************************* */
    
    49
    +/*  GENERAL TAB **************************************************************** */
    
    50 50
     /* ***************************************************************************** */
    
    51 51
     
    
    52
    -#ocean {
    
    53
    -  enabled:{canEditOcean(bean.getActivityLonglineObs())};
    
    54
    -}
    
    55
    -
    
    56 52
     #totalFishingOperationsNumber {
    
    57 53
       font-weight:bold;
    
    58 54
       text:{getStringValue(bean.getTotalFishingOperationsNumber())};
    

  • client-core/src/main/java/fr/ird/observe/client/ui/content/data/ll/common/TripLonglineUIHandler.java
    ... ... @@ -10,12 +10,12 @@ package fr.ird.observe.client.ui.content.data.ll.common;
    10 10
      * it under the terms of the GNU General Public License as
    
    11 11
      * published by the Free Software Foundation, either version 3 of the
    
    12 12
      * License, or (at your option) any later version.
    
    13
    - * 
    
    13
    + *
    
    14 14
      * This program is distributed in the hope that it will be useful,
    
    15 15
      * but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    16 16
      * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    
    17 17
      * GNU General Public License for more details.
    
    18
    - * 
    
    18
    + *
    
    19 19
      * You should have received a copy of the GNU General Public
    
    20 20
      * License along with this program.  If not, see
    
    21 21
      * <http://www.gnu.org/licenses/gpl-3.0.html>.
    
    ... ... @@ -28,6 +28,7 @@ import fr.ird.observe.client.ui.content.api.data.open.ContentOpenableUIHandler;
    28 28
     import fr.ird.observe.client.ui.content.api.spi.ContentUIReferenceCache;
    
    29 29
     import fr.ird.observe.client.ui.content.api.spi.ReferentialReferencesFilter;
    
    30 30
     import fr.ird.observe.client.ui.content.api.ui.ObserveLayoutFocusTraversalPolicy;
    
    31
    +import fr.ird.observe.client.ui.util.UIHelper;
    
    31 32
     import fr.ird.observe.client.ui.util.tripMap.TripMapUI;
    
    32 33
     import fr.ird.observe.dto.data.TripMapDto;
    
    33 34
     import fr.ird.observe.dto.data.ll.common.TripLonglineDto;
    
    ... ... @@ -50,6 +51,12 @@ import javax.swing.JTabbedPane;
    50 51
     import javax.swing.SwingUtilities;
    
    51 52
     import java.awt.Component;
    
    52 53
     import java.awt.Container;
    
    54
    +import java.beans.PropertyChangeEvent;
    
    55
    +import java.beans.PropertyVetoException;
    
    56
    +import java.beans.VetoableChangeListener;
    
    57
    +import java.util.Objects;
    
    58
    +
    
    59
    +import static io.ultreia.java4all.i18n.I18n.t;
    
    53 60
     
    
    54 61
     /**
    
    55 62
      * Created on 8/27/14.
    
    ... ... @@ -62,6 +69,13 @@ class TripLonglineUIHandler extends ContentOpenableUIHandler<TripLonglineDto, Tr
    62 69
         private static final Logger log = LogManager.getLogger(TripLonglineUIHandler.class);
    
    63 70
     
    
    64 71
         private boolean buildTripMap = true;
    
    72
    +    private final VetoableChangeListener logbooksAvailabilityListener;
    
    73
    +    private final VetoableChangeListener observationsAvailabilityListener;
    
    74
    +
    
    75
    +    TripLonglineUIHandler() {
    
    76
    +        logbooksAvailabilityListener = this::onLogbooksAvailabilityChanged;
    
    77
    +        observationsAvailabilityListener = this::onObservationsAvailabilityChanged;
    
    78
    +    }
    
    65 79
     
    
    66 80
         @Override
    
    67 81
         public TripLonglineUIModel getModel() {
    
    ... ... @@ -76,7 +90,7 @@ class TripLonglineUIHandler extends ContentOpenableUIHandler<TripLonglineDto, Tr
    76 90
             referenceCache.addReferentialFilter(TripLonglineDto.PROPERTY_LOGBOOK_DATA_ENTRY_OPERATOR, (ReferentialReferencesFilter<PersonDto, PersonReference>) PersonHelper::filterDataEntryOperatorReferences);
    
    77 91
             referenceCache.addReferentialFilter(TripLonglineDto.PROPERTY_VESSEL, (ReferentialReferencesFilter<VesselDto, VesselReference>) incomingReferences -> {
    
    78 92
                 ClientConfig config = ObserveSwingApplicationContext.get().getConfig();
    
    79
    -            return  VesselHelper.filterVesselReferencesByVesselTypeIds(incomingReferences, config.getLonglineVesselTypeIds());
    
    93
    +            return VesselHelper.filterVesselReferencesByVesselTypeIds(incomingReferences, config.getLonglineVesselTypeIds());
    
    80 94
             });
    
    81 95
             referenceCache.addReferentialFilter(TripLonglineDto.PROPERTY_SPECIES, (ReferentialReferencesFilter<SpeciesDto, SpeciesReference>) incomingReferences -> {
    
    82 96
                 String speciesListId = ObserveSwingApplicationContext.get().getConfig().getSpeciesListLonglineTripId();
    
    ... ... @@ -95,7 +109,7 @@ class TripLonglineUIHandler extends ContentOpenableUIHandler<TripLonglineDto, Tr
    95 109
             tripMap.getHandler().init(ui.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW));
    
    96 110
             tripMap.addPropertyChangeListener(TripMapUI.PROPERTY_SHOW_OBSERVATION, e -> updateMapModel());
    
    97 111
             tripMap.addPropertyChangeListener(TripMapUI.PROPERTY_SHOW_LOGBOOK, e -> updateMapModel());
    
    98
    -        getUi().getMainTabbedPane().addChangeListener(e -> {
    
    112
    +        ui.getMainTabbedPane().addChangeListener(e -> {
    
    99 113
                 JTabbedPane tripLonglineTabPane = (JTabbedPane) e.getSource();
    
    100 114
                 TripLonglineUI ui1 = getUi();
    
    101 115
                 TripMapUI tripMap1 = ui1.getTripMap();
    
    ... ... @@ -201,6 +215,43 @@ class TripLonglineUIHandler extends ContentOpenableUIHandler<TripLonglineDto, Tr
    201 215
             buildTripMap = true;
    
    202 216
         }
    
    203 217
     
    
    218
    +    @Override
    
    219
    +    public void startEditUI() {
    
    220
    +        super.startEditUI();
    
    221
    +        TripLonglineUIModel model = getModel();
    
    222
    +        TripLonglineDto bean = model.getBean();
    
    223
    +        ui.getOcean().setEnabled(bean.getActivityObsCount() == 0 && bean.getActivityLogbookCount() == 0);
    
    224
    +        if (model.isUpdatingMode()) {
    
    225
    +            model.removeVetoableChangeListener(TripLonglineDto.PROPERTY_LOGBOOK_AVAILABILITY, logbooksAvailabilityListener);
    
    226
    +            model.removeVetoableChangeListener(TripLonglineDto.PROPERTY_OBSERVATIONS_AVAILABILITY, observationsAvailabilityListener);
    
    227
    +            model.addVetoableChangeListener(TripLonglineDto.PROPERTY_LOGBOOK_AVAILABILITY, logbooksAvailabilityListener);
    
    228
    +            model.addVetoableChangeListener(TripLonglineDto.PROPERTY_OBSERVATIONS_AVAILABILITY, observationsAvailabilityListener);
    
    229
    +        }
    
    230
    +    }
    
    231
    +
    
    232
    +    @Override
    
    233
    +    public void stopEditUI() {
    
    234
    +        getModel().removeVetoableChangeListener(TripLonglineDto.PROPERTY_LOGBOOK_AVAILABILITY, logbooksAvailabilityListener);
    
    235
    +        getModel().removeVetoableChangeListener(TripLonglineDto.PROPERTY_OBSERVATIONS_AVAILABILITY, observationsAvailabilityListener);
    
    236
    +        super.stopEditUI();
    
    237
    +    }
    
    238
    +
    
    239
    +    private void onLogbooksAvailabilityChanged(PropertyChangeEvent event) throws PropertyVetoException {
    
    240
    +        if (getModel().isUpdatingMode() && Objects.equals(Boolean.FALSE, event.getNewValue()) && getModel().getBean().getActivityLogbookCount() > 0) {
    
    241
    +            String message = t("observe.common.TripLonglineDto.with.logbooks.message");
    
    242
    +            UIHelper.displayWarning(t("observe.common.TripLonglineDto.with.logbooks.title"), message);
    
    243
    +            throw new PropertyVetoException(message, event);
    
    244
    +        }
    
    245
    +    }
    
    246
    +
    
    247
    +    private void onObservationsAvailabilityChanged(PropertyChangeEvent event) throws PropertyVetoException {
    
    248
    +        if (getModel().isUpdatingMode() && Objects.equals(Boolean.FALSE, event.getNewValue()) && getModel().getBean().getActivityObsCount() > 0) {
    
    249
    +            String message = t("observe.common.TripLonglineDto.with.observations.message");
    
    250
    +            UIHelper.displayWarning(t("observe.common.TripLonglineDto.with.observations.title"), message);
    
    251
    +            throw new PropertyVetoException(message, event);
    
    252
    +        }
    
    253
    +    }
    
    254
    +
    
    204 255
         private void buildTripMap() {
    
    205 256
             SwingUtilities.invokeLater(() -> {
    
    206 257
                 ObserveSwingApplicationContext.get().getMainUI().getModel().setBusy(true);
    

  • client-core/src/main/java/fr/ird/observe/client/ui/content/data/ll/common/TripLonglineUIModel.java
    ... ... @@ -10,12 +10,12 @@ package fr.ird.observe.client.ui.content.data.ll.common;
    10 10
      * it under the terms of the GNU General Public License as
    
    11 11
      * published by the Free Software Foundation, either version 3 of the
    
    12 12
      * License, or (at your option) any later version.
    
    13
    - * 
    
    13
    + *
    
    14 14
      * This program is distributed in the hope that it will be useful,
    
    15 15
      * but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    16 16
      * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    
    17 17
      * GNU General Public License for more details.
    
    18
    - * 
    
    18
    + *
    
    19 19
      * You should have received a copy of the GNU General Public
    
    20 20
      * License along with this program.  If not, see
    
    21 21
      * <http://www.gnu.org/licenses/gpl-3.0.html>.
    
    ... ... @@ -27,11 +27,16 @@ import fr.ird.observe.client.ui.content.api.data.open.ContentOpenableUIModel;
    27 27
     import fr.ird.observe.dto.data.ll.common.TripLonglineDto;
    
    28 28
     import fr.ird.observe.dto.data.ll.common.TripLonglineReference;
    
    29 29
     import fr.ird.observe.dto.form.Form;
    
    30
    +import io.ultreia.java4all.bean.JavaBean;
    
    31
    +import io.ultreia.java4all.bean.definition.JavaBeanDefinition;
    
    32
    +import io.ultreia.java4all.bean.spi.GenerateJavaBeanDefinition;
    
    33
    +import io.ultreia.java4all.i18n.I18n;
    
    30 34
     import org.apache.logging.log4j.LogManager;
    
    31 35
     import org.apache.logging.log4j.Logger;
    
    32
    -import io.ultreia.java4all.i18n.I18n;
    
    33 36
     import org.nuiton.util.DateUtil;
    
    34 37
     
    
    38
    +import java.beans.PropertyChangeListener;
    
    39
    +import java.beans.PropertyVetoException;
    
    35 40
     import java.util.Date;
    
    36 41
     
    
    37 42
     /**
    
    ... ... @@ -40,7 +45,9 @@ import java.util.Date;
    40 45
      * @author Tony Chemit - dev@tchemit.fr
    
    41 46
      * @since XXX
    
    42 47
      */
    
    43
    -public class TripLonglineUIModel extends ContentOpenableUIModel<TripLonglineDto, TripLonglineReference> {
    
    48
    +@SuppressWarnings("WeakerAccess")
    
    49
    +@GenerateJavaBeanDefinition
    
    50
    +public class TripLonglineUIModel extends ContentOpenableUIModel<TripLonglineDto, TripLonglineReference> implements JavaBean {
    
    44 51
     
    
    45 52
         private static final long serialVersionUID = 1L;
    
    46 53
         private static final Logger log = LogManager.getLogger(TripLonglineUIModel.class);
    
    ... ... @@ -49,6 +56,34 @@ public class TripLonglineUIModel extends ContentOpenableUIModel<TripLonglineDto,
    49 56
             super(TripLonglineDto.class, I18n.n("observe.common.TripLonglineDto.message.not.open"));
    
    50 57
         }
    
    51 58
     
    
    59
    +    public boolean isLogbookAvailability() {
    
    60
    +        return getBean().isLogbookAvailability();
    
    61
    +    }
    
    62
    +
    
    63
    +    public void setLogbookAvailability(boolean logbookAvailability) {
    
    64
    +        try {
    
    65
    +            boolean oldValue = isLogbookAvailability();
    
    66
    +            fireVetoableChange(TripLonglineDto.PROPERTY_LOGBOOK_AVAILABILITY, oldValue, logbookAvailability);
    
    67
    +            getBean().setLogbookAvailability(logbookAvailability);
    
    68
    +            firePropertyChange(TripLonglineDto.PROPERTY_LOGBOOK_AVAILABILITY, oldValue, logbookAvailability);
    
    69
    +        } catch (PropertyVetoException ignored) {
    
    70
    +        }
    
    71
    +    }
    
    72
    +
    
    73
    +    public boolean isObservationsAvailability() {
    
    74
    +        return getBean().isObservationsAvailability();
    
    75
    +    }
    
    76
    +
    
    77
    +    public void setObservationsAvailability(boolean observationsAvailability) {
    
    78
    +        try {
    
    79
    +            boolean oldValue = isObservationsAvailability();
    
    80
    +            fireVetoableChange(TripLonglineDto.PROPERTY_OBSERVATIONS_AVAILABILITY, oldValue, observationsAvailability);
    
    81
    +            getBean().setObservationsAvailability(observationsAvailability);
    
    82
    +            firePropertyChange(TripLonglineDto.PROPERTY_OBSERVATIONS_AVAILABILITY, oldValue, observationsAvailability);
    
    83
    +        } catch (PropertyVetoException ignored) {
    
    84
    +        }
    
    85
    +    }
    
    86
    +
    
    52 87
         @Override
    
    53 88
         public void openForm(Form<TripLonglineDto> form) {
    
    54 89
             super.openForm(form);
    
    ... ... @@ -59,19 +94,22 @@ public class TripLonglineUIModel extends ContentOpenableUIModel<TripLonglineDto,
    59 94
                 getBean().setEndDate(date);
    
    60 95
                 log.debug(getPrefix() + "date fin " + date);
    
    61 96
             }
    
    97
    +        firePropertyChange(TripLonglineDto.PROPERTY_LOGBOOK_AVAILABILITY, isLogbookAvailability());
    
    98
    +        firePropertyChange(TripLonglineDto.PROPERTY_OBSERVATIONS_AVAILABILITY, isObservationsAvailability());
    
    62 99
         }
    
    63 100
     
    
    64 101
         @Override
    
    102
    +
    
    65 103
         public void init(ContentUI ui) {
    
    66 104
             super.init(ui);
    
    67 105
     
    
    68
    -        getBean().addPropertyChangeListener(TripLonglineDto.PROPERTY_START_DATE, e->{
    
    69
    -            TripLonglineDto bean = (TripLonglineDto) e.getSource();
    
    70
    -            bean.updateNoOfDays();
    
    71
    -        });
    
    72
    -        getBean().addPropertyChangeListener(TripLonglineDto.PROPERTY_END_DATE, e->{
    
    73
    -            TripLonglineDto bean = (TripLonglineDto) e.getSource();
    
    74
    -            bean.updateNoOfDays();
    
    75
    -        });
    
    106
    +        PropertyChangeListener propertyChangeListener = e -> ((TripLonglineDto) e.getSource()).updateNoOfDays();
    
    107
    +        getBean().addPropertyChangeListener(TripLonglineDto.PROPERTY_START_DATE, propertyChangeListener);
    
    108
    +        getBean().addPropertyChangeListener(TripLonglineDto.PROPERTY_END_DATE, propertyChangeListener);
    
    109
    +    }
    
    110
    +
    
    111
    +    @Override
    
    112
    +    public JavaBeanDefinition javaBeanDefinition() {
    
    113
    +        return new TripLonglineUIModelJavaBeanDefinition();
    
    76 114
         }
    
    77 115
     }

  • client-core/src/main/java/fr/ird/observe/client/ui/content/data/ll/landing/TripLonglineLandingUI.jaxx
    ... ... @@ -106,26 +106,26 @@
    106 106
                         </cell>
    
    107 107
                       </row>
    
    108 108
     
    
    109
    -                  <!-- vessel -->
    
    109
    +                  <!-- harbour -->
    
    110 110
                       <row>
    
    111 111
                         <cell>
    
    112
    -                      <JLabel id='vesselLabel'/>
    
    112
    +                      <JLabel id='harbourLabel'/>
    
    113 113
                         </cell>
    
    114 114
                         <cell weightx='1' anchor='east'>
    
    115
    -                      <BeanFilterableComboBox id='vessel' constructorParams='this' genericType='VesselReference'/>
    
    115
    +                      <JPanel layout="{new BorderLayout()}">
    
    116
    +                      <BeanFilterableComboBox id='harbour' constructorParams='this' genericType='HarbourReference' constraints='BorderLayout.CENTER'/>
    
    117
    +                        <JButton id='selectTransshipment' constraints='BorderLayout.EAST'/>
    
    118
    +                      </JPanel>
    
    116 119
                         </cell>
    
    117 120
                       </row>
    
    118 121
     
    
    119
    -                  <!-- harbour -->
    
    122
    +                  <!-- vessel -->
    
    120 123
                       <row>
    
    121 124
                         <cell>
    
    122
    -                      <JLabel id='harbourLabel'/>
    
    125
    +                      <JLabel id='vesselLabel'/>
    
    123 126
                         </cell>
    
    124 127
                         <cell weightx='1' anchor='east'>
    
    125
    -                      <JPanel layout="{new BorderLayout()}">
    
    126
    -                      <BeanFilterableComboBox id='harbour' constructorParams='this' genericType='HarbourReference' constraints='BorderLayout.CENTER'/>
    
    127
    -                        <JButton id='selectTransshipment' constraints='BorderLayout.EAST'/>
    
    128
    -                      </JPanel>
    
    128
    +                      <BeanFilterableComboBox id='vessel' constructorParams='this' genericType='VesselReference'/>
    
    129 129
                         </cell>
    
    130 130
                       </row>
    
    131 131
     
    

  • client-core/src/main/java/fr/ird/observe/client/ui/content/data/ps/common/TripSeineUI.jaxx
    ... ... @@ -76,15 +76,6 @@
    76 76
         <field name='route' component='{actionDown}'/>
    
    77 77
       </BeanValidator>
    
    78 78
     
    
    79
    -  <script><![CDATA[
    
    80
    -
    
    81
    -protected boolean canEditOcean(java.util.LinkedHashSet<RouteStubDto> routes) {
    
    82
    -    return routes == null || routes.isEmpty();
    
    83
    -}
    
    84
    -
    
    85
    -]]>
    
    86
    -  </script>
    
    87
    -
    
    88 79
       <!-- formulaire -->
    
    89 80
       <JPanel id="body" layout='{new BorderLayout()}'>
    
    90 81
         <JScrollPane id='bodyScrollPane' constraints='BorderLayout.CENTER'>
    

  • client-core/src/main/java/fr/ird/observe/client/ui/content/data/ps/common/TripSeineUI.jcss
    ... ... @@ -20,18 +20,6 @@
    20 20
      * #L%
    
    21 21
      */
    
    22 22
     
    
    23
    -#ocean {
    
    24
    -  enabled:{canEditOcean(bean.getRoute())};
    
    25
    -}
    
    26
    -
    
    27
    -#formsUrl {
    
    28
    -  openLinkTip:"observe.common.TripSeineDto.action.openLinkFormsUrl.tip";
    
    29
    -}
    
    30
    -
    
    31
    -#reportsUrl {
    
    32
    -  openLinkTip:"observe.common.TripSeineDto.action.openLinkReportsUrl.tip";
    
    33
    -}
    
    34
    -
    
    35 23
     #reopen {
    
    36 24
       _toolTipText:{t("observe.common.TripDto.action.reopen.tip")};
    
    37 25
     }
    
    ... ... @@ -57,6 +45,18 @@
    57 45
       _observeAction:{MoveSingleTripSeineUIAction.ACTION_NAME};
    
    58 46
     }
    
    59 47
     
    
    48
    +/* ***************************************************************************** */
    
    49
    +/*  GENERAL TAB **************************************************************** */
    
    50
    +/* ***************************************************************************** */
    
    51
    +
    
    52
    +#formsUrl {
    
    53
    +  openLinkTip:"observe.common.TripSeineDto.action.openLinkFormsUrl.tip";
    
    54
    +}
    
    55
    +
    
    56
    +#reportsUrl {
    
    57
    +  openLinkTip:"observe.common.TripSeineDto.action.openLinkReportsUrl.tip";
    
    58
    +}
    
    59
    +
    
    60 60
     /* ***************************************************************************** */
    
    61 61
     /*  MAP TAB ******************************************************************** */
    
    62 62
     /* ***************************************************************************** */
    

  • client-core/src/main/java/fr/ird/observe/client/ui/content/data/ps/common/TripSeineUIHandler.java
    ... ... @@ -164,5 +164,11 @@ class TripSeineUIHandler extends ContentOpenableUIHandler<TripSeineDto, TripSein
    164 164
             getUi().getTripMap().getHandler().doCloseMap();
    
    165 165
             buildTripMap = true;
    
    166 166
         }
    
    167
    +
    
    168
    +    @Override
    
    169
    +    public void startEditUI() {
    
    170
    +        super.startEditUI();
    
    171
    +        ui.getOcean().setEnabled(getModel().getBean().getRouteCount() == 0);
    
    172
    +    }
    
    167 173
     }
    
    168 174
     

  • client-core/src/main/java/fr/ird/observe/client/ui/tree/navigation/NavigationTreeCellRenderer.java
    ... ... @@ -31,6 +31,7 @@ import org.jdesktop.swingx.tree.DefaultXTreeCellRenderer;
    31 31
     import javax.swing.Icon;
    
    32 32
     import javax.swing.JLabel;
    
    33 33
     import javax.swing.JTree;
    
    34
    +import javax.swing.SwingUtilities;
    
    34 35
     import javax.swing.tree.DefaultTreeCellRenderer;
    
    35 36
     import java.awt.Color;
    
    36 37
     import java.awt.Component;
    
    ... ... @@ -95,6 +96,13 @@ public class NavigationTreeCellRenderer extends DefaultXTreeCellRenderer impleme
    95 96
                 Dimension newSize = new Dimension((int) size.getWidth(), 32);
    
    96 97
                 comp.setSize(newSize);
    
    97 98
                 comp.setPreferredSize(newSize);
    
    99
    +        } else {
    
    100
    +            int stringWidth = SwingUtilities.computeStringWidth(comp.getFontMetrics(comp.getFont()), text);
    
    101
    +            if (size.getWidth()<stringWidth) {
    
    102
    +                log.error(String.format("Size is too low: %s for node: %s", size, text));
    
    103
    +                Dimension newSize = new Dimension(stringWidth+5, (int)height);
    
    104
    +                comp.setPreferredSize(newSize);
    
    105
    +            }
    
    98 106
             }
    
    99 107
             return comp;
    
    100 108
         }
    

  • observe-i18n/src/main/i18n/translations/observe_en_GB.properties
    ... ... @@ -2396,6 +2396,10 @@ observe.common.TripLonglineDto.tripType=Trip type
    2396 2396
     observe.common.TripLonglineDto.type=Trip
    
    2397 2397
     observe.common.TripLonglineDto.types=Trips
    
    2398 2398
     observe.common.TripLonglineDto.vessel=Vessel
    
    2399
    +observe.common.TripLonglineDto.with.logbooks.message=There is some logbook in this trip, can't unselect logbook avaibility
    
    2400
    +observe.common.TripLonglineDto.with.logbooks.title=Can't remove logbook avaibility
    
    2401
    +observe.common.TripLonglineDto.with.observations.message=There is some observations in this trip, can't unselect observations avaibility
    
    2402
    +observe.common.TripLonglineDto.with.observations.title=Can't remove observation avaibility
    
    2399 2403
     observe.common.TripLonglineGearUseDto.gearUseFeaturesLongline=Gear use features
    
    2400 2404
     observe.common.TripLonglineLandingDto.action.close.tip=Close the opened landing
    
    2401 2405
     observe.common.TripLonglineLandingDto.action.create=Next landing
    
    ... ... @@ -3374,6 +3378,7 @@ observe.validation.hooksComposition.desactivated.hookSize=Selected hook size is
    3374 3378
     observe.validation.hooksComposition.desactivated.hookType=Selected hook type is disabled.
    
    3375 3379
     observe.validation.hooksComposition.required.hookType=Hook type must be filled.
    
    3376 3380
     observe.validation.hooksComposition.required.proportion=Proportion must be filled.
    
    3381
    +observe.validation.landing.endDate.after.startDate=End date must be after start date.
    
    3377 3382
     observe.validation.landingPartLongline.bound.categoryWeight=Max category must be strictly greater than min category.
    
    3378 3383
     observe.validation.landingPartLongline.required.weight=Weight must be filled.
    
    3379 3384
     observe.validation.landingPartLongline.required.weightMeasureMethod=Weight measure method must be filled.
    

  • observe-i18n/src/main/i18n/translations/observe_es_ES.properties
    ... ... @@ -2396,6 +2396,10 @@ observe.common.TripLonglineDto.tripType=Tipo de marea
    2396 2396
     observe.common.TripLonglineDto.type=Marea
    
    2397 2397
     observe.common.TripLonglineDto.types=Mareas
    
    2398 2398
     observe.common.TripLonglineDto.vessel=Buque
    
    2399
    +observe.common.TripLonglineDto.with.logbooks.message=There is some logbook in this trip, can't unselect logbook avaibility \#TODO
    
    2400
    +observe.common.TripLonglineDto.with.logbooks.title=Can't remove logbook avaibility \#TODO
    
    2401
    +observe.common.TripLonglineDto.with.observations.message=There is some observations in this trip, can't unselect observations avaibility \#TODO
    
    2402
    +observe.common.TripLonglineDto.with.observations.title=Can't remove observation avaibility \#TODO
    
    2399 2403
     observe.common.TripLonglineGearUseDto.gearUseFeaturesLongline=Equipamiento
    
    2400 2404
     observe.common.TripLonglineLandingDto.action.close.tip=Close the opened landing
    
    2401 2405
     observe.common.TripLonglineLandingDto.action.create=Next landing
    
    ... ... @@ -3374,6 +3378,7 @@ observe.validation.hooksComposition.desactivated.hookSize=El tamaño de avanzuel
    3374 3378
     observe.validation.hooksComposition.desactivated.hookType=El tipo de avanzuelo seleccionado está desactivado.
    
    3375 3379
     observe.validation.hooksComposition.required.hookType=La selección de un tipo de avanzuelo es mandatoria.
    
    3376 3380
     observe.validation.hooksComposition.required.proportion=La proporción está vacía.
    
    3381
    +observe.validation.landing.endDate.after.startDate=La fecha de fin debe ser supuerior a la fecha de inicio.
    
    3377 3382
     observe.validation.landingPartLongline.bound.categoryWeight=Max category must be strictly greater than min category.
    
    3378 3383
     observe.validation.landingPartLongline.required.weight=Weight must be filled. \#TODO
    
    3379 3384
     observe.validation.landingPartLongline.required.weightMeasureMethod=Weight measure method must be filled.
    

  • observe-i18n/src/main/i18n/translations/observe_fr_FR.properties
    ... ... @@ -2396,6 +2396,10 @@ observe.common.TripLonglineDto.tripType=Type de marée
    2396 2396
     observe.common.TripLonglineDto.type=Marée
    
    2397 2397
     observe.common.TripLonglineDto.types=Marées
    
    2398 2398
     observe.common.TripLonglineDto.vessel=Navire
    
    2399
    +observe.common.TripLonglineDto.with.logbooks.message=Il existe des livres de bord sur cette marée, impossible de désactiver cette propriété
    
    2400
    +observe.common.TripLonglineDto.with.logbooks.title=Impossible de désactiver la présence des livres de bord
    
    2401
    +observe.common.TripLonglineDto.with.observations.message=Il existe des observations sur cette marée, impossible de désactiver cette propriété
    
    2402
    +observe.common.TripLonglineDto.with.observations.title=Impossible de désactiver la présence des observations
    
    2399 2403
     observe.common.TripLonglineGearUseDto.gearUseFeaturesLongline=Équipements
    
    2400 2404
     observe.common.TripLonglineLandingDto.action.close.tip=Clôturer le débarquement ouvert
    
    2401 2405
     observe.common.TripLonglineLandingDto.action.create=Débarquement suivant
    
    ... ... @@ -3374,6 +3378,7 @@ observe.validation.hooksComposition.desactivated.hookSize=La taille d'hameçon s
    3374 3378
     observe.validation.hooksComposition.desactivated.hookType=Le type d'hameçon sélectionné est désactivée.
    
    3375 3379
     observe.validation.hooksComposition.required.hookType=La sélection d'un type d'hameçon est obligatoire.
    
    3376 3380
     observe.validation.hooksComposition.required.proportion=Proportion non renseignée.
    
    3381
    +observe.validation.landing.endDate.after.startDate=La date de fin doit être supérieure à sa date de début.
    
    3377 3382
     observe.validation.landingPartLongline.bound.categoryWeight=La catégorie de poids max doit être strictement supérieur à la catégorie min.
    
    3378 3383
     observe.validation.landingPartLongline.required.weight=Le poids doit être renseigné.
    
    3379 3384
     observe.validation.landingPartLongline.required.weightMeasureMethod=La méthode de mesure de poids est obligatoire.
    

  • validation/src/main/i18n/getters/validation-messages.getter
    ... ... @@ -12,6 +12,7 @@ observe.validation.floatingObject.invalid.parts
    12 12
     observe.validation.floatingObject.required.comment.for.balise1
    
    13 13
     observe.validation.floatingObject.required.comment.for.balise2
    
    14 14
     observe.validation.floatingObject.size.supportVesselName
    
    15
    +observe.validation.landing.endDate.after.startDate
    
    15 16
     observe.validation.landingPartLongline.bound.categoryWeight
    
    16 17
     observe.validation.landingPartLongline.required.weightMeasureMethod
    
    17 18
     observe.validation.lengthFormula.endDate.before.startDate
    

  • validation/src/main/resources/fr/ird/observe/dto/data/ll/landing/LandingLonglineDto-create-error-validation.xml
    ... ... @@ -28,6 +28,15 @@
    28 28
           <message/>
    
    29 29
         </field-validator>
    
    30 30
       </field>
    
    31
    +  <field name="endDate">
    
    32
    +    <!-- startDate <= endDate -->
    
    33
    +    <field-validator type="fieldexpression" short-circuit="true">
    
    34
    +      <param name="expression">
    
    35
    +        <![CDATA[ endDate == null || startDate == null || endDate.time >= startDate.time ]]>
    
    36
    +      </param>
    
    37
    +      <message>observe.validation.landing.endDate.after.startDate</message>
    
    38
    +    </field-validator>
    
    39
    +  </field>
    
    31 40
       <field name="comment">
    
    32 41
         <field-validator type="commentLengthFieldDto">
    
    33 42
           <message/>
    

  • validation/src/main/resources/fr/ird/observe/dto/data/ll/landing/LandingLonglineDto-update-error-validation.xml
    ... ... @@ -28,6 +28,15 @@
    28 28
           <message/>
    
    29 29
         </field-validator>
    
    30 30
       </field>
    
    31
    +  <field name="endDate">
    
    32
    +    <!-- startDate <= endDate -->
    
    33
    +    <field-validator type="fieldexpression" short-circuit="true">
    
    34
    +      <param name="expression">
    
    35
    +        <![CDATA[ endDate == null || startDate == null || endDate.time >= startDate.time ]]>
    
    36
    +      </param>
    
    37
    +      <message>observe.validation.landing.endDate.after.startDate</message>
    
    38
    +    </field-validator>
    
    39
    +  </field>
    
    31 40
       <field name="comment">
    
    32 41
         <field-validator type="commentLengthFieldDto">
    
    33 42
           <message/>