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

Commits:

16 changed files:

Changes:

  • client-core/src/main/java/fr/ird/observe/client/ui/content/data/TripUI.java
    ... ... @@ -10,19 +10,31 @@ package fr.ird.observe.client.ui.content.data;
    10 10
      * it under the terms of the GNU General Public License as
    
    11 11
      * published by the Free Software Foundation, either version 3 of the
    
    12 12
      * License, or (at your option) any later version.
    
    13
    - * 
    
    13
    + *
    
    14 14
      * This program is distributed in the hope that it will be useful,
    
    15 15
      * but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    16 16
      * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    
    17 17
      * GNU General Public License for more details.
    
    18
    - * 
    
    18
    + *
    
    19 19
      * You should have received a copy of the GNU General Public
    
    20 20
      * License along with this program.  If not, see
    
    21 21
      * <http://www.gnu.org/licenses/gpl-3.0.html>.
    
    22 22
      * #L%
    
    23 23
      */
    
    24 24
     
    
    25
    +import fr.ird.observe.client.ObserveSwingApplicationContext;
    
    26
    +import fr.ird.observe.client.configuration.ClientConfig;
    
    27
    +import fr.ird.observe.client.ui.content.api.data.open.ContentOpenableUI;
    
    25 28
     import fr.ird.observe.client.ui.util.tripMap.TripMapUI;
    
    29
    +import fr.ird.observe.dto.data.TripMapConfigDto;
    
    30
    +import fr.ird.observe.dto.data.TripMapDto;
    
    31
    +import org.apache.logging.log4j.LogManager;
    
    32
    +import org.apache.logging.log4j.Logger;
    
    33
    +
    
    34
    +import javax.swing.JComponent;
    
    35
    +import javax.swing.JTabbedPane;
    
    36
    +import javax.swing.SwingUtilities;
    
    37
    +import javax.swing.event.ChangeEvent;
    
    26 38
     
    
    27 39
     /**
    
    28 40
      * Created by tchemit on 25/08/17.
    
    ... ... @@ -33,4 +45,97 @@ public interface TripUI {
    33 45
     
    
    34 46
         TripMapUI getTripMap();
    
    35 47
     
    
    48
    +    JTabbedPane getMainTabbedPane();
    
    49
    +
    
    50
    +    Boolean isBuildMap();
    
    51
    +
    
    52
    +    void setBuildMap(Boolean buildMap);
    
    53
    +
    
    54
    +    abstract class TripUIHelper<U extends ContentOpenableUI & TripUI> {
    
    55
    +
    
    56
    +        private static final Logger log = LogManager.getLogger(TripUIHelper.class);
    
    57
    +
    
    58
    +        private final U ui;
    
    59
    +        private final String prefix;
    
    60
    +
    
    61
    +        protected TripUIHelper(U ui, String prefix) {
    
    62
    +            this.ui = ui;
    
    63
    +            this.prefix = prefix;
    
    64
    +        }
    
    65
    +
    
    66
    +        protected abstract TripMapDto getMap(TripMapConfigDto tripMapConfig);
    
    67
    +
    
    68
    +        public void installMap() {
    
    69
    +
    
    70
    +            TripMapUI tripMap = ui.getTripMap();
    
    71
    +
    
    72
    +            TripMapConfigDto tripMapConfig = tripMap.getTripMapConfig();
    
    73
    +            tripMapConfig.setAddObservations(true);
    
    74
    +            tripMapConfig.setAddLogbook(true);
    
    75
    +            SwingUtilities.invokeLater(tripMap::validate);
    
    76
    +            ObserveSwingApplicationContext applicationContext = ObserveSwingApplicationContext.get();
    
    77
    +            ClientConfig config = applicationContext.getConfig();
    
    78
    +
    
    79
    +            tripMap.getHandler().setConfig(config);
    
    80
    +            tripMap.getHandler().init(ui.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW));
    
    81
    +            tripMapConfig.addPropertyChangeListener(TripMapConfigDto.PROPERTY_ADD_OBSERVATIONS, e -> updateMapModel());
    
    82
    +            tripMapConfig.addPropertyChangeListener(TripMapConfigDto.PROPERTY_ADD_LOGBOOK, e -> updateMapModel());
    
    83
    +
    
    84
    +            ui.getMainTabbedPane().addChangeListener(this::onTabChanged);
    
    85
    +
    
    86
    +        }
    
    87
    +
    
    88
    +        public void onOpenAfterOpenModel() {
    
    89
    +            ui.getMainTabbedPane().setSelectedIndex(0);
    
    90
    +            closeMap();
    
    91
    +        }
    
    92
    +
    
    93
    +        void closeMap() {
    
    94
    +            ui.getTripMap().getHandler().doCloseMap();
    
    95
    +            ui.setBuildMap(true);
    
    96
    +        }
    
    97
    +
    
    98
    +        private void buildTripMap() {
    
    99
    +            SwingUtilities.invokeLater(() -> {
    
    100
    +                ObserveSwingApplicationContext.get().getMainUI().getModel().setBusy(true);
    
    101
    +                try {
    
    102
    +                    TripMapUI tripMap = ui.getTripMap();
    
    103
    +                    TripMapConfigDto tripMapConfig = tripMap.getTripMapConfig();
    
    104
    +                    log.info(prefix + String.format("Ask to build map: show observation? %s, show logbook? %s", tripMapConfig.isAddObservations(), tripMapConfig.isAddLogbook()));
    
    105
    +                    TripMapDto tripLonglineMap = getMap(tripMapConfig);
    
    106
    +                    tripMap.getHandler().doOpenMap(tripLonglineMap);
    
    107
    +                } finally {
    
    108
    +                    ObserveSwingApplicationContext.get().getMainUI().getModel().setBusy(false);
    
    109
    +                }
    
    110
    +            });
    
    111
    +        }
    
    112
    +
    
    113
    +        private void onTabChanged(ChangeEvent e) {
    
    114
    +            JTabbedPane selectedComponent = (JTabbedPane) e.getSource();
    
    115
    +            TripMapUI tripMap1 = ui.getTripMap();
    
    116
    +            if (selectedComponent.getSelectedComponent().equals(tripMap1)) {
    
    117
    +                ui.getActions().setVisible(false);
    
    118
    +                if (ui.isBuildMap()) {
    
    119
    +                    try {
    
    120
    +                        buildTripMap();
    
    121
    +                    } finally {
    
    122
    +                        ui.setBuildMap(false);
    
    123
    +                    }
    
    124
    +                }
    
    125
    +            } else {
    
    126
    +                ui.getActions().setVisible(true);
    
    127
    +            }
    
    128
    +        }
    
    129
    +
    
    130
    +        private void updateMapModel() {
    
    131
    +            ui.getTripMap().getHandler().doCloseMap();
    
    132
    +            buildTripMap();
    
    133
    +        }
    
    134
    +
    
    135
    +        public void onOpenModel(String tripId) {
    
    136
    +            TripMapUI tripMap = ui.getTripMap();
    
    137
    +            TripMapConfigDto tripMapConfig = tripMap.getTripMapConfig();
    
    138
    +            tripMapConfig.setTripId(tripId);
    
    139
    +        }
    
    140
    +    }
    
    36 141
     }

  • client-core/src/main/java/fr/ird/observe/client/ui/content/data/ll/common/TripLonglineUI.jaxx
    ... ... @@ -64,6 +64,8 @@
    64 64
     
    
    65 65
       <TripLonglineDto id='bean'/>
    
    66 66
     
    
    67
    +  <Boolean id="buildMap" javaBean="true"/>
    
    68
    +
    
    67 69
       <BeanValidator id='validator' beanClass='fr.ird.observe.dto.data.ll.common.TripLonglineDto'
    
    68 70
                      errorTableModel='{getErrorTableModel()}' autoField='true' context='update'>
    
    69 71
         <field name='activityLonglineObs' component='{actionDown}'/>
    

  • client-core/src/main/java/fr/ird/observe/client/ui/content/data/ll/common/TripLonglineUIHandler.java
    ... ... @@ -28,8 +28,8 @@ import fr.ird.observe.client.ui.content.api.data.open.ContentOpenableUIHandler;
    28 28
     import fr.ird.observe.client.ui.content.api.spi.ContentUIReferenceCache;
    
    29 29
     import fr.ird.observe.client.ui.content.api.spi.ReferentialReferencesFilter;
    
    30 30
     import fr.ird.observe.client.ui.content.api.ui.ObserveLayoutFocusTraversalPolicy;
    
    31
    +import fr.ird.observe.client.ui.content.data.TripUI;
    
    31 32
     import fr.ird.observe.client.ui.util.UIHelper;
    
    32
    -import fr.ird.observe.client.ui.util.tripMap.TripMapUI;
    
    33 33
     import fr.ird.observe.dto.data.TripMapDto;
    
    34 34
     import fr.ird.observe.dto.data.ll.common.TripLonglineDto;
    
    35 35
     import fr.ird.observe.dto.data.ll.common.TripLonglineReference;
    
    ... ... @@ -41,13 +41,11 @@ import fr.ird.observe.dto.referential.common.SpeciesReference;
    41 41
     import fr.ird.observe.dto.referential.common.VesselDto;
    
    42 42
     import fr.ird.observe.dto.referential.common.VesselHelper;
    
    43 43
     import fr.ird.observe.dto.referential.common.VesselReference;
    
    44
    +import fr.ird.observe.dto.data.TripMapConfigDto;
    
    44 45
     import org.apache.logging.log4j.LogManager;
    
    45 46
     import org.apache.logging.log4j.Logger;
    
    46 47
     import org.nuiton.jaxx.runtime.spi.UIHandler;
    
    47 48
     
    
    48
    -import javax.swing.JComponent;
    
    49
    -import javax.swing.JTabbedPane;
    
    50
    -import javax.swing.SwingUtilities;
    
    51 49
     import java.awt.Component;
    
    52 50
     import java.awt.Container;
    
    53 51
     import java.beans.PropertyChangeEvent;
    
    ... ... @@ -67,9 +65,9 @@ class TripLonglineUIHandler extends ContentOpenableUIHandler<TripLonglineDto, Tr
    67 65
     
    
    68 66
         private static final Logger log = LogManager.getLogger(TripLonglineUIHandler.class);
    
    69 67
     
    
    70
    -    private boolean buildTripMap = true;
    
    71 68
         private final VetoableChangeListener logbooksAvailabilityListener;
    
    72 69
         private final VetoableChangeListener observationsAvailabilityListener;
    
    70
    +    private TripUI.TripUIHelper<TripLonglineUI> tripUIHelper;
    
    73 71
     
    
    74 72
         TripLonglineUIHandler() {
    
    75 73
             logbooksAvailabilityListener = this::onLogbooksAvailabilityChanged;
    
    ... ... @@ -101,29 +99,14 @@ class TripLonglineUIHandler extends ContentOpenableUIHandler<TripLonglineDto, Tr
    101 99
         @Override
    
    102 100
         public void afterInit(TripLonglineUI ui) {
    
    103 101
             super.afterInit(ui);
    
    104
    -        TripMapUI tripMap = ui.getTripMap();
    
    105
    -        ClientConfig config = ObserveSwingApplicationContext.get().getConfig();
    
    106 102
     
    
    107
    -        tripMap.getHandler().setConfig(config);
    
    108
    -        tripMap.getHandler().init(ui.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW));
    
    109
    -        tripMap.addPropertyChangeListener(TripMapUI.PROPERTY_SHOW_OBSERVATION, e -> updateMapModel());
    
    110
    -        tripMap.addPropertyChangeListener(TripMapUI.PROPERTY_SHOW_LOGBOOK, e -> updateMapModel());
    
    111
    -        ui.getMainTabbedPane().addChangeListener(e -> {
    
    112
    -            JTabbedPane tripLonglineTabPane = (JTabbedPane) e.getSource();
    
    113
    -            TripLonglineUI ui1 = getUi();
    
    114
    -            TripMapUI tripMap1 = ui1.getTripMap();
    
    115
    -            if (tripLonglineTabPane.getSelectedComponent().equals(tripMap1)) {
    
    116
    -                ui1.getActions().setVisible(false);
    
    117
    -
    
    118
    -                if (buildTripMap) {
    
    119
    -                    buildTripMap();
    
    120
    -                    buildTripMap = false;
    
    121
    -                }
    
    122
    -
    
    123
    -            } else {
    
    124
    -                ui1.getActions().setVisible(true);
    
    103
    +        tripUIHelper = new TripUI.TripUIHelper<TripLonglineUI>(ui, prefix) {
    
    104
    +            @Override
    
    105
    +            protected TripMapDto getMap(TripMapConfigDto tripMapConfig) {
    
    106
    +                return getTripLonglineService().getTripLonglineMap(tripMapConfig);
    
    125 107
                 }
    
    126
    -        });
    
    108
    +        };
    
    109
    +        tripUIHelper.installMap();
    
    127 110
     
    
    128 111
             ui.getVessel().getIndexes().setSelectedButton(1);
    
    129 112
             ui.getDepartureHarbour().getIndexes().setSelectedButton(1);
    
    ... ... @@ -192,7 +175,7 @@ class TripLonglineUIHandler extends ContentOpenableUIHandler<TripLonglineDto, Tr
    192 175
     
    
    193 176
             log.info(prefix + "programId = " + programId);
    
    194 177
             log.info(prefix + "tripId    = " + tripId);
    
    195
    -
    
    178
    +        tripUIHelper.onOpenModel(tripId);
    
    196 179
             boolean create = tripId == null;
    
    197 180
     
    
    198 181
             Form<TripLonglineDto> form;
    
    ... ... @@ -209,9 +192,7 @@ class TripLonglineUIHandler extends ContentOpenableUIHandler<TripLonglineDto, Tr
    209 192
         @Override
    
    210 193
         protected void onOpenAfterOpenModel() {
    
    211 194
             super.onOpenAfterOpenModel();
    
    212
    -        ui.getMainTabbedPane().setSelectedIndex(0);
    
    213
    -        ui.getTripMap().getHandler().doCloseMap();
    
    214
    -        buildTripMap = true;
    
    195
    +        tripUIHelper.onOpenAfterOpenModel();
    
    215 196
         }
    
    216 197
     
    
    217 198
         @Override
    
    ... ... @@ -251,25 +232,5 @@ class TripLonglineUIHandler extends ContentOpenableUIHandler<TripLonglineDto, Tr
    251 232
             }
    
    252 233
         }
    
    253 234
     
    
    254
    -    private void buildTripMap() {
    
    255
    -        SwingUtilities.invokeLater(() -> {
    
    256
    -            ObserveSwingApplicationContext.get().getMainUI().getModel().setBusy(true);
    
    257
    -            try {
    
    258
    -                TripMapUI tripMap = ui.getTripMap();
    
    259
    -                Boolean showObservation = tripMap.isShowObservation();
    
    260
    -                Boolean showLogbook = tripMap.isShowLogbook();
    
    261
    -                log.info(prefix + String.format("Ask to build map: show observation? %s, show logbook? %s", showObservation, showLogbook));
    
    262
    -                TripMapDto tripLonglineMap = getTripLonglineService().getTripLonglineMap(ui.getModel().getSelectedId(), showObservation, showLogbook);
    
    263
    -                tripMap.getHandler().doOpenMap(tripLonglineMap);
    
    264
    -            } finally {
    
    265
    -                ObserveSwingApplicationContext.get().getMainUI().getModel().setBusy(false);
    
    266
    -            }
    
    267
    -        });
    
    268
    -    }
    
    269
    -
    
    270
    -    private void updateMapModel() {
    
    271
    -        ui.getTripMap().getHandler().doCloseMap();
    
    272
    -        buildTripMap();
    
    273
    -    }
    
    274 235
     }
    
    275 236
     

  • client-core/src/main/java/fr/ird/observe/client/ui/content/data/ps/common/TripSeineUI.jaxx
    ... ... @@ -69,6 +69,8 @@
    69 69
       <!-- edit bean -->
    
    70 70
       <TripSeineDto id='bean'/>
    
    71 71
     
    
    72
    +  <Boolean id="buildMap" javaBean="true"/>
    
    73
    +
    
    72 74
       <!-- validator -->
    
    73 75
       <BeanValidator id='validator' beanClass='fr.ird.observe.dto.data.ps.common.TripSeineDto'
    
    74 76
                      errorTableModel='{getErrorTableModel()}' autoField='true' context='update'>
    

  • client-core/src/main/java/fr/ird/observe/client/ui/content/data/ps/common/TripSeineUIHandler.java
    ... ... @@ -8,12 +8,12 @@
    8 8
      * it under the terms of the GNU General Public License as
    
    9 9
      * published by the Free Software Foundation, either version 3 of the
    
    10 10
      * License, or (at your option) any later version.
    
    11
    - * 
    
    11
    + *
    
    12 12
      * This program is distributed in the hope that it will be useful,
    
    13 13
      * but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    14 14
      * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    
    15 15
      * GNU General Public License for more details.
    
    16
    - * 
    
    16
    + *
    
    17 17
      * You should have received a copy of the GNU General Public
    
    18 18
      * License along with this program.  If not, see
    
    19 19
      * <http://www.gnu.org/licenses/gpl-3.0.html>.
    
    ... ... @@ -27,7 +27,7 @@ import fr.ird.observe.client.ui.content.api.data.open.ContentOpenableUIHandler;
    27 27
     import fr.ird.observe.client.ui.content.api.spi.ContentUIReferenceCache;
    
    28 28
     import fr.ird.observe.client.ui.content.api.spi.ReferentialReferencesFilter;
    
    29 29
     import fr.ird.observe.client.ui.content.api.ui.ObserveLayoutFocusTraversalPolicy;
    
    30
    -import fr.ird.observe.client.ui.util.tripMap.TripMapUI;
    
    30
    +import fr.ird.observe.client.ui.content.data.TripUI;
    
    31 31
     import fr.ird.observe.dto.data.TripMapDto;
    
    32 32
     import fr.ird.observe.dto.data.ps.common.TripSeineDto;
    
    33 33
     import fr.ird.observe.dto.data.ps.common.TripSeineReference;
    
    ... ... @@ -37,13 +37,11 @@ import fr.ird.observe.dto.referential.common.PersonReference;
    37 37
     import fr.ird.observe.dto.referential.common.VesselDto;
    
    38 38
     import fr.ird.observe.dto.referential.common.VesselHelper;
    
    39 39
     import fr.ird.observe.dto.referential.common.VesselReference;
    
    40
    +import fr.ird.observe.dto.data.TripMapConfigDto;
    
    40 41
     import org.apache.logging.log4j.LogManager;
    
    41 42
     import org.apache.logging.log4j.Logger;
    
    42 43
     import org.nuiton.jaxx.runtime.spi.UIHandler;
    
    43 44
     
    
    44
    -import javax.swing.JComponent;
    
    45
    -import javax.swing.JTabbedPane;
    
    46
    -import javax.swing.SwingUtilities;
    
    47 45
     import java.awt.Component;
    
    48 46
     import java.awt.Container;
    
    49 47
     
    
    ... ... @@ -55,7 +53,7 @@ class TripSeineUIHandler extends ContentOpenableUIHandler<TripSeineDto, TripSein
    55 53
     
    
    56 54
         static private final Logger log = LogManager.getLogger(TripSeineUIHandler.class);
    
    57 55
     
    
    58
    -    private boolean buildTripMap = true;
    
    56
    +    private TripUI.TripUIHelper<TripSeineUI> tripUIHelper;
    
    59 57
     
    
    60 58
         @Override
    
    61 59
         public TripSeineUIModel getModel() {
    
    ... ... @@ -76,37 +74,15 @@ class TripSeineUIHandler extends ContentOpenableUIHandler<TripSeineDto, TripSein
    76 74
         @Override
    
    77 75
         public void afterInit(TripSeineUI ui) {
    
    78 76
             super.afterInit(ui);
    
    77
    +        tripUIHelper = new TripUI.TripUIHelper<TripSeineUI>(ui, prefix) {
    
    79 78
     
    
    80
    -        TripMapUI tripMap = ui.getTripMap();
    
    81
    -        tripMap.getConfig().setVisible(false);
    
    82
    -        SwingUtilities.invokeLater(tripMap::validate);
    
    83
    -        ClientConfig config = ObserveSwingApplicationContext.get().getConfig();
    
    84
    -
    
    85
    -        tripMap.getHandler().setConfig(config);
    
    86
    -        tripMap.getHandler().init(ui.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW));
    
    87
    -
    
    88
    -        ui.getMainTabbedPane().addChangeListener(e -> {
    
    89
    -            JTabbedPane tripSeineTabPane = (JTabbedPane) e.getSource();
    
    90
    -            TripMapUI tripMap1 = ui.getTripMap();
    
    91
    -            if (tripSeineTabPane.getSelectedComponent().equals(tripMap1)) {
    
    92
    -                ui.getActions().setVisible(false);
    
    93
    -                if (buildTripMap) {
    
    94
    -                    SwingUtilities.invokeLater(() -> {
    
    95
    -                        ObserveSwingApplicationContext.get().getMainUI().getModel().setBusy(true);
    
    96
    -                        try {
    
    97
    -                            TripMapDto tripSeineMap = getTripSeineService().getTripSeineMap(getModel().getSelectedId());
    
    98
    -                            ui.getTripMap().getHandler().doOpenMap(tripSeineMap);
    
    99
    -                        } finally {
    
    100
    -                            ObserveSwingApplicationContext.get().getMainUI().getModel().setBusy(false);
    
    101
    -                        }
    
    102
    -                    });
    
    103
    -                    buildTripMap = false;
    
    104
    -                }
    
    105
    -
    
    106
    -            } else {
    
    107
    -                ui.getActions().setVisible(true);
    
    79
    +            @Override
    
    80
    +            protected TripMapDto getMap(TripMapConfigDto tripMapConfig) {
    
    81
    +                return getTripSeineService().getTripSeineMap(tripMapConfig);
    
    108 82
                 }
    
    109
    -        });
    
    83
    +        };
    
    84
    +        tripUIHelper.installMap();
    
    85
    +        ui.getTripMap().getConfig().setVisible(false);
    
    110 86
     
    
    111 87
             ui.getVessel().getIndexes().setSelectedButton(1);
    
    112 88
             ui.getDepartureHarbour().getIndexes().setSelectedButton(1);
    
    ... ... @@ -140,9 +116,9 @@ class TripSeineUIHandler extends ContentOpenableUIHandler<TripSeineDto, TripSein
    140 116
             TripSeineUIModel model = getModel();
    
    141 117
             String programId = model.getSelectedParentId();
    
    142 118
             String tripId = model.getSelectedId();
    
    143
    -
    
    144 119
             log.info(prefix + "programId = " + programId);
    
    145 120
             log.info(prefix + "tripId    = " + tripId);
    
    121
    +        tripUIHelper.onOpenModel(tripId);
    
    146 122
             boolean create = tripId == null;
    
    147 123
     
    
    148 124
             Form<TripSeineDto> form;
    
    ... ... @@ -159,9 +135,7 @@ class TripSeineUIHandler extends ContentOpenableUIHandler<TripSeineDto, TripSein
    159 135
         @Override
    
    160 136
         protected void onOpenAfterOpenModel() {
    
    161 137
             super.onOpenAfterOpenModel();
    
    162
    -        getUi().getMainTabbedPane().setSelectedIndex(0);
    
    163
    -        getUi().getTripMap().getHandler().doCloseMap();
    
    164
    -        buildTripMap = true;
    
    138
    +        tripUIHelper.onOpenAfterOpenModel();
    
    165 139
         }
    
    166 140
     
    
    167 141
         @Override
    

  • client-core/src/main/java/fr/ird/observe/client/ui/util/tripMap/TripMapUI.jaxx
    ... ... @@ -26,12 +26,13 @@
    26 26
         fr.ird.observe.client.ui.actions.tripMap.ZoomItUIAction
    
    27 27
         fr.ird.observe.client.ui.actions.tripMap.ZoomMoinsUIAction
    
    28 28
         fr.ird.observe.client.ui.actions.tripMap.ZoomPlusUIAction
    
    29
    +    fr.ird.observe.client.ui.util.BeanCheckBox
    
    30
    +    fr.ird.observe.dto.data.TripMapConfigDto
    
    29 31
         java.awt.CardLayout
    
    30 32
       </import>
    
    31 33
     
    
    32 34
       <CardLayout id="contentLayout"/>
    
    33
    -  <Boolean id="showObservation" javaBean="true"/>
    
    34
    -  <Boolean id="showLogbook" javaBean="true"/>
    
    35
    +  <TripMapConfigDto id="tripMapConfig"/>
    
    35 36
       <JPanel constraints="BorderLayout.NORTH" layout="{new BorderLayout()}">
    
    36 37
         <JToolBar constraints="BorderLayout.CENTER">
    
    37 38
           <JButton id='zoomIt'/>
    
    ... ... @@ -39,9 +40,9 @@
    39 40
           <JButton id='zoomMoins'/>
    
    40 41
           <JButton id='exportPng'/>
    
    41 42
         </JToolBar>
    
    42
    -    <JPanel id="config" constraints="BorderLayout.SOUTH" layout="{new GridLayout(1,0)}">
    
    43
    -      <JCheckBox id="showObservationEditor" onItemStateChanged='setShowObservation(showObservationEditor.isSelected())'/>
    
    44
    -      <JCheckBox id="showLogbookEditor" onItemStateChanged='setShowLogbook(showLogbookEditor.isSelected())'/>
    
    43
    +    <JPanel id="config" constraints="BorderLayout.SOUTH" layout="{new GridLayout(1,0)}" beanScope="tripMapConfig">
    
    44
    +      <BeanCheckBox id="addObservations"/>
    
    45
    +      <BeanCheckBox id="addLogbook"/>
    
    45 46
         </JPanel>
    
    46 47
       </JPanel>
    
    47 48
     
    

  • client-core/src/main/java/fr/ird/observe/client/ui/util/tripMap/TripMapUI.jcss
    ... ... @@ -44,12 +44,10 @@
    44 44
       _observeAction:{ExportPngUIAction.ACTION_NAME};
    
    45 45
     }
    
    46 46
     
    
    47
    -#showObservationEditor {
    
    47
    +#addObservations {
    
    48 48
       text: "observe.content.map.showObservation";
    
    49
    -  selected:{isShowObservation()};
    
    50 49
     }
    
    51 50
     
    
    52
    -#showLogbookEditor {
    
    51
    +#addLogbook {
    
    53 52
       text: "observe.content.map.showLogbook";
    
    54
    -  selected:{isShowLogbook()};
    
    55 53
     }

  • client-core/src/main/java/fr/ird/observe/client/ui/util/tripMap/TripMapUIHandler.java
    ... ... @@ -29,9 +29,11 @@ import fr.ird.observe.client.configuration.ClientConfig;
    29 29
     import fr.ird.observe.client.ui.ObserveKeyStrokes;
    
    30 30
     import fr.ird.observe.client.ui.actions.tripMap.TripMapActionSupport;
    
    31 31
     import fr.ird.observe.client.ui.content.api.spi.ObserveActionMap;
    
    32
    +import fr.ird.observe.client.ui.util.BeanCheckBox;
    
    32 33
     import fr.ird.observe.dto.data.TripMapDto;
    
    33 34
     import fr.ird.observe.dto.data.TripMapPoint;
    
    34 35
     import fr.ird.observe.spi.DtoModelClasses;
    
    36
    +import org.apache.commons.lang3.StringUtils;
    
    35 37
     import org.apache.logging.log4j.LogManager;
    
    36 38
     import org.apache.logging.log4j.Logger;
    
    37 39
     import org.geotools.geometry.DirectPosition2D;
    
    ... ... @@ -43,8 +45,8 @@ import org.nuiton.jaxx.runtime.spi.UIHandler;
    43 45
     
    
    44 46
     import javax.swing.AbstractAction;
    
    45 47
     import javax.swing.AbstractButton;
    
    46
    -import javax.swing.Action;
    
    47 48
     import javax.swing.InputMap;
    
    49
    +import javax.swing.KeyStroke;
    
    48 50
     import java.awt.Point;
    
    49 51
     import java.awt.event.ActionEvent;
    
    50 52
     import java.awt.event.MouseEvent;
    
    ... ... @@ -110,11 +112,11 @@ public class TripMapUIHandler implements UIHandler<TripMapUI> {
    110 112
                     mapContentBuilder.addLayer(layerFile);
    
    111 113
                 }
    
    112 114
     
    
    113
    -            if (DtoModelClasses.isSeineId(tripMapDto.getId())) {
    
    115
    +            if (DtoModelClasses.isSeineId(tripMapDto.getTripId())) {
    
    114 116
     
    
    115 117
                     mapContentBuilder.addTripLine(tripMapPoints);
    
    116 118
     
    
    117
    -            } else if (DtoModelClasses.isLonglineId(tripMapDto.getId())) {
    
    119
    +            } else if (DtoModelClasses.isLonglineId(tripMapDto.getTripId())) {
    
    118 120
     
    
    119 121
                     mapContentBuilder.addLonglineObsFishingZone(tripMapPoints);
    
    120 122
                     mapContentBuilder.addLonglineObsLine(tripMapPoints);
    
    ... ... @@ -210,13 +212,6 @@ public class TripMapUIHandler implements UIHandler<TripMapUI> {
    210 212
             mapPane.addMouseMotionListener(mouseMapListener);
    
    211 213
             mapPane.addMouseListener(mouseMapListener);
    
    212 214
             mapPane.addMapPaneListener(new TripMapListener());
    
    213
    -
    
    214
    -        ui.addPropertyChangeListener("showObservation", e -> {
    
    215
    -
    
    216
    -        });
    
    217
    -        ui.addPropertyChangeListener("showLogbook", e -> {
    
    218
    -
    
    219
    -        });
    
    220 215
             rendererRunning = false;
    
    221 216
     
    
    222 217
         }
    
    ... ... @@ -229,27 +224,8 @@ public class TripMapUIHandler implements UIHandler<TripMapUI> {
    229 224
             init(actionMap, inputMap, ui.zoomPlus);
    
    230 225
             init(actionMap, inputMap, ui.exportPng);
    
    231 226
     
    
    232
    -        ui.getShowLogbookEditor().setText(ObserveKeyStrokes.suffixTextWithKeyStroke(ui.getShowLogbookEditor().getText(), ObserveKeyStrokes.KEY_STROKE_SHOW_LONGLINE_LOGBOOK));
    
    233
    -        ui.getShowObservationEditor().setText(ObserveKeyStrokes.suffixTextWithKeyStroke(ui.getShowObservationEditor().getText(), ObserveKeyStrokes.KEY_STROKE_SHOW_LONGLINE_OBS));
    
    234
    -
    
    235
    -        AbstractAction observationAction = new AbstractAction() {
    
    236
    -
    
    237
    -            @Override
    
    238
    -            public void actionPerformed(ActionEvent e) {
    
    239
    -                ui.setShowObservation(!ui.isShowObservation());
    
    240
    -            }
    
    241
    -        };
    
    242
    -        Action logbookAction = new AbstractAction() {
    
    243
    -
    
    244
    -            @Override
    
    245
    -            public void actionPerformed(ActionEvent e) {
    
    246
    -                ui.setShowLogbook(!ui.isShowLogbook());
    
    247
    -            }
    
    248
    -        };
    
    249
    -        inputMap.put(ObserveKeyStrokes.KEY_STROKE_SHOW_LONGLINE_OBS, "toggleObservation");
    
    250
    -        actionMap.put("toggleObservation", observationAction);
    
    251
    -        inputMap.put(ObserveKeyStrokes.KEY_STROKE_SHOW_LONGLINE_LOGBOOK, "toggleLogbook");
    
    252
    -        actionMap.put("toggleLogbook", logbookAction);
    
    227
    +        init(ui.getAddObservations(),inputMap, actionMap, ObserveKeyStrokes.KEY_STROKE_SHOW_LONGLINE_OBS);
    
    228
    +        init(ui.getAddLogbook(),inputMap, actionMap, ObserveKeyStrokes.KEY_STROKE_SHOW_LONGLINE_LOGBOOK);
    
    253 229
         }
    
    254 230
     
    
    255 231
         public ReferencedEnvelope getTripArea() {
    
    ... ... @@ -284,6 +260,27 @@ public class TripMapUIHandler implements UIHandler<TripMapUI> {
    284 260
     
    
    285 261
         }
    
    286 262
     
    
    263
    +    protected void init(BeanCheckBox editor, InputMap inputMap, ObserveActionMap actionMap, KeyStroke keyStroke) {
    
    264
    +        log.debug("init simple boolean editor " + editor.getName());
    
    265
    +        String propertyName = editor.getProperty();
    
    266
    +        if (StringUtils.isEmpty(propertyName)) {
    
    267
    +            editor.setProperty(editor.getName());
    
    268
    +        }
    
    269
    +        editor.setSelected(true);
    
    270
    +        editor.init(true, true);
    
    271
    +
    
    272
    +        editor.setText(ObserveKeyStrokes.suffixTextWithKeyStroke(editor.getText(), keyStroke));
    
    273
    +
    
    274
    +        AbstractAction observationAction = new AbstractAction() {
    
    275
    +            @Override
    
    276
    +            public void actionPerformed(ActionEvent e) {
    
    277
    +                editor.doClick();
    
    278
    +            }
    
    279
    +        };
    
    280
    +        inputMap.put(keyStroke, "toggle" + editor.getName());
    
    281
    +        actionMap.put("toggle" + editor.getName(), observationAction);
    
    282
    +    }
    
    283
    +
    
    287 284
         private class MouseMapListener implements MouseWheelListener, MouseListener, MouseMotionListener {
    
    288 285
     
    
    289 286
             Point2D startPointInWorld;
    

  • services-local/src/main/java/fr/ird/observe/services/local/service/data/TripMapDtoFactory.javadto/src/main/java/fr/ird/observe/dto/data/TripMapConfigDto.java
    1
    -package fr.ird.observe.services.local.service.data;
    
    1
    +package fr.ird.observe.dto.data;
    
    2 2
     
    
    3 3
     /*-
    
    4 4
      * #%L
    
    5
    - * ObServe :: Services local implementation
    
    5
    + * ObServe :: Dto
    
    6 6
      * %%
    
    7 7
      * Copyright (C) 2008 - 2019 IRD, Code Lutin, Ultreia.io
    
    8 8
      * %%
    
    ... ... @@ -10,35 +10,66 @@ package fr.ird.observe.services.local.service.data;
    10 10
      * it under the terms of the GNU General Public License as
    
    11 11
      * published by the Free Software Foundation, either version 3 of the
    
    12 12
      * License, or (at your option) any later version.
    
    13
    - * 
    
    13
    + *
    
    14 14
      * This program is distributed in the hope that it will be useful,
    
    15 15
      * but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    16 16
      * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    
    17 17
      * GNU General Public License for more details.
    
    18
    - * 
    
    18
    + *
    
    19 19
      * You should have received a copy of the GNU General Public
    
    20 20
      * License along with this program.  If not, see
    
    21 21
      * <http://www.gnu.org/licenses/gpl-3.0.html>.
    
    22 22
      * #L%
    
    23 23
      */
    
    24 24
     
    
    25
    -import fr.ird.observe.dto.data.TripMapDto;
    
    26
    -import fr.ird.observe.dto.data.TripMapPoint;
    
    27
    -
    
    28
    -import java.util.LinkedHashSet;
    
    25
    +import fr.ird.observe.dto.ObserveDto;
    
    26
    +import io.ultreia.java4all.bean.AbstractJavaBean;
    
    27
    +import io.ultreia.java4all.bean.spi.GenerateJavaBeanDefinition;
    
    29 28
     
    
    30 29
     /**
    
    31
    - * Created on 09/01/16.
    
    30
    + * Created on 30/06/19.
    
    32 31
      *
    
    33 32
      * @author Tony Chemit - dev@tchemit.fr
    
    33
    + * @since ?
    
    34 34
      */
    
    35
    -public class TripMapDtoFactory {
    
    35
    +@GenerateJavaBeanDefinition
    
    36
    +public class TripMapConfigDto extends AbstractJavaBean implements ObserveDto {
    
    37
    +
    
    38
    +    public static final String PROPERTY_TRIP_ID = "tripId";
    
    39
    +    public static final String PROPERTY_ADD_OBSERVATIONS = "addObservations";
    
    40
    +    public static final String PROPERTY_ADD_LOGBOOK = "addLogbook";
    
    41
    +    private String tripId;
    
    42
    +    private boolean addObservations;
    
    43
    +    private boolean addLogbook;
    
    44
    +
    
    45
    +    public String getTripId() {
    
    46
    +        return tripId;
    
    47
    +    }
    
    48
    +
    
    36 49
     
    
    37
    -    public static TripMapDto of(String tripId, LinkedHashSet<TripMapPoint> points) {
    
    38
    -        TripMapDto tripMapDto = new TripMapDto();
    
    39
    -        tripMapDto.setId(tripId);
    
    40
    -        tripMapDto.setPoints(points);
    
    41
    -        return tripMapDto;
    
    50
    +    public boolean isAddObservations() {
    
    51
    +        return addObservations;
    
    42 52
         }
    
    43 53
     
    
    54
    +    public boolean isAddLogbook() {
    
    55
    +        return addLogbook;
    
    56
    +    }
    
    57
    +
    
    58
    +    public void setTripId(String tripId) {
    
    59
    +        String oldValue = getTripId();
    
    60
    +        this.tripId = tripId;
    
    61
    +        firePropertyChange(PROPERTY_TRIP_ID, oldValue, tripId);
    
    62
    +    }
    
    63
    +
    
    64
    +    public void setAddObservations(boolean addObservations) {
    
    65
    +        boolean oldValue = isAddObservations();
    
    66
    +        this.addObservations = addObservations;
    
    67
    +        firePropertyChange(PROPERTY_ADD_OBSERVATIONS, oldValue, addObservations);
    
    68
    +    }
    
    69
    +
    
    70
    +    public void setAddLogbook(boolean addLogbook) {
    
    71
    +        boolean oldValue = isAddLogbook();
    
    72
    +        this.addLogbook = addLogbook;
    
    73
    +        firePropertyChange(PROPERTY_ADD_LOGBOOK, oldValue, addLogbook);
    
    74
    +    }
    
    44 75
     }

  • dto/src/main/java/fr/ird/observe/dto/data/TripMapDto.java
    ... ... @@ -22,22 +22,36 @@ package fr.ird.observe.dto.data;
    22 22
      * #L%
    
    23 23
      */
    
    24 24
     
    
    25
    -import fr.ird.observe.dto.IdDto;
    
    25
    +import fr.ird.observe.dto.ObserveDto;
    
    26
    +import io.ultreia.java4all.bean.AbstractJavaBean;
    
    27
    +import io.ultreia.java4all.bean.spi.GenerateJavaBeanDefinition;
    
    26 28
     
    
    27
    -import java.util.Collection;
    
    28 29
     import java.util.LinkedHashSet;
    
    29 30
     
    
    30
    -public class TripMapDto extends IdDto {
    
    31
    +@GenerateJavaBeanDefinition
    
    32
    +public class TripMapDto extends AbstractJavaBean implements ObserveDto {
    
    31 33
     
    
    34
    +    public static final String PROPERTY_TRIP_ID = "tripId";
    
    32 35
         public static final String PROPERTY_POINTS = "points";
    
    33 36
     
    
    34
    -    private static final long serialVersionUID = 3487020005850232420L;
    
    37
    +    private String tripId;
    
    38
    +    private LinkedHashSet<TripMapPoint> points;
    
    35 39
     
    
    36
    -    protected LinkedHashSet<TripMapPoint> points;
    
    40
    +    public static TripMapDto of(String tripId, LinkedHashSet<TripMapPoint> points) {
    
    41
    +        TripMapDto tripMapDto = new TripMapDto();
    
    42
    +        tripMapDto.setTripId(tripId);
    
    43
    +        tripMapDto.setPoints(points);
    
    44
    +        return tripMapDto;
    
    45
    +    }
    
    46
    +
    
    47
    +    public String getTripId() {
    
    48
    +        return tripId;
    
    49
    +    }
    
    37 50
     
    
    38
    -    public TripMapPoint getPoints(int index) {
    
    39
    -        TripMapPoint o = getChild(points, index);
    
    40
    -        return o;
    
    51
    +    public void setTripId(String tripId) {
    
    52
    +        String oldValue = getTripId();
    
    53
    +        this.tripId = tripId;
    
    54
    +        firePropertyChange(PROPERTY_TRIP_ID, oldValue, tripId);
    
    41 55
         }
    
    42 56
     
    
    43 57
         public boolean isPointsEmpty() {
    
    ... ... @@ -48,42 +62,6 @@ public class TripMapDto extends IdDto {
    48 62
             return points == null ? 0 : points.size();
    
    49 63
         }
    
    50 64
     
    
    51
    -    public void addPoints(TripMapPoint points) {
    
    52
    -        getPoints().add(points);
    
    53
    -        firePropertyChange(PROPERTY_POINTS, null, points);
    
    54
    -    }
    
    55
    -
    
    56
    -    public void addAllPoints(Collection<TripMapPoint> points) {
    
    57
    -        getPoints().addAll(points);
    
    58
    -        firePropertyChange(PROPERTY_POINTS, null, points);
    
    59
    -    }
    
    60
    -
    
    61
    -    public boolean removePoints(TripMapPoint points) {
    
    62
    -        boolean removed = getPoints().remove(points);
    
    63
    -        if (removed) {
    
    64
    -            firePropertyChange(PROPERTY_POINTS, points, null);
    
    65
    -        }
    
    66
    -        return removed;
    
    67
    -    }
    
    68
    -
    
    69
    -    public boolean removeAllPoints(Collection<TripMapPoint> points) {
    
    70
    -        boolean removed = getPoints().removeAll(points);
    
    71
    -        if (removed) {
    
    72
    -            firePropertyChange(PROPERTY_POINTS, points, null);
    
    73
    -        }
    
    74
    -        return removed;
    
    75
    -    }
    
    76
    -
    
    77
    -    public boolean containsPoints(TripMapPoint points) {
    
    78
    -        boolean contains = getPoints().contains(points);
    
    79
    -        return contains;
    
    80
    -    }
    
    81
    -
    
    82
    -    public boolean containsAllPoints(Collection<TripMapPoint> points) {
    
    83
    -        boolean contains = getPoints().containsAll(points);
    
    84
    -        return contains;
    
    85
    -    }
    
    86
    -
    
    87 65
         public LinkedHashSet<TripMapPoint> getPoints() {
    
    88 66
             if (points == null) {
    
    89 67
                 points = new LinkedHashSet<>();
    

  • persistence/src/main/java/fr/ird/observe/entities/data/ll/common/TripLonglineTopiaDao.java
    ... ... @@ -24,6 +24,7 @@ package fr.ird.observe.entities.data.ll.common;
    24 24
     
    
    25 25
     import com.google.common.collect.ImmutableMap;
    
    26 26
     import com.google.common.collect.Lists;
    
    27
    +import fr.ird.observe.dto.data.TripMapConfigDto;
    
    27 28
     import fr.ird.observe.dto.data.TripMapPoint;
    
    28 29
     import fr.ird.observe.dto.data.TripMapPointType;
    
    29 30
     import fr.ird.observe.entities.referential.common.Harbour;
    
    ... ... @@ -53,8 +54,11 @@ public class TripLonglineTopiaDao extends AbstractTripLonglineTopiaDao<TripLongl
    53 54
         //FIXME-PROTECTED-ID
    
    54 55
         public static final String ACTIVITY_LOGBOOK_STATION_ID= "fr.ird.referential.ll.common.VesselActivityLongline#1239832686138#0.3";
    
    55 56
     
    
    56
    -    public LinkedHashSet<TripMapPoint> extractTripMapActivityPoints(String tripId, boolean addObservation, boolean addLogbook) {
    
    57
    +    public LinkedHashSet<TripMapPoint> extractTripMapActivityPoints(TripMapConfigDto tripMapConfig) {
    
    57 58
     
    
    59
    +        String tripId = tripMapConfig.getTripId();
    
    60
    +        boolean addObservation = tripMapConfig.isAddObservations();
    
    61
    +        boolean addLogbook = tripMapConfig.isAddLogbook();
    
    58 62
             TripLongline tripLongline = forTopiaIdEquals(tripId).findUnique();
    
    59 63
     
    
    60 64
             LinkedHashSet<TripMapPoint> tripMapPoints = new LinkedHashSet<>();
    

  • persistence/src/main/java/fr/ird/observe/entities/data/ps/common/TripSeineTopiaDao.java
    ... ... @@ -22,6 +22,7 @@
    22 22
     package fr.ird.observe.entities.data.ps.common;
    
    23 23
     
    
    24 24
     import com.google.common.collect.ImmutableMap;
    
    25
    +import fr.ird.observe.dto.data.TripMapConfigDto;
    
    25 26
     import fr.ird.observe.dto.data.TripMapPoint;
    
    26 27
     import fr.ird.observe.dto.data.TripMapPointType;
    
    27 28
     import fr.ird.observe.dto.referential.ps.common.SchoolTypeHelper;
    
    ... ... @@ -51,8 +52,8 @@ public class TripSeineTopiaDao extends AbstractTripSeineTopiaDao<TripSeine> {
    51 52
         //FIXME-PROTECTED-ID
    
    52 53
         public static final String ACTIVITY_HARBOUR_ID= "fr.ird.referential.ps.common.VesselActivitySeine#1239832675349#0.363119635949572";
    
    53 54
     
    
    54
    -    public LinkedHashSet<TripMapPoint> extractTripMapActivityPoints(String tripId) {
    
    55
    -
    
    55
    +    public LinkedHashSet<TripMapPoint> extractTripMapActivityPoints(TripMapConfigDto tripMapConfig) {
    
    56
    +        String tripId = tripMapConfig.getTripId();
    
    56 57
             TripSeine tripSeine = forTopiaIdEquals(tripId).findUnique();
    
    57 58
     
    
    58 59
             LinkedHashSet<TripMapPoint> tripMapPoints = new LinkedHashSet<>();
    

  • services-local/src/main/java/fr/ird/observe/services/local/service/data/ll/common/TripLonglineServiceLocal.java
    ... ... @@ -23,6 +23,7 @@ package fr.ird.observe.services.local.service.data.ll.common;
    23 23
      */
    
    24 24
     
    
    25 25
     import com.google.common.collect.ImmutableSet;
    
    26
    +import fr.ird.observe.dto.data.TripMapConfigDto;
    
    26 27
     import fr.ird.observe.dto.data.TripMapDto;
    
    27 28
     import fr.ird.observe.dto.data.TripMapPoint;
    
    28 29
     import fr.ird.observe.dto.data.ll.common.TripLonglineDto;
    
    ... ... @@ -42,7 +43,6 @@ import fr.ird.observe.entities.referential.common.Species2;
    42 43
     import fr.ird.observe.entities.referential.common.SpeciesList;
    
    43 44
     import fr.ird.observe.services.local.ObserveServiceContextLocal;
    
    44 45
     import fr.ird.observe.services.local.service.ObserveServiceLocal;
    
    45
    -import fr.ird.observe.services.local.service.data.TripMapDtoFactory;
    
    46 46
     import fr.ird.observe.services.service.data.ll.common.TripLonglineService;
    
    47 47
     import fr.ird.observe.services.service.sql.DeleteSqlScriptProducerRequest;
    
    48 48
     import fr.ird.observe.services.service.sql.SqlScriptProducerService;
    
    ... ... @@ -113,9 +113,9 @@ public class TripLonglineServiceLocal extends ObserveServiceLocal implements Tri
    113 113
         }
    
    114 114
     
    
    115 115
         @Override
    
    116
    -    public TripMapDto getTripLonglineMap(String tripLonglineId, boolean addObservation, boolean addLogbook) {
    
    117
    -        LinkedHashSet<TripMapPoint> points = TRIP_LONGLINE_SPI.getDao(getTopiaPersistenceContext()).extractTripMapActivityPoints(tripLonglineId, addObservation, addLogbook);
    
    118
    -        return TripMapDtoFactory.of(tripLonglineId, points);
    
    116
    +    public TripMapDto getTripLonglineMap(TripMapConfigDto config) {
    
    117
    +        LinkedHashSet<TripMapPoint> points = TRIP_LONGLINE_SPI.getDao(getTopiaPersistenceContext()).extractTripMapActivityPoints(config);
    
    118
    +        return TripMapDto.of(config.getTripId(), points);
    
    119 119
         }
    
    120 120
     
    
    121 121
         @Override
    

  • services-local/src/main/java/fr/ird/observe/services/local/service/data/ps/common/TripSeineServiceLocal.java
    ... ... @@ -40,7 +40,7 @@ import fr.ird.observe.entities.referential.common.Species2;
    40 40
     import fr.ird.observe.entities.referential.common.SpeciesList;
    
    41 41
     import fr.ird.observe.services.local.ObserveServiceContextLocal;
    
    42 42
     import fr.ird.observe.services.local.service.ObserveServiceLocal;
    
    43
    -import fr.ird.observe.services.local.service.data.TripMapDtoFactory;
    
    43
    +import fr.ird.observe.dto.data.TripMapConfigDto;
    
    44 44
     import fr.ird.observe.services.service.data.ps.common.TripSeineService;
    
    45 45
     import fr.ird.observe.services.service.sql.DeleteSqlScriptProducerRequest;
    
    46 46
     import fr.ird.observe.services.service.sql.SqlScriptProducerService;
    
    ... ... @@ -98,9 +98,9 @@ public class TripSeineServiceLocal extends ObserveServiceLocal implements TripSe
    98 98
         }
    
    99 99
     
    
    100 100
         @Override
    
    101
    -    public TripMapDto getTripSeineMap(String tripSeineId) {
    
    102
    -        LinkedHashSet<TripMapPoint> points = TRIP_SEINE_SPI.getDao(getTopiaPersistenceContext()).extractTripMapActivityPoints(tripSeineId);
    
    103
    -        return TripMapDtoFactory.of(tripSeineId, points);
    
    101
    +    public TripMapDto getTripSeineMap(TripMapConfigDto config) {
    
    102
    +        LinkedHashSet<TripMapPoint> points = TRIP_SEINE_SPI.getDao(getTopiaPersistenceContext()).extractTripMapActivityPoints(config);
    
    103
    +        return TripMapDto.of(config.getTripId(), points);
    
    104 104
         }
    
    105 105
     
    
    106 106
         @Override
    

  • services/src/main/java/fr/ird/observe/services/service/data/ll/common/TripLonglineService.java
    ... ... @@ -32,6 +32,7 @@ import fr.ird.observe.dto.reference.ReferentialDtoReferenceSet;
    32 32
     import fr.ird.observe.dto.referential.common.SpeciesReference;
    
    33 33
     import fr.ird.observe.dto.result.SaveResultDto;
    
    34 34
     import fr.ird.observe.services.service.ObserveService;
    
    35
    +import fr.ird.observe.dto.data.TripMapConfigDto;
    
    35 36
     import fr.ird.observe.services.service.data.TripService;
    
    36 37
     import fr.ird.observe.services.spi.ReadDataPermission;
    
    37 38
     import fr.ird.observe.services.spi.Write;
    
    ... ... @@ -42,7 +43,6 @@ import io.ultreia.java4all.http.spi.Nullable;
    42 43
     import io.ultreia.java4all.http.spi.Post;
    
    43 44
     
    
    44 45
     import java.util.Date;
    
    45
    -import java.util.Set;
    
    46 46
     
    
    47 47
     /**
    
    48 48
      * @author Tony Chemit - dev@tchemit.fr
    
    ... ... @@ -55,7 +55,7 @@ public interface TripLonglineService extends ObserveService, TripService {
    55 55
     
    
    56 56
         @Get
    
    57 57
         @ReadDataPermission
    
    58
    -    TripMapDto getTripLonglineMap(String tripLonglineId, boolean addObservation, boolean addLogbook);
    
    58
    +    TripMapDto getTripLonglineMap(TripMapConfigDto config);
    
    59 59
     
    
    60 60
         @Get
    
    61 61
         @ReadDataPermission
    

  • services/src/main/java/fr/ird/observe/services/service/data/ps/common/TripSeineService.java
    ... ... @@ -32,6 +32,7 @@ import fr.ird.observe.dto.reference.ReferentialDtoReferenceSet;
    32 32
     import fr.ird.observe.dto.referential.common.SpeciesReference;
    
    33 33
     import fr.ird.observe.dto.result.SaveResultDto;
    
    34 34
     import fr.ird.observe.services.service.ObserveService;
    
    35
    +import fr.ird.observe.dto.data.TripMapConfigDto;
    
    35 36
     import fr.ird.observe.services.service.data.TripService;
    
    36 37
     import fr.ird.observe.services.spi.ReadDataPermission;
    
    37 38
     import fr.ird.observe.services.spi.Write;
    
    ... ... @@ -42,7 +43,6 @@ import io.ultreia.java4all.http.spi.Nullable;
    42 43
     import io.ultreia.java4all.http.spi.Post;
    
    43 44
     
    
    44 45
     import java.util.Date;
    
    45
    -import java.util.Set;
    
    46 46
     
    
    47 47
     /**
    
    48 48
      * @author Tony Chemit - dev@tchemit.fr
    
    ... ... @@ -55,7 +55,7 @@ public interface TripSeineService extends ObserveService , TripService {
    55 55
     
    
    56 56
         @Get
    
    57 57
         @ReadDataPermission
    
    58
    -    TripMapDto getTripSeineMap(String tripSeineId);
    
    58
    +    TripMapDto getTripSeineMap(TripMapConfigDto config);
    
    59 59
     
    
    60 60
         @Get
    
    61 61
         @ReadDataPermission