Author: kmorin Date: 2013-05-21 19:06:00 +0200 (Tue, 21 May 2013) New Revision: 974 Url: http://forge.codelutin.com/projects/tutti/repository/revisions/974 Log: fixes #2472 [MENSURATIONS] ajouter somme des individus et des poids saisis Modified: trunk/tutti-ui-swing/src/main/filtered-resources/tutti-help-en.properties trunk/tutti-ui-swing/src/main/filtered-resources/tutti-help-fr.properties trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUI.css trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUI.jaxx trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUIHandler.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUIModel.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUI.css trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUI.jaxx trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUIHandler.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUIModel.java trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_en_GB.properties trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties Modified: trunk/tutti-ui-swing/src/main/filtered-resources/tutti-help-en.properties =================================================================== --- trunk/tutti-ui-swing/src/main/filtered-resources/tutti-help-en.properties 2013-05-21 15:44:35 UTC (rev 973) +++ trunk/tutti-ui-swing/src/main/filtered-resources/tutti-help-en.properties 2013-05-21 17:06:00 UTC (rev 974) @@ -1,5 +1,5 @@ #Generated by org.nuiton.jaxx.plugin.GenerateHelpIdsMojo -#Tue May 07 16:11:30 CEST 2013 +#Tue May 21 18:54:28 CEST 2013 tutti.config.help=config.html tutti.createAccidentalBatch.action.cancel.help=createAccidentalBatch.html\#actions tutti.createAccidentalBatch.action.save.help=createAccidentalBatch.html\#actions @@ -86,6 +86,8 @@ tutti.editBenthosFrequencies.field.rafaleStep.help=editBenthosFrequencies.html\#fields tutti.editBenthosFrequencies.field.simpleCounting.help=editBenthosFrequencies.html\#fields tutti.editBenthosFrequencies.field.step.help=editBenthosFrequencies.html\#fields +tutti.editBenthosFrequencies.field.totalNumber.help= +tutti.editBenthosFrequencies.field.totalWeight.help= tutti.editBenthosFrequencies.help=editBenthosFrequencies.html tutti.editCatchBatch.action.cancelEditCatchBatch.help=editCatchBatch.html\#actions tutti.editCatchBatch.action.computeWeights.help=editCatchBatch.html\#actions @@ -232,6 +234,8 @@ tutti.editSpeciesFrequencies.field.rafaleStep.help=editSpeciesFrequencies.html\#fields tutti.editSpeciesFrequencies.field.simpleCounting.help=editSpeciesFrequencies.html\#fields tutti.editSpeciesFrequencies.field.step.help=editSpeciesFrequencies.html\#fields +tutti.editSpeciesFrequencies.field.totalNumber.help= +tutti.editSpeciesFrequencies.field.totalWeight.help= tutti.editSpeciesFrequencies.help=editSpeciesFrequencies.html tutti.fishingOperations.action.deleteFishingOperation.help= tutti.fishingOperations.action.newFishingOperation.help=fishingOperations.html\#actions Modified: trunk/tutti-ui-swing/src/main/filtered-resources/tutti-help-fr.properties =================================================================== --- trunk/tutti-ui-swing/src/main/filtered-resources/tutti-help-fr.properties 2013-05-21 15:44:35 UTC (rev 973) +++ trunk/tutti-ui-swing/src/main/filtered-resources/tutti-help-fr.properties 2013-05-21 17:06:00 UTC (rev 974) @@ -1,5 +1,5 @@ #Generated by org.nuiton.jaxx.plugin.GenerateHelpIdsMojo -#Tue May 07 16:11:30 CEST 2013 +#Tue May 21 18:54:28 CEST 2013 tutti.config.help=config.html tutti.createAccidentalBatch.action.cancel.help=createAccidentalBatch.html\#actions tutti.createAccidentalBatch.action.save.help=createAccidentalBatch.html\#actions @@ -86,6 +86,8 @@ tutti.editBenthosFrequencies.field.rafaleStep.help=editBenthosFrequencies.html\#fields tutti.editBenthosFrequencies.field.simpleCounting.help=editBenthosFrequencies.html\#fields tutti.editBenthosFrequencies.field.step.help=editBenthosFrequencies.html\#fields +tutti.editBenthosFrequencies.field.totalNumber.help= +tutti.editBenthosFrequencies.field.totalWeight.help= tutti.editBenthosFrequencies.help=editBenthosFrequencies.html tutti.editCatchBatch.action.cancelEditCatchBatch.help=editCatchBatch.html\#actions tutti.editCatchBatch.action.computeWeights.help=editCatchBatch.html\#actions @@ -232,6 +234,8 @@ tutti.editSpeciesFrequencies.field.rafaleStep.help=editSpeciesFrequencies.html\#fields tutti.editSpeciesFrequencies.field.simpleCounting.help=editSpeciesFrequencies.html\#fields tutti.editSpeciesFrequencies.field.step.help=editSpeciesFrequencies.html\#fields +tutti.editSpeciesFrequencies.field.totalNumber.help= +tutti.editSpeciesFrequencies.field.totalWeight.help= tutti.editSpeciesFrequencies.help=editSpeciesFrequencies.html tutti.fishingOperations.action.deleteFishingOperation.help= tutti.fishingOperations.action.newFishingOperation.help=fishingOperations.html\#actions Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUI.css =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUI.css 2013-05-21 15:44:35 UTC (rev 973) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUI.css 2013-05-21 17:06:00 UTC (rev 974) @@ -72,8 +72,37 @@ numberPattern: {DECIMAL1_PATTERN}; bean: {model}; enabled: {!model.isSimpleCountingMode()}; + _selectOnFocus: true; } +#totalNumberLabel { + text: "tutti.editBenthosFrequencies.field.totalNumber"; + toolTipText: "tutti.editBenthosFrequencies.field.totalNumber.tip"; + labelFor: {totalNumberField}; + enabled: {!model.isSimpleCountingMode()}; + _help: {"tutti.editBenthosFrequencies.field.totalNumber.help"}; +} + +#totalNumberField { + text: {getStringValue(model.getTotalNumber())}; + enabled: false; + _computed: true; +} + +#totalWeightLabel { + text: "tutti.editBenthosFrequencies.field.totalWeight"; + toolTipText: "tutti.editBenthosFrequencies.field.totalWeight.tip"; + labelFor: {totalWeightField}; + enabled: {model.getTotalWeight() != null}; + _help: {"tutti.editBenthosFrequencies.field.totalWeight.help"}; +} + +#totalWeightField { + text: {getStringValue(model.getTotalWeight())}; + enabled: false; + _computed: true; +} + #lengthStepCaracteristicLabel { text: "tutti.editBenthosFrequencies.field.lengthStepCaracteristic"; toolTipText: "tutti.editBenthosFrequencies.field.lengthStepCaracteristic.tip"; Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUI.jaxx =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUI.jaxx 2013-05-21 15:44:35 UTC (rev 973) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUI.jaxx 2013-05-21 17:06:00 UTC (rev 974) @@ -196,7 +196,7 @@ <cell anchor='west'> <JLabel id='lengthStepCaracteristicLabel'/> </cell> - <cell weightx='1.0'> + <cell weightx='1.0' columns='5'> <BeanFilterableComboBox id='lengthStepCaracteristicComboBox' constructorParams='this' genericType='Caracteristic'/> @@ -210,6 +210,18 @@ <cell weightx='1.0'> <NumberEditor id='stepField' constructorParams='this'/> </cell> + <cell anchor='west'> + <JLabel id='totalNumberLabel'/> + </cell> + <cell weightx='1.0'> + <JTextField id='totalNumberField'/> + </cell> + <cell anchor='west'> + <JLabel id='totalWeightLabel'/> + </cell> + <cell weightx='1.0'> + <JTextField id='totalWeightField'/> + </cell> </row> </Table> </JPanel> Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUIHandler.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUIHandler.java 2013-05-21 15:44:35 UTC (rev 973) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUIHandler.java 2013-05-21 17:06:00 UTC (rev 974) @@ -133,12 +133,27 @@ // the other ones do not need to have a weight to be valid recomputeAllRows = withWeightRows.isEmpty(); } - if (recomputeAllRows) { - List<BenthosFrequencyRowModel> rows = getModel().getRows(); - for (BenthosFrequencyRowModel r : rows) { + + + List<BenthosFrequencyRowModel> rows = getModel().getRows(); + Integer totalNumber = 0; + Float totalWeight = 0f; + for (BenthosFrequencyRowModel r : rows) { + if (recomputeAllRows) { recomputeRowValidState(r); } - } else { + if (r.isValid()) { + totalNumber += r.getNumber(); + Float weight = r.getWeight(); + if (weight != null) { + totalWeight += weight; + } + } + } + getModel().setTotalNumber(totalNumber); + getModel().setTotalWeight(totalWeight); + + if (!recomputeAllRows) { recomputeRowValidState(row); } } @@ -427,6 +442,7 @@ tableModel.addNewRow(rowIndex, row); } + model.setTotalNumber(model.getTotalNumber() + 1); getTable().scrollRowToVisible(rowIndex); } @@ -434,6 +450,10 @@ public void editBatch(BenthosBatchRowModel speciesBatch, BenthosFrequencyCellComponent.FrequencyCellEditor editor) { withWeightRows.clear(); + BenthosFrequencyUIModel model = getModel(); + model.setTotalNumber(null); + model.setTotalWeight(null); + frequencyEditor = editor; Caracteristic lengthStepCaracteristic = null; @@ -450,6 +470,9 @@ if (CollectionUtils.isNotEmpty(frequency)) { + Integer totalNumber = 0; + Float totalWeight = 0f; + BenthosFrequencyTableModel tableModel = getTableModel(); for (BenthosFrequencyRowModel rowModel : frequency) { @@ -463,8 +486,14 @@ if (newRow.getWeight() != null) { withWeightRows.add(newRow); + totalWeight += newRow.getWeight(); + } else { + totalWeight = null; } + totalNumber += newRow.getNumber(); } + model.setTotalNumber(totalNumber); + model.setTotalWeight(totalWeight); // use first frequency row length step caracteristics @@ -511,8 +540,6 @@ editFrequency.size() + " frequency"); } - BenthosFrequencyUIModel model = getModel(); - BenthosFrequencyUIModel.ConfigurationMode mode = BenthosFrequencyUIModel.ConfigurationMode.SIMPLE; if (lengthStepCaracteristic == null && protocol != null) { Integer taxonId = speciesBatch.getSpecies().getReferenceTaxonId(); @@ -521,9 +548,10 @@ mode = BenthosFrequencyUIModel.ConfigurationMode.SIMPLE_COUNTING; } } - if (speciesBatch.getNumber() != null && editFrequency.isEmpty()) { + Integer number = speciesBatch.getNumber(); + if (number != null && editFrequency.isEmpty()) { mode = BenthosFrequencyUIModel.ConfigurationMode.SIMPLE_COUNTING; - model.setSimpleCount(speciesBatch.getNumber()); + model.setSimpleCount(number); } model.setConfigurationMode(mode); Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUIModel.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUIModel.java 2013-05-21 15:44:35 UTC (rev 973) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUIModel.java 2013-05-21 17:06:00 UTC (rev 974) @@ -61,6 +61,10 @@ public static final String PROPERTY_LENGHT_STEP_CARACTERISTIC = "lengthStepCaracteristic"; + public static final String PROPERTY_TOTAL_NUMBER = "totalNumber"; + + public static final String PROPERTY_TOTAL_WEIGHT = "totalWeight"; + public static enum ConfigurationMode { SIMPLE, AUTO_GEN, @@ -117,6 +121,18 @@ */ protected Integer simpleCount; + /** + * Sum of the number of each valid row + * @since 2.3 + */ + protected Integer totalNumber; + + /** + * Sum of the weight of each valid row + * @since 2.3 + */ + protected Float totalWeight; + public BenthosFrequencyUIModel() { super(SpeciesBatchRowModel.class, null, null); } @@ -225,20 +241,26 @@ return result; } - public boolean isOneRowValid() { - boolean result = getRowCount() > 0; - if (result) { - result = false; - for (BenthosFrequencyRowModel row : rows) { - if (row.isValid()) { - result = true; - break; - } - } - } - return result; + public Integer getTotalNumber() { + return totalNumber; } + public void setTotalNumber(Integer totalNumber) { + Object oldValue = getTotalNumber(); + this.totalNumber = totalNumber; + firePropertyChange(PROPERTY_TOTAL_NUMBER, oldValue, totalNumber); + } + + public Float getTotalWeight() { + return totalWeight; + } + + public void setTotalWeight(Float totalWeight) { + Object oldValue = getTotalWeight(); + this.totalWeight = totalWeight; + firePropertyChange(PROPERTY_TOTAL_WEIGHT, oldValue, totalWeight); + } + @Override protected SpeciesBatchRowModel newEntity() { return new SpeciesBatchRowModel(); Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUI.css =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUI.css 2013-05-21 15:44:35 UTC (rev 973) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUI.css 2013-05-21 17:06:00 UTC (rev 974) @@ -72,8 +72,37 @@ numberPattern: {DECIMAL1_PATTERN}; bean: {model}; enabled: {!model.isSimpleCountingMode()}; + _selectOnFocus: true; } +#totalNumberLabel { + text: "tutti.editSpeciesFrequencies.field.totalNumber"; + toolTipText: "tutti.editSpeciesFrequencies.field.totalNumber.tip"; + labelFor: {totalNumberField}; + enabled: {!model.isSimpleCountingMode()}; + _help: {"tutti.editSpeciesFrequencies.field.totalNumber.help"}; +} + +#totalNumberField { + text: {getStringValue(model.getTotalNumber())}; + enabled: false; + _computed: true; +} + +#totalWeightLabel { + text: "tutti.editSpeciesFrequencies.field.totalWeight"; + toolTipText: "tutti.editSpeciesFrequencies.field.totalWeight.tip"; + labelFor: {totalWeightField}; + enabled: {model.getTotalWeight() != null}; + _help: {"tutti.editSpeciesFrequencies.field.totalWeight.help"}; +} + +#totalWeightField { + text: {getStringValue(model.getTotalWeight())}; + enabled: false; + _computed: true; +} + #lengthStepCaracteristicLabel { text: "tutti.editSpeciesFrequencies.field.lengthStepCaracteristic"; toolTipText: "tutti.editSpeciesFrequencies.field.lengthStepCaracteristic.tip"; Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUI.jaxx =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUI.jaxx 2013-05-21 15:44:35 UTC (rev 973) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUI.jaxx 2013-05-21 17:06:00 UTC (rev 974) @@ -196,7 +196,7 @@ <cell anchor='west'> <JLabel id='lengthStepCaracteristicLabel'/> </cell> - <cell weightx='1.0'> + <cell weightx='1.0' columns='5'> <BeanFilterableComboBox id='lengthStepCaracteristicComboBox' constructorParams='this' genericType='Caracteristic'/> @@ -210,6 +210,18 @@ <cell weightx='1.0'> <NumberEditor id='stepField' constructorParams='this'/> </cell> + <cell anchor='west'> + <JLabel id='totalNumberLabel'/> + </cell> + <cell weightx='1.0'> + <JTextField id='totalNumberField'/> + </cell> + <cell anchor='west'> + <JLabel id='totalWeightLabel'/> + </cell> + <cell weightx='1.0'> + <JTextField id='totalWeightField'/> + </cell> </row> </Table> </JPanel> Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUIHandler.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUIHandler.java 2013-05-21 15:44:35 UTC (rev 973) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUIHandler.java 2013-05-21 17:06:00 UTC (rev 974) @@ -38,10 +38,7 @@ import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIHandler; import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SpeciesBatchRowModel; import fr.ifremer.tutti.ui.swing.content.operation.catches.species.frequency.SpeciesFrequencyCellComponent.FrequencyCellEditor; -import fr.ifremer.tutti.ui.swing.util.Cancelable; -import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor; -import fr.ifremer.tutti.ui.swing.util.TuttiUI; -import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil; +import fr.ifremer.tutti.ui.swing.util.*; import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIHandler; import jaxx.runtime.SwingUtil; import jaxx.runtime.validator.swing.SwingValidator; @@ -134,12 +131,26 @@ // the other ones do not need to have a weight to be valid recomputeAllRows = withWeightRows.isEmpty(); } - if (recomputeAllRows) { - List<SpeciesFrequencyRowModel> rows = getModel().getRows(); - for (SpeciesFrequencyRowModel r : rows) { + + List<SpeciesFrequencyRowModel> rows = getModel().getRows(); + Integer totalNumber = 0; + Float totalWeight = 0f; + for (SpeciesFrequencyRowModel r : rows) { + if (recomputeAllRows) { recomputeRowValidState(r); } - } else { + if (r.isValid()) { + totalNumber += r.getNumber(); + Float weight = r.getWeight(); + if (weight != null) { + totalWeight += weight; + } + } + } + getModel().setTotalNumber(totalNumber); + getModel().setTotalWeight(totalWeight); + + if (!recomputeAllRows) { recomputeRowValidState(row); } } @@ -428,6 +439,7 @@ tableModel.addNewRow(rowIndex, row); } + model.setTotalNumber(model.getTotalNumber() + 1); getTable().scrollRowToVisible(rowIndex); } @@ -435,6 +447,10 @@ public void editBatch(SpeciesBatchRowModel speciesBatch, FrequencyCellEditor editor) { withWeightRows.clear(); + SpeciesFrequencyUIModel model = getModel(); + model.setTotalNumber(null); + model.setTotalWeight(null); + frequencyEditor = editor; Caracteristic lengthStepCaracteristic = null; @@ -451,6 +467,9 @@ if (CollectionUtils.isNotEmpty(frequency)) { + Integer totalNumber = 0; + Float totalWeight = 0f; + SpeciesFrequencyTableModel tableModel = getTableModel(); for (SpeciesFrequencyRowModel rowModel : frequency) { @@ -464,8 +483,15 @@ if (newRow.getWeight() != null) { withWeightRows.add(newRow); + totalWeight += newRow.getWeight(); + + } else { + totalWeight = null; } + totalNumber += newRow.getNumber(); } + model.setTotalNumber(totalNumber); + model.setTotalWeight(totalWeight); // use first frequency row length step caracteristics @@ -512,8 +538,6 @@ editFrequency.size() + " frequency"); } - SpeciesFrequencyUIModel model = getModel(); - SpeciesFrequencyUIModel.ConfigurationMode mode = SpeciesFrequencyUIModel.ConfigurationMode.SIMPLE; if (lengthStepCaracteristic == null && protocol != null) { Integer taxonId = speciesBatch.getSpecies().getReferenceTaxonId(); @@ -522,9 +546,10 @@ mode = SpeciesFrequencyUIModel.ConfigurationMode.SIMPLE_COUNTING; } } - if (speciesBatch.getNumber() != null && editFrequency.isEmpty()) { + Integer number = speciesBatch.getNumber(); + if (number != null && editFrequency.isEmpty()) { mode = SpeciesFrequencyUIModel.ConfigurationMode.SIMPLE_COUNTING; - model.setSimpleCount(speciesBatch.getNumber()); + model.setSimpleCount(number); } model.setConfigurationMode(mode); Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUIModel.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUIModel.java 2013-05-21 15:44:35 UTC (rev 973) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUIModel.java 2013-05-21 17:06:00 UTC (rev 974) @@ -26,6 +26,7 @@ import fr.ifremer.tutti.persistence.entities.referential.Caracteristic; import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SpeciesBatchRowModel; +import fr.ifremer.tutti.ui.swing.util.TuttiComputedOrNotData; import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIModel; import java.util.List; @@ -62,6 +63,10 @@ public static final String PROPERTY_LENGHT_STEP_CARACTERISTIC = "lengthStepCaracteristic"; + public static final String PROPERTY_TOTAL_NUMBER = "totalNumber"; + + public static final String PROPERTY_TOTAL_WEIGHT = "totalWeight"; + public static enum ConfigurationMode { SIMPLE, AUTO_GEN, @@ -112,6 +117,18 @@ protected Caracteristic lengthStepCaracteristic; /** + * Sum of the number of each valid row + * @since 2.3 + */ + protected Integer totalNumber; + + /** + * Sum of the weight of each valid row + * @since 2.3 + */ + protected Float totalWeight; + + /** * Number in case of simple counting mode * * @since 1.0 @@ -226,25 +243,26 @@ return result; } - public boolean isOneRowValid() { - boolean result = getRowCount() > 0; - if (result) { - result = false; - for (SpeciesFrequencyRowModel row : rows) { - if (row.isValid()) { - result = true; - break; - } - } - } - return result; + public Integer getTotalNumber() { + return totalNumber; } - // method with an argument for the binding - public boolean isOneRowValid(List<SpeciesFrequencyRowModel> frequencies) { - return isOneRowValid(); + public void setTotalNumber(Integer totalNumber) { + Object oldValue = getTotalNumber(); + this.totalNumber = totalNumber; + firePropertyChange(PROPERTY_TOTAL_NUMBER, oldValue, totalNumber); } + public Float getTotalWeight() { + return totalWeight; + } + + public void setTotalWeight(Float totalWeight) { + Object oldValue = getTotalWeight(); + this.totalWeight = totalWeight; + firePropertyChange(PROPERTY_TOTAL_WEIGHT, oldValue, totalWeight); + } + @Override protected SpeciesBatchRowModel newEntity() { return new SpeciesBatchRowModel(); Modified: trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_en_GB.properties =================================================================== --- trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_en_GB.properties 2013-05-21 15:44:35 UTC (rev 973) +++ trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_en_GB.properties 2013-05-21 17:06:00 UTC (rev 974) @@ -404,6 +404,10 @@ tutti.editBenthosFrequencies.field.simpleCounting.tip= tutti.editBenthosFrequencies.field.step= tutti.editBenthosFrequencies.field.step.tip= +tutti.editBenthosFrequencies.field.totalNumber= +tutti.editBenthosFrequencies.field.totalNumber.tip= +tutti.editBenthosFrequencies.field.totalWeight= +tutti.editBenthosFrequencies.field.totalWeight.tip= tutti.editBenthosFrequencies.label.no.configuration= tutti.editBenthosFrequencies.simpleCountingAndFrequencies= tutti.editBenthosFrequencies.title= @@ -924,6 +928,10 @@ tutti.editSpeciesFrequencies.field.simpleCounting.tip= tutti.editSpeciesFrequencies.field.step= tutti.editSpeciesFrequencies.field.step.tip= +tutti.editSpeciesFrequencies.field.totalNumber= +tutti.editSpeciesFrequencies.field.totalNumber.tip= +tutti.editSpeciesFrequencies.field.totalWeight= +tutti.editSpeciesFrequencies.field.totalWeight.tip= tutti.editSpeciesFrequencies.label.no.configuration= tutti.editSpeciesFrequencies.simpleCountingAndFrequencies= tutti.editSpeciesFrequencies.table.header.lengthStep= Modified: trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties =================================================================== --- trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2013-05-21 15:44:35 UTC (rev 973) +++ trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2013-05-21 17:06:00 UTC (rev 974) @@ -398,6 +398,10 @@ tutti.editBenthosFrequencies.field.simpleCounting.tip=Saisir le nombre d'individus dans le lot tutti.editBenthosFrequencies.field.step=Pas de la classe de taille tutti.editBenthosFrequencies.field.step.tip=Pas de la classe de taille pour cette espèce (ex. \: 1 cm, 0,5 cm, 1 mm etc.) +tutti.editBenthosFrequencies.field.totalNumber=Nombre total +tutti.editBenthosFrequencies.field.totalNumber.tip=Nombre total d'individus des lignes valides +tutti.editBenthosFrequencies.field.totalWeight=Poids total +tutti.editBenthosFrequencies.field.totalWeight.tip=Poids total des lignes valides tutti.editBenthosFrequencies.label.no.configuration=< Pas de configuration > tutti.editBenthosFrequencies.simpleCountingAndFrequencies=Des mensurations ont été saisies dans le tableau. Saisir un simple dénombrement les effacera. tutti.editBenthosFrequencies.title=Mensuration @@ -888,6 +892,10 @@ tutti.editSpeciesFrequencies.field.simpleCounting.tip=Saisir le nombre d'individus dans le lot tutti.editSpeciesFrequencies.field.step=Pas de la classe de taille tutti.editSpeciesFrequencies.field.step.tip=Pas de la classe de taille pour cette espèce (ex. \: 1 cm, 0,5 cm, 1 mm etc.) +tutti.editSpeciesFrequencies.field.totalNumber=Nombre total +tutti.editSpeciesFrequencies.field.totalNumber.tip=Nombre total d'individus des lignes valides +tutti.editSpeciesFrequencies.field.totalWeight=Poids total +tutti.editSpeciesFrequencies.field.totalWeight.tip=Poids total des lignes valides tutti.editSpeciesFrequencies.label.no.configuration=< Pas de configuration > tutti.editSpeciesFrequencies.simpleCountingAndFrequencies=Des mensurations ont été saisies dans le tableau. Saisir un simple dénombrement les effacera. tutti.editSpeciesFrequencies.table.header.lengthStep=Classe de taille