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

WARNING: The push did not contain any new commits, but force pushed to delete the commits and changes below.

Deleted commits:

15 changed files:

Changes:

  • client/src/main/java/fr/ird/observe/client/ui/content/data/longline/ActivityLonglineLogbookUI.jaxx
    1
    +<!--
    
    2
    +  #%L
    
    3
    +  ObServe :: Client
    
    4
    +  %%
    
    5
    +  Copyright (C) 2008 - 2017 IRD, Code Lutin, Ultreia.io
    
    6
    +  %%
    
    7
    +  This program is free software: you can redistribute it and/or modify
    
    8
    +  it under the terms of the GNU General Public License as
    
    9
    +  published by the Free Software Foundation, either version 3 of the 
    
    10
    +  License, or (at your option) any later version.
    
    11
    +  
    
    12
    +  This program is distributed in the hope that it will be useful,
    
    13
    +  but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    14
    +  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    
    15
    +  GNU General Public License for more details.
    
    16
    +  
    
    17
    +  You should have received a copy of the GNU General Public 
    
    18
    +  License along with this program.  If not, see
    
    19
    +  <http://www.gnu.org/licenses/gpl-3.0.html>.
    
    20
    +  #L%
    
    21
    +  -->
    
    22
    +
    
    23
    +<fr.ird.observe.client.ui.content.open.ContentOpenableUI
    
    24
    +    i18nFormat="observe.common.ActivityLonglineDto.%s"
    
    25
    +    superGenericType='ActivityLonglineDto, ActivityLonglineLogbookUI'
    
    26
    +    contentTitle='{n("observe.common.ActivityLonglineDto.title")}'>
    
    27
    +
    
    28
    +  <style source="../../Common.jcss"/>
    
    29
    +
    
    30
    +  <import>
    
    31
    +    fr.ird.observe.dto.data.longline.ActivityLonglineDto
    
    32
    +    fr.ird.observe.dto.data.longline.ActivityLonglineReference
    
    33
    +    fr.ird.observe.dto.data.longline.SetLonglineDto
    
    34
    +    fr.ird.observe.dto.referential.FpaZoneReference
    
    35
    +    fr.ird.observe.dto.referential.longline.VesselActivityLonglineReference
    
    36
    +    fr.ird.observe.dto.referential.seine.WindReference
    
    37
    +    fr.ird.observe.dto.referential.DataQualityReference
    
    38
    +
    
    39
    +    fr.ird.observe.client.ui.actions.content.AddActivityLonglineSetUIAction
    
    40
    +    fr.ird.observe.client.ui.actions.content.DeleteDataUIAction
    
    41
    +    fr.ird.observe.client.ui.actions.main.global.DeleteDataGlobalUIAction
    
    42
    +    fr.ird.observe.client.ui.actions.main.global.OpenDataGlobalUIAction
    
    43
    +    fr.ird.observe.client.ui.actions.main.global.CloseDataGlobalUIAction
    
    44
    +    fr.ird.observe.client.ui.actions.main.global.NewNextDataGlobalUIAction
    
    45
    +    fr.ird.observe.client.ui.util.JComment
    
    46
    +
    
    47
    +    org.nuiton.jaxx.widgets.temperature.TemperatureFormat
    
    48
    +    org.nuiton.jaxx.widgets.temperature.TemperatureEditor
    
    49
    +    org.nuiton.jaxx.widgets.temperature.TemperatureEditorConfig
    
    50
    +
    
    51
    +    org.nuiton.jaxx.widgets.number.NumberEditor
    
    52
    +    org.nuiton.jaxx.widgets.select.BeanComboBox
    
    53
    +
    
    54
    +    org.nuiton.jaxx.widgets.datetime.DateTimeEditor
    
    55
    +    org.nuiton.jaxx.widgets.gis.absolute.CoordinatesEditor
    
    56
    +
    
    57
    +    java.awt.Dimension
    
    58
    +
    
    59
    +    static fr.ird.observe.client.ui.util.UIHelper.getStringValue
    
    60
    +    static org.nuiton.i18n.I18n.n
    
    61
    +  </import>
    
    62
    +
    
    63
    +  <!-- model -->
    
    64
    +  <ActivityLonglineLogbookUIModel id='model'/>
    
    65
    +
    
    66
    +  <!-- edit bean -->
    
    67
    +  <ActivityLonglineDto id='bean'/>
    
    68
    +
    
    69
    +  <!-- validator -->
    
    70
    +  <BeanValidator id='validator' autoField='true' beanClass='fr.ird.observe.dto.data.longline.ActivityLonglineDto'
    
    71
    +                 errorTableModel='{getErrorTableModel()}' context='create'>
    
    72
    +
    
    73
    +    <field name='longitude' component='coordinatesEditor'/>
    
    74
    +    <field name='latitude' component='coordinatesEditor'/>
    
    75
    +    <field name='quadrant' component='coordinatesEditor'/>
    
    76
    +
    
    77
    +  </BeanValidator>
    
    78
    +
    
    79
    +  <!-- formulaire -->
    
    80
    +  <JPanel id="body">
    
    81
    +    <Table fill='both' constraints="BorderLayout.CENTER">
    
    82
    +
    
    83
    +      <!-- date - time -->
    
    84
    +      <row>
    
    85
    +        <cell columns="2" weightx="1">
    
    86
    +          <DateTimeEditor id='timeStamp' constructorParams='this'/>
    
    87
    +        </cell>
    
    88
    +      </row>
    
    89
    +
    
    90
    +      <!--  position -->
    
    91
    +      <row>
    
    92
    +        <cell columns="2" weightx="1">
    
    93
    +          <CoordinatesEditor id='coordinatesEditor' constructorParams='this'/>
    
    94
    +        </cell>
    
    95
    +      </row>
    
    96
    +
    
    97
    +      <!-- activity vessel -->
    
    98
    +      <row>
    
    99
    +        <cell anchor='west'>
    
    100
    +          <JLabel id='vesselActivityLonglineLabel'/>
    
    101
    +        </cell>
    
    102
    +        <cell anchor='east' fill="both">
    
    103
    +          <BeanComboBox id='vesselActivityLongline' genericType='VesselActivityLonglineReference'
    
    104
    +                        constructorParams='this'/>
    
    105
    +        </cell>
    
    106
    +      </row>
    
    107
    +
    
    108
    +      <!--zone FPA-->
    
    109
    +      <row>
    
    110
    +        <cell anchor='west'>
    
    111
    +          <JLabel id='fpaZoneLabel'/>
    
    112
    +        </cell>
    
    113
    +        <cell anchor='east' fill="both">
    
    114
    +          <BeanComboBox id='fpaZone' genericType='FpaZoneReference' constructorParams='this'/>
    
    115
    +        </cell>
    
    116
    +      </row>
    
    117
    +
    
    118
    +      <!-- vitesse vessel -->
    
    119
    +      <row>
    
    120
    +        <cell anchor='west'>
    
    121
    +          <JLabel id='vesselSpeedLabel'/>
    
    122
    +        </cell>
    
    123
    +        <cell anchor='east' weightx="1" fill="both">
    
    124
    +          <NumberEditor id='vesselSpeed' constructorParams='this' styleClass="float2"/>
    
    125
    +        </cell>
    
    126
    +      </row>
    
    127
    +
    
    128
    +      <!-- température de surface -->
    
    129
    +      <row>
    
    130
    +        <cell anchor='west'>
    
    131
    +          <JLabel id='seaSurfaceTemperatureLabel'/>
    
    132
    +        </cell>
    
    133
    +        <cell anchor='east' fill="both">
    
    134
    +          <TemperatureEditor id='seaSurfaceTemperature' constructorParams='this'/>
    
    135
    +        </cell>
    
    136
    +      </row>
    
    137
    +
    
    138
    +      <!--  vent beaufort -->
    
    139
    +      <row>
    
    140
    +        <cell anchor='west'>
    
    141
    +          <JLabel id='windLabel'/>
    
    142
    +        </cell>
    
    143
    +        <cell anchor='east' fill="both">
    
    144
    +          <BeanComboBox id='wind' genericType='WindReference' constructorParams='this'/>
    
    145
    +        </cell>
    
    146
    +      </row>
    
    147
    +
    
    148
    +      <!-- dataQuality -->
    
    149
    +      <row>
    
    150
    +        <cell anchor='west'>
    
    151
    +          <JLabel id='dataQualityLabel'/>
    
    152
    +        </cell>
    
    153
    +        <cell anchor='east' weightx="1" fill="both">
    
    154
    +          <BeanComboBox id='dataQuality' genericType='DataQualityReference' constructorParams='this'/>
    
    155
    +        </cell>
    
    156
    +      </row>
    
    157
    +
    
    158
    +      <!--  activité observation -->
    
    159
    +      <row>
    
    160
    +        <cell anchor='west'>
    
    161
    +          <JLabel id='relatedObservedActivityLabel'/>
    
    162
    +        </cell>
    
    163
    +        <cell anchor='east' fill="both">
    
    164
    +          <BeanComboBox id='relatedObservedActivity' genericType='ActivityLonglineReference' constructorParams='this'/>
    
    165
    +        </cell>
    
    166
    +      </row>
    
    167
    +
    
    168
    +      <!--  comment -->
    
    169
    +      <row>
    
    170
    +        <cell columns='2' weighty="1">
    
    171
    +          <JComment id="comment"/>
    
    172
    +        </cell>
    
    173
    +      </row>
    
    174
    +    </Table>
    
    175
    +  </JPanel>
    
    176
    +
    
    177
    +  <!-- surcharge des actions (pour appliquer la css specifique) -->
    
    178
    +  <JButton id='delete'/>
    
    179
    +  <JButton id='reopen'/>
    
    180
    +  <JButton id='close'/>
    
    181
    +  <JButton id='closeAndCreate'/>
    
    182
    +  <JButton id='actionDown'/>
    
    183
    +
    
    184
    +  <Table id='extraActions' fill="both" weightx="1" insets='2'>
    
    185
    +    <row>
    
    186
    +      <cell weightx="0.5" fill="both">
    
    187
    +        <JButton id='addSet'/>
    
    188
    +      </cell>
    
    189
    +    </row>
    
    190
    +  </Table>
    
    191
    +
    
    192
    +</fr.ird.observe.client.ui.content.open.ContentOpenableUI>

  • client/src/main/java/fr/ird/observe/client/ui/content/data/longline/ActivityLonglineLogbookUI.jcss
    1
    +/*
    
    2
    + * #%L
    
    3
    + * ObServe :: Client
    
    4
    + * %%
    
    5
    + * Copyright (C) 2008 - 2017 IRD, Code Lutin, Ultreia.io
    
    6
    + * %%
    
    7
    + * This program is free software: you can redistribute it and/or modify
    
    8
    + * it under the terms of the GNU General Public License as
    
    9
    + * published by the Free Software Foundation, either version 3 of the 
    
    10
    + * License, or (at your option) any later version.
    
    11
    + * 
    
    12
    + * This program is distributed in the hope that it will be useful,
    
    13
    + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    14
    + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    
    15
    + * GNU General Public License for more details.
    
    16
    + * 
    
    17
    + * You should have received a copy of the GNU General Public 
    
    18
    + * License along with this program.  If not, see
    
    19
    + * <http://www.gnu.org/licenses/gpl-3.0.html>.
    
    20
    + * #L%
    
    21
    + */
    
    22
    +
    
    23
    +#model {
    
    24
    +  editable:true;
    
    25
    +  modified:{validator.isChanged()};
    
    26
    +  valid:{validator.isValid()};
    
    27
    +}
    
    28
    +
    
    29
    +#body {
    
    30
    +  layout:{new BorderLayout()};
    
    31
    +}
    
    32
    +
    
    33
    +#extraActions {
    
    34
    +  visible:{model.isUpdatingMode()};
    
    35
    +}
    
    36
    +
    
    37
    +#timeStamp {
    
    38
    +  propertyDate:{ActivityLonglineDto.PROPERTY_TIME_STAMP};
    
    39
    +  propertyDayDate:{ActivityLonglineUIModel.PROPERTY_DATE};
    
    40
    +  propertyTimeDate:{ActivityLonglineUIModel.PROPERTY_TIME};
    
    41
    +  date:{bean.getTimeStamp()};
    
    42
    +}
    
    43
    +
    
    44
    +#coordinatesEditor {
    
    45
    +  propertyLatitude:{ActivityLonglineDto.PROPERTY_LATITUDE};
    
    46
    +  propertyLongitude:{ActivityLonglineDto.PROPERTY_LONGITUDE};
    
    47
    +  propertyQuadrant:{ActivityLonglineDto.PROPERTY_QUADRANT};
    
    48
    +}
    
    49
    +
    
    50
    +#vesselActivityLongline {
    
    51
    +  property:{ActivityLonglineDto.PROPERTY_VESSEL_ACTIVITY_LONGLINE};
    
    52
    +  selectedItem:{bean.getVesselActivityLongline()};
    
    53
    +  enabled:{!model.isUpdatingMode()};
    
    54
    +}
    
    55
    +
    
    56
    +#fpaZone {
    
    57
    +  property:{ActivityLonglineDto.PROPERTY_FPA_ZONE};
    
    58
    +  selectedItem:{bean.getFpaZone()};
    
    59
    +}
    
    60
    +
    
    61
    +#seaSurfaceTemperature {
    
    62
    +  format:{TemperatureFormat.C};
    
    63
    +  storageTemperature:{bean.getSeaSurfaceTemperature()};
    
    64
    +}
    
    65
    +
    
    66
    +#dataQuality {
    
    67
    +  property:{ActivityLonglineDto.PROPERTY_DATA_QUALITY};
    
    68
    +  selectedItem:{bean.getDataQuality()};
    
    69
    +}
    
    70
    +
    
    71
    +#reopen {
    
    72
    +  _toolTipText:{t("observe.common.ActivityDto.action.reopen.tip")};
    
    73
    +}
    
    74
    +
    
    75
    +#close {
    
    76
    +  enabled:{!model.isModified() && (model.isHistoricalData() || model.isValid())};
    
    77
    +  _toolTipText:{t("observe.common.ActivityDto.action.close.tip")};
    
    78
    +}
    
    79
    +
    
    80
    +#closeAndCreate {
    
    81
    +  _globalAction:{NewNextDataGlobalUIAction.ACTION_NAME};
    
    82
    +  enabled:{!model.isModified() && (model.isHistoricalData() || model.isValid())};
    
    83
    +  _text:{t("observe.common.ActivityDto.action.closeAndCreate")};
    
    84
    +  _toolTipText:{t("observe.common.ActivityDto.action.closeAndCreate.tip")};
    
    85
    +}
    
    86
    +
    
    87
    +#delete {
    
    88
    +  _globalAction:{DeleteDataGlobalUIAction.ACTION_NAME};
    
    89
    +  _toolTipText:{t("observe.common.ActivityDto.action.delete.tip")};
    
    90
    +}
    
    91
    +
    
    92
    +#addSet {
    
    93
    +  actionIcon:add;
    
    94
    +  text:"observe.common.ActivityLonglineDto.action.addSet";
    
    95
    +  toolTipText:"observe.common.ActivityLonglineDto.action.addSet.tip";
    
    96
    +  enabled:{!model.isModified() && model.isValid() && model.isSetOperation() && ! bean.isHasSetLongline()};
    
    97
    +  _observeAction:{AddActivityLonglineSetUIAction.ACTION_NAME};
    
    98
    +
    
    99
    +}

  • client/src/main/java/fr/ird/observe/client/ui/content/data/longline/ActivityLonglineLogbookUIHandler.java
    1
    +package fr.ird.observe.client.ui.content.data.longline;
    
    2
    +
    
    3
    +/*
    
    4
    + * #%L
    
    5
    + * ObServe :: Client
    
    6
    + * %%
    
    7
    + * Copyright (C) 2008 - 2017 IRD, Code Lutin, Ultreia.io
    
    8
    + * %%
    
    9
    + * This program is free software: you can redistribute it and/or modify
    
    10
    + * it under the terms of the GNU General Public License as
    
    11
    + * published by the Free Software Foundation, either version 3 of the
    
    12
    + * License, or (at your option) any later version.
    
    13
    + * 
    
    14
    + * This program is distributed in the hope that it will be useful,
    
    15
    + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    16
    + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    
    17
    + * GNU General Public License for more details.
    
    18
    + * 
    
    19
    + * You should have received a copy of the GNU General Public
    
    20
    + * License along with this program.  If not, see
    
    21
    + * <http://www.gnu.org/licenses/gpl-3.0.html>.
    
    22
    + * #L%
    
    23
    + */
    
    24
    +
    
    25
    +import fr.ird.observe.client.ObserveSwingApplicationContext;
    
    26
    +import fr.ird.observe.client.db.ClientDataContext;
    
    27
    +import fr.ird.observe.client.db.constants.DataContextType;
    
    28
    +import fr.ird.observe.client.ui.content.ContentMode;
    
    29
    +import fr.ird.observe.client.ui.content.ContentUIModel;
    
    30
    +import fr.ird.observe.client.ui.content.open.ContentOpenableUIHandler;
    
    31
    +import fr.ird.observe.client.validation.ClientValidationContext;
    
    32
    +import fr.ird.observe.dto.data.longline.ActivityLonglineDto;
    
    33
    +import fr.ird.observe.dto.data.longline.ActivityLonglineHelper;
    
    34
    +import fr.ird.observe.dto.data.longline.TripLonglineDto;
    
    35
    +import fr.ird.observe.dto.form.Form;
    
    36
    +import fr.ird.observe.dto.reference.DataDtoReference;
    
    37
    +import fr.ird.observe.dto.result.TripChildSaveResultDto;
    
    38
    +import org.apache.commons.logging.Log;
    
    39
    +import org.apache.commons.logging.LogFactory;
    
    40
    +import org.nuiton.jaxx.runtime.spi.UIHandler;
    
    41
    +import org.nuiton.validator.NuitonValidatorScope;
    
    42
    +
    
    43
    +import javax.swing.SwingUtilities;
    
    44
    +import java.util.Optional;
    
    45
    +
    
    46
    +import static org.nuiton.i18n.I18n.n;
    
    47
    +import static org.nuiton.i18n.I18n.t;
    
    48
    +
    
    49
    +/**
    
    50
    + * Created on 8/29/14.
    
    51
    + *
    
    52
    + * @author Tony Chemit - dev@tchemit.fr
    
    53
    + * @since 3.7
    
    54
    + */
    
    55
    +class ActivityLonglineLogbookUIHandler extends ContentOpenableUIHandler<ActivityLonglineDto, ActivityLonglineLogbookUI> implements UIHandler<ActivityLonglineLogbookUI> {
    
    56
    +
    
    57
    +    /** Logger */
    
    58
    +    private static final Log log = LogFactory.getLog(ActivityLonglineLogbookUIHandler.class);
    
    59
    +
    
    60
    +    ActivityLonglineLogbookUIHandler() {
    
    61
    +        super(DataContextType.TripLongline, DataContextType.ActivityLongline, n("observe.common.ActivityLonglineDto.message.not.open"));
    
    62
    +    }
    
    63
    +
    
    64
    +    @Override
    
    65
    +    protected boolean doOpenData() {
    
    66
    +        boolean result = getOpenDataManager().canOpenActivityLongline(getSelectedParentId());
    
    67
    +        if (result) {
    
    68
    +            String setLonglineId = Optional.ofNullable(getBean().getSetLongline()).map(DataDtoReference::getId).orElse(null);
    
    69
    +            getOpenDataManager().openActivityLongline(getSelectedParentId(), getSelectedId(), setLonglineId);
    
    70
    +
    
    71
    +        }
    
    72
    +        return result;
    
    73
    +    }
    
    74
    +
    
    75
    +    @Override
    
    76
    +    public boolean doCloseData() {
    
    77
    +        boolean result = getOpenDataManager().isOpenActivityLongline(getSelectedId());
    
    78
    +        if (result) {
    
    79
    +            getOpenDataManager().closeActivityLongline(getSelectedId());
    
    80
    +        }
    
    81
    +        return result;
    
    82
    +    }
    
    83
    +
    
    84
    +    @Override
    
    85
    +    protected ContentMode getContentMode(ClientDataContext dataContext) {
    
    86
    +
    
    87
    +        String activityId = getSelectedId();
    
    88
    +
    
    89
    +        if (activityId == null) {
    
    90
    +
    
    91
    +            // mode creation
    
    92
    +            return ContentMode.CREATE;
    
    93
    +        }
    
    94
    +
    
    95
    +        // l'activity existe en base
    
    96
    +        if (getOpenDataManager().isOpenActivityLongline(getSelectedId())) {
    
    97
    +
    
    98
    +            // l'activity est ouverte, donc modifiable
    
    99
    +            return ContentMode.UPDATE;
    
    100
    +        }
    
    101
    +
    
    102
    +        ActivityLonglineLogbookUI ui = getUi();
    
    103
    +
    
    104
    +        // l'activity n'est pas ouverte, donc pas éditable
    
    105
    +        if (!getOpenDataManager().isOpenTripLongline(getSelectedParentId())) {
    
    106
    +
    
    107
    +            // la marée n'est pas ouverte
    
    108
    +            addMessage(ui,
    
    109
    +                       NuitonValidatorScope.INFO,
    
    110
    +                       getTypeI18nKey(TripLonglineDto.class),
    
    111
    +                       t("observe.common.TripLonglineDto.message.not.open"));
    
    112
    +
    
    113
    +            if (getModel().isHistoricalData()) {
    
    114
    +
    
    115
    +                addInfoMessage(t("observe.common.DataDto.message.historical.data"));
    
    116
    +            }
    
    117
    +
    
    118
    +        } else {
    
    119
    +
    
    120
    +            // seule l'activity n'est pas ouverte
    
    121
    +            addInfoMessage(t(closeMessage));
    
    122
    +        }
    
    123
    +
    
    124
    +        return ContentMode.READ;
    
    125
    +    }
    
    126
    +
    
    127
    +    @Override
    
    128
    +    public void openUI() {
    
    129
    +        super.openUI();
    
    130
    +
    
    131
    +        getUi().getCoordinatesEditor().resetModel();
    
    132
    +
    
    133
    +        String tripId = getSelectedParentId();
    
    134
    +        String activityId = getSelectedId();
    
    135
    +
    
    136
    +        if (log.isInfoEnabled()) {
    
    137
    +            log.info(prefix + "tripId     = " + tripId);
    
    138
    +            log.info(prefix + "activityId = " + activityId);
    
    139
    +        }
    
    140
    +
    
    141
    +        ContentMode mode = computeContentMode();
    
    142
    +        if (log.isInfoEnabled()) {
    
    143
    +            log.info(prefix + "content mode " + mode);
    
    144
    +        }
    
    145
    +        ActivityLonglineDto bean = getBean();
    
    146
    +
    
    147
    +        boolean create = activityId == null;
    
    148
    +
    
    149
    +        Form<ActivityLonglineDto> form;
    
    150
    +        if (create) {
    
    151
    +
    
    152
    +            // create mode
    
    153
    +            form = getActivityLonglineService().preCreate(tripId);
    
    154
    +
    
    155
    +        } else {
    
    156
    +
    
    157
    +            // update mode
    
    158
    +            form = getActivityLonglineService().loadForm(activityId);
    
    159
    +
    
    160
    +        }
    
    161
    +
    
    162
    +        setContentMode(mode);
    
    163
    +
    
    164
    +        loadReferentialReferenceSetsInModel(form);
    
    165
    +
    
    166
    +        getModel().setForm(form);
    
    167
    +        ActivityLonglineHelper.copyActivityLonglineDto(form.getObject(), bean);
    
    168
    +
    
    169
    +        if (log.isDebugEnabled()) {
    
    170
    +            log.debug("           long  - lat  = " + bean.getLongitude() + " - " + bean.getLatitude());
    
    171
    +        }
    
    172
    +        finalizeOpenUI(mode, create);
    
    173
    +
    
    174
    +        // Mise à jour du composant de coordonnées
    
    175
    +        // 1. Mise à jour latitude/longitude:
    
    176
    +        getUi().getCoordinatesEditor().setLatitudeAndLongitude(bean.getLatitude(), bean.getLongitude());
    
    177
    +
    
    178
    +        // 2. Mise à jour du quadrant :
    
    179
    +        // Si le bean de données contient un quadrant, on met simplement à jour le composant de coordonnées pour sélectionner le quadrant voulu
    
    180
    +        // sinon, on réinitialise les quadrants du composant afin qu'aucun d'eux ne soit sélectionné (par exemple dans le cas de la création de la première activité d'une marée)
    
    181
    +        if (bean.getQuadrant() == null) {
    
    182
    +            getUi().getCoordinatesEditor().resetQuadrant();
    
    183
    +        } else {
    
    184
    +            getUi().getCoordinatesEditor().setQuadrant(bean.getQuadrant());
    
    185
    +        }
    
    186
    +
    
    187
    +        // on annule la modification engendree par ce binding
    
    188
    +        getModel().setModified(create);
    
    189
    +    }
    
    190
    +
    
    191
    +    @Override
    
    192
    +    public void startEditUI(String... binding) {
    
    193
    +        ActivityLonglineLogbookUI ui = getUi();
    
    194
    +
    
    195
    +        ContentUIModel<ActivityLonglineDto> model = getModel();
    
    196
    +
    
    197
    +        boolean create = model.getMode() == ContentMode.CREATE;
    
    198
    +        String contextName = getValidatorContextName(model.getMode());
    
    199
    +        ui.getValidator().setContext(contextName);
    
    200
    +        if (create) {
    
    201
    +            addMessage(ui,
    
    202
    +                       NuitonValidatorScope.INFO,
    
    203
    +                       getTypeI18nKey(ActivityLonglineDto.class),
    
    204
    +                       t("observe.common.ActivityLonglineDto.message.creating"));
    
    205
    +        } else {
    
    206
    +            addMessage(ui,
    
    207
    +                       NuitonValidatorScope.INFO,
    
    208
    +                       getTypeI18nKey(ActivityLonglineDto.class),
    
    209
    +                       t("observe.common.ActivityLonglineDto.message.updating"));
    
    210
    +        }
    
    211
    +
    
    212
    +        super.startEditUI(
    
    213
    +                ActivityLonglineLogbookUI.BINDING_TIME_STAMP_DATE,
    
    214
    +                ActivityLonglineLogbookUI.BINDING_SEA_SURFACE_TEMPERATURE_STORAGE_TEMPERATURE,
    
    215
    +                ActivityLonglineLogbookUI.BINDING_COMMENT_MODEL,
    
    216
    +                ActivityLonglineLogbookUI.BINDING_VESSEL_ACTIVITY_LONGLINE_SELECTED_ITEM,
    
    217
    +                ActivityLonglineLogbookUI.BINDING_FPA_ZONE_SELECTED_ITEM,
    
    218
    +                ActivityLonglineLogbookUI.BINDING_CLOSE_ENABLED,
    
    219
    +                ActivityLonglineLogbookUI.BINDING_CLOSE_AND_CREATE_ENABLED);
    
    220
    +        model.setModified(create);
    
    221
    +    }
    
    222
    +
    
    223
    +    @Override
    
    224
    +    protected void prepareValidationContext() {
    
    225
    +        super.prepareValidationContext();
    
    226
    +
    
    227
    +        ClientValidationContext validationContext = ObserveSwingApplicationContext.get().getValidationContext();
    
    228
    +        validationContext.setCoordinatesEditor("coordinate", getUi().getCoordinatesEditor());
    
    229
    +
    
    230
    +    }
    
    231
    +
    
    232
    +    @Override
    
    233
    +    protected boolean doSave(ActivityLonglineDto bean) {
    
    234
    +
    
    235
    +        boolean notPersisted = bean.isNotPersisted();
    
    236
    +
    
    237
    +        String tripId = getSelectedParentId();
    
    238
    +
    
    239
    +        TripChildSaveResultDto saveResult = getActivityLonglineService().save(tripId, getModel().getBean());
    
    240
    +        saveResult.toDto(bean);
    
    241
    +
    
    242
    +        setUpdateMareeNodeTag(saveResult.isTripEndDateUpdated());
    
    243
    +
    
    244
    +        obtainChildPosition(bean);
    
    245
    +
    
    246
    +        if (notPersisted) {
    
    247
    +            // ouverture de l'activité après création
    
    248
    +            getOpenDataManager().openActivityLongline(getSelectedParentId(), bean.getId(), null);
    
    249
    +
    
    250
    +            if (ActivityLonglineHelper.FISHING_OPERATION_ID.equals(bean.getVesselActivityLongline().getId())) {
    
    251
    +
    
    252
    +                // création de l'opération de pêche
    
    253
    +                SwingUtilities.invokeLater(() -> getUi().getAddSet().doClick());
    
    254
    +            }
    
    255
    +        }
    
    256
    +
    
    257
    +        return true;
    
    258
    +    }
    
    259
    +
    
    260
    +    @Override
    
    261
    +    protected int getOpenablePosition(String parentId, ActivityLonglineDto bean) {
    
    262
    +        return getActivityLonglineService().getActivityLonglinePositionInTripLongline(parentId, bean.getId());
    
    263
    +    }
    
    264
    +
    
    265
    +    @Override
    
    266
    +    protected boolean doDelete(ActivityLonglineDto bean) {
    
    267
    +
    
    268
    +        if (askToDelete(bean)) {
    
    269
    +            return false;
    
    270
    +        }
    
    271
    +        if (log.isInfoEnabled()) {
    
    272
    +            log.info("Will delete Activity " + bean.getId());
    
    273
    +        }
    
    274
    +
    
    275
    +        String tripId = getSelectedParentId();
    
    276
    +        boolean wasTripEndDateUpdated = getActivityLonglineService().delete(tripId, bean.getId());
    
    277
    +        if (log.isInfoEnabled()) {
    
    278
    +            log.info("Delete done for Activity " + bean.getId());
    
    279
    +        }
    
    280
    +        getOpenDataManager().closeActivityLongline(bean.getId());
    
    281
    +
    
    282
    +        setUpdateMareeNodeTag(wasTripEndDateUpdated);
    
    283
    +        return true;
    
    284
    +
    
    285
    +    }
    
    286
    +
    
    287
    +    @Override
    
    288
    +    protected void afterSave(boolean refresh) {
    
    289
    +        super.afterSave(refresh);
    
    290
    +        repaintTripNode();
    
    291
    +    }
    
    292
    +
    
    293
    +    @Override
    
    294
    +    protected void afterDelete() {
    
    295
    +        super.afterDelete();
    
    296
    +        repaintTripNode();
    
    297
    +    }
    
    298
    +
    
    299
    +    @Override
    
    300
    +    protected boolean obtainCanReopen(boolean create) {
    
    301
    +
    
    302
    +        return !create && getOpenDataManager().canOpenActivityLongline(getSelectedParentId());
    
    303
    +
    
    304
    +    }
    
    305
    +
    
    306
    +}

  • client/src/main/java/fr/ird/observe/client/ui/content/data/longline/ActivityLonglineLogbookUIModel.java
    1
    +package fr.ird.observe.client.ui.content.data.longline;
    
    2
    +
    
    3
    +/*
    
    4
    + * #%L
    
    5
    + * ObServe :: Client
    
    6
    + * %%
    
    7
    + * Copyright (C) 2008 - 2017 IRD, Code Lutin, Ultreia.io
    
    8
    + * %%
    
    9
    + * This program is free software: you can redistribute it and/or modify
    
    10
    + * it under the terms of the GNU General Public License as
    
    11
    + * published by the Free Software Foundation, either version 3 of the
    
    12
    + * License, or (at your option) any later version.
    
    13
    + * 
    
    14
    + * This program is distributed in the hope that it will be useful,
    
    15
    + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    16
    + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    
    17
    + * GNU General Public License for more details.
    
    18
    + * 
    
    19
    + * You should have received a copy of the GNU General Public
    
    20
    + * License along with this program.  If not, see
    
    21
    + * <http://www.gnu.org/licenses/gpl-3.0.html>.
    
    22
    + * #L%
    
    23
    + */
    
    24
    +
    
    25
    +import fr.ird.observe.client.ui.content.open.ContentOpenableUIModel;
    
    26
    +import fr.ird.observe.dto.data.longline.ActivityLonglineDto;
    
    27
    +import fr.ird.observe.dto.referential.longline.VesselActivityLonglineHelper;
    
    28
    +import fr.ird.observe.dto.referential.longline.VesselActivityLonglineReference;
    
    29
    +import org.nuiton.util.DateUtil;
    
    30
    +
    
    31
    +import java.util.Date;
    
    32
    +
    
    33
    +/**
    
    34
    + * Created on 9/26/14.
    
    35
    + *
    
    36
    + * @author Tony Chemit - dev@tchemit.fr
    
    37
    + * @since XXX
    
    38
    + */
    
    39
    +public class ActivityLonglineLogbookUIModel extends ContentOpenableUIModel<ActivityLonglineDto> {
    
    40
    +
    
    41
    +    private static final long serialVersionUID = 1L;
    
    42
    +
    
    43
    +    public static final String PROPERTY_SET_OPERATION = "setOperation";
    
    44
    +
    
    45
    +    public static final String PROPERTY_DATE = "date";
    
    46
    +
    
    47
    +    public static final String PROPERTY_TIME = "time";
    
    48
    +
    
    49
    +    public ActivityLonglineLogbookUIModel() {
    
    50
    +        super(ActivityLonglineDto.class);
    
    51
    +
    
    52
    +        getBean().addPropertyChangeListener(ActivityLonglineDto.PROPERTY_VESSEL_ACTIVITY_LONGLINE, evt -> {
    
    53
    +            boolean oldValue = VesselActivityLonglineHelper.isSetOperation((VesselActivityLonglineReference) evt.getOldValue());
    
    54
    +            boolean newValue = VesselActivityLonglineHelper.isSetOperation((VesselActivityLonglineReference) evt.getNewValue());
    
    55
    +            firePropertyChange(PROPERTY_SET_OPERATION, oldValue, newValue);
    
    56
    +        });
    
    57
    +    }
    
    58
    +
    
    59
    +    public boolean isSetOperation() {
    
    60
    +        return VesselActivityLonglineHelper.isSetOperation(bean.getVesselActivityLongline());
    
    61
    +    }
    
    62
    +
    
    63
    +    public Date getDate() {
    
    64
    +        Date timeStamp = bean.getTimeStamp();
    
    65
    +        return timeStamp == null ? null : DateUtil.getDay(timeStamp);
    
    66
    +    }
    
    67
    +
    
    68
    +    public Date getTime() {
    
    69
    +        Date timeStamp = bean.getTimeStamp();
    
    70
    +        return timeStamp == null ? null : DateUtil.getTime(timeStamp, false, false);
    
    71
    +    }
    
    72
    +
    
    73
    +    public void setDate(Date date) {
    
    74
    +        Date timeStamp = bean.getTimeStamp();
    
    75
    +        if (timeStamp != null) {
    
    76
    +            Date dateAndTime = date == null ? timeStamp : DateUtil.getDateAndTime(date, timeStamp, true, false);
    
    77
    +            bean.setTimeStamp(dateAndTime);
    
    78
    +        }
    
    79
    +    }
    
    80
    +
    
    81
    +    public void setTime(Date time) {
    
    82
    +        Date timeStamp = bean.getTimeStamp();
    
    83
    +        if (timeStamp != null) {
    
    84
    +            Date dateAndTime = time == null ? timeStamp : DateUtil.getDateAndTime(timeStamp, time, false, false);
    
    85
    +            bean.setTimeStamp(dateAndTime);
    
    86
    +        }
    
    87
    +    }
    
    88
    +}

  • client/src/main/java/fr/ird/observe/client/ui/content/data/longline/CatchLonglineLogbookUI.jaxx
    1
    +<!--
    
    2
    +  #%L
    
    3
    +  ObServe :: Client
    
    4
    +  %%
    
    5
    +  Copyright (C) 2008 - 2017 IRD, Code Lutin, Ultreia.io
    
    6
    +  %%
    
    7
    +  This program is free software: you can redistribute it and/or modify
    
    8
    +  it under the terms of the GNU General Public License as
    
    9
    +  published by the Free Software Foundation, either version 3 of the 
    
    10
    +  License, or (at your option) any later version.
    
    11
    +  
    
    12
    +  This program is distributed in the hope that it will be useful,
    
    13
    +  but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    14
    +  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    
    15
    +  GNU General Public License for more details.
    
    16
    +  
    
    17
    +  You should have received a copy of the GNU General Public 
    
    18
    +  License along with this program.  If not, see
    
    19
    +  <http://www.gnu.org/licenses/gpl-3.0.html>.
    
    20
    +  #L%
    
    21
    +  -->
    
    22
    +
    
    23
    +<fr.ird.observe.client.ui.content.table.ContentTableUI
    
    24
    +    i18nFormat="observe.common.CatchLonglineDto.%s"
    
    25
    +    superGenericType='SetLonglineCatchDto, CatchLonglineDto, CatchLonglineLogbookUI'
    
    26
    +    contentTitle='{n("observe.common.CatchLonglineDto.title")}'
    
    27
    +    newEntryText='{n("observe.common.CatchLonglineDto.action.new")}'
    
    28
    +    newEntryTip='{n("observe.common.CatchLonglineDto.action.new.tip")}'
    
    29
    +    saveNewEntryText='{n("observe.common.CatchLonglineDto.action.create")}'
    
    30
    +    saveNewEntryTip='{n("observe.common.CatchLonglineDto.action.create.tip")}'>
    
    31
    +
    
    32
    +  <style source="../CommonTable.jcss"/>
    
    33
    +
    
    34
    +  <import>
    
    35
    +    fr.ird.observe.dto.data.longline.BasketReference
    
    36
    +    fr.ird.observe.dto.data.longline.BranchlineDto
    
    37
    +    fr.ird.observe.dto.data.longline.BranchlineReference
    
    38
    +    fr.ird.observe.dto.data.longline.CatchLonglineDto
    
    39
    +    fr.ird.observe.dto.data.longline.SectionReference
    
    40
    +    fr.ird.observe.dto.data.longline.SetLonglineCatchDto
    
    41
    +    fr.ird.observe.dto.referential.SpeciesReference
    
    42
    +    fr.ird.observe.dto.referential.SexReference
    
    43
    +    fr.ird.observe.dto.referential.longline.BaitHaulingStatusReference
    
    44
    +    fr.ird.observe.dto.referential.longline.CatchFateLonglineReference
    
    45
    +    fr.ird.observe.dto.referential.longline.HealthnessReference
    
    46
    +    fr.ird.observe.dto.referential.longline.HookPositionReference
    
    47
    +    fr.ird.observe.dto.referential.longline.MaturityStatusReference
    
    48
    +    fr.ird.observe.dto.referential.longline.StomacFullnessReference
    
    49
    +    fr.ird.observe.client.constants.CatchAcquisitionMode
    
    50
    +    fr.ird.observe.client.ui.content.table.*
    
    51
    +    fr.ird.observe.client.ui.util.BooleanEditor
    
    52
    +    fr.ird.observe.client.ui.util.JComment
    
    53
    +
    
    54
    +    org.nuiton.jaxx.widgets.number.NumberEditor
    
    55
    +    org.nuiton.jaxx.widgets.select.BeanComboBox
    
    56
    +    org.nuiton.jaxx.widgets.select.FilterableDoubleList
    
    57
    +    org.nuiton.jaxx.widgets.datetime.DateTimeEditor
    
    58
    +    org.nuiton.jaxx.widgets.datetime.TimeEditor
    
    59
    +
    
    60
    +    java.awt.Dimension
    
    61
    +
    
    62
    +    java.util.Collection
    
    63
    +
    
    64
    +    org.apache.commons.lang3.BooleanUtils
    
    65
    +
    
    66
    +    static fr.ird.observe.client.ui.util.UIHelper.getStringValue
    
    67
    +    static org.nuiton.i18n.I18n.n
    
    68
    +  </import>
    
    69
    +
    
    70
    +  <!-- model -->
    
    71
    +  <CatchLonglineLogbookUIModel id='model'/>
    
    72
    +
    
    73
    +  <!-- edit bean -->
    
    74
    +  <SetLonglineCatchDto id='bean'/>
    
    75
    +
    
    76
    +  <!-- table edit bean -->
    
    77
    +  <CatchLonglineDto id='tableEditBean'/>
    
    78
    +
    
    79
    +  <!-- table model -->
    
    80
    +  <ContentTableModel id='tableModel' genericType='SetLonglineCatchDto, CatchLonglineDto'/>
    
    81
    +
    
    82
    +  <!-- edit branchline -->
    
    83
    +  <BranchlineDto id='branchlineBean' initializer='new BranchlineDto()'/>
    
    84
    +
    
    85
    +  <!-- le validateur de l'écran -->
    
    86
    +  <BeanValidator id='validator' context='update'
    
    87
    +                 beanClass='fr.ird.observe.dto.data.longline.SetLonglineCatchDto'
    
    88
    +                 errorTableModel='{getErrorTableModel()}'>
    
    89
    +  </BeanValidator>
    
    90
    +
    
    91
    +  <!-- le validateur d'une entrée de tableau -->
    
    92
    +  <BeanValidator id='validatorTable' autoField='true' context='update'
    
    93
    +                 beanClass='fr.ird.observe.dto.data.longline.CatchLonglineDto'
    
    94
    +                 errorTableModel='{getErrorTableModel()}'
    
    95
    +                 parentValidator='{validator}'/>
    
    96
    +
    
    97
    +  <JPopupMenu id='catchLonglinesPopup'>
    
    98
    +    <JMenuItem id='moveCatchLonglineUp' onActionPerformed='getHandler().moveCatchLonglineUp()'/>
    
    99
    +    <JMenuItem id='moveCatchLonglineDown' onActionPerformed='getHandler().moveCatchLonglineDown()'/>
    
    100
    +  </JPopupMenu>
    
    101
    +
    
    102
    +  <ButtonGroup id='acquisitionModeGroup'
    
    103
    +               onStateChanged='getHandler().updateCatchAcquisitionMode((CatchAcquisitionMode) acquisitionModeGroup.getSelectedValue())'/>
    
    104
    +
    
    105
    +  <Table id='editorPanel' fill='both' insets='0'>
    
    106
    +    <row>
    
    107
    +      <cell weightx="1" weighty="1">
    
    108
    +        <JTabbedPane id='mainTabbedPane'>
    
    109
    +          <tab id='caracteristicTab' computeI18n="">
    
    110
    +            <Table id='editForm' fill='both' insets='1'>
    
    111
    +
    
    112
    +              <row>
    
    113
    +                <cell columns="4">
    
    114
    +                  <JPanel layout="{new GridLayout()}">
    
    115
    +
    
    116
    +                    <!-- acquisition Mode -->
    
    117
    +                    <JPanel id='acquisitionModePanel'>
    
    118
    +                      <JRadioButton id='acquisitionModeIndividual'/>
    
    119
    +                      <JRadioButton id='acquisitionModeGrouped'/>
    
    120
    +                    </JPanel>
    
    121
    +
    
    122
    +                  </JPanel>
    
    123
    +                </cell>
    
    124
    +              </row>
    
    125
    +
    
    126
    +              <!-- speciesCatch -->
    
    127
    +              <!-- tagNumber -->
    
    128
    +              <row>
    
    129
    +                <cell>
    
    130
    +                  <JLabel id='speciesCatchLabel'/>
    
    131
    +                </cell>
    
    132
    +                <cell weightx='1' anchor='east'>
    
    133
    +                  <BeanComboBox id='speciesCatch' genericType='SpeciesReference' constructorParams='this'/>
    
    134
    +                </cell>
    
    135
    +                <cell anchor='west'>
    
    136
    +                  <JLabel id='tagNumberLabel'/>
    
    137
    +                </cell>
    
    138
    +                <cell anchor='east' weightx="1" fill="both">
    
    139
    +                  <JPanel layout='{new BorderLayout()}'>
    
    140
    +                    <JToolBar id='tagNumberToolbar' constraints='BorderLayout.WEST'>
    
    141
    +                      <JButton id='resetTagNumber' styleClass='resetButton'/>
    
    142
    +                    </JToolBar>
    
    143
    +                    <JTextField id='tagNumber' constraints='BorderLayout.CENTER'/>
    
    144
    +                  </JPanel>
    
    145
    +                </cell>
    
    146
    +              </row>
    
    147
    +
    
    148
    +              <!-- count -->
    
    149
    +              <row>
    
    150
    +                <cell>
    
    151
    +                  <JLabel id='countLabel'/>
    
    152
    +                </cell>
    
    153
    +                <cell weightx='1' anchor='east'>
    
    154
    +                  <NumberEditor id='count' constructorParams='this' styleClass="int6"/>
    
    155
    +                </cell>
    
    156
    +              </row>
    
    157
    +
    
    158
    +              <!-- count -->
    
    159
    +              <!-- total weight -->
    
    160
    +              <row>
    
    161
    +                <cell>
    
    162
    +                  <JLabel id='totalWeightLabel'/>
    
    163
    +                </cell>
    
    164
    +                <cell weightx='1' anchor='east'>
    
    165
    +                  <NumberEditor id='totalWeight' constructorParams='this' styleClass="float3"/>
    
    166
    +                </cell>
    
    167
    +                <cell>
    
    168
    +                  <JLabel id='weightDeterminationMethodLabel'/>
    
    169
    +                </cell>
    
    170
    +                <cell weightx='1' anchor='east'>
    
    171
    +                  <BeanComboBox id='weightDeterminationMethod' constructorParams='this' genericType='HealthnessReference'/>
    
    172
    +                </cell>
    
    173
    +              </row>
    
    174
    +
    
    175
    +
    
    176
    +              <!-- catch healthness -->
    
    177
    +              <row>
    
    178
    +                <cell>
    
    179
    +                  <JLabel id='catchHealthnessLabel'/>
    
    180
    +                </cell>
    
    181
    +                <cell weightx='1' anchor='east'>
    
    182
    +                  <BeanComboBox id='catchHealthness' constructorParams='this' genericType='HealthnessReference'/>
    
    183
    +                </cell>
    
    184
    +              </row>
    
    185
    +
    
    186
    +              <!-- catch fate -->
    
    187
    +              <!-- discard healthness -->
    
    188
    +              <row>
    
    189
    +                <cell>
    
    190
    +                  <JLabel id='catchFateLonglineLabel'/>
    
    191
    +                </cell>
    
    192
    +                <cell weightx='1' anchor='east'>
    
    193
    +                  <BeanComboBox id='catchFateLongline' constructorParams='this' genericType='CatchFateLonglineReference'/>
    
    194
    +                </cell>
    
    195
    +                <cell>
    
    196
    +                  <JLabel id='discardHealthnessLabel'/>
    
    197
    +                </cell>
    
    198
    +                <cell weightx='1' anchor='east'>
    
    199
    +                  <BeanComboBox id='discardHealthness' constructorParams='this' genericType='HealthnessReference'/>
    
    200
    +                </cell>
    
    201
    +              </row>
    
    202
    +
    
    203
    +              <!-- onBordDataProcessing -->
    
    204
    +              <row>
    
    205
    +                <cell>
    
    206
    +                  <JLabel id='onBordDataProcessingLabel'/>
    
    207
    +                </cell>
    
    208
    +                <cell weightx='1' anchor='east'>
    
    209
    +                  <BeanComboBox id='onBordDataProcessing' constructorParams='this' genericType='CatchFateLonglineReference'/>
    
    210
    +                </cell>
    
    211
    +                <cell anchor='east' weightx="1" fill="both">
    
    212
    +                  <JPanel layout='{new BorderLayout()}'>
    
    213
    +                    <JToolBar id='photoReferencesToolbar' constraints='BorderLayout.WEST'>
    
    214
    +                      <JButton id='resetPhotoReferences' styleClass='resetButton'/>
    
    215
    +                    </JToolBar>
    
    216
    +                    <JTextField id='photoReferences' constraints='BorderLayout.CENTER'/>
    
    217
    +                  </JPanel>
    
    218
    +                </cell>
    
    219
    +              </row>
    
    220
    +            </Table>
    
    221
    +          </tab>
    
    222
    +
    
    223
    +          <tab id='depredatedTab' computeI18n="">
    
    224
    +
    
    225
    +            <Table id='depredatedForm' fill='both' insets='1'>
    
    226
    +
    
    227
    +              <!-- depredated -->
    
    228
    +              <row>
    
    229
    +                <cell anchor='west' fill="both">
    
    230
    +                  <JCheckBox id='depredated' styleClass="i18n"/>
    
    231
    +                </cell>
    
    232
    +              </row>
    
    233
    +
    
    234
    +              <!-- beatDiameter -->
    
    235
    +              <row>
    
    236
    +                <cell>
    
    237
    +                  <JLabel id='beatDiameterLabel'/>
    
    238
    +                </cell>
    
    239
    +                <cell weightx='1' anchor='east'>
    
    240
    +                  <NumberEditor id='beatDiameter' constructorParams='this' styleClass="float3"/>
    
    241
    +                </cell>
    
    242
    +              </row>
    
    243
    +              <!-- countDepredated -->
    
    244
    +              <row>
    
    245
    +                <cell>
    
    246
    +                  <JLabel id='countDepredatedLabel'/>
    
    247
    +                </cell>
    
    248
    +                <cell weightx='1' anchor='east'>
    
    249
    +                  <NumberEditor id='countDepredated' constructorParams='this' styleClass="float3"/>
    
    250
    +                </cell>
    
    251
    +              </row>
    
    252
    +              <!-- depredatedProportion -->
    
    253
    +              <row>
    
    254
    +                <cell>
    
    255
    +                  <JLabel id='depredatedProportionLabel'/>
    
    256
    +                </cell>
    
    257
    +                <cell weightx='1' anchor='east'>
    
    258
    +                  <NumberEditor id='depredatedProportion' constructorParams='this' styleClass="float3"/>
    
    259
    +                </cell>
    
    260
    +              </row>
    
    261
    +
    
    262
    +              <!-- predator -->
    
    263
    +              <row>
    
    264
    +                <cell columns="2" fill="both" weighty="0.7">
    
    265
    +                  <JScrollPane id='predatorPane'>
    
    266
    +                    <FilterableDoubleList id='predator' genericType='SpeciesReference'/>
    
    267
    +                  </JScrollPane>
    
    268
    +                </cell>
    
    269
    +              </row>
    
    270
    +
    
    271
    +            </Table>
    
    272
    +          </tab>
    
    273
    +        </JTabbedPane>
    
    274
    +      </cell>
    
    275
    +    </row>
    
    276
    +    <row>
    
    277
    +      <cell weighty='1'>
    
    278
    +        <JComment id="comment"/>
    
    279
    +      </cell>
    
    280
    +    </row>
    
    281
    +  </Table>
    
    282
    +</fr.ird.observe.client.ui.content.table.ContentTableUI>
    \ No newline at end of file

  • client/src/main/java/fr/ird/observe/client/ui/content/data/longline/CatchLonglineLogbookUI.jcss
    1
    +/*
    
    2
    + * #%L
    
    3
    + * ObServe :: Client
    
    4
    + * %%
    
    5
    + * Copyright (C) 2008 - 2017 IRD, Code Lutin, Ultreia.io
    
    6
    + * %%
    
    7
    + * This program is free software: you can redistribute it and/or modify
    
    8
    + * it under the terms of the GNU General Public License as
    
    9
    + * published by the Free Software Foundation, either version 3 of the
    
    10
    + * License, or (at your option) any later version.
    
    11
    + * 
    
    12
    + * This program is distributed in the hope that it will be useful,
    
    13
    + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    14
    + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    
    15
    + * GNU General Public License for more details.
    
    16
    + * 
    
    17
    + * You should have received a copy of the GNU General Public
    
    18
    + * License along with this program.  If not, see
    
    19
    + * <http://www.gnu.org/licenses/gpl-3.0.html>.
    
    20
    + * #L%
    
    21
    + */
    
    22
    +
    
    23
    +.i18nBranchline {
    
    24
    +  computeI18n:"observe.common.BranchlineDto.%s"
    
    25
    +}
    
    26
    +
    
    27
    +#model {
    
    28
    +  valid:{validator.isValid() && validatorTable.isValid()};
    
    29
    +  canSaveRow:{validatorTable.isChanged() && validatorTable.isValid() };
    
    30
    +  canResetRow:{validatorTable.isChanged()};
    
    31
    +}
    
    32
    +
    
    33
    +#moveCatchLonglineUp {
    
    34
    +  text: "observe.common.CatchLonglineDto.action.moveCatchLonglineUp";
    
    35
    +  toolTipText: "observe.common.CatchLonglineDto.action.moveCatchLonglineUp.tip";
    
    36
    +  actionIcon: go-up;
    
    37
    +}
    
    38
    +
    
    39
    +#moveCatchLonglineDown {
    
    40
    +  text: "observe.common.CatchLonglineDto.action.moveCatchLonglineDown";
    
    41
    +  toolTipText: "observe.common.CatchLonglineDto.action.moveCatchLonglineDown.tip";
    
    42
    +  actionIcon: go-down;
    
    43
    +}
    
    44
    +
    
    45
    +
    
    46
    +/* ***************************************************************************** */
    
    47
    +/*  CARACTERISTIC TAB ********************************************************** */
    
    48
    +/* ***************************************************************************** */
    
    49
    +
    
    50
    +#caracteristicTab {
    
    51
    +  icon:{handler.getErrorIconIfFalse(model.isCaracteristicsTabValid())};
    
    52
    +}
    
    53
    +
    
    54
    +#acquisitionModeGroup {
    
    55
    +  selectedValue:{CatchAcquisitionMode.valueOf(tableEditBean.getAcquisitionMode())};
    
    56
    +}
    
    57
    +
    
    58
    +#acquisitionModePanel {
    
    59
    +  border:{new TitledBorder(t("observe.common.CatchLonglineDto.acquisitionMode"))};
    
    60
    +  layout:{new GridLayout(0,1)};
    
    61
    +}
    
    62
    +
    
    63
    +#acquisitionModeIndividual {
    
    64
    +  buttonGroup:acquisitionModeGroup;
    
    65
    +  value:{CatchAcquisitionMode.INDIVIDUAL};
    
    66
    +  text:{CatchAcquisitionMode.INDIVIDUAL.toString()};
    
    67
    +  selected:{tableEditBean.getAcquisitionMode() == 0};
    
    68
    +  enabled:{!tableModel.isEditable() || tableModel.isCreate()};
    
    69
    +}
    
    70
    +
    
    71
    +#acquisitionModeGrouped {
    
    72
    +  buttonGroup:acquisitionModeGroup;
    
    73
    +  value:{CatchAcquisitionMode.GROUPED};
    
    74
    +  text:{CatchAcquisitionMode.GROUPED.toString()};
    
    75
    +  selected:{tableEditBean.getAcquisitionMode() == 1};
    
    76
    +  enabled:{!tableModel.isEditable() || tableModel.isCreate()};
    
    77
    +}
    
    78
    +
    
    79
    +#locationOnLonglinePanel {
    
    80
    +  border:{new TitledBorder(t("observe.common.CatchLonglineDto.locationOnLongline"))};
    
    81
    +}
    
    82
    +
    
    83
    +#section {
    
    84
    +  property:{CatchLonglineDto.PROPERTY_SECTION};
    
    85
    +  selectedItem:{tableEditBean.getSection()};
    
    86
    +  force:true;
    
    87
    +  _listNoLoad:{true};
    
    88
    +}
    
    89
    +
    
    90
    +#basket {
    
    91
    +  property:{CatchLonglineDto.PROPERTY_BASKET};
    
    92
    +  selectedItem:{tableEditBean.getBasket()};
    
    93
    +  _listNoLoad:{true};
    
    94
    +}
    
    95
    +
    
    96
    +#branchline {
    
    97
    +  property:{CatchLonglineDto.PROPERTY_BRANCHLINE};
    
    98
    +  selectedItem:{tableEditBean.getBranchline()};
    
    99
    +  _listNoLoad:{true};
    
    100
    +}
    
    101
    +
    
    102
    +#speciesCatch {
    
    103
    +  property:{CatchLonglineDto.PROPERTY_SPECIES_CATCH};
    
    104
    +  selectedItem:{tableEditBean.getSpeciesCatch()};
    
    105
    +}
    
    106
    +
    
    107
    +#resetPhotoReferences {
    
    108
    +  toolTipText:"observe.common.CatchLonglineDto.action.reset.photoReferences.tip";
    
    109
    +  _resetTablePropertyName:{CatchLonglineDto.PROPERTY_PHOTO_REFERENCES};
    
    110
    +}
    
    111
    +
    
    112
    +#photoReferences {
    
    113
    +  text:{getStringValue(tableEditBean.getPhotoReferences())};
    
    114
    +  _tablePropertyName:{CatchLonglineDto.PROPERTY_PHOTO_REFERENCES};
    
    115
    +}
    
    116
    +
    
    117
    +#resetTagNumber {
    
    118
    +  toolTipText:"observe.common.DataDto.action.resetTagNumber";
    
    119
    +  _resetTablePropertyName:{CatchLonglineDto.PROPERTY_TAG_NUMBER};
    
    120
    +  enabled:{tableEditBean.getAcquisitionMode() == 0};
    
    121
    +}
    
    122
    +
    
    123
    +#tagNumber {
    
    124
    +  text:{getStringValue(tableEditBean.getTagNumber())};
    
    125
    +  _tablePropertyName:{CatchLonglineDto.PROPERTY_TAG_NUMBER};
    
    126
    +  enabled:{tableEditBean.getAcquisitionMode() == 0};
    
    127
    +}
    
    128
    +
    
    129
    +#count {
    
    130
    +  property:{CatchLonglineDto.PROPERTY_COUNT};
    
    131
    +  numberValue:{tableEditBean.getCount()};
    
    132
    +}
    
    133
    +
    
    134
    +#totalWeight {
    
    135
    +  property:{CatchLonglineDto.PROPERTY_TOTAL_WEIGHT};
    
    136
    +  numberValue:{tableEditBean.getTotalWeight()};
    
    137
    +}
    
    138
    +
    
    139
    +#hookWhenDiscarded {
    
    140
    +  _tablePropertyName:{CatchLonglineDto.PROPERTY_HOOK_WHEN_DISCARDED};
    
    141
    +  booleanValue:{tableEditBean.getHookWhenDiscarded()};
    
    142
    +}
    
    143
    +
    
    144
    +#catchFateLongline {
    
    145
    +  property:{CatchLonglineDto.PROPERTY_CATCH_FATE_LONGLINE};
    
    146
    +  selectedItem:{tableEditBean.getCatchFateLongline()};
    
    147
    +}
    
    148
    +
    
    149
    +#catchHealthness {
    
    150
    +  property:{CatchLonglineDto.PROPERTY_CATCH_HEALTHNESS};
    
    151
    +  selectedItem:{tableEditBean.getCatchHealthness()};
    
    152
    +}
    
    153
    +
    
    154
    +#discardHealthness {
    
    155
    +  property:{CatchLonglineDto.PROPERTY_DISCARD_HEALTHNESS};
    
    156
    +  selectedItem:{tableEditBean.getDiscardHealthness()};
    
    157
    +}
    
    158
    +
    
    159
    +#catchFateLongline {
    
    160
    +  property:{CatchLonglineDto.PROPERTY_CATCH_FATE_LONGLINE};
    
    161
    +  selectedItem:{tableEditBean.getCatchFateLongline()};
    
    162
    +}
    
    163
    +
    
    164
    +#hookPosition {
    
    165
    +  property:{CatchLonglineDto.PROPERTY_HOOK_POSITION};
    
    166
    +  selectedItem:{tableEditBean.getHookPosition()};
    
    167
    +}
    
    168
    +
    
    169
    +#comment {
    
    170
    +  title:"observe.common.CatchLonglineDto.comment";
    
    171
    +}
    
    172
    +
    
    173
    +/* ***************************************************************************** */
    
    174
    +/*  DEPREDATED TAB ************************************************************* */
    
    175
    +/* ***************************************************************************** */
    
    176
    +
    
    177
    +#depredatedFormTab {
    
    178
    +  icon:{handler.getErrorIconIfFalse(model.isDepredatedTabValid())};
    
    179
    +}
    
    180
    +
    
    181
    +#beatDiameter {
    
    182
    +  property:{CatchLonglineDto.PROPERTY_BEAT_DIAMETER};
    
    183
    +  numberValue:{tableEditBean.getBeatDiameter()};
    
    184
    +}
    
    185
    +
    
    186
    +#depredated {
    
    187
    +  horizontalTextPosition:{JCheckBox.LEFT};
    
    188
    +  _tablePropertyName:{CatchLonglineDto.PROPERTY_DEPREDATED};
    
    189
    +  selected:{BooleanUtils.isTrue(tableEditBean.getDepredated())};
    
    190
    +}
    
    191
    +
    
    192
    +#predatorPane {
    
    193
    +  minimumSize:{new Dimension(10,150)};
    
    194
    +}
    
    195
    +
    
    196
    +#predator {
    
    197
    +  property: predator;
    
    198
    +  selected:{(Collection)tableEditBean.getPredator()};
    
    199
    +  showListLabel: true;
    
    200
    +  universeLabel:{t("observe.common.CatchLonglineDto.availablePredator")};
    
    201
    +  selectedLabel:{t("observe.common.CatchLonglineDto.selectedPredator")};
    
    202
    +}
    
    203
    +
    
    204
    +/* ***************************************************************************** */
    
    205
    +/*  FOOD AND SEXUAL TAB ******************************************************** */
    
    206
    +/* ***************************************************************************** */
    
    207
    +
    
    208
    +#foodAndSexualFormTab {
    
    209
    +  icon:{handler.getErrorIconIfFalse(model.isFoodAndSexualTabValid())};
    
    210
    +}
    
    211
    +
    
    212
    +#foodAndSexualForm {
    
    213
    +  border:{new TitledBorder( (String) null)};
    
    214
    +}
    
    215
    +
    
    216
    +#sex {
    
    217
    +  property:{CatchLonglineDto.PROPERTY_SEX};
    
    218
    +  selectedItem:{tableEditBean.getSex()};
    
    219
    +}
    
    220
    +
    
    221
    +#stomacFullness {
    
    222
    +  property:{CatchLonglineDto.PROPERTY_STOMAC_FULLNESS};
    
    223
    +  selectedItem:{tableEditBean.getStomacFullness()};
    
    224
    +}
    
    225
    +
    
    226
    +#maturityStatus {
    
    227
    +  property:{CatchLonglineDto.PROPERTY_MATURITY_STATUS};
    
    228
    +  selectedItem:{tableEditBean.getMaturityStatus()};
    
    229
    +}
    
    230
    +
    
    231
    +#gonadeWeight {
    
    232
    +  property:{CatchLonglineDto.PROPERTY_GONADE_WEIGHT};
    
    233
    +  numberValue:{tableEditBean.getGonadeWeight()};
    
    234
    +}
    
    235
    +
    
    236
    +/* ***************************************************************************** */
    
    237
    +/*  SIZE MEASURES TAB ********************************************************** */
    
    238
    +/* ***************************************************************************** */
    
    239
    +
    
    240
    +#sizeMeasuresFormTab {
    
    241
    +  icon:{handler.getErrorIconIfFalse(sizeMeasuresTableModel.isValid())};
    
    242
    +}
    
    243
    +
    
    244
    +#sizeMeasuresTable {
    
    245
    +  model: {sizeMeasuresTableModel};
    
    246
    +}
    
    247
    +
    
    248
    +#addSizeMeasure {
    
    249
    +  text: "observe.common.CatchLonglineDto.action.addSizeMeasure";
    
    250
    +  toolTipText: "observe.common.CatchLonglineDto.action.addSizeMeasure.tip";
    
    251
    +  actionIcon: add;
    
    252
    +}
    
    253
    +
    
    254
    +#deleteSelectedSizeMeasure {
    
    255
    +  text: "observe.common.CatchLonglineDto.action.deleteSelectedSizeMeasure";
    
    256
    +  toolTipText: "observe.common.CatchLonglineDto.action.deleteSelectedSizeMeasure.tip";
    
    257
    +  actionIcon: delete;
    
    258
    +}
    
    259
    +
    
    260
    +/* ***************************************************************************** */
    
    261
    +/*  WEIGHT MEASURES TAB ******************************************************** */
    
    262
    +/* ***************************************************************************** */
    
    263
    +
    
    264
    +#weightMeasuresFormTab {
    
    265
    +  icon:{handler.getErrorIconIfFalse(weightMeasuresTableModel.isValid())};
    
    266
    +}
    
    267
    +
    
    268
    +#weightMeasuresTable {
    
    269
    +  model: {weightMeasuresTableModel};
    
    270
    +}
    
    271
    +
    
    272
    +#addWeightMeasure {
    
    273
    +  text: "observe.common.CatchLonglineDto.action.addWeightMeasure";
    
    274
    +  toolTipText: "observe.common.CatchLonglineDto.action.addWeightMeasure.tip";
    
    275
    +  actionIcon: add;
    
    276
    +}
    
    277
    +
    
    278
    +#deleteSelectedWeightMeasure {
    
    279
    +  text: "observe.common.CatchLonglineDto.action.deleteSelectedWeightMeasure";
    
    280
    +  toolTipText: "observe.common.CatchLonglineDto.action.deleteSelectedWeightMeasure.tip";
    
    281
    +  actionIcon: delete;
    
    282
    +}
    
    283
    +
    
    284
    +/* ***************************************************************************** */
    
    285
    +/*  BRANCHLINE TAB ************************************************************* */
    
    286
    +/* ***************************************************************************** */
    
    287
    +
    
    288
    +#branchlineFormTab {
    
    289
    +  icon:{handler.getErrorIconIfFalse(model.isBranchlineTabValid())};
    
    290
    +  enabled:{!tableModel.isCreate() && tableEditBean.getBranchline() != null};
    
    291
    +}
    
    292
    +
    
    293
    +#branchlineForm {
    
    294
    +  border:{new TitledBorder( (String) null)};
    
    295
    +  visible:{!tableModel.isCreate() && tableEditBean.getBranchline() != null};
    
    296
    +}
    
    297
    +
    
    298
    +#depthRecorder {
    
    299
    +  horizontalTextPosition:{JCheckBox.LEFT};
    
    300
    +  _branchlineBeanPropertyName:{BranchlineDto.PROPERTY_DEPTH_RECORDER};
    
    301
    +  selected:{BooleanUtils.isTrue(branchlineBean.getDepthRecorder())};
    
    302
    +}
    
    303
    +
    
    304
    +#hookLost {
    
    305
    +  horizontalTextPosition:{JCheckBox.LEFT};
    
    306
    +  _branchlineBeanPropertyName:{BranchlineDto.PROPERTY_HOOK_LOST};
    
    307
    +  selected:{BooleanUtils.isTrue(branchlineBean.getHookLost())};
    
    308
    +}
    
    309
    +
    
    310
    +#traceCutOff {
    
    311
    +  horizontalTextPosition:{JCheckBox.LEFT};
    
    312
    +  _branchlineBeanPropertyName:{BranchlineDto.PROPERTY_TRACE_CUT_OFF};
    
    313
    +  selected:{BooleanUtils.isTrue(branchlineBean.getTraceCutOff())};
    
    314
    +}
    
    315
    +
    
    316
    +#timer {
    
    317
    +  horizontalTextPosition:{JCheckBox.LEFT};
    
    318
    +  _branchlineBeanPropertyName:{BranchlineDto.PROPERTY_TIMER};
    
    319
    +  selected:{BooleanUtils.isTrue(branchlineBean.getTimer())};
    
    320
    +}
    
    321
    +
    
    322
    +#timeSinceContact {
    
    323
    +  propertyTime:{CatchLonglineUIModel.PROPERTY_BRANCHLINE_TIME_SINCE_CONTACT};
    
    324
    +  bean:{model};
    
    325
    +  enabled:{BooleanUtils.isTrue(branchlineBean.getTimer())};
    
    326
    +  time:{model.getBranchlineTimeSinceContact()};
    
    327
    +  showTimeEditorSlider:false;
    
    328
    +}
    
    329
    +
    
    330
    +#timerTimeOnBoard {
    
    331
    +  date:{branchlineBean.getTimerTimeOnBoard()};
    
    332
    +  propertyDate: {BranchlineDto.PROPERTY_TIMER_TIME_ON_BOARD};
    
    333
    +  bean:{branchlineBean};
    
    334
    +  showTimeEditorSlider:false;
    
    335
    +  enabled:{BooleanUtils.isTrue(branchlineBean.getTimer())};
    
    336
    +}
    
    337
    +
    
    338
    +#baitHaulingStatus {
    
    339
    +  property:{BranchlineDto.PROPERTY_BAIT_HAULING_STATUS};
    
    340
    +  bean:{branchlineBean};
    
    341
    +  selectedItem:{branchlineBean.getBaitHaulingStatus()};
    
    342
    +}
    
    343
    +
    
    344
    +#branchlineActions {
    
    345
    +  visible:{tableModel.isEditable()};
    
    346
    +}
    
    347
    +
    
    348
    +#resetBranchline {
    
    349
    +  text:"observe.common.CatchLonglineDto.resetBranchline";
    
    350
    +  toolTipText:"observe.common.CatchLonglineDto.resetBranchline.tip";
    
    351
    +  actionIcon:"revert";
    
    352
    +  enabled:{branchlineValidator.isChanged()};
    
    353
    +}
    
    354
    +
    
    355
    +#saveBranchline{
    
    356
    +  text:"observe.common.CatchLonglineDto.saveBranchline";
    
    357
    +  toolTipText:"observe.common.CatchLonglineDto.saveBranchline.tip";
    
    358
    +  actionIcon:"save";
    
    359
    +  enabled:{branchlineValidator.isChanged() && branchlineValidator.isValid()};
    
    360
    +}

  • client/src/main/java/fr/ird/observe/client/ui/content/data/longline/CatchLonglineLogbookUIHandler.java
    1
    +package fr.ird.observe.client.ui.content.data.longline;
    
    2
    +
    
    3
    +/*
    
    4
    + * #%L
    
    5
    + * ObServe :: Client
    
    6
    + * %%
    
    7
    + * Copyright (C) 2008 - 2017 IRD, Code Lutin, Ultreia.io
    
    8
    + * %%
    
    9
    + * This program is free software: you can redistribute it and/or modify
    
    10
    + * it under the terms of the GNU General Public License as
    
    11
    + * published by the Free Software Foundation, either version 3 of the
    
    12
    + * License, or (at your option) any later version.
    
    13
    + *
    
    14
    + * This program is distributed in the hope that it will be useful,
    
    15
    + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    16
    + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    
    17
    + * GNU General Public License for more details.
    
    18
    + *
    
    19
    + * You should have received a copy of the GNU General Public
    
    20
    + * License along with this program.  If not, see
    
    21
    + * <http://www.gnu.org/licenses/gpl-3.0.html>.
    
    22
    + * #L%
    
    23
    + */
    
    24
    +
    
    25
    +import fr.ird.observe.client.ObserveSwingApplicationContext;
    
    26
    +import fr.ird.observe.client.constants.CatchAcquisitionMode;
    
    27
    +import fr.ird.observe.client.db.constants.DataContextType;
    
    28
    +import fr.ird.observe.client.ui.content.ContentUIModel;
    
    29
    +import fr.ird.observe.client.ui.content.table.ContentTableModel;
    
    30
    +import fr.ird.observe.client.ui.content.table.ContentTableUIHandler;
    
    31
    +import fr.ird.observe.client.ui.content.table.ContentTableUIInitializer;
    
    32
    +import fr.ird.observe.client.ui.tree.navigation.NavigationTree;
    
    33
    +import fr.ird.observe.client.ui.tree.navigation.nodes.NavigationTreeNodeSupport;
    
    34
    +import fr.ird.observe.client.ui.tree.navigation.nodes.longline.TripLonglineNavigationTreeNode;
    
    35
    +import fr.ird.observe.client.ui.util.UIHelper;
    
    36
    +import fr.ird.observe.client.ui.util.table.AutotSelectRowAndShowPopupActionSupport;
    
    37
    +import fr.ird.observe.dto.data.longline.BranchlineDto;
    
    38
    +import fr.ird.observe.dto.data.longline.CatchLonglineDto;
    
    39
    +import fr.ird.observe.dto.data.longline.SetLonglineCatchDto;
    
    40
    +import fr.ird.observe.dto.data.longline.TripLonglineReference;
    
    41
    +import fr.ird.observe.dto.form.Form;
    
    42
    +import fr.ird.observe.dto.form.FormDefinition;
    
    43
    +import fr.ird.observe.dto.reference.DtoReferenceCollection;
    
    44
    +import fr.ird.observe.dto.referential.SpeciesDto;
    
    45
    +import fr.ird.observe.dto.referential.SpeciesReference;
    
    46
    +import fr.ird.observe.dto.referential.longline.CatchFateLonglineReference;
    
    47
    +import fr.ird.observe.dto.referential.longline.HealthnessReference;
    
    48
    +import fr.ird.observe.dto.result.SaveResultDto;
    
    49
    +import fr.ird.observe.spi.DtoModelHelper;
    
    50
    +import org.apache.commons.lang3.BooleanUtils;
    
    51
    +import org.apache.commons.logging.Log;
    
    52
    +import org.apache.commons.logging.LogFactory;
    
    53
    +import org.nuiton.jaxx.runtime.spi.UIHandler;
    
    54
    +import org.nuiton.jaxx.validator.swing.SwingValidatorMessage;
    
    55
    +import org.nuiton.jaxx.validator.swing.SwingValidatorMessageTableModel;
    
    56
    +import org.nuiton.validator.NuitonValidatorScope;
    
    57
    +
    
    58
    +import javax.swing.JComponent;
    
    59
    +import javax.swing.JPopupMenu;
    
    60
    +import javax.swing.JScrollPane;
    
    61
    +import javax.swing.JTable;
    
    62
    +import javax.swing.event.TableModelListener;
    
    63
    +import javax.swing.table.DefaultTableCellRenderer;
    
    64
    +import java.beans.PropertyChangeListener;
    
    65
    +import java.util.HashSet;
    
    66
    +import java.util.List;
    
    67
    +import java.util.Optional;
    
    68
    +import java.util.Set;
    
    69
    +
    
    70
    +import static org.nuiton.i18n.I18n.n;
    
    71
    +import static org.nuiton.i18n.I18n.t;
    
    72
    +
    
    73
    +/**
    
    74
    + * Created on 9/11/14.
    
    75
    + *
    
    76
    + * @author Tony Chemit - dev@tchemit.fr
    
    77
    + * @since 3.7
    
    78
    + */
    
    79
    +public class CatchLonglineLogbookUIHandler extends ContentTableUIHandler<SetLonglineCatchDto, CatchLonglineDto, CatchLonglineLogbookUI> implements UIHandler<CatchLonglineLogbookUI> {
    
    80
    +
    
    81
    +    /** Logger */
    
    82
    +    private static final Log log = LogFactory.getLog(CatchLonglineLogbookUIHandler.class);
    
    83
    +    private static final String GROUPED_TRIP_TYPE_ID = "fr.ird.observe.entities.referentiel.longline.TripType#1239832686136#0.1";
    
    84
    +    // Compute valid state of tab from the error table
    
    85
    +    protected final TableModelListener computeTabValidStateListener;
    
    86
    +    private final PropertyChangeListener catchFateChanged;
    
    87
    +    private final PropertyChangeListener depredatedChanged;
    
    88
    +
    
    89
    +    CatchLonglineLogbookUIHandler() {
    
    90
    +        super(DataContextType.SetLongline);
    
    91
    +        computeTabValidStateListener = e -> {
    
    92
    +
    
    93
    +            SwingValidatorMessageTableModel source = (SwingValidatorMessageTableModel) e.getSource();
    
    94
    +            computeTabValidState(source);
    
    95
    +
    
    96
    +        };
    
    97
    +        catchFateChanged = evt -> onCatchFateChanged((CatchFateLonglineReference) evt.getNewValue());
    
    98
    +        depredatedChanged = evt -> onDepredatedChanged((Boolean) evt.getNewValue(), (CatchLonglineDto) evt.getSource());
    
    99
    +
    
    100
    +        addReferentialFilter(CatchLonglineDto.PROPERTY_SPECIES_CATCH, (ReferentialReferencesFilter<SpeciesDto, SpeciesReference>) incomingReferences -> {
    
    101
    +            String speciesListId = ObserveSwingApplicationContext.get().getConfig().getSpeciesListLonglineCatchId();
    
    102
    +            String tripLonglineId = getDataContext().getSelectedTripLonglineId();
    
    103
    +            List<SpeciesReference> result = getTripLonglineService().getSpeciesByListAndTrip(tripLonglineId, speciesListId).toList();
    
    104
    +            return DtoReferenceCollection.filterEnabled(result);
    
    105
    +        });
    
    106
    +
    
    107
    +        addReferentialFilter(CatchLonglineDto.PROPERTY_PREDATOR, (ReferentialReferencesFilter<SpeciesDto, SpeciesReference>) incomingReferences -> {
    
    108
    +            String speciesListId = ObserveSwingApplicationContext.get().getConfig().getSpeciesListLonglineDepredatorId();
    
    109
    +            String tripLonglineId = getDataContext().getSelectedTripLonglineId();
    
    110
    +            List<SpeciesReference> result = getTripLonglineService().getSpeciesByListAndTrip(tripLonglineId, speciesListId).toList();
    
    111
    +            return DtoReferenceCollection.filterEnabled(result);
    
    112
    +        });
    
    113
    +    }
    
    114
    +
    
    115
    +    @Override
    
    116
    +    public CatchLonglineLogbookUIModel getModel() {
    
    117
    +        return (CatchLonglineLogbookUIModel) super.getModel();
    
    118
    +    }
    
    119
    +
    
    120
    +    @Override
    
    121
    +    public void afterInit(CatchLonglineLogbookUI ui) {
    
    122
    +
    
    123
    +        ContentTableUIInitializer<SetLonglineCatchDto, CatchLonglineDto, CatchLonglineLogbookUI> uiInitializer = new ContentTableUIInitializer<>(ui);
    
    124
    +        uiInitializer.initUI();
    
    125
    +
    
    126
    +        ui.setTitle(t(updateTitle(ui.getContentTitle())));
    
    127
    +        updateTitle(getModel().getMode());
    
    128
    +
    
    129
    +        installFocusTraversalPolicy();
    
    130
    +
    
    131
    +        CatchLonglineLogbookUIModel model = ui.getModel();
    
    132
    +
    
    133
    +        model.addPropertyChangeListener(ContentUIModel.PROPERTY_FORM, evt -> updateUiWithReferenceSetsFromModel());
    
    134
    +    }
    
    135
    +
    
    136
    +    @Override
    
    137
    +    public void openUI() {
    
    138
    +
    
    139
    +        if (log.isInfoEnabled()) {
    
    140
    +            log.info("OpenUI: " + getModel());
    
    141
    +        }
    
    142
    +
    
    143
    +        super.openUI();
    
    144
    +
    
    145
    +        // To be sure always remove listener (could prevent some leaks)
    
    146
    +        getUi().getErrorTableModel().removeTableModelListener(computeTabValidStateListener);
    
    147
    +        // listen messages to see if required to add
    
    148
    +        getUi().getErrorTableModel().addTableModelListener(computeTabValidStateListener);
    
    149
    +
    
    150
    +        SwingValidatorMessageTableModel errorTableModel = getUi().getErrorTableModel();
    
    151
    +        computeTabValidState(errorTableModel);
    
    152
    +
    
    153
    +    }
    
    154
    +
    
    155
    +    void updateCatchAcquisitionMode(CatchAcquisitionMode newMode) {
    
    156
    +
    
    157
    +        if (log.isDebugEnabled()) {
    
    158
    +            log.debug("Change CatchAcquisitionMode " + newMode);
    
    159
    +        }
    
    160
    +        if (newMode == null) {
    
    161
    +
    
    162
    +            // mode null (cela peut arriver avec les bindings)
    
    163
    +            return;
    
    164
    +        }
    
    165
    +
    
    166
    +        CatchLonglineLogbookUI ui = getUi();
    
    167
    +
    
    168
    +        boolean createMode = ui.getTableModel().isCreate();
    
    169
    +
    
    170
    +        CatchLonglineDto editBean = ui.getTableEditBean();
    
    171
    +
    
    172
    +        switch (newMode) {
    
    173
    +
    
    174
    +            case GROUPED:
    
    175
    +
    
    176
    +                if (createMode) {
    
    177
    +
    
    178
    +                    editBean.setTotalWeight(null);
    
    179
    +                    editBean.setCount(null);
    
    180
    +                    editBean.setHookPosition(null);
    
    181
    +
    
    182
    +                }
    
    183
    +
    
    184
    +                break;
    
    185
    +
    
    186
    +            case INDIVIDUAL:
    
    187
    +
    
    188
    +                if (createMode) {
    
    189
    +
    
    190
    +                    // on positionne le count à 1 (seule valeur possible)
    
    191
    +                    editBean.setCount(1);
    
    192
    +
    
    193
    +                }
    
    194
    +
    
    195
    +                break;
    
    196
    +        }
    
    197
    +
    
    198
    +        boolean isGrouped = CatchAcquisitionMode.GROUPED.equals(newMode);
    
    199
    +
    
    200
    +        ui.getTotalWeight().setEnabled(isGrouped);
    
    201
    +        ui.getCount().setEnabled(isGrouped);
    
    202
    +
    
    203
    +        if (createMode) {
    
    204
    +
    
    205
    +            // on propage le mode de saisie dans le bean
    
    206
    +            editBean.setAcquisitionMode(newMode.ordinal());
    
    207
    +
    
    208
    +        }
    
    209
    +    }
    
    210
    +
    
    211
    +    @Override
    
    212
    +    protected void onSelectedRowChanged(int editingRow, CatchLonglineDto bean, boolean create) {
    
    213
    +
    
    214
    +        if (log.isInfoEnabled()) {
    
    215
    +            log.info("Selected row changed: " + editingRow + ", create? " + create);
    
    216
    +        }
    
    217
    +
    
    218
    +        CatchLonglineLogbookUI ui = getUi();
    
    219
    +
    
    220
    +        CatchLonglineTableModel tableModel = getTableModel();
    
    221
    +
    
    222
    +        if (!tableModel.isEditable()) {
    
    223
    +            return;
    
    224
    +        }
    
    225
    +
    
    226
    +        JComponent requestFocus;
    
    227
    +
    
    228
    +        CatchAcquisitionMode acquisitionModeEnum;
    
    229
    +
    
    230
    +        if (tableModel.isCreate()) {
    
    231
    +
    
    232
    +            // go back to first pane
    
    233
    +            ui.getMainTabbedPane().setSelectedIndex(0);
    
    234
    +
    
    235
    +            NavigationTree treeHelper = getNavigationTree();
    
    236
    +            NavigationTreeNodeSupport selectedNode = treeHelper.getSelectedNode();
    
    237
    +            while (!(selectedNode instanceof TripLonglineNavigationTreeNode)) {
    
    238
    +                selectedNode = selectedNode.getParent();
    
    239
    +            }
    
    240
    +            TripLonglineReference tripReference = ((TripLonglineNavigationTreeNode) selectedNode).getData();
    
    241
    +            String tripTypeId = tripReference.getTripTypeId();
    
    242
    +            if (log.isInfoEnabled()) {
    
    243
    +                log.info("Use tripId: " + tripTypeId);
    
    244
    +            }
    
    245
    +            acquisitionModeEnum = GROUPED_TRIP_TYPE_ID.equals(tripTypeId) ? CatchAcquisitionMode.GROUPED : CatchAcquisitionMode.INDIVIDUAL;
    
    246
    +
    
    247
    +            ui.getPredator().setEnabled(false);
    
    248
    +            ui.getDiscardHealthness().setEnabled(false);
    
    249
    +            ui.getBeatDiameter().setEnabled(false);
    
    250
    +
    
    251
    +            requestFocus = ui.getSpeciesCatch();
    
    252
    +
    
    253
    +        } else {
    
    254
    +
    
    255
    +            int acquisitionMode = bean.getAcquisitionMode();
    
    256
    +
    
    257
    +            acquisitionModeEnum = CatchAcquisitionMode.valueOf(acquisitionMode);
    
    258
    +
    
    259
    +            if (acquisitionModeEnum.equals(CatchAcquisitionMode.GROUPED)) {
    
    260
    +
    
    261
    +                requestFocus = ui.getCount();
    
    262
    +
    
    263
    +            } else {
    
    264
    +
    
    265
    +                requestFocus = ui.getCatchHealthness();
    
    266
    +
    
    267
    +            }
    
    268
    +
    
    269
    +            //FIXME Voir si pas besoin aussi de relancer les binding (catchFateChanged, branchlineChanged) ?
    
    270
    +            onDepredatedChanged(bean.getDepredated(), bean);
    
    271
    +
    
    272
    +        }
    
    273
    +
    
    274
    +        ui.getAcquisitionModeGroup().setSelectedValue(null);
    
    275
    +        ui.getAcquisitionModeGroup().setSelectedValue(acquisitionModeEnum);
    
    276
    +
    
    277
    +        bean.removePropertyChangeListener(CatchLonglineDto.PROPERTY_CATCH_FATE_LONGLINE, catchFateChanged);
    
    278
    +        bean.addPropertyChangeListener(CatchLonglineDto.PROPERTY_CATCH_FATE_LONGLINE, catchFateChanged);
    
    279
    +
    
    280
    +        bean.removePropertyChangeListener(CatchLonglineDto.PROPERTY_DEPREDATED, depredatedChanged);
    
    281
    +        bean.addPropertyChangeListener(CatchLonglineDto.PROPERTY_DEPREDATED, depredatedChanged);
    
    282
    +
    
    283
    +        UIHelper.askFocus(requestFocus);
    
    284
    +
    
    285
    +    }
    
    286
    +
    
    287
    +    @Override
    
    288
    +    protected void initTableUI(DefaultTableCellRenderer renderer) {
    
    289
    +
    
    290
    +        CatchLonglineLogbookUI ui = getUi();
    
    291
    +        {
    
    292
    +            // init main table
    
    293
    +
    
    294
    +            JTable table = ui.getTable();
    
    295
    +
    
    296
    +            UIHelper.setI18nTableHeaderRenderer(
    
    297
    +                    table,
    
    298
    +
    
    299
    +                    n("observe.common.CatchLonglineDto.table.speciesCatch"),
    
    300
    +                    n("observe.common.CatchLonglineDto.table.speciesCatch.tip"),
    
    301
    +                    n("observe.common.CatchLonglineDto.table.acquisitionMode"),
    
    302
    +                    n("observe.common.CatchLonglineDto.table.acquisitionMode.tip"),
    
    303
    +                    n("observe.common.CatchLonglineDto.table.count"),
    
    304
    +                    n("observe.common.CatchLonglineDto.table.count.tip"),
    
    305
    +                    n("observe.common.CatchLonglineDto.table.catchHealthness"),
    
    306
    +                    n("observe.common.CatchLonglineDto.table.catchHealthness.tip"),
    
    307
    +                    n("observe.common.CatchLonglineDto.table.catchFateLongline"),
    
    308
    +                    n("observe.common.CatchLonglineDto.table.catchFateLongline.tip"),
    
    309
    +                    n("observe.common.CatchLonglineDto.table.discardHealthness"),
    
    310
    +                    n("observe.common.CatchLonglineDto.table.discardHealthness.tip"),
    
    311
    +                    n("observe.common.CatchLonglineDto.table.depredated"),
    
    312
    +                    n("observe.common.CatchLonglineDto.table.depredated.tip"),
    
    313
    +                    n("observe.common.CatchLonglineDto.table.comment"),
    
    314
    +                    n("observe.common.CatchLonglineDto.table.comment.tip"));
    
    315
    +
    
    316
    +
    
    317
    +            UIHelper.setTableColumnRenderer(table, 0, UIHelper.newReferentialReferenceDecorateTableCellRenderer(renderer, SpeciesReference.class));
    
    318
    +            UIHelper.setTableColumnRenderer(table, 1, UIHelper.newEnumTableCellRenderer(renderer, CatchAcquisitionMode.class));
    
    319
    +            UIHelper.setTableColumnRenderer(table, 2, UIHelper.newEmptyNumberTableCellRenderer(renderer));
    
    320
    +            UIHelper.setTableColumnRenderer(table, 3, UIHelper.newReferentialReferenceDecorateTableCellRenderer(renderer, HealthnessReference.class));
    
    321
    +            UIHelper.setTableColumnRenderer(table, 4, UIHelper.newReferentialReferenceDecorateTableCellRenderer(renderer, CatchFateLonglineReference.class));
    
    322
    +            UIHelper.setTableColumnRenderer(table, 5, UIHelper.newReferentialReferenceDecorateTableCellRenderer(renderer, HealthnessReference.class));
    
    323
    +            UIHelper.setTableColumnRenderer(table, 6, UIHelper.newBooleanTableCellRenderer(renderer));
    
    324
    +            UIHelper.setTableColumnRenderer(table, 7, UIHelper.newStringTableCellRenderer(renderer, 10, true));
    
    325
    +
    
    326
    +            new CatchLonglinesAutotSelectRowAndShowPopupAction(ui, ui.getTableScrollPane(), table, ui.getCatchLonglinesPopup());
    
    327
    +
    
    328
    +        }
    
    329
    +
    
    330
    +        getTableModel().addPropertyChangeListener(ContentTableModel.CREATE_PROPERTY, evt -> {
    
    331
    +            Boolean oldValue = (Boolean) evt.getOldValue();
    
    332
    +            Boolean newValue = (Boolean) evt.getNewValue();
    
    333
    +            setTableModelCreate(oldValue, newValue);
    
    334
    +        });
    
    335
    +    }
    
    336
    +
    
    337
    +    @Override
    
    338
    +    protected String getEditBeanIdToLoad() {
    
    339
    +        return getDataContext().getSelectedSetLonglineId();
    
    340
    +    }
    
    341
    +
    
    342
    +    @Override
    
    343
    +    protected void doPersist(SetLonglineCatchDto bean) {
    
    344
    +        SaveResultDto saveResult = getSetLonglineCatchService().save(bean);
    
    345
    +        bean.setLastUpdateDate(saveResult.getLastUpdateDate());
    
    346
    +    }
    
    347
    +
    
    348
    +    @Override
    
    349
    +    protected boolean prepareSave(SetLonglineCatchDto editBean, List<CatchLonglineDto> objets) throws Exception {
    
    350
    +        boolean doSave = super.prepareSave(editBean, objets);
    
    351
    +        if (doSave) {
    
    352
    +            editBean.setCatchLongline(objets);
    
    353
    +        }
    
    354
    +        return doSave;
    
    355
    +    }
    
    356
    +
    
    357
    +    @Override
    
    358
    +    protected void loadEditBean(String beanId) {
    
    359
    +
    
    360
    +        Form<SetLonglineCatchDto> form = getSetLonglineCatchService().loadForm(beanId);
    
    361
    +
    
    362
    +        CatchLonglineLogbookUIModel model = getModel();
    
    363
    +
    
    364
    +        // On supprime l'entrée sélectionnée dans le tableau
    
    365
    +        getTableModel().setSelectedRow(-1);
    
    366
    +
    
    367
    +        loadReferentialReferenceSetsInModel(form);
    
    368
    +
    
    369
    +        Optional<FormDefinition<BranchlineDto>> optionalFormDefinition = DtoModelHelper.getOptionalFormDefinition(BranchlineDto.class);
    
    370
    +        optionalFormDefinition.ifPresent(branchlineDtoFormDefinition -> loadReferentialReferenceSetsInModel(branchlineDtoFormDefinition, false));
    
    371
    +
    
    372
    +        model.setForm(form);
    
    373
    +    }
    
    374
    +
    
    375
    +    @Override
    
    376
    +    protected void closeSafeUI() {
    
    377
    +
    
    378
    +        if (log.isInfoEnabled()) {
    
    379
    +            log.info("CloseUI: " + getModel());
    
    380
    +        }
    
    381
    +        super.closeSafeUI();
    
    382
    +
    
    383
    +        // remove listener
    
    384
    +        getUi().getErrorTableModel().removeTableModelListener(computeTabValidStateListener);
    
    385
    +
    
    386
    +    }
    
    387
    +
    
    388
    +    private void setTableModelCreate(Boolean oldValue, Boolean newValue) {
    
    389
    +
    
    390
    +        if (BooleanUtils.isTrue(oldValue) && BooleanUtils.isFalse(newValue)) {
    
    391
    +
    
    392
    +            // just save a row
    
    393
    +            // reload acquisition mode (will rebind some stuff)
    
    394
    +
    
    395
    +            CatchAcquisitionMode acquisitionModeEnum = (CatchAcquisitionMode) getUi().getAcquisitionModeGroup().getSelectedValue();
    
    396
    +
    
    397
    +            getUi().getAcquisitionModeGroup().setSelectedValue(null);
    
    398
    +            getUi().getAcquisitionModeGroup().setSelectedValue(acquisitionModeEnum);
    
    399
    +
    
    400
    +        }
    
    401
    +
    
    402
    +    }
    
    403
    +
    
    404
    +    private void onCatchFateChanged(CatchFateLonglineReference newValue) {
    
    405
    +
    
    406
    +        CatchLonglineLogbookUI ui = getUi();
    
    407
    +
    
    408
    +        if (newValue == null || !"fr.ird.observe.entities.referentiel.longline.CatchFateLongline#1239832686125#0.3".equals(newValue.getId())) {
    
    409
    +
    
    410
    +            // not discarded
    
    411
    +            ui.getDiscardHealthness().setEnabled(false);
    
    412
    +
    
    413
    +            getTableEditBean().setHookWhenDiscarded(null);
    
    414
    +            getTableEditBean().setDiscardHealthness(null);
    
    415
    +
    
    416
    +        } else {
    
    417
    +
    
    418
    +            // discarded
    
    419
    +            ui.getDiscardHealthness().setEnabled(true);
    
    420
    +        }
    
    421
    +
    
    422
    +    }
    
    423
    +
    
    424
    +    private void onDepredatedChanged(Boolean newValue, CatchLonglineDto tableEditBean) {
    
    425
    +
    
    426
    +        CatchLonglineLogbookUI ui = getUi();
    
    427
    +
    
    428
    +        if (BooleanUtils.isTrue(newValue)) {
    
    429
    +
    
    430
    +            // depredated
    
    431
    +            ui.getBeatDiameter().setEnabled(true);
    
    432
    +            ui.getPredator().setEnabled(true);
    
    433
    +
    
    434
    +        } else {
    
    435
    +
    
    436
    +            // not depredated
    
    437
    +            ui.getBeatDiameter().setEnabled(false);
    
    438
    +            ui.getPredator().setEnabled(false);
    
    439
    +            tableEditBean.setBeatDiameter(null);
    
    440
    +            tableEditBean.setPredator(null);
    
    441
    +
    
    442
    +        }
    
    443
    +
    
    444
    +    }
    
    445
    +
    
    446
    +    protected void computeTabValidState(SwingValidatorMessageTableModel errorTableModel) {
    
    447
    +
    
    448
    +        Set<String> errorProperties = new HashSet<>();
    
    449
    +        int rowCount = errorTableModel.getRowCount();
    
    450
    +        for (int i = 0; i < rowCount; i++) {
    
    451
    +
    
    452
    +            SwingValidatorMessage row = errorTableModel.getRow(i);
    
    453
    +            if (NuitonValidatorScope.ERROR.equals(row.getScope())) {
    
    454
    +                errorProperties.add(row.getField());
    
    455
    +            }
    
    456
    +        }
    
    457
    +
    
    458
    +        boolean caracteristicsTabValid = !errorProperties.removeAll(CatchLonglineLogbookUIModel.CARACTERISTIC_TAB_PROPERTIES);
    
    459
    +        boolean depredatedTabValid = !errorProperties.removeAll(CatchLonglineLogbookUIModel.DEPREDATED_TAB_PROPERTIES);
    
    460
    +
    
    461
    +        CatchLonglineLogbookUIModel model = getModel();
    
    462
    +
    
    463
    +        model.setCaracteristicsTabValid(caracteristicsTabValid);
    
    464
    +        model.setDepredatedTabValid(depredatedTabValid);
    
    465
    +    }
    
    466
    +
    
    467
    +    @Override
    
    468
    +    protected CatchLonglineTableModel getTableModel() {
    
    469
    +        return (CatchLonglineTableModel) super.getTableModel();
    
    470
    +    }
    
    471
    +
    
    472
    +    public void moveCatchLonglineUp() {
    
    473
    +        int selectedRow = getUi().getTable().getSelectedRow();
    
    474
    +        getTableModel().moveUp(selectedRow);
    
    475
    +    }
    
    476
    +
    
    477
    +    public void moveCatchLonglineDown() {
    
    478
    +        int selectedRow = getUi().getTable().getSelectedRow();
    
    479
    +        getTableModel().moveDown(selectedRow);
    
    480
    +    }
    
    481
    +
    
    482
    +    static class CatchLonglinesAutotSelectRowAndShowPopupAction extends AutotSelectRowAndShowPopupActionSupport {
    
    483
    +
    
    484
    +        private final CatchLonglineLogbookUI ui;
    
    485
    +
    
    486
    +        CatchLonglinesAutotSelectRowAndShowPopupAction(CatchLonglineLogbookUI ui,
    
    487
    +                                                       JScrollPane pane,
    
    488
    +                                                       JTable table,
    
    489
    +                                                       JPopupMenu popup) {
    
    490
    +            super(pane, table, popup);
    
    491
    +            this.ui = ui;
    
    492
    +        }
    
    493
    +
    
    494
    +        @Override
    
    495
    +        protected void beforeOpenPopup(int modelRowIndex, int modelColumnIndex) {
    
    496
    +
    
    497
    +            CatchLonglineTableModel model = (CatchLonglineTableModel) getTable().getModel();
    
    498
    +
    
    499
    +            boolean canMoveUp = !ui.getModel().isCanSaveRow() && modelRowIndex > 0;
    
    500
    +            boolean canMoveDown = !ui.getModel().isCanSaveRow() && modelRowIndex < model.getRowCount() - 1;
    
    501
    +
    
    502
    +            ui.getMoveCatchLonglineUp().setEnabled(canMoveUp);
    
    503
    +            ui.getMoveCatchLonglineDown().setEnabled(canMoveDown);
    
    504
    +
    
    505
    +        }
    
    506
    +
    
    507
    +    }
    
    508
    +}

  • client/src/main/java/fr/ird/observe/client/ui/content/data/longline/CatchLonglineLogbookUIModel.java
    1
    +package fr.ird.observe.client.ui.content.data.longline;
    
    2
    +
    
    3
    +/*
    
    4
    + * #%L
    
    5
    + * ObServe :: Client
    
    6
    + * %%
    
    7
    + * Copyright (C) 2008 - 2017 IRD, Code Lutin, Ultreia.io
    
    8
    + * %%
    
    9
    + * This program is free software: you can redistribute it and/or modify
    
    10
    + * it under the terms of the GNU General Public License as
    
    11
    + * published by the Free Software Foundation, either version 3 of the
    
    12
    + * License, or (at your option) any later version.
    
    13
    + *
    
    14
    + * This program is distributed in the hope that it will be useful,
    
    15
    + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    16
    + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    
    17
    + * GNU General Public License for more details.
    
    18
    + *
    
    19
    + * You should have received a copy of the GNU General Public
    
    20
    + * License along with this program.  If not, see
    
    21
    + * <http://www.gnu.org/licenses/gpl-3.0.html>.
    
    22
    + * #L%
    
    23
    + */
    
    24
    +
    
    25
    +import com.google.common.collect.ImmutableSet;
    
    26
    +import fr.ird.observe.client.ui.content.table.ContentTableMeta;
    
    27
    +import fr.ird.observe.client.ui.content.table.ContentTableModel;
    
    28
    +import fr.ird.observe.client.ui.content.table.ContentTableUIModel;
    
    29
    +import fr.ird.observe.client.ui.content.table.ObserveContentTableUI;
    
    30
    +import fr.ird.observe.dto.data.longline.CatchLonglineDto;
    
    31
    +import fr.ird.observe.dto.data.longline.SetLonglineCatchDto;
    
    32
    +import org.nuiton.util.beans.Binder;
    
    33
    +import org.nuiton.util.beans.BinderModelBuilder;
    
    34
    +
    
    35
    +import java.util.Arrays;
    
    36
    +import java.util.List;
    
    37
    +import java.util.Set;
    
    38
    +
    
    39
    +/**
    
    40
    + * Created on 9/26/14.
    
    41
    + *
    
    42
    + * @author Tony Chemit - dev@tchemit.fr
    
    43
    + * @since 3.7
    
    44
    + */
    
    45
    +public class CatchLonglineLogbookUIModel extends ContentTableUIModel<SetLonglineCatchDto, CatchLonglineDto> {
    
    46
    +
    
    47
    +    public static final String PROPERTY_CARACTERISTICS_TAB_VALID = "caracteristicsTabValid";
    
    48
    +
    
    49
    +    public static final String PROPERTY_DEPREDATED_TAB_VALID = "depredatedTabValid";
    
    50
    +
    
    51
    +    public static final Set<String> CARACTERISTIC_TAB_PROPERTIES =
    
    52
    +            ImmutableSet.<String>builder().add(CatchLonglineDto.PROPERTY_SPECIES_CATCH,
    
    53
    +                    CatchLonglineDto.PROPERTY_PHOTO_REFERENCES,
    
    54
    +                    CatchLonglineDto.PROPERTY_COUNT,
    
    55
    +                    CatchLonglineDto.PROPERTY_TOTAL_WEIGHT,
    
    56
    +                    CatchLonglineDto.PROPERTY_CATCH_HEALTHNESS,
    
    57
    +                    CatchLonglineDto.PROPERTY_HOOK_POSITION,
    
    58
    +                    CatchLonglineDto.PROPERTY_CATCH_FATE_LONGLINE,
    
    59
    +                    CatchLonglineDto.PROPERTY_DISCARD_HEALTHNESS,
    
    60
    +                    CatchLonglineDto.PROPERTY_TAG_NUMBER,
    
    61
    +                    CatchLonglineDto.PROPERTY_HOOK_WHEN_DISCARDED).build();
    
    62
    +
    
    63
    +    public static final Set<String> DEPREDATED_TAB_PROPERTIES =
    
    64
    +            ImmutableSet.<String>builder().add(CatchLonglineDto.PROPERTY_DEPREDATED,
    
    65
    +                    CatchLonglineDto.PROPERTY_BEAT_DIAMETER,
    
    66
    +                    CatchLonglineDto.PROPERTY_PREDATOR).build();
    
    67
    +
    
    68
    +
    
    69
    +    private static final long serialVersionUID = 1L;
    
    70
    +
    
    71
    +    protected boolean caracteristicsTabValid;
    
    72
    +
    
    73
    +    protected boolean depredatedTabValid;
    
    74
    +
    
    75
    +    public CatchLonglineLogbookUIModel(CatchLonglineUI ui) {
    
    76
    +        super(SetLonglineCatchDto.class,
    
    77
    +                CatchLonglineDto.class,
    
    78
    +                new String[]{
    
    79
    +                        SetLonglineCatchDto.PROPERTY_CATCH_LONGLINE
    
    80
    +                },
    
    81
    +                new String[]{CatchLonglineDto.PROPERTY_SPECIES_CATCH,
    
    82
    +                        CatchLonglineDto.PROPERTY_ACQUISITION_MODE,
    
    83
    +                        CatchLonglineDto.PROPERTY_COUNT,
    
    84
    +                        CatchLonglineDto.PROPERTY_CATCH_HEALTHNESS,
    
    85
    +                        CatchLonglineDto.PROPERTY_CATCH_FATE_LONGLINE,
    
    86
    +                        CatchLonglineDto.PROPERTY_DISCARD_HEALTHNESS,
    
    87
    +                        CatchLonglineDto.PROPERTY_DEPREDATED,
    
    88
    +                        CatchLonglineDto.PROPERTY_NUMBER,
    
    89
    +                        CatchLonglineDto.PROPERTY_HOME_ID,
    
    90
    +                        CatchLonglineDto.PROPERTY_HOOK_POSITION,
    
    91
    +                        CatchLonglineDto.PROPERTY_HOOK_WHEN_DISCARDED,
    
    92
    +                        CatchLonglineDto.PROPERTY_MATURITY_STATUS,
    
    93
    +                        CatchLonglineDto.PROPERTY_PHOTO_REFERENCES,
    
    94
    +                        CatchLonglineDto.PROPERTY_SEX,
    
    95
    +                        CatchLonglineDto.PROPERTY_PREDATOR,
    
    96
    +                        CatchLonglineDto.PROPERTY_STOMAC_FULLNESS,
    
    97
    +                        CatchLonglineDto.PROPERTY_TOTAL_WEIGHT,
    
    98
    +                        CatchLonglineDto.PROPERTY_BEAT_DIAMETER,
    
    99
    +                        CatchLonglineDto.PROPERTY_GONADE_WEIGHT,
    
    100
    +                        CatchLonglineDto.PROPERTY_TAG_NUMBER,
    
    101
    +                        CatchLonglineDto.PROPERTY_COMMENT
    
    102
    +                });
    
    103
    +
    
    104
    +        List<ContentTableMeta<CatchLonglineDto>> metas = Arrays.asList(
    
    105
    +                ContentTableModel.newTableMeta(CatchLonglineDto.class, CatchLonglineDto.PROPERTY_SPECIES_CATCH, false),
    
    106
    +                ContentTableModel.newTableMeta(CatchLonglineDto.class, CatchLonglineDto.PROPERTY_ACQUISITION_MODE, false),
    
    107
    +                ContentTableModel.newTableMeta(CatchLonglineDto.class, CatchLonglineDto.PROPERTY_COUNT, false),
    
    108
    +                ContentTableModel.newTableMeta(CatchLonglineDto.class, CatchLonglineDto.PROPERTY_CATCH_HEALTHNESS, false),
    
    109
    +                ContentTableModel.newTableMeta(CatchLonglineDto.class, CatchLonglineDto.PROPERTY_CATCH_FATE_LONGLINE, false),
    
    110
    +                ContentTableModel.newTableMeta(CatchLonglineDto.class, CatchLonglineDto.PROPERTY_DISCARD_HEALTHNESS, false),
    
    111
    +                ContentTableModel.newTableMeta(CatchLonglineDto.class, CatchLonglineDto.PROPERTY_DEPREDATED, false),
    
    112
    +                ContentTableModel.newTableMeta(CatchLonglineDto.class, CatchLonglineDto.PROPERTY_COMMENT, false));
    
    113
    +
    
    114
    +        initModel(ui, metas);
    
    115
    +
    
    116
    +    }
    
    117
    +
    
    118
    +    public boolean isCaracteristicsTabValid() {
    
    119
    +        return caracteristicsTabValid;
    
    120
    +    }
    
    121
    +
    
    122
    +    public void setCaracteristicsTabValid(boolean caracteristicsTabValid) {
    
    123
    +        this.caracteristicsTabValid = caracteristicsTabValid;
    
    124
    +        firePropertyChange(PROPERTY_CARACTERISTICS_TAB_VALID, null, caracteristicsTabValid);
    
    125
    +    }
    
    126
    +
    
    127
    +    public boolean isDepredatedTabValid() {
    
    128
    +        return depredatedTabValid;
    
    129
    +    }
    
    130
    +
    
    131
    +    public void setDepredatedTabValid(boolean depredatedTabValid) {
    
    132
    +        this.depredatedTabValid = depredatedTabValid;
    
    133
    +        firePropertyChange(PROPERTY_DEPREDATED_TAB_VALID, null, depredatedTabValid);
    
    134
    +    }
    
    135
    +
    
    136
    +    @Override
    
    137
    +    protected CatchLonglineTableModel createTableModel(ObserveContentTableUI<SetLonglineCatchDto, CatchLonglineDto, ?> ui, List<ContentTableMeta<CatchLonglineDto>> contentTableMetas) {
    
    138
    +        return new CatchLonglineTableModel(ui, contentTableMetas);
    
    139
    +    }
    
    140
    +
    
    141
    +    @Override
    
    142
    +    protected BinderModelBuilder<CatchLonglineDto, CatchLonglineDto> prepareChildLoador(String binderName) {
    
    143
    +
    
    144
    +        BinderModelBuilder<CatchLonglineDto, CatchLonglineDto> builder = super.prepareChildLoador(binderName);
    
    145
    +
    
    146
    +        builder.addCollectionStrategy(Binder.CollectionStrategy.duplicate, CatchLonglineDto.PROPERTY_PREDATOR);
    
    147
    +
    
    148
    +        return builder;
    
    149
    +
    
    150
    +    }
    
    151
    +
    
    152
    +}

  • client/src/main/java/fr/ird/observe/client/ui/content/data/longline/SetLonglineLogbookUI.jaxx
    1
    +<!--
    
    2
    +  #%L
    
    3
    +  ObServe :: Client
    
    4
    +  %%
    
    5
    +  Copyright (C) 2008 - 2017 IRD, Code Lutin, Ultreia.io
    
    6
    +  %%
    
    7
    +  This program is free software: you can redistribute it and/or modify
    
    8
    +  it under the terms of the GNU General Public License as
    
    9
    +  published by the Free Software Foundation, either version 3 of the 
    
    10
    +  License, or (at your option) any later version.
    
    11
    +  
    
    12
    +  This program is distributed in the hope that it will be useful,
    
    13
    +  but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    14
    +  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    
    15
    +  GNU General Public License for more details.
    
    16
    +  
    
    17
    +  You should have received a copy of the GNU General Public 
    
    18
    +  License along with this program.  If not, see
    
    19
    +  <http://www.gnu.org/licenses/gpl-3.0.html>.
    
    20
    +  #L%
    
    21
    +  -->
    
    22
    +
    
    23
    +<fr.ird.observe.client.ui.content.ContentUI
    
    24
    +    i18nFormat="observe.common.SetLonglineDto.%s"
    
    25
    +    superGenericType='SetLonglineDto, SetLonglineLogbookUI'
    
    26
    +    contentTitle='{n("observe.common.SetLonglineDto.title")}'>
    
    27
    +
    
    28
    +  <import>
    
    29
    +    fr.ird.observe.dto.data.longline.SetLonglineDto
    
    30
    +    fr.ird.observe.dto.referential.longline.SettingShapeReference
    
    31
    +    fr.ird.observe.dto.referential.longline.LineTypeReference
    
    32
    +    fr.ird.observe.dto.referential.longline.LightsticksTypeReference
    
    33
    +    fr.ird.observe.dto.referential.longline.LightsticksColorReference
    
    34
    +
    
    35
    +    fr.ird.observe.client.ui.actions.content.DeleteDataUIAction
    
    36
    +    fr.ird.observe.client.ui.actions.content.ResetEditUIAction
    
    37
    +    fr.ird.observe.client.ui.actions.content.SaveEditUIAction
    
    38
    +    fr.ird.observe.client.ui.actions.main.global.DeleteDataGlobalUIAction
    
    39
    +    fr.ird.observe.client.ui.actions.main.global.NewNextDataGlobalUIAction
    
    40
    +    fr.ird.observe.client.ui.actions.main.global.ResetDataGlobalUIAction
    
    41
    +    fr.ird.observe.client.ui.actions.main.global.SaveDataGlobalUIAction
    
    42
    +
    
    43
    +    fr.ird.observe.client.ui.content.ContentUIModel
    
    44
    +    fr.ird.observe.client.ui.util.BooleanEditor
    
    45
    +    fr.ird.observe.client.ui.util.JComment
    
    46
    +
    
    47
    +    org.nuiton.jaxx.widgets.number.NumberEditor
    
    48
    +    org.nuiton.jaxx.widgets.select.BeanComboBox
    
    49
    +    org.nuiton.jaxx.widgets.gis.absolute.CoordinatesEditor
    
    50
    +    org.nuiton.jaxx.widgets.datetime.DateTimeEditor
    
    51
    +
    
    52
    +    org.apache.commons.lang3.BooleanUtils
    
    53
    +
    
    54
    +    java.awt.Dimension
    
    55
    +
    
    56
    +    static fr.ird.observe.client.ui.util.UIHelper.getStringValue
    
    57
    +    static org.nuiton.i18n.I18n.n
    
    58
    +  </import>
    
    59
    +
    
    60
    +  <style source="../../Common.jcss"/>
    
    61
    +
    
    62
    +  <!-- model -->
    
    63
    +  <SetLonglineLogbookUIModel id='model'/>
    
    64
    +
    
    65
    +  <!-- edit bean -->
    
    66
    +  <SetLonglineDto id='bean'/>
    
    67
    +
    
    68
    +  <!-- validator -->
    
    69
    +  <BeanValidator id='validator' autoField='true' context='update'
    
    70
    +                 beanClass='fr.ird.observe.dto.data.longline.SetLonglineDto'
    
    71
    +                 errorTableModel='{getErrorTableModel()}'>
    
    72
    +
    
    73
    +    <field name='settingStartLongitude' component='settingStartCoordinates'/>
    
    74
    +    <field name='settingStartLatitude' component='settingStartCoordinates'/>
    
    75
    +    <field name='settingStartQuadrant' component='settingStartCoordinates'/>
    
    76
    +
    
    77
    +    <field name='settingEndLongitude' component='settingEndCoordinates'/>
    
    78
    +    <field name='settingEndLatitude' component='settingEndCoordinates'/>
    
    79
    +    <field name='settingEndQuadrant' component='settingEndCoordinates'/>
    
    80
    +
    
    81
    +    <field name='haulingStartLongitude' component='haulingStartCoordinates'/>
    
    82
    +    <field name='haulingStartLatitude' component='haulingStartCoordinates'/>
    
    83
    +    <field name='haulingStartQuadrant' component='haulingStartCoordinates'/>
    
    84
    +
    
    85
    +    <field name='haulingEndLongitude' component='haulingEndCoordinates'/>
    
    86
    +    <field name='haulingEndLatitude' component='haulingEndCoordinates'/>
    
    87
    +    <field name='haulingEndQuadrant' component='haulingEndCoordinates'/>
    
    88
    +
    
    89
    +  </BeanValidator>
    
    90
    +
    
    91
    +  <!-- formulaire -->
    
    92
    +  <JPanel id="body" layout='{new BorderLayout()}'>
    
    93
    +
    
    94
    +    <Table insets="0" fill="both" constraints='BorderLayout.CENTER'>
    
    95
    +      <row>
    
    96
    +        <cell anchor="north">
    
    97
    +          <JTabbedPane id='mainTabbedPane'>
    
    98
    +            <tab id='settingTab' computeI18n="">
    
    99
    +              <JPanel layout='{new BorderLayout()}'>
    
    100
    +                <Table fill='both' constraints='BorderLayout.NORTH'>
    
    101
    +
    
    102
    +                  <!-- homeId -->
    
    103
    +                  <row>
    
    104
    +                    <cell anchor='west'>
    
    105
    +                      <JLabel id='homeIdLabel'/>
    
    106
    +                    </cell>
    
    107
    +                    <cell anchor='east' weightx="1" fill="both">
    
    108
    +                      <JPanel layout='{new BorderLayout()}'>
    
    109
    +                        <JToolBar id='homeIdToolbar' constraints='BorderLayout.WEST'>
    
    110
    +                          <JButton id='resetHomeId' constraints='BorderLayout.WEST' styleClass='resetButton'/>
    
    111
    +                        </JToolBar>
    
    112
    +                        <JTextField id='homeId' constraints='BorderLayout.CENTER'/>
    
    113
    +                      </JPanel>
    
    114
    +                    </cell>
    
    115
    +                  </row>
    
    116
    +                  <!-- number -->
    
    117
    +                  <row>
    
    118
    +                    <cell anchor='west'>
    
    119
    +                      <JLabel id='numberLabel'/>
    
    120
    +                    </cell>
    
    121
    +                    <cell columns="2" weightx="1" fill="both">
    
    122
    +                      <NumberEditor id='number' constructorParams='this' styleClass="int6"/>
    
    123
    +                    </cell>
    
    124
    +                  </row>
    
    125
    +                  <!-- setting shape -->
    
    126
    +                  <row>
    
    127
    +                    <cell anchor='west'>
    
    128
    +                      <JLabel id='settingShapeLabel'/>
    
    129
    +                    </cell>
    
    130
    +                    <cell columns="3" fill="both">
    
    131
    +                      <BeanComboBox id='settingShape' constructorParams='this' genericType='SettingShapeReference'/>
    
    132
    +                    </cell>
    
    133
    +                  </row>
    
    134
    +                  <row>
    
    135
    +                    <cell columns="2">
    
    136
    +                      <Table insets="0" fill='both'>
    
    137
    +                        <!-- setting start timeStamp -->
    
    138
    +                        <row>
    
    139
    +                          <cell weightx="1">
    
    140
    +                            <DateTimeEditor id='settingStartTimeStamp' constructorParams='this'/>
    
    141
    +                          </cell>
    
    142
    +                        </row>
    
    143
    +
    
    144
    +                        <!-- setting start position -->
    
    145
    +                        <row>
    
    146
    +                          <cell anchor="east">
    
    147
    +                            <CoordinatesEditor id='settingStartCoordinates' constructorParams='this'/>
    
    148
    +                          </cell>
    
    149
    +                        </row>
    
    150
    +
    
    151
    +                        <!-- setting end timeStamp -->
    
    152
    +                        <row>
    
    153
    +                          <cell>
    
    154
    +                            <DateTimeEditor id='settingEndTimeStamp' constructorParams='this'/>
    
    155
    +                          </cell>
    
    156
    +                        </row>
    
    157
    +
    
    158
    +                        <!-- setting end position -->
    
    159
    +                        <row>
    
    160
    +                          <cell anchor="east">
    
    161
    +                            <CoordinatesEditor id='settingEndCoordinates' constructorParams='this'/>
    
    162
    +                          </cell>
    
    163
    +                        </row>
    
    164
    +                      </Table>
    
    165
    +                    </cell>
    
    166
    +                  </row>
    
    167
    +                </Table>
    
    168
    +              </JPanel>
    
    169
    +
    
    170
    +            </tab>
    
    171
    +
    
    172
    +            <tab id='settingCaracteristicsTab' computeI18n="">
    
    173
    +              <Table fill='both'>
    
    174
    +
    
    175
    +                <!-- setting vessel speed -->
    
    176
    +                <row>
    
    177
    +                  <cell>
    
    178
    +                    <JLabel id='settingVesselSpeedLabel'/>
    
    179
    +                  </cell>
    
    180
    +                  <cell columns="3">
    
    181
    +                    <NumberEditor id='settingVesselSpeed' constructorParams='this' styleClass="float3"/>
    
    182
    +                  </cell>
    
    183
    +                </row>
    
    184
    +                <!-- time between hooks -->
    
    185
    +                <row>
    
    186
    +                  <cell anchor='west'>
    
    187
    +                    <JLabel id='timeBetweenHooksLabel'/>
    
    188
    +                  </cell>
    
    189
    +                  <cell fill='both' weightx="1" columns="3">
    
    190
    +                    <NumberEditor id='timeBetweenHooks' constructorParams='this' styleClass="long10"/>
    
    191
    +                  </cell>
    
    192
    +                </row>
    
    193
    +                <!-- total line length -->
    
    194
    +                <row>
    
    195
    +                  <cell anchor='west'>
    
    196
    +                    <JLabel id='totalLineLengthLabel'/>
    
    197
    +                  </cell>
    
    198
    +                  <cell fill='both' weightx="1" columns="3">
    
    199
    +                    <NumberEditor id='totalLineLength' constructorParams='this' styleClass="long10"/>
    
    200
    +                  </cell>
    
    201
    +                </row>
    
    202
    +                <!-- basket line length -->
    
    203
    +                <row>
    
    204
    +                  <cell anchor='west'>
    
    205
    +                    <JLabel id='basketLineLengthLabel'/>
    
    206
    +                  </cell>
    
    207
    +                  <cell fill='both' weightx="1" columns="3">
    
    208
    +                    <NumberEditor id='basketLineLength' constructorParams='this' styleClass="long10"/>
    
    209
    +                  </cell>
    
    210
    +                </row>
    
    211
    +                <!-- lengthBetweenBranchlines -->
    
    212
    +                <row>
    
    213
    +                  <cell anchor='west'>
    
    214
    +                    <JLabel id='lengthBetweenBranchlinesLabel'/>
    
    215
    +                  </cell>
    
    216
    +                  <cell fill='both' weightx="1" columns="3">
    
    217
    +                    <NumberEditor id='lengthBetweenBranchlines' constructorParams='this' styleClass="long10"/>
    
    218
    +                  </cell>
    
    219
    +                </row>
    
    220
    +
    
    221
    +                <!-- shooter used -->
    
    222
    +                <!-- shooter speed -->
    
    223
    +                <row>
    
    224
    +                  <cell anchor="east">
    
    225
    +                    <JCheckBox id='shooterUsed' styleClass="i18n"/>
    
    226
    +                  </cell>
    
    227
    +                  <cell>
    
    228
    +                    <JLabel id='shooterSpeedLabel'/>
    
    229
    +                  </cell>
    
    230
    +                  <cell columns="2">
    
    231
    +                    <NumberEditor id='shooterSpeed' constructorParams='this' styleClass="float3"/>
    
    232
    +                  </cell>
    
    233
    +                </row>
    
    234
    +                <!-- max depth targeted (m) -->
    
    235
    +                <row>
    
    236
    +                  <cell>
    
    237
    +                    <JLabel id='maxDepthTargetedLabel'/>
    
    238
    +                  </cell>
    
    239
    +                  <cell columns="3">
    
    240
    +                    <NumberEditor id='maxDepthTargeted' constructorParams='this' styleClass="int6"/>
    
    241
    +                  </cell>
    
    242
    +                </row>
    
    243
    +                <!-- total section count -->
    
    244
    +                <row>
    
    245
    +                  <cell anchor='west'>
    
    246
    +                    <JLabel id='totalSectionsCountLabel'/>
    
    247
    +                  </cell>
    
    248
    +                  <cell fill='both' weightx="1" columns="3">
    
    249
    +                    <NumberEditor id='totalSectionsCount' constructorParams='this' styleClass="int6"/>
    
    250
    +                  </cell>
    
    251
    +                </row>
    
    252
    +                <!-- basket per section count -->
    
    253
    +                <!-- total basket count -->
    
    254
    +                <row>
    
    255
    +                  <cell anchor='west'>
    
    256
    +                    <JLabel id='basketsPerSectionCountLabel'/>
    
    257
    +                  </cell>
    
    258
    +                  <cell fill='both' weightx="1">
    
    259
    +                    <NumberEditor id='basketsPerSectionCount' constructorParams='this' styleClass="int6"/>
    
    260
    +                  </cell>
    
    261
    +                  <cell anchor='west'>
    
    262
    +                    <JLabel id='totalBasketsCountLabel'/>
    
    263
    +                  </cell>
    
    264
    +                  <cell fill='both' weightx="1">
    
    265
    +                    <NumberEditor id='totalBasketsCount' constructorParams='this' styleClass="int6"/>
    
    266
    +                  </cell>
    
    267
    +                </row>
    
    268
    +                <!-- branchlines per basket count -->
    
    269
    +                <!-- total hooks count -->
    
    270
    +                <row>
    
    271
    +                  <cell anchor='west'>
    
    272
    +                    <JLabel id='branchlinesPerBasketCountLabel'/>
    
    273
    +                  </cell>
    
    274
    +                  <cell fill='both' weightx="1">
    
    275
    +                    <NumberEditor id='branchlinesPerBasketCount' constructorParams='this' styleClass="int6"/>
    
    276
    +                  </cell>
    
    277
    +                  <cell anchor='west'>
    
    278
    +                    <JLabel id='totalHooksCountLabel'/>
    
    279
    +                  </cell>
    
    280
    +                  <cell fill='both' weightx="1">
    
    281
    +                    <NumberEditor id='totalHooksCount' constructorParams='this' styleClass="int6"/>
    
    282
    +                  </cell>
    
    283
    +                </row>
    
    284
    +                <!-- line type -->
    
    285
    +                <row>
    
    286
    +                  <cell anchor='west'>
    
    287
    +                    <JLabel id='lineTypeLabel'/>
    
    288
    +                  </cell>
    
    289
    +                  <cell columns="3">
    
    290
    +                    <BeanComboBox id='lineType' constructorParams='this' genericType='LineTypeReference'/>
    
    291
    +                  </cell>
    
    292
    +                </row>
    
    293
    +                <!-- weighted swivels -->
    
    294
    +                <!-- swivels weights -->
    
    295
    +                <row>
    
    296
    +                  <cell anchor="east">
    
    297
    +                    <JCheckBox id='weightedSwivel' styleClass="i18n"/>
    
    298
    +                  </cell>
    
    299
    +                  <cell anchor="west">
    
    300
    +                    <JLabel id='swivelWeightLabel'/>
    
    301
    +                  </cell>
    
    302
    +                  <cell columns="2">
    
    303
    +                    <NumberEditor id='swivelWeight' constructorParams='this' styleClass="float3"/>
    
    304
    +                  </cell>
    
    305
    +                </row>
    
    306
    +
    
    307
    +                <!-- weighted snaps -->
    
    308
    +                <!-- snap weights -->
    
    309
    +                <row>
    
    310
    +                  <cell anchor='east'>
    
    311
    +                    <JCheckBox id='weightedSnap' styleClass="i18n"/>
    
    312
    +                  </cell>
    
    313
    +                  <cell>
    
    314
    +                    <JLabel id='snapWeightLabel'/>
    
    315
    +                  </cell>
    
    316
    +                  <cell columns="2">
    
    317
    +                    <NumberEditor id='snapWeight' constructorParams='this' styleClass="float3"/>
    
    318
    +                  </cell>
    
    319
    +                </row>
    
    320
    +                <!-- monitored -->
    
    321
    +                <row>
    
    322
    +                  <cell anchor='east'>
    
    323
    +                    <JCheckBox id='monitored' styleClass="i18n"/>
    
    324
    +                  </cell>
    
    325
    +                </row>
    
    326
    +              </Table>
    
    327
    +            </tab>
    
    328
    +
    
    329
    +            <tab id='lightstickssTab' computeI18n="">
    
    330
    +              <JPanel layout='{new BorderLayout()}'>
    
    331
    +                <Table fill='both' constraints='BorderLayout.NORTH'>
    
    332
    +                  <!-- lightsticksUsed -->
    
    333
    +                  <row>
    
    334
    +                    <cell anchor='east'>
    
    335
    +                      <JCheckBox id='lightsticksUsed' styleClass="i18n"/>
    
    336
    +                    </cell>
    
    337
    +                  </row>
    
    338
    +                  <!-- lightsticks per basket count -->
    
    339
    +                  <row>
    
    340
    +                    <cell anchor='west'>
    
    341
    +                      <JLabel id='lightsticksPerBasketCountLabel'/>
    
    342
    +                    </cell>
    
    343
    +                    <cell fill='both' weightx="1" columns="3">
    
    344
    +                      <NumberEditor id='lightsticksPerBasketCount' constructorParams='this' styleClass="int6"/>
    
    345
    +                    </cell>
    
    346
    +                  </row>
    
    347
    +                  <!-- lightsticks type -->
    
    348
    +                  <row>
    
    349
    +                    <cell anchor='west'>
    
    350
    +                      <JLabel id='lightsticksTypeLabel'/>
    
    351
    +                    </cell>
    
    352
    +                    <cell columns="3">
    
    353
    +                      <BeanComboBox id='lightsticksType' constructorParams='this' genericType='LightsticksTypeReference'/>
    
    354
    +                    </cell>
    
    355
    +                  </row>
    
    356
    +                  <!-- lightsticks color -->
    
    357
    +                  <row>
    
    358
    +                    <cell anchor='west'>
    
    359
    +                      <JLabel id='lightsticksColorLabel'/>
    
    360
    +                    </cell>
    
    361
    +                    <cell columns="3">
    
    362
    +                      <BeanComboBox id='lightsticksColor' constructorParams='this' genericType='LightsticksColorReference'/>
    
    363
    +                    </cell>
    
    364
    +                  </row>
    
    365
    +                </Table>
    
    366
    +              </JPanel>
    
    367
    +            </tab>
    
    368
    +
    
    369
    +            <tab id='haulingTab' computeI18n="">
    
    370
    +
    
    371
    +              <JPanel layout='{new BorderLayout()}'>
    
    372
    +                <Table fill='both' constraints='BorderLayout.NORTH'>
    
    373
    +
    
    374
    +                  <!-- hauling same direction as setting -->
    
    375
    +                  <row>
    
    376
    +                    <cell>
    
    377
    +                      <JLabel id='haulingDirectionSameAsSettingLabel'/>
    
    378
    +                    </cell>
    
    379
    +                    <cell>
    
    380
    +                      <BooleanEditor id='haulingDirectionSameAsSetting'/>
    
    381
    +                    </cell>
    
    382
    +                  </row>
    
    383
    +
    
    384
    +                  <!-- hauling start timeStamp -->
    
    385
    +                  <row>
    
    386
    +                    <cell columns="2" weightx="1">
    
    387
    +                      <DateTimeEditor id='haulingStartTimeStamp' constructorParams='this'/>
    
    388
    +                    </cell>
    
    389
    +                  </row>
    
    390
    +
    
    391
    +                  <!-- hauling start position -->
    
    392
    +                  <row>
    
    393
    +                    <cell columns="2" anchor='east'>
    
    394
    +                      <CoordinatesEditor id='haulingStartCoordinates' constructorParams='this'/>
    
    395
    +                    </cell>
    
    396
    +                  </row>
    
    397
    +
    
    398
    +                  <!-- hauling end timeStamp -->
    
    399
    +                  <row>
    
    400
    +                    <cell columns="2" weightx="1">
    
    401
    +                      <DateTimeEditor id='haulingEndTimeStamp' constructorParams='this'/>
    
    402
    +                    </cell>
    
    403
    +                  </row>
    
    404
    +
    
    405
    +                  <!-- hauling end position -->
    
    406
    +                  <row>
    
    407
    +                    <cell columns="2" anchor='east'>
    
    408
    +                      <CoordinatesEditor id='haulingEndCoordinates' constructorParams='this'/>
    
    409
    +                    </cell>
    
    410
    +                  </row>
    
    411
    +
    
    412
    +                  <row>
    
    413
    +                    <!-- hauling breaks -->
    
    414
    +                    <cell anchor="west">
    
    415
    +                      <JLabel id='haulingBreaksLabel'/>
    
    416
    +                    </cell>
    
    417
    +                    <cell weightx="1" fill="both">
    
    418
    +                      <NumberEditor id='haulingBreaks' constructorParams='this' styleClass="int6"/>
    
    419
    +                    </cell>
    
    420
    +                  </row>
    
    421
    +                </Table>
    
    422
    +              </JPanel>
    
    423
    +            </tab>
    
    424
    +          </JTabbedPane>
    
    425
    +        </cell>
    
    426
    +      </row>
    
    427
    +
    
    428
    +      <row>
    
    429
    +        <cell fill="both" weighty="1" weightx="1">
    
    430
    +          <JComment id="comment"/>
    
    431
    +        </cell>
    
    432
    +      </row>
    
    433
    +
    
    434
    +    </Table>
    
    435
    +  </JPanel>
    
    436
    +
    
    437
    +  <!-- actions -->
    
    438
    +  <Table id="actions" fill='both' weightx='1' insets='0'>
    
    439
    +    <row>
    
    440
    +      <cell weightx="0.5" fill="both">
    
    441
    +        <JButton id='reset'/>
    
    442
    +      </cell>
    
    443
    +      <cell weightx="0.5">
    
    444
    +        <JButton id='save'/>
    
    445
    +      </cell>
    
    446
    +      <cell weightx="0.5">
    
    447
    +        <JButton id='delete'/>
    
    448
    +      </cell>
    
    449
    +    </row>
    
    450
    +  </Table>
    
    451
    +
    
    452
    +</fr.ird.observe.client.ui.content.ContentUI>

  • client/src/main/java/fr/ird/observe/client/ui/content/data/longline/SetLonglineLogbookUI.jcss
    1
    +/*
    
    2
    + * #%L
    
    3
    + * ObServe :: Client
    
    4
    + * %%
    
    5
    + * Copyright (C) 2008 - 2017 IRD, Code Lutin, Ultreia.io
    
    6
    + * %%
    
    7
    + * This program is free software: you can redistribute it and/or modify
    
    8
    + * it under the terms of the GNU General Public License as
    
    9
    + * published by the Free Software Foundation, either version 3 of the
    
    10
    + * License, or (at your option) any later version.
    
    11
    + * 
    
    12
    + * This program is distributed in the hope that it will be useful,
    
    13
    + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    14
    + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    
    15
    + * GNU General Public License for more details.
    
    16
    + * 
    
    17
    + * You should have received a copy of the GNU General Public
    
    18
    + * License along with this program.  If not, see
    
    19
    + * <http://www.gnu.org/licenses/gpl-3.0.html>.
    
    20
    + * #L%
    
    21
    + */
    
    22
    +
    
    23
    +#model {
    
    24
    +  editable:true;
    
    25
    +  modified:{validator.isChanged()};
    
    26
    +  valid:{validator.isValid()};
    
    27
    +  enabled:{!model.isReadingMode()};
    
    28
    +}
    
    29
    +
    
    30
    +/* ***************************************************************************** */
    
    31
    +/*  SETTING TAB **************************************************************** */
    
    32
    +/* ***************************************************************************** */
    
    33
    +
    
    34
    +#settingTab {
    
    35
    +  icon:{handler.getErrorIconIfFalse(model.isSettingTabValid())};
    
    36
    +}
    
    37
    +
    
    38
    +#homeId {
    
    39
    +  text: {getStringValue(bean.getHomeId())};
    
    40
    +  _propertyName: {SetLonglineDto.PROPERTY_HOME_ID};
    
    41
    +}
    
    42
    +
    
    43
    +#resetHomeId {
    
    44
    +  _resetPropertyName: {SetLonglineDto.PROPERTY_HOME_ID};
    
    45
    +  toolTipText:"observe.common.SetLonglineDto.action.reset.homeId.tip";
    
    46
    +}
    
    47
    +
    
    48
    +#number {
    
    49
    +  property: {SetLonglineDto.PROPERTY_NUMBER};
    
    50
    +  numberValue:{bean.getNumber()};
    
    51
    +}
    
    52
    +
    
    53
    +#settingStartTimeStamp {
    
    54
    +  date:{bean.getSettingStartTimeStamp()};
    
    55
    +  propertyDate: {SetLonglineDto.PROPERTY_SETTING_START_TIME_STAMP};
    
    56
    +}
    
    57
    +
    
    58
    +#settingStartCoordinates {
    
    59
    +  propertyLatitude:{SetLonglineDto.PROPERTY_SETTING_START_LATITUDE};
    
    60
    +  propertyLongitude:{SetLonglineDto.PROPERTY_SETTING_START_LONGITUDE};
    
    61
    +  propertyQuadrant:{SetLonglineDto.PROPERTY_SETTING_START_QUADRANT};
    
    62
    +  latitude:{bean.getSettingStartLatitude()};
    
    63
    +  longitude:{bean.getSettingStartLongitude()};
    
    64
    +  quadrant:{bean.getSettingStartQuadrant()};
    
    65
    +}
    
    66
    +
    
    67
    +#settingEndTimeStamp {
    
    68
    +  date:{bean.getSettingEndTimeStamp()};
    
    69
    +  propertyDate: {SetLonglineDto.PROPERTY_SETTING_END_TIME_STAMP};
    
    70
    +}
    
    71
    +
    
    72
    +#settingEndCoordinates {
    
    73
    +  propertyLatitude:{SetLonglineDto.PROPERTY_SETTING_END_LATITUDE};
    
    74
    +  propertyLongitude:{SetLonglineDto.PROPERTY_SETTING_END_LONGITUDE};
    
    75
    +  propertyQuadrant:{SetLonglineDto.PROPERTY_SETTING_END_QUADRANT};
    
    76
    +  latitude:{bean.getSettingEndLatitude()};
    
    77
    +  longitude:{bean.getSettingEndLongitude()};
    
    78
    +  quadrant:{bean.getSettingEndQuadrant()};
    
    79
    +}
    
    80
    +
    
    81
    +/* ***************************************************************************** */
    
    82
    +/*  SETTING CARACTERISTICS TAB ************************************************* */
    
    83
    +/* ***************************************************************************** */
    
    84
    +
    
    85
    +#settingCaracteristicsTab {
    
    86
    +  icon:{handler.getErrorIconIfFalse(model.isSettingCaracteristicsTabValid())};
    
    87
    +}
    
    88
    +
    
    89
    +#settingVesselSpeed {
    
    90
    +  property:{SetLonglineDto.PROPERTY_SETTING_VESSEL_SPEED};
    
    91
    +  numberValue:{bean.getSettingVesselSpeed()};
    
    92
    +}
    
    93
    +
    
    94
    +#shooterUsed {
    
    95
    +  horizontalTextPosition:{JCheckBox.LEFT};
    
    96
    +  _propertyName:{SetLonglineDto.PROPERTY_SHOOTER_USED};
    
    97
    +  selected:{BooleanUtils.isTrue(bean.getShooterUsed())};
    
    98
    +}
    
    99
    +
    
    100
    +#shooterSpeed {
    
    101
    +  enabled:{BooleanUtils.isTrue(bean.getShooterUsed())};
    
    102
    +  property:{SetLonglineDto.PROPERTY_SHOOTER_SPEED};
    
    103
    +  numberValue:{bean.getShooterSpeed()};
    
    104
    +}
    
    105
    +
    
    106
    +#settingShape {
    
    107
    +  property:{SetLonglineDto.PROPERTY_SETTING_SHAPE};
    
    108
    +  selectedItem:{bean.getSettingShape()};
    
    109
    +}
    
    110
    +
    
    111
    +#weightedSwivel {
    
    112
    +  horizontalTextPosition:{JCheckBox.LEFT};
    
    113
    +  _propertyName:{SetLonglineDto.PROPERTY_WEIGHTED_SWIVEL};
    
    114
    +  selected:{BooleanUtils.isTrue(bean.getWeightedSwivel())};
    
    115
    +}
    
    116
    +
    
    117
    +#swivelWeight {
    
    118
    +  enabled:{BooleanUtils.isTrue(bean.getWeightedSwivel())};
    
    119
    +  property:{SetLonglineDto.PROPERTY_SWIVEL_WEIGHT};
    
    120
    +  numberValue:{bean.getSwivelWeight()};
    
    121
    +}
    
    122
    +
    
    123
    +#weightedSnap {
    
    124
    +  horizontalTextPosition:{JCheckBox.LEFT};
    
    125
    +  _propertyName:{SetLonglineDto.PROPERTY_WEIGHTED_SNAP};
    
    126
    +  selected:{BooleanUtils.isTrue(bean.getWeightedSnap())};
    
    127
    +}
    
    128
    +
    
    129
    +#snapWeight {
    
    130
    +  enabled:{BooleanUtils.isTrue(bean.getWeightedSnap())};
    
    131
    +  property:{SetLonglineDto.PROPERTY_SNAP_WEIGHT};
    
    132
    +  numberValue:{bean.getSnapWeight()};
    
    133
    +}
    
    134
    +
    
    135
    +#lineType {
    
    136
    +  property:{SetLonglineDto.PROPERTY_LINE_TYPE};
    
    137
    +  selectedItem:{bean.getLineType()};
    
    138
    +}
    
    139
    +
    
    140
    +#maxDepthTargeted {
    
    141
    +  property:{SetLonglineDto.PROPERTY_MAX_DEPTH_TARGETED};
    
    142
    +  numberValue:{bean.getMaxDepthTargeted()};
    
    143
    +}
    
    144
    +
    
    145
    +#monitored {
    
    146
    +  horizontalTextPosition:{JCheckBox.LEFT};
    
    147
    +  _propertyName:{SetLonglineDto.PROPERTY_MONITORED};
    
    148
    +  selected:{BooleanUtils.isTrue(bean.getMonitored())};
    
    149
    +}
    
    150
    +
    
    151
    +#lightsticksType {
    
    152
    +  property:{SetLonglineDto.PROPERTY_LIGHTSTICKS_TYPE};
    
    153
    +  selectedItem:{bean.getLightsticksType()};
    
    154
    +  enabled:{bean.getLightsticksPerBasketCount() !=null && bean.getLightsticksPerBasketCount() > 0};
    
    155
    +}
    
    156
    +
    
    157
    +#lightsticksColor {
    
    158
    +  property:{SetLonglineDto.PROPERTY_LIGHTSTICKS_COLOR};
    
    159
    +  selectedItem:{bean.getLightsticksColor()};
    
    160
    +  enabled:{bean.getLightsticksPerBasketCount() !=null && bean.getLightsticksPerBasketCount() > 0};
    
    161
    +}
    
    162
    +
    
    163
    +#timeBetweenHooks {
    
    164
    +  property:{SetLonglineDto.PROPERTY_TIME_BETWEEN_HOOKS};
    
    165
    +  numberValue:{bean.getTimeBetweenHooks()};
    
    166
    +}
    
    167
    +
    
    168
    +#lightsticksPerBasketCount {
    
    169
    +  property:{SetLonglineDto.PROPERTY_LIGHTSTICKS_PER_BASKET_COUNT};
    
    170
    +  numberValue:{bean.getLightsticksPerBasketCount()};
    
    171
    +}
    
    172
    +
    
    173
    +#basketsPerSectionCount {
    
    174
    +  property:{SetLonglineDto.PROPERTY_BASKETS_PER_SECTION_COUNT};
    
    175
    +  numberValue:{bean.getBasketsPerSectionCount()};
    
    176
    +}
    
    177
    +
    
    178
    +#totalBasketsCount {
    
    179
    +  property:{SetLonglineDto.PROPERTY_TOTAL_BASKETS_COUNT};
    
    180
    +  numberValue:{bean.getTotalBasketsCount()};
    
    181
    +}
    
    182
    +
    
    183
    +#branchlinesPerBasketCount {
    
    184
    +  property:{SetLonglineDto.PROPERTY_BRANCHLINES_PER_BASKET_COUNT};
    
    185
    +  numberValue:{bean.getBranchlinesPerBasketCount()};
    
    186
    +}
    
    187
    +
    
    188
    +#totalSectionsCount {
    
    189
    +  property:{SetLonglineDto.PROPERTY_TOTAL_SECTIONS_COUNT};
    
    190
    +  numberValue:{bean.getTotalSectionsCount()};
    
    191
    +}
    
    192
    +
    
    193
    +#totalHooksCount {
    
    194
    +  property:{SetLonglineDto.PROPERTY_TOTAL_HOOKS_COUNT};
    
    195
    +  numberValue:{bean.getTotalHooksCount()};
    
    196
    +}
    
    197
    +
    
    198
    +/* ***************************************************************************** */
    
    199
    +/*  HAULING TAB **************************************************************** */
    
    200
    +/* ***************************************************************************** */
    
    201
    +
    
    202
    +#haulingTab {
    
    203
    +  icon:{handler.getErrorIconIfFalse(model.isHaulingTabValid())};
    
    204
    +}
    
    205
    +
    
    206
    +#haulingDirectionSameAsSetting {
    
    207
    +  booleanValue:{bean.getHaulingDirectionSameAsSetting()};
    
    208
    +  _propertyName: {SetLonglineDto.PROPERTY_HAULING_DIRECTION_SAME_AS_SETTING};
    
    209
    +}
    
    210
    +
    
    211
    +#haulingStartTimeStamp {
    
    212
    +  date:{bean.getHaulingStartTimeStamp()};
    
    213
    +  propertyDate: {SetLonglineDto.PROPERTY_HAULING_START_TIME_STAMP};
    
    214
    +}
    
    215
    +
    
    216
    +#haulingStartCoordinates {
    
    217
    +  propertyLatitude:{SetLonglineDto.PROPERTY_HAULING_START_LATITUDE};
    
    218
    +  propertyLongitude:{SetLonglineDto.PROPERTY_HAULING_START_LONGITUDE};
    
    219
    +  propertyQuadrant:{SetLonglineDto.PROPERTY_HAULING_START_QUADRANT};
    
    220
    +  latitude:{bean.getHaulingStartLatitude()};
    
    221
    +  longitude:{bean.getHaulingStartLongitude()};
    
    222
    +  quadrant:{bean.getHaulingStartQuadrant()};
    
    223
    +}
    
    224
    +
    
    225
    +#haulingEndTimeStamp {
    
    226
    +  date:{bean.getHaulingEndTimeStamp()};
    
    227
    +  propertyDate: {SetLonglineDto.PROPERTY_HAULING_END_TIME_STAMP};
    
    228
    +}
    
    229
    +
    
    230
    +#haulingEndCoordinates {
    
    231
    +  propertyLatitude:{SetLonglineDto.PROPERTY_HAULING_END_LATITUDE};
    
    232
    +  propertyLongitude:{SetLonglineDto.PROPERTY_HAULING_END_LONGITUDE};
    
    233
    +  propertyQuadrant:{SetLonglineDto.PROPERTY_HAULING_END_QUADRANT};
    
    234
    +  latitude:{bean.getHaulingEndLatitude()};
    
    235
    +  longitude:{bean.getHaulingEndLongitude()};
    
    236
    +  quadrant:{bean.getHaulingEndQuadrant()};
    
    237
    +}
    
    238
    +
    
    239
    +#haulingBreaks {
    
    240
    +  property:{SetLonglineDto.PROPERTY_HAULING_BREAKS};
    
    241
    +  numberValue:{bean.getHaulingBreaks()};
    
    242
    +}
    
    243
    +
    
    244
    +#delete {
    
    245
    +  _globalAction:{DeleteDataGlobalUIAction.ACTION_NAME};
    
    246
    +}
    
    247
    +
    
    248
    +#save {
    
    249
    +  _globalAction:{SaveDataGlobalUIAction.ACTION_NAME};
    
    250
    +}
    
    251
    +
    
    252
    +#reset {
    
    253
    +  _globalAction:{ResetDataGlobalUIAction.ACTION_NAME};
    
    254
    +}

  • client/src/main/java/fr/ird/observe/client/ui/content/data/longline/SetLonglineLogbookUIHandler.java
    1
    +package fr.ird.observe.client.ui.content.data.longline;
    
    2
    +
    
    3
    +/*
    
    4
    + * #%L
    
    5
    + * ObServe :: Client
    
    6
    + * %%
    
    7
    + * Copyright (C) 2008 - 2017 IRD, Code Lutin, Ultreia.io
    
    8
    + * %%
    
    9
    + * This program is free software: you can redistribute it and/or modify
    
    10
    + * it under the terms of the GNU General Public License as
    
    11
    + * published by the Free Software Foundation, either version 3 of the
    
    12
    + * License, or (at your option) any later version.
    
    13
    + * 
    
    14
    + * This program is distributed in the hope that it will be useful,
    
    15
    + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    16
    + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    
    17
    + * GNU General Public License for more details.
    
    18
    + * 
    
    19
    + * You should have received a copy of the GNU General Public
    
    20
    + * License along with this program.  If not, see
    
    21
    + * <http://www.gnu.org/licenses/gpl-3.0.html>.
    
    22
    + * #L%
    
    23
    + */
    
    24
    +
    
    25
    +import fr.ird.observe.client.ObserveSwingApplicationContext;
    
    26
    +import fr.ird.observe.client.db.ClientDataContext;
    
    27
    +import fr.ird.observe.client.db.ObserveSwingDataSource;
    
    28
    +import fr.ird.observe.client.db.constants.DataContextType;
    
    29
    +import fr.ird.observe.client.ui.content.ContentMode;
    
    30
    +import fr.ird.observe.client.ui.content.ContentUIHandler;
    
    31
    +import fr.ird.observe.client.ui.content.ContentUIModel;
    
    32
    +import fr.ird.observe.client.ui.tree.navigation.NavigationTree;
    
    33
    +import fr.ird.observe.client.ui.tree.navigation.nodes.NavigationTreeNodeSupport;
    
    34
    +import fr.ird.observe.client.validation.ClientValidationContext;
    
    35
    +import fr.ird.observe.dto.data.longline.ActivityLonglineDto;
    
    36
    +import fr.ird.observe.dto.data.longline.SetLonglineDto;
    
    37
    +import fr.ird.observe.dto.data.longline.SetLonglineHelper;
    
    38
    +import fr.ird.observe.dto.data.longline.SetLonglineReference;
    
    39
    +import fr.ird.observe.dto.form.Form;
    
    40
    +import fr.ird.observe.dto.result.SaveResultDto;
    
    41
    +import fr.ird.observe.spi.DtoModelHelper;
    
    42
    +import org.apache.commons.logging.Log;
    
    43
    +import org.apache.commons.logging.LogFactory;
    
    44
    +import org.nuiton.jaxx.runtime.spi.UIHandler;
    
    45
    +import org.nuiton.jaxx.validator.swing.SwingValidatorMessage;
    
    46
    +import org.nuiton.jaxx.validator.swing.SwingValidatorMessageTableModel;
    
    47
    +import org.nuiton.jaxx.validator.swing.SwingValidatorUtil;
    
    48
    +import org.nuiton.jaxx.widgets.gis.CoordinateFormat;
    
    49
    +import org.nuiton.jaxx.widgets.gis.absolute.CoordinatesEditorModel;
    
    50
    +import org.nuiton.jaxx.widgets.hidor.HidorButton;
    
    51
    +import org.nuiton.validator.NuitonValidatorScope;
    
    52
    +
    
    53
    +import javax.swing.event.TableModelListener;
    
    54
    +import java.beans.PropertyChangeListener;
    
    55
    +import java.util.HashSet;
    
    56
    +import java.util.Set;
    
    57
    +
    
    58
    +import static org.nuiton.i18n.I18n.t;
    
    59
    +
    
    60
    +/**
    
    61
    + * Created on 9/1/14.
    
    62
    + *
    
    63
    + * @author Tony Chemit - dev@tchemit.fr
    
    64
    + * @since 3.7
    
    65
    + */
    
    66
    +public class SetLonglineLogbookUIHandler extends ContentUIHandler<SetLonglineDto, SetLonglineLogbookUI> implements UIHandler<SetLonglineLogbookUI> {
    
    67
    +
    
    68
    +    /** Logger */
    
    69
    +    private static final Log log = LogFactory.getLog(SetLonglineLogbookUIHandler.class);
    
    70
    +
    
    71
    +    // Compute valid state of tab from the error table
    
    72
    +    protected final TableModelListener computeTabValidStateListener;
    
    73
    +
    
    74
    +    // Change toogle target visible on all TimeEditors
    
    75
    +    private final PropertyChangeListener onToogleTimeEditorSliderChangedListener;
    
    76
    +
    
    77
    +    // Change toogle target visible on all TimeEditors
    
    78
    +    private final PropertyChangeListener onCoordinateFormatChangedListener;
    
    79
    +
    
    80
    +    private boolean toogleTimeEditorSliderIsChanging;
    
    81
    +
    
    82
    +    private boolean coordinateFormatChangedIsChanging;
    
    83
    +
    
    84
    +    SetLonglineLogbookUIHandler() {
    
    85
    +        super(DataContextType.ActivityLongline, DataContextType.SetLongline);
    
    86
    +        computeTabValidStateListener = e -> {
    
    87
    +
    
    88
    +            SwingValidatorMessageTableModel source = (SwingValidatorMessageTableModel) e.getSource();
    
    89
    +            computeTabValidState(source);
    
    90
    +
    
    91
    +        };
    
    92
    +        onToogleTimeEditorSliderChangedListener = evt -> {
    
    93
    +            Boolean newValue = (Boolean) evt.getNewValue();
    
    94
    +            onToogleTimeEditorSliderChanged(newValue);
    
    95
    +        };
    
    96
    +        onCoordinateFormatChangedListener = evt -> {
    
    97
    +            CoordinateFormat newValue = (CoordinateFormat) evt.getNewValue();
    
    98
    +            onCoordinateFormatChanged(newValue);
    
    99
    +        };
    
    100
    +    }
    
    101
    +
    
    102
    +    @Override
    
    103
    +    protected boolean computeCanWrite(ObserveSwingDataSource source) {
    
    104
    +        return source.canWriteData();
    
    105
    +    }
    
    106
    +
    
    107
    +    @Override
    
    108
    +    protected ContentMode getContentMode(ClientDataContext dataContext) {
    
    109
    +
    
    110
    +        String setId = getSelectedId();
    
    111
    +
    
    112
    +        if (setId == null) {
    
    113
    +
    
    114
    +            // mode creation
    
    115
    +            return ContentMode.CREATE;
    
    116
    +
    
    117
    +        }
    
    118
    +
    
    119
    +        if (getOpenDataManager().isOpenActivityLongline(dataContext.getSelectedActivityLonglineId())) {
    
    120
    +
    
    121
    +            // l'activité est ouverte, mode édition
    
    122
    +            return ContentMode.UPDATE;
    
    123
    +
    
    124
    +        }
    
    125
    +
    
    126
    +        // l'activité n'est pas ouverte, mode lecture
    
    127
    +        addMessage(getUi(),
    
    128
    +                   NuitonValidatorScope.INFO,
    
    129
    +                   getTypeI18nKey(ActivityLonglineDto.class),
    
    130
    +                   t("observe.common.ActivityLonglineDto.message.not.open"));
    
    131
    +
    
    132
    +        return ContentMode.READ;
    
    133
    +
    
    134
    +    }
    
    135
    +
    
    136
    +    @Override
    
    137
    +    public void afterInit(SetLonglineLogbookUI ui) {
    
    138
    +        super.afterInit(ui);
    
    139
    +
    
    140
    +        ui.getSettingStartTimeStamp().getSliderHidor().addPropertyChangeListener(HidorButton.PROPERTY_TARGET_VISIBLE, onToogleTimeEditorSliderChangedListener);
    
    141
    +        ui.getSettingEndTimeStamp().getSliderHidor().addPropertyChangeListener(HidorButton.PROPERTY_TARGET_VISIBLE, onToogleTimeEditorSliderChangedListener);
    
    142
    +        ui.getHaulingStartTimeStamp().getSliderHidor().addPropertyChangeListener(HidorButton.PROPERTY_TARGET_VISIBLE, onToogleTimeEditorSliderChangedListener);
    
    143
    +        ui.getHaulingEndTimeStamp().getSliderHidor().addPropertyChangeListener(HidorButton.PROPERTY_TARGET_VISIBLE, onToogleTimeEditorSliderChangedListener);
    
    144
    +
    
    145
    +        ui.getSettingStartCoordinates().getModel().addPropertyChangeListener(CoordinatesEditorModel.PROPERTY_FORMAT, onCoordinateFormatChangedListener);
    
    146
    +        ui.getSettingEndCoordinates().getModel().addPropertyChangeListener(CoordinatesEditorModel.PROPERTY_FORMAT, onCoordinateFormatChangedListener);
    
    147
    +        ui.getHaulingStartCoordinates().getModel().addPropertyChangeListener(CoordinatesEditorModel.PROPERTY_FORMAT, onCoordinateFormatChangedListener);
    
    148
    +        ui.getHaulingEndCoordinates().getModel().addPropertyChangeListener(CoordinatesEditorModel.PROPERTY_FORMAT, onCoordinateFormatChangedListener);
    
    149
    +
    
    150
    +    }
    
    151
    +
    
    152
    +    @Override
    
    153
    +    public void openUI() {
    
    154
    +
    
    155
    +        getUi().getSettingStartCoordinates().resetModel();
    
    156
    +        getUi().getSettingEndCoordinates().resetModel();
    
    157
    +        getUi().getHaulingStartCoordinates().resetModel();
    
    158
    +        getUi().getHaulingEndCoordinates().resetModel();
    
    159
    +
    
    160
    +        if (log.isInfoEnabled()) {
    
    161
    +            log.info("OpenUI: " + getModel());
    
    162
    +        }
    
    163
    +        super.openUI();
    
    164
    +
    
    165
    +        String activityId = getSelectedParentId();
    
    166
    +        String setId = getSelectedId();
    
    167
    +
    
    168
    +        if (log.isInfoEnabled()) {
    
    169
    +            log.info("activityId = " + activityId);
    
    170
    +            log.info("setId      = " + setId);
    
    171
    +        }
    
    172
    +        ContentMode mode = computeContentMode();
    
    173
    +
    
    174
    +        SetLonglineDto bean = getBean();
    
    175
    +
    
    176
    +        Form<SetLonglineDto> form;
    
    177
    +        if (setId == null) {
    
    178
    +
    
    179
    +            // create mode
    
    180
    +            form = getSetLonglineService().preCreate(activityId);
    
    181
    +
    
    182
    +        } else {
    
    183
    +
    
    184
    +            // update mode
    
    185
    +            form = getSetLonglineService().loadForm(setId);
    
    186
    +
    
    187
    +        }
    
    188
    +
    
    189
    +        loadReferentialReferenceSetsInModel(form);
    
    190
    +
    
    191
    +        getModel().setForm(form);
    
    192
    +        SetLonglineHelper.copySetLonglineDto(form.getObject(), bean);
    
    193
    +
    
    194
    +        // 1. Mise à jour latitude/longitude:
    
    195
    +        getUi().getSettingStartCoordinates().setLatitudeAndLongitude(bean.getSettingStartLatitude(), bean.getSettingStartLongitude());
    
    196
    +        // 2. Mise à jour du quadrant :
    
    197
    +        // Si le bean de données contient un quadrant, on met simplement à jour le composant de coordonnées pour sélectionner le quadrant voulu
    
    198
    +        // sinon, on réinitialise les quadrants du composant afin qu'aucun d'eux ne soit sélectionné (par exemple dans le cas de la création de la première activité d'une route)
    
    199
    +        if (bean.getSettingStartQuadrant() == null) {
    
    200
    +            getUi().getSettingStartCoordinates().resetQuadrant();
    
    201
    +        } else {
    
    202
    +            getUi().getSettingStartCoordinates().setQuadrant(bean.getSettingStartQuadrant());
    
    203
    +        }
    
    204
    +
    
    205
    +        // 1. Mise à jour latitude/longitude:
    
    206
    +        getUi().getSettingEndCoordinates().setLatitudeAndLongitude(bean.getSettingEndLatitude(), bean.getSettingEndLongitude());
    
    207
    +        // 2. Mise à jour du quadrant :
    
    208
    +        // Si le bean de données contient un quadrant, on met simplement à jour le composant de coordonnées pour sélectionner le quadrant voulu
    
    209
    +        // sinon, on réinitialise les quadrants du composant afin qu'aucun d'eux ne soit sélectionné (par exemple dans le cas de la création de la première activité d'une route)
    
    210
    +        if (bean.getSettingEndQuadrant() == null) {
    
    211
    +            getUi().getSettingEndCoordinates().resetQuadrant();
    
    212
    +        } else {
    
    213
    +            getUi().getSettingEndCoordinates().setQuadrant(bean.getSettingEndQuadrant());
    
    214
    +        }
    
    215
    +
    
    216
    +        // 1. Mise à jour latitude/longitude:
    
    217
    +        getUi().getHaulingStartCoordinates().setLatitudeAndLongitude(bean.getHaulingStartLatitude(), bean.getHaulingStartLongitude());
    
    218
    +        // 2. Mise à jour du quadrant :
    
    219
    +        // Si le bean de données contient un quadrant, on met simplement à jour le composant de coordonnées pour sélectionner le quadrant voulu
    
    220
    +        // sinon, on réinitialise les quadrants du composant afin qu'aucun d'eux ne soit sélectionné (par exemple dans le cas de la création de la première activité d'une route)
    
    221
    +        if (bean.getHaulingStartQuadrant() == null) {
    
    222
    +            getUi().getHaulingStartCoordinates().resetQuadrant();
    
    223
    +        } else {
    
    224
    +            getUi().getHaulingStartCoordinates().setQuadrant(bean.getHaulingStartQuadrant());
    
    225
    +        }
    
    226
    +
    
    227
    +        // 1. Mise à jour latitude/longitude:
    
    228
    +        getUi().getHaulingEndCoordinates().setLatitudeAndLongitude(bean.getHaulingEndLatitude(), bean.getHaulingEndLongitude());
    
    229
    +        // 2. Mise à jour du quadrant :
    
    230
    +        // Si le bean de données contient un quadrant, on met simplement à jour le composant de coordonnées pour sélectionner le quadrant voulu
    
    231
    +        // sinon, on réinitialise les quadrants du composant afin qu'aucun d'eux ne soit sélectionné (par exemple dans le cas de la création de la première activité d'une route)
    
    232
    +        if (bean.getHaulingEndQuadrant() == null) {
    
    233
    +            getUi().getHaulingEndCoordinates().resetQuadrant();
    
    234
    +        } else {
    
    235
    +            getUi().getHaulingEndCoordinates().setQuadrant(bean.getHaulingEndQuadrant());
    
    236
    +        }
    
    237
    +
    
    238
    +        // utilisation du mode requis
    
    239
    +        setContentMode(mode);
    
    240
    +
    
    241
    +        // To be sure always remove listener (could prevent some leaks)
    
    242
    +        getUi().getErrorTableModel().removeTableModelListener(computeTabValidStateListener);
    
    243
    +        // listen messages to see if required to add
    
    244
    +        getUi().getErrorTableModel().addTableModelListener(computeTabValidStateListener);
    
    245
    +
    
    246
    +        SwingValidatorMessageTableModel errorTableModel = getUi().getErrorTableModel();
    
    247
    +        computeTabValidState(errorTableModel);
    
    248
    +
    
    249
    +        if (mode != ContentMode.READ) {
    
    250
    +            getUi().startEdit(null);
    
    251
    +        }
    
    252
    +
    
    253
    +    }
    
    254
    +
    
    255
    +    @Override
    
    256
    +    protected void closeSafeUI() {
    
    257
    +
    
    258
    +        if (log.isInfoEnabled()) {
    
    259
    +            log.info("CloseUI: " + getModel());
    
    260
    +        }
    
    261
    +        super.closeSafeUI();
    
    262
    +
    
    263
    +        // remove listener
    
    264
    +        getUi().getErrorTableModel().removeTableModelListener(computeTabValidStateListener);
    
    265
    +
    
    266
    +    }
    
    267
    +
    
    268
    +    @Override
    
    269
    +    public void startEditUI(String... binding) {
    
    270
    +
    
    271
    +        ContentUIModel<SetLonglineDto> model = getModel();
    
    272
    +        boolean create = model.getMode() == ContentMode.CREATE;
    
    273
    +        String contextName = getValidatorContextName(model.getMode());
    
    274
    +        getUi().getValidator().setContext(contextName);
    
    275
    +        if (create) {
    
    276
    +            addInfoMessage(t("observe.common.SetLonglineDto.message.creating"));
    
    277
    +        } else {
    
    278
    +            addInfoMessage(t("observe.common.SetLonglineDto.message.updating"));
    
    279
    +        }
    
    280
    +
    
    281
    +        super.startEditUI(SetLonglineLogbookUI.BINDING_COMMENT_MODEL,
    
    282
    +
    
    283
    +                          // setting tab
    
    284
    +                          SetLonglineLogbookUI.BINDING_HOME_ID_TEXT,
    
    285
    +                          SetLonglineLogbookUI.BINDING_NUMBER_NUMBER_VALUE,
    
    286
    +
    
    287
    +                          SetLonglineLogbookUI.BINDING_SETTING_START_TIME_STAMP_DATE,
    
    288
    +                          SetLonglineLogbookUI.BINDING_SETTING_START_COORDINATES_LATITUDE,
    
    289
    +                          SetLonglineLogbookUI.BINDING_SETTING_START_COORDINATES_LONGITUDE,
    
    290
    +
    
    291
    +                          SetLonglineLogbookUI.BINDING_SETTING_END_TIME_STAMP_DATE,
    
    292
    +                          SetLonglineLogbookUI.BINDING_SETTING_END_COORDINATES_LATITUDE,
    
    293
    +                          SetLonglineLogbookUI.BINDING_SETTING_END_COORDINATES_LONGITUDE,
    
    294
    +
    
    295
    +                          // setting caracteristics tab
    
    296
    +                          SetLonglineLogbookUI.BINDING_SETTING_VESSEL_SPEED_NUMBER_VALUE,
    
    297
    +                          SetLonglineLogbookUI.BINDING_SHOOTER_USED_SELECTED,
    
    298
    +                          SetLonglineLogbookUI.BINDING_SHOOTER_SPEED_NUMBER_VALUE,
    
    299
    +                          SetLonglineLogbookUI.BINDING_TIME_BETWEEN_HOOKS_NUMBER_VALUE,
    
    300
    +                          SetLonglineLogbookUI.BINDING_SETTING_SHAPE_SELECTED_ITEM,
    
    301
    +                          SetLonglineLogbookUI.BINDING_WEIGHTED_SWIVEL_SELECTED,
    
    302
    +                          SetLonglineLogbookUI.BINDING_SWIVEL_WEIGHT_NUMBER_VALUE,
    
    303
    +                          SetLonglineLogbookUI.BINDING_WEIGHTED_SNAP_SELECTED,
    
    304
    +                          SetLonglineLogbookUI.BINDING_SNAP_WEIGHT_NUMBER_VALUE,
    
    305
    +                          SetLonglineLogbookUI.BINDING_LINE_TYPE_SELECTED_ITEM,
    
    306
    +                          SetLonglineLogbookUI.BINDING_MAX_DEPTH_TARGETED_NUMBER_VALUE,
    
    307
    +                          SetLonglineLogbookUI.BINDING_MONITORED_SELECTED,
    
    308
    +                          SetLonglineLogbookUI.BINDING_LIGHTSTICKS_TYPE_SELECTED_ITEM,
    
    309
    +                          SetLonglineLogbookUI.BINDING_LIGHTSTICKS_COLOR_SELECTED_ITEM,
    
    310
    +                          SetLonglineLogbookUI.BINDING_LIGHTSTICKS_PER_BASKET_COUNT_NUMBER_VALUE,
    
    311
    +                          SetLonglineLogbookUI.BINDING_BASKETS_PER_SECTION_COUNT_NUMBER_VALUE,
    
    312
    +                          SetLonglineLogbookUI.BINDING_TOTAL_BASKETS_COUNT_NUMBER_VALUE,
    
    313
    +                          SetLonglineLogbookUI.BINDING_BRANCHLINES_PER_BASKET_COUNT_NUMBER_VALUE,
    
    314
    +                          SetLonglineLogbookUI.BINDING_TOTAL_SECTIONS_COUNT_NUMBER_VALUE,
    
    315
    +                          SetLonglineLogbookUI.BINDING_TOTAL_HOOKS_COUNT_NUMBER_VALUE,
    
    316
    +
    
    317
    +                          // hauling tab
    
    318
    +                          SetLonglineLogbookUI.BINDING_HAULING_DIRECTION_SAME_AS_SETTING_BOOLEAN_VALUE,
    
    319
    +
    
    320
    +                          SetLonglineLogbookUI.BINDING_HAULING_START_TIME_STAMP_DATE,
    
    321
    +                          SetLonglineLogbookUI.BINDING_HAULING_START_COORDINATES_LATITUDE,
    
    322
    +                          SetLonglineLogbookUI.BINDING_HAULING_START_COORDINATES_LONGITUDE,
    
    323
    +
    
    324
    +                          SetLonglineLogbookUI.BINDING_HAULING_END_TIME_STAMP_DATE,
    
    325
    +                          SetLonglineLogbookUI.BINDING_HAULING_END_COORDINATES_LATITUDE,
    
    326
    +                          SetLonglineLogbookUI.BINDING_HAULING_END_COORDINATES_LONGITUDE,
    
    327
    +
    
    328
    +                          SetLonglineLogbookUI.BINDING_HAULING_BREAKS_NUMBER_VALUE);
    
    329
    +
    
    330
    +        model.setModified(create);
    
    331
    +
    
    332
    +    }
    
    333
    +
    
    334
    +    @Override
    
    335
    +    protected boolean doSave(SetLonglineDto bean) {
    
    336
    +
    
    337
    +        String activityId = getSelectedParentId();
    
    338
    +
    
    339
    +        boolean notPersisted = bean.isNotPersisted();
    
    340
    +
    
    341
    +        SaveResultDto saveResult = getSetLonglineService().save(activityId, bean);
    
    342
    +        saveResult.toDto(bean);
    
    343
    +
    
    344
    +        if (notPersisted) {
    
    345
    +            getOpenDataManager().openSetLongline(activityId, bean.getId());
    
    346
    +        }
    
    347
    +
    
    348
    +        return true;
    
    349
    +
    
    350
    +    }
    
    351
    +
    
    352
    +    @Override
    
    353
    +    protected void afterSave(boolean refresh) {
    
    354
    +
    
    355
    +        super.afterSave(refresh);
    
    356
    +
    
    357
    +        SetLonglineDto bean = getBean();
    
    358
    +
    
    359
    +        SwingValidatorUtil.setValidatorChanged(getUi(), false);
    
    360
    +
    
    361
    +        NavigationTree treeHelper = getNavigationTree();
    
    362
    +
    
    363
    +        NavigationTreeNodeSupport node = treeHelper.getSelectedNode();
    
    364
    +        boolean create = node.getId() == null;
    
    365
    +
    
    366
    +        if (create) {
    
    367
    +
    
    368
    +            getModel().setMode(ContentMode.UPDATE);
    
    369
    +
    
    370
    +            // remove old node and recreate new node
    
    371
    +            NavigationTreeNodeSupport parentNode = node.getParent();
    
    372
    +            treeHelper.removeNode(node);
    
    373
    +
    
    374
    +            SetLonglineReference reference = DtoModelHelper.fromDataDto(SetLonglineDto.class).toReference(getDecoratorService().getReferentialLocale(), bean);
    
    375
    +            node = treeHelper.addSetLongline(parentNode, reference);
    
    376
    +
    
    377
    +            stopEditUI();
    
    378
    +            treeHelper.selectNode(node);
    
    379
    +
    
    380
    +        } else {
    
    381
    +
    
    382
    +            // select ancestor node
    
    383
    +            treeHelper.reloadSelectedNode(false, false);
    
    384
    +
    
    385
    +        }
    
    386
    +
    
    387
    +    }
    
    388
    +
    
    389
    +    @Override
    
    390
    +    protected boolean doDelete(SetLonglineDto bean) {
    
    391
    +
    
    392
    +        if (askToDelete(bean)) {
    
    393
    +            return false;
    
    394
    +        }
    
    395
    +
    
    396
    +        String activityId = getSelectedParentId();
    
    397
    +        getSetLonglineService().delete(activityId, bean.getId());
    
    398
    +
    
    399
    +        return true;
    
    400
    +
    
    401
    +    }
    
    402
    +
    
    403
    +    @Override
    
    404
    +    protected void prepareValidationContext() {
    
    405
    +        super.prepareValidationContext();
    
    406
    +
    
    407
    +        ClientValidationContext validationContext = ObserveSwingApplicationContext.get().getValidationContext();
    
    408
    +        validationContext.setCoordinatesEditor("haulingStart", getUi().getHaulingStartCoordinates());
    
    409
    +        validationContext.setCoordinatesEditor("haulingEnd", getUi().getHaulingEndCoordinates());
    
    410
    +        validationContext.setCoordinatesEditor("settingStart", getUi().getSettingStartCoordinates());
    
    411
    +        validationContext.setCoordinatesEditor("settingEnd", getUi().getSettingEndCoordinates());
    
    412
    +
    
    413
    +    }
    
    414
    +
    
    415
    +
    
    416
    +    protected void computeTabValidState(SwingValidatorMessageTableModel errorTableModel) {
    
    417
    +
    
    418
    +        Set<String> errorProperties = new HashSet<>();
    
    419
    +        int rowCount = errorTableModel.getRowCount();
    
    420
    +        for (int i = 0; i < rowCount; i++) {
    
    421
    +
    
    422
    +            SwingValidatorMessage row = errorTableModel.getRow(i);
    
    423
    +            if (NuitonValidatorScope.ERROR.equals(row.getScope())) {
    
    424
    +                errorProperties.add(row.getField());
    
    425
    +            }
    
    426
    +        }
    
    427
    +
    
    428
    +        boolean settingTabValid = !errorProperties.removeAll(SetLonglineLogbookUIModel.SETTING_TAB_PROPERTIES);
    
    429
    +        boolean settingCaracteristicsTabValid = !errorProperties.removeAll(SetLonglineLogbookUIModel.SETTING_CARACTERISTICS_TAB_PROPERTIES);
    
    430
    +        boolean haulingTabValid = !errorProperties.removeAll(SetLonglineLogbookUIModel.HAULING_TAB_PROPERTIES);
    
    431
    +
    
    432
    +        SetLonglineLogbookUIModel model = (SetLonglineLogbookUIModel) getModel();
    
    433
    +        model.setSettingTabValid(settingTabValid);
    
    434
    +        model.setSettingCaracteristicsTabValid(settingCaracteristicsTabValid);
    
    435
    +        model.setHaulingTabValid(haulingTabValid);
    
    436
    +
    
    437
    +    }
    
    438
    +
    
    439
    +    private void onToogleTimeEditorSliderChanged(boolean newValue) {
    
    440
    +
    
    441
    +        if (!toogleTimeEditorSliderIsChanging) {
    
    442
    +
    
    443
    +            toogleTimeEditorSliderIsChanging = true;
    
    444
    +
    
    445
    +            boolean selected = !newValue;
    
    446
    +
    
    447
    +            try {
    
    448
    +
    
    449
    +                getUi().getSettingStartTimeStamp().getSliderHidor().setSelected(selected);
    
    450
    +                getUi().getSettingStartTimeStamp().getSliderHidor().setTargetVisible(newValue);
    
    451
    +
    
    452
    +                getUi().getSettingEndTimeStamp().getSliderHidor().setSelected(selected);
    
    453
    +                getUi().getSettingEndTimeStamp().getSliderHidor().setTargetVisible(newValue);
    
    454
    +
    
    455
    +                getUi().getHaulingStartTimeStamp().getSliderHidor().setSelected(selected);
    
    456
    +                getUi().getHaulingStartTimeStamp().getSliderHidor().setTargetVisible(newValue);
    
    457
    +
    
    458
    +                getUi().getHaulingEndTimeStamp().getSliderHidor().setSelected(selected);
    
    459
    +                getUi().getHaulingEndTimeStamp().getSliderHidor().setTargetVisible(newValue);
    
    460
    +
    
    461
    +            } finally {
    
    462
    +
    
    463
    +                toogleTimeEditorSliderIsChanging = false;
    
    464
    +
    
    465
    +            }
    
    466
    +
    
    467
    +        }
    
    468
    +
    
    469
    +    }
    
    470
    +
    
    471
    +    private synchronized void onCoordinateFormatChanged(CoordinateFormat newValue) {
    
    472
    +
    
    473
    +        if (!coordinateFormatChangedIsChanging) {
    
    474
    +
    
    475
    +            coordinateFormatChangedIsChanging = true;
    
    476
    +
    
    477
    +            try {
    
    478
    +
    
    479
    +                getUi().getSettingStartCoordinates().setFormat(newValue);
    
    480
    +                getUi().getSettingEndCoordinates().setFormat(newValue);
    
    481
    +
    
    482
    +                getUi().getHaulingStartCoordinates().setFormat(newValue);
    
    483
    +                getUi().getHaulingEndCoordinates().setFormat(newValue);
    
    484
    +
    
    485
    +            } finally {
    
    486
    +
    
    487
    +                coordinateFormatChangedIsChanging = false;
    
    488
    +
    
    489
    +            }
    
    490
    +
    
    491
    +        }
    
    492
    +
    
    493
    +    }
    
    494
    +
    
    495
    +}

  • client/src/main/java/fr/ird/observe/client/ui/content/data/longline/SetLonglineLogbookUIModel.java
    1
    +package fr.ird.observe.client.ui.content.data.longline;
    
    2
    +
    
    3
    +/*
    
    4
    + * #%L
    
    5
    + * ObServe :: Client
    
    6
    + * %%
    
    7
    + * Copyright (C) 2008 - 2017 IRD, Code Lutin, Ultreia.io
    
    8
    + * %%
    
    9
    + * This program is free software: you can redistribute it and/or modify
    
    10
    + * it under the terms of the GNU General Public License as
    
    11
    + * published by the Free Software Foundation, either version 3 of the
    
    12
    + * License, or (at your option) any later version.
    
    13
    + * 
    
    14
    + * This program is distributed in the hope that it will be useful,
    
    15
    + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    16
    + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    
    17
    + * GNU General Public License for more details.
    
    18
    + * 
    
    19
    + * You should have received a copy of the GNU General Public
    
    20
    + * License along with this program.  If not, see
    
    21
    + * <http://www.gnu.org/licenses/gpl-3.0.html>.
    
    22
    + * #L%
    
    23
    + */
    
    24
    +
    
    25
    +import com.google.common.collect.ImmutableSet;
    
    26
    +import fr.ird.observe.client.ui.content.ContentUIModel;
    
    27
    +import fr.ird.observe.dto.data.longline.SetLonglineDto;
    
    28
    +
    
    29
    +import java.util.Set;
    
    30
    +
    
    31
    +/**
    
    32
    + * Created on 9/28/14.
    
    33
    + *
    
    34
    + * @author Tony Chemit - dev@tchemit.fr
    
    35
    + * @since XXX
    
    36
    + */
    
    37
    +public class SetLonglineLogbookUIModel extends ContentUIModel<SetLonglineDto> {
    
    38
    +
    
    39
    +    public static final String PROPERTY_SETTING_TAB_VALID = "settingTabValid";
    
    40
    +
    
    41
    +    public static final String PROPERTY_SETTING_CARACTERISTICS_TAB_VALID = "settingCaracteristicsTabValid";
    
    42
    +
    
    43
    +    public static final String PROPERTY_HAULING_TAB_VALID = "haulingTabValid";
    
    44
    +
    
    45
    +    public static final Set<String> SETTING_TAB_PROPERTIES =
    
    46
    +            ImmutableSet.<String>builder().add(
    
    47
    +                    SetLonglineDto.PROPERTY_HOME_ID,
    
    48
    +                    SetLonglineDto.PROPERTY_NUMBER,
    
    49
    +                    SetLonglineDto.PROPERTY_SETTING_START_TIME_STAMP,
    
    50
    +                    SetLonglineDto.PROPERTY_SETTING_START_LATITUDE,
    
    51
    +                    SetLonglineDto.PROPERTY_SETTING_START_LONGITUDE,
    
    52
    +                    SetLonglineDto.PROPERTY_SETTING_END_TIME_STAMP,
    
    53
    +                    SetLonglineDto.PROPERTY_SETTING_END_LATITUDE,
    
    54
    +                    SetLonglineDto.PROPERTY_SETTING_END_LONGITUDE
    
    55
    +            ).build();
    
    56
    +
    
    57
    +    public static final Set<String> SETTING_CARACTERISTICS_TAB_PROPERTIES =
    
    58
    +            ImmutableSet.<String>builder().add(
    
    59
    +                    SetLonglineDto.PROPERTY_SETTING_SHAPE,
    
    60
    +                    SetLonglineDto.PROPERTY_LINE_TYPE,
    
    61
    +                    SetLonglineDto.PROPERTY_LIGHTSTICKS_TYPE,
    
    62
    +                    SetLonglineDto.PROPERTY_LIGHTSTICKS_COLOR,
    
    63
    +                    SetLonglineDto.PROPERTY_SETTING_VESSEL_SPEED,
    
    64
    +                    SetLonglineDto.PROPERTY_MAX_DEPTH_TARGETED,
    
    65
    +                    SetLonglineDto.PROPERTY_SHOOTER_USED,
    
    66
    +                    SetLonglineDto.PROPERTY_SHOOTER_SPEED,
    
    67
    +                    SetLonglineDto.PROPERTY_WEIGHTED_SWIVEL,
    
    68
    +                    SetLonglineDto.PROPERTY_SWIVEL_WEIGHT,
    
    69
    +                    SetLonglineDto.PROPERTY_WEIGHTED_SNAP,
    
    70
    +                    SetLonglineDto.PROPERTY_SNAP_WEIGHT,
    
    71
    +                    SetLonglineDto.PROPERTY_MONITORED,
    
    72
    +                    SetLonglineDto.PROPERTY_TIME_BETWEEN_HOOKS,
    
    73
    +                    SetLonglineDto.PROPERTY_BASKETS_PER_SECTION_COUNT,
    
    74
    +                    SetLonglineDto.PROPERTY_BRANCHLINES_PER_BASKET_COUNT,
    
    75
    +                    SetLonglineDto.PROPERTY_LIGHTSTICKS_PER_BASKET_COUNT,
    
    76
    +                    SetLonglineDto.PROPERTY_TOTAL_SECTIONS_COUNT,
    
    77
    +                    SetLonglineDto.PROPERTY_TOTAL_BASKETS_COUNT,
    
    78
    +                    SetLonglineDto.PROPERTY_TOTAL_HOOKS_COUNT
    
    79
    +            ).build();
    
    80
    +
    
    81
    +    public static final Set<String> HAULING_TAB_PROPERTIES =
    
    82
    +            ImmutableSet.<String>builder().add(
    
    83
    +                    SetLonglineDto.PROPERTY_HAULING_DIRECTION_SAME_AS_SETTING,
    
    84
    +                    SetLonglineDto.PROPERTY_HAULING_START_LATITUDE,
    
    85
    +                    SetLonglineDto.PROPERTY_HAULING_START_LONGITUDE,
    
    86
    +                    SetLonglineDto.PROPERTY_HAULING_START_TIME_STAMP,
    
    87
    +                    SetLonglineDto.PROPERTY_HAULING_END_LATITUDE,
    
    88
    +                    SetLonglineDto.PROPERTY_HAULING_END_LONGITUDE,
    
    89
    +                    SetLonglineDto.PROPERTY_HAULING_END_TIME_STAMP,
    
    90
    +                    SetLonglineDto.PROPERTY_HAULING_BREAKS
    
    91
    +            ).build();
    
    92
    +
    
    93
    +    private static final long serialVersionUID = 1L;
    
    94
    +
    
    95
    +    protected boolean settingTabValid;
    
    96
    +
    
    97
    +    protected boolean settingCaracteristicsTabValid;
    
    98
    +
    
    99
    +    protected boolean haulingTabValid;
    
    100
    +
    
    101
    +    public SetLonglineLogbookUIModel() {
    
    102
    +        super(SetLonglineDto.class);
    
    103
    +    }
    
    104
    +
    
    105
    +    public boolean isHaulingTabValid() {
    
    106
    +        return haulingTabValid;
    
    107
    +    }
    
    108
    +
    
    109
    +    public void setHaulingTabValid(boolean haulingTabValid) {
    
    110
    +        this.haulingTabValid = haulingTabValid;
    
    111
    +        firePropertyChange(PROPERTY_HAULING_TAB_VALID, null, haulingTabValid);
    
    112
    +    }
    
    113
    +
    
    114
    +    public boolean isSettingCaracteristicsTabValid() {
    
    115
    +        return settingCaracteristicsTabValid;
    
    116
    +    }
    
    117
    +
    
    118
    +    public void setSettingCaracteristicsTabValid(boolean settingCaracteristicsTabValid) {
    
    119
    +        this.settingCaracteristicsTabValid = settingCaracteristicsTabValid;
    
    120
    +        firePropertyChange(PROPERTY_SETTING_CARACTERISTICS_TAB_VALID, null, settingCaracteristicsTabValid);
    
    121
    +    }
    
    122
    +
    
    123
    +    public boolean isSettingTabValid() {
    
    124
    +        return settingTabValid;
    
    125
    +    }
    
    126
    +
    
    127
    +    public void setSettingTabValid(boolean settingTabValid) {
    
    128
    +        this.settingTabValid = settingTabValid;
    
    129
    +        firePropertyChange(PROPERTY_SETTING_TAB_VALID, null, settingTabValid);
    
    130
    +    }
    
    131
    +
    
    132
    +}

  • client/src/main/resources/i18n/client_en_GB.properties
    ... ... @@ -364,8 +364,11 @@ observe.common.ActivityLonglineDto.message.no.active.found.for.other.trip=No ope
    364 364
     observe.common.ActivityLonglineDto.message.nonForTrip=< No activity for current trip >
    
    365 365
     observe.common.ActivityLonglineDto.message.not.open=Activity is not opened, no edit possible.
    
    366 366
     observe.common.ActivityLonglineDto.message.updating=Updating an activity
    
    367
    +observe.common.ActivityLonglineDto.relatedObservedActivity=Observed activity
    
    367 368
     observe.common.ActivityLonglineDto.timeStamp=timestamp
    
    368 369
     observe.common.ActivityLonglineDto.titles=Activities
    
    370
    +observe.common.ActivityLonglineDto.vesselSpeed=Speed
    
    371
    +observe.common.ActivityLonglineDto.wind=Wind
    
    369 372
     observe.common.ActivitySeineDto.action.addFloatingObject=Add FAD
    
    370 373
     observe.common.ActivitySeineDto.action.addFloatingObject.tip=Add a FAD to the activity
    
    371 374
     observe.common.ActivitySeineDto.action.addSet=Add a Set
    
    ... ... @@ -454,11 +457,14 @@ observe.common.CatchLonglineDto.availablePredator=Avaiable predators
    454 457
     observe.common.CatchLonglineDto.beatDiameter=Beat diameter
    
    455 458
     observe.common.CatchLonglineDto.branchlineTab=Branchline
    
    456 459
     observe.common.CatchLonglineDto.caracteristicTab=Caracteristics
    
    460
    +observe.common.CatchLonglineDto.countDepredated=\#TODO
    
    457 461
     observe.common.CatchLonglineDto.depredated=Depredated
    
    462
    +observe.common.CatchLonglineDto.depredatedProportion=\#TODO
    
    458 463
     observe.common.CatchLonglineDto.depredatedTab=Depredation
    
    459 464
     observe.common.CatchLonglineDto.foodAndSexualTab=Food and sexual maturity
    
    460 465
     observe.common.CatchLonglineDto.hookWhenDiscarded=Discarded with hook
    
    461 466
     observe.common.CatchLonglineDto.locationOnLongline=Location on longline
    
    467
    +observe.common.CatchLonglineDto.onBordDataProcessing=On bord data processing
    
    462 468
     observe.common.CatchLonglineDto.photoReferences=Photo references
    
    463 469
     observe.common.CatchLonglineDto.resetBranchline=Cancel
    
    464 470
     observe.common.CatchLonglineDto.resetBranchline.tip=Cancel any modification
    
    ... ... @@ -490,6 +496,7 @@ observe.common.CatchLonglineDto.table.speciesCatch=Species
    490 496
     observe.common.CatchLonglineDto.table.speciesCatch.tip=Species
    
    491 497
     observe.common.CatchLonglineDto.tagNumber=Tag number
    
    492 498
     observe.common.CatchLonglineDto.totalWeight=Total weight (kg)
    
    499
    +observe.common.CatchLonglineDto.weightDeterminationMethod=Weight Determination method
    
    493 500
     observe.common.CatchLonglineDto.weightMeasuresTab=Weights
    
    494 501
     observe.common.DataDto.action.createEntry.tip=Create a new entry
    
    495 502
     observe.common.DataDto.action.deleteEntry.tip=Delete entry in edition
    
    ... ... @@ -912,14 +919,20 @@ observe.common.SensorUsedDto.table.sensorType.tip=Sensor type
    912 919
     observe.common.SetDto.action.goToOpen.short=Open set
    
    913 920
     observe.common.SetDto.action.goToOpen.tip=Open set
    
    914 921
     observe.common.SetLonglineDto.action.reset.homeId.tip=Reset home id
    
    922
    +observe.common.SetLonglineDto.basketLineLength=\#TODO
    
    915 923
     observe.common.SetLonglineDto.haulingTab=Hauling
    
    924
    +observe.common.SetLonglineDto.lengthBetweenBranchlines=\#TODO
    
    925
    +observe.common.SetLonglineDto.lightsticksUsed=\#TODO
    
    926
    +observe.common.SetLonglineDto.lightstickssTab=\#TODO
    
    916 927
     observe.common.SetLonglineDto.message.creating=Creating fishing operation
    
    917 928
     observe.common.SetLonglineDto.message.updating=Updating fishing operation
    
    918 929
     observe.common.SetLonglineDto.monitored=Monitored
    
    919 930
     observe.common.SetLonglineDto.settingCaracteristicsTab=Caracteristics
    
    920 931
     observe.common.SetLonglineDto.settingTab=Setting
    
    932
    +observe.common.SetLonglineDto.shooterUsed=Shooter used
    
    921 933
     observe.common.SetLonglineDto.targetCatchCompositionEstimatedByObserver=Composition estimated by observer?
    
    922 934
     observe.common.SetLonglineDto.targetDiscardCatchCompositionEstimatedByObserver=Composition estimated by observer?
    
    935
    +observe.common.SetLonglineDto.totalLineLength=\#TODO
    
    923 936
     observe.common.SetLonglineDto.weightedSnap=Weighted snap
    
    924 937
     observe.common.SetLonglineDto.weightedSwivel=Weighted swivel
    
    925 938
     observe.common.SetLonglineGlobalCompositionDto.availableMitigationType=Available mitigations
    

  • client/src/main/resources/i18n/client_es_ES.properties
    ... ... @@ -364,8 +364,11 @@ observe.common.ActivityLonglineDto.message.no.active.found.for.other.trip=Ningun
    364 364
     observe.common.ActivityLonglineDto.message.nonForTrip=< Ninguna actividad por la marea actual >
    
    365 365
     observe.common.ActivityLonglineDto.message.not.open=La actividad no está abierta, imposible modificar.
    
    366 366
     observe.common.ActivityLonglineDto.message.updating=Se está modificando la actividad actual.
    
    367
    +observe.common.ActivityLonglineDto.relatedObservedActivity=\#TODO
    
    367 368
     observe.common.ActivityLonglineDto.timeStamp=Timestamp
    
    368 369
     observe.common.ActivityLonglineDto.titles=Actividades
    
    370
    +observe.common.ActivityLonglineDto.vesselSpeed=\#TODO
    
    371
    +observe.common.ActivityLonglineDto.wind=\#TODO
    
    369 372
     observe.common.ActivitySeineDto.action.addFloatingObject=Añadir un DCP
    
    370 373
     observe.common.ActivitySeineDto.action.addFloatingObject.tip=Añadir un objeto flotante a la actividad
    
    371 374
     observe.common.ActivitySeineDto.action.addSet=Añadir un lance
    
    ... ... @@ -454,11 +457,14 @@ observe.common.CatchLonglineDto.availablePredator=Deprepadaores disponibles
    454 457
     observe.common.CatchLonglineDto.beatDiameter=Diametro de la mordedura
    
    455 458
     observe.common.CatchLonglineDto.branchlineTab=Arponcillo
    
    456 459
     observe.common.CatchLonglineDto.caracteristicTab=Características
    
    460
    +observe.common.CatchLonglineDto.countDepredated=\#TODO
    
    457 461
     observe.common.CatchLonglineDto.depredated=Victima de depredación
    
    462
    +observe.common.CatchLonglineDto.depredatedProportion=\#TODO
    
    458 463
     observe.common.CatchLonglineDto.depredatedTab=Depredación
    
    459 464
     observe.common.CatchLonglineDto.foodAndSexualTab=Alimentación y maturidad sexual
    
    460 465
     observe.common.CatchLonglineDto.hookWhenDiscarded=Echazado con el anzuelo
    
    461 466
     observe.common.CatchLonglineDto.locationOnLongline=Posición sobre la línea
    
    467
    +observe.common.CatchLonglineDto.onBordDataProcessing=On bord data processing \#TODO
    
    462 468
     observe.common.CatchLonglineDto.photoReferences=Referencias foto
    
    463 469
     observe.common.CatchLonglineDto.resetBranchline=Cancelar
    
    464 470
     observe.common.CatchLonglineDto.resetBranchline.tip=Cancelar las modificaciones sobre el arponcillo
    
    ... ... @@ -490,6 +496,7 @@ observe.common.CatchLonglineDto.table.speciesCatch=Especie
    490 496
     observe.common.CatchLonglineDto.table.speciesCatch.tip=Especie
    
    491 497
     observe.common.CatchLonglineDto.tagNumber=Numéro d'échantillon \#TODO
    
    492 498
     observe.common.CatchLonglineDto.totalWeight=Peso total (kg)
    
    499
    +observe.common.CatchLonglineDto.weightDeterminationMethod=\#TODO
    
    493 500
     observe.common.CatchLonglineDto.weightMeasuresTab=Pesos (kg)
    
    494 501
     observe.common.DataDto.action.createEntry.tip=Crear una nueva entrada
    
    495 502
     observe.common.DataDto.action.deleteEntry.tip=Cancelar la edición de la entrada actual
    
    ... ... @@ -912,14 +919,20 @@ observe.common.SensorUsedDto.table.sensorType.tip=Tipo de sensor
    912 919
     observe.common.SetDto.action.goToOpen.short=Lance abierto
    
    913 920
     observe.common.SetDto.action.goToOpen.tip=Acceder al lance abierto
    
    914 921
     observe.common.SetLonglineDto.action.reset.homeId.tip=Reiniciar el id de negocio
    
    922
    +observe.common.SetLonglineDto.basketLineLength=\#TODO
    
    915 923
     observe.common.SetLonglineDto.haulingTab=Arrastre
    
    924
    +observe.common.SetLonglineDto.lengthBetweenBranchlines=\#TODO
    
    925
    +observe.common.SetLonglineDto.lightsticksUsed=\#TODO
    
    926
    +observe.common.SetLonglineDto.lightstickssTab=\#TODO
    
    916 927
     observe.common.SetLonglineDto.message.creating=Lance en proceso de creación.
    
    917 928
     observe.common.SetLonglineDto.message.updating=La operación de pesca está en proceso de modificación.
    
    918 929
     observe.common.SetLonglineDto.monitored=Instrumentada
    
    919 930
     observe.common.SetLonglineDto.settingCaracteristicsTab=Características
    
    920 931
     observe.common.SetLonglineDto.settingTab=Calada
    
    932
    +observe.common.SetLonglineDto.shooterUsed=Shooter used \#TODO
    
    921 933
     observe.common.SetLonglineDto.targetCatchCompositionEstimatedByObserver=Composition estimée par l'observateur ? \#TODO
    
    922 934
     observe.common.SetLonglineDto.targetDiscardCatchCompositionEstimatedByObserver=Composition estimée par l'observateur ? \#TODO
    
    935
    +observe.common.SetLonglineDto.totalLineLength=Total line length (m) \#TODO
    
    923 936
     observe.common.SetLonglineDto.weightedSnap=Snap lesté
    
    924 937
     observe.common.SetLonglineDto.weightedSwivel=Émerillon lesté
    
    925 938
     observe.common.SetLonglineGlobalCompositionDto.availableMitigationType=Atenuaciónes disponibles
    

  • client/src/main/resources/i18n/client_fr_FR.properties
    ... ... @@ -364,8 +364,11 @@ observe.common.ActivityLonglineDto.message.no.active.found.for.other.trip=Aucune
    364 364
     observe.common.ActivityLonglineDto.message.nonForTrip=< Aucune activité pour la marée courante >
    
    365 365
     observe.common.ActivityLonglineDto.message.not.open=L'opération de pêche n'est pas ouverte, aucune modification possible.
    
    366 366
     observe.common.ActivityLonglineDto.message.updating=L'activité est en cours de modification.
    
    367
    +observe.common.ActivityLonglineDto.relatedObservedActivity=Activité observée
    
    367 368
     observe.common.ActivityLonglineDto.timeStamp=Horodatage
    
    368 369
     observe.common.ActivityLonglineDto.titles=Activités
    
    370
    +observe.common.ActivityLonglineDto.vesselSpeed=Vitesse du courant (nd)
    
    371
    +observe.common.ActivityLonglineDto.wind=Vent Beaufort
    
    369 372
     observe.common.ActivitySeineDto.action.addFloatingObject=Ajouter un DCP
    
    370 373
     observe.common.ActivitySeineDto.action.addFloatingObject.tip=Ajouter un objet flottant à l'activité
    
    371 374
     observe.common.ActivitySeineDto.action.addSet=Ajouter la calée
    
    ... ... @@ -454,11 +457,14 @@ observe.common.CatchLonglineDto.availablePredator=Prédateurs disponibles
    454 457
     observe.common.CatchLonglineDto.beatDiameter=Diamètre de la morsure
    
    455 458
     observe.common.CatchLonglineDto.branchlineTab=Avançon
    
    456 459
     observe.common.CatchLonglineDto.caracteristicTab=Caractéristiques
    
    460
    +observe.common.CatchLonglineDto.countDepredated=Nombre déprédaté
    
    457 461
     observe.common.CatchLonglineDto.depredated=Victime de déprédation
    
    462
    +observe.common.CatchLonglineDto.depredatedProportion=Proportion déprédaté
    
    458 463
     observe.common.CatchLonglineDto.depredatedTab=Déprédation
    
    459 464
     observe.common.CatchLonglineDto.foodAndSexualTab=Alimentation et maturité sexuelle
    
    460 465
     observe.common.CatchLonglineDto.hookWhenDiscarded=Rejeté avec hameçon
    
    461 466
     observe.common.CatchLonglineDto.locationOnLongline=Position sur la ligne
    
    467
    +observe.common.CatchLonglineDto.onBordDataProcessing=Traitement effectué à bord
    
    462 468
     observe.common.CatchLonglineDto.photoReferences=Références photo
    
    463 469
     observe.common.CatchLonglineDto.resetBranchline=Annuler
    
    464 470
     observe.common.CatchLonglineDto.resetBranchline.tip=Annuler les modifications sur l'avançon
    
    ... ... @@ -490,6 +496,7 @@ observe.common.CatchLonglineDto.table.speciesCatch=Espèce
    490 496
     observe.common.CatchLonglineDto.table.speciesCatch.tip=Espèce
    
    491 497
     observe.common.CatchLonglineDto.tagNumber=Id marque
    
    492 498
     observe.common.CatchLonglineDto.totalWeight=Poids total (kg)
    
    499
    +observe.common.CatchLonglineDto.weightDeterminationMethod=Méthode d'estimation
    
    493 500
     observe.common.CatchLonglineDto.weightMeasuresTab=Poids (kg)
    
    494 501
     observe.common.DataDto.action.createEntry.tip=Créer une nouvelle entrée
    
    495 502
     observe.common.DataDto.action.deleteEntry.tip=Supprimer l'entrée en cours d'édition
    
    ... ... @@ -912,14 +919,20 @@ observe.common.SensorUsedDto.table.sensorType.tip=Type de capteur
    912 919
     observe.common.SetDto.action.goToOpen.short=Calée ouverte
    
    913 920
     observe.common.SetDto.action.goToOpen.tip=Accéder à la calée ouverte
    
    914 921
     observe.common.SetLonglineDto.action.reset.homeId.tip=Réinitialiser l'id métier
    
    922
    +observe.common.SetLonglineDto.basketLineLength=Longueur de la ligne par panier (m)
    
    915 923
     observe.common.SetLonglineDto.haulingTab=Virage
    
    924
    +observe.common.SetLonglineDto.lengthBetweenBranchlines=Distance entre avançons (m)
    
    925
    +observe.common.SetLonglineDto.lightsticksUsed=Utilisation des cyalumes ?
    
    926
    +observe.common.SetLonglineDto.lightstickssTab=Cyalumes
    
    916 927
     observe.common.SetLonglineDto.message.creating=L'opération de pêche est en cours de création.
    
    917 928
     observe.common.SetLonglineDto.message.updating=L'opération de pêche est en cours de modification.
    
    918 929
     observe.common.SetLonglineDto.monitored=Instrumentée
    
    919 930
     observe.common.SetLonglineDto.settingCaracteristicsTab=Caractéristiques
    
    920 931
     observe.common.SetLonglineDto.settingTab=Filage
    
    932
    +observe.common.SetLonglineDto.shooterUsed=Utilisation du shooter
    
    921 933
     observe.common.SetLonglineDto.targetCatchCompositionEstimatedByObserver=Composition estimée par l'observateur ?
    
    922 934
     observe.common.SetLonglineDto.targetDiscardCatchCompositionEstimatedByObserver=Composition estimée par l'observateur ?
    
    935
    +observe.common.SetLonglineDto.totalLineLength=Longueur totale de la ligne (m)
    
    923 936
     observe.common.SetLonglineDto.weightedSnap=Snap lesté
    
    924 937
     observe.common.SetLonglineDto.weightedSwivel=Émerillon lesté
    
    925 938
     observe.common.SetLonglineGlobalCompositionDto.availableMitigationType=Atténuations disponibles