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 e13dc4b19fc4d19cf8c4de25f40b7f7e03183629 Author: Kevin Morin <morin@codelutin.com> Date: Mon Jan 26 17:43:20 2015 +0100 refs #6453 ajout du nombre d'espèces --- .../src/main/xmi/tutti-persistence.zargo | Bin 58066 -> 58181 bytes .../operation/catches/EditCatchesUIHandler.java | 87 ++++++++++++++------- .../operation/catches/EditCatchesUIModel.java | 26 ++++++ .../catches/benthos/BenthosBatchUIHandler.java | 19 +++-- .../catches/benthos/BenthosBatchUIModel.java | 23 ++++++ .../catches/species/SpeciesBatchUIHandler.java | 21 +++-- .../catches/species/SpeciesBatchUIModel.java | 23 ++++++ tutti-ui-swing/src/main/resources/EcranResume.svg | 14 ++-- .../resources/i18n/tutti-ui-swing_en_GB.properties | 3 + .../resources/i18n/tutti-ui-swing_fr_FR.properties | 2 + 10 files changed, 169 insertions(+), 49 deletions(-) diff --git a/tutti-persistence/src/main/xmi/tutti-persistence.zargo b/tutti-persistence/src/main/xmi/tutti-persistence.zargo index 18682a6..62ab6db 100644 Binary files a/tutti-persistence/src/main/xmi/tutti-persistence.zargo and b/tutti-persistence/src/main/xmi/tutti-persistence.zargo differ diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIHandler.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIHandler.java index 2048267..606c93d 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIHandler.java +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIHandler.java @@ -42,6 +42,7 @@ import fr.ifremer.tutti.ui.swing.util.TuttiUI; import fr.ifremer.tutti.ui.swing.util.catches.EnterWeightUI; import fr.ifremer.tutti.ui.swing.util.computable.ComputableData; import fr.ifremer.tutti.util.Weights; +import jaxx.runtime.JAXXUtil; import jaxx.runtime.swing.CardLayout2Ext; import jaxx.runtime.validator.swing.SwingValidator; import org.apache.batik.dom.svg.SAXSVGDocumentFactory; @@ -120,7 +121,8 @@ public class EditCatchesUIHandler extends AbstractTuttiTabContainerUIHandler<Edi n("tutti.editCatchBatch.field.benthosTotalUnsortedComputedWeight"); n("tutti.editCatchBatch.field.benthosTotalSampleSortedComputedWeight"); - // initSvgField("value_vrac_trie", getModel().getCatchTotalComputedOrNotWeight()); + n("tutti.editCatchBatch.field.speciesDistinctSortedSpeciesCount"); + n("tutti.editCatchBatch.field.benthosDistinctSortedSpeciesCount"); } /** Logger. */ @@ -253,23 +255,24 @@ public class EditCatchesUIHandler extends AbstractTuttiTabContainerUIHandler<Edi WeightUnit benthosWeightUnit = config.getBenthosWeightUnit(); WeightUnit marineLitterWeightUnit = config.getMarineLitterWeightUnit(); - initSvgField(CatchBatch.PROPERTY_CATCH_TOTAL_WEIGHT, getModel().getCatchTotalComputedOrNotWeight(), catchWeightUnit); + EditCatchesUIModel model = getModel(); + initSvgField(CatchBatch.PROPERTY_CATCH_TOTAL_WEIGHT, model.getCatchTotalComputedOrNotWeight(), catchWeightUnit); initSvgField(CatchBatch.PROPERTY_CATCH_TOTAL_SORTED_COMPUTED_WEIGHT, catchWeightUnit); - initSvgField(CatchBatch.PROPERTY_CATCH_TOTAL_REJECTED_WEIGHT, getModel().getCatchTotalRejectedComputedOrNotWeight(), catchWeightUnit); + initSvgField(CatchBatch.PROPERTY_CATCH_TOTAL_REJECTED_WEIGHT, model.getCatchTotalRejectedComputedOrNotWeight(), catchWeightUnit); initSvgField(CatchBatch.PROPERTY_CATCH_TOTAL_SORTED_SORTED_COMPUTED_WEIGHT, catchWeightUnit); - initSvgField(CatchBatch.PROPERTY_SPECIES_TOTAL_SORTED_WEIGHT, getModel().getSpeciesTotalSortedComputedOrNotWeight(), speciesWeightUnit); + initSvgField(CatchBatch.PROPERTY_SPECIES_TOTAL_SORTED_WEIGHT, model.getSpeciesTotalSortedComputedOrNotWeight(), speciesWeightUnit); initSvgField(CatchBatch.PROPERTY_SPECIES_TOTAL_SAMPLE_SORTED_COMPUTED_WEIGHT, speciesWeightUnit); - initSvgField(CatchBatch.PROPERTY_BENTHOS_TOTAL_SORTED_WEIGHT, getModel().getBenthosTotalSortedComputedOrNotWeight(), benthosWeightUnit); + initSvgField(CatchBatch.PROPERTY_BENTHOS_TOTAL_SORTED_WEIGHT, model.getBenthosTotalSortedComputedOrNotWeight(), benthosWeightUnit); initSvgField(CatchBatch.PROPERTY_BENTHOS_TOTAL_SAMPLE_SORTED_COMPUTED_WEIGHT, benthosWeightUnit); initSvgField(CatchBatch.PROPERTY_CATCH_TOTAL_UNSORTED_COMPUTED_WEIGHT, catchWeightUnit); initSvgField(CatchBatch.PROPERTY_SPECIES_TOTAL_UNSORTED_COMPUTED_WEIGHT, speciesWeightUnit); initSvgField(CatchBatch.PROPERTY_BENTHOS_TOTAL_UNSORTED_COMPUTED_WEIGHT, benthosWeightUnit); - getModel().addPropertyChangeListener(new ChangeElementBackgroundColorPropertyChangeListener( + model.addPropertyChangeListener(new ChangeElementBackgroundColorPropertyChangeListener( CatchBatch.PROPERTY_SPECIES_TOTAL_UNSORTED_COMPUTED_WEIGHT, Sets.newHashSet(CatchBatch.PROPERTY_CATCH_TOTAL_REJECTED_WEIGHT, CatchBatch.PROPERTY_CATCH_TOTAL_REJECTED_COMPUTED_WEIGHT, @@ -286,17 +289,17 @@ public class EditCatchesUIHandler extends AbstractTuttiTabContainerUIHandler<Edi Float speciesTotalSampleSortedComputedWeight = model.getSpeciesTotalSampleSortedComputedWeight(); boolean warning = catchTotalRejectedWeight != null - && speciesTotalSortedWeight != null - && speciesTotalSampleSortedComputedWeight != null - && Weights.isEqualWeight(catchTotalRejectedWeight, 0f) - && Weights.isEqualWeight(speciesTotalSortedWeight, - speciesTotalSampleSortedComputedWeight); + && speciesTotalSortedWeight != null + && speciesTotalSampleSortedComputedWeight != null + && Weights.isEqualWeight(catchTotalRejectedWeight, 0f) + && Weights.isEqualWeight(speciesTotalSortedWeight, + speciesTotalSampleSortedComputedWeight); return warning ? Color.ORANGE : Color.decode("#006bba"); } })); - getModel().addPropertyChangeListener(new ChangeElementBackgroundColorPropertyChangeListener( + model.addPropertyChangeListener(new ChangeElementBackgroundColorPropertyChangeListener( CatchBatch.PROPERTY_BENTHOS_TOTAL_UNSORTED_COMPUTED_WEIGHT, Sets.newHashSet(CatchBatch.PROPERTY_CATCH_TOTAL_REJECTED_WEIGHT, CatchBatch.PROPERTY_CATCH_TOTAL_REJECTED_COMPUTED_WEIGHT, @@ -325,20 +328,23 @@ public class EditCatchesUIHandler extends AbstractTuttiTabContainerUIHandler<Edi initSvgField(CatchBatch.PROPERTY_SPECIES_TOTAL_COMPUTED_WEIGHT, speciesWeightUnit); initSvgField(CatchBatch.PROPERTY_BENTHOS_TOTAL_COMPUTED_WEIGHT, benthosWeightUnit); - initSvgField(CatchBatch.PROPERTY_MARINE_LITTER_TOTAL_WEIGHT, getModel().getMarineLitterTotalComputedOrNotWeight(), marineLitterWeightUnit); - - getModel().addPropertyChangeListener(new RatioPropertyChangeListener("ratioSpeciesSampleSortedOverSpeciesSortedWeightLabel", - CatchBatch.PROPERTY_SPECIES_TOTAL_SAMPLE_SORTED_COMPUTED_WEIGHT, - CatchBatch.PROPERTY_SPECIES_TOTAL_SORTED_WEIGHT, - CatchBatch.PROPERTY_SPECIES_TOTAL_SORTED_COMPUTED_WEIGHT, - canvas, - svgDocument)); - getModel().addPropertyChangeListener(new RatioPropertyChangeListener("ratioBenthosSampleSortedOverBenthosSortedWeightLabel", - CatchBatch.PROPERTY_BENTHOS_TOTAL_SAMPLE_SORTED_COMPUTED_WEIGHT, - CatchBatch.PROPERTY_BENTHOS_TOTAL_SORTED_WEIGHT, - CatchBatch.PROPERTY_BENTHOS_TOTAL_SORTED_COMPUTED_WEIGHT, - canvas, - svgDocument)); + initSvgField(CatchBatch.PROPERTY_MARINE_LITTER_TOTAL_WEIGHT, model.getMarineLitterTotalComputedOrNotWeight(), marineLitterWeightUnit); + + model.addPropertyChangeListener(new RatioPropertyChangeListener("ratioSpeciesSampleSortedOverSpeciesSortedWeightLabel", + CatchBatch.PROPERTY_SPECIES_TOTAL_SAMPLE_SORTED_COMPUTED_WEIGHT, + CatchBatch.PROPERTY_SPECIES_TOTAL_SORTED_WEIGHT, + CatchBatch.PROPERTY_SPECIES_TOTAL_SORTED_COMPUTED_WEIGHT, + canvas, + svgDocument)); + model.addPropertyChangeListener(new RatioPropertyChangeListener("ratioBenthosSampleSortedOverBenthosSortedWeightLabel", + CatchBatch.PROPERTY_BENTHOS_TOTAL_SAMPLE_SORTED_COMPUTED_WEIGHT, + CatchBatch.PROPERTY_BENTHOS_TOTAL_SORTED_WEIGHT, + CatchBatch.PROPERTY_BENTHOS_TOTAL_SORTED_COMPUTED_WEIGHT, + canvas, + svgDocument)); + + initSpeciesCount(CatchBatch.PROPERTY_SPECIES_DISTINCT_SORTED_SPECIES_COUNT); + initSpeciesCount(CatchBatch.PROPERTY_BENTHOS_DISTINCT_SORTED_SPECIES_COUNT); } }); @@ -347,6 +353,30 @@ public class EditCatchesUIHandler extends AbstractTuttiTabContainerUIHandler<Edi canvas.setDocument(svgDocument); } + protected void initSpeciesCount(final String property) { + + if (log.isDebugEnabled()) { + log.debug("init " + property + " field"); + } + + canvas.getUpdateManager().getUpdateRunnableQueue().invokeLater(new Runnable() { + @Override + public void run() { + Element labelElement = svgDocument.getElementById(property + "Label"); + labelElement.setTextContent(t("tutti.editCatchBatch.field." + property)); + } + }); + + getModel().addPropertyChangeListener(property, new PropertyChangeListener() { + @Override + public void propertyChange(PropertyChangeEvent evt) { + Integer value = (Integer) evt.getNewValue(); + Element labelElement = svgDocument.getElementById(property + "Value"); + labelElement.setTextContent(JAXXUtil.getStringValue(value)); + } + }); + } + protected void initSvgField(String property, WeightUnit weightUnit) { initSvgField(property, null, weightUnit); } @@ -454,8 +484,9 @@ public class EditCatchesUIHandler extends AbstractTuttiTabContainerUIHandler<Edi Set<String> result = super.getPropertiesToIgnore(); result.addAll(Sets.newHashSet( EditCatchesUIModel.PROPERTY_CATCH_TOTAL_COMPUTED_WEIGHT, - EditCatchesUIModel.PROPERTY_CATCH_TOTAL_SORTED_COMPUTED_WEIGHT, EditCatchesUIModel.PROPERTY_CATCH_TOTAL_UNSORTED_COMPUTED_WEIGHT, + EditCatchesUIModel.PROPERTY_CATCH_TOTAL_SORTED_COMPUTED_WEIGHT, + EditCatchesUIModel.PROPERTY_CATCH_TOTAL_SORTED_SORTED_COMPUTED_WEIGHT, EditCatchesUIModel.PROPERTY_CATCH_TOTAL_REJECTED_COMPUTED_WEIGHT, EditCatchesUIModel.PROPERTY_SPECIES_TOTAL_COMPUTED_WEIGHT, EditCatchesUIModel.PROPERTY_SPECIES_TOTAL_SORTED_COMPUTED_WEIGHT, @@ -469,6 +500,8 @@ public class EditCatchesUIHandler extends AbstractTuttiTabContainerUIHandler<Edi EditCatchesUIModel.PROPERTY_BENTHOS_TOTAL_SAMPLE_SORTED_COMPUTED_WEIGHT, EditCatchesUIModel.PROPERTY_BENTHOS_TOTAL_INERT_COMPUTED_WEIGHT, EditCatchesUIModel.PROPERTY_BENTHOS_TOTAL_LIVING_NOT_ITEMIZED_COMPUTED_WEIGHT, + EditCatchesUIModel.PROPERTY_SPECIES_DISTINCT_SORTED_SPECIES_COUNT, + EditCatchesUIModel.PROPERTY_BENTHOS_DISTINCT_SORTED_SPECIES_COUNT, EditCatchesUIModel.PROPERTY_ATTACHMENT, EditCatchesUIModel.PROPERTY_BATCH_UPDATED )); diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIModel.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIModel.java index 1f2de8a..a2ccbea 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIModel.java +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIModel.java @@ -848,6 +848,30 @@ public class EditCatchesUIModel extends AbstractTuttiBeanUIModel<CatchBatch, Edi firePropertyChange(PROPERTY_CATCH_TOTAL_SORTED_SORTED_COMPUTED_WEIGHT, oldValue, catchTotalSortedSortedComputedWeight); } + @Override + public Integer getSpeciesDistinctSortedSpeciesCount() { + return editObject.getSpeciesDistinctSortedSpeciesCount(); + } + + @Override + public void setSpeciesDistinctSortedSpeciesCount(Integer speciesDistinctSortedSpeciesCount) { + Object oldValue = getSpeciesDistinctSortedSpeciesCount(); + this.editObject.setSpeciesDistinctSortedSpeciesCount(speciesDistinctSortedSpeciesCount); + firePropertyChange(PROPERTY_SPECIES_DISTINCT_SORTED_SPECIES_COUNT, oldValue, speciesDistinctSortedSpeciesCount); + } + + @Override + public Integer getBenthosDistinctSortedSpeciesCount() { + return editObject.getBenthosDistinctSortedSpeciesCount(); + } + + @Override + public void setBenthosDistinctSortedSpeciesCount(Integer benthosDistinctSortedSpeciesCount) { + Object oldValue = getBenthosDistinctSortedSpeciesCount(); + this.editObject.setBenthosDistinctSortedSpeciesCount(benthosDistinctSortedSpeciesCount); + firePropertyChange(PROPERTY_BENTHOS_DISTINCT_SORTED_SPECIES_COUNT, oldValue, benthosDistinctSortedSpeciesCount); + } + public void reset() { setSpeciesTotalInertComputedWeight(null); setSpeciesTotalLivingNotItemizedComputedWeight(null); @@ -870,5 +894,7 @@ public class EditCatchesUIModel extends AbstractTuttiBeanUIModel<CatchBatch, Edi removeAllAttachment(getAttachment()); getSpeciesUsed().clear(); getMarineLitterCategoriesUsed().clear(); + setSpeciesDistinctSortedSpeciesCount(null); + setBenthosDistinctSortedSpeciesCount(null); } } diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIHandler.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIHandler.java index 9cc5688..8099423 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIHandler.java +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIHandler.java @@ -69,7 +69,6 @@ import fr.ifremer.tutti.ui.swing.util.comment.CommentCellRenderer; import fr.ifremer.tutti.ui.swing.util.computable.ComputableDataTableCell; import fr.ifremer.tutti.util.Weights; import jaxx.runtime.SwingUtil; -import org.nuiton.jaxx.widgets.number.NumberEditor; import jaxx.runtime.swing.renderer.DecoratorListCellRenderer; import jaxx.runtime.validator.swing.SwingValidator; import org.apache.commons.collections4.CollectionUtils; @@ -85,18 +84,15 @@ import org.jdesktop.swingx.table.TableColumnExt; import org.jdesktop.swingx.table.TableColumnModelExt; import org.nuiton.decorator.Decorator; import org.nuiton.jaxx.application.swing.table.ColumnIdentifier; +import org.nuiton.jaxx.widgets.number.NumberEditor; import org.nuiton.validator.NuitonValidatorResult; -import javax.swing.JComboBox; -import javax.swing.JComponent; -import javax.swing.JOptionPane; -import javax.swing.RowFilter; +import javax.swing.*; import javax.swing.event.TableModelEvent; import javax.swing.event.TableModelListener; import javax.swing.table.TableCellRenderer; import javax.swing.table.TableColumnModel; -import java.awt.Color; -import java.awt.Component; +import java.awt.*; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.io.Serializable; @@ -361,6 +357,7 @@ public class BenthosBatchUIHandler extends AbstractTuttiBatchTableUIHandler<Bent BenthosBatchUIModel model = getModel(); model.setRootNumber(0); + model.setBenthosDistinctSortedSpeciesCount(0); for (BenthosBatchRowModel row : rows) { updateTotalFromFrequencies(row); @@ -1442,6 +1439,10 @@ public class BenthosBatchUIHandler extends AbstractTuttiBatchTableUIHandler<Bent if (row.isBatchRoot()) { model.setRootNumber(model.getRootNumber() - 1); + + if (QualitativeValueId.SORTED_VRAC.getValue().equals(categoryValue.getIdAsInt())) { + model.decBenthosDistinctSortedSpeciesCount(); + } } } @@ -1579,6 +1580,10 @@ public class BenthosBatchUIHandler extends AbstractTuttiBatchTableUIHandler<Bent BenthosBatchUIModel model = getModel(); model.getSpeciesUsed().put(categoryValue, row.getSpecies()); + if (QualitativeValueId.SORTED_VRAC.getValue().equals(categoryValue.getIdAsInt())) { + model.incBenthosDistinctSortedSpeciesCount(); + } + model.setRootNumber(model.getRootNumber() + 1); } diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIModel.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIModel.java index 04a04da..9c4416d 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIModel.java +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIModel.java @@ -274,6 +274,29 @@ public class BenthosBatchUIModel extends AbstractTuttiBatchUIModel<BenthosBatchR catchesUIModel.setBenthosTotalLivingNotItemizedComputedWeight(speciesTotalLivingNotItemizedComputedWeight); } + public Integer getBenthosDistinctSortedSpeciesCount() { + return catchesUIModel.getBenthosDistinctSortedSpeciesCount(); + } + + public void setBenthosDistinctSortedSpeciesCount(Integer benthosDistinctSortedSpeciesCount) { + catchesUIModel.setBenthosDistinctSortedSpeciesCount(benthosDistinctSortedSpeciesCount); + } + + public void incBenthosDistinctSortedSpeciesCount() { + Integer benthosDistinctSortedSpeciesCount = getBenthosDistinctSortedSpeciesCount(); + if (benthosDistinctSortedSpeciesCount == null) { + benthosDistinctSortedSpeciesCount = 0; + } + setBenthosDistinctSortedSpeciesCount(benthosDistinctSortedSpeciesCount + 1); + } + + public void decBenthosDistinctSortedSpeciesCount() { + Integer benthosDistinctSortedSpeciesCount = getBenthosDistinctSortedSpeciesCount(); + if (benthosDistinctSortedSpeciesCount != null) { + setBenthosDistinctSortedSpeciesCount(benthosDistinctSortedSpeciesCount - 1); + } + } + public TableViewMode getTableViewMode() { return tableViewMode; } diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java index c6bb1b8..648d8da 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java @@ -48,9 +48,9 @@ import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIHandler; import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIModel; import fr.ifremer.tutti.ui.swing.content.operation.catches.SampleCategoryColumnIdentifier; import fr.ifremer.tutti.ui.swing.content.operation.catches.SampleCategoryComponent; +import fr.ifremer.tutti.ui.swing.content.operation.catches.SpeciesAbleBatchRowHelper; import fr.ifremer.tutti.ui.swing.content.operation.catches.SpeciesBatchDecorator; import fr.ifremer.tutti.ui.swing.content.operation.catches.SpeciesBatchDecoratorComparator; -import fr.ifremer.tutti.ui.swing.content.operation.catches.SpeciesAbleBatchRowHelper; import fr.ifremer.tutti.ui.swing.content.operation.catches.SpeciesSortMode; import fr.ifremer.tutti.ui.swing.content.operation.catches.TableViewMode; import fr.ifremer.tutti.ui.swing.content.operation.catches.species.create.CreateSpeciesBatchUI; @@ -69,7 +69,6 @@ import fr.ifremer.tutti.ui.swing.util.comment.CommentCellRenderer; import fr.ifremer.tutti.ui.swing.util.computable.ComputableDataTableCell; import fr.ifremer.tutti.util.Weights; import jaxx.runtime.SwingUtil; -import org.nuiton.jaxx.widgets.number.NumberEditor; import jaxx.runtime.swing.renderer.DecoratorListCellRenderer; import jaxx.runtime.validator.swing.SwingValidator; import org.apache.commons.collections4.CollectionUtils; @@ -85,18 +84,15 @@ import org.jdesktop.swingx.table.TableColumnExt; import org.jdesktop.swingx.table.TableColumnModelExt; import org.nuiton.decorator.Decorator; import org.nuiton.jaxx.application.swing.table.ColumnIdentifier; +import org.nuiton.jaxx.widgets.number.NumberEditor; import org.nuiton.validator.NuitonValidatorResult; -import javax.swing.JComboBox; -import javax.swing.JComponent; -import javax.swing.JOptionPane; -import javax.swing.RowFilter; +import javax.swing.*; import javax.swing.event.TableModelEvent; import javax.swing.event.TableModelListener; import javax.swing.table.TableCellRenderer; import javax.swing.table.TableColumnModel; -import java.awt.Color; -import java.awt.Component; +import java.awt.*; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.io.Serializable; @@ -363,6 +359,7 @@ public class SpeciesBatchUIHandler extends AbstractTuttiBatchTableUIHandler<Spec SpeciesBatchUIModel model = getModel(); model.setRootNumber(0); + model.setSpeciesDistinctSortedSpeciesCount(0); for (SpeciesBatchRowModel row : rows) { updateTotalFromFrequencies(row); @@ -1449,6 +1446,10 @@ public class SpeciesBatchUIHandler extends AbstractTuttiBatchTableUIHandler<Spec if (row.isBatchRoot()) { model.setRootNumber(model.getRootNumber() - 1); + + if (QualitativeValueId.SORTED_VRAC.getValue().equals(categoryValue.getIdAsInt())) { + model.decSpeciesDistinctSortedSpeciesCount(); + } } } @@ -1602,6 +1603,10 @@ public class SpeciesBatchUIHandler extends AbstractTuttiBatchTableUIHandler<Spec SpeciesBatchUIModel model = getModel(); model.getSpeciesUsed().put(categoryValue, row.getSpecies()); + if (QualitativeValueId.SORTED_VRAC.getValue().equals(categoryValue.getIdAsInt())) { + model.incSpeciesDistinctSortedSpeciesCount(); + } + model.setRootNumber(model.getRootNumber() + 1); } diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIModel.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIModel.java index 088f7d8..3034291 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIModel.java +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIModel.java @@ -258,6 +258,29 @@ public class SpeciesBatchUIModel extends AbstractTuttiBatchUIModel<SpeciesBatchR catchesUIModel.setSpeciesTotalLivingNotItemizedComputedWeight(speciesTotalLivingNotItemizedComputedWeight); } + public Integer getSpeciesDistinctSortedSpeciesCount() { + return catchesUIModel.getSpeciesDistinctSortedSpeciesCount(); + } + + public void setSpeciesDistinctSortedSpeciesCount(Integer speciesDistinctSortedSpeciesCount) { + catchesUIModel.setSpeciesDistinctSortedSpeciesCount(speciesDistinctSortedSpeciesCount); + } + + public void incSpeciesDistinctSortedSpeciesCount() { + Integer speciesDistinctSortedSpeciesCount = getSpeciesDistinctSortedSpeciesCount(); + if (speciesDistinctSortedSpeciesCount == null) { + speciesDistinctSortedSpeciesCount = 0; + } + setSpeciesDistinctSortedSpeciesCount(speciesDistinctSortedSpeciesCount + 1); + } + + public void decSpeciesDistinctSortedSpeciesCount() { + Integer speciesDistinctSortedSpeciesCount = getSpeciesDistinctSortedSpeciesCount(); + if (speciesDistinctSortedSpeciesCount != null) { + setSpeciesDistinctSortedSpeciesCount(speciesDistinctSortedSpeciesCount - 1); + } + } + public TableViewMode getTableViewMode() { return tableViewMode; } diff --git a/tutti-ui-swing/src/main/resources/EcranResume.svg b/tutti-ui-swing/src/main/resources/EcranResume.svg index 9995d81..8d85766 100644 --- a/tutti-ui-swing/src/main/resources/EcranResume.svg +++ b/tutti-ui-swing/src/main/resources/EcranResume.svg @@ -788,7 +788,7 @@ style="font-size:10px;font-style:italic;font-weight:normal;text-align:end;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:end;fill:#0000ff;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans Italic" x="653.52368" y="140.25211" - id="ratioBenthosSampleSortedOverBenthosgitSortedWeightLabel" + id="ratioBenthosSampleSortedOverBenthosSortedWeightLabel" sodipodi:linespacing="125%" /> <text xml:space="preserve" @@ -799,17 +799,17 @@ sodipodi:linespacing="125%" /> <text xml:space="preserve" - style="font-size:9px;font-style:normal;font-weight:normal;text-align:end;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" + style="font-size:9px;font-style:italic;font-weight:normal;text-align:end;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" x="434.4368" y="208.85081" - id="speciesSpeciesNumberLabel" + id="speciesDistinctSortedSpeciesCountLabel" sodipodi:linespacing="125%">Nombre d'espèces :</text> <text xml:space="preserve" - style="font-size:9px;font-style:normal;font-weight:normal;text-align:end;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" + style="font-size:9px;font-style:italic;font-weight:normal;text-align:end;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" x="658.59515" y="209.14259" - id="benthosSpeciesNumberLabel" + id="benthosDistinctSortedSpeciesCountLabel" sodipodi:linespacing="125%" inkscape:transform-center-x="79.903062" inkscape:transform-center-y="-4.5351562">Nombre d'espèces :</text> @@ -818,14 +818,14 @@ style="font-size:10px;font-style:italic;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#0000ff;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans Italic" x="438.71716" y="209.19144" - id="speciesSpeciesNumberValue" + id="speciesDistinctSortedSpeciesCountValue" sodipodi:linespacing="125%"></text> <text xml:space="preserve" style="font-size:10px;font-style:italic;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#0000ff;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans Italic" x="663.29871" y="208.83646" - id="benthosSpeciesNumberValue-0" + id="benthosDistinctSortedSpeciesCountValue" sodipodi:linespacing="125%"></text> </g> </svg> diff --git a/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_en_GB.properties b/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_en_GB.properties index 04c644a..3d7bad5 100644 --- a/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_en_GB.properties +++ b/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_en_GB.properties @@ -604,6 +604,8 @@ tutti.editCatchBatch.action.saveCatchBatch.mnemonic= tutti.editCatchBatch.action.saveCatchBatch.tip= tutti.editCatchBatch.askCancelEditBeforeLeaving.cancelEditCatchBatch= tutti.editCatchBatch.askSaveBeforeLeaving.saveCatchBatch= +tutti.editCatchBatch.field.= +tutti.editCatchBatch.field.benthosDistinctSortedSpeciesCount= tutti.editCatchBatch.field.benthosTotalComputedWeight= tutti.editCatchBatch.field.benthosTotalSampleSortedComputedWeight= tutti.editCatchBatch.field.benthosTotalSampleSortedWeight= @@ -632,6 +634,7 @@ tutti.editCatchBatch.field.catchTotalWeight= tutti.editCatchBatch.field.catchTotalWeight.tip= tutti.editCatchBatch.field.marineLitterTotalWeight= tutti.editCatchBatch.field.marineLitterTotalWeight.tip= +tutti.editCatchBatch.field.speciesDistinctSortedSpeciesCount= tutti.editCatchBatch.field.speciesOrBenthosTotalWeight.not.computed= tutti.editCatchBatch.field.speciesTotalComputedWeight= tutti.editCatchBatch.field.speciesTotalSampleSortedComputedWeight= diff --git a/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties b/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties index 4000b1f..b016b28 100644 --- a/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties +++ b/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties @@ -589,6 +589,7 @@ tutti.editCatchBatch.action.saveCatchBatch.mnemonic=S tutti.editCatchBatch.action.saveCatchBatch.tip=Enregistrer la capture tutti.editCatchBatch.askCancelEditBeforeLeaving.cancelEditCatchBatch=La capture n'est pas valide et ne peut pas être enregistrée tutti.editCatchBatch.askSaveBeforeLeaving.saveCatchBatch=Des modifications sur la capture n'ont pas été enregistrées +tutti.editCatchBatch.field.benthosDistinctSortedSpeciesCount=Nombre d'espèces \: tutti.editCatchBatch.field.benthosTotalComputedWeight=Total Benthos tutti.editCatchBatch.field.benthosTotalSampleSortedComputedWeight=Vrac observé tutti.editCatchBatch.field.benthosTotalSampleSortedWeight=Poids VRAC trié @@ -617,6 +618,7 @@ tutti.editCatchBatch.field.catchTotalWeight=CAPTURE TOTALE tutti.editCatchBatch.field.catchTotalWeight.tip=Poids total de la capture (sauf macro déchets et captures accidentelles) tutti.editCatchBatch.field.marineLitterTotalWeight=Total macrodéchets tutti.editCatchBatch.field.marineLitterTotalWeight.tip=Poids total des macro déchets dans la capture +tutti.editCatchBatch.field.speciesDistinctSortedSpeciesCount=Nombre d'espèces \: tutti.editCatchBatch.field.speciesOrBenthosTotalWeight.not.computed=poids non calculable dans ce contexte tutti.editCatchBatch.field.speciesTotalComputedWeight=Total Espèces tutti.editCatchBatch.field.speciesTotalSampleSortedComputedWeight=Vrac observé -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.