Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe
Commits:
-
023def69
by Tony Chemit at 2021-09-27T11:49:33+02:00
-
28457534
by Tony Chemit at 2021-09-27T11:49:33+02:00
-
0cb274a0
by Tony Chemit at 2021-09-27T11:49:33+02:00
-
62239db6
by Tony Chemit at 2021-09-27T14:00:57+02:00
-
b63a2a9d
by Tony Chemit at 2021-09-27T14:56:14+02:00
13 changed files:
- client/datasource/actions/src/main/i18n/getters/java.getter
- client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/actions/DataManager.java
- 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/referential/actions/ShowUsagesReferential.java
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/referential/usage/UsageForDeleteUIHandler.java
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/referential/usage/UsageForDesactivateUIHandler.java
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/referential/usage/UsageForDisplayUIHandler.java
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/referential/usage/UsageUIHandlerSupport.java
- pom.xml
- services/api-test/src/main/java/fr/ird/observe/services/service/referential/ReferentialServiceFixtures.java
- services/client-impl/pom.xml
- − services/client-impl/src/main/java/fr/ird/observe/services/client/referential/ReferentialServiceClient.java
- services/local-impl/src/main/java/fr/ird/observe/services/local/service/referential/ReferentialServiceLocalSupport.java
Changes:
| ... | ... | @@ -26,7 +26,6 @@ observe.ui.action.goto.previous.stage |
| 26 | 26 |
observe.ui.action.goto.previous.stage.tip
|
| 27 | 27 |
observe.ui.action.info.storage.tip
|
| 28 | 28 |
observe.ui.choice.cancel
|
| 29 |
-observe.ui.choice.confirm.insert
|
|
| 30 | 29 |
observe.ui.choice.replace
|
| 31 | 30 |
observe.ui.datasource.actions.config.data.sources.equals
|
| 32 | 31 |
observe.ui.datasource.editor.actions.consolidate
|
| ... | ... | @@ -47,7 +46,6 @@ observe.ui.datasource.editor.actions.data.export.result |
| 47 | 46 |
observe.ui.datasource.editor.actions.data.import.add.missing.referential
|
| 48 | 47 |
observe.ui.datasource.editor.actions.data.import.add.missing.referential.for.type
|
| 49 | 48 |
observe.ui.datasource.editor.actions.data.import.result
|
| 50 |
-observe.ui.datasource.editor.actions.data.import.title.require.add.missing.referential
|
|
| 51 | 49 |
observe.ui.datasource.editor.actions.exportData
|
| 52 | 50 |
observe.ui.datasource.editor.actions.exportData.description
|
| 53 | 51 |
observe.ui.datasource.editor.actions.exportData.message.not.possible
|
| ... | ... | @@ -22,10 +22,9 @@ package fr.ird.observe.client.datasource.actions.actions; |
| 22 | 22 |
* #L%
|
| 23 | 23 |
*/
|
| 24 | 24 |
|
| 25 |
+import com.google.common.collect.LinkedHashMultimap;
|
|
| 25 | 26 |
import com.google.common.collect.SetMultimap;
|
| 26 |
-import fr.ird.observe.client.ClientUIContext;
|
|
| 27 | 27 |
import fr.ird.observe.client.datasource.api.ObserveSwingDataSource;
|
| 28 |
-import fr.ird.observe.client.datasource.editor.api.content.referential.usage.UsageForDisplayUI;
|
|
| 29 | 28 |
import fr.ird.observe.client.datasource.editor.api.content.referential.usage.UsageForDisplayUIHandler;
|
| 30 | 29 |
import fr.ird.observe.client.util.ProgressModel;
|
| 31 | 30 |
import fr.ird.observe.dto.ToolkitIdLabel;
|
| ... | ... | @@ -40,6 +39,7 @@ import fr.ird.observe.services.service.referential.ReferentialService; |
| 40 | 39 |
import fr.ird.observe.spi.decoration.I18nDecoratorHelper;
|
| 41 | 40 |
import fr.ird.observe.spi.referential.MissingReferentialRequest;
|
| 42 | 41 |
import fr.ird.observe.spi.referential.MissingReferentialResult;
|
| 42 |
+import fr.ird.observe.spi.referential.ReferentialIds;
|
|
| 43 | 43 |
import io.ultreia.java4all.application.template.spi.GenerateTemplate;
|
| 44 | 44 |
import io.ultreia.java4all.lang.Strings;
|
| 45 | 45 |
import org.apache.commons.lang3.StringUtils;
|
| ... | ... | @@ -47,7 +47,6 @@ import org.apache.logging.log4j.LogManager; |
| 47 | 47 |
import org.apache.logging.log4j.Logger;
|
| 48 | 48 |
import org.nuiton.jaxx.runtime.swing.wizard.ext.WizardState;
|
| 49 | 49 |
|
| 50 |
-import javax.swing.JOptionPane;
|
|
| 51 | 50 |
import java.util.Collection;
|
| 52 | 51 |
import java.util.Objects;
|
| 53 | 52 |
import java.util.Set;
|
| ... | ... | @@ -57,7 +56,7 @@ import static io.ultreia.java4all.i18n.I18n.n; |
| 57 | 56 |
import static io.ultreia.java4all.i18n.I18n.t;
|
| 58 | 57 |
|
| 59 | 58 |
/**
|
| 60 |
- * Hi-level object to perform business data management (says: delete some trip, copy some trip)
|
|
| 59 |
+ * Hi-level object to perform business data management (says: delete some trip, copy some trip, insert missing referential, ...)
|
|
| 61 | 60 |
* <p>
|
| 62 | 61 |
* Created on 10/02/2021.
|
| 63 | 62 |
*
|
| ... | ... | @@ -116,9 +115,13 @@ public class DataManager { |
| 116 | 115 |
public WizardState insertMissingReferential(Collection<String> idsToCopy) {
|
| 117 | 116 |
progressModel.increments();
|
| 118 | 117 |
|
| 118 |
+ //FIXME Review this code, if a referential synchro was just performed before
|
|
| 119 |
+ //FIXME We then have already resolved all ids that are only on incoming source
|
|
| 120 |
+ //FIXME From this ids, retains all that are in data to export (on incoming source)
|
|
| 121 |
+ //FIXME That's all, no need to call target source
|
|
| 119 | 122 |
ReferentialService targetReferentialService = targetSource.getReferentialService();
|
| 120 |
- SetMultimap<Class<? extends ReferentialDto>, String> targetSourceReferential = targetReferentialService.getReferentialIds();
|
|
| 121 |
- MissingReferentialRequest missingReferentialRequest = MissingReferentialRequest.of(targetSourceReferential, idsToCopy.toArray(new String[0]));
|
|
| 123 |
+ ReferentialIds targetSourceReferential = targetReferentialService.getReferentialIds();
|
|
| 124 |
+ MissingReferentialRequest missingReferentialRequest = MissingReferentialRequest.of(targetSourceReferential.getIds(), idsToCopy.toArray(new String[0]));
|
|
| 122 | 125 |
MissingReferentialResult missingReferentialResult = incomingSource.getReferentialService().computeMissingReferential(missingReferentialRequest);
|
| 123 | 126 |
|
| 124 | 127 |
progressModel.increments();
|
| ... | ... | @@ -132,18 +135,9 @@ public class DataManager { |
| 132 | 135 |
|
| 133 | 136 |
SetMultimap<Class<? extends ReferentialDto>, ToolkitIdLabel> usages = incomingSource.getReferentialMap(missingReferentialResult.getMissingIds());
|
| 134 | 137 |
|
| 135 |
- UsageForDisplayUI usagesUI = UsageForDisplayUIHandler.showMissingReferential(getMessage(), usages);
|
|
| 138 |
+ boolean response = UsageForDisplayUIHandler.showMissingReferential(getMessage(), usages, getTargetSourceLabel());
|
|
| 136 | 139 |
|
| 137 |
- int response = ClientUIContext.askUser(null,
|
|
| 138 |
- t("observe.ui.datasource.editor.actions.data.import.title.require.add.missing.referential", getTargetSourceLabel()),
|
|
| 139 |
- usagesUI,
|
|
| 140 |
- JOptionPane.WARNING_MESSAGE,
|
|
| 141 |
- new Object[]{
|
|
| 142 |
- t("observe.ui.choice.confirm.insert"),
|
|
| 143 |
- t("observe.ui.choice.cancel")},
|
|
| 144 |
- 0);
|
|
| 145 |
- |
|
| 146 |
- if (response != 0) {
|
|
| 140 |
+ if (!response) {
|
|
| 147 | 141 |
progressModel.increments();
|
| 148 | 142 |
return WizardState.CANCELED;
|
| 149 | 143 |
}
|
| ... | ... | @@ -186,6 +186,7 @@ observe.ui.action.storage.applyAction |
| 186 | 186 |
observe.ui.choice.cancel
|
| 187 | 187 |
observe.ui.choice.cancel.tip
|
| 188 | 188 |
observe.ui.choice.confirm.delete
|
| 189 |
+observe.ui.choice.confirm.insert
|
|
| 189 | 190 |
observe.ui.choice.confirm.move
|
| 190 | 191 |
observe.ui.choice.confirm.replace
|
| 191 | 192 |
observe.ui.choice.continue
|
| ... | ... | @@ -208,6 +209,7 @@ observe.ui.datasource.avdth.import |
| 208 | 209 |
observe.ui.datasource.avdth.import.tip
|
| 209 | 210 |
observe.ui.datasource.avdth.newImport
|
| 210 | 211 |
observe.ui.datasource.avdth.newImport.tip
|
| 212 |
+observe.ui.datasource.editor.actions.data.import.title.require.add.missing.referential
|
|
| 211 | 213 |
observe.ui.datasource.editor.content.map.action.exportPng
|
| 212 | 214 |
observe.ui.datasource.editor.content.map.action.exportPng.tip
|
| 213 | 215 |
observe.ui.datasource.editor.content.map.action.zoomIt
|
| ... | ... | @@ -22,14 +22,11 @@ package fr.ird.observe.client.datasource.editor.api.content.referential.actions; |
| 22 | 22 |
* #L%
|
| 23 | 23 |
*/
|
| 24 | 24 |
|
| 25 |
-import fr.ird.observe.client.ClientUIContext;
|
|
| 26 | 25 |
import fr.ird.observe.client.datasource.editor.api.ObserveKeyStrokesEditorApi;
|
| 27 | 26 |
import fr.ird.observe.client.datasource.editor.api.content.actions.ConfigureMenuAction;
|
| 28 | 27 |
import fr.ird.observe.client.datasource.editor.api.content.referential.ContentReferentialUI;
|
| 29 | 28 |
import fr.ird.observe.client.datasource.editor.api.content.referential.ContentReferentialUIModel;
|
| 30 |
-import fr.ird.observe.client.datasource.editor.api.content.referential.usage.UsageForDisplayUI;
|
|
| 31 | 29 |
import fr.ird.observe.client.datasource.editor.api.content.referential.usage.UsageForDisplayUIHandler;
|
| 32 |
-import fr.ird.observe.client.util.UIHelper;
|
|
| 33 | 30 |
import fr.ird.observe.dto.ToolkitIdLabel;
|
| 34 | 31 |
import fr.ird.observe.dto.UsageCount;
|
| 35 | 32 |
import fr.ird.observe.dto.reference.ReferentialDtoReference;
|
| ... | ... | @@ -37,8 +34,6 @@ import fr.ird.observe.dto.referential.ReferentialDto; |
| 37 | 34 |
import fr.ird.observe.dto.referential.ToolkitReferentialDtoBean;
|
| 38 | 35 |
import fr.ird.observe.services.service.referential.UsageService;
|
| 39 | 36 |
|
| 40 |
-import javax.swing.JOptionPane;
|
|
| 41 |
-import java.awt.Dimension;
|
|
| 42 | 37 |
import java.awt.event.ActionEvent;
|
| 43 | 38 |
|
| 44 | 39 |
import static io.ultreia.java4all.i18n.I18n.t;
|
| ... | ... | @@ -72,18 +67,7 @@ public final class ShowUsagesReferential<D extends ReferentialDto, R extends Ref |
| 72 | 67 |
|
| 73 | 68 |
ToolkitIdLabel reference = bean.toLabel();
|
| 74 | 69 |
getDecoratorService().installToolkitIdLabelDecorator(request.getType(), reference);
|
| 75 |
- UsageForDisplayUI usagesUI = UsageForDisplayUIHandler.showUsages(usageService, reference, request, usages);
|
|
| 76 |
- |
|
| 77 |
- Object[] options = {t("observe.ui.choice.quit")};
|
|
| 78 |
- JOptionPane pane = new JOptionPane(usagesUI, JOptionPane.INFORMATION_MESSAGE,
|
|
| 79 |
- JOptionPane.DEFAULT_OPTION, null,
|
|
| 80 |
- options, options[0]);
|
|
| 81 |
- |
|
| 82 |
- Dimension size = getMainUI().getPreferredSize();
|
|
| 83 |
- Dimension thisSize = new Dimension((int) size.getWidth() - 20, (int) size.getHeight() - 20);
|
|
| 84 |
- pane.setPreferredSize(thisSize);
|
|
| 85 |
- pane.putClientProperty(UIHelper.NO_PACK, true);
|
|
| 86 |
- ClientUIContext.askUser(pane, t("observe.ui.title.show.usage"), options);
|
|
| 70 |
+ UsageForDisplayUIHandler.showUsages(usageService, reference, request, usages);
|
|
| 87 | 71 |
}
|
| 88 | 72 |
|
| 89 | 73 |
}
|
| ... | ... | @@ -23,8 +23,6 @@ package fr.ird.observe.client.datasource.editor.api.content.referential.usage; |
| 23 | 23 |
*/
|
| 24 | 24 |
|
| 25 | 25 |
import fr.ird.observe.client.ClientUIContext;
|
| 26 |
-import fr.ird.observe.client.ClientUIContextApplicationComponent;
|
|
| 27 |
-import fr.ird.observe.client.util.UIHelper;
|
|
| 28 | 26 |
import fr.ird.observe.dto.BusinessDto;
|
| 29 | 27 |
import fr.ird.observe.dto.IdDto;
|
| 30 | 28 |
import fr.ird.observe.dto.ToolkitIdLabel;
|
| ... | ... | @@ -39,7 +37,6 @@ import org.apache.commons.lang3.tuple.Pair; |
| 39 | 37 |
|
| 40 | 38 |
import javax.swing.JLabel;
|
| 41 | 39 |
import javax.swing.JOptionPane;
|
| 42 |
-import java.awt.Dimension;
|
|
| 43 | 40 |
import java.util.Collection;
|
| 44 | 41 |
import java.util.List;
|
| 45 | 42 |
|
| ... | ... | @@ -81,10 +78,7 @@ public class UsageForDeleteUIHandler extends UsageUIHandlerSupport<UsageForDelet |
| 81 | 78 |
|
| 82 | 79 |
usagesUI.getHandler().attachToOptionPane(pane, replaceText);
|
| 83 | 80 |
|
| 84 |
- Dimension size = ClientUIContextApplicationComponent.value().getMainUI().getPreferredSize();
|
|
| 85 |
- Dimension thisSize = new Dimension((int) size.getWidth() - 20, (int) size.getHeight() - 20);
|
|
| 86 |
- pane.setPreferredSize(thisSize);
|
|
| 87 |
- pane.putClientProperty(UIHelper.NO_PACK, true);
|
|
| 81 |
+ usagesUI.getHandler().setUISize(pane);
|
|
| 88 | 82 |
int response = ClientUIContext.askUser(pane, t("observe.ui.title.can.not.delete.referentiel"), options);
|
| 89 | 83 |
|
| 90 | 84 |
if (response == 0) {
|
| ... | ... | @@ -23,8 +23,6 @@ package fr.ird.observe.client.datasource.editor.api.content.referential.usage; |
| 23 | 23 |
*/
|
| 24 | 24 |
|
| 25 | 25 |
import fr.ird.observe.client.ClientUIContext;
|
| 26 |
-import fr.ird.observe.client.ClientUIContextApplicationComponent;
|
|
| 27 |
-import fr.ird.observe.client.util.UIHelper;
|
|
| 28 | 26 |
import fr.ird.observe.dto.BusinessDto;
|
| 29 | 27 |
import fr.ird.observe.dto.IdDto;
|
| 30 | 28 |
import fr.ird.observe.dto.ToolkitIdLabel;
|
| ... | ... | @@ -41,7 +39,6 @@ import org.apache.logging.log4j.Logger; |
| 41 | 39 |
|
| 42 | 40 |
import javax.swing.JLabel;
|
| 43 | 41 |
import javax.swing.JOptionPane;
|
| 44 |
-import java.awt.Dimension;
|
|
| 45 | 42 |
import java.util.Collection;
|
| 46 | 43 |
import java.util.List;
|
| 47 | 44 |
|
| ... | ... | @@ -87,10 +84,7 @@ public class UsageForDesactivateUIHandler extends UsageUIHandlerSupport<UsageFor |
| 87 | 84 |
JOptionPane pane = new JOptionPane(usagesUI, JOptionPane.WARNING_MESSAGE, JOptionPane.DEFAULT_OPTION, null, options, options[0]);
|
| 88 | 85 |
|
| 89 | 86 |
usagesUI.getHandler().attachToOptionPane(pane, replaceText);
|
| 90 |
- Dimension size = ClientUIContextApplicationComponent.value().getMainUI().getPreferredSize();
|
|
| 91 |
- Dimension thisSize = new Dimension((int) size.getWidth() - 20, (int) size.getHeight() - 20);
|
|
| 92 |
- pane.setPreferredSize(thisSize);
|
|
| 93 |
- pane.putClientProperty(UIHelper.NO_PACK, true);
|
|
| 87 |
+ usagesUI.getHandler().setUISize(pane);
|
|
| 94 | 88 |
|
| 95 | 89 |
int response = ClientUIContext.askUser(pane, t("observe.ui.title.need.confirm.to.desactivate.referentiel"), options);
|
| 96 | 90 |
log.debug("response : " + response);
|
| ... | ... | @@ -23,6 +23,7 @@ package fr.ird.observe.client.datasource.editor.api.content.referential.usage; |
| 23 | 23 |
*/
|
| 24 | 24 |
|
| 25 | 25 |
import com.google.common.collect.SetMultimap;
|
| 26 |
+import fr.ird.observe.client.ClientUIContext;
|
|
| 26 | 27 |
import fr.ird.observe.dto.BusinessDto;
|
| 27 | 28 |
import fr.ird.observe.dto.ToolkitIdLabel;
|
| 28 | 29 |
import fr.ird.observe.dto.UsageCount;
|
| ... | ... | @@ -34,6 +35,7 @@ import io.ultreia.java4all.jaxx.widgets.combobox.JaxxComboBox; |
| 34 | 35 |
import io.ultreia.java4all.util.SingletonSupplier;
|
| 35 | 36 |
|
| 36 | 37 |
import javax.swing.JLabel;
|
| 38 |
+import javax.swing.JOptionPane;
|
|
| 37 | 39 |
import java.util.Collection;
|
| 38 | 40 |
|
| 39 | 41 |
import static io.ultreia.java4all.i18n.I18n.t;
|
| ... | ... | @@ -46,10 +48,10 @@ import static io.ultreia.java4all.i18n.I18n.t; |
| 46 | 48 |
*/
|
| 47 | 49 |
public class UsageForDisplayUIHandler extends UsageUIHandlerSupport<UsageForDisplayUI> {
|
| 48 | 50 |
|
| 49 |
- public static UsageForDisplayUI showUsages(UsageService usageService,
|
|
| 50 |
- ToolkitIdLabel reference,
|
|
| 51 |
- ToolkitReferentialDtoBean request,
|
|
| 52 |
- UsageCount usages) {
|
|
| 51 |
+ public static void showUsages(UsageService usageService,
|
|
| 52 |
+ ToolkitIdLabel reference,
|
|
| 53 |
+ ToolkitReferentialDtoBean request,
|
|
| 54 |
+ UsageCount usages) {
|
|
| 53 | 55 |
//FIXME utiliser une template
|
| 54 | 56 |
String type = I18nDecoratorHelper.getType(request.getType());
|
| 55 | 57 |
String message = t("observe.ui.message.show.usages", type, reference);
|
| ... | ... | @@ -64,10 +66,20 @@ public class UsageForDisplayUIHandler extends UsageUIHandlerSupport<UsageForDisp |
| 64 | 66 |
return SingletonSupplier.of(() -> usageService.find(request, dtoType));
|
| 65 | 67 |
}
|
| 66 | 68 |
};
|
| 67 |
- return UsageForDisplayUI.build(message, getter);
|
|
| 69 |
+ UsageForDisplayUI usagesUI = UsageForDisplayUI.build(message, getter);
|
|
| 70 |
+ |
|
| 71 |
+ Object[] options = {t("observe.ui.choice.quit")};
|
|
| 72 |
+ JOptionPane pane = new JOptionPane(usagesUI, JOptionPane.INFORMATION_MESSAGE,
|
|
| 73 |
+ JOptionPane.DEFAULT_OPTION, null,
|
|
| 74 |
+ options, options[0]);
|
|
| 75 |
+ |
|
| 76 |
+ usagesUI.getHandler().setUISize(pane);
|
|
| 77 |
+ ClientUIContext.askUser(pane, t("observe.ui.title.show.usage"), options);
|
|
| 68 | 78 |
}
|
| 69 | 79 |
|
| 70 |
- public static UsageForDisplayUI showMissingReferential(String message, SetMultimap<Class<? extends ReferentialDto>, ToolkitIdLabel> usages) {
|
|
| 80 |
+ public static boolean showMissingReferential(String message,
|
|
| 81 |
+ SetMultimap<Class<? extends ReferentialDto>, ToolkitIdLabel> usages,
|
|
| 82 |
+ String targetSourceLabel) {
|
|
| 71 | 83 |
UsageCount count = new UsageCount();
|
| 72 | 84 |
for (Class<? extends ReferentialDto> dtoType : usages.keys()) {
|
| 73 | 85 |
count.put(dtoType, (long) usages.get(dtoType).size());
|
| ... | ... | @@ -84,7 +96,18 @@ public class UsageForDisplayUIHandler extends UsageUIHandlerSupport<UsageForDisp |
| 84 | 96 |
return SingletonSupplier.of(() -> usages.get((Class<? extends ReferentialDto>) dtoType));
|
| 85 | 97 |
}
|
| 86 | 98 |
};
|
| 87 |
- return UsageForDisplayUI.build(message, getter);
|
|
| 99 |
+ UsageForDisplayUI usagesUI = UsageForDisplayUI.build(message, getter);
|
|
| 100 |
+ |
|
| 101 |
+ String[] options = {
|
|
| 102 |
+ t("observe.ui.choice.confirm.insert"),
|
|
| 103 |
+ t("observe.ui.choice.cancel")};
|
|
| 104 |
+ JOptionPane pane = new JOptionPane(usagesUI, JOptionPane.WARNING_MESSAGE, JOptionPane.DEFAULT_OPTION, null, options, options[0]);
|
|
| 105 |
+ |
|
| 106 |
+ usagesUI.getHandler().setUISize(pane);
|
|
| 107 |
+ String title = t("observe.ui.datasource.editor.actions.data.import.title.require.add.missing.referential", targetSourceLabel);
|
|
| 108 |
+ int response = ClientUIContext.askUser(pane, title, options);
|
|
| 109 |
+ return response == 0;
|
|
| 110 |
+ |
|
| 88 | 111 |
}
|
| 89 | 112 |
|
| 90 | 113 |
@Override
|
| ... | ... | @@ -22,8 +22,10 @@ package fr.ird.observe.client.datasource.editor.api.content.referential.usage; |
| 22 | 22 |
* #L%
|
| 23 | 23 |
*/
|
| 24 | 24 |
|
| 25 |
+import fr.ird.observe.client.ClientUIContextApplicationComponent;
|
|
| 25 | 26 |
import fr.ird.observe.client.WithClientUIContext;
|
| 26 | 27 |
import fr.ird.observe.client.util.DisabledItemSelectionModel;
|
| 28 |
+import fr.ird.observe.client.util.UIHelper;
|
|
| 27 | 29 |
import fr.ird.observe.dto.BusinessDto;
|
| 28 | 30 |
import fr.ird.observe.dto.ToolkitIdLabel;
|
| 29 | 31 |
import fr.ird.observe.dto.UsageCount;
|
| ... | ... | @@ -36,12 +38,14 @@ import org.nuiton.jaxx.runtime.spi.UIHandler; |
| 36 | 38 |
|
| 37 | 39 |
import javax.swing.ButtonGroup;
|
| 38 | 40 |
import javax.swing.JButton;
|
| 41 |
+import javax.swing.JComponent;
|
|
| 39 | 42 |
import javax.swing.JLabel;
|
| 40 | 43 |
import javax.swing.JList;
|
| 41 | 44 |
import javax.swing.JOptionPane;
|
| 42 | 45 |
import javax.swing.JToggleButton;
|
| 43 | 46 |
import java.awt.Component;
|
| 44 | 47 |
import java.awt.Container;
|
| 48 |
+import java.awt.Dimension;
|
|
| 45 | 49 |
import java.util.Collection;
|
| 46 | 50 |
import java.util.List;
|
| 47 | 51 |
import java.util.Objects;
|
| ... | ... | @@ -97,6 +101,8 @@ public abstract class UsageUIHandlerSupport<U extends JAXXObject> implements UIH |
| 97 | 101 |
|
| 98 | 102 |
String message = ui.getContextValue(String.class);
|
| 99 | 103 |
getMessage().setText(message);
|
| 104 |
+ Dimension preferredSize = getClientUIContext().getMainUI().getPreferredSize();
|
|
| 105 |
+ ((JComponent) ui).setMaximumSize(preferredSize);
|
|
| 100 | 106 |
|
| 101 | 107 |
UsagesGetter usagesGetter = Objects.requireNonNull(ui.getContextValue(UsagesGetter.class));
|
| 102 | 108 |
if (usagesGetter.isEmpty()) {
|
| ... | ... | @@ -146,6 +152,13 @@ public abstract class UsageUIHandlerSupport<U extends JAXXObject> implements UIH |
| 146 | 152 |
});
|
| 147 | 153 |
}
|
| 148 | 154 |
|
| 155 |
+ protected void setUISize(JOptionPane pane) {
|
|
| 156 |
+ Dimension size = ClientUIContextApplicationComponent.value().getMainUI().getPreferredSize();
|
|
| 157 |
+ Dimension thisSize = new Dimension((int) size.getWidth() - 20, (int) size.getHeight() - 20);
|
|
| 158 |
+ pane.setPreferredSize(thisSize);
|
|
| 159 |
+ pane.putClientProperty(UIHelper.NO_PACK, true);
|
|
| 160 |
+ }
|
|
| 161 |
+ |
|
| 149 | 162 |
private <D extends BusinessDto> void buildUsagePanel(ButtonGroup buttonGroup, Class<D> dtoType, UsagesGetter usagesGetter) {
|
| 150 | 163 |
long count = usagesGetter.getCount().get(dtoType);
|
| 151 | 164 |
SingletonSupplier<Collection<ToolkitIdLabel>> factory = usagesGetter.getUsages(dtoType);
|
| ... | ... | @@ -24,7 +24,7 @@ |
| 24 | 24 |
<parent>
|
| 25 | 25 |
<groupId>io.ultreia.maven</groupId>
|
| 26 | 26 |
<artifactId>pom</artifactId>
|
| 27 |
- <version>2021.96</version>
|
|
| 27 |
+ <version>2021.98</version>
|
|
| 28 | 28 |
</parent>
|
| 29 | 29 |
|
| 30 | 30 |
<groupId>fr.ird.observe</groupId>
|
| ... | ... | @@ -161,7 +161,7 @@ |
| 161 | 161 |
<maven.build.timestamp.format>dd/MM/yyyy HH:mm z</maven.build.timestamp.format>
|
| 162 | 162 |
<buildDate>${maven.build.timestamp}</buildDate>
|
| 163 | 163 |
|
| 164 |
-<!-- <lib.version.toolkit>5.0.44-SNAPSHOT</lib.version.toolkit>-->
|
|
| 164 |
+ <lib.version.toolkit>5.0.45-SNAPSHOT</lib.version.toolkit>
|
|
| 165 | 165 |
|
| 166 | 166 |
<lib.version.ognl>3.1.29</lib.version.ognl>
|
| 167 | 167 |
<!--can't use 1.4.197 (date has changed + blob also)-->
|
| ... | ... | @@ -172,8 +172,8 @@ |
| 172 | 172 |
<lib.version.graalvm>21.1.0</lib.version.graalvm>
|
| 173 | 173 |
|
| 174 | 174 |
<!-- <lib.version.java4all.http>1.0.30</lib.version.java4all.http>-->
|
| 175 |
- <!-- <lib.version.java4all.topia>1.47</lib.version.java4all.topia>-->
|
|
| 176 |
- <!-- <lib.version.java4all.eugene>3.0-alpha-38</lib.version.java4all.eugene>-->
|
|
| 175 |
+<!-- <lib.version.java4all.topia>1.52-SNAPSHOT</lib.version.java4all.topia>-->
|
|
| 176 |
+<!-- <lib.version.java4all.eugene>3.0-alpha-42-SNAPSHOT</lib.version.java4all.eugene>-->
|
|
| 177 | 177 |
<!-- <lib.version.java4all.jaxx>3.0.0-RC-8</lib.version.java4all.jaxx>-->
|
| 178 | 178 |
<!--<lib.version.java4all.application-context>1.0.3-SNAPSHOT</lib.version.java4all.application-context>-->
|
| 179 | 179 |
<!--<lib.version.java4all.application-template>1.0.2-SNAPSHOT</lib.version.java4all.application-template>-->
|
| ... | ... | @@ -24,17 +24,16 @@ package fr.ird.observe.services.service.referential; |
| 24 | 24 |
|
| 25 | 25 |
|
| 26 | 26 |
import com.google.common.collect.LinkedHashMultimap;
|
| 27 |
-import com.google.common.collect.SetMultimap;
|
|
| 28 | 27 |
import fr.ird.observe.dto.ToolkitIdLabel;
|
| 29 | 28 |
import fr.ird.observe.dto.form.Form;
|
| 30 | 29 |
import fr.ird.observe.dto.reference.ReferentialDtoReferenceSet;
|
| 31 |
-import fr.ird.observe.dto.referential.ReferentialDto;
|
|
| 32 | 30 |
import fr.ird.observe.dto.referential.common.ProgramDto;
|
| 33 | 31 |
import fr.ird.observe.dto.referential.common.ProgramReference;
|
| 34 | 32 |
import fr.ird.observe.dto.result.SaveResultDto;
|
| 35 | 33 |
import fr.ird.observe.services.ObserveServicesProvider;
|
| 36 | 34 |
import fr.ird.observe.spi.referential.MissingReferentialRequest;
|
| 37 | 35 |
import fr.ird.observe.spi.referential.MissingReferentialResult;
|
| 36 |
+import fr.ird.observe.spi.referential.ReferentialIds;
|
|
| 38 | 37 |
import org.junit.Assert;
|
| 39 | 38 |
|
| 40 | 39 |
import java.util.Collections;
|
| ... | ... | @@ -105,7 +104,7 @@ public class ReferentialServiceFixtures extends GeneratedReferentialServiceFixtu |
| 105 | 104 |
|
| 106 | 105 |
@Override
|
| 107 | 106 |
public void getReferentialIds(ObserveServicesProvider servicesProvider, ReferentialService service) {
|
| 108 |
- SetMultimap<Class<? extends ReferentialDto>, String> actual = service.getReferentialIds();
|
|
| 107 |
+ ReferentialIds actual = service.getReferentialIds();
|
|
| 109 | 108 |
Assert.assertNotNull(actual);
|
| 110 | 109 |
Assert.assertEquals(getIntegerProperty("getReferentialIds.count"), actual.keySet().size());
|
| 111 | 110 |
Assert.assertEquals(REFERENTIAL_COUNT, actual.size());
|
| ... | ... | @@ -113,10 +113,6 @@ |
| 113 | 113 |
<groupId>org.apache.commons</groupId>
|
| 114 | 114 |
<artifactId>commons-lang3</artifactId>
|
| 115 | 115 |
</dependency>
|
| 116 |
- <dependency>
|
|
| 117 |
- <groupId>com.google.guava</groupId>
|
|
| 118 |
- <artifactId>guava</artifactId>
|
|
| 119 |
- </dependency>
|
|
| 120 | 116 |
<dependency>
|
| 121 | 117 |
<groupId>com.google.code.gson</groupId>
|
| 122 | 118 |
<artifactId>gson</artifactId>
|
| 1 |
-package fr.ird.observe.services.client.referential;
|
|
| 2 |
- |
|
| 3 |
-/*-
|
|
| 4 |
- * #%L
|
|
| 5 |
- * ObServe Services :: Client implementation
|
|
| 6 |
- * %%
|
|
| 7 |
- * Copyright (C) 2008 - 2021 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 com.google.common.collect.SetMultimap;
|
|
| 26 |
-import com.google.gson.reflect.TypeToken;
|
|
| 27 |
-import fr.ird.observe.dto.referential.ReferentialDto;
|
|
| 28 |
-import org.apache.http.HttpStatus;
|
|
| 29 |
- |
|
| 30 |
-import javax.annotation.Generated;
|
|
| 31 |
-import java.util.concurrent.TimeUnit;
|
|
| 32 |
- |
|
| 33 |
-@Generated(value = "io.ultreia.java4all.http.maven.plugin.GenerateHttpClientMojo", date = "Fri Sep 17 15:00:51 CEST 2021")
|
|
| 34 |
-public class ReferentialServiceClient extends GeneratedReferentialServiceClient {
|
|
| 35 |
- |
|
| 36 |
- //FIXME Generate this
|
|
| 37 |
- @Override
|
|
| 38 |
- public SetMultimap<Class<? extends ReferentialDto>, String> getReferentialIds() {
|
|
| 39 |
- return executeRequest(create("getReferentialIds")
|
|
| 40 |
- .addAuthToken()
|
|
| 41 |
- .setTimeout(TimeUnit.MINUTES, 1)
|
|
| 42 |
- .post(), HttpStatus.SC_OK).toJson(new TypeToken<SetMultimap<Class<? extends ReferentialDto>, String>>(){}.getType());
|
|
| 43 |
- }
|
|
| 44 |
-}
|
| ... | ... | @@ -48,6 +48,7 @@ import fr.ird.observe.spi.module.ObserveBusinessProject; |
| 48 | 48 |
import fr.ird.observe.spi.referential.MissingReferentialIdsBuilder;
|
| 49 | 49 |
import fr.ird.observe.spi.referential.MissingReferentialRequest;
|
| 50 | 50 |
import fr.ird.observe.spi.referential.MissingReferentialResult;
|
| 51 |
+import fr.ird.observe.spi.referential.ReferentialIds;
|
|
| 51 | 52 |
import fr.ird.observe.spi.referential.sql.ReplaceSqlStatementGenerator;
|
| 52 | 53 |
import fr.ird.observe.spi.referential.synchro.OneSideSqlRequest;
|
| 53 | 54 |
import fr.ird.observe.spi.referential.synchro.OneSideSqlResult;
|
| ... | ... | @@ -244,14 +245,14 @@ class ReferentialServiceLocalSupport extends ObserveServiceLocal implements Refe |
| 244 | 245 |
}
|
| 245 | 246 |
|
| 246 | 247 |
@Override
|
| 247 |
- public SetMultimap<Class<? extends ReferentialDto>, String> getReferentialIds() {
|
|
| 248 |
+ public ReferentialIds getReferentialIds() {
|
|
| 248 | 249 |
SetMultimap<Class<? extends ReferentialDto>, String> result = LinkedHashMultimap.create();
|
| 249 | 250 |
for (Class<? extends ReferentialDto> dtoType : ObserveBusinessProject.get().getReferentialTypes()) {
|
| 250 | 251 |
ReferentialDtoEntityContext<?, ?, ?, ?> spi = ObservePersistenceBusinessProject.fromReferentialDto(dtoType);
|
| 251 | 252 |
List<String> allIds = spi.getDao(getTopiaPersistenceContext()).findAllIds();
|
| 252 | 253 |
result.putAll(dtoType, allIds);
|
| 253 | 254 |
}
|
| 254 |
- return result;
|
|
| 255 |
+ return ReferentialIds.of(result);
|
|
| 255 | 256 |
}
|
| 256 | 257 |
|
| 257 | 258 |
@Override
|