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

Commits:

2 changed files:

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
    222 222
             bean.addPropertyChangeListener(this);
    
    223 223
             ui.getModel().open();
    
    224 224
             log.info(String.format("Init with configuration: %s", bean));
    
    225
    +        onLoadDataChanged(bean.isLoadData());
    
    225 226
             reset(bean);
    
    226 227
         }
    
    227 228
     
    
    ... ... @@ -242,13 +243,7 @@ public class TreeConfigUIHandler implements UIHandler<TreeConfigUI>, PropertyCha
    242 243
                 case TreeConfig.LOAD_DATA: {
    
    243 244
                     updateOption(evt);
    
    244 245
                     boolean newValue = (boolean) evt.getNewValue();
    
    245
    -                allModules.values().forEach(e -> e.setEnabled(newValue));
    
    246
    -                allGroupBy.values().forEach(e -> e.setEnabled(newValue));
    
    247
    -                groupByOptions.values().forEach(e -> e.setEnabled(newValue));
    
    248
    -                String groupByName = ui.getModel().getBean().getGroupByName();
    
    249
    -                if (groupByName != null) {
    
    250
    -                    changeGroupByName(groupByName);
    
    251
    -                }
    
    246
    +                onLoadDataChanged(newValue);
    
    252 247
                     return;
    
    253 248
                 }
    
    254 249
                 case TreeConfig.LOAD_REFERENTIAL:
    
    ... ... @@ -284,7 +279,6 @@ public class TreeConfigUIHandler implements UIHandler<TreeConfigUI>, PropertyCha
    284 279
                 }
    
    285 280
             }
    
    286 281
         }
    
    287
    -
    
    288 282
         public void reset(TreeConfig bean) {
    
    289 283
             String moduleName = bean.getModuleName();
    
    290 284
             String groupByName = bean.getGroupByName();
    
    ... ... @@ -340,6 +334,16 @@ public class TreeConfigUIHandler implements UIHandler<TreeConfigUI>, PropertyCha
    340 334
             }
    
    341 335
         }
    
    342 336
     
    
    337
    +    private void onLoadDataChanged(boolean newValue) {
    
    338
    +        allModules.values().forEach(e -> e.setEnabled(newValue));
    
    339
    +        allGroupBy.values().forEach(e -> e.setEnabled(newValue));
    
    340
    +        groupByOptions.values().forEach(e -> e.setEnabled(newValue));
    
    341
    +        String groupByName = ui.getModel().getBean().getGroupByName();
    
    342
    +        if (groupByName != null) {
    
    343
    +            changeGroupByName(groupByName);
    
    344
    +        }
    
    345
    +    }
    
    346
    +
    
    343 347
         private void updateOption(PropertyChangeEvent evt) {
    
    344 348
             boolean oldValue = (boolean) evt.getOldValue();
    
    345 349
             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
    117 117
                 dataProvider.initRootDataNode(navigationResult, rootNode);
    
    118 118
             }
    
    119 119
             if (request.isLoadReferential()) {
    
    120
    -            getRootNodeProviders(Set.of("common", moduleName)).forEach(p -> p.initRootReferentialNode(rootNode, navigationResult));
    
    120
    +            Stream<? extends RootNavigationTreeNodeProvider> referentialProviders;
    
    121
    +            if (request.isLoadData()) {
    
    122
    +                // only load common + this module
    
    123
    +                referentialProviders = getRootNodeProviders(Set.of("common", moduleName));
    
    124
    +            } else {
    
    125
    +                // load all referential
    
    126
    +                // See https://gitlab.com/ultreiaio/ird-observe/-/issues/2338
    
    127
    +                referentialProviders = getRootNodeProviders().stream();
    
    128
    +            }
    
    129
    +            referentialProviders.forEach(p -> p.initRootReferentialNode(rootNode, navigationResult));
    
    121 130
             }
    
    122 131
         }
    
    123 132