Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe

Commits:

23 changed files:

Changes:

  • client/src/main/java/fr/ird/observe/client/ui/ObserveCommon.jcss
    ... ... @@ -24,6 +24,10 @@
    24 24
       computeI18n:"skip"
    
    25 25
     }
    
    26 26
     
    
    27
    +.forceNavigation {
    
    28
    +  _forceNavigation: true;
    
    29
    +}
    
    30
    +
    
    27 31
     JToolBar {
    
    28 32
       borderPainted:false;
    
    29 33
       floatable:false;
    

  • client/src/main/java/fr/ird/observe/client/ui/ObserveKeyStrokes.java
    ... ... @@ -85,6 +85,7 @@ public abstract class ObserveKeyStrokes {
    85 85
         public static final KeyStroke KEY_STROKE_CHANGE_FOCUS = KeyStroke.getKeyStroke("pressed F1");
    
    86 86
         public static final KeyStroke KEY_STROKE_SAVE = KeyStroke.getKeyStroke("ctrl pressed S");
    
    87 87
         public static final KeyStroke KEY_STROKE_SHIFT_ALT_ENTER = KeyStroke.getKeyStroke("alt shift pressed ENTER");
    
    88
    +    public static final KeyStroke KEY_STROKE_SHOW_TECHNICAL_INFORMATIONS = KeyStroke.getKeyStroke("shift pressed F1");
    
    88 89
         public static final KeyStroke KEY_STROKE_GO_DOWN = KeyStroke.getKeyStroke("alt pressed D");
    
    89 90
         public static final KeyStroke KEY_STROKE_ADD_DCP = KeyStroke.getKeyStroke("ctrl pressed P");
    
    90 91
         public static final KeyStroke KEY_STROKE_ADD_SET_LONGLINE = KeyStroke.getKeyStroke("ctrl pressed L");
    

  • client/src/main/java/fr/ird/observe/client/ui/actions/UIActionSupport.java
    ... ... @@ -82,6 +82,19 @@ public abstract class UIActionSupport extends AbstractAction {
    82 82
             }
    
    83 83
         }
    
    84 84
     
    
    85
    +
    
    86
    +    public String getText() {
    
    87
    +        return (String) getValue(SHORT_DESCRIPTION);
    
    88
    +    }
    
    89
    +
    
    90
    +    public String getToolTipText() {
    
    91
    +        return (String) getValue(LONG_DESCRIPTION);
    
    92
    +    }
    
    93
    +
    
    94
    +    public Icon getIcon() {
    
    95
    +        return (Icon) getValue(SMALL_ICON);
    
    96
    +    }
    
    97
    +
    
    85 98
         public static void register(Action action, InputMap inputMap, ActionMap actionMap, KeyStroke keyStroke, String actionCommandKey) {
    
    86 99
             if (keyStroke != null) {
    
    87 100
                 inputMap.put(keyStroke, actionCommandKey);
    

  • client/src/main/java/fr/ird/observe/client/ui/actions/content/ShowTechnicalInformationsAction.java
    1
    +package fr.ird.observe.client.ui.actions.content;
    
    2
    +
    
    3
    +/*-
    
    4
    + * #%L
    
    5
    + * ObServe :: Client
    
    6
    + * %%
    
    7
    + * Copyright (C) 2008 - 2018 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 fr.ird.observe.client.ObserveSwingApplicationContext;
    
    26
    +import fr.ird.observe.client.ui.ObserveKeyStrokes;
    
    27
    +import fr.ird.observe.client.ui.ObserveMainUI;
    
    28
    +import fr.ird.observe.client.ui.content.ContentUI;
    
    29
    +import fr.ird.observe.client.ui.content.ContentUIModel;
    
    30
    +import fr.ird.observe.client.ui.util.SpringUtilities;
    
    31
    +import fr.ird.observe.dto.IdDto;
    
    32
    +import fr.ird.observe.dto.referential.ReferentialDto;
    
    33
    +import org.apache.commons.lang3.time.FastDateFormat;
    
    34
    +import org.nuiton.decorator.Decorator;
    
    35
    +
    
    36
    +import javax.swing.JButton;
    
    37
    +import javax.swing.JLabel;
    
    38
    +import javax.swing.JPanel;
    
    39
    +import javax.swing.JPopupMenu;
    
    40
    +import javax.swing.JTextField;
    
    41
    +import javax.swing.SpringLayout;
    
    42
    +import javax.swing.border.TitledBorder;
    
    43
    +import java.awt.Dimension;
    
    44
    +import java.awt.event.FocusEvent;
    
    45
    +import java.awt.event.FocusListener;
    
    46
    +import java.util.Locale;
    
    47
    +import java.util.Objects;
    
    48
    +
    
    49
    +import static org.nuiton.i18n.I18n.n;
    
    50
    +import static org.nuiton.i18n.I18n.t;
    
    51
    +
    
    52
    +/**
    
    53
    + * Created by tchemit on 21/09/2018.
    
    54
    + *
    
    55
    + * @author Tony Chemit - dev@tchemit.fr
    
    56
    + */
    
    57
    +public class ShowTechnicalInformationsAction extends AbstractContentUIAction {
    
    58
    +
    
    59
    +    public static final String ACTION_NAME = ShowTechnicalInformationsAction.class.getName();
    
    60
    +    private static final long serialVersionUID = 1L;
    
    61
    +
    
    62
    +    private final FastDateFormat dateFormat;
    
    63
    +
    
    64
    +    public ShowTechnicalInformationsAction(ObserveMainUI mainUI) {
    
    65
    +        super(mainUI,
    
    66
    +              ACTION_NAME,
    
    67
    +              null,
    
    68
    +              n("observe.action.show.technical.informations.tip"),
    
    69
    +              "show-informations",
    
    70
    +              ObserveKeyStrokes.KEY_STROKE_SHOW_TECHNICAL_INFORMATIONS);
    
    71
    +        putValue(NAME, null);
    
    72
    +        Locale locale = ObserveSwingApplicationContext.get().getConfig().getLocale();
    
    73
    +        if (Locale.ENGLISH.equals(locale)) {
    
    74
    +            dateFormat = FastDateFormat.getInstance("yyyy-MM-ddZZ hh:mm:ss");
    
    75
    +        } else {
    
    76
    +            dateFormat = FastDateFormat.getInstance("dd/MM/yyyy hh:mm:ss");
    
    77
    +        }
    
    78
    +    }
    
    79
    +
    
    80
    +    @Override
    
    81
    +    protected void actionPerformed(ContentUI<?, ?> contentUI) {
    
    82
    +
    
    83
    +        JButton button = contentUI.getShowTechnicalInformations();
    
    84
    +
    
    85
    +        ContentUIModel<?> model = contentUI.getModel();
    
    86
    +        IdDto bean = model.isEditing() ? model.getBean() : contentUI.getHandler().getSelectedBean();
    
    87
    +
    
    88
    +        if (bean.getLastUpdateDate() == null) {
    
    89
    +            return;
    
    90
    +        }
    
    91
    +
    
    92
    +        JPanel content = new JPanel(new SpringLayout());
    
    93
    +
    
    94
    +        FocusListener l = new FocusListener() {
    
    95
    +            @Override
    
    96
    +            public void focusGained(FocusEvent e) {
    
    97
    +                JTextField source = (JTextField) e.getSource();
    
    98
    +                source.setSelectionStart(0);
    
    99
    +                source.setSelectionEnd(source.getText().length());
    
    100
    +            }
    
    101
    +
    
    102
    +            @Override
    
    103
    +            public void focusLost(FocusEvent e) {
    
    104
    +
    
    105
    +            }
    
    106
    +        };
    
    107
    +
    
    108
    +        {
    
    109
    +            content.add(new JLabel(t("observe.common.Dto.topiaId")));
    
    110
    +            JTextField comp = new JTextField(bean.getId());
    
    111
    +            comp.setEditable(false);
    
    112
    +            comp.addFocusListener(l);
    
    113
    +            content.add(comp);
    
    114
    +        }
    
    115
    +
    
    116
    +        Class<?> beanType = model.getBeanType();
    
    117
    +        boolean isReferential = ReferentialDto.class.isAssignableFrom(beanType);
    
    118
    +        if (isReferential) {
    
    119
    +            content.add(new JLabel(t("observe.common.Dto.topiaCreateDate")));
    
    120
    +            JTextField comp = new JTextField(dateFormat.format(bean.getCreateDate()));
    
    121
    +            comp.setEditable(false);
    
    122
    +            comp.addFocusListener(l);
    
    123
    +            content.add(comp);
    
    124
    +        }
    
    125
    +
    
    126
    +        {
    
    127
    +            content.add(new JLabel(t("observe.common.Dto.lastUpdateDate")));
    
    128
    +            JTextField comp = new JTextField(dateFormat.format(bean.getLastUpdateDate()));
    
    129
    +            comp.setEditable(false);
    
    130
    +            comp.addFocusListener(l);
    
    131
    +            content.add(comp);
    
    132
    +        }
    
    133
    +
    
    134
    +        if (isReferential) {
    
    135
    +            content.add(new JLabel(t("observe.common.Dto.topiaVersion")));
    
    136
    +            JTextField comp = new JTextField(String.valueOf(bean.getVersion()));
    
    137
    +            comp.setEditable(false);
    
    138
    +            comp.addFocusListener(l);
    
    139
    +            content.add(comp);
    
    140
    +        }
    
    141
    +
    
    142
    +        SpringUtilities.makeCompactGrid(content, isReferential ? 4 : 2, 2, 5, 5, 5, 5);
    
    143
    +
    
    144
    +        Decorator<?> decorator = ObserveSwingApplicationContext.get().getDecoratorService().getDecoratorByType(beanType);
    
    145
    +        Objects.requireNonNull(decorator, "Cant find decorator of type " + beanType);
    
    146
    +        String title = t("observe.common.Dto.technicalInformations", "\n" + decorator.toString(bean));
    
    147
    +
    
    148
    +        content.setBorder(new TitledBorder(title));
    
    149
    +
    
    150
    +        JPopupMenu popup = new JPopupMenu();
    
    151
    +        popup.setBorderPainted(true);
    
    152
    +        popup.add(content);
    
    153
    +        popup.pack();
    
    154
    +
    
    155
    +        Dimension dim = popup.getPreferredSize();
    
    156
    +        int x = (int) (button.getPreferredSize().getWidth() - dim.getWidth());
    
    157
    +        int y = button.getHeight();
    
    158
    +        popup.show(button, x, y);
    
    159
    +
    
    160
    +    }
    
    161
    +
    
    162
    +}

  • client/src/main/java/fr/ird/observe/client/ui/content/ContentUI.jaxx
    ... ... @@ -36,6 +36,7 @@
    36 36
         fr.ird.observe.client.configuration.ClientConfig
    
    37 37
         fr.ird.observe.client.ui.actions.content.GoUpUIAction
    
    38 38
         fr.ird.observe.client.ui.actions.content.GoDownUIAction
    
    39
    +    fr.ird.observe.client.ui.actions.content.ShowTechnicalInformationsAction
    
    39 40
         fr.ird.observe.client.ui.content.ContentUIHandler
    
    40 41
     
    
    41 42
         fr.ird.observe.dto.IdDto
    
    ... ... @@ -47,6 +48,9 @@
    47 48
         javax.swing.JComboBox
    
    48 49
         javax.swing.JList
    
    49 50
         javax.swing.UIManager
    
    51
    +    javax.swing.AbstractButton
    
    52
    +
    
    53
    +    static org.nuiton.i18n.I18n.t
    
    50 54
       </import>
    
    51 55
     
    
    52 56
       <ClientConfig id='config' initializer='ObserveSwingApplicationContext.get().getConfig()'/>
    
    ... ... @@ -73,6 +77,8 @@
    73 77
     
    
    74 78
       public abstract ContentUIHandler<E,U> getHandler();
    
    75 79
     
    
    80
    +  public List<AbstractButton> getNavigationPopupActions() { return getHandler().getNavigationPopupActions(); }
    
    81
    +
    
    76 82
     public Object getSelectedBean(JComboBox combo) {
    
    77 83
         return combo.getSelectedItem();
    
    78 84
     }
    
    ... ... @@ -140,8 +146,7 @@ public void createData() {
    140 146
           <JButton id='actionDown'/>
    
    141 147
         </JXLayer>
    
    142 148
     
    
    143
    -    <JButton id='showTechnicalInformations'
    
    144
    -             onActionPerformed='getHandler().showTechnicalInformations((JButton) event.getSource());'/>
    
    149
    +    <JButton id='showTechnicalInformations'/>
    
    145 150
     
    
    146 151
         <JLabel id='titleRight'/>
    
    147 152
       </JToolBar>
    
    ... ... @@ -160,6 +165,9 @@ public void createData() {
    160 165
     
    
    161 166
       <JPanel id="invisible" visible='false'>
    
    162 167
     
    
    168
    +    <JPanel id="navigationActions">
    
    169
    +      <!--Place here all actions you want to see in navigation popup but not in the form-->
    
    170
    +    </JPanel>
    
    163 171
       </JPanel>
    
    164 172
     
    
    165 173
     </org.jdesktop.swingx.JXTitledPanel>

  • client/src/main/java/fr/ird/observe/client/ui/content/ContentUI.jcss
    ... ... @@ -37,6 +37,7 @@
    37 37
     #actionDown {
    
    38 38
       _observeAction:{GoDownUIAction.ACTION_NAME};
    
    39 39
       _protectFocus:true;
    
    40
    +  _skipNavigation:true;
    
    40 41
     }
    
    41 42
     
    
    42 43
     #actionUpPane {
    
    ... ... @@ -46,6 +47,7 @@
    46 47
     #actionUp {
    
    47 48
       _observeAction:{GoUpUIAction.ACTION_NAME};
    
    48 49
       _protectFocus:true;
    
    50
    +  _skipNavigation:true;
    
    49 51
     }
    
    50 52
     
    
    51 53
     
    
    ... ... @@ -59,8 +61,7 @@
    59 61
     
    
    60 62
     #showTechnicalInformations {
    
    61 63
       _original:true;
    
    62
    -  toolTipText:"observe.action.show.technical.informations.tip";
    
    63
    -  actionIcon:"show-informations";
    
    64
    +  _observeAction:{ShowTechnicalInformationsAction.ACTION_NAME};
    
    64 65
       enabled:{!model.isCreatingMode() && (model.getBean() != null)};
    
    65 66
       focusPainted:false;
    
    66 67
       borderPainted:false;
    

  • client/src/main/java/fr/ird/observe/client/ui/content/ContentUIHandler.java
    ... ... @@ -106,6 +106,7 @@ import org.apache.logging.log4j.LogManager;
    106 106
     import org.apache.logging.log4j.Logger;
    
    107 107
     import org.nuiton.decorator.Decorator;
    
    108 108
     import org.nuiton.decorator.DecoratorUtil;
    
    109
    +import org.nuiton.jaxx.runtime.JAXXObject;
    
    109 110
     import org.nuiton.jaxx.runtime.context.DefaultJAXXContext;
    
    110 111
     import org.nuiton.jaxx.validator.swing.SwingValidatorMessageTableModel;
    
    111 112
     import org.nuiton.jaxx.validator.swing.SwingValidatorUtil;
    
    ... ... @@ -1179,7 +1180,7 @@ public abstract class ContentUIHandler<E extends IdDto, U extends ContentUI<E, U
    1179 1180
     
    
    1180 1181
         }
    
    1181 1182
     
    
    1182
    -    protected E getSelectedBean() {
    
    1183
    +    public E getSelectedBean() {
    
    1183 1184
             return getModel().getBean();
    
    1184 1185
         }
    
    1185 1186
     
    
    ... ... @@ -1603,4 +1604,55 @@ public abstract class ContentUIHandler<E extends IdDto, U extends ContentUI<E, U
    1603 1604
             List<R> filter(List<R> incomingReferences);
    
    1604 1605
         }
    
    1605 1606
     
    
    1607
    +    /**
    
    1608
    +     * @return actions usable in the navigation popup.
    
    1609
    +     */
    
    1610
    +    public List<AbstractButton> getNavigationPopupActions() {
    
    1611
    +        List<AbstractButton> result = new LinkedList<>();
    
    1612
    +        collectNavigationPopupActions(result, ui, "actions", "extraActions", "navigationActions", "titleRightToolBar");
    
    1613
    +        for (Object object : ui.get$objectMap().values()) {
    
    1614
    +            if (object != ui && object instanceof ContentUI) {
    
    1615
    +                collectNavigationPopupActions(result, (JAXXObject) object, "actions", "extraActions", "navigationActions");
    
    1616
    +            }
    
    1617
    +        }
    
    1618
    +        return result;
    
    1619
    +    }
    
    1620
    +
    
    1621
    +    protected void collectNavigationPopupActions(List<AbstractButton> result, JAXXObject jaxxObject, String... containers) {
    
    1622
    +        for (Object object : jaxxObject.get$objectMap().values()) {
    
    1623
    +            if (object instanceof AbstractButton) {
    
    1624
    +                AbstractButton button = (AbstractButton) object;
    
    1625
    +                boolean force = Objects.equals(true, button.getClientProperty("forceNavigation"));
    
    1626
    +                if (!force) {
    
    1627
    +                    if (!button.isEnabled()) {
    
    1628
    +                        log.info("Reject (disabled) action: " + button.getName() + " - " + button.getText());
    
    1629
    +                        continue;
    
    1630
    +                    }
    
    1631
    +                    if (!button.isShowing()) {
    
    1632
    +                        log.info("Reject (hidden) action: " + button.getName() + " - " + button.getText());
    
    1633
    +                        continue;
    
    1634
    +                    }
    
    1635
    +                    if (Objects.equals(true, button.getClientProperty("skipNavigation"))) {
    
    1636
    +                        log.info("Reject (skip) action: " + button.getName() + " - " + button.getText());
    
    1637
    +                        continue;
    
    1638
    +                    }
    
    1639
    +
    
    1640
    +                    boolean found = false;
    
    1641
    +                    for (String container : containers) {
    
    1642
    +                        found = SwingUtilities.getAncestorNamed(container, button) != null;
    
    1643
    +                        if (found) {
    
    1644
    +                            break;
    
    1645
    +                        }
    
    1646
    +                    }
    
    1647
    +                    if (!found) {
    
    1648
    +                        log.info("Reject (out of zone) action: " + button.getName() + " - " + button.getText());
    
    1649
    +                        continue;
    
    1650
    +                    }
    
    1651
    +                }
    
    1652
    +                log.info("Keep action: " + button.getName() + " - " + button.getText());
    
    1653
    +                result.add(button);
    
    1654
    +            }
    
    1655
    +        }
    
    1656
    +
    
    1657
    +    }
    
    1606 1658
     }

  • client/src/main/java/fr/ird/observe/client/ui/content/data/longline/TripLonglineUI.jaxx
    ... ... @@ -40,6 +40,7 @@
    40 40
         fr.ird.observe.dto.referential.longline.ObservationTripTypeReference
    
    41 41
         fr.ird.observe.dto.referential.longline.LogbookTripTypeReference
    
    42 42
         fr.ird.observe.client.ui.actions.content.DeleteDataUIAction
    
    43
    +    fr.ird.observe.client.ui.actions.content.MoveTripLonglineUIAction
    
    43 44
         fr.ird.observe.client.ui.actions.main.global.DeleteDataGlobalUIAction
    
    44 45
         fr.ird.observe.client.ui.actions.main.global.NewNextDataGlobalUIAction
    
    45 46
         fr.ird.observe.client.ui.util.JComment
    
    ... ... @@ -355,4 +356,7 @@ protected boolean canEditOcean(java.util.LinkedHashSet<TripLonglineActivityObsDt
    355 356
       <JButton id='closeAndCreate'/>
    
    356 357
       <JButton id='actionDown'/>
    
    357 358
     
    
    359
    +  <JPanel id="forceNavigation">
    
    360
    +    <JButton id='move' styleClass="forceNavigation"/>
    
    361
    +  </JPanel>
    
    358 362
     </fr.ird.observe.client.ui.content.open.ContentOpenableUI>

  • client/src/main/java/fr/ird/observe/client/ui/content/data/longline/TripLonglineUI.jcss
    ... ... @@ -216,3 +216,7 @@ BigTextEditor {
    216 216
     #logbookComment {
    
    217 217
       property:{TripLonglineDto.PROPERTY_LOGBOOK_COMMENT};
    
    218 218
     }
    
    219
    +
    
    220
    +#move {
    
    221
    +  _observeAction:{MoveTripLonglineUIAction.ACTION_NAME};
    
    222
    +}

  • client/src/main/java/fr/ird/observe/client/ui/content/data/longline/logbook/ActivityLonglineLogbookUI.jaxx
    ... ... @@ -38,6 +38,7 @@
    38 38
     
    
    39 39
         fr.ird.observe.client.ui.actions.content.AddActivityLonglineLogbookSetUIAction
    
    40 40
         fr.ird.observe.client.ui.actions.content.DeleteDataUIAction
    
    41
    +    fr.ird.observe.client.ui.actions.content.MoveActivityLonglineLogbookUIAction
    
    41 42
         fr.ird.observe.client.ui.actions.main.global.DeleteDataGlobalUIAction
    
    42 43
         fr.ird.observe.client.ui.actions.main.global.OpenDataGlobalUIAction
    
    43 44
         fr.ird.observe.client.ui.actions.main.global.CloseDataGlobalUIAction
    

  • client/src/main/java/fr/ird/observe/client/ui/content/data/longline/logbook/ActivityLonglineLogbookUI.jcss
    ... ... @@ -100,3 +100,7 @@
    100 100
       enabled:{!model.isModified() && model.isValid() && model.isSetOperation() && ! bean.isHasSetLongline()};
    
    101 101
       _observeAction:{AddActivityLonglineLogbookSetUIAction.ACTION_NAME};
    
    102 102
     }
    
    103
    +
    
    104
    +#move {
    
    105
    +  _observeAction:{MoveActivityLonglineLogbookUIAction.ACTION_NAME};
    
    106
    +}
    \ No newline at end of file

  • client/src/main/java/fr/ird/observe/client/ui/content/data/longline/obs/ActivityLonglineObsUI.jaxx
    ... ... @@ -35,6 +35,7 @@
    35 35
     
    
    36 36
         fr.ird.observe.client.ui.actions.content.AddActivityLonglineObsSetUIAction
    
    37 37
         fr.ird.observe.client.ui.actions.content.DeleteDataUIAction
    
    38
    +    fr.ird.observe.client.ui.actions.content.MoveActivityLonglineObsUIAction
    
    38 39
         fr.ird.observe.client.ui.actions.main.global.DeleteDataGlobalUIAction
    
    39 40
         fr.ird.observe.client.ui.actions.main.global.OpenDataGlobalUIAction
    
    40 41
         fr.ird.observe.client.ui.actions.main.global.CloseDataGlobalUIAction
    
    ... ... @@ -155,5 +156,7 @@
    155 156
           </cell>
    
    156 157
         </row>
    
    157 158
       </Table>
    
    158
    -
    
    159
    +  <JPanel id="forceNavigation">
    
    160
    +    <JButton id='move' styleClass="forceNavigation"/>
    
    161
    +  </JPanel>
    
    159 162
     </fr.ird.observe.client.ui.content.open.ContentOpenableUI>

  • client/src/main/java/fr/ird/observe/client/ui/content/data/longline/obs/ActivityLonglineObsUI.jcss
    ... ... @@ -97,3 +97,7 @@
    97 97
       _observeAction:{AddActivityLonglineObsSetUIAction.ACTION_NAME};
    
    98 98
     
    
    99 99
     }
    
    100
    +
    
    101
    +#move {
    
    102
    +  _observeAction:{MoveActivityLonglineObsUIAction.ACTION_NAME};
    
    103
    +}

  • client/src/main/java/fr/ird/observe/client/ui/content/data/seine/ActivitySeineUI.jaxx
    ... ... @@ -44,9 +44,10 @@
    44 44
         org.nuiton.jaxx.widgets.temperature.TemperatureEditor
    
    45 45
         org.nuiton.jaxx.widgets.temperature.TemperatureEditorConfig
    
    46 46
     
    
    47
    -    fr.ird.observe.client.ui.actions.content.DeleteDataUIAction
    
    48 47
         fr.ird.observe.client.ui.actions.content.AddActivitySeineSetUIAction
    
    49 48
         fr.ird.observe.client.ui.actions.content.AddActivitySeineFloatingObjectUIAction
    
    49
    +    fr.ird.observe.client.ui.actions.content.DeleteDataUIAction
    
    50
    +    fr.ird.observe.client.ui.actions.content.MoveActivitySeineUIAction
    
    50 51
         fr.ird.observe.client.ui.util.JComment
    
    51 52
     
    
    52 53
         org.nuiton.jaxx.widgets.number.NumberEditor
    
    ... ... @@ -303,5 +304,7 @@
    303 304
           </cell>
    
    304 305
         </row>
    
    305 306
       </Table>
    
    306
    -
    
    307
    +  <JPanel id="forceNavigation">
    
    308
    +    <JButton id='move' styleClass="forceNavigation"/>
    
    309
    +  </JPanel>
    
    307 310
     </fr.ird.observe.client.ui.content.open.ContentOpenableUI>

  • client/src/main/java/fr/ird/observe/client/ui/content/data/seine/ActivitySeineUI.jcss
    ... ... @@ -181,3 +181,6 @@
    181 181
       visible:{bean.isDcpOperation()};
    
    182 182
       _observeAction:{AddActivitySeineFloatingObjectUIAction.ACTION_NAME};
    
    183 183
     }
    
    184
    +#move {
    
    185
    +  _observeAction:{MoveActivitySeineUIAction.ACTION_NAME};
    
    186
    +}
    \ No newline at end of file

  • client/src/main/java/fr/ird/observe/client/ui/content/data/seine/RouteUI.jaxx
    ... ... @@ -30,6 +30,7 @@
    30 30
       <import>
    
    31 31
         fr.ird.observe.dto.data.seine.RouteDto
    
    32 32
         fr.ird.observe.client.ui.actions.content.DeleteDataUIAction
    
    33
    +    fr.ird.observe.client.ui.actions.content.MoveRouteUIAction
    
    33 34
         fr.ird.observe.client.ui.util.JComment
    
    34 35
     
    
    35 36
         org.jdesktop.swingx.JXDatePicker
    
    ... ... @@ -95,5 +96,7 @@
    95 96
       <JButton id='close'/>
    
    96 97
       <JButton id='closeAndCreate'/>
    
    97 98
       <JButton id='actionDown'/>
    
    98
    -
    
    99
    +  <JPanel id="forceNavigation">
    
    100
    +    <JButton id='move' styleClass="forceNavigation"/>
    
    101
    +  </JPanel>
    
    99 102
     </fr.ird.observe.client.ui.content.open.ContentOpenableUI>

  • client/src/main/java/fr/ird/observe/client/ui/content/data/seine/RouteUI.jcss
    ... ... @@ -66,3 +66,6 @@ NumberEditor {
    66 66
     #delete {
    
    67 67
       _toolTipText:{t("observe.common.RouteDto.action.delete.tip")};
    
    68 68
     }
    
    69
    +#move {
    
    70
    +  _observeAction:{MoveRouteUIAction.ACTION_NAME};
    
    71
    +}
    \ No newline at end of file

  • client/src/main/java/fr/ird/observe/client/ui/content/data/seine/TripSeineUI.jaxx
    ... ... @@ -41,6 +41,7 @@
    41 41
         fr.ird.observe.dto.referential.DataQualityReference
    
    42 42
     
    
    43 43
         fr.ird.observe.client.ui.actions.content.DeleteDataUIAction
    
    44
    +    fr.ird.observe.client.ui.actions.content.MoveTripSeineUIAction
    
    44 45
         fr.ird.observe.client.ui.util.JComment
    
    45 46
         fr.ird.observe.client.ui.util.tripMap.TripMapUI
    
    46 47
     
    
    ... ... @@ -262,5 +263,7 @@ protected boolean canEditOcean(java.util.LinkedHashSet<RouteStubDto> routes) {
    262 263
       <JButton id='close'/>
    
    263 264
       <JButton id='closeAndCreate'/>
    
    264 265
       <JButton id='actionDown'/>
    
    265
    -
    
    266
    +  <JPanel id="forceNavigation">
    
    267
    +    <JButton id='move' styleClass="forceNavigation"/>
    
    268
    +  </JPanel>
    
    266 269
     </fr.ird.observe.client.ui.content.open.ContentOpenableUI>

  • client/src/main/java/fr/ird/observe/client/ui/content/data/seine/TripSeineUI.jcss
    ... ... @@ -153,3 +153,6 @@ NumberEditor {
    153 153
     #delete {
    
    154 154
       _toolTipText:{t("observe.common.TripDto.action.delete.tip")};
    
    155 155
     }
    
    156
    +#move {
    
    157
    +  _observeAction:{MoveTripSeineUIAction.ACTION_NAME};
    
    158
    +}
    \ No newline at end of file

  • client/src/main/java/fr/ird/observe/client/ui/content/ref/ContentReferenceUIHandler.java
    ... ... @@ -414,7 +414,7 @@ public class ContentReferenceUIHandler<D extends ReferentialDto, R extends Refer
    414 414
         }
    
    415 415
     
    
    416 416
         @Override
    
    417
    -    protected D getSelectedBean() {
    
    417
    +    public D getSelectedBean() {
    
    418 418
             return getModel().getSelectedBean();
    
    419 419
         }
    
    420 420
     
    

  • client/src/main/java/fr/ird/observe/client/ui/tree/ObserveNavigationTreeShowPopupAction.java
    ... ... @@ -10,12 +10,12 @@ package fr.ird.observe.client.ui.tree;
    10 10
      * it under the terms of the GNU General Public License as
    
    11 11
      * published by the Free Software Foundation, either version 3 of the
    
    12 12
      * License, or (at your option) any later version.
    
    13
    - * 
    
    13
    + *
    
    14 14
      * This program is distributed in the hope that it will be useful,
    
    15 15
      * but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    16 16
      * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    
    17 17
      * GNU General Public License for more details.
    
    18
    - * 
    
    18
    + *
    
    19 19
      * You should have received a copy of the GNU General Public
    
    20 20
      * License along with this program.  If not, see
    
    21 21
      * <http://www.gnu.org/licenses/gpl-3.0.html>.
    
    ... ... @@ -24,40 +24,35 @@ package fr.ird.observe.client.ui.tree;
    24 24
     
    
    25 25
     import com.google.common.base.Preconditions;
    
    26 26
     import fr.ird.observe.client.ObserveSwingApplicationContext;
    
    27
    -import fr.ird.observe.client.ui.actions.content.MoveActivityLonglineLogbookUIAction;
    
    28
    -import fr.ird.observe.client.ui.actions.content.MoveActivityLonglineObsUIAction;
    
    29
    -import fr.ird.observe.client.ui.actions.content.MoveActivitySeineUIAction;
    
    30
    -import fr.ird.observe.client.ui.actions.content.MoveRouteUIAction;
    
    31
    -import fr.ird.observe.client.ui.actions.content.MoveTripLonglineUIAction;
    
    32
    -import fr.ird.observe.client.ui.actions.content.MoveTripSeineUIAction;
    
    27
    +import fr.ird.observe.client.ui.ObserveKeyStrokes;
    
    33 28
     import fr.ird.observe.client.ui.content.ContentUI;
    
    34
    -import fr.ird.observe.client.ui.content.open.ContentOpenableUI;
    
    35 29
     import fr.ird.observe.client.ui.tree.navigation.NavigationTree;
    
    36 30
     import fr.ird.observe.client.ui.tree.navigation.nodes.NavigationTreeNodeSupport;
    
    37
    -import fr.ird.observe.client.ui.tree.navigation.nodes.ReferenceNavigationTreeNodeSupport;
    
    38
    -import fr.ird.observe.dto.data.longline.ActivityLonglineLogbookReference;
    
    39
    -import fr.ird.observe.dto.data.longline.ActivityLonglineObsReference;
    
    40
    -import fr.ird.observe.dto.data.longline.TripLonglineReference;
    
    41
    -import fr.ird.observe.dto.data.seine.ActivitySeineReference;
    
    42
    -import fr.ird.observe.dto.data.seine.RouteReference;
    
    43
    -import fr.ird.observe.dto.data.seine.TripSeineReference;
    
    44
    -import fr.ird.observe.dto.navigation.ObserveNavigationNode;
    
    45
    -import org.apache.logging.log4j.Logger;
    
    46 31
     import org.apache.logging.log4j.LogManager;
    
    32
    +import org.apache.logging.log4j.Logger;
    
    33
    +import org.jetbrains.annotations.NotNull;
    
    47 34
     
    
    48
    -import javax.swing.JButton;
    
    35
    +import javax.swing.AbstractAction;
    
    36
    +import javax.swing.AbstractButton;
    
    37
    +import javax.swing.Action;
    
    49 38
     import javax.swing.JMenuItem;
    
    50 39
     import javax.swing.JPopupMenu;
    
    51 40
     import javax.swing.JScrollPane;
    
    41
    +import javax.swing.KeyStroke;
    
    52 42
     import javax.swing.MenuElement;
    
    53 43
     import javax.swing.SwingUtilities;
    
    54 44
     import javax.swing.tree.TreePath;
    
    55 45
     import java.awt.Point;
    
    56 46
     import java.awt.Rectangle;
    
    47
    +import java.awt.event.ActionEvent;
    
    57 48
     import java.awt.event.KeyAdapter;
    
    58 49
     import java.awt.event.KeyEvent;
    
    59 50
     import java.awt.event.MouseAdapter;
    
    60 51
     import java.awt.event.MouseEvent;
    
    52
    +import java.util.List;
    
    53
    +import java.util.Map;
    
    54
    +import java.util.Objects;
    
    55
    +import java.util.TreeMap;
    
    61 56
     
    
    62 57
     /**
    
    63 58
      * Created on 1/8/15.
    
    ... ... @@ -70,21 +65,21 @@ public class ObserveNavigationTreeShowPopupAction {
    70 65
         /** Logger. */
    
    71 66
         private static final Logger log = LogManager.getLogger(ObserveNavigationTreeShowPopupAction.class);
    
    72 67
     
    
    73
    -    private static final String TRIP_SEINE_MENU_ITEMS = "tripSeine";
    
    74
    -    private static final String TRIP_LONGLINE_MENU_ITEMS = "tripLongline";
    
    75
    -    private static final String ROUTE_MENU_ITEMS = "route";
    
    76
    -    private static final String ACTIVITY_SEINE_MENU_ITEMS = "activitySeine";
    
    77
    -    private static final String ACTIVITY_LONGLINE_MENU_ITEMS = "activityLongline";
    
    68
    +//    private static final String TRIP_SEINE_MENU_ITEMS = "tripSeine";
    
    69
    +//    private static final String TRIP_LONGLINE_MENU_ITEMS = "tripLongline";
    
    70
    +//    private static final String ROUTE_MENU_ITEMS = "route";
    
    71
    +//    private static final String ACTIVITY_SEINE_MENU_ITEMS = "activitySeine";
    
    72
    +//    private static final String ACTIVITY_LONGLINE_MENU_ITEMS = "activityLongline";
    
    78 73
     
    
    79 74
         private final JPopupMenu popup;
    
    80 75
     
    
    81 76
         private final NavigationTree tree;
    
    82 77
     
    
    83 78
         private final JMenuItem noAction;
    
    84
    -    private final JMenuItem openAction;
    
    85
    -    private final JMenuItem closeAction;
    
    86
    -    private final JMenuItem moveAction;
    
    87
    -    private final JMenuItem deleteAction;
    
    79
    +//    private final JMenuItem openAction;
    
    80
    +//    private final JMenuItem closeAction;
    
    81
    +//    private final JMenuItem moveAction;
    
    82
    +//    private final JMenuItem deleteAction;
    
    88 83
     
    
    89 84
         public ObserveNavigationTreeShowPopupAction(NavigationTree tree, JScrollPane pane, JPopupMenu popup) {
    
    90 85
     
    
    ... ... @@ -92,36 +87,35 @@ public class ObserveNavigationTreeShowPopupAction {
    92 87
             this.tree = tree;
    
    93 88
     
    
    94 89
             JMenuItem noActionComponent = null;
    
    95
    -        // trip menus
    
    96
    -        JMenuItem moveComponent = null;
    
    97
    -        JMenuItem openActionComponent = null;
    
    98
    -        JMenuItem closeActionComponent = null;
    
    99
    -        JMenuItem deleteActionComponent = null;
    
    90
    +//        JMenuItem moveComponent = null;
    
    91
    +//        JMenuItem openActionComponent = null;
    
    92
    +//        JMenuItem closeActionComponent = null;
    
    93
    +//        JMenuItem deleteActionComponent = null;
    
    100 94
     
    
    101 95
             for (MenuElement menuElement : popup.getSubElements()) {
    
    102 96
     
    
    103 97
                 if (menuElement.getComponent().getName().equals("navigationNoAction")) {
    
    104 98
                     noActionComponent = (JMenuItem) menuElement.getComponent();
    
    105 99
                 }
    
    106
    -            if (menuElement.getComponent().getName().equals("navigationMoveAction")) {
    
    107
    -                moveComponent = (JMenuItem) menuElement.getComponent();
    
    108
    -            }
    
    109
    -            if (menuElement.getComponent().getName().equals("navigationOpenAction")) {
    
    110
    -                openActionComponent = (JMenuItem) menuElement.getComponent();
    
    111
    -            }
    
    112
    -            if (menuElement.getComponent().getName().equals("navigationCloseAction")) {
    
    113
    -                closeActionComponent = (JMenuItem) menuElement.getComponent();
    
    114
    -            }
    
    115
    -            if (menuElement.getComponent().getName().equals("navigationDeleteAction")) {
    
    116
    -                deleteActionComponent = (JMenuItem) menuElement.getComponent();
    
    117
    -            }
    
    100
    +//            if (menuElement.getComponent().getName().equals("navigationMoveAction")) {
    
    101
    +//                moveComponent = (JMenuItem) menuElement.getComponent();
    
    102
    +//            }
    
    103
    +//            if (menuElement.getComponent().getName().equals("navigationOpenAction")) {
    
    104
    +//                openActionComponent = (JMenuItem) menuElement.getComponent();
    
    105
    +//            }
    
    106
    +//            if (menuElement.getComponent().getName().equals("navigationCloseAction")) {
    
    107
    +//                closeActionComponent = (JMenuItem) menuElement.getComponent();
    
    108
    +//            }
    
    109
    +//            if (menuElement.getComponent().getName().equals("navigationDeleteAction")) {
    
    110
    +//                deleteActionComponent = (JMenuItem) menuElement.getComponent();
    
    111
    +//            }
    
    118 112
             }
    
    119 113
     
    
    120 114
             this.noAction = noActionComponent;
    
    121
    -        this.openAction = openActionComponent;
    
    122
    -        this.closeAction = closeActionComponent;
    
    123
    -        this.moveAction = moveComponent;
    
    124
    -        this.deleteAction = deleteActionComponent;
    
    115
    +//        this.openAction = openActionComponent;
    
    116
    +//        this.closeAction = closeActionComponent;
    
    117
    +//        this.moveAction = moveComponent;
    
    118
    +//        this.deleteAction = deleteActionComponent;
    
    125 119
     
    
    126 120
             KeyAdapter keyAdapter = new KeyAdapter() {
    
    127 121
                 @Override
    
    ... ... @@ -146,124 +140,115 @@ public class ObserveNavigationTreeShowPopupAction {
    146 140
             pane.addMouseListener(mouseAdapter);
    
    147 141
         }
    
    148 142
     
    
    143
    +    @NotNull
    
    144
    +    private static String removeKeyStroke(String text) {
    
    145
    +        int lastIndex = text.lastIndexOf('(');
    
    146
    +        if (lastIndex > -1) {
    
    147
    +            text = text.substring(0, lastIndex - 1).trim();
    
    148
    +        }
    
    149
    +        return text;
    
    150
    +    }
    
    151
    +
    
    149 152
         private void autoSelectNodeInTree(MouseEvent e) {
    
    153
    +
    
    150 154
             boolean rightClick = SwingUtilities.isRightMouseButton(e);
    
    155
    +
    
    151 156
             if (rightClick) {
    
    157
    +
    
    152 158
                 // get the coordinates of the mouse click
    
    153 159
                 Point p = e.getPoint();
    
    160
    +
    
    154 161
                 int closestRowForLocation = tree.getClosestRowForLocation(e.getX(), e.getY());
    
    162
    +
    
    155 163
                 int rowToSelect = -1;
    
    164
    +
    
    156 165
                 if (isRowSelected(closestRowForLocation)) {
    
    166
    +
    
    157 167
                     rowToSelect = closestRowForLocation;
    
    158 168
                 }
    
    169
    +
    
    159 170
                 if (rowToSelect == -1) {
    
    171
    +
    
    160 172
                     // try to change selection
    
    173
    +
    
    161 174
                     TreePath pathForRow = tree.getPathForRow(closestRowForLocation);
    
    162 175
                     tree.setSelectionPath(pathForRow);
    
    176
    +
    
    163 177
                     if (isRowSelected(closestRowForLocation)) {
    
    178
    +
    
    164 179
                         rowToSelect = closestRowForLocation;
    
    165 180
                     }
    
    181
    +
    
    166 182
                 }
    
    183
    +
    
    167 184
                 if (rowToSelect != -1) {
    
    185
    +
    
    168 186
                     showPopup(rowToSelect, p);
    
    187
    +
    
    169 188
                 }
    
    189
    +
    
    170 190
             }
    
    171 191
         }
    
    172 192
     
    
    173 193
         private void openNodeMenu(KeyEvent e) {
    
    194
    +
    
    174 195
             if (e.getKeyCode() == KeyEvent.VK_CONTEXT_MENU && !tree.isSelectionEmpty()) {
    
    196
    +
    
    175 197
                 // get the lowest selected row
    
    176 198
                 int lowestRow = getLowestSelectedRowCount();
    
    199
    +
    
    177 200
                 // get the selected column
    
    178 201
                 Rectangle r = tree.getRowBounds(lowestRow);
    
    202
    +
    
    179 203
                 // get the point in the middle lower of the cell
    
    180 204
                 Point p = new Point(r.x + r.width / 2, r.y + r.height);
    
    181
    -            log.debug("Row " + lowestRow + " found t point [" + p + "]");
    
    205
    +
    
    206
    +            if (log.isDebugEnabled()) {
    
    207
    +                log.debug("Row " + lowestRow + " found t point [" + p + "]");
    
    208
    +            }
    
    209
    +
    
    182 210
                 showPopup(lowestRow, p);
    
    211
    +
    
    183 212
             }
    
    184 213
         }
    
    185 214
     
    
    186 215
         private void showPopup(int row, Point p) {
    
    216
    +
    
    187 217
             log.info("Will show popup from row: " + row);
    
    218
    +
    
    188 219
             NavigationTreeNodeSupport selectedNode = (NavigationTreeNodeSupport) tree.getPathForRow(row).getLastPathComponent();
    
    220
    +
    
    189 221
             log.info("Found selected node: " + selectedNode);
    
    190
    -        beforeOpenPopup(selectedNode);
    
    191
    -        popup.show(tree, p.x, p.y);
    
    222
    +
    
    223
    +        SwingUtilities.invokeLater(() -> {
    
    224
    +            beforeOpenPopup(selectedNode);
    
    225
    +            popup.show(tree, p.x, p.y);
    
    226
    +        });
    
    227
    +
    
    192 228
         }
    
    193 229
     
    
    194
    -    //FIXME
    
    195 230
         private void beforeOpenPopup(NavigationTreeNodeSupport selectedNode) {
    
    231
    +
    
    232
    +        // clean popup
    
    196 233
             popup.removeAll();
    
    234
    +        popup.setLabel(selectedNode.getText());
    
    197 235
             ObserveSwingApplicationContext applicationContext = ObserveSwingApplicationContext.get();
    
    198
    -//        ClientDataContext dataContext = applicationContext.getDataContext();
    
    199 236
             ContentUI<?, ?> selectedContentUI = applicationContext.getContentUIManager().getSelectedContentUI();
    
    200
    -        ObserveNavigationNode<?> selectedNodeId = selectedContentUI.getHandler().getSelectedNode();
    
    201
    -        String selectedId = selectedNodeId.getId();
    
    202
    -        ObserveNavigationNode<?> editNode = selectedContentUI.getHandler().getEditNode();
    
    203
    -//        ObserveOpenDataManager openDataManager = applicationContext.getOpenDataManager();
    
    204
    -        boolean closeActionEnabled = false;
    
    205
    -        if (selectedContentUI instanceof ContentOpenableUI) {
    
    206
    -            JButton closeButton = ((ContentOpenableUI) selectedContentUI).getClose();
    
    207
    -            closeActionEnabled = closeButton.isEnabled();
    
    237
    +        List<AbstractButton> actions = selectedContentUI.getNavigationPopupActions();
    
    238
    +        if (actions.isEmpty()) {
    
    239
    +            popup.add(noAction);
    
    240
    +        } else {
    
    241
    +            Map<String, AbstractButton> actionMap = new TreeMap<>();
    
    242
    +            actions.forEach(a -> actionMap.put(getActionText(a), a));
    
    243
    +            actionMap.forEach(this::addAction);
    
    208 244
             }
    
    209
    -//        Class dataType = selectedNode.getDataType();
    
    210
    -//        if (TripSeineReference.class.equals(dataType)) {
    
    211
    -//            beforeOpenMenu((ReferenceNavigationTreeNodeSupport) selectedNode, TRIP_SEINE_MENU_ITEMS);
    
    212
    -//            openAction.setEnabled(editNode.isDisabled());
    
    213
    -//            closeAction.setEnabled(closeActionEnabled);
    
    214
    -//        } else if (TripLonglineReference.class.equals(dataType)) {
    
    215
    -//            beforeOpenMenu((ReferenceNavigationTreeNodeSupport) selectedNode, TRIP_LONGLINE_MENU_ITEMS);
    
    216
    -//            openAction.setEnabled(editNode.isDisabled());
    
    217
    -//            closeAction.setEnabled(closeActionEnabled);
    
    218
    -//        } else if (RouteReference.class.equals(dataType)) {
    
    219
    -//            beforeOpenMenu((ReferenceNavigationTreeNodeSupport) selectedNode, ROUTE_MENU_ITEMS);
    
    220
    -//            openAction.setEnabled(openDataManager.canOpenRoute(dataContext.getSelectedTripSeineId()));
    
    221
    -//            closeAction.setEnabled(closeActionEnabled);
    
    222
    -//        } else if (ActivitySeineReference.class.equals(dataType)) {
    
    223
    -//            beforeOpenMenu((ReferenceNavigationTreeNodeSupport) selectedNode, ACTIVITY_SEINE_MENU_ITEMS);
    
    224
    -//            openAction.setEnabled(openDataManager.canOpenActivitySeine(dataContext.getSelectedRouteId()));
    
    225
    -//            closeAction.setEnabled(closeActionEnabled);
    
    226
    -//        } else if (ActivityLonglineObsReference.class.equals(dataType)) {
    
    227
    -//            beforeOpenMenu((ReferenceNavigationTreeNodeSupport) selectedNode, ACTIVITY_LONGLINE_MENU_ITEMS);
    
    228
    -//            openAction.setEnabled(openDataManager.canOpenActivityLonglineObs(dataContext.getSelectedTripLonglineId()));
    
    229
    -//            closeAction.setEnabled(closeActionEnabled);
    
    230
    -//        } else if (ActivityLonglineLogbookReference.class.equals(dataType)) {
    
    231
    -//            beforeOpenMenu((ReferenceNavigationTreeNodeSupport) selectedNode, ACTIVITY_LONGLINE_MENU_ITEMS);
    
    232
    -//            openAction.setEnabled(openDataManager.canOpenActivityLonglineLogbook(dataContext.getSelectedTripLonglineId()));
    
    233
    -//            closeAction.setEnabled(closeActionEnabled);
    
    234
    -//        } else {
    
    235
    -//            popup.add(noAction);
    
    236
    -//        }
    
    237 245
         }
    
    238 246
     
    
    239
    -    private void beforeOpenMenu(ReferenceNavigationTreeNodeSupport selectedNode, String nodeType) {
    
    240
    -        log.info("Will load popup for " + nodeType + " node.");
    
    241
    -        ObserveSwingApplicationContext applicationContext = ObserveSwingApplicationContext.get();
    
    242
    -        if (selectedNode.isOpen()) {
    
    243
    -            closeAction.putClientProperty("ui", applicationContext.getContentUIManager().getSelectedContentUI());
    
    244
    -            popup.add(closeAction);
    
    245
    -        } else {
    
    246
    -            openAction.putClientProperty("ui", applicationContext.getContentUIManager().getSelectedContentUI());
    
    247
    -            popup.add(openAction);
    
    248
    -        }
    
    249
    -        Class dataType = selectedNode.getDataType();
    
    250
    -        if (TripSeineReference.class.equals(dataType)) {
    
    251
    -            moveAction.setAction(new MoveTripSeineUIAction(applicationContext.getMainUI()));
    
    252
    -        } else if (TripLonglineReference.class.equals(dataType)) {
    
    253
    -            moveAction.setAction(new MoveTripLonglineUIAction(applicationContext.getMainUI()));
    
    254
    -        } else if (RouteReference.class.equals(dataType)) {
    
    255
    -            moveAction.setAction(new MoveRouteUIAction(applicationContext.getMainUI()));
    
    256
    -        } else if (ActivitySeineReference.class.equals(dataType)) {
    
    257
    -            moveAction.setAction(new MoveActivitySeineUIAction(applicationContext.getMainUI()));
    
    258
    -        } else if (ActivityLonglineObsReference.class.equals(dataType)) {
    
    259
    -            moveAction.setAction(new MoveActivityLonglineObsUIAction(applicationContext.getMainUI()));
    
    260
    -        } else if (ActivityLonglineLogbookReference.class.equals(dataType)) {
    
    261
    -            moveAction.setAction(new MoveActivityLonglineLogbookUIAction(applicationContext.getMainUI()));
    
    262
    -        }
    
    263
    -        popup.add(moveAction);
    
    264
    -        deleteAction.putClientProperty("ui", applicationContext.getContentUIManager().getSelectedContentUI());
    
    265
    -        deleteAction.setEnabled(selectedNode.isOpen());
    
    266
    -        popup.add(deleteAction);
    
    247
    +    private void addAction(String text, AbstractButton abstractButton) {
    
    248
    +        JMenuItem menuItem = new JMenuItem();
    
    249
    +        MenuAction menuAction = new MenuAction(abstractButton, text, popup.getComponentCount());
    
    250
    +        menuItem.setAction(menuAction);
    
    251
    +        popup.add(menuItem);
    
    267 252
         }
    
    268 253
     
    
    269 254
         private boolean isRowSelected(int requiredRow) {
    
    ... ... @@ -272,6 +257,7 @@ public class ObserveNavigationTreeShowPopupAction {
    272 257
             if (selectedRows != null) {
    
    273 258
                 for (int selectedRow : selectedRows) {
    
    274 259
                     if (requiredRow == selectedRow) {
    
    260
    +
    
    275 261
                         // match
    
    276 262
                         result = true;
    
    277 263
                         break;
    
    ... ... @@ -293,4 +279,41 @@ public class ObserveNavigationTreeShowPopupAction {
    293 279
             return lowestRow;
    
    294 280
         }
    
    295 281
     
    
    282
    +    private String getActionText(AbstractButton abstractButton) {
    
    283
    +        String text = abstractButton.getText();
    
    284
    +        if (text == null || text.equals(abstractButton.getName())) {
    
    285
    +            text = abstractButton.getToolTipText();
    
    286
    +        }
    
    287
    +        Objects.requireNonNull(text, "Button with no text, nor tip, kind of strange, don't you think?");
    
    288
    +        return text;
    
    289
    +    }
    
    290
    +
    
    291
    +    private static class MenuAction extends AbstractAction {
    
    292
    +
    
    293
    +        private final Action action;
    
    294
    +
    
    295
    +        MenuAction(AbstractButton abstractButton, String text, int pos) {
    
    296
    +            super(removeKeyStroke(text), abstractButton.getIcon());
    
    297
    +            int a = 'A' + pos;
    
    298
    +            KeyStroke keyStroke = KeyStroke.getKeyStroke("ctrl pressed " + (char) a);
    
    299
    +            putValue(ACCELERATOR_KEY, keyStroke);
    
    300
    +            String toolTipText = abstractButton.getToolTipText();
    
    301
    +            if (toolTipText != null) {
    
    302
    +                toolTipText = removeKeyStroke(toolTipText);
    
    303
    +                toolTipText = ObserveKeyStrokes.suffixTextWithKeyStroke(toolTipText, keyStroke);
    
    304
    +                putValue(SHORT_DESCRIPTION, toolTipText);
    
    305
    +            }
    
    306
    +            this.action = new AbstractAction() {
    
    307
    +                @Override
    
    308
    +                public void actionPerformed(ActionEvent e) {
    
    309
    +                    abstractButton.doClick();
    
    310
    +                }
    
    311
    +            };
    
    312
    +        }
    
    313
    +
    
    314
    +        @Override
    
    315
    +        public void actionPerformed(ActionEvent e) {
    
    316
    +            action.actionPerformed(e);
    
    317
    +        }
    
    318
    +    }
    
    296 319
     }

  • validation/src/main/resources/fr/ird/observe/dto/data/seine/ActivitySeineDto-create-error-validation.xml
    ... ... @@ -179,7 +179,7 @@
    179 179
         <field-validator type="quadrantDto" short-circuit="true">
    
    180 180
           <param name="ocean">currentTripSeine.ocean</param>
    
    181 181
           <message>
    
    182
    -        observe.validation.activity.invalid.quadrant##${currentTripSeine.ocean.libelle}
    
    182
    +        observe.validation.activity.invalid.quadrant##${currentTripSeine.ocean.label}
    
    183 183
           </message>
    
    184 184
         </field-validator>
    
    185 185
     
    

  • validation/src/main/resources/fr/ird/observe/dto/data/seine/ActivitySeineDto-update-error-validation.xml
    ... ... @@ -37,7 +37,7 @@
    37 37
         <field-validator type="quadrantDto" short-circuit="true">
    
    38 38
           <param name="ocean">currentTripSeine.ocean</param>
    
    39 39
           <message>
    
    40
    -        observe.validation.activity.invalid.quadrant##${currentTripSeine.ocean.libelle}
    
    40
    +        observe.validation.activity.invalid.quadrant##${currentTripSeine.ocean.label}
    
    41 41
           </message>
    
    42 42
         </field-validator>
    
    43 43