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

Commits:

22 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
    ... ... @@ -83,6 +83,7 @@ public abstract class ObserveKeyStrokes {
    83 83
         public static final KeyStroke KEY_STROKE_CHANGE_FOCUS = KeyStroke.getKeyStroke("pressed F1");
    
    84 84
         public static final KeyStroke KEY_STROKE_SAVE = KeyStroke.getKeyStroke("ctrl pressed S");
    
    85 85
         public static final KeyStroke KEY_STROKE_SHIFT_ALT_ENTER = KeyStroke.getKeyStroke("alt shift pressed ENTER");
    
    86
    +    public static final KeyStroke KEY_STROKE_SHOW_TECHNICAL_INFORMATIONS = KeyStroke.getKeyStroke("shift pressed F1");
    
    86 87
         public static final KeyStroke KEY_STROKE_GO_DOWN = KeyStroke.getKeyStroke("alt pressed D");
    
    87 88
         public static final KeyStroke KEY_STROKE_ADD_DCP = KeyStroke.getKeyStroke("ctrl pressed P");
    
    88 89
         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
    ... ... @@ -83,6 +83,18 @@ public abstract class UIActionSupport extends AbstractAction {
    83 83
             }
    
    84 84
         }
    
    85 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
    +
    
    86 98
         public KeyStroke getAcceleratorKey() {
    
    87 99
             return (KeyStroke) getValue(ACCELERATOR_KEY);
    
    88 100
         }
    

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

  • client/src/main/java/fr/ird/observe/client/ui/actions/storage/UseRemoteConfigurationUIAction.java
    ... ... @@ -29,8 +29,8 @@ import fr.ird.observe.client.ui.storage.StorageUI;
    29 29
     import fr.ird.observe.client.ui.storage.StorageUIModel;
    
    30 30
     import fr.ird.observe.client.ui.storage.tabs.ConfigUI;
    
    31 31
     import fr.ird.observe.dto.presets.RemoteDataSourceConfiguration;
    
    32
    -import org.apache.logging.log4j.Logger;
    
    33 32
     import org.apache.logging.log4j.LogManager;
    
    33
    +import org.apache.logging.log4j.Logger;
    
    34 34
     
    
    35 35
     import javax.swing.JMenuItem;
    
    36 36
     import javax.swing.KeyStroke;
    
    ... ... @@ -84,8 +84,7 @@ public class UseRemoteConfigurationUIAction extends UIActionSupport {
    84 84
                 if (ConnexionStatus.SUCCESS == configUI.getModel().getConnexionStatus()) {
    
    85 85
                     if (parentContainer.getModel().getNextStep() != null) {
    
    86 86
                         parentContainer.getNextAction().doClick();
    
    87
    -                }
    
    88
    -                if (getMainUI() != null) {
    
    87
    +                } else if (getMainUI() != null) {
    
    89 88
                         parentContainer.getApplyAction().doClick();
    
    90 89
                     }
    
    91 90
                 }
    

  • client/src/main/java/fr/ird/observe/client/ui/actions/storage/UseServerConfigurationUIAction.java
    ... ... @@ -10,12 +10,12 @@ package fr.ird.observe.client.ui.actions.storage;
    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>.
    
    ... ... @@ -29,8 +29,8 @@ import fr.ird.observe.client.ui.storage.StorageUI;
    29 29
     import fr.ird.observe.client.ui.storage.StorageUIModel;
    
    30 30
     import fr.ird.observe.client.ui.storage.tabs.ConfigUI;
    
    31 31
     import fr.ird.observe.dto.presets.ServerDataSourceConfiguration;
    
    32
    -import org.apache.logging.log4j.Logger;
    
    33 32
     import org.apache.logging.log4j.LogManager;
    
    33
    +import org.apache.logging.log4j.Logger;
    
    34 34
     
    
    35 35
     import javax.swing.JMenuItem;
    
    36 36
     import javax.swing.KeyStroke;
    
    ... ... @@ -45,10 +45,9 @@ import java.awt.event.ActionEvent;
    45 45
      */
    
    46 46
     public class UseServerConfigurationUIAction extends UIActionSupport {
    
    47 47
     
    
    48
    +    public static final String ACTION_NAME = UseServerConfigurationUIAction.class.getName();
    
    48 49
         /** Logger */
    
    49 50
         private static final Logger log = LogManager.getLogger(UseServerConfigurationUIAction.class);
    
    50
    -
    
    51
    -    public static final String ACTION_NAME = UseServerConfigurationUIAction.class.getName();
    
    52 51
         private final ConfigUI configUI;
    
    53 52
         private final ServerDataSourceConfiguration configuration;
    
    54 53
         private StorageUI parentContainer;
    
    ... ... @@ -84,8 +83,7 @@ public class UseServerConfigurationUIAction extends UIActionSupport {
    84 83
                 if (ConnexionStatus.SUCCESS == configUI.getModel().getConnexionStatus()) {
    
    85 84
                     if (parentContainer.getModel().getNextStep() != null) {
    
    86 85
                         parentContainer.getNextAction().doClick();
    
    87
    -                }
    
    88
    -                if (getMainUI() != null) {
    
    86
    +                } else if (getMainUI() != null) {
    
    89 87
                         parentContainer.getApplyAction().doClick();
    
    90 88
                     }
    
    91 89
                 }
    

  • client/src/main/java/fr/ird/observe/client/ui/content/ContentUI.jaxx
    ... ... @@ -37,6 +37,7 @@
    37 37
         fr.ird.observe.client.configuration.ClientConfig
    
    38 38
         fr.ird.observe.client.ui.actions.content.GoUpUIAction
    
    39 39
         fr.ird.observe.client.ui.actions.content.GoDownUIAction
    
    40
    +    fr.ird.observe.client.ui.actions.content.ShowTechnicalInformationsAction
    
    40 41
         fr.ird.observe.client.ui.content.ContentUIHandler
    
    41 42
     
    
    42 43
         fr.ird.observe.dto.IdDto
    
    ... ... @@ -48,6 +49,9 @@
    48 49
         javax.swing.JComboBox
    
    49 50
         javax.swing.JList
    
    50 51
         javax.swing.UIManager
    
    52
    +    javax.swing.AbstractButton
    
    53
    +
    
    54
    +    static org.nuiton.i18n.I18n.t
    
    51 55
       </import>
    
    52 56
     
    
    53 57
       <ClientConfig id='config' initializer='ObserveSwingApplicationContext.get().getConfig()'/>
    
    ... ... @@ -76,6 +80,8 @@
    76 80
     
    
    77 81
       public abstract ContentUIHandler<E,U> getHandler();
    
    78 82
     
    
    83
    +  public List<AbstractButton> getNavigationPopupActions() { return getHandler().getNavigationPopupActions(); }
    
    84
    +
    
    79 85
     public Object getSelectedBean(JComboBox combo) {
    
    80 86
         return combo.getSelectedItem();
    
    81 87
     }
    
    ... ... @@ -143,8 +149,7 @@ public void createData() {
    143 149
           <JButton id='actionDown'/>
    
    144 150
         </JXLayer>
    
    145 151
     
    
    146
    -    <JButton id='showTechnicalInformations'
    
    147
    -             onActionPerformed='getHandler().showTechnicalInformations((JButton) event.getSource());'/>
    
    152
    +    <JButton id='showTechnicalInformations'/>
    
    148 153
     
    
    149 154
         <JLabel id='titleRight'/>
    
    150 155
       </JToolBar>
    
    ... ... @@ -163,6 +168,9 @@ public void createData() {
    163 168
     
    
    164 169
       <JPanel id="invisible" visible='false'>
    
    165 170
     
    
    171
    +    <JPanel id="navigationActions">
    
    172
    +      <!--Place here all actions you want to see in navigation popup but not in the form-->
    
    173
    +    </JPanel>
    
    166 174
       </JPanel>
    
    167 175
     
    
    168 176
     </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
    ... ... @@ -8,12 +8,12 @@
    8 8
      * it under the terms of the GNU General Public License as
    
    9 9
      * published by the Free Software Foundation, either version 3 of the
    
    10 10
      * License, or (at your option) any later version.
    
    11
    - * 
    
    11
    + *
    
    12 12
      * This program is distributed in the hope that it will be useful,
    
    13 13
      * but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    14 14
      * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    
    15 15
      * GNU General Public License for more details.
    
    16
    - * 
    
    16
    + *
    
    17 17
      * You should have received a copy of the GNU General Public
    
    18 18
      * License along with this program.  If not, see
    
    19 19
      * <http://www.gnu.org/licenses/gpl-3.0.html>.
    
    ... ... @@ -35,7 +35,6 @@ import fr.ird.observe.client.ui.content.list.ContentListUIModel;
    35 35
     import fr.ird.observe.client.ui.content.ref.ContentReferenceUIHandler;
    
    36 36
     import fr.ird.observe.client.ui.tree.navigation.NavigationTree;
    
    37 37
     import fr.ird.observe.client.ui.tree.navigation.nodes.NavigationTreeNodeSupport;
    
    38
    -import fr.ird.observe.client.ui.util.SpringUtilities;
    
    39 38
     import fr.ird.observe.client.ui.util.UIHelper;
    
    40 39
     import fr.ird.observe.client.validation.ClientValidationContext;
    
    41 40
     import fr.ird.observe.dto.IdDto;
    
    ... ... @@ -96,11 +95,10 @@ import fr.ird.observe.services.service.referential.ReferentialService;
    96 95
     import fr.ird.observe.services.service.sql.SqlScriptProducerService;
    
    97 96
     import fr.ird.observe.spi.map.ImmutableDtoMap;
    
    98 97
     import org.apache.commons.lang3.BooleanUtils;
    
    99
    -import org.apache.commons.lang3.time.FastDateFormat;
    
    100 98
     import org.apache.logging.log4j.LogManager;
    
    101 99
     import org.apache.logging.log4j.Logger;
    
    102
    -import org.nuiton.decorator.Decorator;
    
    103 100
     import org.nuiton.decorator.DecoratorUtil;
    
    101
    +import org.nuiton.jaxx.runtime.JAXXObject;
    
    104 102
     import org.nuiton.jaxx.runtime.context.DefaultJAXXContext;
    
    105 103
     import org.nuiton.jaxx.validator.swing.SwingValidatorMessageTableModel;
    
    106 104
     import org.nuiton.jaxx.validator.swing.SwingValidatorUtil;
    
    ... ... @@ -112,28 +110,17 @@ import org.nuiton.validator.NuitonValidatorScope;
    112 110
     import javax.swing.AbstractButton;
    
    113 111
     import javax.swing.ActionMap;
    
    114 112
     import javax.swing.Icon;
    
    115
    -import javax.swing.JButton;
    
    116 113
     import javax.swing.JComponent;
    
    117
    -import javax.swing.JLabel;
    
    118 114
     import javax.swing.JOptionPane;
    
    119
    -import javax.swing.JPanel;
    
    120
    -import javax.swing.JPopupMenu;
    
    121
    -import javax.swing.JTextField;
    
    122 115
     import javax.swing.JToolBar;
    
    123
    -import javax.swing.SpringLayout;
    
    124 116
     import javax.swing.SwingUtilities;
    
    125 117
     import javax.swing.UIManager;
    
    126
    -import javax.swing.border.TitledBorder;
    
    127 118
     import java.awt.Component;
    
    128
    -import java.awt.Dimension;
    
    129 119
     import java.awt.FocusTraversalPolicy;
    
    130
    -import java.awt.event.FocusEvent;
    
    131
    -import java.awt.event.FocusListener;
    
    132 120
     import java.util.Collection;
    
    133 121
     import java.util.Collections;
    
    134 122
     import java.util.LinkedList;
    
    135 123
     import java.util.List;
    
    136
    -import java.util.Locale;
    
    137 124
     import java.util.Map;
    
    138 125
     import java.util.Objects;
    
    139 126
     import java.util.Optional;
    
    ... ... @@ -158,13 +145,12 @@ public abstract class ContentUIHandler<E extends IdDto, U extends ContentUI<E, U
    158 145
         private final DataContextType type;
    
    159 146
         private final Icon errorIcon;
    
    160 147
         private final Map<String, ReferentialReferencesFilter> referentialsFilters = new TreeMap<>();
    
    161
    -    private final FastDateFormat dateFormat;
    
    148
    +    private final ObserveLayoutFocusTraversalPolicy<U> focusTraversalPolicy;
    
    162 149
         protected String prefix;
    
    163 150
         /** l'interface graphique que le controleur utilise */
    
    164 151
         protected U ui;
    
    165 152
         private boolean init;
    
    166 153
     
    
    167
    -    private final ObserveLayoutFocusTraversalPolicy<U> focusTraversalPolicy;
    
    168 154
         public ContentUIHandler(DataContextType parentType, DataContextType type) {
    
    169 155
             this(null, parentType, type);
    
    170 156
         }
    
    ... ... @@ -174,17 +160,9 @@ public abstract class ContentUIHandler<E extends IdDto, U extends ContentUI<E, U
    174 160
             this.parentType = parentType;
    
    175 161
             this.type = type;
    
    176 162
             this.errorIcon = UIManager.getIcon("action.error");
    
    177
    -        Locale locale = ObserveSwingApplicationContext.get().getConfig().getLocale();
    
    178
    -        if (Locale.ENGLISH.equals(locale)) {
    
    179
    -            dateFormat = FastDateFormat.getInstance("yyyy-MM-ddZZ hh:mm:ss");
    
    180
    -        } else {
    
    181
    -            dateFormat = FastDateFormat.getInstance("dd/MM/yyyy hh:mm:ss");
    
    182
    -        }
    
    183 163
             this.focusTraversalPolicy = creatFocusTraversalPolicy();
    
    184 164
         }
    
    185 165
     
    
    186
    -    protected abstract ObserveLayoutFocusTraversalPolicy<U> creatFocusTraversalPolicy();
    
    187
    -
    
    188 166
         public static NavigationTree getNavigationTree() {
    
    189 167
             return ObserveSwingApplicationContext.get().getMainUI().getNavigationUI().getTree();
    
    190 168
         }
    
    ... ... @@ -298,6 +276,63 @@ public abstract class ContentUIHandler<E extends IdDto, U extends ContentUI<E, U
    298 276
             model.removeMessages(ui, null);
    
    299 277
         }
    
    300 278
     
    
    279
    +    /**
    
    280
    +     * @return layout focus traversel policy used by the ui.
    
    281
    +     */
    
    282
    +    protected abstract ObserveLayoutFocusTraversalPolicy<U> creatFocusTraversalPolicy();
    
    283
    +
    
    284
    +    /**
    
    285
    +     * @return actions usable in the navigation popup.
    
    286
    +     */
    
    287
    +    public List<AbstractButton> getNavigationPopupActions() {
    
    288
    +        List<AbstractButton> result = new LinkedList<>();
    
    289
    +        collectNavigationPopupActions(result, ui, "actions", "extraActions", "navigationActions", "titleRightToolBar");
    
    290
    +        for (Object object : ui.get$objectMap().values()) {
    
    291
    +            if (object != ui && object instanceof ContentUI) {
    
    292
    +                collectNavigationPopupActions(result, (JAXXObject) object, "actions", "extraActions", "navigationActions");
    
    293
    +            }
    
    294
    +        }
    
    295
    +        return result;
    
    296
    +    }
    
    297
    +
    
    298
    +    protected void collectNavigationPopupActions(List<AbstractButton> result, JAXXObject jaxxObject, String... containers) {
    
    299
    +        for (Object object : jaxxObject.get$objectMap().values()) {
    
    300
    +            if (object instanceof AbstractButton) {
    
    301
    +                AbstractButton button = (AbstractButton) object;
    
    302
    +                boolean force = Objects.equals(true, button.getClientProperty("forceNavigation"));
    
    303
    +                if (!force) {
    
    304
    +                    if (!button.isEnabled()) {
    
    305
    +                        log.info("Reject (disabled) action: " + button.getName() + " - " + button.getText());
    
    306
    +                        continue;
    
    307
    +                    }
    
    308
    +                    if (!button.isShowing()) {
    
    309
    +                        log.info("Reject (hidden) action: " + button.getName() + " - " + button.getText());
    
    310
    +                        continue;
    
    311
    +                    }
    
    312
    +                    if (Objects.equals(true, button.getClientProperty("skipNavigation"))) {
    
    313
    +                        log.info("Reject (skip) action: " + button.getName() + " - " + button.getText());
    
    314
    +                        continue;
    
    315
    +                    }
    
    316
    +
    
    317
    +                    boolean found = false;
    
    318
    +                    for (String container : containers) {
    
    319
    +                        found = SwingUtilities.getAncestorNamed(container, button) != null;
    
    320
    +                        if (found) {
    
    321
    +                            break;
    
    322
    +                        }
    
    323
    +                    }
    
    324
    +                    if (!found) {
    
    325
    +                        log.info("Reject (out of zone) action: " + button.getName() + " - " + button.getText());
    
    326
    +                        continue;
    
    327
    +                    }
    
    328
    +                }
    
    329
    +                log.info("Keep action: " + button.getName() + " - " + button.getText());
    
    330
    +                result.add(button);
    
    331
    +            }
    
    332
    +        }
    
    333
    +
    
    334
    +    }
    
    335
    +
    
    301 336
         protected void addReferentialFilter(String propertyName, ReferentialReferencesFilter filter) {
    
    302 337
             referentialsFilters.put(propertyName, filter);
    
    303 338
         }
    
    ... ... @@ -802,9 +837,9 @@ public abstract class ContentUIHandler<E extends IdDto, U extends ContentUI<E, U
    802 837
     
    
    803 838
         protected void addInfoMessage(String message) {
    
    804 839
             addMessage(ui,
    
    805
    -                NuitonValidatorScope.INFO,
    
    806
    -                getTypeI18nKey(getModel().getBeanType()),
    
    807
    -                t(message)
    
    840
    +                   NuitonValidatorScope.INFO,
    
    841
    +                   getTypeI18nKey(getModel().getBeanType()),
    
    842
    +                   t(message)
    
    808 843
             );
    
    809 844
         }
    
    810 845
     
    
    ... ... @@ -1159,92 +1194,11 @@ public abstract class ContentUIHandler<E extends IdDto, U extends ContentUI<E, U
    1159 1194
     
    
    1160 1195
         }
    
    1161 1196
     
    
    1162
    -    protected E getSelectedBean() {
    
    1197
    +    public E getSelectedBean() {
    
    1163 1198
             return getModel().getBean();
    
    1164 1199
         }
    
    1165 1200
     
    
    1166
    -    /**
    
    1167
    -     * Pour afficher une popup avec l'ensemble des informations techniques.
    
    1168
    -     *
    
    1169
    -     * @param button le boutton qui a declanche l'action
    
    1170
    -     */
    
    1171
    -    void showTechnicalInformations(JButton button) {
    
    1172
    -
    
    1173
    -        E bean = getModel().isEditing() ? getBean() : getSelectedBean();
    
    1174
    -
    
    1175
    -        if (bean.getLastUpdateDate() == null) {
    
    1176
    -            return;
    
    1177
    -        }
    
    1178
    -
    
    1179
    -        JPanel content = new JPanel(new SpringLayout());
    
    1180
    -
    
    1181
    -        FocusListener l = new FocusListener() {
    
    1182
    -            @Override
    
    1183
    -            public void focusGained(FocusEvent e) {
    
    1184
    -                JTextField source = (JTextField) e.getSource();
    
    1185
    -                source.setSelectionStart(0);
    
    1186
    -                source.setSelectionEnd(source.getText().length());
    
    1187
    -            }
    
    1188
    -
    
    1189
    -            @Override
    
    1190
    -            public void focusLost(FocusEvent e) {
    
    1191
    -
    
    1192
    -            }
    
    1193
    -        };
    
    1194
    -
    
    1195
    -        {
    
    1196
    -            content.add(new JLabel(t("observe.common.Dto.topiaId")));
    
    1197
    -            JTextField comp = new JTextField(bean.getId());
    
    1198
    -            comp.setEditable(false);
    
    1199
    -            comp.addFocusListener(l);
    
    1200
    -            content.add(comp);
    
    1201
    -        }
    
    1202
    -
    
    1203
    -        boolean isReferential = ReferentialDto.class.isAssignableFrom(getBeanType());
    
    1204
    -        if (isReferential) {
    
    1205
    -            content.add(new JLabel(t("observe.common.Dto.topiaCreateDate")));
    
    1206
    -            JTextField comp = new JTextField(dateFormat.format(bean.getCreateDate()));
    
    1207
    -            comp.setEditable(false);
    
    1208
    -            comp.addFocusListener(l);
    
    1209
    -            content.add(comp);
    
    1210
    -        }
    
    1211
    -
    
    1212
    -        {
    
    1213
    -            content.add(new JLabel(t("observe.common.Dto.lastUpdateDate")));
    
    1214
    -            JTextField comp = new JTextField(dateFormat.format(bean.getLastUpdateDate()));
    
    1215
    -            comp.setEditable(false);
    
    1216
    -            comp.addFocusListener(l);
    
    1217
    -            content.add(comp);
    
    1218
    -        }
    
    1219
    -
    
    1220
    -        if (isReferential) {
    
    1221
    -            content.add(new JLabel(t("observe.common.Dto.topiaVersion")));
    
    1222
    -            JTextField comp = new JTextField(String.valueOf(bean.getVersion()));
    
    1223
    -            comp.setEditable(false);
    
    1224
    -            comp.addFocusListener(l);
    
    1225
    -            content.add(comp);
    
    1226
    -        }
    
    1227
    -
    
    1228
    -        SpringUtilities.makeCompactGrid(content, isReferential ? 4 : 2, 2, 5, 5, 5, 5);
    
    1229
    -
    
    1230
    -        Decorator<E> decorator = getDecoratorService().getDecoratorByType(getBeanType());
    
    1231
    -        Objects.requireNonNull(decorator, "Cant find decorator of type " + getBeanType());
    
    1232
    -        String title = t("observe.common.Dto.technicalInformations", "\n" + decorator.toString(bean));
    
    1233
    -
    
    1234
    -        content.setBorder(new TitledBorder(title));
    
    1235
    -
    
    1236
    -        JPopupMenu popup = new JPopupMenu();
    
    1237
    -        popup.setBorderPainted(true);
    
    1238
    -        popup.add(content);
    
    1239
    -        popup.pack();
    
    1240
    -        Dimension dim = popup.getPreferredSize();
    
    1241
    -        int x = (int) (button.getPreferredSize().getWidth() - dim.getWidth());
    
    1242
    -        int y = button.getHeight();
    
    1243
    -        popup.show(button, x, y);
    
    1244
    -    }
    
    1245
    -
    
    1246 1201
         void openedUI() {
    
    1247
    -
    
    1248 1202
             SwingUtilities.invokeLater(this::forceGrabFocusOnForm);
    
    1249 1203
         }
    
    1250 1204
     
    

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

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

  • client/src/main/java/fr/ird/observe/client/ui/content/data/longline/TripLonglineUI.jaxx
    ... ... @@ -38,6 +38,7 @@
    38 38
         fr.ird.observe.dto.referential.DataQualityReference
    
    39 39
         fr.ird.observe.dto.referential.longline.TripTypeReference
    
    40 40
         fr.ird.observe.client.ui.actions.content.DeleteDataUIAction
    
    41
    +    fr.ird.observe.client.ui.actions.content.MoveTripLonglineUIAction
    
    41 42
         fr.ird.observe.client.ui.actions.main.global.DeleteDataGlobalUIAction
    
    42 43
         fr.ird.observe.client.ui.actions.main.global.NewNextDataGlobalUIAction
    
    43 44
         fr.ird.observe.client.ui.util.JComment
    
    ... ... @@ -238,4 +239,7 @@ protected boolean canEditOcean(java.util.LinkedHashSet<TripLonglineActivityDto>
    238 239
       <JButton id='closeAndCreate'/>
    
    239 240
       <JButton id='actionDown'/>
    
    240 241
     
    
    242
    +  <JPanel id="forceNavigation">
    
    243
    +    <JButton id='move' styleClass="forceNavigation"/>
    
    244
    +  </JPanel>
    
    241 245
     </fr.ird.observe.client.ui.content.open.ContentOpenableUI>

  • client/src/main/java/fr/ird/observe/client/ui/content/data/longline/TripLonglineUI.jcss
    ... ... @@ -118,3 +118,7 @@
    118 118
       _toolTipText:{t("observe.common.TripDto.action.delete.tip")};
    
    119 119
       _globalAction:{DeleteDataGlobalUIAction.ACTION_NAME};
    
    120 120
     }
    
    121
    +
    
    122
    +#move {
    
    123
    +  _observeAction:{MoveTripLonglineUIAction.ACTION_NAME};
    
    124
    +}

  • 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
    ... ... @@ -64,3 +64,6 @@ NumberEditor {
    64 64
     #delete {
    
    65 65
       _toolTipText:{t("observe.common.RouteDto.action.delete.tip")};
    
    66 66
     }
    
    67
    +#move {
    
    68
    +  _observeAction:{MoveRouteUIAction.ACTION_NAME};
    
    69
    +}
    \ 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
    ... ... @@ -151,3 +151,6 @@ NumberEditor {
    151 151
     #delete {
    
    152 152
       _toolTipText:{t("observe.common.TripDto.action.delete.tip")};
    
    153 153
     }
    
    154
    +#move {
    
    155
    +  _observeAction:{MoveTripSeineUIAction.ACTION_NAME};
    
    156
    +}
    \ No newline at end of file

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

  • 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