Tony CHEMIT pushed to branch develop-9.0.x at ultreiaio / ird-observe Commits: 36df89ec by Tony Chemit at 2023-02-14T11:12:55+01:00 Sur le formulaire Captures, le champs méthode de mesure de poids doit être accessible uniquement si le poids est renseigné et non calculé - Closes #2627 - - - - - 2 changed files: - client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/observation/SetCatchUI.jcss - client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/observation/SetCatchUITableModel.java Changes: ===================================== client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/observation/SetCatchUI.jcss ===================================== @@ -24,3 +24,6 @@ _focusComponent:{species}; } +#weightMeasureMethod { + enabled: {tableEditBean.getCatchWeight() != null && tableEditBean.getCatchWeightComputedSource() == null}; +} ===================================== client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/observation/SetCatchUITableModel.java ===================================== @@ -78,10 +78,7 @@ class SetCatchUITableModel extends GeneratedSetCatchUITableModel { CatchDto source = (CatchDto) evt.getSource(); source.setTotalCountComputedSource(null); }; - catchWeightChanged = evt -> { - CatchDto source = (CatchDto) evt.getSource(); - source.setCatchWeightComputedSource(null); - }; + catchWeightChanged = evt -> onWeightChanged((Float) evt.getNewValue(), !ui.getStates().isResetEdit()); meanWeightChanged = evt -> { CatchDto source = (CatchDto) evt.getSource(); source.setMeanWeightComputedSource(null); @@ -146,6 +143,7 @@ class SetCatchUITableModel extends GeneratedSetCatchUITableModel { @Override protected void onSelectedRowChanged(SetCatchUI ui, int editingRow, CatchDto tableEditBean, CatchDto previousRowBean, boolean notPersisted, boolean newRow) { + super.onSelectedRowChanged(ui, editingRow, tableEditBean, previousRowBean, notPersisted, newRow); tableEditBean.removePropertyChangeListener(CatchDto.PROPERTY_TOTAL_COUNT, totalCountChanged); @@ -176,4 +174,14 @@ class SetCatchUITableModel extends GeneratedSetCatchUITableModel { // No specific message return null; } + + protected void onWeightChanged(Float newValue, boolean realChange) { + CatchDto tableEditBean = getTableEditBean(); + if (realChange) { + tableEditBean.setCatchWeightComputedSource(null); + } + if (newValue == null) { + tableEditBean.setWeightMeasureMethod(null); + } + } } View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/commit/36df89ecfed54893d1c71acb29... -- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/commit/36df89ecfed54893d1c71acb29... You're receiving this email because of your account on gitlab.com.
participants (1)
-
Tony CHEMIT (@tchemit)