Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe
Commits:
-
f4094436
by Tony Chemit at 2020-07-06T13:00:01+02:00
-
cba65bba
by Tony Chemit at 2020-07-06T13:00:02+02:00
-
080180d4
by Tony Chemit at 2020-07-06T13:00:02+02:00
10 changed files:
- client-core/src/main/java/fr/ird/observe/client/util/JMenuWithAccelerator.java
- client-datasource-actions/src/main/i18n/getters/java.getter
- client-datasource-actions/src/main/java/fr/ird/observe/client/datasource/actions/longline/pairing/tree/ActivityLonglinePairingTreeTableModel.java
- client-datasource-editor-api/src/main/java/fr/ird/observe/client/datasource/editor/content/data/table/actions/ContentTableUIEntryActionSupport.java
- + client-datasource-editor-api/src/main/java/fr/ird/observe/client/datasource/editor/content/data/table/actions/MakeActionsEnabledOnlyIfMenuItemParentIsOpenedPopupMenuListener.java
- client-datasource-editor-api/src/main/java/fr/ird/observe/client/datasource/editor/content/data/table/popup/AutoSelectWithMoveUpAndDownShowPopupAction.java
- observe-i18n/src/main/i18n/translations/observe_en_GB.properties
- observe-i18n/src/main/i18n/translations/observe_es_ES.properties
- observe-i18n/src/main/i18n/translations/observe_fr_FR.properties
- pom.xml
Changes:
| ... | ... | @@ -58,7 +58,7 @@ public class JMenuWithAccelerator extends JMenu { |
| 58 | 58 |
public void setSelected(boolean b) {
|
| 59 | 59 |
super.setSelected(b);
|
| 60 | 60 |
if (b) {
|
| 61 |
- log.info(String.format("Yo selected: up to %s", getName()));
|
|
| 61 |
+ log.debug(String.format("%s is now selected", getName()));
|
|
| 62 | 62 |
SwingUtilities.invokeLater(() -> ((JMenuItem) getMenuComponent(0)).setSelected(true));
|
| 63 | 63 |
}
|
| 64 | 64 |
}
|
| ... | ... | @@ -48,6 +48,8 @@ observe.actions.exportData.title |
| 48 | 48 |
observe.actions.exportData.title.tip
|
| 49 | 49 |
observe.actions.longline.pairing
|
| 50 | 50 |
observe.actions.longline.pairing.description
|
| 51 |
+observe.actions.longline.pairing.table.logbook.activity
|
|
| 52 |
+observe.actions.longline.pairing.table.observation.activity
|
|
| 51 | 53 |
observe.actions.longline.pairing.table.selected
|
| 52 | 54 |
observe.actions.longline.pairing.tip
|
| 53 | 55 |
observe.actions.longline.pairing.title
|
| ... | ... | @@ -173,9 +175,7 @@ observe.admin.report.title.tip |
| 173 | 175 |
observe.choice.cancel
|
| 174 | 176 |
observe.choice.confirm.insert
|
| 175 | 177 |
observe.choice.replace
|
| 176 |
-observe.common.data
|
|
| 177 | 178 |
observe.common.none
|
| 178 |
-observe.data.ll.logbook.Activity.relatedObservedActivity
|
|
| 179 | 179 |
observe.message.no.report.selected
|
| 180 | 180 |
observe.message.select.report
|
| 181 | 181 |
observe.message.show.usage.for.missingReferentials2
|
| ... | ... | @@ -48,8 +48,8 @@ public class ActivityLonglinePairingTreeTableModel extends DefaultTreeTableModel |
| 48 | 48 |
|
| 49 | 49 |
public ActivityLonglinePairingTreeTableModel(ActivityLonglinePairingModel uiModel, ActivityLonglinePairingRootNode rootNode) {
|
| 50 | 50 |
super(Objects.requireNonNull(rootNode), Arrays.asList(
|
| 51 |
- I18n.t("observe.common.data"),
|
|
| 52 |
- I18n.t("observe.data.ll.logbook.Activity.relatedObservedActivity"),
|
|
| 51 |
+ I18n.t("observe.actions.longline.pairing.table.logbook.activity"),
|
|
| 52 |
+ I18n.t("observe.actions.longline.pairing.table.observation.activity"),
|
|
| 53 | 53 |
I18n.t("observe.actions.longline.pairing.table.selected")));
|
| 54 | 54 |
this.uiModel = Objects.requireNonNull(uiModel);
|
| 55 | 55 |
}
|
| ... | ... | @@ -27,9 +27,13 @@ import fr.ird.observe.client.datasource.editor.content.data.table.ContentTableMo |
| 27 | 27 |
import fr.ird.observe.client.datasource.editor.content.data.table.ContentTableUI;
|
| 28 | 28 |
import fr.ird.observe.client.datasource.editor.content.data.table.ContentTableUIModel;
|
| 29 | 29 |
import fr.ird.observe.client.main.MainUIModel;
|
| 30 |
+import io.ultreia.java4all.lang.Objects2;
|
|
| 30 | 31 |
import org.apache.logging.log4j.LogManager;
|
| 31 | 32 |
import org.apache.logging.log4j.Logger;
|
| 33 |
+import org.nuiton.jaxx.runtime.JAXXObject;
|
|
| 34 |
+import org.nuiton.jaxx.runtime.swing.action.JAXXObjectActionSupport;
|
|
| 32 | 35 |
|
| 36 |
+import javax.swing.AbstractButton;
|
|
| 33 | 37 |
import javax.swing.KeyStroke;
|
| 34 | 38 |
import java.awt.event.ActionEvent;
|
| 35 | 39 |
import java.beans.PropertyChangeListener;
|
| ... | ... | @@ -45,6 +49,13 @@ public abstract class ContentTableUIEntryActionSupport extends ContentTableUIAct |
| 45 | 49 |
private final PropertyChangeListener propertyChangeListener;
|
| 46 | 50 |
private boolean canExecuteFromRead;
|
| 47 | 51 |
|
| 52 |
+ public static <U extends JAXXObject, A extends JAXXObjectActionSupport<U>> A init(U ui, AbstractButton editor, Class<A> actionType) {
|
|
| 53 |
+ |
|
| 54 |
+ A action = JAXXObjectActionSupport.init(ui, editor, actionType );
|
|
| 55 |
+ editor.putClientProperty(ACTIVATE_FROM_POPUP, true);
|
|
| 56 |
+ return action;
|
|
| 57 |
+ }
|
|
| 58 |
+ |
|
| 48 | 59 |
protected ContentTableUIEntryActionSupport(String text, String tip, String icon, KeyStroke keyStroke) {
|
| 49 | 60 |
super(text, tip, icon, keyStroke);
|
| 50 | 61 |
propertyChangeListener = e -> {
|
| 1 |
+package fr.ird.observe.client.datasource.editor.content.data.table.actions;
|
|
| 2 |
+ |
|
| 3 |
+/*-
|
|
| 4 |
+ * #%L
|
|
| 5 |
+ * ObServe :: Client DataSource Editor API
|
|
| 6 |
+ * %%
|
|
| 7 |
+ * Copyright (C) 2008 - 2020 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 org.apache.logging.log4j.LogManager;
|
|
| 26 |
+import org.apache.logging.log4j.Logger;
|
|
| 27 |
+import org.nuiton.jaxx.runtime.swing.action.JAXXObjectActionSupport;
|
|
| 28 |
+ |
|
| 29 |
+import javax.swing.JMenuItem;
|
|
| 30 |
+import javax.swing.JPopupMenu;
|
|
| 31 |
+import javax.swing.SwingUtilities;
|
|
| 32 |
+import javax.swing.event.PopupMenuEvent;
|
|
| 33 |
+import javax.swing.event.PopupMenuListener;
|
|
| 34 |
+import java.awt.Component;
|
|
| 35 |
+import java.util.Objects;
|
|
| 36 |
+ |
|
| 37 |
+/**
|
|
| 38 |
+ * Install this listener on menu to disable any accelerator in popup menu while menu is not displayed.
|
|
| 39 |
+ *
|
|
| 40 |
+ * @author Tony Chemit - dev@tchemit.fr
|
|
| 41 |
+ */
|
|
| 42 |
+public class MakeActionsEnabledOnlyIfMenuItemParentIsOpenedPopupMenuListener implements PopupMenuListener {
|
|
| 43 |
+ |
|
| 44 |
+ private static final Logger log = LogManager.getLogger(MakeActionsEnabledOnlyIfMenuItemParentIsOpenedPopupMenuListener.class);
|
|
| 45 |
+ |
|
| 46 |
+ private final JPopupMenu jMenu;
|
|
| 47 |
+ private boolean adjusting;
|
|
| 48 |
+ |
|
| 49 |
+ public static void install(JPopupMenu menuBar) {
|
|
| 50 |
+ menuBar.addPopupMenuListener(new MakeActionsEnabledOnlyIfMenuItemParentIsOpenedPopupMenuListener(menuBar));
|
|
| 51 |
+ }
|
|
| 52 |
+ |
|
| 53 |
+ public MakeActionsEnabledOnlyIfMenuItemParentIsOpenedPopupMenuListener(JPopupMenu jMenu) {
|
|
| 54 |
+ this.jMenu = Objects.requireNonNull(jMenu);
|
|
| 55 |
+ }
|
|
| 56 |
+ |
|
| 57 |
+ @Override
|
|
| 58 |
+ public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
|
|
| 59 |
+ updateElements(true);
|
|
| 60 |
+ }
|
|
| 61 |
+ |
|
| 62 |
+ @Override
|
|
| 63 |
+ public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
|
|
| 64 |
+ SwingUtilities.invokeLater(() -> updateElements(false));
|
|
| 65 |
+ }
|
|
| 66 |
+ |
|
| 67 |
+ @Override
|
|
| 68 |
+ public void popupMenuCanceled(PopupMenuEvent e) {
|
|
| 69 |
+ updateElements(false);
|
|
| 70 |
+ }
|
|
| 71 |
+ |
|
| 72 |
+ public void updateElements(boolean activateFromPopup) {
|
|
| 73 |
+ if (adjusting) {
|
|
| 74 |
+ return;
|
|
| 75 |
+ }
|
|
| 76 |
+ adjusting = true;
|
|
| 77 |
+ |
|
| 78 |
+ try {
|
|
| 79 |
+ String state = activateFromPopup ? "enabled" : "disabled";
|
|
| 80 |
+ for (Component subElement : jMenu.getComponents()) {
|
|
| 81 |
+ if (subElement instanceof JMenuItem) {
|
|
| 82 |
+ JMenuItem component = (JMenuItem) subElement;
|
|
| 83 |
+ if (component.getAccelerator() != null && component.getAction() instanceof JAXXObjectActionSupport) {
|
|
| 84 |
+ log.info(String.format("Menu (%s) item (%s) will %s", jMenu.getName(), component.getName(), state));
|
|
| 85 |
+ component.putClientProperty(JAXXObjectActionSupport.ACTIVATE_FROM_POPUP, activateFromPopup);
|
|
| 86 |
+ }
|
|
| 87 |
+ }
|
|
| 88 |
+ }
|
|
| 89 |
+ } finally {
|
|
| 90 |
+ adjusting = false;
|
|
| 91 |
+ }
|
|
| 92 |
+ }
|
|
| 93 |
+}
|
| ... | ... | @@ -23,6 +23,7 @@ package fr.ird.observe.client.datasource.editor.content.data.table.popup; |
| 23 | 23 |
*/
|
| 24 | 24 |
|
| 25 | 25 |
import fr.ird.observe.client.datasource.editor.content.data.table.ContentTableUI;
|
| 26 |
+import fr.ird.observe.client.datasource.editor.content.data.table.actions.MakeActionsEnabledOnlyIfMenuItemParentIsOpenedPopupMenuListener;
|
|
| 26 | 27 |
import fr.ird.observe.client.datasource.editor.content.data.table.actions.MoveBottom;
|
| 27 | 28 |
import fr.ird.observe.client.datasource.editor.content.data.table.actions.MoveDown;
|
| 28 | 29 |
import fr.ird.observe.client.datasource.editor.content.data.table.actions.MoveTop;
|
| ... | ... | @@ -42,13 +43,13 @@ import java.util.Objects; |
| 42 | 43 |
*/
|
| 43 | 44 |
public class AutoSelectWithMoveUpAndDownShowPopupAction extends AutoSelectRowAndShowPopupActionSupport {
|
| 44 | 45 |
|
| 45 |
- private final ContentTableUI ui;
|
|
| 46 |
+ private final ContentTableUI<?, ?, ?> ui;
|
|
| 46 | 47 |
private final JMenuItem moveTop;
|
| 47 | 48 |
private final JMenuItem moveUp;
|
| 48 | 49 |
private final JMenuItem moveDown;
|
| 49 | 50 |
private final JMenuItem moveBottom;
|
| 50 | 51 |
|
| 51 |
- public AutoSelectWithMoveUpAndDownShowPopupAction(ContentTableUI ui) {
|
|
| 52 |
+ public AutoSelectWithMoveUpAndDownShowPopupAction(ContentTableUI<?, ?, ?> ui) {
|
|
| 52 | 53 |
super(Objects.requireNonNull(ui).getTableScrollPane(), ui.getTable());
|
| 53 | 54 |
this.ui = ui;
|
| 54 | 55 |
JPopupMenu popup = getPopup();
|
| ... | ... | @@ -71,15 +72,6 @@ public class AutoSelectWithMoveUpAndDownShowPopupAction extends AutoSelectRowAnd |
| 71 | 72 |
moveUp.setEnabled(false);
|
| 72 | 73 |
moveDown.setEnabled(false);
|
| 73 | 74 |
}
|
| 74 |
-// TableModel model = ui.getTable().getModel();
|
|
| 75 |
-// ContentTableUIModel model1 = ui.getModel();
|
|
| 76 |
-// boolean notEdit = !model1.isCanSaveRow();
|
|
| 77 |
-// boolean canMoveUp = !model1.isCanSaveRow() && modelRowIndex > 0;
|
|
| 78 |
-// boolean canMoveDown = ;
|
|
| 79 |
-// moveTop.setEnabled(canMoveUp);
|
|
| 80 |
-// moveUp.setEnabled(canMoveUp);
|
|
| 81 |
-// moveDown.setEnabled(canMoveDown);
|
|
| 82 |
-// moveBottom.setEnabled(canMoveDown);
|
|
| 83 | 75 |
}
|
| 84 | 76 |
|
| 85 | 77 |
}
|
| ... | ... | @@ -224,7 +224,9 @@ observe.actions.longline.pairing=Longline activities pairing |
| 224 | 224 |
observe.actions.longline.pairing.config=Pairing configuration
|
| 225 | 225 |
observe.actions.longline.pairing.description=Longline activities pairing
|
| 226 | 226 |
observe.actions.longline.pairing.message.operation.done=Pairing operation done in %1$s.
|
| 227 |
-observe.actions.longline.pairing.table.selected=To be processed
|
|
| 227 |
+observe.actions.longline.pairing.table.logbook.activity=Observation activities
|
|
| 228 |
+observe.actions.longline.pairing.table.observation.activity=Logbook activities
|
|
| 229 |
+observe.actions.longline.pairing.table.selected=To be saved
|
|
| 228 | 230 |
observe.actions.longline.pairing.tip=Longline activities pairing
|
| 229 | 231 |
observe.actions.longline.pairing.title=Longline activities pairing
|
| 230 | 232 |
observe.actions.longline.pairing.title.tip=Longline activities pairing
|
| ... | ... | @@ -224,7 +224,9 @@ observe.actions.longline.pairing=Longline activities pairing \#TODO |
| 224 | 224 |
observe.actions.longline.pairing.config=Pairing configuration \#TODO
|
| 225 | 225 |
observe.actions.longline.pairing.description=Longline activities pairing \#TODO
|
| 226 | 226 |
observe.actions.longline.pairing.message.operation.done=Pairing operation done in %1$s. \#TODO
|
| 227 |
-observe.actions.longline.pairing.table.selected=Debe tratarse
|
|
| 227 |
+observe.actions.longline.pairing.table.logbook.activity=Observation activities \#TODO
|
|
| 228 |
+observe.actions.longline.pairing.table.observation.activity=Logbook activities \#TODO
|
|
| 229 |
+observe.actions.longline.pairing.table.selected=Debe grabar \#TODO
|
|
| 228 | 230 |
observe.actions.longline.pairing.tip=Longline activities pairing \#TODO
|
| 229 | 231 |
observe.actions.longline.pairing.title=Longline activities pairing \#TODO
|
| 230 | 232 |
observe.actions.longline.pairing.title.tip=Longline activities pairing \#TODO
|
| ... | ... | @@ -224,7 +224,9 @@ observe.actions.longline.pairing=Appairement des activités palangre |
| 224 | 224 |
observe.actions.longline.pairing.config=Configuration de l'appairement
|
| 225 | 225 |
observe.actions.longline.pairing.description=Appairement des activités palangre
|
| 226 | 226 |
observe.actions.longline.pairing.message.operation.done=Opération terminées en %1$s.
|
| 227 |
-observe.actions.longline.pairing.table.selected=À traiter
|
|
| 227 |
+observe.actions.longline.pairing.table.logbook.activity=Activités Observation
|
|
| 228 |
+observe.actions.longline.pairing.table.observation.activity=Activités Livre de Bord
|
|
| 229 |
+observe.actions.longline.pairing.table.selected=À enregistrer
|
|
| 228 | 230 |
observe.actions.longline.pairing.tip=Appairement des activités palangre
|
| 229 | 231 |
observe.actions.longline.pairing.title=Appairement des activités palangre
|
| 230 | 232 |
observe.actions.longline.pairing.title.tip=Appairement des activités palangre
|
| ... | ... | @@ -176,7 +176,7 @@ |
| 176 | 176 |
|
| 177 | 177 |
<!-- <lib.version.java4all.topia>1.17</lib.version.java4all.topia>-->
|
| 178 | 178 |
<!-- <lib.version.java4all.eugene>3.0-alpha-34-SNAPSHOT</lib.version.java4all.eugene>-->
|
| 179 |
- <lib.version.java4all.jaxx>3.0-alpha-74</lib.version.java4all.jaxx>
|
|
| 179 |
+ <lib.version.java4all.jaxx>3.0-alpha-75</lib.version.java4all.jaxx>
|
|
| 180 | 180 |
<!--<lib.version.java4all.application-context>1.0.3-SNAPSHOT</lib.version.java4all.application-context>-->
|
| 181 | 181 |
<!--<lib.version.java4all.application-template>1.0.2-SNAPSHOT</lib.version.java4all.application-template>-->
|
| 182 | 182 |
<!--<lib.version.java4all.i18n>4.0-beta-3-SNAPSHOT</lib.version.java4all.i18n>-->
|