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

Commits:

11 changed files:

Changes:

  • client/datasource/actions/src/main/i18n/getters/java.getter
    ... ... @@ -15,6 +15,7 @@ observe.ui.action.close
    15 15
     observe.ui.action.close.synchro.tip
    
    16 16
     observe.ui.action.config.export.required.write.data
    
    17 17
     observe.ui.action.config.left.datasource.required.write.data
    
    18
    +observe.ui.action.configuration.tip
    
    18 19
     observe.ui.action.continue
    
    19 20
     observe.ui.action.copy.to.clipBoard
    
    20 21
     observe.ui.action.do.backup.tip
    
    ... ... @@ -25,7 +26,6 @@ observe.ui.action.goto.previous.stage.tip
    25 26
     observe.ui.action.info.storage.tip
    
    26 27
     observe.ui.choice.cancel
    
    27 28
     observe.ui.choice.replace
    
    28
    -observe.ui.content.action.configure.tip
    
    29 29
     observe.ui.datasource.actions.config.data.sources.equals
    
    30 30
     observe.ui.datasource.editor.actions.activity.pairing
    
    31 31
     observe.ui.datasource.editor.actions.consolidate
    

  • client/datasource/editor/api/src/main/i18n/getters/java.getter
    ... ... @@ -165,6 +165,7 @@ observe.ui.action.info.storage
    165 165
     observe.ui.action.info.storage.tip
    
    166 166
     observe.ui.action.load.from.file
    
    167 167
     observe.ui.action.load.from.file.tip
    
    168
    +observe.ui.action.move.groupBy.configuration
    
    168 169
     observe.ui.action.move.layout.multiple.message
    
    169 170
     observe.ui.action.move.layout.single.message
    
    170 171
     observe.ui.action.move.message
    

  • client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/config/TreeConfigUIHandler.java
    ... ... @@ -157,8 +157,6 @@ public class TreeConfigUIHandler implements UIHandler<TreeConfigUI>, PropertyCha
    157 157
             disableOption(ui, TreeConfig.LOAD_DATA);
    
    158 158
             disableOption(ui, TreeConfig.LOAD_REFERENTIAL);
    
    159 159
             disableOption(ui, TreeConfig.LOAD_EMPTY_GROUP_BY);
    
    160
    -//        disableOption(ui, TreeConfig.LOAD_DISABLED_GROUP_BY);
    
    161
    -//        disableOption(ui, TreeConfig.LOAD_NULL_GROUP_BY);
    
    162 160
         }
    
    163 161
     
    
    164 162
         public static void disableOption(TreeConfigUI ui, String id) {
    
    ... ... @@ -170,6 +168,10 @@ public class TreeConfigUIHandler implements UIHandler<TreeConfigUI>, PropertyCha
    170 168
             ui.getSelectionPanel().setVisible(false);
    
    171 169
         }
    
    172 170
     
    
    171
    +    public static void hideModule(TreeConfigUI ui) {
    
    172
    +        ui.getModuleChoose().setVisible(false);
    
    173
    +    }
    
    174
    +
    
    173 175
         public TreeConfigUIHandler() {
    
    174 176
             allModules = new TreeMap<>();
    
    175 177
             allGroupBy = ArrayListMultimap.create();
    
    ... ... @@ -223,6 +225,16 @@ public class TreeConfigUIHandler implements UIHandler<TreeConfigUI>, PropertyCha
    223 225
             reset(bean);
    
    224 226
         }
    
    225 227
     
    
    228
    +    public void updateOptions(){
    
    229
    +        for (Map.Entry<String, Collection<AbstractButton>> entry : groupByOptions.asMap().entrySet()) {
    
    230
    +            entry.getValue().forEach(c -> {
    
    231
    +                if (Objects.equals(true, c.getClientProperty(DISABLED))) {
    
    232
    +                    c.setEnabled(false);
    
    233
    +                }
    
    234
    +            });
    
    235
    +        }
    
    236
    +    }
    
    237
    +
    
    226 238
         @Override
    
    227 239
         public void propertyChange(PropertyChangeEvent evt) {
    
    228 240
             String propertyName = evt.getPropertyName();
    

  • client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/actions/move/layout/MoveLayoutApplyNavigationConfiguration.java
    1
    +package fr.ird.observe.client.datasource.editor.api.content.actions.move.layout;
    
    2
    +
    
    3
    +/*-
    
    4
    + * #%L
    
    5
    + * ObServe Client :: DataSource :: Editor :: API
    
    6
    + * %%
    
    7
    + * Copyright (C) 2008 - 2022 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.datasource.editor.api.config.TreeConfigUI;
    
    26
    +import fr.ird.observe.client.datasource.editor.api.config.actions.ApplyConfigurationSupport;
    
    27
    +import fr.ird.observe.navigation.tree.TreeConfig;
    
    28
    +
    
    29
    +/**
    
    30
    + * Created on 19/04/2022.
    
    31
    + *
    
    32
    + * @author Tony Chemit - dev@tchemit.fr
    
    33
    + * @since 9.0.0
    
    34
    + */
    
    35
    +public class MoveLayoutApplyNavigationConfiguration extends ApplyConfigurationSupport {
    
    36
    +    private final MoveLayoutRequestBuilder moveLayoutRequestBuilder;
    
    37
    +
    
    38
    +    public MoveLayoutApplyNavigationConfiguration(MoveLayoutRequestBuilder moveLayoutRequestBuilder) {
    
    39
    +        this.moveLayoutRequestBuilder = moveLayoutRequestBuilder;
    
    40
    +    }
    
    41
    +
    
    42
    +    @Override
    
    43
    +    protected void saveConfiguration(TreeConfig originalConfig) {
    
    44
    +        // never save to application configuration
    
    45
    +    }
    
    46
    +
    
    47
    +    @Override
    
    48
    +    protected void applyConsumer(TreeConfigUI ui, boolean canReselectNode) {
    
    49
    +        moveLayoutRequestBuilder.updateConfiguration(ui.getModel().getBean());
    
    50
    +    }
    
    51
    +}

  • client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/actions/move/layout/MoveLayoutRequestBuilder.java
    ... ... @@ -22,10 +22,17 @@ package fr.ird.observe.client.datasource.editor.api.content.actions.move.layout;
    22 22
      * #L%
    
    23 23
      */
    
    24 24
     
    
    25
    -import fr.ird.observe.client.ClientUIContextApplicationComponent;
    
    25
    +import fr.ird.observe.client.WithClientUIContextApi;
    
    26 26
     import fr.ird.observe.client.datasource.editor.api.DataSourceEditor;
    
    27 27
     import fr.ird.observe.client.datasource.editor.api.ObserveKeyStrokesEditorApi;
    
    28
    +import fr.ird.observe.client.datasource.editor.api.config.TreeConfigUI;
    
    29
    +import fr.ird.observe.client.datasource.editor.api.config.TreeConfigUIHandler;
    
    30
    +import fr.ird.observe.client.datasource.editor.api.config.TreeStatistics;
    
    31
    +import fr.ird.observe.client.datasource.editor.api.config.TreeStatisticsTemplate;
    
    28 32
     import fr.ird.observe.client.datasource.editor.api.content.actions.mode.ChangeMode;
    
    33
    +import fr.ird.observe.client.datasource.editor.api.navigation.NavigationTreeModel;
    
    34
    +import fr.ird.observe.client.datasource.editor.api.navigation.NavigationUI;
    
    35
    +import fr.ird.observe.client.datasource.editor.api.navigation.tree.root.RootNavigationInitializer;
    
    29 36
     import fr.ird.observe.client.datasource.usage.UsageUIHandlerSupport;
    
    30 37
     import fr.ird.observe.client.util.DtoIconHelper;
    
    31 38
     import fr.ird.observe.client.util.UIHelper;
    
    ... ... @@ -33,9 +40,15 @@ import fr.ird.observe.dto.BusinessDto;
    33 40
     import fr.ird.observe.dto.ToolkitIdDtoBean;
    
    34 41
     import fr.ird.observe.dto.ToolkitIdLabel;
    
    35 42
     import fr.ird.observe.dto.data.DataDto;
    
    43
    +import fr.ird.observe.dto.data.DataGroupByDto;
    
    36 44
     import fr.ird.observe.dto.data.DataGroupByParameter;
    
    45
    +import fr.ird.observe.dto.reference.DataGroupByDtoSet;
    
    37 46
     import fr.ird.observe.navigation.id.CloseNodeVetoException;
    
    38 47
     import fr.ird.observe.navigation.id.IdNode;
    
    48
    +import fr.ird.observe.navigation.tree.GroupByHelper;
    
    49
    +import fr.ird.observe.navigation.tree.TreeConfig;
    
    50
    +import fr.ird.observe.navigation.tree.io.request.ToolkitTreeFlatModelRootRequest;
    
    51
    +import fr.ird.observe.services.service.NavigationService;
    
    39 52
     import fr.ird.observe.services.service.data.MoveLayoutRequest;
    
    40 53
     import fr.ird.observe.spi.decoration.I18nDecoratorHelper;
    
    41 54
     import io.ultreia.java4all.decoration.Decorator;
    
    ... ... @@ -46,15 +59,21 @@ import org.apache.logging.log4j.Logger;
    46 59
     import javax.swing.AbstractAction;
    
    47 60
     import javax.swing.Action;
    
    48 61
     import javax.swing.ActionMap;
    
    62
    +import javax.swing.BorderFactory;
    
    63
    +import javax.swing.DefaultComboBoxModel;
    
    49 64
     import javax.swing.InputMap;
    
    50 65
     import javax.swing.JButton;
    
    51 66
     import javax.swing.JCheckBox;
    
    67
    +import javax.swing.JComboBox;
    
    52 68
     import javax.swing.JComponent;
    
    69
    +import javax.swing.JDialog;
    
    53 70
     import javax.swing.JLabel;
    
    54 71
     import javax.swing.JLayeredPane;
    
    55 72
     import javax.swing.JOptionPane;
    
    56 73
     import javax.swing.JPanel;
    
    74
    +import javax.swing.JPopupMenu;
    
    57 75
     import javax.swing.JSeparator;
    
    76
    +import javax.swing.JToolBar;
    
    58 77
     import javax.swing.KeyStroke;
    
    59 78
     import javax.swing.SwingConstants;
    
    60 79
     import javax.swing.SwingUtilities;
    
    ... ... @@ -62,6 +81,7 @@ import java.awt.BorderLayout;
    62 81
     import java.awt.Font;
    
    63 82
     import java.awt.GridLayout;
    
    64 83
     import java.awt.event.ActionEvent;
    
    84
    +import java.awt.event.ItemEvent;
    
    65 85
     import java.util.LinkedHashSet;
    
    66 86
     import java.util.List;
    
    67 87
     import java.util.Objects;
    
    ... ... @@ -79,7 +99,7 @@ import static io.ultreia.java4all.i18n.I18n.t;
    79 99
      * @since 8.0.1
    
    80 100
      */
    
    81 101
     @SuppressWarnings("UnusedReturnValue")
    
    82
    -public class MoveLayoutRequestBuilder {
    
    102
    +public class MoveLayoutRequestBuilder implements WithClientUIContextApi {
    
    83 103
     
    
    84 104
         private static final Logger log = LogManager.getLogger(MoveLayoutRequestBuilder.class);
    
    85 105
         /**
    
    ... ... @@ -102,6 +122,10 @@ public class MoveLayoutRequestBuilder {
    102 122
          * Apply action.
    
    103 123
          */
    
    104 124
         private final AbstractAction applyAction;
    
    125
    +    /**
    
    126
    +     * Apply action.
    
    127
    +     */
    
    128
    +    private final AbstractAction configureAction;
    
    105 129
         /**
    
    106 130
          * Optional edit node.
    
    107 131
          */
    
    ... ... @@ -144,6 +168,16 @@ public class MoveLayoutRequestBuilder {
    144 168
          * Selected layout types.
    
    145 169
          */
    
    146 170
         private Set<Class<? extends DataDto>> selectedLayoutTypes;
    
    171
    +    private DataSourceEditor dataSourceEditor;
    
    172
    +    private FilterableComboBox<ToolkitIdLabel> parentEditor;
    
    173
    +    private JPanel groupByNamePanel;
    
    174
    +    private JLabel groupByNameLabel;
    
    175
    +    private GroupByHelper groupByHelper;
    
    176
    +    private ToolkitTreeFlatModelRootRequest rootRequest;
    
    177
    +    private JComboBox<DataGroupByDto<?>> groupByValuesEditor;
    
    178
    +    private DataGroupByDtoSet<?, ?> dataGroupByDtoSet;
    
    179
    +    private TreeConfig treeConfig;
    
    180
    +    private String groupByParameterValue;
    
    147 181
     
    
    148 182
         static class BuilderImpl implements StepSetParentCandidates, StepBuild {
    
    149 183
             private final MoveLayoutRequestBuilder builder;
    
    ... ... @@ -215,12 +249,24 @@ public class MoveLayoutRequestBuilder {
    215 249
             applyAction = new AbstractAction() {
    
    216 250
                 @Override
    
    217 251
                 public void actionPerformed(ActionEvent e) {
    
    218
    -                log.info("Apply :)");
    
    219 252
                     jButton.doClick();
    
    220 253
                 }
    
    221 254
             };
    
    222 255
             applyAction.putValue(Action.ACCELERATOR_KEY, keyStroke);
    
    223 256
             applyAction.putValue(Action.NAME, t);
    
    257
    +        keyStroke = ObserveKeyStrokesEditorApi.KEY_STROKE_INSERT_CONFIGURE;
    
    258
    +        t = ObserveKeyStrokesEditorApi.suffixTextWithKeyStroke("", keyStroke);
    
    259
    +        String tip = ObserveKeyStrokesEditorApi.suffixTextWithKeyStroke(t("observe.ui.tree.action.configure.tip"), keyStroke);
    
    260
    +        configureAction = new AbstractAction() {
    
    261
    +            @Override
    
    262
    +            public void actionPerformed(ActionEvent e) {
    
    263
    +                doConfigure();
    
    264
    +            }
    
    265
    +        };
    
    266
    +        configureAction.putValue(Action.LARGE_ICON_KEY, UIHelper.getUIManagerActionIcon("generate"));
    
    267
    +        configureAction.putValue(Action.ACCELERATOR_KEY, keyStroke);
    
    268
    +        configureAction.putValue(Action.NAME, t);
    
    269
    +        configureAction.putValue(Action.SHORT_DESCRIPTION, tip);
    
    224 270
         }
    
    225 271
     
    
    226 272
         private MoveLayoutRequestBuilder setEditNode(IdNode<?> editNode) {
    
    ... ... @@ -244,6 +290,7 @@ public class MoveLayoutRequestBuilder {
    244 290
         }
    
    245 291
     
    
    246 292
         public Optional<MoveLayoutRequest> build(DataSourceEditor dataSourceEditor) {
    
    293
    +        this.dataSourceEditor = dataSourceEditor;
    
    247 294
             if (parentTargetDtoType == null) {
    
    248 295
                 parentTargetDtoType = oldParentId.getType();
    
    249 296
             }
    
    ... ... @@ -254,8 +301,19 @@ public class MoveLayoutRequestBuilder {
    254 301
                 askNewParentMessage = I18nDecoratorHelper.getPropertyI18nKey(dtoType, "action.move.all.choose.parent.message");
    
    255 302
             }
    
    256 303
             Objects.requireNonNull(availableLayoutTypes, "No availableLayoutTypes declared in builder");
    
    257
    -        DataGroupByParameter groupBy = Objects.requireNonNull(this.groupByValueSupplier, "No groupByValue supplier set.").get();
    
    258
    -        List<ToolkitIdLabel> parentCandidates = Objects.requireNonNull(this.parentCandidates, "No parent candidates set.").apply(groupBy, oldParentId.getId());
    
    304
    +        DataGroupByParameter dataGroupByParameter = Objects.requireNonNull(this.groupByValueSupplier, "No groupByValue supplier set.").get();
    
    305
    +
    
    306
    +        groupByParameterValue = dataGroupByParameter.getValue();
    
    307
    +
    
    308
    +        NavigationTreeModel navigationTreeModel = dataSourceEditor.getNavigationUI().getTree().getModel();
    
    309
    +        groupByHelper = navigationTreeModel.getGroupByHelper();
    
    310
    +
    
    311
    +        RootNavigationInitializer initializer = navigationTreeModel.getRoot().getInitializer();
    
    312
    +        rootRequest = initializer.getRequest();
    
    313
    +        dataGroupByDtoSet = initializer.getGroupBy();
    
    314
    +        treeConfig = new TreeConfig();
    
    315
    +        treeConfig.init(navigationTreeModel.getConfig());
    
    316
    +        List<ToolkitIdLabel> parentCandidates = Objects.requireNonNull(this.parentCandidates, "No parent candidates set.").apply(dataGroupByParameter, oldParentId.getId());
    
    259 317
             ToolkitIdLabel newParentId = askNewParent(parentCandidates, askNewParentTitle, askNewParentMessage).orElse(null);
    
    260 318
             if (newParentId == null) {
    
    261 319
                 return Optional.empty();
    
    ... ... @@ -275,14 +333,13 @@ public class MoveLayoutRequestBuilder {
    275 333
         }
    
    276 334
     
    
    277 335
         private Optional<ToolkitIdLabel> askNewParent(List<ToolkitIdLabel> parentCandidates, String dialogTitle, String dialogMessage) {
    
    278
    -        Decorator decorator = ClientUIContextApplicationComponent.value().getDecoratorService().getToolkitIdLabelDecoratorByType(parentTargetDtoType);
    
    279
    -        FilterableComboBox<ToolkitIdLabel> editor = UIHelper.newToolkitIdLabelFilterableComboBox(parentTargetDtoType, decorator, parentCandidates);
    
    336
    +        Decorator decorator = getDecoratorService().getToolkitIdLabelDecoratorByType(parentTargetDtoType);
    
    337
    +        parentEditor = UIHelper.newToolkitIdLabelFilterableComboBox(parentTargetDtoType, decorator, parentCandidates);
    
    280 338
     
    
    281 339
             String continueActionText = (String) applyAction.getValue(Action.NAME);
    
    282 340
             Object[] options = {continueActionText};
    
    283 341
             JPanel panel = new JPanel(new BorderLayout(3, 3));
    
    284 342
     
    
    285
    -        JPanel panelNorth = new JPanel(new BorderLayout());
    
    286 343
             JPanel panelMessages = new JPanel(new BorderLayout(3, 3));
    
    287 344
             boolean single = availableLayoutTypes.size() == 1;
    
    288 345
     
    
    ... ... @@ -297,20 +354,42 @@ public class MoveLayoutRequestBuilder {
    297 354
     
    
    298 355
             panelMessages.add(BorderLayout.NORTH, new JLabel(message));
    
    299 356
     
    
    300
    -        JPanel panelMessage2 = new JPanel(new GridLayout(0, 1));
    
    301
    -        panelMessage2.add(new JLabel());
    
    302
    -        panelMessage2.add(new JLabel(t(dialogMessage)));
    
    303
    -        panelMessages.add(BorderLayout.SOUTH, panelMessage2);
    
    357
    +        groupByNamePanel = new JPanel(new BorderLayout());
    
    358
    +        groupByNamePanel.setBorder(BorderFactory.createTitledBorder(/*BorderFactory.createLoweredBevelBorder(),*/ t("observe.Common.navigation.config.groupByName") + "      "));
    
    304 359
     
    
    305
    -        panelNorth.add(BorderLayout.NORTH, panelMessages);
    
    306
    -        panelNorth.add(BorderLayout.CENTER, editor);
    
    360
    +        JToolBar toolBar = new JToolBar();
    
    361
    +        toolBar.setBorderPainted(false);
    
    362
    +        toolBar.setFloatable(false);
    
    363
    +        toolBar.add(new JButton(configureAction));
    
    364
    +
    
    365
    +        groupByNamePanel.add(BorderLayout.CENTER, groupByNameLabel = new JLabel(""));
    
    366
    +        groupByNamePanel.add(BorderLayout.EAST, toolBar);
    
    367
    +        groupByNamePanel.add(BorderLayout.SOUTH, groupByValuesEditor = new JComboBox<>());
    
    368
    +
    
    369
    +
    
    370
    +        JPanel panelConfiguration = new JPanel(new BorderLayout());
    
    371
    +        parentEditor.setBorder(BorderFactory.createTitledBorder(/*BorderFactory.createLoweredBevelBorder(),*/t(dialogMessage) + "      "));
    
    372
    +
    
    373
    +        panelConfiguration.add(BorderLayout.CENTER, groupByNamePanel);
    
    374
    +        panelConfiguration.add(BorderLayout.SOUTH, parentEditor);
    
    375
    +
    
    376
    +        updateConfigurationLabel();
    
    377
    +
    
    378
    +        updateGroupByValues();
    
    379
    +
    
    380
    +        groupByValuesEditor.addItemListener(e -> {
    
    381
    +            if (e.getStateChange() != ItemEvent.SELECTED) {
    
    382
    +                return;
    
    383
    +            }
    
    384
    +            DataGroupByDto<?> newGroupByValue = (DataGroupByDto<?>) e.getItem();
    
    385
    +            onGroupByValueChanged(newGroupByValue);
    
    386
    +        });
    
    307 387
     
    
    308 388
             JPanel panelSelectTarget = new JPanel(new GridLayout(0, 1));
    
    309 389
             //FIXME:Move Add a default client configuration option to set this value
    
    310 390
             selectTarget.setSelected(true);
    
    311 391
             panelSelectTarget.add(new JLabel());
    
    312 392
             panelSelectTarget.add(selectTarget);
    
    313
    -        panelNorth.add(BorderLayout.SOUTH, panelSelectTarget);
    
    314 393
     
    
    315 394
             JPanel panelSouth = new JPanel(new GridLayout(0, 1));
    
    316 395
             panelSouth.add(BorderLayout.NORTH, new JSeparator(SwingConstants.HORIZONTAL));
    
    ... ... @@ -318,19 +397,27 @@ public class MoveLayoutRequestBuilder {
    318 397
             information.setFont(information.getFont().deriveFont(Font.ITALIC).deriveFont(11f));
    
    319 398
             panelSouth.add(BorderLayout.CENTER, information);
    
    320 399
     
    
    400
    +        JPanel panelNorth = new JPanel(new BorderLayout());
    
    401
    +        panelNorth.add(BorderLayout.NORTH, panelMessages);
    
    402
    +        panelNorth.add(BorderLayout.CENTER, panelConfiguration);
    
    403
    +        panelNorth.add(BorderLayout.SOUTH, panelSelectTarget);
    
    404
    +
    
    321 405
             panel.add(BorderLayout.NORTH, panelNorth);
    
    322 406
             panel.add(BorderLayout.SOUTH, panelSouth);
    
    323 407
     
    
    324 408
             InputMap inputMap1 = panel.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
    
    325 409
             inputMap1.put((KeyStroke) selectTargetAction.getValue(Action.ACCELERATOR_KEY), "selectTarget");
    
    410
    +        inputMap1.put((KeyStroke) configureAction.getValue(Action.ACCELERATOR_KEY), "configure");
    
    326 411
     
    
    327 412
             InputMap inputMap = panel.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
    
    328 413
             inputMap.put((KeyStroke) selectTargetAction.getValue(Action.ACCELERATOR_KEY), "selectTarget");
    
    329 414
             inputMap.put((KeyStroke) applyAction.getValue(Action.ACCELERATOR_KEY), "apply");
    
    415
    +        inputMap.put((KeyStroke) configureAction.getValue(Action.ACCELERATOR_KEY), "configure");
    
    330 416
     
    
    331 417
             ActionMap actionMap = panel.getActionMap();
    
    332 418
             actionMap.put("selectTarget", selectTargetAction);
    
    333 419
             actionMap.put("apply", applyAction);
    
    420
    +        actionMap.put("configure", configureAction);
    
    334 421
     
    
    335 422
     
    
    336 423
             optionPane = new JOptionPane(panel, JOptionPane.QUESTION_MESSAGE, JOptionPane.DEFAULT_OPTION, null, options, options[0]) {
    
    ... ... @@ -343,18 +430,18 @@ public class MoveLayoutRequestBuilder {
    343 430
     
    
    344 431
                     inputMap.put(KeyStroke.getKeyStroke("pressed ENTER"), "none");
    
    345 432
                     inputMap.put(KeyStroke.getKeyStroke("ctrl pressed ENTER"), "none");
    
    346
    -                if (editor.getCombobox().getModel().getSize() == 1) {
    
    433
    +                if (parentEditor.getCombobox().getModel().getSize() == 1) {
    
    347 434
                         // auto-select unique data
    
    348
    -                    editor.setSelectedItem(parentCandidates.get(0));
    
    435
    +                    parentEditor.setSelectedItem(parentCandidates.get(0));
    
    349 436
                     }
    
    350
    -                SwingUtilities.invokeLater(editor.getCombobox()::requestFocus);
    
    437
    +                SwingUtilities.invokeLater(parentEditor.getCombobox()::requestFocus);
    
    351 438
                 }
    
    352 439
             };
    
    440
    +        optionPane.setComponentPopupMenu(new JPopupMenu());
    
    353 441
             jButton = UsageUIHandlerSupport.findButton(optionPane, continueActionText);
    
    354 442
             Objects.requireNonNull(jButton).setIcon(UIHelper.getUIManagerActionIcon("move"));
    
    355 443
             jButton.setEnabled(false);
    
    356
    -        editor.getModel().addPropertyChangeListener("selectedItem", evt -> jButton.setEnabled(canMove(evt.getNewValue())));
    
    357
    -
    
    444
    +        parentEditor.getModel().addPropertyChangeListener("selectedItem", evt -> jButton.setEnabled(canMove(evt.getNewValue())));
    
    358 445
             if (!single) {
    
    359 446
                 JPanel typesPanel = new JPanel(new GridLayout(0, 1));
    
    360 447
                 int index = 1;
    
    ... ... @@ -363,7 +450,7 @@ public class MoveLayoutRequestBuilder {
    363 450
                     Action typeAction = new AbstractAction() {
    
    364 451
                         @Override
    
    365 452
                         public void actionPerformed(ActionEvent e) {
    
    366
    -                        jButton.setEnabled(updateSelectedType(typeEditor, type, editor));
    
    453
    +                        jButton.setEnabled(updateSelectedType(typeEditor, type, parentEditor));
    
    367 454
                         }
    
    368 455
                     };
    
    369 456
                     String actionName = "Select-" + type.getName();
    
    ... ... @@ -382,15 +469,15 @@ public class MoveLayoutRequestBuilder {
    382 469
                     typesPanel.add(typeEditor);
    
    383 470
                     index++;
    
    384 471
                 }
    
    385
    -
    
    386 472
                 panelMessages.add(BorderLayout.CENTER, typesPanel);
    
    387 473
             }
    
    388
    -        int response = UIHelper.askUser(ClientUIContextApplicationComponent.value().getMainUI(), optionPane, t(dialogTitle), options);
    
    474
    +        panelMessages.add(BorderLayout.SOUTH, new JLabel(""));
    
    475
    +        int response = UIHelper.askUser(getMainUI(), optionPane, t(dialogTitle), options);
    
    389 476
     
    
    390 477
             ToolkitIdLabel newParent = null;
    
    391 478
             if (response == 0) {
    
    392 479
                 // will replace and delete
    
    393
    -            newParent = editor.getModel().getSelectedItem();
    
    480
    +            newParent = parentEditor.getModel().getSelectedItem();
    
    394 481
                 log.info(String.format("Selected parent id: %s", newParent));
    
    395 482
             }
    
    396 483
             if (newParent == null || selectedLayoutTypes.isEmpty()) {
    
    ... ... @@ -399,6 +486,82 @@ public class MoveLayoutRequestBuilder {
    399 486
             return Optional.of(newParent);
    
    400 487
         }
    
    401 488
     
    
    489
    +    private void onGroupByValueChanged(DataGroupByDto<?> newGroupByValue) {
    
    490
    +        DataGroupByParameter newGroupBy = new DataGroupByParameter(rootRequest.getGroupByName(), rootRequest.getGroupByFlavor(), newGroupByValue.getFilterValue());
    
    491
    +
    
    492
    +        List<ToolkitIdLabel> newParentCandidates = parentCandidates.apply(newGroupBy, oldParentId.getId());
    
    493
    +        ToolkitIdLabel selectedItem = parentEditor.getModel().getSelectedItem();
    
    494
    +        parentEditor.setData(newParentCandidates);
    
    495
    +        parentEditor.setSelectedItem(newParentCandidates.contains(selectedItem) ? selectedItem : null);
    
    496
    +
    
    497
    +        if (parentEditor.getCombobox().getModel().getSize() == 1) {
    
    498
    +            // auto-select unique data
    
    499
    +            parentEditor.setSelectedItem(newParentCandidates.get(0));
    
    500
    +        }
    
    501
    +        SwingUtilities.invokeLater(parentEditor.getCombobox()::requestFocus);
    
    502
    +    }
    
    503
    +
    
    504
    +    private void doConfigure() {
    
    505
    +        SwingUtilities.invokeLater(() -> {
    
    506
    +            NavigationUI ui = dataSourceEditor.getNavigationUI();
    
    507
    +
    
    508
    +            TreeConfigUI configUI = TreeConfigUIHandler.createUI(ui,
    
    509
    +                                                                 treeConfig,
    
    510
    +                                                                 ui.getTree().getModel().getGroupByHelper(),
    
    511
    +                                                                 new MoveLayoutApplyNavigationConfiguration(this),
    
    512
    +                                                                 ui.getTree());
    
    513
    +
    
    514
    +            TreeConfigUIHandler.hideOptions(configUI);
    
    515
    +            TreeConfigUIHandler.hideModule(configUI);
    
    516
    +            configUI.getHandler().updateOptions();
    
    517
    +            configUI.setComponentPopupMenu(optionPane.getComponentPopupMenu());
    
    518
    +            SwingUtilities.invokeLater(() -> TreeConfigUIHandler.showPanel(groupByNamePanel, configUI));
    
    519
    +        });
    
    520
    +    }
    
    521
    +
    
    522
    +    public void updateConfiguration(TreeConfig bean) {
    
    523
    +        treeConfig = bean;
    
    524
    +        rootRequest = bean.toRootRequest(groupByHelper);
    
    525
    +        log.warn(String.format("Will use new request: %s", rootRequest));
    
    526
    +
    
    527
    +        updateConfigurationLabel();
    
    528
    +
    
    529
    +        NavigationService navigationService = getDataSourcesManager().getMainDataSource().getNavigationService();
    
    530
    +        dataGroupByDtoSet = navigationService.getGroupByDtoSet(rootRequest);
    
    531
    +        getDecoratorService().installDecorator(dataGroupByDtoSet);
    
    532
    +
    
    533
    +        groupByParameterValue = dataGroupByDtoSet.size() == 0 ? null : dataGroupByDtoSet.toList().get(0).getFilterValue();
    
    534
    +        updateGroupByValues();
    
    535
    +        SwingUtilities.invokeLater(() -> {
    
    536
    +            JDialog dialog = (JDialog) SwingUtilities.getAncestorOfClass(JDialog.class, optionPane);
    
    537
    +            dialog.pack();
    
    538
    +        });
    
    539
    +    }
    
    540
    +
    
    541
    +    private void updateConfigurationLabel() {
    
    542
    +        TreeStatistics statistics = new TreeStatistics(
    
    543
    +                rootRequest,
    
    544
    +                groupByHelper,
    
    545
    +                () -> 0,
    
    546
    +                () -> 0L,
    
    547
    +                () -> 0L);
    
    548
    +        String statisticsText = TreeStatisticsTemplate.generateTreeStatisticsText(statistics);
    
    549
    +        groupByNameLabel.setText(statisticsText.substring(0, statisticsText.lastIndexOf(" /")));
    
    550
    +
    
    551
    +    }
    
    552
    +
    
    553
    +    private void updateGroupByValues() {
    
    554
    +
    
    555
    +        @SuppressWarnings("unchecked") List<DataGroupByDto<?>> groupByValues = (List<DataGroupByDto<?>>) dataGroupByDtoSet.toList();
    
    556
    +
    
    557
    +        DataGroupByDto<?> selectedGroupByValue = groupByParameterValue == null ? null : dataGroupByDtoSet.tryGetReferenceById(groupByParameterValue).orElse(null);
    
    558
    +
    
    559
    +        DefaultComboBoxModel<DataGroupByDto<?>> model = (DefaultComboBoxModel<DataGroupByDto<?>>) groupByValuesEditor.getModel();
    
    560
    +        model.removeAllElements();
    
    561
    +        model.addAll(groupByValues);
    
    562
    +        model.setSelectedItem(selectedGroupByValue != null ? selectedGroupByValue : groupByValues.isEmpty() ? null : groupByValues.get(0));
    
    563
    +    }
    
    564
    +
    
    402 565
         private boolean updateSelectedType(JCheckBox typeEditor, Class<? extends DataDto> type, FilterableComboBox<ToolkitIdLabel> editor) {
    
    403 566
             if (selectedLayoutTypes.contains(type)) {
    
    404 567
                 selectedLayoutTypes.remove(type);
    
    ... ... @@ -416,6 +579,7 @@ public class MoveLayoutRequestBuilder {
    416 579
     
    
    417 580
         public interface StepSetParentCandidates {
    
    418 581
     
    
    582
    +
    
    419 583
             StepSetParentCandidates setEditNode(IdNode<?> editNode);
    
    420 584
     
    
    421 585
             StepSetParentCandidates setGroupByValue(Supplier<DataGroupByParameter> groupByValue);
    

  • client/runner/src/main/i18n/translations/client-runner_en_GB.properties
    ... ... @@ -373,6 +373,7 @@ observe.ui.action.locale.fr=French
    373 373
     observe.ui.action.locale.fr.tip=Change application's language in french
    
    374 374
     observe.ui.action.locale.uk=English
    
    375 375
     observe.ui.action.locale.uk.tip=Change application's language in english
    
    376
    +observe.ui.action.move.groupBy.configuration=Criteria configuration\:
    
    376 377
     observe.ui.action.move.layout.multiple.message=Your are about to move some object from type '%s' beyond the following list\:
    
    377 378
     observe.ui.action.move.layout.single.message=Your are about to move all object of type '%s'.
    
    378 379
     observe.ui.action.move.message=Your are about to move %d object(s) of type '%s'\:
    

  • client/runner/src/main/i18n/translations/client-runner_es_ES.properties
    ... ... @@ -373,6 +373,7 @@ observe.ui.action.locale.fr=Francés
    373 373
     observe.ui.action.locale.fr.tip=Cambiar el idioma de la applicación al francés
    
    374 374
     observe.ui.action.locale.uk=Inglés
    
    375 375
     observe.ui.action.locale.uk.tip=Cambiar el idioma de la applicación al inglés
    
    376
    +observe.ui.action.move.groupBy.configuration=Criteria configuration\:
    
    376 377
     observe.ui.action.move.layout.multiple.message=Your are about to move some object from type '%s' beyond the fowolling list\:
    
    377 378
     observe.ui.action.move.layout.single.message=Your are about to move all object of type '%s'.
    
    378 379
     observe.ui.action.move.message=Your are about to move %d object(s) of type '%s'\: \#TODO
    

  • client/runner/src/main/i18n/translations/client-runner_fr_FR.properties
    ... ... @@ -373,6 +373,7 @@ observe.ui.action.locale.fr=Français
    373 373
     observe.ui.action.locale.fr.tip=Changer la langue de l'application en français
    
    374 374
     observe.ui.action.locale.uk=Anglais
    
    375 375
     observe.ui.action.locale.uk.tip=Changer la langue de l'application en anglais
    
    376
    +observe.ui.action.move.groupBy.configuration=Configuration des critères \:
    
    376 377
     observe.ui.action.move.layout.multiple.message=Vous êtes sur le point de déplacer un ensemble de données sur le type '%s' à sélectionner dans la liste suivante \:
    
    377 378
     observe.ui.action.move.layout.single.message=Vous êtes sur le point de déplacer toutes les données de type '%s'.
    
    378 379
     observe.ui.action.move.message=Vous êtes sur le point de déplacer %d donnée(s) de type '%s'\:
    

  • core/services/local/src/main/java/fr/ird/observe/services/local/service/NavigationServiceLocalSupport.java
    ... ... @@ -23,6 +23,7 @@ package fr.ird.observe.services.local.service;
    23 23
      */
    
    24 24
     
    
    25 25
     import fr.ird.observe.dto.db.configuration.ObserveDataSourceConnection;
    
    26
    +import fr.ird.observe.dto.reference.DataGroupByDtoSet;
    
    26 27
     import fr.ird.observe.entities.data.DataEntity;
    
    27 28
     import fr.ird.observe.navigation.tree.NavigationResult;
    
    28 29
     import fr.ird.observe.navigation.tree.io.ToolkitTreeFlatModel;
    
    ... ... @@ -45,6 +46,11 @@ import java.util.Optional;
    45 46
      */
    
    46 47
     public class NavigationServiceLocalSupport extends ObserveServiceLocal implements NavigationService {
    
    47 48
     
    
    49
    +    @Override
    
    50
    +    public DataGroupByDtoSet<?, ?> getGroupByDtoSet(ToolkitTreeFlatModelRootRequest request) {
    
    51
    +        return newTreeBuilder().buildDataGroupByDtoSet(request, now());
    
    52
    +    }
    
    53
    +
    
    48 54
         @Override
    
    49 55
         public NavigationResult getNavigation(ToolkitTreeFlatModelRootRequest request, Date timestamp) {
    
    50 56
             if (timestamp == null) {
    

  • pom.xml
    ... ... @@ -155,7 +155,7 @@
    155 155
         <!-- build timestamp configuration -->
    
    156 156
         <maven.build.timestamp.format>dd/MM/yyyy HH:mm z</maven.build.timestamp.format>
    
    157 157
         <buildDate>${maven.build.timestamp}</buildDate>
    
    158
    -    <lib.version.toolkit>6.0.9-SNAPSHOT</lib.version.toolkit>
    
    158
    +    <lib.version.toolkit>6.0.9</lib.version.toolkit>
    
    159 159
         <lib.version.ognl>3.1.29</lib.version.ognl>
    
    160 160
         <!-- FIXME  <lib.version.ognl>3.3.2</lib.version.ognl>-->
    
    161 161
         <lib.version.h2>1.4.196</lib.version.h2>
    

  • server/core/src/main/filtered-resources/META-INF/mapping-api-client.wm
    ... ... @@ -45,6 +45,7 @@ GET /DataSourceService/produceCreateSqlScript Data
    45 45
     GET    /DataSourceService/produceDeleteSqlScript                            DataSourceServiceRestApi.produceDeleteSqlScript
    
    46 46
     GET    /DataSourceService/produceMoveSqlScript                              DataSourceServiceRestApi.produceMoveSqlScript
    
    47 47
     GET    /DataSourceService/retainExistingIds                                 DataSourceServiceRestApi.retainExistingIds
    
    48
    +GET    /NavigationService/getGroupByDtoSet                                  NavigationServiceRestApi.getGroupByDtoSet
    
    48 49
     GET    /NavigationService/getNavigation                                     NavigationServiceRestApi.getNavigation
    
    49 50
     GET    /NavigationService/loadNavigationPath                                NavigationServiceRestApi.loadNavigationPath
    
    50 51
     GET    /NavigationService/loadNavigationRoot                                NavigationServiceRestApi.loadNavigationRoot