Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe
Commits:
-
e2ae3d0e
by Tony Chemit at 2020-12-17T08:19:32+01:00
-
5094b739
by Tony Chemit at 2020-12-17T08:27:37+01:00
16 changed files:
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/DataSourceEditorHandler.java
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/DataSourceEditorLayerUI.java
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/DataSourceEditorModel.java
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/ContentUIManager.java
- 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/actions/mode/ChangeMode.java
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/data/TripActionHelper.java
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/data/edit/actions/SaveEditUIAdapter.java
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/data/open/actions/SaveOpenableUIAdapter.java
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/navigation/NavigationTree.java
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/navigation/NavigationTreeSelectionListenerImpl.java
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/navigation/NavigationTreeShowPopupHandler.java
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/navigation/NavigationUIInitializer.java
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/navigation/tree/root/RootNavigationNode.java
- client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/RouteCloseCallback.java
- models/dto/src/main/models/Observe-01-referential-common.model
Changes:
| ... | ... | @@ -25,6 +25,7 @@ package fr.ird.observe.client.datasource.editor.api; |
| 25 | 25 |
import fr.ird.observe.client.ClientUIContext;
|
| 26 | 26 |
import fr.ird.observe.client.WithClientUIContext;
|
| 27 | 27 |
import fr.ird.observe.client.datasource.editor.api.actions.ChangeEditorFocus;
|
| 28 |
+import fr.ird.observe.client.datasource.editor.api.content.ContentUI;
|
|
| 28 | 29 |
import fr.ird.observe.client.datasource.editor.api.content.ContentUIManager;
|
| 29 | 30 |
import fr.ird.observe.client.datasource.editor.api.content.validation.ContentMessageTableRenderer;
|
| 30 | 31 |
import fr.ird.observe.client.datasource.editor.api.navigation.NavigationTree;
|
| ... | ... | @@ -32,12 +33,15 @@ import fr.ird.observe.client.datasource.editor.api.navigation.NavigationTreeMode |
| 32 | 33 |
import fr.ird.observe.client.util.ProgressModel;
|
| 33 | 34 |
import fr.ird.observe.client.util.UIHelper;
|
| 34 | 35 |
import fr.ird.observe.client.util.init.UIInitHelper;
|
| 36 |
+import fr.ird.observe.client.util.session.ObserveSwingSessionHelper;
|
|
| 35 | 37 |
import org.apache.logging.log4j.LogManager;
|
| 36 | 38 |
import org.apache.logging.log4j.Logger;
|
| 37 | 39 |
import org.nuiton.jaxx.runtime.spi.UIHandler;
|
| 38 | 40 |
import org.nuiton.jaxx.validator.swing.SwingValidatorUtil;
|
| 39 | 41 |
|
| 42 |
+import javax.swing.JComponent;
|
|
| 40 | 43 |
import javax.swing.SwingUtilities;
|
| 44 |
+import java.awt.BorderLayout;
|
|
| 41 | 45 |
import java.util.Objects;
|
| 42 | 46 |
|
| 43 | 47 |
/**
|
| ... | ... | @@ -49,6 +53,8 @@ public class DataSourceEditorHandler implements UIHandler<DataSourceEditor>, Wit |
| 49 | 53 |
private static final Logger log = LogManager.getLogger(DataSourceEditorHandler.class);
|
| 50 | 54 |
|
| 51 | 55 |
private DataSourceEditor ui;
|
| 56 |
+ private ObserveSwingSessionHelper swingSessionHelper;
|
|
| 57 |
+ private boolean contentAdjusting;
|
|
| 52 | 58 |
|
| 53 | 59 |
@Override
|
| 54 | 60 |
public void beforeInit(DataSourceEditor ui) {
|
| ... | ... | @@ -57,8 +63,9 @@ public class DataSourceEditorHandler implements UIHandler<DataSourceEditor>, Wit |
| 57 | 63 |
ui.setContextValue(model.getDatasourceMenuModel());
|
| 58 | 64 |
ui.setContextValue(model.getNavigationMenuModel());
|
| 59 | 65 |
ClientUIContext clientUIContext = getClientUIContext();
|
| 66 |
+ swingSessionHelper = clientUIContext.getObserveSwingSessionHelper();
|
|
| 60 | 67 |
ui.setContextValue(clientUIContext.getClientConfig());
|
| 61 |
- ui.setContextValue(new ContentUIManager(clientUIContext.getMainUI().getMainUIBodyContentManager(), clientUIContext.getObserveSwingSessionHelper()));
|
|
| 68 |
+ ui.setContextValue(new ContentUIManager(clientUIContext.getMainUI().getMainUIBodyContentManager()));
|
|
| 62 | 69 |
}
|
| 63 | 70 |
|
| 64 | 71 |
@Override
|
| ... | ... | @@ -77,6 +84,43 @@ public class DataSourceEditorHandler implements UIHandler<DataSourceEditor>, Wit |
| 77 | 84 |
|
| 78 | 85 |
// register this action since there is no editor on which attach this action
|
| 79 | 86 |
ChangeEditorFocus.init(ui, null, ChangeEditorFocus.class);
|
| 87 |
+ |
|
| 88 |
+ ui.getModel().addPropertyChangeListener(DataSourceEditorModel.PROPERTY_CONTENT, evt -> onContentChanged((ContentUI) evt.getOldValue(), (ContentUI) evt.getNewValue()));
|
|
| 89 |
+ }
|
|
| 90 |
+ |
|
| 91 |
+ private void onContentChanged(ContentUI previousContentUI, ContentUI contentUI) {
|
|
| 92 |
+ if (contentAdjusting) {
|
|
| 93 |
+ return;
|
|
| 94 |
+ }
|
|
| 95 |
+ contentAdjusting = true;
|
|
| 96 |
+ try {
|
|
| 97 |
+ log.info(String.format("Content ui changed from: %s to %s", previousContentUI == null ? null : previousContentUI.getModel().getPrefix(), contentUI == null ? null : contentUI.getModel().getPrefix()));
|
|
| 98 |
+ if (previousContentUI != null) {
|
|
| 99 |
+ log.info(String.format("[%s] Will destroy previous content ui", previousContentUI.getClass().getSimpleName()));
|
|
| 100 |
+ previousContentUI.destroy();
|
|
| 101 |
+ }
|
|
| 102 |
+ if (contentUI == null) {
|
|
| 103 |
+ setNoContent();
|
|
| 104 |
+ } else {
|
|
| 105 |
+ setContent(contentUI);
|
|
| 106 |
+ openContent(contentUI);
|
|
| 107 |
+ }
|
|
| 108 |
+ } catch (Exception e) {
|
|
| 109 |
+ setNoContent();
|
|
| 110 |
+ ui.getModel().setContent(null);
|
|
| 111 |
+ } finally {
|
|
| 112 |
+ contentAdjusting = false;
|
|
| 113 |
+ }
|
|
| 114 |
+ }
|
|
| 115 |
+ |
|
| 116 |
+ private void setNoContent() {
|
|
| 117 |
+ setContent(ui.getEmptySelection());
|
|
| 118 |
+ }
|
|
| 119 |
+ |
|
| 120 |
+ private void setContent(JComponent content) {
|
|
| 121 |
+ log.info("Set content: " + content.getName());
|
|
| 122 |
+ ui.getContent().removeAll();
|
|
| 123 |
+ ui.getContent().add(content, BorderLayout.CENTER);
|
|
| 80 | 124 |
}
|
| 81 | 125 |
|
| 82 | 126 |
public void updateContentSize() {
|
| ... | ... | @@ -88,21 +132,28 @@ public class DataSourceEditorHandler implements UIHandler<DataSourceEditor>, Wit |
| 88 | 132 |
ui.getContentSplitPane().setDividerLocation(plusSize);
|
| 89 | 133 |
}
|
| 90 | 134 |
|
| 135 |
+ public void openContent(ContentUI contentUI) {
|
|
| 136 |
+ log.info(String.format("%sWill open ui", contentUI.getModel().getPrefix()));
|
|
| 137 |
+ contentUI.open();
|
|
| 138 |
+ updateContentSize();
|
|
| 139 |
+ swingSessionHelper.addComponent(contentUI, true);
|
|
| 140 |
+ swingSessionHelper.save();
|
|
| 141 |
+ log.info(String.format("%s opened", contentUI.getModel().getPrefix()));
|
|
| 142 |
+ SwingUtilities.invokeLater(contentUI::opened);
|
|
| 143 |
+ }
|
|
| 144 |
+ |
|
| 91 | 145 |
/**
|
| 92 |
- * Charge dans l'ui un nouveau modèle de navigation.
|
|
| 146 |
+ * Charge dans l'interface graphique un nouveau modèle de navigation.
|
|
| 93 | 147 |
*
|
| 94 |
- * <b>Note:</b> cette méthode doit être appelée après tout rechargement de modèle de naivgation.
|
|
| 148 |
+ * <b>Note:</b> cette méthode doit être appelée après tout rechargement de modèle de navigation.
|
|
| 95 | 149 |
*
|
| 96 | 150 |
* @param progressModel the progress model to interact with ui
|
| 97 | 151 |
*/
|
| 98 | 152 |
public void loadNavigationUI(ProgressModel progressModel) {
|
| 99 |
- |
|
| 100 | 153 |
NavigationTree tree = ui.getNavigationUI().getTree();
|
| 101 |
- |
|
| 102 | 154 |
NavigationTreeModel treeModel = tree.getModel();
|
| 103 | 155 |
treeModel.populate(false);
|
| 104 | 156 |
progressModel.increments();
|
| 105 |
- |
|
| 106 | 157 |
// select initial node
|
| 107 | 158 |
try {
|
| 108 | 159 |
tree.selectInitialNode();
|
| ... | ... | @@ -110,9 +161,7 @@ public class DataSourceEditorHandler implements UIHandler<DataSourceEditor>, Wit |
| 110 | 161 |
log.error("Could not load initial node", e);
|
| 111 | 162 |
}
|
| 112 | 163 |
progressModel.increments();
|
| 113 |
- |
|
| 114 | 164 |
tree.setVisible(true);
|
| 115 |
- |
|
| 116 | 165 |
ui.getModel().setFocusOnNavigation(true);
|
| 117 | 166 |
}
|
| 118 | 167 |
|
| ... | ... | @@ -117,7 +117,7 @@ public class DataSourceEditorLayerUI extends AbstractLayerUI<JComponent> impleme |
| 117 | 117 |
log.debug("Set focus on content");
|
| 118 | 118 |
editor.getNavigationView().setBorder(getNoFocusBorder());
|
| 119 | 119 |
editor.getContentSplitPane().setBorder(getFocusBorder());
|
| 120 |
- ContentUI contentUI = editor.getContentUIManager().getSelectedContentUI();
|
|
| 120 |
+ ContentUI contentUI = editor.getModel().getContent();
|
|
| 121 | 121 |
if (contentUI != null) {
|
| 122 | 122 |
Component focusComponent = contentUI.getModel().getStates().getFormFocusOwner();
|
| 123 | 123 |
if (focusComponent == null) {
|
| ... | ... | @@ -39,7 +39,7 @@ import java.util.Objects; |
| 39 | 39 |
public class DataSourceEditorModel extends AbstractJavaBean {
|
| 40 | 40 |
|
| 41 | 41 |
public static final String PROPERTY_FOCUS_ON_NAVIGATION = "focusOnNavigation";
|
| 42 |
- private static final String PROPERTY_CONTENT = "content";
|
|
| 42 |
+ public static final String PROPERTY_CONTENT = "content";
|
|
| 43 | 43 |
/**
|
| 44 | 44 |
* Shared message table model.
|
| 45 | 45 |
*/
|
| ... | ... | @@ -78,6 +78,11 @@ public class DataSourceEditorModel extends AbstractJavaBean { |
| 78 | 78 |
return content;
|
| 79 | 79 |
}
|
| 80 | 80 |
|
| 81 |
+ @SuppressWarnings("unchecked")
|
|
| 82 |
+ public <U extends ContentUI> U getTypedContent() {
|
|
| 83 |
+ return (U) content;
|
|
| 84 |
+ }
|
|
| 85 |
+ |
|
| 81 | 86 |
public void setContent(ContentUI content) {
|
| 82 | 87 |
ContentUI oldValue = getContent();
|
| 83 | 88 |
this.content = content;
|
| ... | ... | @@ -25,17 +25,11 @@ import fr.ird.observe.client.datasource.editor.api.DataSourceEditor; |
| 25 | 25 |
import fr.ird.observe.client.datasource.editor.api.DataSourceEditorBodyContent;
|
| 26 | 26 |
import fr.ird.observe.client.datasource.editor.api.navigation.tree.NavigationNode;
|
| 27 | 27 |
import fr.ird.observe.client.main.body.MainUIBodyContentManager;
|
| 28 |
-import fr.ird.observe.client.util.UIHelper;
|
|
| 29 |
-import fr.ird.observe.client.util.session.ObserveSwingSessionHelper;
|
|
| 30 | 28 |
import org.apache.logging.log4j.LogManager;
|
| 31 | 29 |
import org.apache.logging.log4j.Logger;
|
| 32 | 30 |
import org.nuiton.jaxx.runtime.JAXXContext;
|
| 33 | 31 |
import org.nuiton.jaxx.runtime.context.JAXXInitialContext;
|
| 34 | 32 |
|
| 35 |
-import javax.swing.JPanel;
|
|
| 36 |
-import javax.swing.SwingUtilities;
|
|
| 37 |
-import java.awt.BorderLayout;
|
|
| 38 |
-import java.awt.Component;
|
|
| 39 | 33 |
import java.lang.reflect.Constructor;
|
| 40 | 34 |
|
| 41 | 35 |
/**
|
| ... | ... | @@ -49,7 +43,6 @@ public class ContentUIManager { |
| 49 | 43 |
|
| 50 | 44 |
private static final Logger log = LogManager.getLogger(ContentUIManager.class);
|
| 51 | 45 |
|
| 52 |
- private final ObserveSwingSessionHelper swingSessionHelper;
|
|
| 53 | 46 |
private final DataSourceEditorBodyContent dataSourceEditorBody;
|
| 54 | 47 |
|
| 55 | 48 |
public static JAXXInitialContext newContext(ContentUI parent) {
|
| ... | ... | @@ -63,178 +56,54 @@ public class ContentUIManager { |
| 63 | 56 |
.add(dataSourceEditor);
|
| 64 | 57 |
}
|
| 65 | 58 |
|
| 66 |
- public ContentUIManager(MainUIBodyContentManager mainUIBodyContentManager, ObserveSwingSessionHelper swingSessionHelper) {
|
|
| 67 |
- this.swingSessionHelper = swingSessionHelper;
|
|
| 59 |
+ public ContentUIManager(MainUIBodyContentManager mainUIBodyContentManager) {
|
|
| 68 | 60 |
this.dataSourceEditorBody = mainUIBodyContentManager.getBodyTyped(DataSourceEditor.class, DataSourceEditorBodyContent.class);
|
| 69 | 61 |
}
|
| 70 | 62 |
|
| 71 |
- public <U extends ContentUI> U getContent() {
|
|
| 72 |
- JPanel layoutContent = getLayoutContent();
|
|
| 73 |
- Component currentContent = layoutContent.getComponent(0);
|
|
| 74 |
- if (!(currentContent instanceof ContentUI)) {
|
|
| 75 |
- return null;
|
|
| 76 |
- }
|
|
| 77 |
- @SuppressWarnings("unchecked") U content = (U) currentContent;
|
|
| 78 |
- log.debug(String.format("Will use existing content: %s", content.getClass().getName()));
|
|
| 79 |
- return content;
|
|
| 80 |
- }
|
|
| 81 |
- |
|
| 82 | 63 |
public void closeSafeSelectedContentUI() {
|
| 83 |
- ContentUI selectedContentUI = getSelectedContentUI();
|
|
| 64 |
+ ContentUI selectedContentUI = getDataSourceEditor().getModel().getContent();
|
|
| 84 | 65 |
if (selectedContentUI != null) {
|
| 85 | 66 |
selectedContentUI.getHandler().getContentOpen().closeSafeUI();
|
| 86 | 67 |
}
|
| 87 | 68 |
}
|
| 88 | 69 |
|
| 89 | 70 |
public <U extends ContentUI> U createContent(NavigationNode node, Class<U> uiClass) {
|
| 90 |
- DataSourceEditor dataSourceEditor = getDataSourceEditor();
|
|
| 91 |
- JAXXInitialContext jaxxInitialContext = newContext(dataSourceEditor, node);
|
|
| 92 |
- U result;
|
|
| 93 | 71 |
try {
|
| 94 | 72 |
Constructor<U> constructor = uiClass.getConstructor(JAXXContext.class);
|
| 95 | 73 |
log.info(String.format("[%s] Will create new ui", uiClass.getSimpleName()));
|
| 96 |
- result = constructor.newInstance(jaxxInitialContext);
|
|
| 74 |
+ JAXXInitialContext jaxxInitialContext = newContext(getDataSourceEditor(), node);
|
|
| 75 |
+ return constructor.newInstance(jaxxInitialContext);
|
|
| 97 | 76 |
} catch (Exception e) {
|
| 98 | 77 |
throw new IllegalStateException("Could not create content ui " + uiClass, e);
|
| 99 | 78 |
}
|
| 100 |
- try {
|
|
| 101 |
- // ajout du content dans son parent
|
|
| 102 |
- getLayoutContent().removeAll();
|
|
| 103 |
- getLayoutContent().add(result, BorderLayout.CENTER);
|
|
| 104 |
- log.debug(String.format("Add new content: %s", result.getClass().getName()));
|
|
| 105 |
- return result;
|
|
| 106 |
- } catch (Exception e) {
|
|
| 107 |
- throw new IllegalStateException("Could not init content ui " + uiClass, e);
|
|
| 108 |
- }
|
|
| 109 |
- }
|
|
| 110 |
- |
|
| 111 |
- public void openContent(ContentUI content) {
|
|
| 112 |
- log.info(String.format("%sWill open ui", content.getModel().getPrefix()));
|
|
| 113 |
- boolean withError = false;
|
|
| 114 |
- try {
|
|
| 115 |
- content.open();
|
|
| 116 |
- } catch (Exception e) {
|
|
| 117 |
- //FIXME:BodyContent See what to do exactly in this case, remove everything ?
|
|
| 118 |
- UIHelper.handlingError(e);
|
|
| 119 |
- withError = true;
|
|
| 120 |
- } finally {
|
|
| 121 |
- if (!withError) {
|
|
| 122 |
- getLayoutContent().removeAll();
|
|
| 123 |
- getLayoutContent().add(content, BorderLayout.CENTER);
|
|
| 124 |
- getDataSourceEditor().updateContentSize();
|
|
| 125 |
- |
|
| 126 |
- swingSessionHelper.addComponent(content, true);
|
|
| 127 |
- swingSessionHelper.save();
|
|
| 128 |
- log.info(String.format("%s opened", content.getModel().getPrefix()));
|
|
| 129 |
- |
|
| 130 |
- SwingUtilities.invokeLater(content::opened);
|
|
| 131 |
- }
|
|
| 132 |
- }
|
|
| 133 |
- }
|
|
| 134 |
- |
|
| 135 |
- public void close() {
|
|
| 136 |
- getLayoutContent().removeAll();
|
|
| 137 |
- getLayoutContent().add(getDataSourceEditor().getEmptySelection(), BorderLayout.CENTER);
|
|
| 138 |
- }
|
|
| 139 |
- |
|
| 140 |
- public ContentUI getSelectedContentUI() {
|
|
| 141 |
- return getSelectedContentUI(getDataSourceEditor());
|
|
| 142 |
- }
|
|
| 143 |
- |
|
| 144 |
- public boolean closeSelectedContentUI() {
|
|
| 145 |
- return closeSelectedContentUI(getDataSourceEditor());
|
|
| 146 | 79 |
}
|
| 147 | 80 |
|
| 148 | 81 |
/**
|
| 149 | 82 |
* Essaye de fermer l'écran d'édition s'il existe.
|
| 150 | 83 |
*
|
| 151 |
- * @param dataSourceEditor l'ui principale
|
|
| 152 |
- * @return {@code true} si le contenu a bien été fermé, {@code false} si on
|
|
| 153 |
- * ne peut pas fermer l'écran
|
|
| 84 |
+ * @return {@code true} si le contenu a bien été fermé, {@code false} si on ne peut pas fermer l'écran
|
|
| 154 | 85 |
* @since 1.5
|
| 155 | 86 |
*/
|
| 156 |
- public boolean closeSelectedContentUI(DataSourceEditor dataSourceEditor) {
|
|
| 157 |
- ContentUI ui = getSelectedContentUI(dataSourceEditor);
|
|
| 87 |
+ public boolean closeSelectedContentUI() {
|
|
| 88 |
+ ContentUI ui = getDataSourceEditor().getModel().getContent();
|
|
| 158 | 89 |
if (ui == null) {
|
| 159 | 90 |
// no content ui
|
| 160 | 91 |
return true;
|
| 161 | 92 |
}
|
| 162 | 93 |
log.info(String.format("[%s] Will close ui", ui.getClass().getSimpleName()));
|
| 163 |
- boolean closed = false;
|
|
| 94 |
+ boolean closed;
|
|
| 164 | 95 |
try {
|
| 165 | 96 |
closed = ui.close();
|
| 166 | 97 |
} catch (Exception e) {
|
| 167 |
- UIHelper.handlingError(e);
|
|
| 98 |
+ log.error(String.format("%sCould not close ui", ui.getModel().getPrefix()), e);
|
|
| 99 |
+ // still we accept to qui the content
|
|
| 100 |
+ closed = true;
|
|
| 168 | 101 |
}
|
| 169 | 102 |
return closed;
|
| 170 | 103 |
}
|
| 171 | 104 |
|
| 172 |
- public void removeSelectedContentUI() {
|
|
| 173 |
- ContentUI selectedContentUI = getSelectedContentUI();
|
|
| 174 |
- if (selectedContentUI != null) {
|
|
| 175 |
- try {
|
|
| 176 |
- getLayoutContent().removeAll();
|
|
| 177 |
- } catch (Exception e) {
|
|
| 178 |
- e.printStackTrace();
|
|
| 179 |
- }
|
|
| 180 |
- log.info(String.format("[%s] Will destroy ui", selectedContentUI.getClass().getSimpleName()));
|
|
| 181 |
- selectedContentUI.destroy();
|
|
| 182 |
- }
|
|
| 183 |
- getLayoutContent().add(getDataSourceEditor().getEmptySelection(), BorderLayout.CENTER);
|
|
| 184 |
- }
|
|
| 185 |
- |
|
| 186 |
- //FIXME:BodyContent Who used this ?
|
|
| 187 |
-// public void restartEdit() {
|
|
| 188 |
-//
|
|
| 189 |
-// ContentUI selectedUI = getSelectedContentUI();
|
|
| 190 |
-// if (selectedUI == null) {
|
|
| 191 |
-// // pas d'écran selectionne
|
|
| 192 |
-// return;
|
|
| 193 |
-// }
|
|
| 194 |
-// ContentUIModel model = selectedUI.getModel();
|
|
| 195 |
-// if (!model.isEditable()) {
|
|
| 196 |
-// // modele non editable
|
|
| 197 |
-// return;
|
|
| 198 |
-// }
|
|
| 199 |
-//
|
|
| 200 |
-// if (!model.isUpdatingMode()) {
|
|
| 201 |
-// // ecran non en mode mis a jour
|
|
| 202 |
-// return;
|
|
| 203 |
-// }
|
|
| 204 |
-//
|
|
| 205 |
-// log.info(String.format("[%s] Will restart edit ui", selectedUI.getClass().getSimpleName()));
|
|
| 206 |
-// selectedUI.restartEdit();
|
|
| 207 |
-// }
|
|
| 208 |
- |
|
| 209 |
- @Override
|
|
| 210 |
- protected void finalize() throws Throwable {
|
|
| 211 |
- super.finalize();
|
|
| 212 |
- close();
|
|
| 213 |
- }
|
|
| 214 |
- |
|
| 215 |
- private JPanel getLayoutContent() {
|
|
| 216 |
- return getDataSourceEditor().getContent();
|
|
| 217 |
- }
|
|
| 218 |
- |
|
| 219 | 105 |
private DataSourceEditor getDataSourceEditor() {
|
| 220 | 106 |
return dataSourceEditorBody.get();
|
| 221 | 107 |
}
|
| 222 | 108 |
|
| 223 |
- private ContentUI getSelectedContentUI(DataSourceEditor ui) {
|
|
| 224 |
- if (ui == null) {
|
|
| 225 |
- // no ui, so no modification
|
|
| 226 |
- return null;
|
|
| 227 |
- }
|
|
| 228 |
- ContentUI result = null;
|
|
| 229 |
- JPanel container = ui.getContent();
|
|
| 230 |
- if (container.getComponentCount() < 1) {
|
|
| 231 |
- return null;
|
|
| 232 |
- }
|
|
| 233 |
- Component currentContent = container.getComponent(0);
|
|
| 234 |
- if (currentContent instanceof ContentUI) {
|
|
| 235 |
- result = (ContentUI) currentContent;
|
|
| 236 |
- }
|
|
| 237 |
- return result;
|
|
| 238 |
- }
|
|
| 239 |
- |
|
| 240 | 109 |
}
|
| ... | ... | @@ -83,7 +83,7 @@ public class CreateNewContentTableUIEntry<U extends ContentUI> extends ContentUI |
| 83 | 83 |
ContentTableUI<?, ?, ?> newContentUI;
|
| 84 | 84 |
if (!source.equals(selectedNode)) {
|
| 85 | 85 |
tree.selectSafeNode(selectedNode);
|
| 86 |
- newContentUI = (ContentTableUI<?, ?, ?>) getDataSourceEditor().getContentUIManager().getSelectedContentUI();
|
|
| 86 |
+ newContentUI = (ContentTableUI<?, ?, ?>) getDataSourceEditor().getModel().getContent();
|
|
| 87 | 87 |
} else {
|
| 88 | 88 |
newContentUI = (ContentTableUI<?, ?, ?>) ui;
|
| 89 | 89 |
}
|
| ... | ... | @@ -251,22 +251,18 @@ public class ChangeMode<U extends ContentUI> extends ContentUIActionSupport<U> { |
| 251 | 251 |
}
|
| 252 | 252 |
|
| 253 | 253 |
public void rebuildEditableZone(U ui) {
|
| 254 |
-// ui.getActions().setVisible(true);
|
|
| 255 | 254 |
ui.getHandler().getDataSourceEditor().getMessageView().setVisible(true);
|
| 256 | 255 |
SwingUtilities.invokeLater(ui.getHandler()::fixFormSize);
|
| 257 | 256 |
getDataSourceEditor().updateContentSize();
|
| 258 |
-// ui.getHandler().fixFormSize();
|
|
| 259 | 257 |
}
|
| 260 | 258 |
|
| 261 | 259 |
protected void rebuildNotEditableZone(U ui) {
|
| 262 |
-// ui.getActions().setVisible(false);
|
|
| 263 | 260 |
ui.getHandler().getDataSourceEditor().getMessageView().setVisible(false);
|
| 264 | 261 |
ui.getHandler().fixFormSize();
|
| 265 | 262 |
getDataSourceEditor().updateContentSize();
|
| 266 | 263 |
SwingUtilities.invokeLater(ui.getHandler()::fixFormSize);
|
| 267 | 264 |
}
|
| 268 | 265 |
|
| 269 |
- |
|
| 270 | 266 |
protected void rebuildFocus(U ui, ContentMode mode) {
|
| 271 | 267 |
ContentUIModel model = ui.getModel();
|
| 272 | 268 |
model.setFormFocusOwner(null);
|
| ... | ... | @@ -136,7 +136,7 @@ public abstract class TripActionHelper implements WithClientUIContext { |
| 136 | 136 |
NavigationTree tree = ui.getHandler().getDataSourceEditor().getNavigationUI().getTree();
|
| 137 | 137 |
NavigationNode tripNode = tree.getSelectedNode().upToReferenceNode(getReferenceType());
|
| 138 | 138 |
tree.selectSafeNode(tripNode);
|
| 139 |
- TripUI<?> tripUI = (TripUI<?>) ui.getHandler().getDataSourceEditor().getContentUIManager().getSelectedContentUI();
|
|
| 139 |
+ TripUI<?> tripUI = (TripUI<?>) ui.getHandler().getDataSourceEditor().getModel().getContent();
|
|
| 140 | 140 |
// set availability flag to true
|
| 141 | 141 |
tripUI.getModel().set(availabilityPropertyName, true);
|
| 142 | 142 |
// go to meta-data tab
|
| ... | ... | @@ -59,7 +59,7 @@ public class SaveEditUIAdapter<U extends ContentEditUI<?, U>> implements SaveAda |
| 59 | 59 |
dataSourceEditor.getNavigationUI().getTree().reSelectSafeNode(node);
|
| 60 | 60 |
|
| 61 | 61 |
// apply extra actions from previous opened content (go back to correct tab if any, ...)
|
| 62 |
- U newUi = dataSourceEditor.getContentUIManager().getContent();
|
|
| 62 |
+ U newUi = dataSourceEditor.getModel().getTypedContent();
|
|
| 63 | 63 |
newUi.resetFromPreviousUi(ui);
|
| 64 | 64 |
}
|
| 65 | 65 |
}
|
| ... | ... | @@ -69,12 +69,12 @@ public class SaveOpenableUIAdapter<U extends ContentOpenableUI<?, U>> implements |
| 69 | 69 |
dataSourceEditor.getNavigationUI().getTree().reSelectSafeNode(node);
|
| 70 | 70 |
|
| 71 | 71 |
// apply extra actions from previous opened content (go back to correct tab if any, ...)
|
| 72 |
- U newUi = dataSourceEditor.getContentUIManager().getContent();
|
|
| 72 |
+ U newUi = dataSourceEditor.getModel().getTypedContent();
|
|
| 73 | 73 |
newUi.resetFromPreviousUi(ui);
|
| 74 | 74 |
|
| 75 | 75 |
if (request.isNotPersisted() && predicate.test(bean)) {
|
| 76 | 76 |
// reload ui and do click
|
| 77 |
- U content = dataSourceEditor.getContentUIManager().getContent();
|
|
| 77 |
+ U content = dataSourceEditor.getModel().getTypedContent();
|
|
| 78 | 78 |
SwingUtilities.invokeLater(() -> buttonGetter.apply(content).doClick());
|
| 79 | 79 |
}
|
| 80 | 80 |
}
|
| ... | ... | @@ -45,42 +45,9 @@ public class NavigationTree extends JXTree { |
| 45 | 45 |
|
| 46 | 46 |
public NavigationTree() {
|
| 47 | 47 |
super(new NavigationTreeModel());
|
| 48 |
- |
|
| 49 | 48 |
setLargeModel(true);
|
| 50 | 49 |
setRootVisible(false);
|
| 51 |
- |
|
| 52 |
-// addTreeWillExpandListener(new TreeWillExpandListener() {
|
|
| 53 |
-//
|
|
| 54 |
-// @Override
|
|
| 55 |
-// public void treeWillExpand(TreeExpansionEvent event) throws ExpandVetoException {
|
|
| 56 |
-// getSelectionModel().fireTreeWillExpandEvent(event);
|
|
| 57 |
-// openNode(event.getPath());
|
|
| 58 |
-// }
|
|
| 59 |
-//
|
|
| 60 |
-// @Override
|
|
| 61 |
-// public void treeWillCollapse(TreeExpansionEvent event) throws ExpandVetoException {
|
|
| 62 |
-// //FIXME check this is working ?
|
|
| 63 |
-// getSelectionModel().fireTreeWillCollapseEvent(event);
|
|
| 64 |
-// }
|
|
| 65 |
-// });
|
|
| 66 |
-// addTreeSelectionListener(e -> {
|
|
| 67 |
-// if (!e.isAddedPath()) {
|
|
| 68 |
-// return;
|
|
| 69 |
-// }
|
|
| 70 |
-// openNode(e.getPath());
|
|
| 71 |
-// });
|
|
| 72 |
- |
|
| 73 |
- }
|
|
| 74 |
- |
|
| 75 |
-// public boolean getScrollableTracksViewportWidth() {
|
|
| 76 |
-// return true;
|
|
| 77 |
-// }
|
|
| 78 |
- |
|
| 79 |
-// @Override
|
|
| 80 |
-// public boolean isFixedRowHeight() {
|
|
| 81 |
-// return true;
|
|
| 82 |
-// }
|
|
| 83 |
- |
|
| 50 |
+ }
|
|
| 84 | 51 |
|
| 85 | 52 |
@Override
|
| 86 | 53 |
public void updateUI() {
|
| ... | ... | @@ -157,9 +124,9 @@ public class NavigationTree extends JXTree { |
| 157 | 124 |
NavigationNode selectedNode = getModel().getInitialNode();
|
| 158 | 125 |
log.info(String.format("Initial selected node: %s", selectedNode));
|
| 159 | 126 |
if (selectedNode != null) {
|
| 160 |
- selectSafeNode(selectedNode);
|
|
| 127 |
+ reSelectSafeNode(selectedNode);
|
|
| 161 | 128 |
}
|
| 162 |
- SwingUtilities.invokeLater(this::grabFocus);
|
|
| 129 |
+ SwingUtilities.invokeLater(this::requestFocusInWindow);
|
|
| 163 | 130 |
}
|
| 164 | 131 |
|
| 165 | 132 |
/**
|
| ... | ... | @@ -180,7 +147,7 @@ public class NavigationTree extends JXTree { |
| 180 | 147 |
selectFirstNode();
|
| 181 | 148 |
}
|
| 182 | 149 |
}
|
| 183 |
- SwingUtilities.invokeLater(this::grabFocus);
|
|
| 150 |
+ SwingUtilities.invokeLater(this::requestFocusInWindow);
|
|
| 184 | 151 |
}
|
| 185 | 152 |
|
| 186 | 153 |
public void addUnsavedNode(NavigationNode parentNode, NavigationNode result) {
|
| ... | ... | @@ -24,6 +24,7 @@ package fr.ird.observe.client.datasource.editor.api.navigation; |
| 24 | 24 |
|
| 25 | 25 |
import fr.ird.observe.client.ClientUIContext;
|
| 26 | 26 |
import fr.ird.observe.client.datasource.api.ObserveSwingDataSource;
|
| 27 |
+import fr.ird.observe.client.datasource.editor.api.DataSourceEditorModel;
|
|
| 27 | 28 |
import fr.ird.observe.client.datasource.editor.api.content.ContentUI;
|
| 28 | 29 |
import fr.ird.observe.client.datasource.editor.api.content.ContentUIManager;
|
| 29 | 30 |
import fr.ird.observe.client.datasource.editor.api.navigation.event.NavigationTreeSelectionEvent;
|
| ... | ... | @@ -48,9 +49,11 @@ class NavigationTreeSelectionListenerImpl implements fr.ird.observe.client.datas |
| 48 | 49 |
private final ClientUIContext clientUIContext;
|
| 49 | 50 |
private final ContentUIManager contentUIManager;
|
| 50 | 51 |
private final NavigationUI ui;
|
| 52 |
+ private final DataSourceEditorModel dataSourceEditorModel;
|
|
| 51 | 53 |
private final NavigationTree tree;
|
| 52 | 54 |
|
| 53 |
- NavigationTreeSelectionListenerImpl(ContentUIManager contentUIManager, NavigationUI ui, NavigationTree tree) {
|
|
| 55 |
+ NavigationTreeSelectionListenerImpl(DataSourceEditorModel dataSourceEditorModel, ContentUIManager contentUIManager, NavigationUI ui, NavigationTree tree) {
|
|
| 56 |
+ this.dataSourceEditorModel = Objects.requireNonNull(dataSourceEditorModel);
|
|
| 54 | 57 |
this.tree = Objects.requireNonNull(tree);
|
| 55 | 58 |
this.clientUIContext = tree.getRootNode().getClientUIContext();
|
| 56 | 59 |
this.contentUIManager = Objects.requireNonNull(contentUIManager);
|
| ... | ... | @@ -70,9 +73,8 @@ class NavigationTreeSelectionListenerImpl implements fr.ird.observe.client.datas |
| 70 | 73 |
}
|
| 71 | 74 |
|
| 72 | 75 |
@Override
|
| 73 |
- public void treeWillExpand(TreeExpansionEvent event) throws ExpandVetoException {
|
|
| 76 |
+ public void treeWillExpand(TreeExpansionEvent event) {
|
|
| 74 | 77 |
// do nothing
|
| 75 |
-// tree.getSelectionModel().fireTreeWillExpandEvent(event);
|
|
| 76 | 78 |
TreePath path = event.getPath();
|
| 77 | 79 |
NavigationNode node = (NavigationNode) path.getLastPathComponent();
|
| 78 | 80 |
log.info(String.format("Will expand - do open node: %s", node));
|
| ... | ... | @@ -82,7 +84,7 @@ class NavigationTreeSelectionListenerImpl implements fr.ird.observe.client.datas |
| 82 | 84 |
@Override
|
| 83 | 85 |
public void treeWillCollapse(TreeExpansionEvent event) throws ExpandVetoException {
|
| 84 | 86 |
//FIXME check this is working ?
|
| 85 |
-// tree.getSelectionModel().fireTreeWillCollapseEvent(event);
|
|
| 87 |
+ tree.getSelectionModel().fireTreeWillCollapseEvent(event);
|
|
| 86 | 88 |
|
| 87 | 89 |
NavigationNode node = (NavigationNode) event.getPath().getLastPathComponent();
|
| 88 | 90 |
|
| ... | ... | @@ -111,12 +113,13 @@ class NavigationTreeSelectionListenerImpl implements fr.ird.observe.client.datas |
| 111 | 113 |
if (source == null || !source.isOpen()) {
|
| 112 | 114 |
//FIXME Is this can really happen ? not sure
|
| 113 | 115 |
// no open data source
|
| 114 |
- log.debug("No open Data source.");
|
|
| 116 |
+ log.warn("No open Data source.");
|
|
| 115 | 117 |
return;
|
| 116 | 118 |
}
|
| 117 | 119 |
if (tree.isSelectionEmpty()) {
|
| 118 |
- log.debug("No selection, show empty panel...");
|
|
| 119 |
- contentUIManager.removeSelectedContentUI();
|
|
| 120 |
+ log.info("No selection, show empty panel...");
|
|
| 121 |
+ dataSourceEditorModel.setContent(null);
|
|
| 122 |
+// contentUIManager.removeSelectedContentUI();
|
|
| 120 | 123 |
return;
|
| 121 | 124 |
}
|
| 122 | 125 |
|
| ... | ... | @@ -125,6 +128,7 @@ class NavigationTreeSelectionListenerImpl implements fr.ird.observe.client.datas |
| 125 | 128 |
|
| 126 | 129 |
String params = node.toString();
|
| 127 | 130 |
String message = t("observe.ui.action.open.screen", params);
|
| 131 |
+ log.info("Open selection: " + message);
|
|
| 128 | 132 |
|
| 129 | 133 |
node.open();
|
| 130 | 134 |
|
| ... | ... | @@ -137,75 +141,23 @@ class NavigationTreeSelectionListenerImpl implements fr.ird.observe.client.datas |
| 137 | 141 |
|
| 138 | 142 |
// obtain the ui type to show
|
| 139 | 143 |
Class<? extends ContentUI> uiClass = node.getScope().getContentUiType();
|
| 140 |
- log.info(String.format("new selected path = %s, ui = %s", node, uiClass));
|
|
| 144 |
+ log.info(String.format("Will open content for node = %s, ui = %s", node, uiClass));
|
|
| 141 | 145 |
|
| 142 |
- //FIXME Just for test
|
|
| 143 |
- if (uiClass == null) {
|
|
| 144 |
- //FIXME We should always have a ui associated to node, improve this code to not accept this state
|
|
| 145 |
- // no ui found, do nothing
|
|
| 146 |
- return;
|
|
| 147 |
- }
|
|
| 148 | 146 |
// compute the selected ids to put in data context
|
| 149 | 147 |
node.getContext().storeSelectedNodes(node);
|
| 150 | 148 |
|
| 151 |
- //FIXME:Focus this is not the place to set focus
|
|
| 152 |
-// boolean focusOnNavigation = false;
|
|
| 153 |
-// JComponent focusOwner;
|
|
| 154 |
-// ObserveMainUI mainUI = getClientUIContext().getMainUI();
|
|
| 155 |
-// Component focusOwner1 = mainUI.getFocusOwner();
|
|
| 156 |
-// if (focusOwner1 == null || focusOwner1.equals(ui) || focusOwner1.equals(mainUI)) {
|
|
| 157 |
-// focusOnNavigation = true;
|
|
| 158 |
-// focusOwner = ui.getNavigationUI().getTree();
|
|
| 159 |
-// } else {
|
|
| 160 |
-// focusOwner = (JComponent) mainUI.getFocusOwner();
|
|
| 161 |
-//
|
|
| 162 |
-// if (focusOwner != null) {
|
|
| 163 |
-// if (ui.getNavigationUI().getTree().equals(focusOwner)) {
|
|
| 164 |
-// focusOnNavigation = true;
|
|
| 165 |
-// }
|
|
| 166 |
-// if (ui.getNavigationUI().equals(focusOwner)) {
|
|
| 167 |
-// focusOnNavigation = true;
|
|
| 168 |
-// }
|
|
| 169 |
-// if (ui.getNavigationView().equals(focusOwner)) {
|
|
| 170 |
-// focusOnNavigation = true;
|
|
| 171 |
-// }
|
|
| 172 |
-// if (!focusOnNavigation) {
|
|
| 173 |
-// Container focusOwnerParent = focusOwner.getParentReference();
|
|
| 174 |
-// while (focusOwnerParent != null) {
|
|
| 175 |
-// if (ui.getNavigationUI().getTree().equals(focusOwnerParent)) {
|
|
| 176 |
-// focusOnNavigation = true;
|
|
| 177 |
-// break;
|
|
| 178 |
-// }
|
|
| 179 |
-// if (ui.getNavigationUI().equals(focusOwnerParent)) {
|
|
| 180 |
-// focusOnNavigation = true;
|
|
| 181 |
-// break;
|
|
| 182 |
-// }
|
|
| 183 |
-// if (ui.getNavigationView().equals(focusOwnerParent)) {
|
|
| 184 |
-// focusOnNavigation = true;
|
|
| 185 |
-// break;
|
|
| 186 |
-// }
|
|
| 187 |
-// focusOwnerParent = focusOwnerParent.getParentReference();
|
|
| 188 |
-// }
|
|
| 189 |
-// }
|
|
| 190 |
-// }
|
|
| 191 |
-// }
|
|
| 192 |
-// if (focusOnNavigation) {
|
|
| 193 |
-// log.debug("Focus on navigation: " + focusOwner);
|
|
| 149 |
+// ContentUI previousSelectedContent = contentUIManager.getSelectedContentUI();
|
|
| 150 |
+// if (previousSelectedContent != null) {
|
|
| 151 |
+// contentUIManager.removeSelectedContentUI();
|
|
| 194 | 152 |
// }
|
| 195 | 153 |
|
| 196 |
- ContentUI previousSelectedContent = contentUIManager.getSelectedContentUI();
|
|
| 197 |
- if (previousSelectedContent != null) {
|
|
| 198 |
- contentUIManager.removeSelectedContentUI();
|
|
| 199 |
- }
|
|
| 200 |
- |
|
| 201 | 154 |
// create new content
|
| 202 | 155 |
ContentUI content = contentUIManager.createContent(node, node.getScope().getContentUiType());
|
| 203 | 156 |
|
| 204 | 157 |
// open content
|
| 205 |
- contentUIManager.openContent(content);
|
|
| 158 |
+ dataSourceEditorModel.setContent(content);
|
|
| 159 |
+// contentUIManager.openContent(content);
|
|
| 206 | 160 |
|
| 207 | 161 |
ObserveUtil.cleanMemory();
|
| 208 |
- |
|
| 209 |
-// if (focusOnNavigation) SwingUtilities.invokeLater(focusOwner::requestFocusInWindow);
|
|
| 210 | 162 |
}
|
| 211 | 163 |
}
|
| ... | ... | @@ -22,9 +22,9 @@ package fr.ird.observe.client.datasource.editor.api.navigation; |
| 22 | 22 |
* #L%
|
| 23 | 23 |
*/
|
| 24 | 24 |
|
| 25 |
+import fr.ird.observe.client.datasource.editor.api.DataSourceEditorModel;
|
|
| 25 | 26 |
import fr.ird.observe.client.datasource.editor.api.content.ContentUI;
|
| 26 | 27 |
import fr.ird.observe.client.datasource.editor.api.content.ContentUIHandler;
|
| 27 |
-import fr.ird.observe.client.datasource.editor.api.content.ContentUIManager;
|
|
| 28 | 28 |
import fr.ird.observe.client.datasource.editor.api.navigation.tree.NavigationNode;
|
| 29 | 29 |
import org.apache.logging.log4j.LogManager;
|
| 30 | 30 |
import org.apache.logging.log4j.Logger;
|
| ... | ... | @@ -57,10 +57,10 @@ public class NavigationTreeShowPopupHandler implements KeyListener, MouseListene |
| 57 | 57 |
private final JPopupMenu popup;
|
| 58 | 58 |
private final NavigationTree tree;
|
| 59 | 59 |
private final JMenuItem noAction;
|
| 60 |
- private final ContentUIManager contentUIManager;
|
|
| 60 |
+ private final DataSourceEditorModel dataSourceEditorModel;
|
|
| 61 | 61 |
|
| 62 |
- NavigationTreeShowPopupHandler(ContentUIManager contentUIManager, NavigationTree tree, JPopupMenu popup, JMenuItem noAction) {
|
|
| 63 |
- this.contentUIManager = Objects.requireNonNull(contentUIManager);
|
|
| 62 |
+ NavigationTreeShowPopupHandler(DataSourceEditorModel dataSourceEditorModel, NavigationTree tree, JPopupMenu popup, JMenuItem noAction) {
|
|
| 63 |
+ this.dataSourceEditorModel = Objects.requireNonNull(dataSourceEditorModel);
|
|
| 64 | 64 |
this.popup = Objects.requireNonNull(popup);
|
| 65 | 65 |
this.tree = Objects.requireNonNull(tree);
|
| 66 | 66 |
this.noAction = Objects.requireNonNull(noAction);
|
| ... | ... | @@ -84,7 +84,7 @@ public class NavigationTreeShowPopupHandler implements KeyListener, MouseListene |
| 84 | 84 |
// clean popup
|
| 85 | 85 |
popup.removeAll();
|
| 86 | 86 |
popup.setLabel(selectedNode.toString());
|
| 87 |
- ContentUI selectedContentUI = contentUIManager.getSelectedContentUI();
|
|
| 87 |
+ ContentUI selectedContentUI = dataSourceEditorModel.getContent();
|
|
| 88 | 88 |
ContentUIHandler<?> handler = selectedContentUI.getHandler();
|
| 89 | 89 |
int length = 0;
|
| 90 | 90 |
List<AbstractButton> actions = handler.getNavigationPopupActions();
|
| ... | ... | @@ -187,7 +187,7 @@ public class NavigationTreeShowPopupHandler implements KeyListener, MouseListene |
| 187 | 187 |
// try to change selection
|
| 188 | 188 |
|
| 189 | 189 |
TreePath pathForRow = tree.getPathForRow(closestRowForLocation);
|
| 190 |
- if (pathForRow==null) {
|
|
| 190 |
+ if (pathForRow == null) {
|
|
| 191 | 191 |
e.consume();
|
| 192 | 192 |
return;
|
| 193 | 193 |
}
|
| ... | ... | @@ -23,6 +23,7 @@ package fr.ird.observe.client.datasource.editor.api.navigation; |
| 23 | 23 |
*/
|
| 24 | 24 |
|
| 25 | 25 |
import fr.ird.observe.client.configuration.NavigationTreeConfigBean;
|
| 26 |
+import fr.ird.observe.client.datasource.editor.api.DataSourceEditorModel;
|
|
| 26 | 27 |
import fr.ird.observe.client.datasource.editor.api.content.ContentUIManager;
|
| 27 | 28 |
import fr.ird.observe.client.datasource.editor.api.navigation.actions.ConfigureMenuAction;
|
| 28 | 29 |
import fr.ird.observe.client.util.init.UIInitHelper;
|
| ... | ... | @@ -115,9 +116,10 @@ class NavigationUIInitializer extends UIInitializerSupport<NavigationUI, UIIniti |
| 115 | 116 |
editor.setCellRenderer(new NavigationTreeCellRenderer());
|
| 116 | 117 |
editor.getModel().loadConfig();
|
| 117 | 118 |
NavigationUI ui = initializerContext.getUi();
|
| 119 |
+ DataSourceEditorModel dataSourceEditorModel = Objects.requireNonNull(ui.getContextValue(DataSourceEditorModel.class));
|
|
| 118 | 120 |
ContentUIManager contentUIManager = Objects.requireNonNull(ui.getContextValue(ContentUIManager.class));
|
| 119 |
- editor.installShowPopupHandler(new NavigationTreeShowPopupHandler(contentUIManager, editor, ui.getNavigationPopup(), ui.getNoAction()));
|
|
| 120 |
- NavigationTreeSelectionListenerImpl selectionListener = new NavigationTreeSelectionListenerImpl(contentUIManager, ui, editor);
|
|
| 121 |
+ editor.installShowPopupHandler(new NavigationTreeShowPopupHandler(dataSourceEditorModel, editor, ui.getNavigationPopup(), ui.getNoAction()));
|
|
| 122 |
+ NavigationTreeSelectionListenerImpl selectionListener = new NavigationTreeSelectionListenerImpl(dataSourceEditorModel, contentUIManager, ui, editor);
|
|
| 121 | 123 |
editor.addNavigationTreeSelectionListener(selectionListener);
|
| 122 | 124 |
editor.addTreeWillExpandListener(selectionListener);
|
| 123 | 125 |
editor.addTreeSelectionListener(selectionListener);
|
| ... | ... | @@ -104,9 +104,9 @@ public class RootNavigationNode extends NavigationNode { |
| 104 | 104 |
public NavigationNode findNodeFromPreviousSelectedNode(NavigationNode oldSelectedNode) {
|
| 105 | 105 |
NavigationNode result = this;
|
| 106 | 106 |
TreeNode[] pathToRoot = oldSelectedNode.getPath();
|
| 107 |
- for (int i = 1; i < pathToRoot.length; i++) {
|
|
| 107 |
+ for (TreeNode treeNode : pathToRoot) {
|
|
| 108 | 108 |
NavigationNode next;
|
| 109 |
- NavigationNode oldNode = (NavigationNode) pathToRoot[i];
|
|
| 109 |
+ NavigationNode oldNode = (NavigationNode) treeNode;
|
|
| 110 | 110 |
if (oldNode.getScope().isSelectNode()) {
|
| 111 | 111 |
next = result.findChildByType(oldNode.getClass(), oldNode.getInitializer().getSelectNodeId());
|
| 112 | 112 |
} else {
|
| ... | ... | @@ -146,7 +146,7 @@ public class RouteCloseCallback implements EditNodeCloseCallback, WithClientUICo |
| 146 | 146 |
parentNode.addEmptyActivityUINavigationNode();
|
| 147 | 147 |
|
| 148 | 148 |
// on récupère l'écran d'édition
|
| 149 |
- ActivityUI selectedUI = (ActivityUI) dataSourceEditor.getContentUIManager().getSelectedContentUI();
|
|
| 149 |
+ ActivityUI selectedUI = (ActivityUI) dataSourceEditor.getModel().getContent();
|
|
| 150 | 150 |
|
| 151 | 151 |
// on recupère l'activité de fin de veille
|
| 152 | 152 |
VesselActivityReference vesselActivitySeine = null;
|
| ... | ... | @@ -58,7 +58,7 @@ longitude + {*:1} Float | mayNotNull |
| 58 | 58 |
quadrant + {*:1} Integer | mayNotNull
|
| 59 | 59 |
country {*:0..1} fr.ird.observe.dto.referential.common.CountryReference | notNull
|
| 60 | 60 |
|
| 61 |
-referential.common.LengthLengthParameter > referential.common.LengthFormulaSupport | references=uri,oceanLabel,sexLabel,species,startDate,endDate,inputSizeMeasureType,outputSizeMeasureType,inputOutputFormula,outputInputFormula
|
|
| 61 |
+referential.common.LengthLengthParameter > referential.common.LengthFormulaSupport >> reference.ReferentialDtoReferenceWithNoCodeAware | references=uri,oceanLabel,sexLabel,species,startDate,endDate,inputSizeMeasureType,outputSizeMeasureType,inputOutputFormula,outputInputFormula
|
|
| 62 | 62 |
inputOutputFormula + {*:1} String | notNull
|
| 63 | 63 |
inputOutputFormulaValid + {*:1} boolean
|
| 64 | 64 |
outputInputFormula + {*:1} String | notNull
|
| ... | ... | @@ -66,7 +66,7 @@ outputInputFormulaValid + {*:1} boolean |
| 66 | 66 |
inputSizeMeasureType {*:1} fr.ird.observe.dto.referential.common.SizeMeasureTypeReference | notNull
|
| 67 | 67 |
outputSizeMeasureType {*:1} fr.ird.observe.dto.referential.common.SizeMeasureTypeReference | notNull
|
| 68 | 68 |
|
| 69 |
-referential.common.LengthWeightParameter > referential.common.LengthFormulaSupport | references=uri,oceanLabel,sexLabel,species,startDate,endDate,lengthWeightFormula,weightLengthFormula,sizeMeasureType
|
|
| 69 |
+referential.common.LengthWeightParameter > referential.common.LengthFormulaSupport >> reference.ReferentialDtoReferenceWithNoCodeAware | references=uri,oceanLabel,sexLabel,species,startDate,endDate,lengthWeightFormula,weightLengthFormula,sizeMeasureType
|
|
| 70 | 70 |
lengthWeightFormula + {*:1} String | notNull
|
| 71 | 71 |
weightLengthFormula + {*:1} String | notNull
|
| 72 | 72 |
meanLength + {*:1} Float | strictlyPositiveNumber
|