Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe
Commits:
-
7a361345
by Tony Chemit at 2024-02-23T09:54:32+01:00
-
10414880
by Tony Chemit at 2024-02-23T09:55:05+01:00
8 changed files:
- client/datasource/editor/api/src/main/i18n/getters/java.getter
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/data/ropen/actions/SaveContentRootOpenableUIAdapter.java
- client/runner/pom.xml
- client/runner/src/main/i18n/translations/client-runner_en_GB.properties
- client/runner/src/main/i18n/translations/client-runner_es_ES.properties
- client/runner/src/main/i18n/translations/client-runner_fr_FR.properties
- pom.xml
- server/runner/pom.xml
Changes:
| ... | ... | @@ -325,6 +325,9 @@ observe.ui.tree.action.searchOrCreate.tip |
| 325 | 325 | observe.ui.tree.action.selectAll.tip
|
| 326 | 326 | observe.ui.tree.action.unselectAll.tip
|
| 327 | 327 | observe.ui.tree.loaded
|
| 328 | +observe.ui.tree.need.add.disabled.groupBy.message
|
|
| 329 | +observe.ui.tree.need.add.null.groupBy.message
|
|
| 330 | +observe.ui.tree.need.reload.title
|
|
| 328 | 331 | observe.ui.tree.reload
|
| 329 | 332 | observe.ui.type.action.create
|
| 330 | 333 | observe.ui.type.action.delete
|
| ... | ... | @@ -29,15 +29,21 @@ import fr.ird.observe.client.datasource.editor.api.content.data.ropen.ContentRoo |
| 29 | 29 | import fr.ird.observe.client.datasource.editor.api.content.data.ropen.ContentRootOpenableUIModel;
|
| 30 | 30 | import fr.ird.observe.client.datasource.editor.api.content.data.ropen.ContentRootOpenableUINavigationNode;
|
| 31 | 31 | import fr.ird.observe.client.datasource.editor.api.navigation.NavigationTree;
|
| 32 | +import fr.ird.observe.client.datasource.editor.api.navigation.NavigationTreeModel;
|
|
| 32 | 33 | import fr.ird.observe.client.datasource.editor.api.navigation.NavigationUI;
|
| 33 | 34 | import fr.ird.observe.client.datasource.editor.api.navigation.tree.capability.ReferenceContainerCapability;
|
| 34 | 35 | import fr.ird.observe.client.datasource.editor.api.navigation.tree.root.RootNavigationNode;
|
| 35 | 36 | import fr.ird.observe.dto.data.DataGroupByDto;
|
| 36 | 37 | import fr.ird.observe.dto.data.RootOpenableDto;
|
| 37 | 38 | import fr.ird.observe.dto.reference.DataDtoReference;
|
| 39 | +import fr.ird.observe.dto.reference.ReferentialDtoReference;
|
|
| 38 | 40 | import fr.ird.observe.navigation.tree.NavigationResult;
|
| 41 | +import fr.ird.observe.navigation.tree.io.request.ToolkitTreeFlatModelRootRequest;
|
|
| 42 | +import fr.ird.observe.navigation.tree.navigation.NavigationTreeConfig;
|
|
| 43 | +import io.ultreia.java4all.i18n.I18n;
|
|
| 39 | 44 | import org.apache.logging.log4j.LogManager;
|
| 40 | 45 | import org.apache.logging.log4j.Logger;
|
| 46 | +import org.nuiton.jaxx.runtime.swing.JOptionPanes;
|
|
| 41 | 47 | |
| 42 | 48 | import java.util.Objects;
|
| 43 | 49 | |
| ... | ... | @@ -63,13 +69,13 @@ public class SaveContentRootOpenableUIAdapter<D extends RootOpenableDto, U exten |
| 63 | 69 | // get old groupBy dto
|
| 64 | 70 | @SuppressWarnings("unchecked") DataGroupByDto<D> oldGroupByDto = (DataGroupByDto<D>) node.getParentReference();
|
| 65 | 71 | |
| 66 | - // new groupBy value
|
|
| 67 | - String newGroupByValue = oldGroupByDto.definition().toGroupByValue(bean, ((RootNavigationNode) node.getRoot()).getInitializer().getRequest().getGroupByFlavor());
|
|
| 68 | - // is groupBy has changed?
|
|
| 69 | - boolean groupByChanged = !Objects.equals(oldGroupByDto.getFilterValue(), newGroupByValue);
|
|
| 72 | + ToolkitTreeFlatModelRootRequest navigationRequest = ((RootNavigationNode) node.getRoot()).getInitializer().getRequest();
|
|
| 73 | + ComputeNavigationRequestChange<D,U> computeNavigationRequestChange = new ComputeNavigationRequestChange<>(oldGroupByDto, navigationRequest, bean);
|
|
| 74 | + computeNavigationRequestChange.warnUserIfNecessary(ui);
|
|
| 75 | + |
|
| 70 | 76 | // We need to inject ot node the new reference (it could does not know the id if not persisted)
|
| 71 | 77 | // As I prefer to use a unique code (for persisted or not, keep it like this)
|
| 72 | - node = updateReference(dataSourceEditor.getNavigationUI(), node, bean.getId(), oldGroupByDto, groupByChanged, newGroupByValue);
|
|
| 78 | + node = updateReference(dataSourceEditor.getNavigationUI(), node, computeNavigationRequestChange);
|
|
| 73 | 79 | |
| 74 | 80 | tree.reSelectSafeNodeThen(node, () -> {
|
| 75 | 81 | dataSourceEditor.getModel().resetFromPreviousUi(ui);
|
| ... | ... | @@ -79,17 +85,125 @@ public class SaveContentRootOpenableUIAdapter<D extends RootOpenableDto, U exten |
| 79 | 85 | });
|
| 80 | 86 | }
|
| 81 | 87 | |
| 88 | + public static class ComputeNavigationRequestChange<D extends RootOpenableDto, U extends ContentRootOpenableUI<D, U>> {
|
|
| 89 | + private final DataGroupByDto<D> oldGroupByDto;
|
|
| 90 | + private final ToolkitTreeFlatModelRootRequest navigationRequest;
|
|
| 91 | + private final D bean;
|
|
| 92 | + private final String newGroupByValue;
|
|
| 93 | + private final boolean groupByChanged;
|
|
| 94 | + private final boolean changeNavigationRequest;
|
|
| 95 | + private final boolean addNullGroupBy;
|
|
| 96 | + private final boolean addDisabledGroupBy;
|
|
| 97 | + |
|
| 98 | + ComputeNavigationRequestChange(DataGroupByDto<D> oldGroupByDto, ToolkitTreeFlatModelRootRequest navigationRequest, D bean) {
|
|
| 99 | + this.oldGroupByDto = oldGroupByDto;
|
|
| 100 | + this.navigationRequest = navigationRequest;
|
|
| 101 | + this.bean = bean;
|
|
| 102 | + this.newGroupByValue = oldGroupByDto.definition().toGroupByValue(bean, navigationRequest.getGroupByFlavor());
|
|
| 103 | + this.groupByChanged = !Objects.equals(oldGroupByDto.getFilterValue(), newGroupByValue);
|
|
| 104 | + boolean changeNavigationRequest = false;
|
|
| 105 | + boolean addNullGroupBy = false;
|
|
| 106 | + boolean addDisabledGroupBy = false;
|
|
| 107 | + if (groupByChanged) {
|
|
| 108 | + // check if old navigation request is compliant with new groupBy value
|
|
| 109 | + if (newGroupByValue == null) {
|
|
| 110 | + if (!navigationRequest.isLoadNullGroupBy()) {
|
|
| 111 | + // need to add null groupBy in navigation request
|
|
| 112 | + changeNavigationRequest = true;
|
|
| 113 | + addNullGroupBy = true;
|
|
| 114 | + }
|
|
| 115 | + } else {
|
|
| 116 | + if (oldGroupByDto.definition().isQualitative() && !navigationRequest.isLoadDisabledGroupBy()) {
|
|
| 117 | + ReferentialDtoReference groupByObjectValue = (ReferentialDtoReference) oldGroupByDto.definition().toGroupByObjectValue(bean);
|
|
| 118 | + if (groupByObjectValue.isDisabled()) {
|
|
| 119 | + // need to add disabled groupBy in navigation request
|
|
| 120 | + changeNavigationRequest = true;
|
|
| 121 | + addDisabledGroupBy = true;
|
|
| 122 | + }
|
|
| 123 | + }
|
|
| 124 | + }
|
|
| 125 | + }
|
|
| 126 | + this.changeNavigationRequest = changeNavigationRequest;
|
|
| 127 | + this.addNullGroupBy = addNullGroupBy;
|
|
| 128 | + this.addDisabledGroupBy = addDisabledGroupBy;
|
|
| 129 | + }
|
|
| 130 | + |
|
| 131 | + public void warnUserIfNecessary(U ui) {
|
|
| 132 | + if (!isChangeNavigationRequest()) {
|
|
| 133 | + return;
|
|
| 134 | + }
|
|
| 135 | + // display message to user
|
|
| 136 | + if (isAddNullGroupBy()) {
|
|
| 137 | + // add null groupBy in navigation request
|
|
| 138 | + JOptionPanes.displayWarning(ui, I18n.t("observe.ui.tree.need.reload.title"), I18n.t("observe.ui.tree.need.add.null.groupBy.message"));
|
|
| 139 | + return;
|
|
| 140 | + }
|
|
| 141 | + if (isAddDisabledGroupBy()) {
|
|
| 142 | + // add disabled groupBy in navigation request
|
|
| 143 | + JOptionPanes.displayWarning(ui, I18n.t("observe.ui.tree.need.reload.title"), I18n.t("observe.ui.tree.need.add.disabled.groupBy.message"));
|
|
| 144 | + }
|
|
| 145 | + }
|
|
| 146 | + |
|
| 147 | + public DataGroupByDto<D> getOldGroupByDto() {
|
|
| 148 | + return oldGroupByDto;
|
|
| 149 | + }
|
|
| 150 | + |
|
| 151 | + public ToolkitTreeFlatModelRootRequest getNavigationRequest() {
|
|
| 152 | + return navigationRequest;
|
|
| 153 | + }
|
|
| 154 | + |
|
| 155 | + public D getBean() {
|
|
| 156 | + return bean;
|
|
| 157 | + }
|
|
| 158 | + |
|
| 159 | + public String getNewGroupByValue() {
|
|
| 160 | + return newGroupByValue;
|
|
| 161 | + }
|
|
| 162 | + |
|
| 163 | + public boolean isGroupByChanged() {
|
|
| 164 | + return groupByChanged;
|
|
| 165 | + }
|
|
| 166 | + |
|
| 167 | + public boolean isChangeNavigationRequest() {
|
|
| 168 | + return changeNavigationRequest;
|
|
| 169 | + }
|
|
| 170 | + |
|
| 171 | + public boolean isAddNullGroupBy() {
|
|
| 172 | + return addNullGroupBy;
|
|
| 173 | + }
|
|
| 174 | + |
|
| 175 | + public boolean isAddDisabledGroupBy() {
|
|
| 176 | + return addDisabledGroupBy;
|
|
| 177 | + }
|
|
| 178 | + |
|
| 179 | + NavigationResult updateNavigationResult(NavigationTreeModel navigationTreeModel) {
|
|
| 180 | + NavigationTreeConfig navigationTreeConfig = navigationTreeModel.getConfig();
|
|
| 181 | + if (isAddNullGroupBy()) {
|
|
| 182 | + navigationTreeConfig.setLoadNullGroupBy(true);
|
|
| 183 | + navigationTreeModel.getClientConfig().saveTreeConfig(navigationTreeConfig);
|
|
| 184 | + navigationRequest.setLoadNullGroupBy(true);
|
|
| 185 | + }
|
|
| 186 | + if (isAddDisabledGroupBy()) {
|
|
| 187 | + navigationTreeConfig.setLoadDisabledGroupBy(true);
|
|
| 188 | + navigationRequest.setLoadDisabledGroupBy(true);
|
|
| 189 | + navigationTreeModel.getClientConfig().saveTreeConfig(navigationTreeConfig);
|
|
| 190 | + }
|
|
| 191 | + return navigationTreeModel.updateNavigationResult();
|
|
| 192 | + }
|
|
| 193 | + }
|
|
| 194 | + |
|
| 82 | 195 | public ContentRootOpenableUINavigationNode updateReference(NavigationUI navigationUI,
|
| 83 | 196 | ContentRootOpenableUINavigationNode node,
|
| 84 | - String id,
|
|
| 85 | - DataGroupByDto<D> oldGroupByDto,
|
|
| 86 | - boolean groupByChanged,
|
|
| 87 | - String newGroupByValue) {
|
|
| 197 | + ComputeNavigationRequestChange<D, U> computeNavigationRequestChange) {
|
|
| 88 | 198 | boolean notPersisted = node.getInitializer().isNotPersisted();
|
| 199 | + String id = computeNavigationRequestChange.getBean().getId();
|
|
| 200 | + DataGroupByDto<D> oldGroupByDto = computeNavigationRequestChange.getOldGroupByDto();
|
|
| 201 | + boolean groupByChanged = computeNavigationRequestChange.isGroupByChanged();
|
|
| 202 | + String newGroupByValue = computeNavigationRequestChange.getNewGroupByValue();
|
|
| 89 | 203 | ContentRootListUINavigationNode parent = node.getParent();
|
| 90 | 204 | if (groupByChanged) {
|
| 91 | 205 | // the navigation must be updated, new parent groupBy value has changed
|
| 92 | - NavigationResult navigationResult = navigationUI.getTree().getModel().updateNavigationResult();
|
|
| 206 | + NavigationResult navigationResult = computeNavigationRequestChange.updateNavigationResult(navigationUI.getTree().getModel());
|
|
| 93 | 207 | // groupBy has changed (remove node from parent)
|
| 94 | 208 | RootNavigationNode rootNode = (RootNavigationNode) node.getRoot();
|
| 95 | 209 | node.removeFromParent();
|
| ... | ... | @@ -140,6 +140,11 @@ |
| 140 | 140 | <artifactId>jaxb-runtime</artifactId>
|
| 141 | 141 | <scope>runtime</scope>
|
| 142 | 142 | </dependency>
|
| 143 | + <dependency>
|
|
| 144 | + <groupId>org.nuiton</groupId>
|
|
| 145 | + <artifactId>nuiton-converter</artifactId>
|
|
| 146 | + <scope>runtime</scope>
|
|
| 147 | + </dependency>
|
|
| 143 | 148 | <dependency>
|
| 144 | 149 | <groupId>${project.groupId}</groupId>
|
| 145 | 150 | <artifactId>client-datasource-editor-api-test</artifactId>
|
| ... | ... | @@ -927,6 +927,9 @@ observe.ui.tree.action.searchOrCreate.tip=Search or create a new trip |
| 927 | 927 | observe.ui.tree.action.selectAll.tip=Select All
|
| 928 | 928 | observe.ui.tree.action.unselectAll.tip=Unselect All
|
| 929 | 929 | observe.ui.tree.loaded=Tree reloaded (in %s)
|
| 930 | +observe.ui.tree.need.add.disabled.groupBy.message=The current navigation tree configuration do not allow to display disabled groupBy, configuration will be updated to enable this and make possible to display the saved trip.
|
|
| 931 | +observe.ui.tree.need.add.null.groupBy.message=The current navigation tree configuration do not allow to display not grouped groupBy, configuration will be updated to enable this and make possible to display the saved trip.
|
|
| 932 | +observe.ui.tree.need.reload.title=Navigation structure modification required
|
|
| 930 | 933 | observe.ui.tree.reload=Reload tree structure
|
| 931 | 934 | observe.ui.type.action.create=Create a new %s
|
| 932 | 935 | observe.ui.type.action.delete=Delete selected %s
|
| ... | ... | @@ -927,6 +927,9 @@ observe.ui.tree.action.searchOrCreate.tip=Search or create a new trip \#TODO |
| 927 | 927 | observe.ui.tree.action.selectAll.tip=Seleccionar todo
|
| 928 | 928 | observe.ui.tree.action.unselectAll.tip=Deseleccionar todo
|
| 929 | 929 | observe.ui.tree.loaded=Tree reloaded (in %s)
|
| 930 | +observe.ui.tree.need.add.disabled.groupBy.message=The current navigation tree configuration do not allow to display disabled groupBy, configuration will be updated to enable this and make possible to display the saved trip. #TODO
|
|
| 931 | +observe.ui.tree.need.add.null.groupBy.message=The current navigation tree configuration do not allow to display not grouped groupBy, configuration will be updated to enable this and make possible to display the saved trip. #TODO
|
|
| 932 | +observe.ui.tree.need.reload.title=Navigation structure modification required #TODO
|
|
| 930 | 933 | observe.ui.tree.reload=Reload tree structure
|
| 931 | 934 | observe.ui.type.action.create=Crear un objeto de tipo '%s'
|
| 932 | 935 | observe.ui.type.action.delete=Eliminar el objeto de tipo '%s' seleccionado
|
| ... | ... | @@ -927,6 +927,9 @@ observe.ui.tree.action.searchOrCreate.tip=Rechercher ou créer une nouvelle mar |
| 927 | 927 | observe.ui.tree.action.selectAll.tip=Tout sélectionner
|
| 928 | 928 | observe.ui.tree.action.unselectAll.tip=Tout désélectionner
|
| 929 | 929 | observe.ui.tree.loaded=Arbre rechargé (en %s)
|
| 930 | +observe.ui.tree.need.add.disabled.groupBy.message=La configuration actuelle de l'arbre de navigation ne permet pas d'afficher une modalité désactivée, elle sera modifiée dans ce sens afin de pouvoir afficher cette marée après enregistrement.
|
|
| 931 | +observe.ui.tree.need.add.null.groupBy.message=La configuration actuelle de l'arbre de navigation ne permet pas d'afficher une modalité nulle, elle sera modifiée dans ce sens afin de pouvoir afficher cette marée après enregistrement.
|
|
| 932 | +observe.ui.tree.need.reload.title=Adaptation de la structure de l'arbre requise
|
|
| 930 | 933 | observe.ui.tree.reload=Chargement de la structure de l'arbre
|
| 931 | 934 | observe.ui.type.action.create=Créer un objet de type '%s'
|
| 932 | 935 | observe.ui.type.action.delete=Supprimer l'objet de type '%s' sélectionné
|
| ... | ... | @@ -23,7 +23,7 @@ |
| 23 | 23 | <parent>
|
| 24 | 24 | <groupId>io.ultreia.maven</groupId>
|
| 25 | 25 | <artifactId>pom</artifactId>
|
| 26 | - <version>2024.03</version>
|
|
| 26 | + <version>2024.09</version>
|
|
| 27 | 27 | </parent>
|
| 28 | 28 | <groupId>fr.ird.observe</groupId>
|
| 29 | 29 | <artifactId>ird-observe</artifactId>
|
| ... | ... | @@ -113,7 +113,10 @@ |
| 113 | 113 | <!-- build timestamp configuration -->
|
| 114 | 114 | <maven.build.timestamp.format>dd/MM/yyyy HH:mm z</maven.build.timestamp.format>
|
| 115 | 115 | <buildDate>${maven.build.timestamp}</buildDate>
|
| 116 | - <lib.version.java4all.decorator>0.0.15</lib.version.java4all.decorator>
|
|
| 116 | + <!-- >>> Sealed version -->
|
|
| 117 | + <lib.version.java4all.jaxx>3.0.25</lib.version.java4all.jaxx>
|
|
| 118 | + <lib.version.java4all.validation>1.0.3</lib.version.java4all.validation>
|
|
| 119 | + <lib.version.java4all.i18n>4.0-beta-26</lib.version.java4all.i18n>
|
|
| 117 | 120 | <lib.version.ognl>3.1.29</lib.version.ognl>
|
| 118 | 121 | <!-- FIXME <lib.version.ognl>3.3.2</lib.version.ognl>-->
|
| 119 | 122 | <lib.version.h2>1.4.196</lib.version.h2>
|
| ... | ... | @@ -129,6 +132,7 @@ |
| 129 | 132 | <!-- FIXME <lib.version.jts>1.18.2</lib.version.jts>-->
|
| 130 | 133 | <lib.version.hsqldb>2.7.0</lib.version.hsqldb>
|
| 131 | 134 | <!-- FIXME <lib.version.hsqldb>2.7.1</lib.version.hsqldb>-->
|
| 135 | + <!-- <<< Sealed version -->
|
|
| 132 | 136 | <!-- license header configuration -->
|
| 133 | 137 | <license.licenseName>gpl_v3</license.licenseName>
|
| 134 | 138 | <license.organizationName>IRD, Ultreia.io</license.organizationName>
|
| ... | ... | @@ -87,6 +87,11 @@ |
| 87 | 87 | <artifactId>flexmark-util-data</artifactId>
|
| 88 | 88 | <scope>runtime</scope>
|
| 89 | 89 | </dependency>
|
| 90 | + <dependency>
|
|
| 91 | + <groupId>org.nuiton</groupId>
|
|
| 92 | + <artifactId>nuiton-converter</artifactId>
|
|
| 93 | + <scope>runtime</scope>
|
|
| 94 | + </dependency>
|
|
| 90 | 95 | </dependencies>
|
| 91 | 96 | <build>
|
| 92 | 97 | <finalName>${applicationName}-${project.version}</finalName>
|