This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository tutti. See http://git.codelutin.com/tutti.git commit 171233807a4fa12098eca464e5db9d29c232ab20 Author: Kevin Morin <morin@codelutin.com> Date: Wed Sep 10 14:01:19 2014 +0200 refs #5139 [CAPTURE] répéter le champ "poids sous échantillon" dans la fenêtre de saisie des mensurations --- .../frequency/BenthosFrequencyCellComponent.java | 1 + .../benthos/frequency/BenthosFrequencyUI.css | 13 ++++++-- .../benthos/frequency/BenthosFrequencyUI.jaxx | 4 ++- .../frequency/BenthosFrequencyUIHandler.java | 3 +- .../benthos/frequency/BenthosFrequencyUIModel.java | 37 ++++++++++++++++++---- .../frequency/SpeciesFrequencyCellComponent.java | 1 + .../species/frequency/SpeciesFrequencyUI.css | 13 ++++++-- .../species/frequency/SpeciesFrequencyUI.jaxx | 4 ++- .../frequency/SpeciesFrequencyUIHandler.java | 26 ++------------- .../species/frequency/SpeciesFrequencyUIModel.java | 37 ++++++++++++++++++---- 10 files changed, 95 insertions(+), 44 deletions(-) diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyCellComponent.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyCellComponent.java index 6db5e8f..ec8b0b6 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyCellComponent.java +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyCellComponent.java @@ -249,6 +249,7 @@ public class BenthosFrequencyCellComponent extends DefaultTableCellRenderer { // set frequencies to the incoming batch editRow.setFrequency(frequency); + editRow.setWeight(frequencyModel.getTotalWeight()); // update frequencies total ui.getHandler().updateTotalFromFrequencies(editRow); diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUI.css b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUI.css index 18f2634..a4c8f17 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUI.css +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUI.css @@ -30,6 +30,14 @@ NumberEditor { showPopupButton: {handler.getConfig().isShowNumberEditorButton()}; } +ComputableDataEditor { + autoPopup: {handler.getConfig().isAutoPopupNumberEditor()}; + showPopupButton: {handler.getConfig().isShowNumberEditorButton()}; + showReset: true; + useFloat: true; + computedDataColor: {handler.getConfig().getColorComputedWeights()}; +} + #editBenthosFrequenciesTopPanel { _help: {"tutti.editBenthosFrequencies.help"}; } @@ -79,9 +87,8 @@ NumberEditor { } #totalWeightField { - text: {handler.getWeightStringValue(totalWeightLabel, model.getTotalWeight())}; - enabled: false; - _computed: true; + bean: {model.getTotalComputedOrNotWeight()}; + model: {model.getTotalWeight()}; _help: {"tutti.editBenthosFrequencies.field.totalWeight.help"}; } diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUI.jaxx b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUI.jaxx index 4ada8b4..e943ecb 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUI.jaxx +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUI.jaxx @@ -30,6 +30,7 @@ fr.ifremer.tutti.ui.swing.content.operation.catches.FrequencyConfigurationMode fr.ifremer.tutti.ui.swing.util.TuttiUI fr.ifremer.tutti.ui.swing.util.TuttiUIUtil + fr.ifremer.tutti.ui.swing.util.computable.ComputableDataEditor jaxx.runtime.swing.CardLayout2Ext jaxx.runtime.swing.editor.bean.BeanFilterableComboBox @@ -183,7 +184,8 @@ public BenthosFrequencyUI(TuttiUI parentUI) { <JLabel id='totalWeightLabel'/> </cell> <cell weightx='1.0'> - <JTextField id='totalWeightField'/> + <ComputableDataEditor id='totalWeightField' + genericType="Float" constructorParams='this'/> </cell> </row> </Table> diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUIHandler.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUIHandler.java index 8a9e897..74e93e7 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUIHandler.java +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUIHandler.java @@ -524,7 +524,8 @@ public class BenthosFrequencyUIHandler extends AbstractTuttiTableUIHandler<Benth model.clearWithWeightRows(); model.setNextEditableRowIndex(editor.getNextEditableRowIndex()); model.setTotalNumber(null); - model.setTotalWeight(null); + model.setTotalComputedWeight(null); + model.setTotalWeight(speciesBatch.getWeight()); model.setSimpleCount(null); model.setMinStep(null); model.setMaxStep(null); diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUIModel.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUIModel.java index c107819..023b421 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUIModel.java +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUIModel.java @@ -28,6 +28,7 @@ import fr.ifremer.tutti.persistence.entities.data.SampleCategoryModel; import fr.ifremer.tutti.persistence.entities.referential.Caracteristic; import fr.ifremer.tutti.ui.swing.content.operation.catches.FrequencyConfigurationMode; import fr.ifremer.tutti.ui.swing.content.operation.catches.benthos.BenthosBatchRowModel; +import fr.ifremer.tutti.ui.swing.util.computable.ComputableData; import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIModel; import org.apache.commons.collections4.CollectionUtils; @@ -65,8 +66,12 @@ public class BenthosFrequencyUIModel extends AbstractTuttiTableUIModel<BenthosBa public static final String PROPERTY_TOTAL_NUMBER = "totalNumber"; + public static final String PROPERTY_TOTAL_COMPUTED_OR_NOT_WEIGHT = "totalComputedOrNotWeight"; + public static final String PROPERTY_TOTAL_WEIGHT = "totalWeight"; + public static final String PROPERTY_TOTAL_COMPUTED_WEIGHT = "totalComputedWeight"; + public static final String PROPERTY_EMPTY_ROWS = "emptyRows"; public static final String PROPERTY_NEXT_EDITABLE_ROW_INDEX = "nextEditableRowIndex"; @@ -128,11 +133,11 @@ public class BenthosFrequencyUIModel extends AbstractTuttiTableUIModel<BenthosBa protected Integer totalNumber; /** - * Sum of the weight of each valid row + * Sum of the weight of each valid row, or sample weight * - * @since 2.3 + * @since 3.8 */ - protected Float totalWeight; + protected ComputableData<Float> totalComputedOrNotWeight = new ComputableData<Float>(); /** * The index of the next editable row (null if none). @@ -302,16 +307,36 @@ public class BenthosFrequencyUIModel extends AbstractTuttiTableUIModel<BenthosBa firePropertyChange(PROPERTY_TOTAL_NUMBER, oldValue, totalNumber); } + public ComputableData<Float> getTotalComputedOrNotWeight() { + return totalComputedOrNotWeight; + } + + public void setTotalComputedOrNotWeight(ComputableData<Float> totalComputedOrNotWeight) { + Object oldValue = getTotalComputedOrNotWeight(); + this.totalComputedOrNotWeight = totalComputedOrNotWeight; + firePropertyChange(PROPERTY_TOTAL_COMPUTED_OR_NOT_WEIGHT, oldValue, totalComputedOrNotWeight); + } + public Float getTotalWeight() { - return totalWeight; + return totalComputedOrNotWeight.getData(); } public void setTotalWeight(Float totalWeight) { Object oldValue = getTotalWeight(); - this.totalWeight = totalWeight; + this.totalComputedOrNotWeight.setData(totalWeight); firePropertyChange(PROPERTY_TOTAL_WEIGHT, oldValue, totalWeight); } + public Float getTotalComputedWeight() { + return totalComputedOrNotWeight.getComputedData(); + } + + public void setTotalComputedWeight(Float totalComputedWeight) { + Object oldValue = getTotalComputedWeight(); + this.totalComputedOrNotWeight.setComputedData(totalComputedWeight); + firePropertyChange(PROPERTY_TOTAL_COMPUTED_WEIGHT, oldValue, totalComputedWeight); + } + public Set<BenthosFrequencyRowModel> getEmptyRows() { return emptyRows; } @@ -404,6 +429,6 @@ public class BenthosFrequencyUIModel extends AbstractTuttiTableUIModel<BenthosBa int totalNumber = computeTotalNumber(); Float totalWeight = computeTotalWeight(); setTotalNumber(totalNumber); - setTotalWeight(totalWeight); + setTotalComputedWeight(totalWeight); } } diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyCellComponent.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyCellComponent.java index eded534..8077762 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyCellComponent.java +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyCellComponent.java @@ -249,6 +249,7 @@ public class SpeciesFrequencyCellComponent extends DefaultTableCellRenderer { // set frequencies to the incoming batch editRow.setFrequency(frequency); + editRow.setWeight(frequencyModel.getTotalWeight()); // update frequencies total ui.getHandler().updateTotalFromFrequencies(editRow); diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUI.css b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUI.css index 6278f48..ae14a4c 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUI.css +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUI.css @@ -30,6 +30,14 @@ NumberEditor { showPopupButton: {handler.getConfig().isShowNumberEditorButton()}; } +ComputableDataEditor { + autoPopup: {handler.getConfig().isAutoPopupNumberEditor()}; + showPopupButton: {handler.getConfig().isShowNumberEditorButton()}; + showReset: true; + useFloat: true; + computedDataColor: {handler.getConfig().getColorComputedWeights()}; +} + #editSpeciesFrequenciesTopPanel { _help: {"tutti.editSpeciesFrequencies.help"}; } @@ -79,9 +87,8 @@ NumberEditor { } #totalWeightField { - text: {handler.getWeightStringValue(totalWeightLabel, model.getTotalWeight())}; - enabled: false; - _computed: true; + bean: {model.getTotalComputedOrNotWeight()}; + model: {model.getTotalWeight()}; _help: {"tutti.editSpeciesFrequencies.field.totalWeight.help"}; } diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUI.jaxx b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUI.jaxx index 3277e11..4c3f57d 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUI.jaxx +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUI.jaxx @@ -30,6 +30,7 @@ fr.ifremer.tutti.ui.swing.content.operation.catches.FrequencyConfigurationMode fr.ifremer.tutti.ui.swing.util.TuttiUI fr.ifremer.tutti.ui.swing.util.TuttiUIUtil + fr.ifremer.tutti.ui.swing.util.computable.ComputableDataEditor jaxx.runtime.swing.CardLayout2Ext jaxx.runtime.swing.editor.bean.BeanFilterableComboBox @@ -183,7 +184,8 @@ public SpeciesFrequencyUI(TuttiUI parentUI) { <JLabel id='totalWeightLabel'/> </cell> <cell weightx='1.0'> - <JTextField id='totalWeightField'/> + <ComputableDataEditor id='totalWeightField' + genericType="Float" constructorParams='this'/> </cell> </row> </Table> diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUIHandler.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUIHandler.java index 3dc2eee..9b8c044 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUIHandler.java +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUIHandler.java @@ -196,7 +196,7 @@ public class SpeciesFrequencyUIHandler extends AbstractTuttiTableUIHandler<Speci } } - recomputeTotalNumberAndWeight(); + model.recomputeTotalNumberAndWeight(); if (!recomputeAllRows) { if (log.isInfoEnabled()) { @@ -581,7 +581,8 @@ public class SpeciesFrequencyUIHandler extends AbstractTuttiTableUIHandler<Speci model.clearWithWeightRows(); model.setNextEditableRowIndex(editor.getNextEditableRowIndex()); model.setTotalNumber(null); - model.setTotalWeight(null); + model.setTotalComputedWeight(null); + model.setTotalWeight(speciesBatch.getWeight()); model.setSimpleCount(null); model.setMinStep(null); model.setMaxStep(null); @@ -809,27 +810,6 @@ public class SpeciesFrequencyUIHandler extends AbstractTuttiTableUIHandler<Speci getContext().getIchtyometerReader().addFeedModeReaderListener(feedReaderListener); } - protected void recomputeTotalNumberAndWeight() { - SpeciesFrequencyUIModel model = getModel(); - List<SpeciesFrequencyRowModel> rows = model.getRows(); - Integer totalNumber = 0; - Float totalWeight = 0f; - for (SpeciesFrequencyRowModel r : rows) { - if (r.isValid()) { - Integer number = r.getNumber(); - if (number != null) { - totalNumber += number; - } - Float weight = r.getWeight(); - if (weight != null) { - totalWeight += weight; - } - } - } - model.setTotalNumber(totalNumber); - model.setTotalWeight(totalWeight); - } - protected JComponent getComponentToFocus(FrequencyConfigurationMode mode) { JComponent componentToFocus = null; if (mode != null) { diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUIModel.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUIModel.java index 4b6ceb9..91d0b09 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUIModel.java +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUIModel.java @@ -28,6 +28,7 @@ import fr.ifremer.tutti.persistence.entities.data.SampleCategoryModel; import fr.ifremer.tutti.persistence.entities.referential.Caracteristic; import fr.ifremer.tutti.ui.swing.content.operation.catches.FrequencyConfigurationMode; import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SpeciesBatchRowModel; +import fr.ifremer.tutti.ui.swing.util.computable.ComputableData; import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIModel; import org.apache.commons.collections4.CollectionUtils; @@ -65,8 +66,12 @@ public class SpeciesFrequencyUIModel extends AbstractTuttiTableUIModel<SpeciesBa public static final String PROPERTY_TOTAL_NUMBER = "totalNumber"; + public static final String PROPERTY_TOTAL_COMPUTED_OR_NOT_WEIGHT = "totalComputedOrNotWeight"; + public static final String PROPERTY_TOTAL_WEIGHT = "totalWeight"; + public static final String PROPERTY_TOTAL_COMPUTED_WEIGHT = "totalComputedWeight"; + public static final String PROPERTY_EMPTY_ROWS = "emptyRows"; public static final String PROPERTY_NEXT_EDITABLE_ROW_INDEX = "nextEditableRowIndex"; @@ -121,11 +126,11 @@ public class SpeciesFrequencyUIModel extends AbstractTuttiTableUIModel<SpeciesBa protected Integer totalNumber; /** - * Sum of the weight of each valid row + * Sum of the weight of each valid row, or sample weight * - * @since 2.3 + * @since 3.8 */ - protected Float totalWeight; + protected ComputableData<Float> totalComputedOrNotWeight = new ComputableData<Float>(); /** * Number in case of simple counting mode @@ -310,16 +315,36 @@ public class SpeciesFrequencyUIModel extends AbstractTuttiTableUIModel<SpeciesBa firePropertyChange(PROPERTY_TOTAL_NUMBER, oldValue, totalNumber); } + public ComputableData<Float> getTotalComputedOrNotWeight() { + return totalComputedOrNotWeight; + } + + public void setTotalComputedOrNotWeight(ComputableData<Float> totalComputedOrNotWeight) { + Object oldValue = getTotalComputedOrNotWeight(); + this.totalComputedOrNotWeight = totalComputedOrNotWeight; + firePropertyChange(PROPERTY_TOTAL_COMPUTED_OR_NOT_WEIGHT, oldValue, totalComputedOrNotWeight); + } + public Float getTotalWeight() { - return totalWeight; + return totalComputedOrNotWeight.getData(); } public void setTotalWeight(Float totalWeight) { Object oldValue = getTotalWeight(); - this.totalWeight = totalWeight; + this.totalComputedOrNotWeight.setData(totalWeight); firePropertyChange(PROPERTY_TOTAL_WEIGHT, oldValue, totalWeight); } + public Float getTotalComputedWeight() { + return totalComputedOrNotWeight.getComputedData(); + } + + public void setTotalComputedWeight(Float totalComputedWeight) { + Object oldValue = getTotalComputedWeight(); + this.totalComputedOrNotWeight.setComputedData(totalComputedWeight); + firePropertyChange(PROPERTY_TOTAL_COMPUTED_WEIGHT, oldValue, totalComputedWeight); + } + public Set<SpeciesFrequencyRowModel> getEmptyRows() { return emptyRows; } @@ -412,6 +437,6 @@ public class SpeciesFrequencyUIModel extends AbstractTuttiTableUIModel<SpeciesBa int totalNumber = computeTotalNumber(); Float totalWeight = computeTotalWeight(); setTotalNumber(totalNumber); - setTotalWeight(totalWeight); + setTotalComputedWeight(totalWeight); } } -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.