Observe-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
May 2023
- 1 participants
- 51 discussions
[Git][ultreiaio/ird-observe][develop] Erreur en sortie de form lors du renommage d'un programme - Closes #2680
by Tony CHEMIT (@tchemit) 01 May '23
by Tony CHEMIT (@tchemit) 01 May '23
01 May '23
Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe
Commits:
901dabf4 by Tony Chemit at 2023-05-01T15:35:04+02:00
Erreur en sortie de form lors du renommage d'un programme - Closes #2680
- - - - -
10 changed files:
- client/configuration/src/main/filtered-resources/observe-log4j2.xml
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/data/rlist/ContentRootListUINavigationCapability.java
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/referential/actions/SaveContentReferentialUIAdapter.java
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/navigation/NavigationTreeModel.java
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/navigation/tree/root/RootNavigationCapability.java
- toolkit/api-i18n/src/main/i18n/translations/toolkit-api-i18n_en_GB.properties
- toolkit/api-i18n/src/main/i18n/translations/toolkit-api-i18n_es_ES.properties
- toolkit/api-i18n/src/main/i18n/translations/toolkit-api-i18n_fr_FR.properties
- toolkit/api/src/main/i18n/getters/java.getter
- toolkit/api/src/main/java/fr/ird/observe/dto/I18nDecoratorHelper.java
Changes:
=====================================
client/configuration/src/main/filtered-resources/observe-log4j2.xml
=====================================
@@ -103,6 +103,10 @@
<AppenderRef ref="console"/>
<AppenderRef ref="File"/>
</Logger>
+ <Logger name="fr.ird.observe.client.datasource.editor.api.navigation.NavigationTreeModel" level="info" additivity="false">
+ <AppenderRef ref="console"/>
+ <AppenderRef ref="File"/>
+ </Logger>
<Logger name="fr.ird.observe.client.datasource.editor.api.content.actions" level="warn" additivity="false">
<AppenderRef ref="console"/>
<AppenderRef ref="File"/>
=====================================
client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/data/rlist/ContentRootListUINavigationCapability.java
=====================================
@@ -51,6 +51,7 @@ public abstract class ContentRootListUINavigationCapability<N extends ContentRoo
@Override
public void updateReference(DataGroupByDto<?> reference) {
+ getNode().getInitializer().setParentReference(reference);
Enumeration<?> children = getNode().children();
while (children.hasMoreElements()) {
ContentRootOpenableUINavigationNode childrenNode = (ContentRootOpenableUINavigationNode) children.nextElement();
=====================================
client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/referential/actions/SaveContentReferentialUIAdapter.java
=====================================
@@ -64,24 +64,28 @@ public class SaveContentReferentialUIAdapter<D extends ReferentialDto, R extends
RootNavigationInitializer initializer = rootNode.getInitializer();
ToolkitTreeFlatModelRootRequest request = initializer.getRequest();
if (!request.isLoadData()) {
- return;
- }
- if (!bean.isEnabled() && !request.isLoadDisabledGroupBy()) {
- return;
- }
- if (notPersisted && !request.isLoadEmptyGroupBy()) {
+ // no data loading, no update to perform
return;
}
Class<?> groupByType = initializer.getGroupBy().getPropertyType();
if (!groupByType.equals(states.mainReferenceType())) {
+ // the groupBy type is not the navigation configuration one (no update to perform)
return;
}
String groupById = bean.getId();
if (notPersisted) {
- // add the new empty node
+ if (!request.isLoadEmptyGroupBy()) {
+ // navigation configuration won't add this node
+ return;
+ }
+ if (!bean.isEnabled() && !request.isLoadDisabledGroupBy()) {
+ // navigation configuration won't add this node
+ return;
+ }
+ // add the new groupBy node
rootNode.getCapability().createMissingNode(groupById);
} else {
- // get existing node
+ // update the (optional) groupBy node
rootNode.getCapability().updateChildNode(groupById);
}
}
=====================================
client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/navigation/NavigationTreeModel.java
=====================================
@@ -27,11 +27,8 @@ import fr.ird.observe.client.datasource.api.ObserveSwingDataSource;
import fr.ird.observe.client.datasource.editor.api.navigation.tree.NavigationNode;
import fr.ird.observe.client.datasource.editor.api.navigation.tree.root.RootNavigationInitializer;
import fr.ird.observe.client.datasource.editor.api.navigation.tree.root.RootNavigationNode;
-import fr.ird.observe.client.datasource.editor.api.navigation.tree.select.SelectNodeStrategy;
-import fr.ird.observe.client.datasource.editor.api.navigation.tree.select.SelectNodesByModel;
-import fr.ird.observe.client.datasource.editor.api.navigation.tree.select.SelectNodesByModelNode;
-import fr.ird.observe.client.datasource.editor.api.navigation.tree.select.SelectNodesByPath;
-import fr.ird.observe.client.datasource.editor.api.navigation.tree.select.SelectNodesDefault;
+import fr.ird.observe.client.datasource.editor.api.navigation.tree.select.*;
+import fr.ird.observe.dto.I18nDecoratorHelper;
import fr.ird.observe.navigation.id.IdNode;
import fr.ird.observe.navigation.id.Project;
import fr.ird.observe.navigation.tree.GroupByHelper;
@@ -49,10 +46,7 @@ import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreeNode;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Objects;
-import java.util.Optional;
+import java.util.*;
/**
* Created on 14/11/16.
@@ -220,23 +214,23 @@ public class NavigationTreeModel extends DefaultTreeModel implements WithClientU
protected NavigationResult createOrUpdateNavigationResult(NavigationResult navigationResult) {
NavigationService navigationService = getDataSourcesManager().getMainDataSource().getNavigationService();
+ Locale locale = getDecoratorService().getReferentialLocale().getLocale();
+ ToolkitTreeFlatModelRootRequest request;
+ Date timestamp;
NavigationResult newNavigationResult;
if (navigationResult == null) {
log.info("Ask for new navigation result (no previous result)");
- ToolkitTreeFlatModelRootRequest request = getConfig().toRootRequest(groupByHelper);
- newNavigationResult = navigationService.getNavigation(request, null);
- log.info("Generated new navigation result at: " + newNavigationResult.getTimestamp());
+ timestamp = null;
+ request = getConfig().toRootRequest(groupByHelper);
} else {
- log.info("Ask for new navigation result from: " + navigationResult.getTimestamp());
- newNavigationResult = navigationService.getNavigation(navigationResult.getRequest(), navigationResult.getTimestamp());
- if (newNavigationResult == null) {
- // reuse previous result
- log.info("Reuse previous navigation result from: " + navigationResult.getTimestamp());
- newNavigationResult = navigationResult;
- } else {
- log.info("Generated new navigation result at: " + newNavigationResult.getTimestamp());
- }
+ log.info("Ask for new navigation result from: " + I18nDecoratorHelper.getTimestampWithSecondsLabel(locale, navigationResult.getTimestamp()));
+ // Only on local mode, can always trust the service timestamp
+ // otherwise always use a null time stamp to skip null result by service
+ timestamp = getDataSourcesManager().getMainDataSource().isLocal() ? navigationResult.getTimestamp() : null;
+ request = navigationResult.getRequest();
}
+ newNavigationResult = navigationService.getNavigation(request, timestamp);
+ log.info("Generated new navigation result at: {}", I18nDecoratorHelper.getTimestampWithSecondsLabel(locale, newNavigationResult.getTimestamp()));
return newNavigationResult;
}
=====================================
client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/navigation/tree/root/RootNavigationCapability.java
=====================================
@@ -44,7 +44,6 @@ import java.util.stream.Collectors;
* @since 8.0.1
*/
public class RootNavigationCapability implements GroupByContainerCapability<RootNavigationNode> {
-
private final RootNavigationNode node;
private final SingletonSupplier<List<Class<? extends NavigationNode>>> acceptedNodeTypes;
@@ -90,20 +89,33 @@ public class RootNavigationCapability implements GroupByContainerCapability<Root
public void updateChildNode(String id) {
// Update also navigation result, this method is asking it
NavigationResult navigationResult = getNode().getInitializer().getTreeModel().updateNavigationResult();
+
+ ContentRootListUINavigationNode groupByNode = (ContentRootListUINavigationNode) getNode().findChildById(id);
+
DataGroupByDto<?> reference = navigationResult.getGroupBy(id);
- if (reference.decorator().isEmpty()) {
- getNode().getContext().getDecoratorService().installDecorator(reference);
+ if (reference == null) {
+ // this case can happen if groupBy is not compliant with the navigation configuration
+ if (groupByNode != null) {
+ // this case can happen if groupBy was compliant with the navigation configuration, but not any longer
+ // just remove the obsolete groupBy node
+ groupByNode.removeFromParent();
+ }
+ return;
+ }
+ if (groupByNode == null) {
+ // this case can happen if group by was disabled, then enabled and navigation configuration does not accept disabled groupBy
+ // we need just then to insert the new groupBy node
+ insertChildNode(reference);
+ return;
}
- ContentRootListUINavigationNode groupByNode = (ContentRootListUINavigationNode) getNode().findChildById(id);
- // Maybe position has changed ?
int oldNodePosition = getNode().getIndex(groupByNode);
int newNodePosition = getNodePosition(reference);
- groupByNode.getInitializer().setParentReference(reference);
+ // Propagate reference as parentReference to in children and as reference to this node
+ groupByNode.getCapability().updateReference(reference);
// need to update groupByNode
groupByNode.nodeChanged();
- // Propagate reference as parentReference to in children
- groupByNode.getCapability().updateReference(reference);
if (oldNodePosition != newNodePosition) {
+ // position has changed
getNode().moveNode(groupByNode, newNodePosition);
}
}
@@ -114,6 +126,7 @@ public class RootNavigationCapability implements GroupByContainerCapability<Root
NavigationResult navigationResult = getNode().getInitializer().getTreeModel().updateNavigationResult();
DataGroupByDto<?> reference = navigationResult.getGroupBy(id);
if (reference == null) {
+ //FIXME How the reference could not be found in navigation result?
reference = getNode().getContext().computeGroupByDto(id);
}
return insertChildNode(reference);
=====================================
toolkit/api-i18n/src/main/i18n/translations/toolkit-api-i18n_en_GB.properties
=====================================
@@ -49,6 +49,7 @@ observe.Common.none=None
observe.Common.size=%d element(s)
observe.Common.time.format=%1$tH\:%1$tM
observe.Common.timestamp.format=%1$tY-%1$tm-%1$td %1$tH\:%1$tM
+observe.Common.timestamp.seconds.format=%1$tY-%1$tm-%1$td %1$tH\:%1$tM\:%1$tS
observe.Common.type.data=Data
observe.Common.type.referential=Referential
observe.Common.undefined=Undefined
=====================================
toolkit/api-i18n/src/main/i18n/translations/toolkit-api-i18n_es_ES.properties
=====================================
@@ -49,6 +49,7 @@ observe.Common.none=Ninguno
observe.Common.size=%d element(s) \#TODO
observe.Common.time.format=%1$tH\:%1$tM
observe.Common.timestamp.format=%1$tY-%1$tm-%1$td %1$tH\:%1$tM
+observe.Common.timestamp.seconds.format=%1$tY-%1$tm-%1$td %1$tH\:%1$tM\:%1$tS
observe.Common.type.data=Datos
observe.Common.type.referential=Referential
observe.Common.undefined=indeterminado
=====================================
toolkit/api-i18n/src/main/i18n/translations/toolkit-api-i18n_fr_FR.properties
=====================================
@@ -49,6 +49,7 @@ observe.Common.none=Aucun
observe.Common.size=%d élément(s)
observe.Common.time.format=%1$tH\:%1$tM
observe.Common.timestamp.format=%1$td/%1$tm/%1$tY %1$tH\:%1$tM
+observe.Common.timestamp.seconds.format=%1$td/%1$tm/%1$tY %1$tH\:%1$tM\:%1$tS
observe.Common.type.data=Donnée
observe.Common.type.referential=Référentiel
observe.Common.undefined=Non défini
=====================================
toolkit/api/src/main/i18n/getters/java.getter
=====================================
@@ -25,6 +25,7 @@ observe.Common.no.coordinate
observe.Common.no.value
observe.Common.time.format
observe.Common.timestamp.format
+observe.Common.timestamp.seconds.format
observe.Common.type.data
observe.Common.type.referential
observe.Common.undefined
=====================================
toolkit/api/src/main/java/fr/ird/observe/dto/I18nDecoratorHelper.java
=====================================
@@ -156,23 +156,26 @@ public abstract class I18nDecoratorHelper extends BeanPropertyI18nKeyProducerPro
}
public static String getTimestampLabel(Locale locale, Date date) {
-
return I18n.l(locale, "observe.Common.timestamp.format", date);
}
+ public static String getTimestampWithSecondsLabel(Locale locale, Date date) {
+ return I18n.l(locale, "observe.Common.timestamp.seconds.format", date);
+ }
+
public static String getTimeLabel(Locale locale, Date date) {
return I18n.l(locale, "observe.Common.time.format", date);
}
public static String getSpeedRange(Locale locale, Integer minValue, Integer maxValue) {
- String min = minValue == null ? "" : minValue + "";
- String max = maxValue == null ? "" : maxValue + "";
+ String min = minValue == null ? "" : String.valueOf(minValue);
+ String max = maxValue == null ? "" : String.valueOf(maxValue);
return I18n.l(locale, "observe.referential.common.Wind.speedRange") + String.format("[%-4s < %-4s]", min, max);
}
public static String getSwellHeight(Locale locale, Float minValue, Float maxValue) {
- String min = minValue == null ? "" : minValue + "";
- String max = maxValue == null ? "" : maxValue + "";
+ String min = minValue == null ? "" : String.valueOf(minValue);
+ String max = maxValue == null ? "" : String.valueOf(maxValue);
return I18n.l(locale, "observe.referential.common.Wind.swellHeight") + String.format("[%-4s < %-4s]", min, max);
}
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/commit/901dabf431af0e750e89e4741…
--
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/commit/901dabf431af0e750e89e4741…
You're receiving this email because of your account on gitlab.com.
1
0