Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe
Commits:
-
df4ec157
by Tony CHEMIT at 2017-12-21T17:36:01+01:00
-
f1f12485
by Tony CHEMIT at 2017-12-21T17:36:32+01:00
-
d70a4053
by Tony CHEMIT at 2017-12-21T17:36:45+01:00
-
6c858fe2
by Tony CHEMIT at 2017-12-21T17:46:17+01:00
30 changed files:
- client/src/main/java/fr/ird/observe/client/ObserveClientImplementationFactory.java
- client/src/main/java/fr/ird/observe/client/ds/editor/form/open/CommonOpenDataFormUI.jcss
- − client/src/main/java/fr/ird/observe/client/ds/editor/form/open/OpenDataFormUIMoveTripActionSupport.java
- client/src/main/java/fr/ird/observe/client/ds/editor/form/open/longline/ActivityLonglineObsUI.jaxx
- client/src/main/java/fr/ird/observe/client/ds/editor/form/open/longline/ActivityLonglineObsUI.jcss
- client/src/main/java/fr/ird/observe/client/ds/editor/form/open/longline/ActivityLonglineObsUIModel.java
- client/src/main/java/fr/ird/observe/client/ds/editor/form/open/longline/TripLonglineUI.jaxx
- client/src/main/java/fr/ird/observe/client/ds/editor/form/open/longline/TripLonglineUI.jcss
- client/src/main/java/fr/ird/observe/client/ds/editor/form/open/longline/TripLonglineUIModel.java
- client/src/main/java/fr/ird/observe/client/ds/editor/form/open/longline/actions/OpenDataFormUIAddSetLonglineObs.java → client/src/main/java/fr/ird/observe/client/ds/editor/form/open/longline/actions/AddSetLonglineObs.java
- − client/src/main/java/fr/ird/observe/client/ds/editor/form/open/longline/actions/OpenDataFormUIMoveActivityLongline.java
- − client/src/main/java/fr/ird/observe/client/ds/editor/form/open/longline/actions/OpenDataFormUIMoveTripLongline.java
- client/src/main/java/fr/ird/observe/client/ds/editor/form/open/seine/ActivitySeineUI.jaxx
- client/src/main/java/fr/ird/observe/client/ds/editor/form/open/seine/ActivitySeineUI.jcss
- client/src/main/java/fr/ird/observe/client/ds/editor/form/open/seine/ActivitySeineUIModel.java
- client/src/main/java/fr/ird/observe/client/ds/editor/form/open/seine/RouteUI.jaxx
- client/src/main/java/fr/ird/observe/client/ds/editor/form/open/seine/RouteUI.jcss
- client/src/main/java/fr/ird/observe/client/ds/editor/form/open/seine/RouteUIModel.java
- client/src/main/java/fr/ird/observe/client/ds/editor/form/open/seine/TripSeineUI.jaxx
- client/src/main/java/fr/ird/observe/client/ds/editor/form/open/seine/TripSeineUI.jcss
- client/src/main/java/fr/ird/observe/client/ds/editor/form/open/seine/TripSeineUIModel.java
- client/src/main/java/fr/ird/observe/client/ds/editor/form/open/seine/actions/OpenDataFormUIAddFloatingObject.java → client/src/main/java/fr/ird/observe/client/ds/editor/form/open/seine/actions/AddFloatingObject.java
- client/src/main/java/fr/ird/observe/client/ds/editor/form/open/seine/actions/OpenDataFormUIAddSetSeine.java → client/src/main/java/fr/ird/observe/client/ds/editor/form/open/seine/actions/AddSetSeine.java
- − client/src/main/java/fr/ird/observe/client/ds/editor/form/open/seine/actions/OpenDataFormUIMoveActivitySeine.java
- − client/src/main/java/fr/ird/observe/client/ds/editor/form/open/seine/actions/OpenDataFormUIMoveRoute.java
- − client/src/main/java/fr/ird/observe/client/ds/editor/form/open/seine/actions/OpenDataFormUIMoveTripSeine.java
- − client/src/main/java/fr/ird/observe/client/ds/editor/tree/ObserveNavigationTreeShowPopupAction.java
- dto/src/main/models/Observe.model
- pom.xml
- services-local/src/test/java/fr/ird/observe/spi/persistence/PersistenceModuleHelperTest.java
Changes:
| ... | ... | @@ -24,8 +24,6 @@ package fr.ird.observe.client; |
| 24 | 24 |
|
| 25 | 25 |
import fr.ird.observe.client.ds.ObserveClientDataSource;
|
| 26 | 26 |
import fr.ird.observe.client.ds.ObserveDataSourceServicesProvider;
|
| 27 |
-import fr.ird.observe.client.ds.editor.DataSourceUI;
|
|
| 28 |
-import fr.ird.observe.client.ds.editor.tree.ObserveNavigationTreeShowPopupAction;
|
|
| 29 | 27 |
import fr.ird.observe.client.ds.editor.tree.navigation.ObserveNavigationTree;
|
| 30 | 28 |
import fr.ird.observe.client.ds.editor.tree.selection.ObserveSelectionTree;
|
| 31 | 29 |
import fr.ird.observe.client.main.ObserveMainUI;
|
| ... | ... | @@ -148,9 +146,6 @@ public class ObserveClientImplementationFactory implements ClientImplementationF |
| 148 | 146 |
// set fullscreen property on main ui
|
| 149 | 147 |
ui.getGraphicsConfiguration().getDevice().setFullScreenWindow(config.isFullScreen() ? ui : null);
|
| 150 | 148 |
|
| 151 |
- DataSourceUI dataSourceEditor = ui.getDataSourceEditor();
|
|
| 152 |
- new ObserveNavigationTreeShowPopupAction(dataSourceEditor.getTree(), dataSourceEditor.getNavigationTree(), dataSourceEditor.getNavigationPopup());
|
|
| 153 |
- |
|
| 154 | 149 |
return ui;
|
| 155 | 150 |
|
| 156 | 151 |
}
|
| ... | ... | @@ -63,9 +63,3 @@ BigTextBeanEditor { |
| 63 | 63 |
model:{bean};
|
| 64 | 64 |
}
|
| 65 | 65 |
|
| 66 |
-#model {
|
|
| 67 |
- editable:true;
|
|
| 68 |
- modified:{validator.isChanged()};
|
|
| 69 |
- valid:{validator.isValid()};
|
|
| 70 |
-}
|
|
| 71 |
- |
| 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 |
-package fr.ird.observe.client.ds.editor.form.open;
|
|
| 23 |
- |
|
| 24 |
-import fr.ird.observe.client.ds.editor.form.MoveDataHelper;
|
|
| 25 |
-import fr.ird.observe.client.ds.editor.form.open.actions.OpenDataFormUIMoveSingleDataActionSupport;
|
|
| 26 |
-import fr.ird.observe.client.ds.editor.tree.navigation.nodes.NavigationTreeNodeSupport;
|
|
| 27 |
-import fr.ird.observe.dto.data.OpenableDto;
|
|
| 28 |
-import fr.ird.observe.dto.reference.DataDtoReference;
|
|
| 29 |
-import fr.ird.observe.dto.referential.GearType;
|
|
| 30 |
- |
|
| 31 |
-import java.util.Optional;
|
|
| 32 |
- |
|
| 33 |
-/**
|
|
| 34 |
- * Action pour changer le programme d'une ou plusieurs marée dans la liste.
|
|
| 35 |
- *
|
|
| 36 |
- * @author Tony Chemit - dev@tchemit.fr
|
|
| 37 |
- * @since 5.0
|
|
| 38 |
- */
|
|
| 39 |
-public abstract class OpenDataFormUIMoveTripActionSupport<D extends OpenableDto, R extends DataDtoReference<D, R>> extends OpenDataFormUIMoveSingleDataActionSupport<D,R> {
|
|
| 40 |
- |
|
| 41 |
- private final GearType gearType;
|
|
| 42 |
- |
|
| 43 |
- protected OpenDataFormUIMoveTripActionSupport(String label, String tip, GearType gearType) {
|
|
| 44 |
- super(label, tip, "move-trips");
|
|
| 45 |
- this.gearType = gearType;
|
|
| 46 |
- }
|
|
| 47 |
- |
|
| 48 |
- @Override
|
|
| 49 |
- public Optional<String> getNewParentId() {
|
|
| 50 |
- return MoveDataHelper.chooseNewProgram(getMainUI(), gearType, getOldParentNode().getId());
|
|
| 51 |
- }
|
|
| 52 |
- |
|
| 53 |
- @Override
|
|
| 54 |
- public NavigationTreeNodeSupport getNewParentNode(String newParentId) {
|
|
| 55 |
- return getDataSourceEditor().getTree().getChild(getOldParentNode().getParent(), newParentId);
|
|
| 56 |
- }
|
|
| 57 |
- |
|
| 58 |
-}
|
| ... | ... | @@ -131,6 +131,7 @@ |
| 131 | 131 |
<JButton id='delete'/>
|
| 132 | 132 |
<JButton id='openData'/>
|
| 133 | 133 |
<JButton id='closeData'/>
|
| 134 |
+ <JButton id='moveData'/>
|
|
| 134 | 135 |
<JButton id='create'/>
|
| 135 | 136 |
|
| 136 | 137 |
</fr.ird.observe.client.ds.editor.form.open.OpenDataFormUI>
|
| ... | ... | @@ -49,10 +49,16 @@ |
| 49 | 49 |
toolTipText:"observe.common.ActivityDto.action.closeAndCreate.tip";
|
| 50 | 50 |
}
|
| 51 | 51 |
|
| 52 |
+#moveData {
|
|
| 53 |
+ text:"observe.menu.navigation.action.move.activityLongline";
|
|
| 54 |
+ toolTipText:"observe.menu.navigation.action.move.activityLongline";
|
|
| 55 |
+ actionIcon:move-activities;
|
|
| 56 |
+}
|
|
| 57 |
+ |
|
| 52 | 58 |
#delete {
|
| 53 | 59 |
toolTipText:"observe.common.ActivityDto.action.delete.tip";
|
| 54 | 60 |
}
|
| 55 | 61 |
|
| 56 | 62 |
#addSet {
|
| 57 |
- actionType:"fr.ird.observe.client.ds.editor.form.open.longline.actions.OpenDataFormUIAddSetLonglineObs.class";
|
|
| 63 |
+ actionType:"fr.ird.observe.client.ds.editor.form.open.longline.actions.AddSetLonglineObs.class";
|
|
| 58 | 64 |
}
|
| ... | ... | @@ -29,10 +29,17 @@ import fr.ird.observe.client.ds.editor.form.open.OpenDataFormUI; |
| 29 | 29 |
import fr.ird.observe.client.ds.editor.form.open.OpenDataFormUILayoutFocusTraversalPolicy;
|
| 30 | 30 |
import fr.ird.observe.client.ds.editor.form.open.OpenDataFormUIModel;
|
| 31 | 31 |
import fr.ird.observe.client.ds.editor.form.spi.FormUIValidationMessageManager;
|
| 32 |
+import fr.ird.observe.client.ds.editor.tree.navigation.NavigationTree;
|
|
| 33 |
+import fr.ird.observe.client.ds.editor.tree.navigation.nodes.NavigationTreeNodeSupport;
|
|
| 34 |
+import fr.ird.observe.client.ds.editor.tree.navigation.nodes.longline.TripLonglineNavigationTreeNode;
|
|
| 35 |
+import fr.ird.observe.client.util.DecoratedNodeEntity;
|
|
| 32 | 36 |
import fr.ird.observe.dto.data.longline.ActivityLonglineObsDto;
|
| 33 | 37 |
import fr.ird.observe.dto.data.longline.ActivityLonglineObsHelper;
|
| 34 | 38 |
import fr.ird.observe.dto.data.longline.ActivityLonglineObsReference;
|
| 35 | 39 |
import fr.ird.observe.dto.data.longline.TripLonglineDto;
|
| 40 |
+import fr.ird.observe.dto.data.longline.TripLonglineReference;
|
|
| 41 |
+import fr.ird.observe.dto.decoration.ObserveI18nDecoratorHelper;
|
|
| 42 |
+import fr.ird.observe.dto.decoration.decorators.DataReferenceDecorator;
|
|
| 36 | 43 |
import fr.ird.observe.dto.reference.DataDtoReference;
|
| 37 | 44 |
import fr.ird.observe.dto.referential.longline.VesselActivityLonglineHelper;
|
| 38 | 45 |
import fr.ird.observe.dto.referential.longline.VesselActivityLonglineReference;
|
| ... | ... | @@ -146,7 +153,8 @@ public class ActivityLonglineObsUIModel extends OpenDataFormUIModel<ActivityLong |
| 146 | 153 |
}
|
| 147 | 154 |
}
|
| 148 | 155 |
|
| 149 |
- public void afterOpen(OpenDataFormUI<ActivityLonglineObsDto, ActivityLonglineObsReference> ui) {
|
|
| 156 |
+ @Override
|
|
| 157 |
+ public void afterOpenData(OpenDataFormUI<ActivityLonglineObsDto, ActivityLonglineObsReference> ui) {
|
|
| 150 | 158 |
String setLonglineId = Optional.ofNullable(getBean().getSetLonglineObs()).map(DataDtoReference::getId).orElse(null);
|
| 151 | 159 |
ObserveFormHelper.getApplicationDataSourceContext(ui).setOpenSetLonglineObsId(setLonglineId);
|
| 152 | 160 |
}
|
| ... | ... | @@ -170,4 +178,46 @@ public class ActivityLonglineObsUIModel extends OpenDataFormUIModel<ActivityLong |
| 170 | 178 |
|
| 171 | 179 |
};
|
| 172 | 180 |
}
|
| 181 |
+ |
|
| 182 |
+ @Override
|
|
| 183 |
+ public DecoratedNodeEntity[] getParentCandidates(OpenDataFormUI<ActivityLonglineObsDto, ActivityLonglineObsReference> ui) {
|
|
| 184 |
+ NavigationTreeNodeSupport oldParentNode = getOldParentNode(ui);
|
|
| 185 |
+ NavigationTreeNodeSupport programNode = oldParentNode.getParent();
|
|
| 186 |
+ String oldTripLonglineId = oldParentNode.getId();
|
|
| 187 |
+ int tripLonglineNb = programNode.getChildCount();
|
|
| 188 |
+ |
|
| 189 |
+ ObserveClientApplicationContext applicationContext = ObserveClientApplicationContext.get();
|
|
| 190 |
+ DataReferenceDecorator<TripLonglineReference> decorator = applicationContext.getDataReferenceDecorator(TripLonglineReference.class, null);
|
|
| 191 |
+ |
|
| 192 |
+ //on crée un tableau avec une marée en moins car on ne propose pas la marée actuelle
|
|
| 193 |
+ DecoratedNodeEntity[] decoratedTripLonglines = new DecoratedNodeEntity[tripLonglineNb - 1];
|
|
| 194 |
+ |
|
| 195 |
+ int j = 0;
|
|
| 196 |
+ for (int i = 0; i < tripLonglineNb; i++) {
|
|
| 197 |
+ TripLonglineNavigationTreeNode tripLonglineNode = (TripLonglineNavigationTreeNode) programNode.getChildAt(i);
|
|
| 198 |
+ String tripLonglineId = tripLonglineNode.getId();
|
|
| 199 |
+ if (!oldTripLonglineId.equals(tripLonglineId)) {
|
|
| 200 |
+ decoratedTripLonglines[j++] = DecoratedNodeEntity.newDecoratedNodeEntity(tripLonglineNode, decorator);
|
|
| 201 |
+ }
|
|
| 202 |
+ }
|
|
| 203 |
+ return decoratedTripLonglines;
|
|
| 204 |
+ }
|
|
| 205 |
+ |
|
| 206 |
+ @Override
|
|
| 207 |
+ public String getMoveTitle() {
|
|
| 208 |
+ return t("observe.action.choose.tripLongline.title");
|
|
| 209 |
+ }
|
|
| 210 |
+ |
|
| 211 |
+ @Override
|
|
| 212 |
+ public String getMoveMessage() {
|
|
| 213 |
+ return t("observe.action.choose.tripLongline.message");
|
|
| 214 |
+ }
|
|
| 215 |
+ |
|
| 216 |
+ |
|
| 217 |
+ @Override
|
|
| 218 |
+ public NavigationTreeNodeSupport getNewParentNode(NavigationTree tree, NavigationTreeNodeSupport oldParentNode, String newParentId) {
|
|
| 219 |
+ NavigationTreeNodeSupport tripLonglineNode = tree.getChild(oldParentNode.getParent(), newParentId);
|
|
| 220 |
+ String activitiesNodeId = ObserveI18nDecoratorHelper.getTypePluralI18nKey(ActivityLonglineObsDto.class);
|
|
| 221 |
+ return tree.getChild(tripLonglineNode, activitiesNodeId);
|
|
| 222 |
+ }
|
|
| 173 | 223 |
}
|
| ... | ... | @@ -30,7 +30,6 @@ |
| 30 | 30 |
<import>
|
| 31 | 31 |
fr.ird.observe.dto.data.longline.TripLonglineDto
|
| 32 | 32 |
fr.ird.observe.dto.data.longline.TripLonglineReference
|
| 33 |
- fr.ird.observe.dto.data.longline.TripLonglineActivityObsDto
|
|
| 34 | 33 |
fr.ird.observe.dto.referential.HarbourReference
|
| 35 | 34 |
fr.ird.observe.dto.referential.VesselReference
|
| 36 | 35 |
fr.ird.observe.dto.referential.PersonReference
|
| ... | ... | @@ -202,11 +201,12 @@ |
| 202 | 201 |
</tab>
|
| 203 | 202 |
</JTabbedPane>
|
| 204 | 203 |
</JPanel>
|
| 204 |
+ <JButton id='create'/>
|
|
| 205 | 205 |
<JButton id='reset'/>
|
| 206 | 206 |
<JButton id='save'/>
|
| 207 | 207 |
<JButton id='delete'/>
|
| 208 | 208 |
<JButton id='openData'/>
|
| 209 | 209 |
<JButton id='closeData'/>
|
| 210 |
- <JButton id='create'/>
|
|
| 210 |
+ <JButton id='moveData'/>
|
|
| 211 | 211 |
|
| 212 | 212 |
</fr.ird.observe.client.ds.editor.form.open.OpenDataFormUI>
|
| ... | ... | @@ -44,3 +44,10 @@ |
| 44 | 44 |
#delete {
|
| 45 | 45 |
toolTipText:"observe.common.TripDto.action.delete.tip";
|
| 46 | 46 |
}
|
| 47 |
+ |
|
| 48 |
+ |
|
| 49 |
+#moveData {
|
|
| 50 |
+ text:"observe.menu.navigation.action.move.tripLongline";
|
|
| 51 |
+ toolTipText:"observe.menu.navigation.action.move.tripLongline";
|
|
| 52 |
+ actionIcon:move-trips;
|
|
| 53 |
+}
|
| ... | ... | @@ -32,19 +32,27 @@ import fr.ird.observe.client.ds.editor.form.open.OpenDataFormUI; |
| 32 | 32 |
import fr.ird.observe.client.ds.editor.form.open.OpenDataFormUILayoutFocusTraversalPolicy;
|
| 33 | 33 |
import fr.ird.observe.client.ds.editor.form.open.OpenDataFormUIModel;
|
| 34 | 34 |
import fr.ird.observe.client.ds.editor.form.spi.FormUIValidationMessageManager;
|
| 35 |
+import fr.ird.observe.client.ds.editor.tree.navigation.NavigationTree;
|
|
| 35 | 36 |
import fr.ird.observe.client.ds.editor.tree.navigation.ObserveNavigationTree;
|
| 37 |
+import fr.ird.observe.client.ds.editor.tree.navigation.nodes.NavigationTreeNodeSupport;
|
|
| 38 |
+import fr.ird.observe.client.ds.editor.tree.navigation.nodes.longline.TripLonglineListNavigationTreeNode;
|
|
| 39 |
+import fr.ird.observe.client.util.DecoratedNodeEntity;
|
|
| 40 |
+import fr.ird.observe.dto.IdHelper;
|
|
| 36 | 41 |
import fr.ird.observe.dto.data.longline.TripLonglineDto;
|
| 37 | 42 |
import fr.ird.observe.dto.data.longline.TripLonglineReference;
|
| 43 |
+import fr.ird.observe.dto.decoration.decorators.ReferentialReferenceDecorator;
|
|
| 38 | 44 |
import fr.ird.observe.dto.reference.DtoReferenceCollection;
|
| 39 | 45 |
import fr.ird.observe.dto.reference.ReferentialReferencesFilter;
|
| 40 | 46 |
import fr.ird.observe.dto.referential.PersonHelper;
|
| 41 | 47 |
import fr.ird.observe.dto.referential.PersonReference;
|
| 48 |
+import fr.ird.observe.dto.referential.ProgramReference;
|
|
| 42 | 49 |
import fr.ird.observe.dto.referential.VesselHelper;
|
| 43 | 50 |
import fr.ird.observe.dto.referential.VesselReference;
|
| 44 | 51 |
import fr.ird.observe.services.service.data.longline.TripLonglineService;
|
| 45 | 52 |
|
| 46 | 53 |
import java.awt.Component;
|
| 47 | 54 |
import java.awt.Container;
|
| 55 |
+import java.util.ArrayList;
|
|
| 48 | 56 |
import java.util.List;
|
| 49 | 57 |
import java.util.Set;
|
| 50 | 58 |
|
| ... | ... | @@ -94,7 +102,7 @@ public class TripLonglineUIModel extends OpenDataFormUIModel<TripLonglineDto, Tr |
| 94 | 102 |
|
| 95 | 103 |
@Override
|
| 96 | 104 |
public int moveData(String newParentId) {
|
| 97 |
-// FIXME!!!
|
|
| 105 |
+// FIXME!!! Ce n'est pas l'endroit pour gérer cet état (à faire dans l'action)
|
|
| 98 | 106 |
// Close old program and open new program
|
| 99 | 107 |
// if (getOpenDataManager().isOpen(dataId)) {
|
| 100 | 108 |
// getOpenDataManager().closeProgram(oldParentId);
|
| ... | ... | @@ -170,4 +178,51 @@ public class TripLonglineUIModel extends OpenDataFormUIModel<TripLonglineDto, Tr |
| 170 | 178 |
ObserveFormHelper.getApplicationDataSourceContext(this).closeProgram();
|
| 171 | 179 |
super.closeData();
|
| 172 | 180 |
}
|
| 181 |
+ |
|
| 182 |
+ @Override
|
|
| 183 |
+ public DecoratedNodeEntity[] getParentCandidates(OpenDataFormUI<TripLonglineDto, TripLonglineReference> ui) {
|
|
| 184 |
+ |
|
| 185 |
+ NavigationTree treeHelper = ui.getDataSourceUI().getTree();
|
|
| 186 |
+ |
|
| 187 |
+ // racine
|
|
| 188 |
+ NavigationTreeNodeSupport rootNode = treeHelper.getRootNode();
|
|
| 189 |
+ |
|
| 190 |
+ //on crée un tableau avec un programme en moins car on ne propose pas le programme actuel
|
|
| 191 |
+ List<DecoratedNodeEntity> decoratedProgramList = new ArrayList<>();
|
|
| 192 |
+ |
|
| 193 |
+ ReferentialReferenceDecorator<ProgramReference> programDecorator = ui.getMainUI().getApplicationContext().getDecoratorService().getReferentialReferenceDecorator(ProgramReference.class);
|
|
| 194 |
+ |
|
| 195 |
+ String parentId = getParentId();
|
|
| 196 |
+ for (int i = 0, n = rootNode.getChildCount(); i < n; i++) {
|
|
| 197 |
+ |
|
| 198 |
+ NavigationTreeNodeSupport programNode = (NavigationTreeNodeSupport) rootNode.getChildAt(i);
|
|
| 199 |
+ String programId = programNode.getId();
|
|
| 200 |
+ |
|
| 201 |
+ // si le noeud programme n'est pas le même que le parent actuel
|
|
| 202 |
+ // si le noeud est bien un noeud de programme
|
|
| 203 |
+ if (programId != null && IdHelper.isProgramId(programId) && !parentId.equals(programId)) {
|
|
| 204 |
+ if (programNode instanceof TripLonglineListNavigationTreeNode) {
|
|
| 205 |
+ TripLonglineListNavigationTreeNode node = (TripLonglineListNavigationTreeNode) programNode;
|
|
| 206 |
+ decoratedProgramList.add(DecoratedNodeEntity.newDecoratedNodeEntity(node, programDecorator));
|
|
| 207 |
+ }
|
|
| 208 |
+ }
|
|
| 209 |
+ }
|
|
| 210 |
+ return decoratedProgramList.toArray(new DecoratedNodeEntity[decoratedProgramList.size()]);
|
|
| 211 |
+ }
|
|
| 212 |
+ |
|
| 213 |
+ |
|
| 214 |
+ @Override
|
|
| 215 |
+ public String getMoveTitle() {
|
|
| 216 |
+ return t("observe.action.choose.program.title");
|
|
| 217 |
+ }
|
|
| 218 |
+ |
|
| 219 |
+ @Override
|
|
| 220 |
+ public String getMoveMessage() {
|
|
| 221 |
+ return t("observe.action.choose.program.message");
|
|
| 222 |
+ }
|
|
| 223 |
+ |
|
| 224 |
+ @Override
|
|
| 225 |
+ protected NavigationTreeNodeSupport getNewParentNode(NavigationTree tree, NavigationTreeNodeSupport oldParentNode, String newParentId) {
|
|
| 226 |
+ return tree.getChild(oldParentNode.getParent(), newParentId);
|
|
| 227 |
+ }
|
|
| 173 | 228 |
}
|
| ... | ... | @@ -41,9 +41,9 @@ import static org.nuiton.i18n.I18n.t; |
| 41 | 41 |
* @author Tony Chemit - dev@tchemit.fr
|
| 42 | 42 |
* @since 6.0
|
| 43 | 43 |
*/
|
| 44 |
-public class OpenDataFormUIAddSetLonglineObs extends OpenDataFormUIActionSupport<ActivityLonglineObsDto, ActivityLonglineObsReference> {
|
|
| 44 |
+public class AddSetLonglineObs extends OpenDataFormUIActionSupport<ActivityLonglineObsDto, ActivityLonglineObsReference> {
|
|
| 45 | 45 |
|
| 46 |
- public OpenDataFormUIAddSetLonglineObs() {
|
|
| 46 |
+ public AddSetLonglineObs() {
|
|
| 47 | 47 |
super(t("observe.common.ActivityLonglineObsDto.action.addSet"),
|
| 48 | 48 |
t("observe.common.ActivityLonglineObsDto.action.addSet.tip"),
|
| 49 | 49 |
"add", ObserveKeyStrokes.KEY_STROKE_ADD_SET_LONGLINE);
|
| 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 |
-package fr.ird.observe.client.ds.editor.form.open.longline.actions;
|
|
| 23 |
- |
|
| 24 |
-import fr.ird.observe.client.ds.editor.form.MoveDataHelper;
|
|
| 25 |
-import fr.ird.observe.client.ds.editor.form.open.actions.OpenDataFormUIMoveSingleDataActionSupport;
|
|
| 26 |
-import fr.ird.observe.client.ds.editor.tree.navigation.NavigationTree;
|
|
| 27 |
-import fr.ird.observe.client.ds.editor.tree.navigation.nodes.NavigationTreeNodeSupport;
|
|
| 28 |
-import fr.ird.observe.dto.data.longline.ActivityLonglineObsDto;
|
|
| 29 |
-import fr.ird.observe.dto.data.longline.ActivityLonglineObsReference;
|
|
| 30 |
-import fr.ird.observe.dto.decoration.ObserveI18nDecoratorHelper;
|
|
| 31 |
- |
|
| 32 |
-import java.util.Optional;
|
|
| 33 |
- |
|
| 34 |
-import static org.nuiton.i18n.I18n.n;
|
|
| 35 |
- |
|
| 36 |
-/**
|
|
| 37 |
- * Action pour changer le programme d'une ou plusieurs marée dans la liste.
|
|
| 38 |
- *
|
|
| 39 |
- * @author Tony Chemit - dev@ultreia.io
|
|
| 40 |
- * @since 5.0
|
|
| 41 |
- */
|
|
| 42 |
-public class OpenDataFormUIMoveActivityLongline extends OpenDataFormUIMoveSingleDataActionSupport<ActivityLonglineObsDto,ActivityLonglineObsReference> {
|
|
| 43 |
- |
|
| 44 |
- public OpenDataFormUIMoveActivityLongline() {
|
|
| 45 |
- super(n("observe.menu.navigation.action.move.activityLongline"),
|
|
| 46 |
- n("observe.menu.navigation.action.move.activityLongline"),
|
|
| 47 |
- "move-activities");
|
|
| 48 |
- }
|
|
| 49 |
- |
|
| 50 |
- @Override
|
|
| 51 |
- public Optional<String> getNewParentId() {
|
|
| 52 |
- return MoveDataHelper.chooseNewTripLongline(getMainUI(), getOldParentNode());
|
|
| 53 |
- }
|
|
| 54 |
- |
|
| 55 |
- @Override
|
|
| 56 |
- public NavigationTreeNodeSupport getNewParentNode(String newParentId) {
|
|
| 57 |
- NavigationTree tree = getDataSourceEditor().getTree();
|
|
| 58 |
- NavigationTreeNodeSupport tripLonglineNode = tree.getChild(getOldParentNode().getParent(), newParentId);
|
|
| 59 |
- String activitiesNodeId = ObserveI18nDecoratorHelper.getTypePluralI18nKey(ActivityLonglineObsDto.class);
|
|
| 60 |
- return tree.getChild(tripLonglineNode, activitiesNodeId);
|
|
| 61 |
- }
|
|
| 62 |
- |
|
| 63 |
-}
|
| 1 |
-package fr.ird.observe.client.ds.editor.form.open.longline.actions;
|
|
| 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.ds.editor.form.open.OpenDataFormUIMoveTripActionSupport;
|
|
| 26 |
-import fr.ird.observe.dto.data.longline.TripLonglineDto;
|
|
| 27 |
-import fr.ird.observe.dto.data.longline.TripLonglineReference;
|
|
| 28 |
-import fr.ird.observe.dto.referential.GearType;
|
|
| 29 |
- |
|
| 30 |
-import static org.nuiton.i18n.I18n.n;
|
|
| 31 |
- |
|
| 32 |
-/**
|
|
| 33 |
- * @author Tony Chemit - dev@tchemit.fr
|
|
| 34 |
- * @since 5.0
|
|
| 35 |
- */
|
|
| 36 |
-public class OpenDataFormUIMoveTripLongline extends OpenDataFormUIMoveTripActionSupport<TripLonglineDto, TripLonglineReference> {
|
|
| 37 |
- |
|
| 38 |
- public OpenDataFormUIMoveTripLongline() {
|
|
| 39 |
- super(n("observe.menu.navigation.action.move.tripLongline"),
|
|
| 40 |
- n("observe.menu.navigation.action.move.tripLongline"),
|
|
| 41 |
- GearType.longline);
|
|
| 42 |
- }
|
|
| 43 |
- |
|
| 44 |
-}
|
| ... | ... | @@ -272,11 +272,12 @@ |
| 272 | 272 |
</cell>
|
| 273 | 273 |
</row>
|
| 274 | 274 |
</Table>
|
| 275 |
+ <JButton id='create'/>
|
|
| 275 | 276 |
<JButton id='reset'/>
|
| 276 | 277 |
<JButton id='save'/>
|
| 277 | 278 |
<JButton id='delete'/>
|
| 278 | 279 |
<JButton id='openData'/>
|
| 279 | 280 |
<JButton id='closeData'/>
|
| 280 |
- <JButton id='create'/>
|
|
| 281 |
+ <JButton id='moveData'/>
|
|
| 281 | 282 |
|
| 282 | 283 |
</fr.ird.observe.client.ds.editor.form.open.OpenDataFormUI>
|
| ... | ... | @@ -91,9 +91,15 @@ |
| 91 | 91 |
}
|
| 92 | 92 |
|
| 93 | 93 |
#addSet {
|
| 94 |
- actionType:"fr.ird.observe.client.ds.editor.form.open.seine.actions.OpenDataFormUIAddSetSeine.class";
|
|
| 94 |
+ actionType:"fr.ird.observe.client.ds.editor.form.open.seine.actions.AddSetSeine.class";
|
|
| 95 | 95 |
}
|
| 96 | 96 |
|
| 97 | 97 |
#addDCP {
|
| 98 |
- actionType:"fr.ird.observe.client.ds.editor.form.open.seine.actions.OpenDataFormUIAddFloatingObject.class";
|
|
| 98 |
+ actionType:"fr.ird.observe.client.ds.editor.form.open.seine.actions.AddFloatingObject.class";
|
|
| 99 |
+}
|
|
| 100 |
+ |
|
| 101 |
+#moveData {
|
|
| 102 |
+ text:"observe.menu.navigation.action.move.activitySeine";
|
|
| 103 |
+ toolTipText:"observe.menu.navigation.action.move.activitySeine";
|
|
| 104 |
+ actionIcon:move-activities;
|
|
| 99 | 105 |
}
|
| ... | ... | @@ -31,16 +31,21 @@ import fr.ird.observe.client.ds.editor.form.open.OpenDataFormUI; |
| 31 | 31 |
import fr.ird.observe.client.ds.editor.form.open.OpenDataFormUILayoutFocusTraversalPolicy;
|
| 32 | 32 |
import fr.ird.observe.client.ds.editor.form.open.OpenDataFormUIModel;
|
| 33 | 33 |
import fr.ird.observe.client.ds.editor.form.spi.FormUIValidationMessageManager;
|
| 34 |
+import fr.ird.observe.client.ds.editor.tree.navigation.NavigationTree;
|
|
| 35 |
+import fr.ird.observe.client.ds.editor.tree.navigation.nodes.NavigationTreeNodeSupport;
|
|
| 36 |
+import fr.ird.observe.client.ds.editor.tree.navigation.nodes.seine.RouteSeineNavigationTreeNode;
|
|
| 37 |
+import fr.ird.observe.client.util.DecoratedNodeEntity;
|
|
| 34 | 38 |
import fr.ird.observe.dto.data.seine.ActivitySeineDto;
|
| 35 | 39 |
import fr.ird.observe.dto.data.seine.ActivitySeineReference;
|
| 36 | 40 |
import fr.ird.observe.dto.data.seine.RouteDto;
|
| 41 |
+import fr.ird.observe.dto.data.seine.RouteReference;
|
|
| 37 | 42 |
import fr.ird.observe.dto.data.seine.TripSeineDto;
|
| 43 |
+import fr.ird.observe.dto.decoration.ObserveI18nDecoratorHelper;
|
|
| 44 |
+import fr.ird.observe.dto.decoration.decorators.DataReferenceDecorator;
|
|
| 38 | 45 |
import fr.ird.observe.dto.reference.DataDtoReference;
|
| 39 | 46 |
import fr.ird.observe.dto.referential.seine.VesselActivitySeineHelper;
|
| 40 | 47 |
import fr.ird.observe.dto.referential.seine.VesselActivitySeineReference;
|
| 41 | 48 |
import fr.ird.observe.services.service.data.seine.ActivitySeineService;
|
| 42 |
-import org.apache.commons.logging.Log;
|
|
| 43 |
-import org.apache.commons.logging.LogFactory;
|
|
| 44 | 49 |
|
| 45 | 50 |
import javax.swing.JComponent;
|
| 46 | 51 |
import javax.swing.JSpinner;
|
| ... | ... | @@ -85,14 +90,11 @@ public class ActivitySeineUIModel extends OpenDataFormUIModel<ActivitySeineDto, |
| 85 | 90 |
ActivitySeineDto.PROPERTY_DETECTION_MODE,
|
| 86 | 91 |
ActivitySeineDto.PROPERTY_REASON_FOR_NO_FISHING).build();
|
| 87 | 92 |
|
| 88 |
- private static final Log log = LogFactory.getLog(ActivitySeineUIModel.class);
|
|
| 89 | 93 |
private static final String PROPERTY_SET_OPERATION = "setOperation";
|
| 90 | 94 |
private static final String PROPERTY_DCP_OPERATION = "dcpOperation";
|
| 91 | 95 |
private static final String PROPERTY_CHANGED_ZONE_OPERATION = "changedZoneOperation";
|
| 92 |
- private String activity6Label;
|
|
| 93 | 96 |
|
| 94 | 97 |
public ActivitySeineUIModel() {
|
| 95 |
- super();
|
|
| 96 | 98 |
bean.addPropertyChangeListener(ActivitySeineDto.PROPERTY_VESSEL_ACTIVITY_SEINE, evt -> {
|
| 97 | 99 |
VesselActivitySeineReference oldActivitySeine = (VesselActivitySeineReference) evt.getOldValue();
|
| 98 | 100 |
VesselActivitySeineReference newActivitySeine = (VesselActivitySeineReference) evt.getNewValue();
|
| ... | ... | @@ -121,7 +123,8 @@ public class ActivitySeineUIModel extends OpenDataFormUIModel<ActivitySeineDto, |
| 121 | 123 |
}
|
| 122 | 124 |
}
|
| 123 | 125 |
|
| 124 |
- public void afterOpen(OpenDataFormUI<ActivitySeineDto, ActivitySeineReference> ui) {
|
|
| 126 |
+ @Override
|
|
| 127 |
+ public void afterOpenData(OpenDataFormUI<ActivitySeineDto, ActivitySeineReference> ui) {
|
|
| 125 | 128 |
String setSeineId = Optional.ofNullable(getBean().getSetSeine()).map(DataDtoReference::getId).orElse(null);
|
| 126 | 129 |
ObserveFormHelper.getApplicationDataSourceContext(ui).setOpenSetSeineId(setSeineId);
|
| 127 | 130 |
}
|
| ... | ... | @@ -179,15 +182,15 @@ public class ActivitySeineUIModel extends OpenDataFormUIModel<ActivitySeineDto, |
| 179 | 182 |
ui1.getAddDCP().setVisible(bean.isDcpOperation());
|
| 180 | 183 |
ui.getExtraActions().setVisible(isUpdatingMode());
|
| 181 | 184 |
|
| 182 |
- VesselActivitySeineReference activity6 = getActivity6Label();
|
|
| 183 |
- String activity6Label = ClientApplicationContext.get().getDecoratorService().getReferentialReferenceDecorator(VesselActivitySeineReference.class).toString(activity6);
|
|
| 185 |
+ VesselActivitySeineReference fishingOperationActivity = getFishingOperationActivity();
|
|
| 186 |
+ String activity6Label = ClientApplicationContext.get().getDecoratorService().getReferentialReferenceDecorator(VesselActivitySeineReference.class).toString(fishingOperationActivity);
|
|
| 184 | 187 |
|
| 185 | 188 |
String text = t("observe.common.ActivitySeineDto.vesselActivitySeine.comment", activity6Label);
|
| 186 | 189 |
ui1.vesselActivityInformation.setText(text);
|
| 187 | 190 |
ui1.vesselActivityInformation.setToolTipText(text);
|
| 188 | 191 |
}
|
| 189 | 192 |
|
| 190 |
- private VesselActivitySeineReference getActivity6Label() {
|
|
| 193 |
+ private VesselActivitySeineReference getFishingOperationActivity() {
|
|
| 191 | 194 |
List<VesselActivitySeineReference> activities = getReferentialReferences(ActivitySeineDto.PROPERTY_VESSEL_ACTIVITY_SEINE);
|
| 192 | 195 |
|
| 193 | 196 |
for (VesselActivitySeineReference vesselActivity : activities) {
|
| ... | ... | @@ -239,4 +242,46 @@ public class ActivitySeineUIModel extends OpenDataFormUIModel<ActivitySeineDto, |
| 239 | 242 |
}
|
| 240 | 243 |
};
|
| 241 | 244 |
}
|
| 245 |
+ |
|
| 246 |
+ @Override
|
|
| 247 |
+ public DecoratedNodeEntity[] getParentCandidates(OpenDataFormUI<ActivitySeineDto, ActivitySeineReference> ui) {
|
|
| 248 |
+ NavigationTreeNodeSupport oldParentNode = getOldParentNode(ui);
|
|
| 249 |
+ NavigationTreeNodeSupport routesNode = oldParentNode.getParent();
|
|
| 250 |
+ String oldRouteId = oldParentNode.getId();
|
|
| 251 |
+ int routeNb = routesNode.getChildCount();
|
|
| 252 |
+ |
|
| 253 |
+ ObserveClientApplicationContext applicationContext = ObserveClientApplicationContext.get();
|
|
| 254 |
+ DataReferenceDecorator<RouteReference> decorator = applicationContext.getDecoratorService().getDataReferenceDecorator(RouteReference.class);
|
|
| 255 |
+ |
|
| 256 |
+ //on crée un tableau avec une route en moins car on ne propose pas la route actuel
|
|
| 257 |
+ DecoratedNodeEntity[] decoratedRoutes = new DecoratedNodeEntity[routeNb - 1];
|
|
| 258 |
+ |
|
| 259 |
+ int j = 0;
|
|
| 260 |
+ for (int i = 0; i < routeNb; i++) {
|
|
| 261 |
+ RouteSeineNavigationTreeNode routeNode = (RouteSeineNavigationTreeNode) routesNode.getChildAt(i);
|
|
| 262 |
+ String routeId = routeNode.getId();
|
|
| 263 |
+ if (!oldRouteId.equals(routeId)) {
|
|
| 264 |
+ decoratedRoutes[j++] = DecoratedNodeEntity.newDecoratedNodeEntity(routeNode, decorator);
|
|
| 265 |
+ }
|
|
| 266 |
+ }
|
|
| 267 |
+ return decoratedRoutes;
|
|
| 268 |
+ }
|
|
| 269 |
+ |
|
| 270 |
+ |
|
| 271 |
+ @Override
|
|
| 272 |
+ public String getMoveTitle() {
|
|
| 273 |
+ return t("observe.action.choose.route.title");
|
|
| 274 |
+ }
|
|
| 275 |
+ |
|
| 276 |
+ @Override
|
|
| 277 |
+ public String getMoveMessage() {
|
|
| 278 |
+ return t("observe.action.choose.route.message");
|
|
| 279 |
+ }
|
|
| 280 |
+ |
|
| 281 |
+ @Override
|
|
| 282 |
+ protected NavigationTreeNodeSupport getNewParentNode(NavigationTree tree, NavigationTreeNodeSupport oldParentNode, String newParentId) {
|
|
| 283 |
+ NavigationTreeNodeSupport routeNode = tree.getChild(oldParentNode.getParent(), newParentId);
|
|
| 284 |
+ String activitiesNodeId = ObserveI18nDecoratorHelper.getTypePluralI18nKey(ActivitySeineDto.class);
|
|
| 285 |
+ return tree.getChild(routeNode, activitiesNodeId);
|
|
| 286 |
+ }
|
|
| 242 | 287 |
}
|
| ... | ... | @@ -88,10 +88,12 @@ |
| 88 | 88 |
</Table>
|
| 89 | 89 |
</JPanel>
|
| 90 | 90 |
|
| 91 |
- <!-- surcharge des actions (pour appliquer la css specifique) -->
|
|
| 91 |
+ <JButton id='create'/>
|
|
| 92 |
+ <JButton id='reset'/>
|
|
| 93 |
+ <JButton id='save'/>
|
|
| 92 | 94 |
<JButton id='delete'/>
|
| 93 | 95 |
<JButton id='openData'/>
|
| 94 | 96 |
<JButton id='closeData'/>
|
| 95 |
- <JButton id='create'/>
|
|
| 97 |
+ <JButton id='moveData'/>
|
|
| 96 | 98 |
|
| 97 | 99 |
</fr.ird.observe.client.ds.editor.form.open.OpenDataFormUI>
|
| ... | ... | @@ -40,3 +40,9 @@ |
| 40 | 40 |
#delete {
|
| 41 | 41 |
toolTipText:"observe.common.RouteDto.action.delete.tip";
|
| 42 | 42 |
}
|
| 43 |
+ |
|
| 44 |
+#moveData {
|
|
| 45 |
+ text:"observe.menu.navigation.action.move.route";
|
|
| 46 |
+ toolTipText:"observe.menu.navigation.action.move.route";
|
|
| 47 |
+ actionIcon:move-routes;
|
|
| 48 |
+}
|
| ... | ... | @@ -30,13 +30,18 @@ import fr.ird.observe.client.ds.editor.form.open.OpenDataFormUI; |
| 30 | 30 |
import fr.ird.observe.client.ds.editor.form.open.OpenDataFormUILayoutFocusTraversalPolicy;
|
| 31 | 31 |
import fr.ird.observe.client.ds.editor.form.open.OpenDataFormUIModel;
|
| 32 | 32 |
import fr.ird.observe.client.ds.editor.form.spi.FormUIValidationMessageManager;
|
| 33 |
+import fr.ird.observe.client.ds.editor.tree.navigation.NavigationTree;
|
|
| 33 | 34 |
import fr.ird.observe.client.ds.editor.tree.navigation.ObserveNavigationTree;
|
| 34 | 35 |
import fr.ird.observe.client.ds.editor.tree.navigation.nodes.NavigationTreeNodeSupport;
|
| 36 |
+import fr.ird.observe.client.ds.editor.tree.navigation.nodes.seine.TripSeineNavigationTreeNode;
|
|
| 37 |
+import fr.ird.observe.client.util.DecoratedNodeEntity;
|
|
| 35 | 38 |
import fr.ird.observe.dto.data.seine.ActivitySeineDto;
|
| 36 | 39 |
import fr.ird.observe.dto.data.seine.RouteDto;
|
| 37 | 40 |
import fr.ird.observe.dto.data.seine.RouteReference;
|
| 38 | 41 |
import fr.ird.observe.dto.data.seine.TripSeineDto;
|
| 42 |
+import fr.ird.observe.dto.data.seine.TripSeineReference;
|
|
| 39 | 43 |
import fr.ird.observe.dto.decoration.ObserveI18nDecoratorHelper;
|
| 44 |
+import fr.ird.observe.dto.decoration.decorators.DataReferenceDecorator;
|
|
| 40 | 45 |
import fr.ird.observe.dto.referential.seine.VesselActivitySeineHelper;
|
| 41 | 46 |
import fr.ird.observe.dto.referential.seine.VesselActivitySeineReference;
|
| 42 | 47 |
import fr.ird.observe.services.service.data.seine.RouteService;
|
| ... | ... | @@ -241,4 +246,50 @@ public class RouteUIModel extends OpenDataFormUIModel<RouteDto, RouteReference, |
| 241 | 246 |
}
|
| 242 | 247 |
}
|
| 243 | 248 |
|
| 249 |
+ @Override
|
|
| 250 |
+ public DecoratedNodeEntity[] getParentCandidates(OpenDataFormUI<RouteDto, RouteReference> ui) {
|
|
| 251 |
+ |
|
| 252 |
+ NavigationTreeNodeSupport oldTripSeineNode = getOldParentNode(ui);
|
|
| 253 |
+ |
|
| 254 |
+ NavigationTreeNodeSupport programNode = oldTripSeineNode.getParent();
|
|
| 255 |
+ String oldTripSeineId = oldTripSeineNode.getId();
|
|
| 256 |
+ int tripSeineNb = programNode.getChildCount();
|
|
| 257 |
+ |
|
| 258 |
+ ClientApplicationContext applicationContext = ClientApplicationContext.get();
|
|
| 259 |
+ DataReferenceDecorator decorator = applicationContext.getDecoratorService().getDataReferenceDecorator(TripSeineReference.class);
|
|
| 260 |
+ |
|
| 261 |
+ //on crée un tableau avec une marée en moins car on ne propose pas la marée actuel
|
|
| 262 |
+ DecoratedNodeEntity[] decoratedTripSeines = new DecoratedNodeEntity[tripSeineNb - 1];
|
|
| 263 |
+ |
|
| 264 |
+ int j = 0;
|
|
| 265 |
+ for (int i = 0; i < tripSeineNb; i++) {
|
|
| 266 |
+ |
|
| 267 |
+ TripSeineNavigationTreeNode tripSeineNode = (TripSeineNavigationTreeNode) programNode.getChildAt(i);
|
|
| 268 |
+ |
|
| 269 |
+ String tripSeineId = tripSeineNode.getId();
|
|
| 270 |
+ |
|
| 271 |
+ if (!oldTripSeineId.equals(tripSeineId)) {
|
|
| 272 |
+ decoratedTripSeines[j++] = DecoratedNodeEntity.newDecoratedNodeEntity(tripSeineNode, decorator);
|
|
| 273 |
+ }
|
|
| 274 |
+ }
|
|
| 275 |
+ return decoratedTripSeines;
|
|
| 276 |
+ }
|
|
| 277 |
+ |
|
| 278 |
+ |
|
| 279 |
+ @Override
|
|
| 280 |
+ public String getMoveTitle() {
|
|
| 281 |
+ return t("observe.action.choose.tripSeine.title");
|
|
| 282 |
+ }
|
|
| 283 |
+ |
|
| 284 |
+ @Override
|
|
| 285 |
+ public String getMoveMessage() {
|
|
| 286 |
+ return t("observe.action.choose.tripSeine.message");
|
|
| 287 |
+ }
|
|
| 288 |
+ |
|
| 289 |
+ @Override
|
|
| 290 |
+ protected NavigationTreeNodeSupport getNewParentNode(NavigationTree tree, NavigationTreeNodeSupport oldParentNode, String newParentId) {
|
|
| 291 |
+ NavigationTreeNodeSupport tripNode = tree.getChild(oldParentNode.getParent(), newParentId);
|
|
| 292 |
+ String routesNodeId = ObserveI18nDecoratorHelper.getTypePluralI18nKey(RouteDto.class);
|
|
| 293 |
+ return tree.getChild(tripNode, routesNodeId);
|
|
| 294 |
+ }
|
|
| 244 | 295 |
}
|
| ... | ... | @@ -209,11 +209,12 @@ |
| 209 | 209 |
</tab>
|
| 210 | 210 |
</JTabbedPane>
|
| 211 | 211 |
</JPanel>
|
| 212 |
+ <JButton id='create'/>
|
|
| 212 | 213 |
<JButton id='reset'/>
|
| 213 | 214 |
<JButton id='save'/>
|
| 214 | 215 |
<JButton id='delete'/>
|
| 215 | 216 |
<JButton id='openData'/>
|
| 216 | 217 |
<JButton id='closeData'/>
|
| 217 |
- <JButton id='create'/>
|
|
| 218 |
+ <JButton id='moveData'/>
|
|
| 218 | 219 |
|
| 219 | 220 |
</fr.ird.observe.client.ds.editor.form.open.OpenDataFormUI>
|
| ... | ... | @@ -54,3 +54,9 @@ |
| 54 | 54 |
#delete {
|
| 55 | 55 |
toolTipText:"observe.common.TripDto.action.delete.tip";
|
| 56 | 56 |
}
|
| 57 |
+ |
|
| 58 |
+#moveData {
|
|
| 59 |
+ text:"observe.menu.navigation.action.move.tripSeine";
|
|
| 60 |
+ toolTipText:"observe.menu.navigation.action.move.tripSeine";
|
|
| 61 |
+ actionIcon:move-trips;
|
|
| 62 |
+}
|
| ... | ... | @@ -32,19 +32,27 @@ import fr.ird.observe.client.ds.editor.form.open.OpenDataFormUI; |
| 32 | 32 |
import fr.ird.observe.client.ds.editor.form.open.OpenDataFormUILayoutFocusTraversalPolicy;
|
| 33 | 33 |
import fr.ird.observe.client.ds.editor.form.open.OpenDataFormUIModel;
|
| 34 | 34 |
import fr.ird.observe.client.ds.editor.form.spi.FormUIValidationMessageManager;
|
| 35 |
+import fr.ird.observe.client.ds.editor.tree.navigation.NavigationTree;
|
|
| 35 | 36 |
import fr.ird.observe.client.ds.editor.tree.navigation.ObserveNavigationTree;
|
| 37 |
+import fr.ird.observe.client.ds.editor.tree.navigation.nodes.NavigationTreeNodeSupport;
|
|
| 38 |
+import fr.ird.observe.client.ds.editor.tree.navigation.nodes.seine.TripSeineListNavigationTreeNode;
|
|
| 39 |
+import fr.ird.observe.client.util.DecoratedNodeEntity;
|
|
| 40 |
+import fr.ird.observe.dto.IdHelper;
|
|
| 36 | 41 |
import fr.ird.observe.dto.data.seine.TripSeineDto;
|
| 37 | 42 |
import fr.ird.observe.dto.data.seine.TripSeineReference;
|
| 43 |
+import fr.ird.observe.dto.decoration.decorators.ReferentialReferenceDecorator;
|
|
| 38 | 44 |
import fr.ird.observe.dto.reference.DtoReferenceCollection;
|
| 39 | 45 |
import fr.ird.observe.dto.reference.ReferentialReferencesFilter;
|
| 40 | 46 |
import fr.ird.observe.dto.referential.PersonHelper;
|
| 41 | 47 |
import fr.ird.observe.dto.referential.PersonReference;
|
| 48 |
+import fr.ird.observe.dto.referential.ProgramReference;
|
|
| 42 | 49 |
import fr.ird.observe.dto.referential.VesselHelper;
|
| 43 | 50 |
import fr.ird.observe.dto.referential.VesselReference;
|
| 44 | 51 |
import fr.ird.observe.services.service.data.seine.TripSeineService;
|
| 45 | 52 |
|
| 46 | 53 |
import java.awt.Component;
|
| 47 | 54 |
import java.awt.Container;
|
| 55 |
+import java.util.ArrayList;
|
|
| 48 | 56 |
import java.util.List;
|
| 49 | 57 |
import java.util.Set;
|
| 50 | 58 |
|
| ... | ... | @@ -177,4 +185,50 @@ public class TripSeineUIModel extends OpenDataFormUIModel<TripSeineDto, TripSein |
| 177 | 185 |
ObserveFormHelper.getApplicationDataSourceContext(this).closeProgram();
|
| 178 | 186 |
super.closeData();
|
| 179 | 187 |
}
|
| 188 |
+ |
|
| 189 |
+ @Override
|
|
| 190 |
+ public DecoratedNodeEntity[] getParentCandidates(OpenDataFormUI<TripSeineDto, TripSeineReference> ui) {
|
|
| 191 |
+ |
|
| 192 |
+ NavigationTree treeHelper = ui.getDataSourceUI().getTree();
|
|
| 193 |
+ |
|
| 194 |
+ // racine
|
|
| 195 |
+ NavigationTreeNodeSupport rootNode = treeHelper.getRootNode();
|
|
| 196 |
+ |
|
| 197 |
+ //on crée un tableau avec un programme en moins car on ne propose pas le programme actuel
|
|
| 198 |
+ List<DecoratedNodeEntity> decoratedProgramList = new ArrayList<>();
|
|
| 199 |
+ |
|
| 200 |
+ ReferentialReferenceDecorator<ProgramReference> programDecorator = ui.getMainUI().getApplicationContext().getDecoratorService().getReferentialReferenceDecorator(ProgramReference.class);
|
|
| 201 |
+ |
|
| 202 |
+ String parentId = getParentId();
|
|
| 203 |
+ for (int i = 0, n = rootNode.getChildCount(); i < n; i++) {
|
|
| 204 |
+ |
|
| 205 |
+ NavigationTreeNodeSupport programNode = (NavigationTreeNodeSupport) rootNode.getChildAt(i);
|
|
| 206 |
+ String programId = programNode.getId();
|
|
| 207 |
+ |
|
| 208 |
+ // si le noeud programme n'est pas le même que le parent actuel
|
|
| 209 |
+ // si le noeud est bien un noeud de programme
|
|
| 210 |
+ if (programId != null && IdHelper.isProgramId(programId) && !parentId.equals(programId)) {
|
|
| 211 |
+ if (programNode instanceof TripSeineListNavigationTreeNode) {
|
|
| 212 |
+ TripSeineListNavigationTreeNode node = (TripSeineListNavigationTreeNode) programNode;
|
|
| 213 |
+ decoratedProgramList.add(DecoratedNodeEntity.newDecoratedNodeEntity(node, programDecorator));
|
|
| 214 |
+ }
|
|
| 215 |
+ }
|
|
| 216 |
+ }
|
|
| 217 |
+ return decoratedProgramList.toArray(new DecoratedNodeEntity[decoratedProgramList.size()]);
|
|
| 218 |
+ }
|
|
| 219 |
+ |
|
| 220 |
+ @Override
|
|
| 221 |
+ public String getMoveTitle() {
|
|
| 222 |
+ return t("observe.action.choose.program.title");
|
|
| 223 |
+ }
|
|
| 224 |
+ |
|
| 225 |
+ @Override
|
|
| 226 |
+ public String getMoveMessage() {
|
|
| 227 |
+ return t("observe.action.choose.program.message");
|
|
| 228 |
+ }
|
|
| 229 |
+ |
|
| 230 |
+ @Override
|
|
| 231 |
+ protected NavigationTreeNodeSupport getNewParentNode(NavigationTree tree, NavigationTreeNodeSupport oldParentNode, String newParentId) {
|
|
| 232 |
+ return tree.getChild(oldParentNode.getParent(), newParentId);
|
|
| 233 |
+ }
|
|
| 180 | 234 |
}
|
| ... | ... | @@ -49,11 +49,11 @@ import static org.nuiton.i18n.I18n.t; |
| 49 | 49 |
* @author Tony Chemit - dev@tchemit.fr
|
| 50 | 50 |
* @since 6.0
|
| 51 | 51 |
*/
|
| 52 |
-public class OpenDataFormUIAddFloatingObject extends OpenDataFormUIActionSupport<ActivitySeineDto, ActivitySeineReference> {
|
|
| 52 |
+public class AddFloatingObject extends OpenDataFormUIActionSupport<ActivitySeineDto, ActivitySeineReference> {
|
|
| 53 | 53 |
|
| 54 |
- private static final Log log = LogFactory.getLog(OpenDataFormUIAddFloatingObject.class);
|
|
| 54 |
+ private static final Log log = LogFactory.getLog(AddFloatingObject.class);
|
|
| 55 | 55 |
|
| 56 |
- public OpenDataFormUIAddFloatingObject() {
|
|
| 56 |
+ public AddFloatingObject() {
|
|
| 57 | 57 |
super(t("observe.common.ActivitySeineDto.action.addFloatingObject"), t("observe.common.ActivitySeineDto.action.addFloatingObject.tip"), "add", ObserveKeyStrokes.KEY_STROKE_ADD_DCP);
|
| 58 | 58 |
}
|
| 59 | 59 |
|
| ... | ... | @@ -41,9 +41,9 @@ import static org.nuiton.i18n.I18n.t; |
| 41 | 41 |
* @author Tony Chemit - dev@tchemit.fr
|
| 42 | 42 |
* @since 6.0
|
| 43 | 43 |
*/
|
| 44 |
-public class OpenDataFormUIAddSetSeine extends OpenDataFormUIActionSupport<ActivitySeineDto, ActivitySeineReference> {
|
|
| 44 |
+public class AddSetSeine extends OpenDataFormUIActionSupport<ActivitySeineDto, ActivitySeineReference> {
|
|
| 45 | 45 |
|
| 46 |
- public OpenDataFormUIAddSetSeine() {
|
|
| 46 |
+ public AddSetSeine() {
|
|
| 47 | 47 |
super(t("observe.common.ActivitySeineDto.action.addSet"), t("observe.common.ActivitySeineDto.action.addSet.tip"), "add", ObserveKeyStrokes.KEY_STROKE_ADD_SET_SEINE);
|
| 48 | 48 |
}
|
| 49 | 49 |
|
| 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 |
-package fr.ird.observe.client.ds.editor.form.open.seine.actions;
|
|
| 23 |
- |
|
| 24 |
-import fr.ird.observe.client.ds.editor.form.MoveDataHelper;
|
|
| 25 |
-import fr.ird.observe.client.ds.editor.form.open.actions.OpenDataFormUIMoveSingleDataActionSupport;
|
|
| 26 |
-import fr.ird.observe.client.ds.editor.tree.navigation.NavigationTree;
|
|
| 27 |
-import fr.ird.observe.client.ds.editor.tree.navigation.nodes.NavigationTreeNodeSupport;
|
|
| 28 |
-import fr.ird.observe.dto.data.seine.ActivitySeineDto;
|
|
| 29 |
-import fr.ird.observe.dto.data.seine.ActivitySeineReference;
|
|
| 30 |
-import fr.ird.observe.dto.decoration.ObserveI18nDecoratorHelper;
|
|
| 31 |
- |
|
| 32 |
-import java.util.Optional;
|
|
| 33 |
- |
|
| 34 |
-import static org.nuiton.i18n.I18n.n;
|
|
| 35 |
- |
|
| 36 |
-/**
|
|
| 37 |
- * Action pour changer le programme d'une ou plusieurs marée dans la liste.
|
|
| 38 |
- *
|
|
| 39 |
- * @author Tony Chemit - dev@ultreia.io
|
|
| 40 |
- * @since 5.0
|
|
| 41 |
- */
|
|
| 42 |
-public class OpenDataFormUIMoveActivitySeine extends OpenDataFormUIMoveSingleDataActionSupport<ActivitySeineDto, ActivitySeineReference> {
|
|
| 43 |
- |
|
| 44 |
- public OpenDataFormUIMoveActivitySeine() {
|
|
| 45 |
- super(n("observe.menu.navigation.action.move.activitySeine"),
|
|
| 46 |
- n("observe.menu.navigation.action.move.activitySeine"),
|
|
| 47 |
- "move-activities");
|
|
| 48 |
- }
|
|
| 49 |
- |
|
| 50 |
- @Override
|
|
| 51 |
- public Optional<String> getNewParentId() {
|
|
| 52 |
- return MoveDataHelper.chooseNewRoute(getMainUI(), getOldParentNode());
|
|
| 53 |
- }
|
|
| 54 |
- |
|
| 55 |
- @Override
|
|
| 56 |
- public NavigationTreeNodeSupport getNewParentNode(String newParentId) {
|
|
| 57 |
- NavigationTree tree = getDataSourceEditor().getTree();
|
|
| 58 |
- NavigationTreeNodeSupport routeNode = tree.getChild(getOldParentNode().getParent(), newParentId);
|
|
| 59 |
- String activitiesNodeId = ObserveI18nDecoratorHelper.getTypePluralI18nKey(ActivitySeineDto.class);
|
|
| 60 |
- return tree.getChild(routeNode, activitiesNodeId);
|
|
| 61 |
- }
|
|
| 62 |
- |
|
| 63 |
-}
|
| 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 |
-package fr.ird.observe.client.ds.editor.form.open.seine.actions;
|
|
| 23 |
- |
|
| 24 |
-import fr.ird.observe.client.ds.editor.form.MoveDataHelper;
|
|
| 25 |
-import fr.ird.observe.client.ds.editor.form.open.actions.OpenDataFormUIMoveSingleDataActionSupport;
|
|
| 26 |
-import fr.ird.observe.client.ds.editor.tree.navigation.NavigationTree;
|
|
| 27 |
-import fr.ird.observe.client.ds.editor.tree.navigation.nodes.NavigationTreeNodeSupport;
|
|
| 28 |
-import fr.ird.observe.dto.data.seine.RouteDto;
|
|
| 29 |
-import fr.ird.observe.dto.data.seine.RouteReference;
|
|
| 30 |
-import fr.ird.observe.dto.decoration.ObserveI18nDecoratorHelper;
|
|
| 31 |
- |
|
| 32 |
-import java.util.Optional;
|
|
| 33 |
- |
|
| 34 |
-import static org.nuiton.i18n.I18n.n;
|
|
| 35 |
- |
|
| 36 |
-/**
|
|
| 37 |
- * Action pour changer le programme d'une ou plusieurs marée dans la liste.
|
|
| 38 |
- *
|
|
| 39 |
- * @author Tony Chemit - dev@ultreia.io
|
|
| 40 |
- * @since 5.0
|
|
| 41 |
- */
|
|
| 42 |
-public class OpenDataFormUIMoveRoute extends OpenDataFormUIMoveSingleDataActionSupport<RouteDto, RouteReference> {
|
|
| 43 |
- |
|
| 44 |
- public OpenDataFormUIMoveRoute() {
|
|
| 45 |
- super(n("observe.menu.navigation.action.move.route"),
|
|
| 46 |
- n("observe.menu.navigation.action.move.route"),
|
|
| 47 |
- "move-routes");
|
|
| 48 |
- }
|
|
| 49 |
- |
|
| 50 |
- @Override
|
|
| 51 |
- public Optional<String> getNewParentId() {
|
|
| 52 |
- return MoveDataHelper.chooseNewTripSeine(getMainUI(), getOldParentNode());
|
|
| 53 |
- }
|
|
| 54 |
- |
|
| 55 |
- @Override
|
|
| 56 |
- public NavigationTreeNodeSupport getNewParentNode(String newParentId) {
|
|
| 57 |
- NavigationTree tree = getDataSourceEditor().getTree();
|
|
| 58 |
- NavigationTreeNodeSupport tripNode = tree.getChild(getOldParentNode().getParent(), newParentId);
|
|
| 59 |
- String routesNodeId = ObserveI18nDecoratorHelper.getTypePluralI18nKey(RouteDto.class);
|
|
| 60 |
- return tree.getChild(tripNode, routesNodeId);
|
|
| 61 |
- }
|
|
| 62 |
- |
|
| 63 |
-}
|
| 1 |
-package fr.ird.observe.client.ds.editor.form.open.seine.actions;
|
|
| 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.ds.editor.form.open.OpenDataFormUIMoveTripActionSupport;
|
|
| 26 |
-import fr.ird.observe.dto.data.seine.TripSeineDto;
|
|
| 27 |
-import fr.ird.observe.dto.data.seine.TripSeineReference;
|
|
| 28 |
-import fr.ird.observe.dto.referential.GearType;
|
|
| 29 |
- |
|
| 30 |
-import static org.nuiton.i18n.I18n.n;
|
|
| 31 |
- |
|
| 32 |
-/**
|
|
| 33 |
- * @author Tony Chemit - dev@tchemit.fr
|
|
| 34 |
- * @since 5.0
|
|
| 35 |
- */
|
|
| 36 |
-public class OpenDataFormUIMoveTripSeine extends OpenDataFormUIMoveTripActionSupport<TripSeineDto, TripSeineReference> {
|
|
| 37 |
- |
|
| 38 |
- public OpenDataFormUIMoveTripSeine() {
|
|
| 39 |
- super(n("observe.menu.navigation.action.move.tripSeine"),
|
|
| 40 |
- n("observe.menu.navigation.action.move.tripSeine"),
|
|
| 41 |
- GearType.seine);
|
|
| 42 |
- }
|
|
| 43 |
- |
|
| 44 |
-}
|
| 1 |
-package fr.ird.observe.client.ds.editor.tree;
|
|
| 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.base.Preconditions;
|
|
| 26 |
-import fr.ird.observe.client.ObserveClientApplicationContext;
|
|
| 27 |
-import fr.ird.observe.client.ds.editor.form.FormUI;
|
|
| 28 |
-import fr.ird.observe.client.ds.editor.form.open.OpenDataFormUI;
|
|
| 29 |
-import fr.ird.observe.client.ds.editor.form.open.longline.actions.OpenDataFormUIMoveActivityLongline;
|
|
| 30 |
-import fr.ird.observe.client.ds.editor.form.open.longline.actions.OpenDataFormUIMoveTripLongline;
|
|
| 31 |
-import fr.ird.observe.client.ds.editor.form.open.seine.actions.OpenDataFormUIMoveActivitySeine;
|
|
| 32 |
-import fr.ird.observe.client.ds.editor.form.open.seine.actions.OpenDataFormUIMoveRoute;
|
|
| 33 |
-import fr.ird.observe.client.ds.editor.form.open.seine.actions.OpenDataFormUIMoveTripSeine;
|
|
| 34 |
-import fr.ird.observe.client.ds.editor.tree.navigation.NavigationTree;
|
|
| 35 |
-import fr.ird.observe.client.ds.editor.tree.navigation.nodes.NavigationTreeNodeSupport;
|
|
| 36 |
-import fr.ird.observe.client.ds.editor.tree.navigation.nodes.ReferenceNavigationTreeNodeSupport;
|
|
| 37 |
-import fr.ird.observe.dto.data.longline.ActivityLonglineObsDto;
|
|
| 38 |
-import fr.ird.observe.dto.data.longline.TripLonglineDto;
|
|
| 39 |
-import fr.ird.observe.dto.data.seine.ActivitySeineDto;
|
|
| 40 |
-import fr.ird.observe.dto.data.seine.RouteDto;
|
|
| 41 |
-import fr.ird.observe.dto.data.seine.TripSeineDto;
|
|
| 42 |
-import fr.ird.observe.spi.application.ObserveApplicationDataContext;
|
|
| 43 |
-import org.apache.commons.logging.Log;
|
|
| 44 |
-import org.apache.commons.logging.LogFactory;
|
|
| 45 |
- |
|
| 46 |
-import javax.swing.JButton;
|
|
| 47 |
-import javax.swing.JMenuItem;
|
|
| 48 |
-import javax.swing.JPopupMenu;
|
|
| 49 |
-import javax.swing.JScrollPane;
|
|
| 50 |
-import javax.swing.MenuElement;
|
|
| 51 |
-import javax.swing.SwingUtilities;
|
|
| 52 |
-import javax.swing.tree.TreePath;
|
|
| 53 |
-import java.awt.Point;
|
|
| 54 |
-import java.awt.Rectangle;
|
|
| 55 |
-import java.awt.event.KeyAdapter;
|
|
| 56 |
-import java.awt.event.KeyEvent;
|
|
| 57 |
-import java.awt.event.MouseAdapter;
|
|
| 58 |
-import java.awt.event.MouseEvent;
|
|
| 59 |
- |
|
| 60 |
-/**
|
|
| 61 |
- * Created on 1/8/15.
|
|
| 62 |
- *
|
|
| 63 |
- * @author Tony Chemit - dev@tchemit.fr
|
|
| 64 |
- * @since 3.11
|
|
| 65 |
- */
|
|
| 66 |
-public class ObserveNavigationTreeShowPopupAction {
|
|
| 67 |
- |
|
| 68 |
- private static final Log log = LogFactory.getLog(ObserveNavigationTreeShowPopupAction.class);
|
|
| 69 |
- |
|
| 70 |
- private static final String TRIP_SEINE_MENU_ITEMS = "tripSeine";
|
|
| 71 |
- private static final String TRIP_LONGLINE_MENU_ITEMS = "tripLongline";
|
|
| 72 |
- private static final String ROUTE_MENU_ITEMS = "route";
|
|
| 73 |
- private static final String ACTIVITY_SEINE_MENU_ITEMS = "activitySeine";
|
|
| 74 |
- private static final String ACTIVITY_LONGLINE_MENU_ITEMS = "activityLongline";
|
|
| 75 |
- |
|
| 76 |
- private final JPopupMenu popup;
|
|
| 77 |
- |
|
| 78 |
- private final NavigationTree tree;
|
|
| 79 |
- |
|
| 80 |
- private final JMenuItem noAction;
|
|
| 81 |
- private final JMenuItem openAction;
|
|
| 82 |
- private final JMenuItem closeAction;
|
|
| 83 |
- private final JMenuItem moveAction;
|
|
| 84 |
- private final JMenuItem deleteAction;
|
|
| 85 |
- |
|
| 86 |
- public ObserveNavigationTreeShowPopupAction(NavigationTree tree, JScrollPane pane, JPopupMenu popup) {
|
|
| 87 |
- |
|
| 88 |
- this.popup = popup;
|
|
| 89 |
- this.tree = tree;
|
|
| 90 |
- |
|
| 91 |
- JMenuItem noActionComponent = null;
|
|
| 92 |
- // trip menus
|
|
| 93 |
- JMenuItem moveComponent = null;
|
|
| 94 |
- JMenuItem openActionComponent = null;
|
|
| 95 |
- JMenuItem closeActionComponent = null;
|
|
| 96 |
- JMenuItem deleteActionComponent = null;
|
|
| 97 |
- |
|
| 98 |
- for (MenuElement menuElement : popup.getSubElements()) {
|
|
| 99 |
- |
|
| 100 |
- if (menuElement.getComponent().getName().equals("navigationNoAction")) {
|
|
| 101 |
- noActionComponent = (JMenuItem) menuElement.getComponent();
|
|
| 102 |
- }
|
|
| 103 |
- if (menuElement.getComponent().getName().equals("navigationMoveAction")) {
|
|
| 104 |
- moveComponent = (JMenuItem) menuElement.getComponent();
|
|
| 105 |
- }
|
|
| 106 |
- if (menuElement.getComponent().getName().equals("navigationOpenAction")) {
|
|
| 107 |
- openActionComponent = (JMenuItem) menuElement.getComponent();
|
|
| 108 |
- }
|
|
| 109 |
- if (menuElement.getComponent().getName().equals("navigationCloseAction")) {
|
|
| 110 |
- closeActionComponent = (JMenuItem) menuElement.getComponent();
|
|
| 111 |
- }
|
|
| 112 |
- if (menuElement.getComponent().getName().equals("navigationDeleteAction")) {
|
|
| 113 |
- deleteActionComponent = (JMenuItem) menuElement.getComponent();
|
|
| 114 |
- }
|
|
| 115 |
- }
|
|
| 116 |
- |
|
| 117 |
- this.noAction = noActionComponent;
|
|
| 118 |
- this.openAction = openActionComponent;
|
|
| 119 |
- this.closeAction = closeActionComponent;
|
|
| 120 |
- this.moveAction = moveComponent;
|
|
| 121 |
- this.deleteAction = deleteActionComponent;
|
|
| 122 |
- |
|
| 123 |
- KeyAdapter keyAdapter = new KeyAdapter() {
|
|
| 124 |
- @Override
|
|
| 125 |
- public void keyPressed(KeyEvent e) {
|
|
| 126 |
- if (tree.isEnabled()) {
|
|
| 127 |
- openNodeMenu(e);
|
|
| 128 |
- }
|
|
| 129 |
- }
|
|
| 130 |
- };
|
|
| 131 |
- tree.addKeyListener(keyAdapter);
|
|
| 132 |
- pane.addKeyListener(keyAdapter);
|
|
| 133 |
- |
|
| 134 |
- MouseAdapter mouseAdapter = new MouseAdapter() {
|
|
| 135 |
- @Override
|
|
| 136 |
- public void mouseClicked(MouseEvent e) {
|
|
| 137 |
- if (tree.isEnabled()) {
|
|
| 138 |
- autoSelectNodeInTree(e);
|
|
| 139 |
- }
|
|
| 140 |
- }
|
|
| 141 |
- };
|
|
| 142 |
- tree.addMouseListener(mouseAdapter);
|
|
| 143 |
- pane.addMouseListener(mouseAdapter);
|
|
| 144 |
- }
|
|
| 145 |
- |
|
| 146 |
- private void autoSelectNodeInTree(MouseEvent e) {
|
|
| 147 |
- |
|
| 148 |
- boolean rightClick = SwingUtilities.isRightMouseButton(e);
|
|
| 149 |
- |
|
| 150 |
- if (rightClick) {
|
|
| 151 |
- |
|
| 152 |
- // get the coordinates of the mouse click
|
|
| 153 |
- Point p = e.getPoint();
|
|
| 154 |
- |
|
| 155 |
- int closestRowForLocation = tree.getClosestRowForLocation(e.getX(), e.getY());
|
|
| 156 |
- |
|
| 157 |
- int rowToSelect = -1;
|
|
| 158 |
- |
|
| 159 |
- if (isRowSelected(closestRowForLocation)) {
|
|
| 160 |
- |
|
| 161 |
- rowToSelect = closestRowForLocation;
|
|
| 162 |
- }
|
|
| 163 |
- |
|
| 164 |
- if (rowToSelect == -1) {
|
|
| 165 |
- |
|
| 166 |
- // try to change selection
|
|
| 167 |
- |
|
| 168 |
- TreePath pathForRow = tree.getPathForRow(closestRowForLocation);
|
|
| 169 |
- tree.setSelectionPath(pathForRow);
|
|
| 170 |
- |
|
| 171 |
- if (isRowSelected(closestRowForLocation)) {
|
|
| 172 |
- |
|
| 173 |
- rowToSelect = closestRowForLocation;
|
|
| 174 |
- }
|
|
| 175 |
- |
|
| 176 |
- }
|
|
| 177 |
- |
|
| 178 |
- if (rowToSelect != -1) {
|
|
| 179 |
- |
|
| 180 |
- showPopup(rowToSelect, p);
|
|
| 181 |
- |
|
| 182 |
- }
|
|
| 183 |
- |
|
| 184 |
- }
|
|
| 185 |
- }
|
|
| 186 |
- |
|
| 187 |
- private void openNodeMenu(KeyEvent e) {
|
|
| 188 |
- |
|
| 189 |
- if (e.getKeyCode() == KeyEvent.VK_CONTEXT_MENU && !tree.isSelectionEmpty()) {
|
|
| 190 |
- |
|
| 191 |
- // get the lowest selected row
|
|
| 192 |
- int lowestRow = getLowestSelectedRowCount();
|
|
| 193 |
- |
|
| 194 |
- // get the selected column
|
|
| 195 |
- Rectangle r = tree.getRowBounds(lowestRow);
|
|
| 196 |
- |
|
| 197 |
- // get the point in the middle lower of the cell
|
|
| 198 |
- Point p = new Point(r.x + r.width / 2, r.y + r.height);
|
|
| 199 |
- |
|
| 200 |
- if (log.isDebugEnabled()) {
|
|
| 201 |
- log.debug("Row " + lowestRow + " found t point [" + p + "]");
|
|
| 202 |
- }
|
|
| 203 |
- |
|
| 204 |
- showPopup(lowestRow, p);
|
|
| 205 |
- |
|
| 206 |
- }
|
|
| 207 |
- }
|
|
| 208 |
- |
|
| 209 |
- private void showPopup(int row, Point p) {
|
|
| 210 |
- |
|
| 211 |
- if (log.isInfoEnabled()) {
|
|
| 212 |
- log.info("Will show popup from row: " + row);
|
|
| 213 |
- }
|
|
| 214 |
- |
|
| 215 |
- NavigationTreeNodeSupport selectedNode = (NavigationTreeNodeSupport) tree.getPathForRow(row).getLastPathComponent();
|
|
| 216 |
- |
|
| 217 |
- if (log.isInfoEnabled()) {
|
|
| 218 |
- log.info("Found selected node: " + selectedNode);
|
|
| 219 |
- }
|
|
| 220 |
- |
|
| 221 |
- beforeOpenPopup(selectedNode);
|
|
| 222 |
- |
|
| 223 |
- popup.show(tree, p.x, p.y);
|
|
| 224 |
- |
|
| 225 |
- }
|
|
| 226 |
- |
|
| 227 |
- private void beforeOpenPopup(NavigationTreeNodeSupport selectedNode) {
|
|
| 228 |
- |
|
| 229 |
- // clean popup
|
|
| 230 |
- popup.removeAll();
|
|
| 231 |
- |
|
| 232 |
- FormUI selectedContentUI = tree.getFormUIManager().getSelectedContentUI();
|
|
| 233 |
- ObserveApplicationDataContext openDataManager = ObserveClientApplicationContext.applicationDataContext();
|
|
| 234 |
- |
|
| 235 |
- boolean closeActionEnabled = false;
|
|
| 236 |
- |
|
| 237 |
- if (selectedContentUI instanceof OpenDataFormUI) {
|
|
| 238 |
- JButton closeButton = ((OpenDataFormUI) selectedContentUI).getCloseData();
|
|
| 239 |
- closeActionEnabled = closeButton.isEnabled();
|
|
| 240 |
- }
|
|
| 241 |
- |
|
| 242 |
- Class dataType = selectedNode.getDataType();
|
|
| 243 |
- if (TripSeineDto.class.equals(dataType)) {
|
|
| 244 |
- |
|
| 245 |
- beforeOpenMenu((ReferenceNavigationTreeNodeSupport) selectedNode, TRIP_SEINE_MENU_ITEMS);
|
|
| 246 |
- |
|
| 247 |
- openAction.setEnabled(!openDataManager.isOpenTripSeine());
|
|
| 248 |
- closeAction.setEnabled(closeActionEnabled);
|
|
| 249 |
- |
|
| 250 |
- } else if (TripLonglineDto.class.equals(dataType)) {
|
|
| 251 |
- |
|
| 252 |
- beforeOpenMenu((ReferenceNavigationTreeNodeSupport) selectedNode, TRIP_LONGLINE_MENU_ITEMS);
|
|
| 253 |
- |
|
| 254 |
- openAction.setEnabled(!openDataManager.isOpenTripLongline());
|
|
| 255 |
- closeAction.setEnabled(closeActionEnabled);
|
|
| 256 |
- |
|
| 257 |
- } else if (RouteDto.class.equals(dataType)) {
|
|
| 258 |
- |
|
| 259 |
- beforeOpenMenu((ReferenceNavigationTreeNodeSupport) selectedNode, ROUTE_MENU_ITEMS);
|
|
| 260 |
- |
|
| 261 |
- openAction.setEnabled(!openDataManager.canOpenRoute());
|
|
| 262 |
- closeAction.setEnabled(closeActionEnabled);
|
|
| 263 |
- |
|
| 264 |
- } else if (ActivitySeineDto.class.equals(dataType)) {
|
|
| 265 |
- |
|
| 266 |
- beforeOpenMenu((ReferenceNavigationTreeNodeSupport) selectedNode, ACTIVITY_SEINE_MENU_ITEMS);
|
|
| 267 |
- |
|
| 268 |
- openAction.setEnabled(openDataManager.canOpenActivitySeine());
|
|
| 269 |
- closeAction.setEnabled(closeActionEnabled);
|
|
| 270 |
- |
|
| 271 |
- } else if (ActivityLonglineObsDto.class.equals(dataType)) {
|
|
| 272 |
- |
|
| 273 |
- beforeOpenMenu((ReferenceNavigationTreeNodeSupport) selectedNode, ACTIVITY_LONGLINE_MENU_ITEMS);
|
|
| 274 |
- |
|
| 275 |
- openAction.setEnabled(openDataManager.canOpenActivityLonglineObs());
|
|
| 276 |
- closeAction.setEnabled(closeActionEnabled);
|
|
| 277 |
- |
|
| 278 |
- } else {
|
|
| 279 |
- |
|
| 280 |
- popup.add(noAction);
|
|
| 281 |
- }
|
|
| 282 |
- }
|
|
| 283 |
- |
|
| 284 |
- private void beforeOpenMenu(ReferenceNavigationTreeNodeSupport selectedNode, String nodeType) {
|
|
| 285 |
- if (log.isInfoEnabled()) {
|
|
| 286 |
- log.info("Will load popup for " + nodeType + " node.");
|
|
| 287 |
- }
|
|
| 288 |
- |
|
| 289 |
- if (selectedNode.isOpen()) {
|
|
| 290 |
- |
|
| 291 |
- closeAction.putClientProperty("ui", tree.getFormUIManager().getSelectedContentUI());
|
|
| 292 |
- popup.add(closeAction);
|
|
| 293 |
- |
|
| 294 |
- |
|
| 295 |
- } else {
|
|
| 296 |
- |
|
| 297 |
- openAction.putClientProperty("ui", tree.getFormUIManager().getSelectedContentUI());
|
|
| 298 |
- popup.add(openAction);
|
|
| 299 |
- |
|
| 300 |
- }
|
|
| 301 |
- |
|
| 302 |
- Class dataType = selectedNode.getDataType();
|
|
| 303 |
- |
|
| 304 |
- if (TripSeineDto.class.equals(dataType)) {
|
|
| 305 |
- moveAction.setAction(new OpenDataFormUIMoveTripSeine());
|
|
| 306 |
- } else if (TripLonglineDto.class.equals(dataType)) {
|
|
| 307 |
- moveAction.setAction(new OpenDataFormUIMoveTripLongline());
|
|
| 308 |
- } else if (RouteDto.class.equals(dataType)) {
|
|
| 309 |
- moveAction.setAction(new OpenDataFormUIMoveRoute());
|
|
| 310 |
- } else if (ActivitySeineDto.class.equals(dataType)) {
|
|
| 311 |
- moveAction.setAction(new OpenDataFormUIMoveActivitySeine());
|
|
| 312 |
- } else if (ActivityLonglineObsDto.class.equals(dataType)) {
|
|
| 313 |
- moveAction.setAction(new OpenDataFormUIMoveActivityLongline());
|
|
| 314 |
- }
|
|
| 315 |
- popup.add(moveAction);
|
|
| 316 |
- |
|
| 317 |
- deleteAction.putClientProperty("ui", tree.getFormUIManager().getSelectedContentUI());
|
|
| 318 |
- deleteAction.setEnabled(selectedNode.isOpen());
|
|
| 319 |
- popup.add(deleteAction);
|
|
| 320 |
- }
|
|
| 321 |
- |
|
| 322 |
- private boolean isRowSelected(int requiredRow) {
|
|
| 323 |
- |
|
| 324 |
- boolean result = false;
|
|
| 325 |
- |
|
| 326 |
- int[] selectedRows = tree.getSelectionRows();
|
|
| 327 |
- if (selectedRows != null) {
|
|
| 328 |
- for (int selectedRow : selectedRows) {
|
|
| 329 |
- if (requiredRow == selectedRow) {
|
|
| 330 |
- |
|
| 331 |
- // match
|
|
| 332 |
- result = true;
|
|
| 333 |
- break;
|
|
| 334 |
- }
|
|
| 335 |
- }
|
|
| 336 |
- }
|
|
| 337 |
- |
|
| 338 |
- return result;
|
|
| 339 |
- |
|
| 340 |
- }
|
|
| 341 |
- |
|
| 342 |
- private int getLowestSelectedRowCount() {
|
|
| 343 |
- |
|
| 344 |
- Preconditions.checkState(!tree.isSelectionEmpty());
|
|
| 345 |
- |
|
| 346 |
- int[] selectedRows = tree.getSelectionRows();
|
|
| 347 |
- int lowestRow = -1;
|
|
| 348 |
- if (selectedRows != null) {
|
|
| 349 |
- for (int row : selectedRows) {
|
|
| 350 |
- lowestRow = Math.max(lowestRow, row);
|
|
| 351 |
- }
|
|
| 352 |
- }
|
|
| 353 |
- return lowestRow;
|
|
| 354 |
- |
|
| 355 |
- }
|
|
| 356 |
- |
|
| 357 |
-}
|
| ... | ... | @@ -41,6 +41,8 @@ interface reference.ReferentialReference > fr.ird.observe.dto.ObserveDto |
| 41 | 41 |
abstract Id >> ObserveDto | skip
|
| 42 | 42 |
id + {*:1} String
|
| 43 | 43 |
lastUpdateDate + {*:1} Date
|
| 44 |
+version + {*:1} long
|
|
| 45 |
+createDate + {*:1} Date
|
|
| 44 | 46 |
|
| 45 | 47 |
abstract data.Data > Id | skip
|
| 46 | 48 |
|
| ... | ... | @@ -55,8 +57,6 @@ code + {*:1} String |
| 55 | 57 |
status + {*:1} !fr.ird.observe.dto.referential.ReferenceStatus
|
| 56 | 58 |
uri + {*:1} String
|
| 57 | 59 |
needComment + {*:1} boolean
|
| 58 |
-version + {*:1} long
|
|
| 59 |
-createDate + {*:1} Date
|
|
| 60 | 60 |
|
| 61 | 61 |
abstract referential.I18nReferential > referential.Referential | skip
|
| 62 | 62 |
label1 + {*:1} String
|
| ... | ... | @@ -145,6 +145,7 @@ |
| 145 | 145 |
<!--persistence model version-->
|
| 146 | 146 |
<observe.model.version>6.904</observe.model.version>
|
| 147 | 147 |
<lib.version.java4all.toolkit>2.0-alpha-2-SNAPSHOT</lib.version.java4all.toolkit>
|
| 148 |
+ <lib.version.java4all.jaxx>3.0-alpha-23-SNAPSHOT</lib.version.java4all.jaxx>
|
|
| 148 | 149 |
|
| 149 | 150 |
<!-- license header configuration -->
|
| 150 | 151 |
<license.licenseName>gpl_v3</license.licenseName>
|
| ... | ... | @@ -10,12 +10,12 @@ package fr.ird.observe.spi.persistence; |
| 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>.
|
| ... | ... | @@ -37,13 +37,14 @@ import fr.ird.observe.services.test.ServiceTestSupport; |
| 37 | 37 |
import fr.ird.observe.services.test.spi.DatabaseNameConfiguration;
|
| 38 | 38 |
import fr.ird.observe.spi.dto.DtoModelClasses;
|
| 39 | 39 |
import fr.ird.observe.test.ObserveFixtures;
|
| 40 |
-import java.util.List;
|
|
| 41 | 40 |
import org.apache.commons.logging.Log;
|
| 42 | 41 |
import org.apache.commons.logging.LogFactory;
|
| 43 | 42 |
import org.junit.Assert;
|
| 44 | 43 |
import org.junit.Test;
|
| 45 | 44 |
import org.nuiton.topia.persistence.TopiaDao;
|
| 46 | 45 |
|
| 46 |
+import java.util.List;
|
|
| 47 |
+ |
|
| 47 | 48 |
/**
|
| 48 | 49 |
* Created on 26/11/15.
|
| 49 | 50 |
*
|
| ... | ... | @@ -66,7 +67,7 @@ public class PersistenceModuleHelperTest extends ServiceTestSupport { |
| 66 | 67 |
}
|
| 67 | 68 |
|
| 68 | 69 |
@Test
|
| 69 |
- public void testTransformEntityToReferentialDto() throws Exception {
|
|
| 70 |
+ public void testTransformEntityToReferentialDto() {
|
|
| 70 | 71 |
|
| 71 | 72 |
for (Class<? extends ReferentialDto> dtoType : DtoModelClasses.REFERENTIAL_TYPES) {
|
| 72 | 73 |
transformReferentialEntityToDto(dtoType);
|
| ... | ... | @@ -74,7 +75,7 @@ public class PersistenceModuleHelperTest extends ServiceTestSupport { |
| 74 | 75 |
}
|
| 75 | 76 |
|
| 76 | 77 |
@Test
|
| 77 |
- public void testTransformEntityToDataDtoForSeine() throws Exception {
|
|
| 78 |
+ public void testTransformEntityToDataDtoForSeine() {
|
|
| 78 | 79 |
for (Class<? extends DataDto> dataType : DtoModelClasses.ALL_DATA_TYPES) {
|
| 79 | 80 |
transformDataEntityToDto(dataType);
|
| 80 | 81 |
}
|
| ... | ... | @@ -82,7 +83,7 @@ public class PersistenceModuleHelperTest extends ServiceTestSupport { |
| 82 | 83 |
|
| 83 | 84 |
@DatabaseNameConfiguration(DatabaseName.dataForTestLongline)
|
| 84 | 85 |
@Test
|
| 85 |
- public void testTransformEntityToDataDtoForLongline() throws Exception {
|
|
| 86 |
+ public void testTransformEntityToDataDtoForLongline() {
|
|
| 86 | 87 |
transformDataEntityToDto(SetLonglineObsCatchDto.class);
|
| 87 | 88 |
// for (Class<? extends DataDto> dataType : DtoModelClasses.ALL_DATA_TYPES) {
|
| 88 | 89 |
// transformDataEntityToDto(dataType);
|
| ... | ... | @@ -107,12 +108,12 @@ public class PersistenceModuleHelperTest extends ServiceTestSupport { |
| 107 | 108 |
for (E entity : Iterables.limit(entities, ObserveFixtures.ENTITIES_LIMIT_SIZE)) {
|
| 108 | 109 |
|
| 109 | 110 |
log.debug("transform " + entity.getTopiaId() + " to " + dtoType.getName());
|
| 110 |
- D dto = typeContext.toDto(ReferentialLocale.FR, dtoType, entity);
|
|
| 111 |
+ D dto = typeContext.toDto(ReferentialLocale.FR, entity);
|
|
| 111 | 112 |
|
| 112 | 113 |
Assert.assertNotNull(dto);
|
| 113 | 114 |
Assert.assertEquals(entity.getTopiaId(), dto.getId());
|
| 114 |
-// Assert.assertEquals(entity.getTopiaCreateDate(), dto.getCreateDate());
|
|
| 115 |
-// Assert.assertEquals(entity.getTopiaVersion(), dto.getTestPropertyAsVersion());
|
|
| 115 |
+ Assert.assertEquals(entity.getTopiaCreateDate(), dto.getCreateDate());
|
|
| 116 |
+ Assert.assertEquals(entity.getTopiaVersion(), dto.getVersion());
|
|
| 116 | 117 |
|
| 117 | 118 |
E entity2 = dao.forTopiaIdEquals(entity.getTopiaId()).findUnique();
|
| 118 | 119 |
typeContext.copyToEntity(ReferentialLocale.FR, dto, entity2);
|