Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe Commits: 8d3a3edb by Tony Chemit at 2022-05-18T09:27:33+02:00 Comportement de l'arbre quand à l'affichage des références - Closes 2338 - - - - - 2 changed files: - client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/config/TreeConfigUIHandler.java - client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/navigation/tree/root/RootNavigationInitializer.java Changes: ===================================== client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/config/TreeConfigUIHandler.java ===================================== @@ -222,6 +222,7 @@ public class TreeConfigUIHandler implements UIHandler<TreeConfigUI>, PropertyCha bean.addPropertyChangeListener(this); ui.getModel().open(); log.info(String.format("Init with configuration: %s", bean)); + onLoadDataChanged(bean.isLoadData()); reset(bean); } @@ -242,13 +243,7 @@ public class TreeConfigUIHandler implements UIHandler<TreeConfigUI>, PropertyCha case TreeConfig.LOAD_DATA: { updateOption(evt); boolean newValue = (boolean) evt.getNewValue(); - allModules.values().forEach(e -> e.setEnabled(newValue)); - allGroupBy.values().forEach(e -> e.setEnabled(newValue)); - groupByOptions.values().forEach(e -> e.setEnabled(newValue)); - String groupByName = ui.getModel().getBean().getGroupByName(); - if (groupByName != null) { - changeGroupByName(groupByName); - } + onLoadDataChanged(newValue); return; } case TreeConfig.LOAD_REFERENTIAL: @@ -284,7 +279,6 @@ public class TreeConfigUIHandler implements UIHandler<TreeConfigUI>, PropertyCha } } } - public void reset(TreeConfig bean) { String moduleName = bean.getModuleName(); String groupByName = bean.getGroupByName(); @@ -340,6 +334,16 @@ public class TreeConfigUIHandler implements UIHandler<TreeConfigUI>, PropertyCha } } + private void onLoadDataChanged(boolean newValue) { + allModules.values().forEach(e -> e.setEnabled(newValue)); + allGroupBy.values().forEach(e -> e.setEnabled(newValue)); + groupByOptions.values().forEach(e -> e.setEnabled(newValue)); + String groupByName = ui.getModel().getBean().getGroupByName(); + if (groupByName != null) { + changeGroupByName(groupByName); + } + } + private void updateOption(PropertyChangeEvent evt) { boolean oldValue = (boolean) evt.getOldValue(); boolean newValue = (boolean) evt.getNewValue(); ===================================== client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/navigation/tree/root/RootNavigationInitializer.java ===================================== @@ -117,7 +117,16 @@ public class RootNavigationInitializer extends NavigationInitializer<RootNavigat dataProvider.initRootDataNode(navigationResult, rootNode); } if (request.isLoadReferential()) { - getRootNodeProviders(Set.of("common", moduleName)).forEach(p -> p.initRootReferentialNode(rootNode, navigationResult)); + Stream<? extends RootNavigationTreeNodeProvider> referentialProviders; + if (request.isLoadData()) { + // only load common + this module + referentialProviders = getRootNodeProviders(Set.of("common", moduleName)); + } else { + // load all referential + // See https://gitlab.com/ultreiaio/ird-observe/-/issues/2338 + referentialProviders = getRootNodeProviders().stream(); + } + referentialProviders.forEach(p -> p.initRootReferentialNode(rootNode, navigationResult)); } } View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/commit/8d3a3edb97f831deecec354a48... -- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/commit/8d3a3edb97f831deecec354a48... You're receiving this email because of your account on gitlab.com.