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

Commits:

7 changed files:

Changes:

  • client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/actions/ToggleInsert.java
    ... ... @@ -26,11 +26,13 @@ import fr.ird.observe.client.datasource.editor.api.ObserveKeyStrokesEditorApi;
    26 26
     import fr.ird.observe.client.datasource.editor.api.content.ContentUI;
    
    27 27
     import org.nuiton.jaxx.runtime.swing.action.MenuAction;
    
    28 28
     
    
    29
    +import javax.swing.AbstractButton;
    
    29 30
     import javax.swing.JComponent;
    
    30 31
     import javax.swing.JPopupMenu;
    
    31 32
     import javax.swing.SwingUtilities;
    
    32 33
     import javax.swing.event.PopupMenuEvent;
    
    33 34
     import javax.swing.event.PopupMenuListener;
    
    35
    +import java.awt.Component;
    
    34 36
     import java.awt.event.ActionEvent;
    
    35 37
     
    
    36 38
     import static io.ultreia.java4all.i18n.I18n.n;
    
    ... ... @@ -72,9 +74,18 @@ public class ToggleInsert<U extends ContentUI> extends ContentUIActionSupport<U>
    72 74
         protected void doActionPerformed(ActionEvent e, U ui) {
    
    73 75
             ui.getToggleInsert().setSelected(true);
    
    74 76
             SwingUtilities.invokeLater(() -> {
    
    75
    -            JComponent c = ui.getToggleInsert();
    
    76 77
                 JPopupMenu p = ui.getInsertPopup();
    
    77
    -            MenuAction.preparePopup(p, c, false);
    
    78
    +            int componentCount = p.getComponentCount();
    
    79
    +            if (componentCount == 1) {
    
    80
    +                Component component = p.getComponent(0);
    
    81
    +                if (component.isEnabled() && component instanceof AbstractButton) {
    
    82
    +                    ((AbstractButton) component).doClick();
    
    83
    +                    ui.getToggleInsert().setSelected(false);
    
    84
    +                }
    
    85
    +            } else {
    
    86
    +                JComponent c = ui.getToggleInsert();
    
    87
    +                MenuAction.preparePopup(p, c, false);
    
    88
    +            }
    
    78 89
             });
    
    79 90
         }
    
    80 91
     
    

  • core/api/validation/src/main/filtered-resources/META-INF/validators/validation.json
    ... ... @@ -11981,7 +11981,8 @@
    11981 11981
           {
    
    11982 11982
             "name": "speciesFate",
    
    11983 11983
             "comments": [
    
    11984
    -          "check if referential speciesFate is disabled (only if validation is strong)"
    
    11984
    +          "check if referential speciesFate is disabled (only if validation is strong)",
    
    11985
    +          "speciesFate is mandatory"
    
    11985 11986
             ]
    
    11986 11987
           },
    
    11987 11988
           {
    
    ... ... @@ -12129,7 +12130,8 @@
    12129 12130
           {
    
    12130 12131
             "name": "speciesFate",
    
    12131 12132
             "comments": [
    
    12132
    -          "check if referential speciesFate is disabled (only if validation is strong)"
    
    12133
    +          "check if referential speciesFate is disabled (only if validation is strong)",
    
    12134
    +          "speciesFate is mandatory"
    
    12133 12135
             ]
    
    12134 12136
           },
    
    12135 12137
           {
    

  • core/api/validation/src/main/resources/fr/ird/observe/dto/data/ps/observation/CatchDto-create-error-validation.xml
    ... ... @@ -118,6 +118,11 @@
    118 118
       </field>
    
    119 119
     
    
    120 120
       <field name="speciesFate">
    
    121
    +    <!-- speciesFate is mandatory -->
    
    122
    +    <field-validator type="mandatory" short-circuit="true">
    
    123
    +      <message/>
    
    124
    +    </field-validator>
    
    125
    +
    
    121 126
         <!-- check if referential speciesFate is disabled (only if validation is strong) -->
    
    122 127
         <field-validator type="checkDisabledReferentialOnErrorScope">
    
    123 128
           <message/>
    

  • core/api/validation/src/main/resources/fr/ird/observe/dto/data/ps/observation/CatchDto-update-error-validation.xml
    ... ... @@ -123,6 +123,11 @@
    123 123
       </field>
    
    124 124
     
    
    125 125
       <field name="speciesFate">
    
    126
    +    <!-- speciesFate is mandatory -->
    
    127
    +    <field-validator type="mandatory" short-circuit="true">
    
    128
    +      <message/>
    
    129
    +    </field-validator>
    
    130
    +
    
    126 131
         <!-- check if referential speciesFate is disabled (only if validation is strong) -->
    
    127 132
         <field-validator type="checkDisabledReferentialOnErrorScope">
    
    128 133
           <message/>
    

  • core/persistence/resources/src/main/resources/fr/ird/observe/entities/data/ps/observation/Catch/validation-create.json
    ... ... @@ -68,7 +68,8 @@
    68 68
       },
    
    69 69
       "speciesFate": {
    
    70 70
         "errors": [
    
    71
    -      "check if referential speciesFate is disabled (only if validation is strong)"
    
    71
    +      "check if referential speciesFate is disabled (only if validation is strong)",
    
    72
    +      "speciesFate is mandatory"
    
    72 73
         ],
    
    73 74
         "warnings": [
    
    74 75
           "check if referential speciesFate is disabled (only if validation is not strong)"
    

  • core/persistence/resources/src/main/resources/fr/ird/observe/entities/data/ps/observation/Catch/validation-update.json
    ... ... @@ -68,7 +68,8 @@
    68 68
       },
    
    69 69
       "speciesFate": {
    
    70 70
         "errors": [
    
    71
    -      "check if referential speciesFate is disabled (only if validation is strong)"
    
    71
    +      "check if referential speciesFate is disabled (only if validation is strong)",
    
    72
    +      "speciesFate is mandatory"
    
    72 73
         ],
    
    73 74
         "warnings": [
    
    74 75
           "check if referential speciesFate is disabled (only if validation is not strong)"
    

  • model/src/main/models/Observe/dto/attribute/notNull.properties
    ... ... @@ -167,6 +167,7 @@ data.ps.observation.Activity.attribute.time=true
    167 167
     data.ps.observation.Activity.attribute.vesselActivity=true
    
    168 168
     data.ps.observation.Catch.attribute.informationSource=true
    
    169 169
     data.ps.observation.Catch.attribute.species=true
    
    170
    +data.ps.observation.Catch.attribute.speciesFate=true
    
    170 171
     data.ps.observation.FloatingObjectPart.attribute.objectMaterial=true
    
    171 172
     data.ps.observation.NonTargetCatchRelease.attribute.count=true
    
    172 173
     data.ps.observation.NonTargetCatchRelease.attribute.sex=true