Tony CHEMIT pushed to branch develop-9.0.x at ultreiaio / ird-observe Commits: 71530937 by Tony Chemit at 2022-10-24T13:58:42+02:00 On a pu en créer une capture sans devenir - Closes #2491 - - - - - 12fd40a9 by Tony Chemit at 2022-10-24T14:00:08+02:00 Update Public API doc - - - - - 72c4c7da by Tony Chemit at 2022-10-24T14:26:57+02:00 Lorsque l'on veut créer une nouvelle donnée, on fait **F3**, on peut alors s'affranchir de choisir quoi créer si une seule possibilité existe (cela evite un clic) - Closes #2493 - - - - - 15 changed files: - client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/actions/ToggleInsert.java - core/api/validation/src/main/filtered-resources/META-INF/validators/validation.json - core/api/validation/src/main/resources/fr/ird/observe/dto/data/ps/observation/CatchDto-create-error-validation.xml - core/api/validation/src/main/resources/fr/ird/observe/dto/data/ps/observation/CatchDto-update-error-validation.xml - core/persistence/resources/src/main/resources/fr/ird/observe/entities/data/ps/observation/Catch/validation-create.json - core/persistence/resources/src/main/resources/fr/ird/observe/entities/data/ps/observation/Catch/validation-update.json - model/src/main/models/Observe/dto/attribute/notNull.properties - server/runner/src/main/webResources/doc/api/public/data/ps/logbook/Activity/validation-create-error.xml - server/runner/src/main/webResources/doc/api/public/data/ps/logbook/Activity/validation-create.json - server/runner/src/main/webResources/doc/api/public/data/ps/logbook/Activity/validation-update-error.xml - server/runner/src/main/webResources/doc/api/public/data/ps/logbook/Activity/validation-update.json - server/runner/src/main/webResources/doc/api/public/data/ps/observation/Catch/validation-create-error.xml - server/runner/src/main/webResources/doc/api/public/data/ps/observation/Catch/validation-create.json - server/runner/src/main/webResources/doc/api/public/data/ps/observation/Catch/validation-update-error.xml - server/runner/src/main/webResources/doc/api/public/data/ps/observation/Catch/validation-update.json 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; import fr.ird.observe.client.datasource.editor.api.content.ContentUI; import org.nuiton.jaxx.runtime.swing.action.MenuAction; +import javax.swing.AbstractButton; import javax.swing.JComponent; import javax.swing.JPopupMenu; import javax.swing.SwingUtilities; import javax.swing.event.PopupMenuEvent; import javax.swing.event.PopupMenuListener; +import java.awt.Component; import java.awt.event.ActionEvent; import static io.ultreia.java4all.i18n.I18n.n; @@ -72,9 +74,18 @@ public class ToggleInsert<U extends ContentUI> extends ContentUIActionSupport<U> protected void doActionPerformed(ActionEvent e, U ui) { ui.getToggleInsert().setSelected(true); SwingUtilities.invokeLater(() -> { - JComponent c = ui.getToggleInsert(); JPopupMenu p = ui.getInsertPopup(); - MenuAction.preparePopup(p, c, false); + int componentCount = p.getComponentCount(); + if (componentCount == 1) { + Component component = p.getComponent(0); + if (component.isEnabled() && component instanceof AbstractButton) { + ((AbstractButton) component).doClick(); + ui.getToggleInsert().setSelected(false); + } + } else { + JComponent c = ui.getToggleInsert(); + MenuAction.preparePopup(p, c, false); + } }); } ===================================== core/api/validation/src/main/filtered-resources/META-INF/validators/validation.json ===================================== @@ -11897,7 +11897,8 @@ { "name": "speciesFate", "comments": [ - "check if referential speciesFate is disabled (only if validation is strong)" + "check if referential speciesFate is disabled (only if validation is strong)", + "speciesFate is mandatory" ] }, { @@ -12045,7 +12046,8 @@ { "name": "speciesFate", "comments": [ - "check if referential speciesFate is disabled (only if validation is strong)" + "check if referential speciesFate is disabled (only if validation is strong)", + "speciesFate is mandatory" ] }, { ===================================== core/api/validation/src/main/resources/fr/ird/observe/dto/data/ps/observation/CatchDto-create-error-validation.xml ===================================== @@ -118,6 +118,11 @@ </field> <field name="speciesFate"> + <!-- speciesFate is mandatory --> + <field-validator type="mandatory" short-circuit="true"> + <message/> + </field-validator> + <!-- check if referential speciesFate is disabled (only if validation is strong) --> <field-validator type="checkDisabledReferentialOnErrorScope"> <message/> ===================================== core/api/validation/src/main/resources/fr/ird/observe/dto/data/ps/observation/CatchDto-update-error-validation.xml ===================================== @@ -123,6 +123,11 @@ </field> <field name="speciesFate"> + <!-- speciesFate is mandatory --> + <field-validator type="mandatory" short-circuit="true"> + <message/> + </field-validator> + <!-- check if referential speciesFate is disabled (only if validation is strong) --> <field-validator type="checkDisabledReferentialOnErrorScope"> <message/> ===================================== core/persistence/resources/src/main/resources/fr/ird/observe/entities/data/ps/observation/Catch/validation-create.json ===================================== @@ -68,7 +68,8 @@ }, "speciesFate": { "errors": [ - "check if referential speciesFate is disabled (only if validation is strong)" + "check if referential speciesFate is disabled (only if validation is strong)", + "speciesFate is mandatory" ], "warnings": [ "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 @@ }, "speciesFate": { "errors": [ - "check if referential speciesFate is disabled (only if validation is strong)" + "check if referential speciesFate is disabled (only if validation is strong)", + "speciesFate is mandatory" ], "warnings": [ "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 data.ps.observation.Activity.attribute.vesselActivity=true data.ps.observation.Catch.attribute.informationSource=true data.ps.observation.Catch.attribute.species=true +data.ps.observation.Catch.attribute.speciesFate=true data.ps.observation.FloatingObjectPart.attribute.objectMaterial=true data.ps.observation.NonTargetCatchRelease.attribute.count=true data.ps.observation.NonTargetCatchRelease.attribute.sex=true ===================================== server/runner/src/main/webResources/doc/api/public/data/ps/logbook/Activity/validation-create-error.xml ===================================== @@ -231,6 +231,12 @@ </field> <field name="schoolType"> + <!-- schoolType is mandatory except if !setEnabled --> + <field-validator type="mandatory" short-circuit="true"> + <param name="skip"><![CDATA[ !setEnabled ]]></param> + <message>observe.data.ps.logbook.Activity.schoolType.validation.required</message> + </field-validator> + <!-- check if referential schoolType is disabled (only if validation is strong) --> <field-validator type="checkDisabledReferentialOnErrorScope"> <message/> ===================================== server/runner/src/main/webResources/doc/api/public/data/ps/logbook/Activity/validation-create.json ===================================== @@ -122,7 +122,8 @@ }, "schoolType": { "errors": [ - "check if referential schoolType is disabled (only if validation is strong)" + "check if referential schoolType is disabled (only if validation is strong)", + "schoolType is mandatory except if !setEnabled" ], "warnings": [ "check if referential schoolType is disabled (only if validation is not strong)" ===================================== server/runner/src/main/webResources/doc/api/public/data/ps/logbook/Activity/validation-update-error.xml ===================================== @@ -231,6 +231,12 @@ </field> <field name="schoolType"> + <!-- schoolType is mandatory except if !setEnabled --> + <field-validator type="mandatory" short-circuit="true"> + <param name="skip"><![CDATA[ !setEnabled ]]></param> + <message>observe.data.ps.logbook.Activity.schoolType.validation.required</message> + </field-validator> + <!-- check if referential schoolType is disabled (only if validation is strong) --> <field-validator type="checkDisabledReferentialOnErrorScope"> <message/> ===================================== server/runner/src/main/webResources/doc/api/public/data/ps/logbook/Activity/validation-update.json ===================================== @@ -122,7 +122,8 @@ }, "schoolType": { "errors": [ - "check if referential schoolType is disabled (only if validation is strong)" + "check if referential schoolType is disabled (only if validation is strong)", + "schoolType is mandatory except if !setEnabled" ], "warnings": [ "check if referential schoolType is disabled (only if validation is not strong)" ===================================== server/runner/src/main/webResources/doc/api/public/data/ps/observation/Catch/validation-create-error.xml ===================================== @@ -118,6 +118,11 @@ </field> <field name="speciesFate"> + <!-- speciesFate is mandatory --> + <field-validator type="mandatory" short-circuit="true"> + <message/> + </field-validator> + <!-- check if referential speciesFate is disabled (only if validation is strong) --> <field-validator type="checkDisabledReferentialOnErrorScope"> <message/> ===================================== server/runner/src/main/webResources/doc/api/public/data/ps/observation/Catch/validation-create.json ===================================== @@ -68,7 +68,8 @@ }, "speciesFate": { "errors": [ - "check if referential speciesFate is disabled (only if validation is strong)" + "check if referential speciesFate is disabled (only if validation is strong)", + "speciesFate is mandatory" ], "warnings": [ "check if referential speciesFate is disabled (only if validation is not strong)" ===================================== server/runner/src/main/webResources/doc/api/public/data/ps/observation/Catch/validation-update-error.xml ===================================== @@ -123,6 +123,11 @@ </field> <field name="speciesFate"> + <!-- speciesFate is mandatory --> + <field-validator type="mandatory" short-circuit="true"> + <message/> + </field-validator> + <!-- check if referential speciesFate is disabled (only if validation is strong) --> <field-validator type="checkDisabledReferentialOnErrorScope"> <message/> ===================================== server/runner/src/main/webResources/doc/api/public/data/ps/observation/Catch/validation-update.json ===================================== @@ -68,7 +68,8 @@ }, "speciesFate": { "errors": [ - "check if referential speciesFate is disabled (only if validation is strong)" + "check if referential speciesFate is disabled (only if validation is strong)", + "speciesFate is mandatory" ], "warnings": [ "check if referential speciesFate is disabled (only if validation is not strong)" View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/372fccbe4dae7df2f2636b0e0... -- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/372fccbe4dae7df2f2636b0e0... You're receiving this email because of your account on gitlab.com.