Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe
Commits:
-
2434a371
by Tony Chemit at 2020-12-17T06:05:56+01:00
-
512a2d47
by Tony Chemit at 2020-12-17T06:11:48+01:00
-
95c108a1
by Tony Chemit at 2020-12-17T06:11:48+01:00
4 changed files:
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/actions/create/CreateNewContentTableUIEntry.java
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/data/simple/ContentSimpleUIModelSupport.java
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/menu/actions/ImportStorageFromFileAction.java
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/menu/actions/LoadStorageActionSupport.java
Changes:
| ... | ... | @@ -60,7 +60,7 @@ public class CreateNewContentTableUIEntry<U extends ContentUI> extends ContentUI |
| 60 | 60 |
JMenuItem editor = new JMenuItem();
|
| 61 | 61 |
String fieldName = "add" + StringUtils.capitalize(dtoType.getSimpleName().replace("Dto", ""));
|
| 62 | 62 |
editor.setName(fieldName);
|
| 63 |
- log.info("Create new action: " + fieldName);
|
|
| 63 |
+ log.debug("Create new action: " + fieldName);
|
|
| 64 | 64 |
ui.get$objectMap().put(editor.getName(), editor);
|
| 65 | 65 |
init(ui, editor, action);
|
| 66 | 66 |
return editor;
|
| ... | ... | @@ -99,8 +99,9 @@ public abstract class ContentSimpleUIModelSupport<D extends DataDto> extends Con |
| 99 | 99 |
if (result) {
|
| 100 | 100 |
D bean = getStates().getBean();
|
| 101 | 101 |
result = ContentTableUINavigationInitializer.isEnabled(bean, dtoType);
|
| 102 |
- if (result) { // got a matching bean property
|
|
| 103 |
- log.info(String.format("%sUse dto bean property to enable %s create action.", getPrefix(), dtoType.getName()));
|
|
| 102 |
+ if (result) {
|
|
| 103 |
+ // got a matching bean property
|
|
| 104 |
+ log.debug(String.format("%sUse dto bean property to enable %s create action.", getPrefix(), dtoType.getName()));
|
|
| 104 | 105 |
}
|
| 105 | 106 |
return result;
|
| 106 | 107 |
}
|
| ... | ... | @@ -26,9 +26,7 @@ import fr.ird.observe.client.constants.CreationMode; |
| 26 | 26 |
import fr.ird.observe.client.constants.DbMode;
|
| 27 | 27 |
import fr.ird.observe.client.datasource.editor.api.wizard.StorageStep;
|
| 28 | 28 |
import fr.ird.observe.client.datasource.editor.api.wizard.StorageUI;
|
| 29 |
-import fr.ird.observe.client.datasource.editor.api.wizard.StorageUILauncher;
|
|
| 30 | 29 |
import fr.ird.observe.client.datasource.editor.api.wizard.StorageUIModel;
|
| 31 |
-import fr.ird.observe.client.main.ObserveMainUI;
|
|
| 32 | 30 |
import org.apache.logging.log4j.LogManager;
|
| 33 | 31 |
import org.apache.logging.log4j.Logger;
|
| 34 | 32 |
|
| ... | ... | @@ -76,19 +74,9 @@ public class ImportStorageFromFileAction extends LoadStorageActionSupport { |
| 76 | 74 |
}
|
| 77 | 75 |
}
|
| 78 | 76 |
|
| 79 |
- @Override
|
|
| 80 |
- protected StorageUILauncher startWizard(ObserveMainUI mainUI) {
|
|
| 81 |
- if (getObserveDataSourcesManager().getOptionalMainDataSource().isPresent()) {
|
|
| 82 |
- log.info("Closing datasource...");
|
|
| 83 |
- getDataSourceEditorBodyContent().doCloseStorage();
|
|
| 84 |
- }
|
|
| 85 |
- return super.startWizard(mainUI);
|
|
| 86 |
- }
|
|
| 87 |
- |
|
| 88 | 77 |
@Override
|
| 89 | 78 |
protected void doChangeStorage(StorageUI ui) {
|
| 90 | 79 |
log.info("Start importing new datasource from backup file...");
|
| 91 |
- |
|
| 92 | 80 |
super.doChangeStorage(ui);
|
| 93 | 81 |
}
|
| 94 | 82 |
}
|
| ... | ... | @@ -22,6 +22,7 @@ package fr.ird.observe.client.datasource.editor.api.menu.actions; |
| 22 | 22 |
* #L%
|
| 23 | 23 |
*/
|
| 24 | 24 |
|
| 25 |
+import fr.ird.observe.client.datasource.editor.api.DataSourceEditor;
|
|
| 25 | 26 |
import fr.ird.observe.client.datasource.editor.api.loading.LoadingDataSourceContext;
|
| 26 | 27 |
import fr.ird.observe.client.datasource.editor.api.loading.close.CloseDataSourceAction;
|
| 27 | 28 |
import fr.ird.observe.client.datasource.editor.api.loading.open.OpenDataSourceAction;
|
| ... | ... | @@ -70,9 +71,12 @@ public abstract class LoadStorageActionSupport extends DataSourceEditorMenuActio |
| 70 | 71 |
JAXXContext rootContext = ui == null ? mainUI : ui;
|
| 71 | 72 |
return new StorageUILauncher(rootContext, mainUI, getTitle()) {
|
| 72 | 73 |
|
| 74 |
+ boolean withPreviousDatasource;
|
|
| 75 |
+ |
|
| 73 | 76 |
@Override
|
| 74 | 77 |
protected void init(StorageUI ui) {
|
| 75 | 78 |
super.init(ui);
|
| 79 |
+ withPreviousDatasource = getClientUIContext().getDataSourcesManager().getOptionalMainDataSource().isPresent();
|
|
| 76 | 80 |
LoadStorageActionSupport.this.init(ui);
|
| 77 | 81 |
}
|
| 78 | 82 |
|
| ... | ... | @@ -82,6 +86,13 @@ public abstract class LoadStorageActionSupport extends DataSourceEditorMenuActio |
| 82 | 86 |
doChangeStorage(ui);
|
| 83 | 87 |
}
|
| 84 | 88 |
|
| 89 |
+ @Override
|
|
| 90 |
+ public void doClose(StorageUI ui, boolean wasCanceled) {
|
|
| 91 |
+ super.doClose(ui, wasCanceled);
|
|
| 92 |
+ if (wasCanceled && withPreviousDatasource) {
|
|
| 93 |
+ mainUI.changeBodyContent(DataSourceEditor.class);
|
|
| 94 |
+ }
|
|
| 95 |
+ }
|
|
| 85 | 96 |
};
|
| 86 | 97 |
}
|
| 87 | 98 |
|