Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe
Commits:
-
bea39d78
by Tony Chemit at 2023-07-26T16:56:52+02:00
-
ab18e1d6
by Tony Chemit at 2023-07-28T16:05:34+02:00
-
984a29d2
by Tony Chemit at 2023-07-28T16:05:34+02:00
-
f1602cd3
by Tony Chemit at 2023-07-28T16:05:34+02:00
-
5f94b023
by Tony Chemit at 2023-07-28T16:05:34+02:00
-
acd770bf
by Tony Chemit at 2023-07-28T16:05:34+02:00
-
22e5721c
by Tony Chemit at 2023-07-28T16:05:34+02:00
15 changed files:
- client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/AdminTabUI.jaxx
- client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/AdminTabUIHandler.java
- client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/pairing/ActivityPairingUIHandler.java
- client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/report/ReportUIHandler.java
- client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/synchronize/data/DataSynchroUIHandler.java
- client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/synchronize/data/tree/DataSelectionTreePaneHandler.java
- client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/synchronize/referential/ng/ReferentialSynchroUIHandler.java
- client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/synchronize/referential/ng/tree/ReferentialSelectionTreeCellRenderer.java
- client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/validate/ValidateUIHandler.java
- core/persistence/migration/src/main/resources/db/migration/v9/9.2/07_issue-2762-PG.sql
- toolkit/api/src/main/java/fr/ird/observe/dto/I18nDecoratorHelper.java
- toolkit/api/src/main/java/fr/ird/observe/navigation/tree/ToolkitTreeModelSupport.java
- toolkit/api/src/main/java/fr/ird/observe/navigation/tree/selection/SelectionTreeCellRenderer.java
- toolkit/api/src/main/java/fr/ird/observe/navigation/tree/selection/SelectionTreeModelSupport.java
- toolkit/api/src/main/java/fr/ird/observe/navigation/tree/selection/SelectionTreeNodeRendererContext.java
Changes:
| ... | ... | @@ -64,6 +64,7 @@ protected AdminTabUI(AdminUI parentContext) { |
| 64 | 64 | }
|
| 65 | 65 | |
| 66 | 66 | public void destroy() {
|
| 67 | + getHandler().destroy();
|
|
| 67 | 68 | description.setText("");
|
| 68 | 69 | leftSourceModel = null;
|
| 69 | 70 | rightSourceModel = null;
|
| ... | ... | @@ -28,6 +28,8 @@ import org.nuiton.jaxx.runtime.swing.wizard.ext.WizardState; |
| 28 | 28 | import javax.swing.JButton;
|
| 29 | 29 | import javax.swing.JTextArea;
|
| 30 | 30 | import javax.swing.SwingUtilities;
|
| 31 | +import java.awt.GridBagConstraints;
|
|
| 32 | +import java.awt.Insets;
|
|
| 31 | 33 | import java.io.PrintWriter;
|
| 32 | 34 | import java.io.StringWriter;
|
| 33 | 35 | import java.util.Objects;
|
| ... | ... | @@ -169,4 +171,15 @@ public class AdminTabUIHandler<U extends AdminTabUI> implements WithClientUICont |
| 169 | 171 | progression.append(text + "\n");
|
| 170 | 172 | progression.setCaretPosition(progression.getDocument().getLength());
|
| 171 | 173 | }
|
| 174 | + |
|
| 175 | + protected void hideFixedPanelLabel(AdminTabUI ui) {
|
|
| 176 | + // See https://gitlab.com/ultreiaio/ird-observe/-/issues/2767
|
|
| 177 | + // FIXME Maybe we should use a simple JPanel instead?
|
|
| 178 | + ui.getNEED_FIX_panel().removeAll();
|
|
| 179 | + ui.getNEED_FIX_panel().add(ui.getNEED_FIX_content(), new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, 10, 1, new Insets(3, 3, 3, 3), 0, 0));
|
|
| 180 | + }
|
|
| 181 | + |
|
| 182 | + public void destroy() {
|
|
| 183 | + |
|
| 184 | + }
|
|
| 172 | 185 | } |
| ... | ... | @@ -36,5 +36,6 @@ public class ActivityPairingUIHandler extends AdminTabUIHandler<ActivityPairingU |
| 36 | 36 | public void afterInit(ActivityPairingUI ui) {
|
| 37 | 37 | super.afterInit(ui);
|
| 38 | 38 | setAutoStart(ui.getPrepare());
|
| 39 | + hideFixedPanelLabel(ui);
|
|
| 39 | 40 | }
|
| 40 | 41 | } |
| ... | ... | @@ -122,6 +122,7 @@ public class ReportUIHandler extends AdminTabUIHandler<ReportUI> implements UIHa |
| 122 | 122 | }
|
| 123 | 123 | }
|
| 124 | 124 | |
| 125 | + @Override
|
|
| 125 | 126 | public void destroy() {
|
| 126 | 127 | ObserveSwingDataSource dataSource = ui.getModel().getConfigModel().getLeftSourceModel().getSafeSource(false);
|
| 127 | 128 | if (dataSource.isOpen()) {
|
| ... | ... | @@ -32,6 +32,7 @@ import fr.ird.observe.client.util.init.UIInitHelper; |
| 32 | 32 | import org.nuiton.jaxx.runtime.spi.UIHandler;
|
| 33 | 33 | |
| 34 | 34 | import javax.swing.JScrollPane;
|
| 35 | +import javax.swing.ToolTipManager;
|
|
| 35 | 36 | |
| 36 | 37 | import static io.ultreia.java4all.i18n.I18n.t;
|
| 37 | 38 | |
| ... | ... | @@ -54,6 +55,8 @@ public class DataSynchroUIHandler extends AdminTabUIHandler<DataSynchroUI> imple |
| 54 | 55 | SelectUnselectWithOpposite.init(ui.getLeftTreePane().getTree(), null, new SelectUnselectWithOpposite(ui.getRightTreePane().getTree()));
|
| 55 | 56 | JScrollPane descriptionPane = ui.getDescriptionPane();
|
| 56 | 57 | descriptionPane.getParent().remove(descriptionPane);
|
| 58 | + |
|
| 59 | + hideFixedPanelLabel(ui);
|
|
| 57 | 60 | }
|
| 58 | 61 | |
| 59 | 62 | @Override
|
| ... | ... | @@ -64,4 +67,9 @@ public class DataSynchroUIHandler extends AdminTabUIHandler<DataSynchroUI> imple |
| 64 | 67 | configModel.addPropertyChangeListener(StorageUIModel.VALID_PROPERTY_NAME, evt -> getModel().validate());
|
| 65 | 68 | }
|
| 66 | 69 | |
| 70 | + @Override
|
|
| 71 | + public void destroy() {
|
|
| 72 | + ToolTipManager.sharedInstance().unregisterComponent(ui.getLeftTreePane().getTree().getTree());
|
|
| 73 | + ToolTipManager.sharedInstance().unregisterComponent(ui.getRightTreePane().getTree().getTree());
|
|
| 74 | + }
|
|
| 67 | 75 | } |
| ... | ... | @@ -45,6 +45,7 @@ import javax.swing.JLabel; |
| 45 | 45 | import javax.swing.JPopupMenu;
|
| 46 | 46 | import javax.swing.JSeparator;
|
| 47 | 47 | import javax.swing.SwingUtilities;
|
| 48 | +import javax.swing.ToolTipManager;
|
|
| 48 | 49 | import javax.swing.tree.TreePath;
|
| 49 | 50 | import java.awt.Color;
|
| 50 | 51 | import java.awt.event.MouseAdapter;
|
| ... | ... | @@ -123,7 +124,7 @@ public class DataSelectionTreePaneHandler implements UIHandler<DataSelectionTree |
| 123 | 124 | Consumer<TreeConfigUI> consumer = TreeConfigUIHandler::hideOptions;
|
| 124 | 125 | Consumer<TreeConfigUI> apply = u -> initPanel(parent, ui);
|
| 125 | 126 | SelectionTreePaneHandler.init(treePane, consumer, apply);
|
| 126 | - |
|
| 127 | + ToolTipManager.sharedInstance().registerComponent(tree);
|
|
| 127 | 128 | if (isLeft) {
|
| 128 | 129 | stepModel.setLeftSelectionDataModel(treeModel);
|
| 129 | 130 | } else {
|
| ... | ... | @@ -32,6 +32,7 @@ import org.apache.logging.log4j.LogManager; |
| 32 | 32 | import org.apache.logging.log4j.Logger;
|
| 33 | 33 | import org.nuiton.jaxx.runtime.spi.UIHandler;
|
| 34 | 34 | |
| 35 | +import javax.swing.ToolTipManager;
|
|
| 35 | 36 | import java.util.EnumSet;
|
| 36 | 37 | |
| 37 | 38 | import static io.ultreia.java4all.i18n.I18n.t;
|
| ... | ... | @@ -59,6 +60,9 @@ public class ReferentialSynchroUIHandler extends AdminTabUIHandler<ReferentialSy |
| 59 | 60 | parentUI.getTabs().setTitleAt(1, t("observe.ui.datasource.editor.actions.synchro.referential.withMode", newValue.getLabel()));
|
| 60 | 61 | }
|
| 61 | 62 | });
|
| 63 | + hideFixedPanelLabel(ui);
|
|
| 64 | + ToolTipManager.sharedInstance().registerComponent(ui.getLeftTreePane().getTree());
|
|
| 65 | + ToolTipManager.sharedInstance().registerComponent(ui.getRightTreePane().getTree());
|
|
| 62 | 66 | }
|
| 63 | 67 | |
| 64 | 68 | @Override
|
| ... | ... | @@ -75,7 +75,7 @@ public class ReferentialSelectionTreeCellRenderer extends DefaultXTreeCellRender |
| 75 | 75 | super.getTreeCellRendererComponent(tree, text, sel, expanded, leaf, row, hasFocus);
|
| 76 | 76 | |
| 77 | 77 | setIcon(icon);
|
| 78 | - setToolTipText(text);
|
|
| 78 | + panel.setToolTipText(text);
|
|
| 79 | 79 | boolean selectedState;
|
| 80 | 80 | Icon selectedIcon = unselectedIcon;
|
| 81 | 81 | if (node.isLeaf()) {
|
| ... | ... | @@ -127,6 +127,7 @@ public class ValidateUIHandler extends AdminTabUIHandler<ValidateUI> implements |
| 127 | 127 | Set<ValidatorDto> validators = getValidatorsManager().getValidators();
|
| 128 | 128 | ValidateModel stepModel = model.getValidateModel();
|
| 129 | 129 | stepModel.setAllValidators(validators);
|
| 130 | + hideFixedPanelLabel(ui);
|
|
| 130 | 131 | }
|
| 131 | 132 | |
| 132 | 133 | @Override
|
| ... | ... | @@ -19,8 +19,8 @@ |
| 19 | 19 | -- <http://www.gnu.org/licenses/gpl-3.0.html>.
|
| 20 | 20 | -- #L%
|
| 21 | 21 | ---
|
| 22 | -ALTER TABLE ps_common.ObservedSystem RENAME allwObservation TO observation;
|
|
| 23 | -ALTER TABLE ps_common.ObservedSystem RENAME allwLogbook TO logbook;
|
|
| 24 | -ALTER TABLE ps_common.WeightCategory RENAME allwLanding TO landing;
|
|
| 25 | -ALTER TABLE ps_common.WeightCategory RENAME allwLogbook TO logbook;
|
|
| 26 | -ALTER TABLE ps_common.WeightCategory RENAME allwWellPlan TO wellPlan; |
|
| 22 | +ALTER TABLE ps_common.ObservedSystem RENAME allowObservation TO observation;
|
|
| 23 | +ALTER TABLE ps_common.ObservedSystem RENAME allowLogbook TO logbook;
|
|
| 24 | +ALTER TABLE ps_common.WeightCategory RENAME allowLanding TO landing;
|
|
| 25 | +ALTER TABLE ps_common.WeightCategory RENAME allowLogbook TO logbook;
|
|
| 26 | +ALTER TABLE ps_common.WeightCategory RENAME allowWellPlan TO wellPlan; |
| ... | ... | @@ -49,6 +49,8 @@ public abstract class I18nDecoratorHelper extends BeanPropertyI18nKeyProducerPro |
| 49 | 49 | public static final String I18N_CONSTANT_LABEL = "label";
|
| 50 | 50 | public static final String I18N_CONSTANT_LABEL_PATTERN = "observe.constant.@CLASS_SIMPLE_NAME@.@NAME@";
|
| 51 | 51 | public static final String I18N_CONSTANT_DESCRIPTION_PATTERN = "observe.constant.@CLASS_SIMPLE_NAME@.@NAME@.description";
|
| 52 | + public static final String I18N_CONSTANT_ACTION = "action";
|
|
| 53 | + public static final String I18N_CONSTANT_ACTION_PATTERN = "observe.constant.@CLASS_SIMPLE_NAME@.@NAME@.action";
|
|
| 52 | 54 | public static final String I18N_CONSTANT_STORAGE_LABEL_PATTERN = "observe.constant.storage.@CLASS_SIMPLE_NAME@.@NAME@";
|
| 53 | 55 | public static final String I18N_CONSTANT_NAVIGATION_LABEL_PATTERN = "observe.Common.navigation.config.@CLASS_SIMPLE_NAME@.@NAME@";
|
| 54 | 56 | public static final String I18N_CONSTANT_NAVIGATION_DESCRIPTION_PATTERN = "observe.Common.navigation.config.@CLASS_SIMPLE_NAME@.@NAME@.description";
|
| ... | ... | @@ -38,6 +38,7 @@ import java.beans.PropertyChangeSupport; |
| 38 | 38 | import java.util.Enumeration;
|
| 39 | 39 | import java.util.List;
|
| 40 | 40 | import java.util.Objects;
|
| 41 | +import java.util.function.Consumer;
|
|
| 41 | 42 | import java.util.function.Function;
|
| 42 | 43 | import java.util.function.Supplier;
|
| 43 | 44 | |
| ... | ... | @@ -87,16 +88,32 @@ public abstract class ToolkitTreeModelSupport<R extends ToolkitTreeNode> extends |
| 87 | 88 | this.editIds = editIds;
|
| 88 | 89 | }
|
| 89 | 90 | |
| 90 | - public final void populate(Function<ToolkitTreeFlatModelRootRequest, ToolkitTreeFlatModel> service) {
|
|
| 91 | + public final ToolkitTreeFlatModel buildFlatModel(Function<ToolkitTreeFlatModelRootRequest, ToolkitTreeFlatModel> service) {
|
|
| 91 | 92 | request = toRequest();
|
| 92 | 93 | ToolkitTreeFlatModel flatModel = service.apply(request);
|
| 93 | 94 | dataCount = flatModel.getDataCount();
|
| 94 | 95 | augmentsModel(flatModel);
|
| 96 | + return flatModel;
|
|
| 97 | + }
|
|
| 98 | + |
|
| 99 | + public final void populate(ToolkitTreeFlatModel flatModel, Consumer<R> rootConsumer) {
|
|
| 95 | 100 | R rootNode = new ToolkitTreeNodeBuilder().load(rootSupplier.get(), flatModel.getMapping());
|
| 96 | 101 | augmentsRoot(rootNode);
|
| 102 | + if (rootConsumer != null) {
|
|
| 103 | + rootConsumer.accept(rootNode);
|
|
| 104 | + }
|
|
| 97 | 105 | setRoot(rootNode);
|
| 98 | 106 | }
|
| 99 | 107 | |
| 108 | + public final void populate(Function<ToolkitTreeFlatModelRootRequest, ToolkitTreeFlatModel> service) {
|
|
| 109 | + populate(service, null);
|
|
| 110 | + }
|
|
| 111 | + |
|
| 112 | + public final void populate(Function<ToolkitTreeFlatModelRootRequest, ToolkitTreeFlatModel> service, Consumer<R> rootConsumer) {
|
|
| 113 | + ToolkitTreeFlatModel flatModel = buildFlatModel(service);
|
|
| 114 | + populate(flatModel, rootConsumer);
|
|
| 115 | + }
|
|
| 116 | + |
|
| 100 | 117 | public final ToolkitTreeFlatModelRootRequest getRequest() {
|
| 101 | 118 | return request;
|
| 102 | 119 | }
|
| ... | ... | @@ -75,7 +75,7 @@ public class SelectionTreeCellRenderer extends DefaultXTreeCellRenderer { |
| 75 | 75 | this.selected.setIcon(context.selectionState.getIcon());
|
| 76 | 76 | setForeground(context.color);
|
| 77 | 77 | setIcon(context.icon);
|
| 78 | - setToolTipText(context.tip);
|
|
| 78 | + panel.setToolTipText(context.tip);
|
|
| 79 | 79 | if (context.open) {
|
| 80 | 80 | setFont(getFont().deriveFont(Font.BOLD));
|
| 81 | 81 | } else {
|
| ... | ... | @@ -65,6 +65,20 @@ public class SelectionTreeModelSupport<R extends SelectionTreeNode> extends Tool |
| 65 | 65 | */
|
| 66 | 66 | private int selectedCount = -1;
|
| 67 | 67 | |
| 68 | + public static List<String> allDataIds(TreeNode root) {
|
|
| 69 | + Enumeration<?> children = root.children();
|
|
| 70 | + List<String> result = new LinkedList<>();
|
|
| 71 | + while (children.hasMoreElements()) {
|
|
| 72 | + SelectionTreeNode topNode = (SelectionTreeNode) children.nextElement();
|
|
| 73 | + Enumeration<TreeNode> dataEnum = topNode.children();
|
|
| 74 | + while (dataEnum.hasMoreElements()) {
|
|
| 75 | + SelectionTreeNode treeNode = (SelectionTreeNode) dataEnum.nextElement();
|
|
| 76 | + result.add(treeNode.getUserObject().getId());
|
|
| 77 | + }
|
|
| 78 | + }
|
|
| 79 | + return result;
|
|
| 80 | + }
|
|
| 81 | + |
|
| 68 | 82 | public SelectionTreeModelSupport(BusinessProject businessProject, SelectionTreeConfig config, Supplier<R> rootSupplier) {
|
| 69 | 83 | super(businessProject, config, rootSupplier);
|
| 70 | 84 | selectedData = new LinkedList<>();
|
| ... | ... | @@ -163,20 +177,6 @@ public class SelectionTreeModelSupport<R extends SelectionTreeNode> extends Tool |
| 163 | 177 | recomputeSelectedCount();
|
| 164 | 178 | }
|
| 165 | 179 | |
| 166 | - public List<String> allDataIds() {
|
|
| 167 | - Enumeration<?> children = getRoot().children();
|
|
| 168 | - List<String> result = new LinkedList<>();
|
|
| 169 | - while (children.hasMoreElements()) {
|
|
| 170 | - SelectionTreeNode topNode = (SelectionTreeNode) children.nextElement();
|
|
| 171 | - Enumeration<TreeNode> dataEnum = topNode.children();
|
|
| 172 | - while (dataEnum.hasMoreElements()) {
|
|
| 173 | - SelectionTreeNode treeNode = (SelectionTreeNode) dataEnum.nextElement();
|
|
| 174 | - result.add(treeNode.getUserObject().getId());
|
|
| 175 | - }
|
|
| 176 | - }
|
|
| 177 | - return result;
|
|
| 178 | - }
|
|
| 179 | - |
|
| 180 | 180 | public long allDataCount() {
|
| 181 | 181 | Enumeration<?> children = getRoot().children();
|
| 182 | 182 | long result = 0;
|
| ... | ... | @@ -287,7 +287,7 @@ public class SelectionTreeModelSupport<R extends SelectionTreeNode> extends Tool |
| 287 | 287 | |
| 288 | 288 | public void augmentsExistIds(List<String> otherSideIds) {
|
| 289 | 289 | if (otherSideIds != null) {
|
| 290 | - List<String> thisSideIds = allDataIds();
|
|
| 290 | + List<String> thisSideIds = allDataIds(getRoot());
|
|
| 291 | 291 | // optimization: only deal with this ids that are also on this side
|
| 292 | 292 | otherSideIds.removeIf(id -> !thisSideIds.contains(id));
|
| 293 | 293 | // augments exist state
|
| ... | ... | @@ -53,16 +53,30 @@ public class SelectionTreeNodeRendererContext { |
| 53 | 53 | } else {
|
| 54 | 54 | this.count = node.getChildCount();
|
| 55 | 55 | }
|
| 56 | - this.icon = node.getIcon();
|
|
| 56 | + this.icon = buildIcon(node);
|
|
| 57 | + this.text = buildText(node);
|
|
| 58 | + this.tip = buildTip(node, text);
|
|
| 59 | + this.color = enabled && (!node.getUserObject().isReferentialType() || count > 0) ? Color.BLACK : Color.GRAY;
|
|
| 60 | + this.selectionState = node.getSelectionState();
|
|
| 61 | + }
|
|
| 62 | + |
|
| 63 | + protected Icon buildIcon(SelectionTreeNode node) {
|
|
| 64 | + return node.getIcon();
|
|
| 65 | + }
|
|
| 66 | + |
|
| 67 | + protected String buildText(SelectionTreeNode node) {
|
|
| 57 | 68 | String text = node.getUserObject().getText();
|
| 58 | - String tip = text;
|
|
| 59 | 69 | if (exist) {
|
| 60 | 70 | text = t("observe.common.exist.on.remote", text);
|
| 61 | - tip = t("observe.ui.message.warning.will.be.delete", text);
|
|
| 62 | 71 | }
|
| 63 | - this.text = text;
|
|
| 64 | - this.tip = tip;
|
|
| 65 | - this.color = enabled && (!node.getUserObject().isReferentialType() || count > 0) ? Color.BLACK : Color.GRAY;
|
|
| 66 | - this.selectionState = node.getSelectionState();
|
|
| 72 | + return text;
|
|
| 73 | + }
|
|
| 74 | + |
|
| 75 | + protected String buildTip(SelectionTreeNode node, String text) {
|
|
| 76 | + String tip = text;
|
|
| 77 | + if (exist) {
|
|
| 78 | + tip += t("observe.ui.message.warning.will.be.delete", text);
|
|
| 79 | + }
|
|
| 80 | + return tip;
|
|
| 67 | 81 | }
|
| 68 | 82 | } |