Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe Commits: ff1f74b8 by Tony Chemit at 2022-10-24T14:45:09+02:00 On a pu en créer une capture sans devenir - Closes #2491 - - - - - 0068d0bd by Tony Chemit at 2022-10-24T14:45:14+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 - - - - - 7 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 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 ===================================== @@ -11981,7 +11981,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" ] }, { @@ -12129,7 +12130,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 View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/05a95b7a9d96332f36afeb34b... -- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/05a95b7a9d96332f36afeb34b... You're receiving this email because of your account on gitlab.com.