Tutti-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
April 2016
- 2 participants
- 234 discussions
This is an automated email from the git hooks/post-receive script.
New change to branch develop in repository tutti.
See https://gitlab.nuiton.org/codelutin/tutti.git
from b0e531f Livrable #8256 Merge branch 'feature/8256' into develop
new ca6413e Bien reporter le poids de sous-échantillon après un import (See #8248)
new e010538 Correction du chargement de l'écran des mensurations si pas de méthode de mensuration trouvée
new 22912b8 Livrable #8248 Merge branch 'feature/8248' into develop
The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "adds" were already present in the repository and have only
been added to this reference.
Detailed log of new commits:
commit 22912b87f46eba5a305d88cd13ea4b25c832607a
Merge: b0e531f e010538
Author: Tony CHEMIT <chemit(a)codelutin.com>
Date: Sun Apr 17 12:28:34 2016 +0200
Livrable #8248
Merge branch 'feature/8248' into develop
commit e010538141ceeaf0a51fc47dd0af53563d93128d
Author: Tony CHEMIT <chemit(a)codelutin.com>
Date: Sun Apr 17 12:28:31 2016 +0200
Correction du chargement de l'écran des mensurations si pas de méthode de mensuration trouvée
commit ca6413eb302c047f0b2e2f6965860f98b7027f03
Author: Tony CHEMIT <chemit(a)codelutin.com>
Date: Sun Apr 17 12:28:02 2016 +0200
Bien reporter le poids de sous-échantillon après un import (See #8248)
Summary of changes:
.../frequency/SpeciesFrequencyUIHandler.java | 16 +++++++++++-----
.../ImportMultiPostSpeciesSupportAction.java | 21 ++++++++++++++-------
2 files changed, 25 insertions(+), 12 deletions(-)
--
To stop receiving notification emails like this one, please contact
codelutin.com SCM administrator <admin+scm(a)codelutin.com>.
1
3
This is an automated email from the git hooks/post-receive script.
New change to branch develop in repository tutti.
See https://gitlab.nuiton.org/codelutin/tutti.git
from cf65593 Livrable #8257 Merge branch 'feature/8257' into develop
new c80d374 ajout toString
new c0998d6 Revue de l'API de cache pour avoir un cache de haut niveau sur les cruise puis des caches dédiés
new dbdef2d Revue du chargement des caches de campagne
new abb60a4 Utilisation des caches de campagnes
new b0e531f Livrable #8256 Merge branch 'feature/8256' into develop
The 5 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "adds" were already present in the repository and have only
been added to this reference.
Detailed log of new commits:
commit b0e531ffe132889e942659e7c506a768de602d78
Merge: cf65593 abb60a4
Author: Tony CHEMIT <chemit(a)codelutin.com>
Date: Sun Apr 17 10:59:41 2016 +0200
Livrable #8256
Merge branch 'feature/8256' into develop
commit abb60a40e675965c84686ccbb512bd9d1328e61b
Author: Tony CHEMIT <chemit(a)codelutin.com>
Date: Sun Apr 17 07:36:09 2016 +0200
Utilisation des caches de campagnes
commit dbdef2da4edd97ac634bc5c4d42a60ae0c63c8cb
Author: Tony CHEMIT <chemit(a)codelutin.com>
Date: Sun Apr 17 07:35:51 2016 +0200
Revue du chargement des caches de campagne
commit c0998d61c99c033888bb6fca3c0131d10c7a9fd0
Author: Tony CHEMIT <chemit(a)codelutin.com>
Date: Sun Apr 17 07:35:26 2016 +0200
Revue de l'API de cache pour avoir un cache de haut niveau sur les cruise puis des caches dédiés
commit c80d374b8be5d6a5e967bffd7f60b9acef7bc1b1
Author: Tony CHEMIT <chemit(a)codelutin.com>
Date: Sun Apr 17 07:34:51 2016 +0200
ajout toString
Summary of changes:
.../entities/data/FishingOperationBean.java | 14 +-
.../ifremer/tutti/service/PersistenceService.java | 129 +++---
.../fr/ifremer/tutti/service/TuttiDataContext.java | 216 ++++------
.../cps/CalcifiedPiecesSamplingExportService.java | 39 +-
.../tutti/service/sampling/CruiseCache.java | 141 +++++++
.../tutti/service/sampling/CruiseCacheAble.java | 46 +++
.../tutti/service/sampling/CruiseCacheLoader.java | 149 +++++++
.../service/sampling/CruiseSamplingCache.java | 451 ++++++++++-----------
.../sampling/CruiseSamplingCacheLoader.java | 156 -------
.../tutti/service/sampling/SamplingCodeCache.java | 113 ++++++
.../fr/ifremer/tutti/ui/swing/TuttiUIContext.java | 18 +-
.../content/actions/EditCatchesSupportAction.java | 24 +-
.../content/cruise/actions/SaveCruiseAction.java | 7 +-
.../CalcifiedPiecesSamplingReportAction.java | 30 +-
.../SamplingCodeCellEditor.java | 20 +-
.../IndividualObservationBatchTableHandler.java | 38 +-
.../frequency/IndividualObservationUICache.java | 205 ++++++----
.../protocol/actions/SaveProtocolAction.java | 6 +-
18 files changed, 1059 insertions(+), 743 deletions(-)
create mode 100644 tutti-service/src/main/java/fr/ifremer/tutti/service/sampling/CruiseCache.java
create mode 100644 tutti-service/src/main/java/fr/ifremer/tutti/service/sampling/CruiseCacheAble.java
create mode 100644 tutti-service/src/main/java/fr/ifremer/tutti/service/sampling/CruiseCacheLoader.java
delete mode 100644 tutti-service/src/main/java/fr/ifremer/tutti/service/sampling/CruiseSamplingCacheLoader.java
create mode 100644 tutti-service/src/main/java/fr/ifremer/tutti/service/sampling/SamplingCodeCache.java
--
To stop receiving notification emails like this one, please contact
codelutin.com SCM administrator <admin+scm(a)codelutin.com>.
1
5
This is an automated email from the git hooks/post-receive script.
New change to branch feature/8256 in repository tutti.
See https://gitlab.nuiton.org/codelutin/tutti.git
was abb60a4 Utilisation des caches de campagnes
This change permanently discards the following revisions:
discards abb60a4 Utilisation des caches de campagnes
discards dbdef2d Revue du chargement des caches de campagne
discards c0998d6 Revue de l'API de cache pour avoir un cache de haut niveau sur les cruise puis des caches dédiés
discards c80d374 ajout toString
--
To stop receiving notification emails like this one, please contact
codelutin.com SCM administrator <admin+scm(a)codelutin.com>.
1
0
This is an automated email from the git hooks/post-receive script.
New change to branch feature/8256 in repository tutti.
See https://gitlab.nuiton.org/codelutin/tutti.git
at abb60a4 Utilisation des caches de campagnes
This branch includes the following new commits:
new c80d374 ajout toString
new c0998d6 Revue de l'API de cache pour avoir un cache de haut niveau sur les cruise puis des caches dédiés
new dbdef2d Revue du chargement des caches de campagne
new abb60a4 Utilisation des caches de campagnes
The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "adds" were already present in the repository and have only
been added to this reference.
Detailed log of new commits:
commit abb60a40e675965c84686ccbb512bd9d1328e61b
Author: Tony CHEMIT <chemit(a)codelutin.com>
Date: Sun Apr 17 07:36:09 2016 +0200
Utilisation des caches de campagnes
commit dbdef2da4edd97ac634bc5c4d42a60ae0c63c8cb
Author: Tony CHEMIT <chemit(a)codelutin.com>
Date: Sun Apr 17 07:35:51 2016 +0200
Revue du chargement des caches de campagne
commit c0998d61c99c033888bb6fca3c0131d10c7a9fd0
Author: Tony CHEMIT <chemit(a)codelutin.com>
Date: Sun Apr 17 07:35:26 2016 +0200
Revue de l'API de cache pour avoir un cache de haut niveau sur les cruise puis des caches dédiés
commit c80d374b8be5d6a5e967bffd7f60b9acef7bc1b1
Author: Tony CHEMIT <chemit(a)codelutin.com>
Date: Sun Apr 17 07:34:51 2016 +0200
ajout toString
--
To stop receiving notification emails like this one, please contact
codelutin.com SCM administrator <admin+scm(a)codelutin.com>.
1
4
This is an automated email from the git hooks/post-receive script.
New change to branch develop in repository tutti.
See https://gitlab.nuiton.org/codelutin/tutti.git
from 9b9430d Livrable #8245 Merge branch 'feature/8245' into develop
new 46f455d Correction d'un fire data sur le table model, why ? (See #8257)
new 72ccffb Amélioration code : on arrête de faire dix milles trucs en même temps : j'en ai maaaaaaaaaaare
new cf65593 Livrable #8257 Merge branch 'feature/8257' into develop
The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "adds" were already present in the repository and have only
been added to this reference.
Detailed log of new commits:
commit cf655935f65dfd2ab34e919f00ac2a2a1c73200f
Merge: 9b9430d 72ccffb
Author: Tony CHEMIT <chemit(a)codelutin.com>
Date: Sat Apr 16 12:20:13 2016 +0200
Livrable #8257
Merge branch 'feature/8257' into develop
commit 72ccffb99dc48e2ac8adacbf8cc19c1b22b1952f
Author: Tony CHEMIT <chemit(a)codelutin.com>
Date: Sat Apr 16 12:20:11 2016 +0200
Amélioration code : on arrête de faire dix milles trucs en même temps : j'en ai maaaaaaaaaaare
commit 46f455da51dd68528a9a6b25cdca815a2db56b2a
Author: Tony CHEMIT <chemit(a)codelutin.com>
Date: Sat Apr 16 12:19:49 2016 +0200
Correction d'un fire data sur le table model, why ? (See #8257)
Summary of changes:
.../frequency/SpeciesFrequencyTableModel.java | 302 ++++++++++-----------
.../species/frequency/SpeciesFrequencyUIModel.java | 26 +-
.../actions/ApplySpeciesFrequencyRafaleAction.java | 3 +-
3 files changed, 164 insertions(+), 167 deletions(-)
--
To stop receiving notification emails like this one, please contact
codelutin.com SCM administrator <admin+scm(a)codelutin.com>.
1
3
This is an automated email from the git hooks/post-receive script.
New change to branch develop in repository tutti.
See https://gitlab.nuiton.org/codelutin/tutti.git
from 2aad139 Quand on quitte un écran, on nettoye les validateurs
new 1d6b0ed Mauvais flow, c'est pas faute de l'avoir dit pleins de fois...
new 1a78521 Ajout d'une classe pour gérer les unités
new 138580c Correction de l'apgorithme de comparaision de poids
new 278f703 En avant la musique... création de modèles et controleurs...
new 9844616 Réécriture de la logique du mode de recopie + continue le nettoyage du code
new e2b4392 Correction de l'unité utilisée pour le graphique des poids moyens
new 1028129 Introduction modele pour la partie observations individuelles + du menache
new 9b9430d Livrable #8245 Merge branch 'feature/8245' into develop
The 8 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "adds" were already present in the repository and have only
been added to this reference.
Detailed log of new commits:
commit 9b9430d081a7902c006189fd45e2d90ed017a5fb
Merge: 2aad139 1028129
Author: Tony CHEMIT <chemit(a)codelutin.com>
Date: Sat Apr 16 11:16:24 2016 +0200
Livrable #8245
Merge branch 'feature/8245' into develop
commit 10281292f9f06aace81f0b439edbc021938b063c
Author: Tony CHEMIT <chemit(a)codelutin.com>
Date: Sat Apr 16 11:15:20 2016 +0200
Introduction modele pour la partie observations individuelles + du menache
commit e2b4392dca98d96754cd8ea3d290c63f889b335b
Author: Tony CHEMIT <chemit(a)codelutin.com>
Date: Sat Apr 16 07:56:39 2016 +0200
Correction de l'unité utilisée pour le graphique des poids moyens
commit 9844616e718e71252ef0e82b732b664279cc9986
Author: Tony CHEMIT <chemit(a)codelutin.com>
Date: Fri Apr 15 23:30:14 2016 +0200
Réécriture de la logique du mode de recopie + continue le nettoyage du code
commit 278f70357eabf2563a71be3f617ab0c95efcf6ab
Author: Tony CHEMIT <chemit(a)codelutin.com>
Date: Fri Apr 15 09:52:50 2016 +0200
En avant la musique... création de modèles et controleurs...
commit 138580c9b2f7462a3f4f22f15802586ab8e2026b
Author: Tony CHEMIT <chemit(a)codelutin.com>
Date: Fri Apr 15 09:46:35 2016 +0200
Correction de l'apgorithme de comparaision de poids
commit 1a78521fce03c26f899a8c3bbb68eb8602864070
Author: Tony CHEMIT <chemit(a)codelutin.com>
Date: Fri Apr 15 09:46:20 2016 +0200
Ajout d'une classe pour gérer les unités
commit 1d6b0ed3ab81dbf4b22e88500ee709cdece07d80
Author: Tony CHEMIT <chemit(a)codelutin.com>
Date: Thu Apr 14 17:33:49 2016 +0200
Mauvais flow, c'est pas faute de l'avoir dit pleins de fois...
Summary of changes:
.../entities/referential/TaxonCache.java | 3 +
.../java/fr/ifremer/tutti/type/WeightUnit.java | 15 +-
.../src/main/java/fr/ifremer/tutti/util/Units.java | 13 +
.../accidental/AccidentalBatchUIHandler.java | 2 +-
.../SamplingCodeCellEditor.java | 2 +
.../catches/species/edit/SpeciesBatchRowModel.java | 2 +-
.../species/edit/SpeciesBatchUIHandler.java | 2 +-
.../frequency/AverageWeightsHistogramHandler.java | 156 +++
.../frequency/AverageWeightsHistogramModel.java | 117 +++
.../frequency/FrequenciesHistogramHandler.java | 164 +++
.../frequency/FrequenciesHistogramModel.java | 107 ++
.../IndividualObservationBatchRowModel.java | 38 +-
.../IndividualObservationBatchRowState.java | 61 ++
.../IndividualObservationBatchTableHandler.java | 712 +++++++++++++
.../IndividualObservationBatchTableModel.java | 124 ++-
.../IndividualObservationBatchUIModel.java | 206 ++++
.../IndividualObservationToFrequencyEngine.java | 268 +++++
.../frequency/IndividualObservationUICache.java | 25 +-
.../frequency/SpeciesFrequencyCellComponent.java | 12 +-
.../frequency/SpeciesFrequencyLogRowModel.java | 1 -
.../frequency/SpeciesFrequencyTableModel.java | 312 +++---
.../species/frequency/SpeciesFrequencyUI.jaxx | 2 +-
.../frequency/SpeciesFrequencyUIHandler.java | 1111 +++++---------------
.../species/frequency/SpeciesFrequencyUIModel.java | 418 ++------
.../actions/ApplySpeciesFrequencyRafaleAction.java | 110 +-
.../frequency/actions/DeleteSampleCodeAction.java | 4 +-
.../DeleteSpeciesFrequencyLogRowAction.java | 2 +-
.../frequency/actions/EditSampleCodeAction.java | 4 +-
.../GenerateSpeciesFrequencyLengthStepsAction.java | 59 +-
.../ImportMultiPostSpeciesSupportAction.java | 70 +-
.../frequency/actions/RemoveObservationAction.java | 20 +-
.../actions/ResetSpeciesFrequencyAction.java | 2 +-
.../util/table/AbstractTuttiTableUIModel.java | 14 +-
33 files changed, 2580 insertions(+), 1578 deletions(-)
create mode 100644 tutti-persistence/src/main/java/fr/ifremer/tutti/util/Units.java
create mode 100644 tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/AverageWeightsHistogramHandler.java
create mode 100644 tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/AverageWeightsHistogramModel.java
create mode 100644 tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/FrequenciesHistogramHandler.java
create mode 100644 tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/FrequenciesHistogramModel.java
rename tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/{individualobservation => species/frequency}/IndividualObservationBatchRowModel.java (91%)
create mode 100644 tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/IndividualObservationBatchRowState.java
create mode 100644 tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/IndividualObservationBatchTableHandler.java
rename tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/{individualobservation => species/frequency}/IndividualObservationBatchTableModel.java (69%)
create mode 100644 tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/IndividualObservationBatchUIModel.java
create mode 100644 tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/IndividualObservationToFrequencyEngine.java
--
To stop receiving notification emails like this one, please contact
codelutin.com SCM administrator <admin+scm(a)codelutin.com>.
1
8
This is an automated email from the git hooks/post-receive script.
New change to branch feature/8245 in repository tutti.
See https://gitlab.nuiton.org/codelutin/tutti.git
was 1028129 Introduction modele pour la partie observations individuelles + du menache
This change permanently discards the following revisions:
discards 1028129 Introduction modele pour la partie observations individuelles + du menache
discards e2b4392 Correction de l'unité utilisée pour le graphique des poids moyens
discards 9844616 Réécriture de la logique du mode de recopie + continue le nettoyage du code
discards 278f703 En avant la musique... création de modèles et controleurs...
discards 138580c Correction de l'apgorithme de comparaision de poids
discards 1a78521 Ajout d'une classe pour gérer les unités
discards 1d6b0ed Mauvais flow, c'est pas faute de l'avoir dit pleins de fois...
--
To stop receiving notification emails like this one, please contact
codelutin.com SCM administrator <admin+scm(a)codelutin.com>.
1
0
This is an automated email from the git hooks/post-receive script.
New change to branch feature/8245 in repository tutti.
See https://gitlab.nuiton.org/codelutin/tutti.git
from e2b4392 Correction de l'unité utilisée pour le graphique des poids moyens
new 1028129 Introduction modele pour la partie observations individuelles + du menache
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "adds" were already present in the repository and have only
been added to this reference.
Detailed log of new commits:
commit 10281292f9f06aace81f0b439edbc021938b063c
Author: Tony CHEMIT <chemit(a)codelutin.com>
Date: Sat Apr 16 11:15:20 2016 +0200
Introduction modele pour la partie observations individuelles + du menache
Summary of changes:
.../IndividualObservationBatchTableHandler.java | 84 +--
.../IndividualObservationBatchTableModel.java | 106 +++-
.../IndividualObservationBatchUIModel.java | 206 +++++++
.../IndividualObservationToFrequencyEngine.java | 24 +-
.../frequency/IndividualObservationUICache.java | 24 +-
.../frequency/SpeciesFrequencyCellComponent.java | 11 +-
.../frequency/SpeciesFrequencyTableModel.java | 251 ++++----
.../frequency/SpeciesFrequencyUIHandler.java | 648 +--------------------
.../species/frequency/SpeciesFrequencyUIModel.java | 348 ++---------
.../actions/ApplySpeciesFrequencyRafaleAction.java | 94 +--
.../GenerateSpeciesFrequencyLengthStepsAction.java | 59 +-
.../ImportMultiPostSpeciesSupportAction.java | 69 +--
.../frequency/actions/RemoveObservationAction.java | 14 +-
.../actions/ResetSpeciesFrequencyAction.java | 2 +-
.../util/table/AbstractTuttiTableUIModel.java | 14 +-
15 files changed, 672 insertions(+), 1282 deletions(-)
create mode 100644 tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/IndividualObservationBatchUIModel.java
--
To stop receiving notification emails like this one, please contact
codelutin.com SCM administrator <admin+scm(a)codelutin.com>.
1
1
This is an automated email from the git hooks/post-receive script.
New change to branch feature/8245 in repository tutti.
See https://gitlab.nuiton.org/codelutin/tutti.git
from 9844616 Réécriture de la logique du mode de recopie + continue le nettoyage du code
new e2b4392 Correction de l'unité utilisée pour le graphique des poids moyens
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "adds" were already present in the repository and have only
been added to this reference.
Detailed log of new commits:
commit e2b4392dca98d96754cd8ea3d290c63f889b335b
Author: Tony CHEMIT <chemit(a)codelutin.com>
Date: Sat Apr 16 07:56:39 2016 +0200
Correction de l'unité utilisée pour le graphique des poids moyens
Summary of changes:
.../frequency/AverageWeightsHistogramHandler.java | 2 +-
.../frequency/AverageWeightsHistogramModel.java | 21 ++++----
.../species/frequency/SpeciesFrequencyUIModel.java | 59 +---------------------
3 files changed, 11 insertions(+), 71 deletions(-)
--
To stop receiving notification emails like this one, please contact
codelutin.com SCM administrator <admin+scm(a)codelutin.com>.
1
1
01/01: Réécriture de la logique du mode de recopie + continue le nettoyage du code
by codelutin.com scm 15 Apr '16
by codelutin.com scm 15 Apr '16
15 Apr '16
This is an automated email from the git hooks/post-receive script.
New commit to branch feature/8245 in repository tutti.
See https://gitlab.nuiton.org/codelutin/tutti.git
commit 9844616e718e71252ef0e82b732b664279cc9986
Author: Tony CHEMIT <chemit(a)codelutin.com>
Date: Fri Apr 15 23:30:14 2016 +0200
Réécriture de la logique du mode de recopie + continue le nettoyage du code
---
.../entities/referential/TaxonCache.java | 3 +
.../frequency/FrequenciesHistogramHandler.java | 2 -
.../frequency/FrequenciesHistogramModel.java | 8 +-
.../IndividualObservationBatchRowModel.java | 36 ++-
.../IndividualObservationBatchRowState.java | 61 +++++
.../IndividualObservationBatchTableHandler.java | 285 ++++++++++++---------
.../IndividualObservationBatchTableModel.java | 7 +-
.../IndividualObservationToFrequencyEngine.java | 260 +++++++++++++++++++
.../frequency/SpeciesFrequencyTableModel.java | 32 +--
.../frequency/SpeciesFrequencyUIHandler.java | 280 ++++++--------------
.../species/frequency/SpeciesFrequencyUIModel.java | 20 +-
.../ImportMultiPostSpeciesSupportAction.java | 1 +
.../frequency/actions/RemoveObservationAction.java | 6 +-
13 files changed, 614 insertions(+), 387 deletions(-)
diff --git a/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/TaxonCache.java b/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/TaxonCache.java
index e109c51..c4c34aa 100644
--- a/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/TaxonCache.java
+++ b/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/TaxonCache.java
@@ -120,4 +120,7 @@ public class TaxonCache {
}
+ public boolean containsLengthStepPmfmId(Species species) {
+ return getLengthStepPmfmId(species)!=null;
+ }
}
diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/FrequenciesHistogramHandler.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/FrequenciesHistogramHandler.java
index e741e44..5b5eff6 100644
--- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/FrequenciesHistogramHandler.java
+++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/FrequenciesHistogramHandler.java
@@ -42,8 +42,6 @@ public class FrequenciesHistogramHandler implements Closeable {
SpeciesFrequencyUIModel uiModel = ui.getModel();
SpeciesFrequencyUIHandler uiHandler = ui.getHandler();
-// this.frequencyTableModel = uiHandler.getTableModel();
-
this.model = uiModel.getFrequenciesHistogramModel();
chart = ChartFactory.createXYBarChart(null,
diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/FrequenciesHistogramModel.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/FrequenciesHistogramModel.java
index 0171a41..db0172e 100644
--- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/FrequenciesHistogramModel.java
+++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/FrequenciesHistogramModel.java
@@ -1,6 +1,5 @@
package fr.ifremer.tutti.ui.swing.content.operation.catches.species.frequency;
-import fr.ifremer.tutti.type.WeightUnit;
import org.jdesktop.beans.AbstractSerializableBean;
import org.jfree.data.xy.XYSeries;
import org.jfree.data.xy.XYSeriesCollection;
@@ -28,16 +27,11 @@ public class FrequenciesHistogramModel extends AbstractSerializableBean {
private final XYSeriesCollection dataset;
protected final XYSeries series;
- private final WeightUnit frequencyWeightUnit;
- private final WeightUnit individualObservationWeightUnit;
-
private String title;
private String lengthStepLabelWithUnit;
private Float step;
- public FrequenciesHistogramModel(WeightUnit frequencyWeightUnit, WeightUnit individualObservationWeightUnit) {
- this.frequencyWeightUnit = frequencyWeightUnit;
- this.individualObservationWeightUnit = individualObservationWeightUnit;
+ public FrequenciesHistogramModel() {
series = new XYSeries("", true, false);
diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/IndividualObservationBatchRowModel.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/IndividualObservationBatchRowModel.java
index c22191b..8244875 100644
--- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/IndividualObservationBatchRowModel.java
+++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/IndividualObservationBatchRowModel.java
@@ -60,17 +60,14 @@ public class IndividualObservationBatchRowModel extends AbstractTuttiBeanUIModel
public static final String PROPERTY_DEFAULT_CARACTERISTICS = "defaultCaracteristics";
-// public static final String PROPERTY_SAMPLING_CODE_PREFIX = "samplingCodePrefix";
-//
-// public static final String PROPERTY_SAMPLING_CODE_ID = "samplingCodeId";
+ public static final String PROPERTY_INDIVIDUAL_OBSERVATION_BATCH_ROW_STATE = "individualObservationBatchRowState";
/**
* Delegate edit object.
*
* @since 1.3
*/
- protected final IndividualObservationBatch editObject =
- IndividualObservationBatchs.newIndividualObservationBatch();
+ protected final IndividualObservationBatch editObject = IndividualObservationBatchs.newIndividualObservationBatch();
/**
* Attachments (should never be null).
@@ -93,13 +90,6 @@ public class IndividualObservationBatchRowModel extends AbstractTuttiBeanUIModel
*/
protected final WeightUnit weightUnit;
-// /**
-// * Caracteristique de maturité
-// *
-// * @since 4.5
-// */
-// protected Caracteristic maturityCaracteristic;
-
/**
* @since 4.5
*/
@@ -264,9 +254,14 @@ public class IndividualObservationBatchRowModel extends AbstractTuttiBeanUIModel
@Override
public void setWeight(Float weight) {
- Object oldValue = getWeight();
+ Float oldValue = getWeight();
+ IndividualObservationBatchRowState oldState = new IndividualObservationBatchRowState(getSize(), oldValue, computeValid());
editObject.setWeight(weight);
firePropertyChange(PROPERTY_WEIGHT, oldValue, weight);
+
+ IndividualObservationBatchRowState newState = new IndividualObservationBatchRowState(getSize(), weight, computeValid());
+ firePropertyChange(PROPERTY_INDIVIDUAL_OBSERVATION_BATCH_ROW_STATE, oldState, newState);
+
}
public boolean withWeight() {
@@ -292,9 +287,15 @@ public class IndividualObservationBatchRowModel extends AbstractTuttiBeanUIModel
@Override
public void setSize(Float size) {
- Object oldValue = getSize();
+ Float oldValue = getSize();
+ IndividualObservationBatchRowState oldState = new IndividualObservationBatchRowState(oldValue, getWeight(), computeValid());
+
editObject.setSize(size);
firePropertyChange(PROPERTY_SIZE, oldValue, size);
+
+ IndividualObservationBatchRowState newState = new IndividualObservationBatchRowState(size, getWeight(), computeValid());
+ firePropertyChange(PROPERTY_INDIVIDUAL_OBSERVATION_BATCH_ROW_STATE, oldState, newState);
+
}
public boolean withSize() {
@@ -483,4 +484,11 @@ public class IndividualObservationBatchRowModel extends AbstractTuttiBeanUIModel
return result;
}
+ public boolean computeValid() {
+ CopyIndividualObservationMode copyIndividualObservationMode = getCopyIndividualObservationMode();
+ return copyIndividualObservationMode == CopyIndividualObservationMode.NOTHING
+ || (copyIndividualObservationMode == CopyIndividualObservationMode.SIZE && withSize())
+ || (copyIndividualObservationMode == CopyIndividualObservationMode.ALL && withSize() && withWeight());
+ }
+
}
diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/IndividualObservationBatchRowState.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/IndividualObservationBatchRowState.java
new file mode 100644
index 0000000..8f4085b
--- /dev/null
+++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/IndividualObservationBatchRowState.java
@@ -0,0 +1,61 @@
+package fr.ifremer.tutti.ui.swing.content.operation.catches.species.frequency;
+
+import com.google.common.base.MoreObjects;
+
+import java.util.Objects;
+
+/**
+ * Contient l'état d'une observation individuelle utilisée par les modes de recopie pour savoir ce qu'il faut
+ * déporter dans les mensurations.
+ *
+ * Created on 15/04/16.
+ *
+ * @author Tony Chemit - chemit(a)codelutin.com
+ */
+public class IndividualObservationBatchRowState {
+
+ private final Float size;
+ private final Float weight;
+ private final boolean valid;
+
+ public IndividualObservationBatchRowState(Float size, Float weight, boolean valid) {
+ this.size = size;
+ this.weight = weight;
+ this.valid = valid;
+ }
+
+ public boolean isValid() {
+ return valid;
+ }
+
+ public Float getSize() {
+ return size;
+ }
+
+ public Float getWeight() {
+ return weight;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ IndividualObservationBatchRowState that = (IndividualObservationBatchRowState) o;
+ return Objects.equals(size, that.size) &&
+ Objects.equals(weight, that.weight);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(size, weight);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("size", size)
+ .add("weight", weight)
+ .add("valid", valid)
+ .toString();
+ }
+}
diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/IndividualObservationBatchTableHandler.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/IndividualObservationBatchTableHandler.java
index 8fd6d3b..528f01c 100644
--- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/IndividualObservationBatchTableHandler.java
+++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/IndividualObservationBatchTableHandler.java
@@ -26,6 +26,7 @@ import fr.ifremer.tutti.ui.swing.util.comment.CommentCellEditor;
import fr.ifremer.tutti.ui.swing.util.comment.CommentCellRenderer;
import jaxx.runtime.SwingUtil;
import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.tuple.Pair;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jdesktop.swingx.JXTable;
@@ -48,6 +49,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Objects;
+import java.util.Optional;
import java.util.Set;
import static org.nuiton.i18n.I18n.t;
@@ -84,6 +86,8 @@ public class IndividualObservationBatchTableHandler implements Closeable {
*/
private final PropertyChangeListener individualObservationRowChangedListener;
+ private final IndividualObservationToFrequencyEngine individualObservationToFrequencyEngine;
+
public IndividualObservationBatchTableHandler(SpeciesFrequencyUI ui) {
this.ui = ui;
@@ -92,6 +96,7 @@ public class IndividualObservationBatchTableHandler implements Closeable {
this.individualObservationUICache = new IndividualObservationUICache(uiHandler.getDataContext().getOptionalCruiseSamplingCache().orElse(null), model);
this.individualObservationTable = ui.getObsTable();
this.frequencyTableModel = uiHandler.getTableModel();
+ this.individualObservationToFrequencyEngine = new IndividualObservationToFrequencyEngine(model.getIndividualObservationWeightUnit());
List<Caracteristic> maturityCaracteristics = new ArrayList<>(uiHandler.getDataContext().getMaturityCaracteristics());
@@ -107,69 +112,112 @@ public class IndividualObservationBatchTableHandler implements Closeable {
CaracteristicQualitativeValue maturity = model.getMaturityValue(row);
switch (propertyName) {
- case IndividualObservationBatchRowModel.PROPERTY_SIZE: {
+ case IndividualObservationBatchRowModel.PROPERTY_INDIVIDUAL_OBSERVATION_BATCH_ROW_STATE: {
- Float oldValue = (Float) evt.getOldValue();
- Float newValue = (Float) evt.getNewValue();
+ IndividualObservationBatchRowState oldValue = (IndividualObservationBatchRowState) evt.getOldValue();
+ IndividualObservationBatchRowState newValue = (IndividualObservationBatchRowState) evt.getNewValue();
- if (oldValue != null) {
- individualObservationUICache.decrementsObservationNb(gender, maturity, oldValue, row.getSamplingCode());
- }
- if (newValue != null) {
- individualObservationUICache.incrementsObservationNb(gender, maturity, newValue, row.getSamplingCode());
- }
+ Optional<IndividualObservationToFrequencyEngine.FrequencyUpdate> optionalFrequencyUpdate =
+ individualObservationToFrequencyEngine.computeFrequencyUpdate(model.getCopyIndividualObservationMode(), oldValue, newValue);
- // we only update the frequencies if the row is valid
- if (row.isValid() && model.mustCopyIndividualObservationSize()) {
+ if (optionalFrequencyUpdate.isPresent()) {
- if (oldValue != null) {
- frequencyTableModel.decrementFrequencyRowsNumbers(oldValue);
- }
- if (newValue != null) {
- frequencyTableModel.incrementFrequencyRowsNumbers(newValue);
- }
+ IndividualObservationToFrequencyEngine.FrequencyUpdate frequencyUpdate = optionalFrequencyUpdate.get();
- if (model.isCopyIndividualObservationAll() && row.withWeight()) {
- float weight = row.getWeight();
- if (oldValue != null) {
- frequencyTableModel.removeWeightToFrequencyRow(oldValue, weight);
- }
- if (newValue != null) {
- frequencyTableModel.addWeightToFrequencyRow(newValue, weight);
- }
+ Optional<Float> optionalDecrementSize = frequencyUpdate.getDecrementSize();
+ if (optionalDecrementSize.isPresent()) {
+ float lengthStepToDecrement = optionalDecrementSize.get();
+ frequencyTableModel.decrementFrequencyRowsNumbers(lengthStepToDecrement);
+ individualObservationUICache.decrementsObservationNb(gender, maturity, lengthStepToDecrement, row.getSamplingCode());
}
- }
- }
- break;
-
- case IndividualObservationBatchRowModel.PROPERTY_WEIGHT:
- if (row.isValid() && model.isCopyIndividualObservationAll()) {
-
- Float oldValue = (Float) evt.getOldValue();
- Float newValue = (Float) evt.getNewValue();
- Float weightToAdd;
-
- if (oldValue == null) {
- weightToAdd = newValue;
- } else if (newValue == null) {
- weightToAdd = -oldValue;
-
- } else {
- weightToAdd = newValue - oldValue;
+ Optional<Float> optionalIncrementSize = frequencyUpdate.getIncrementSize();
+ if (optionalIncrementSize.isPresent()) {
+ float lengthStepToIncrement = optionalIncrementSize.get();
+ frequencyTableModel.incrementFrequencyRowsNumbers(lengthStepToIncrement);
+ individualObservationUICache.incrementsObservationNb(gender, maturity, lengthStepToIncrement, row.getSamplingCode());
}
- WeightUnit weightUnit = model.getWeightUnit();
+ Optional<Pair<Float, Float>> optionalSubstractWeight = frequencyUpdate.getSubstractWeight();
+ if (optionalSubstractWeight.isPresent()) {
+ Pair<Float, Float> substractWeight = optionalSubstractWeight.get();
+ frequencyTableModel.removeWeightToFrequencyRow(substractWeight.getKey(), substractWeight.getValue());
+ }
- if (weightUnit.isNotNullNorZero(weightToAdd)) {
- if (weightUnit.isGreaterThanZero(weightToAdd)) {
- frequencyTableModel.addWeightToFrequencyRow(row, weightToAdd);
- } else {
- frequencyTableModel.removeWeightToFrequencyRow(row, -weightToAdd);
- }
+ Optional<Pair<Float, Float>> optionalAddWeight = frequencyUpdate.getAddWeight();
+ if (optionalAddWeight.isPresent()) {
+ Pair<Float, Float> addWeight = optionalAddWeight.get();
+ frequencyTableModel.addWeightToFrequencyRow(addWeight.getKey(), addWeight.getValue());
}
+
}
- break;
+
+ }
+ break;
+
+// case IndividualObservationBatchRowModel.PROPERTY_SIZE: {
+//
+// Float oldValue = (Float) evt.getOldValue();
+// Float newValue = (Float) evt.getNewValue();
+//
+// if (oldValue != null) {
+// individualObservationUICache.decrementsObservationNb(gender, maturity, oldValue, row.getSamplingCode());
+// }
+// if (newValue != null) {
+// individualObservationUICache.incrementsObservationNb(gender, maturity, newValue, row.getSamplingCode());
+// }
+//
+// // we only update the frequencies if the row is valid
+// if (row.isValid() && model.mustCopyIndividualObservationSize()) {
+//
+// if (oldValue != null) {
+// frequencyTableModel.decrementFrequencyRowsNumbers(oldValue);
+// }
+// if (newValue != null) {
+// frequencyTableModel.incrementFrequencyRowsNumbers(newValue);
+// }
+//
+// if (model.isCopyIndividualObservationAll() && row.withWeight()) {
+// float weight = row.getWeight();
+// if (oldValue != null) {
+// frequencyTableModel.removeWeightToFrequencyRow(oldValue, weight);
+// }
+// if (newValue != null) {
+// frequencyTableModel.addWeightToFrequencyRow(newValue, weight);
+// }
+// }
+// }
+// }
+// break;
+//
+// case IndividualObservationBatchRowModel.PROPERTY_WEIGHT:
+// if (row.isValid() && model.isCopyIndividualObservationAll()) {
+//
+// Float oldValue = (Float) evt.getOldValue();
+// Float newValue = (Float) evt.getNewValue();
+// Float weightToAdd;
+//
+// if (oldValue == null) {
+// weightToAdd = newValue;
+//
+// } else if (newValue == null) {
+// weightToAdd = -oldValue;
+//
+// } else {
+// weightToAdd = newValue - oldValue;
+// }
+//
+// WeightUnit weightUnit = model.getWeightUnit();
+//
+// if (weightUnit.isNotNullNorZero(weightToAdd)) {
+// if (weightUnit.isGreaterThanZero(weightToAdd)) {
+// frequencyTableModel.addWeightToFrequencyRow(row, weightToAdd);
+// } else {
+// frequencyTableModel.removeWeightToFrequencyRow(row, -weightToAdd);
+// }
+// }
+// }
+// break;
case IndividualObservationBatchRowModel.PROPERTY_DEFAULT_CARACTERISTICS:
case IndividualObservationBatchRowModel.PROPERTY_CARACTERISTICS:
@@ -219,26 +267,27 @@ public class IndividualObservationBatchTableHandler implements Closeable {
}
break;
- case IndividualObservationBatchRowModel.PROPERTY_VALID:
- // if the row's valid state changes, then remove or readd it to the frequencies
- if (!model.isRowComputationInProgress()) {
- boolean oldValue = (boolean) evt.getOldValue();
- boolean newValue = (boolean) evt.getNewValue();
-
- if (oldValue && model.mustCopyIndividualObservationSize()) {
-
- frequencyTableModel.decrementFrequencyRowsNumbers(row);
- }
- if (newValue) {
- if (model.mustCopyIndividualObservationSize()) {
- frequencyTableModel.incrementFrequencyRowsNumbers(row);
- }
- if (model.isCopyIndividualObservationAll() && row.withWeight()) {
- frequencyTableModel.addWeightToFrequencyRow(row, row.getWeight());
- }
- }
- }
- break;
+// case IndividualObservationBatchRowModel.PROPERTY_VALID:
+// // if the row's valid state changes, then remove or readd it to the frequencies
+// if (!model.isRowComputationInProgress()) {
+//
+// boolean oldValue = (boolean) evt.getOldValue();
+// boolean newValue = (boolean) evt.getNewValue();
+//
+// if (oldValue && model.mustCopyIndividualObservationSize()) {
+//
+// frequencyTableModel.decrementFrequencyRowsNumbers(row);
+// }
+// if (newValue) {
+// if (model.mustCopyIndividualObservationSize()) {
+// frequencyTableModel.incrementFrequencyRowsNumbers(row);
+// }
+// if (model.isCopyIndividualObservationAll() && row.withWeight()) {
+// frequencyTableModel.addWeightToFrequencyRow(row, row.getWeight());
+// }
+// }
+// }
+// break;
}
model.recomputeIndividualObservationRowValidState(row);
@@ -561,59 +610,7 @@ public class IndividualObservationBatchTableHandler implements Closeable {
}
- public void setMaturityCaracteristic(Caracteristic maturityCaracteristic) {
- model.setMaturityCaracteristic(maturityCaracteristic);
- if (maturityCaracteristic != null) {
- addMaturityCaracteristicColumnToModel(maturityCaracteristic);
- }
- }
-
- public void addMaturityCaracteristicColumnToModel(Caracteristic caracteristic) {
-
- // remove the row sorter while we add the new column
- individualObservationTable.setRowSorter(null);
- individualObservationTable.setAutoCreateRowSorter(false);
-
- TableColumnModelExt columnModel = (TableColumnModelExt) individualObservationTable.getColumnModel();
-
- ColumnIdentifier<IndividualObservationBatchRowModel> maturityColumnId = uiHandler.addCaracteristicColumnToModel(individualObservationTable,
- columnModel,
- caracteristic);
-
- Objects.requireNonNull(maturityColumnId);
- this.maturityColumnId = maturityColumnId;
-
- individualObservationTableModel.addMaturityIdentifier(maturityColumnId);
-
- // on cherche le bon index où insérer la colonne maturité (avant les autres caractéristiques, mais elle peut etre cachee)
- int modelIndex = columnModel.getColumnExt(IndividualObservationBatchTableModel.OTHER_CARACTERISTICS).getModelIndex();
- int indexToMove = individualObservationTable.convertColumnIndexToView(modelIndex);
-
- // si la colonne autres caracteristiques est cachée, alors on cherche la première colonne suivante non cachée
- int columnCount = columnModel.getColumnCount(true);
- while (indexToMove == -1 && modelIndex < columnCount) {
- indexToMove = individualObservationTable.convertColumnIndexToView(modelIndex);
- modelIndex++;
- }
- // si une colonne après celle des autres caractéristiques est visible, on déplace la maturité avant cette colonne
- // sinon, on laisse la maturité à la fin
- if (modelIndex != -1) {
- individualObservationTable.moveColumn(columnModel.getColumnCount() - 1, indexToMove);
- }
- // reset the row sorter
- individualObservationTable.setAutoCreateRowSorter(true);
-
- }
-
- public void setIndividualObservationRows(List<IndividualObservationBatchRowModel> obsRows) {
-
- model.setIndividualObservationRows(obsRows);
- individualObservationTableModel.setRows(obsRows);
- model.recomputeIndividualObservationRowsValidateState();
-
- }
-
- public void initCaracteristicValues(SpeciesBatchRowModel speciesBatch) {
+ public void editBatch(SpeciesBatchRowModel speciesBatch, List<IndividualObservationBatchRowModel> individualObservationRows) {
CaracteristicMap sampleCategoryValues = new CaracteristicMap();
Iterator<SampleCategory<?>> iterator = speciesBatch.iterator();
@@ -625,6 +622,10 @@ public class IndividualObservationBatchTableHandler implements Closeable {
individualObservationTableModel.setDefaultCaracteristicValues(sampleCategoryValues);
model.setNotEditableCaracteristic(sampleCategoryValues.keySet());
+ model.setIndividualObservationRows(individualObservationRows);
+ individualObservationTableModel.setRows(individualObservationRows);
+ model.recomputeIndividualObservationRowsValidateState();
+
}
public boolean isSampleCodeMenusEnabled(int modelRowIndex) {
@@ -656,7 +657,41 @@ public class IndividualObservationBatchTableHandler implements Closeable {
model.setMaturityCaracteristic(maturityCaracteristic);
if (maturityCaracteristic != null) {
- addMaturityCaracteristicColumnToModel(maturityCaracteristic);
+
+
+ // remove the row sorter while we add the new column
+ individualObservationTable.setRowSorter(null);
+ individualObservationTable.setAutoCreateRowSorter(false);
+
+ TableColumnModelExt columnModel = (TableColumnModelExt) individualObservationTable.getColumnModel();
+
+ ColumnIdentifier<IndividualObservationBatchRowModel> maturityColumnId = uiHandler.addCaracteristicColumnToModel(individualObservationTable,
+ columnModel,
+ maturityCaracteristic);
+
+ Objects.requireNonNull(maturityColumnId);
+ this.maturityColumnId = maturityColumnId;
+
+ individualObservationTableModel.addMaturityIdentifier(maturityColumnId);
+
+ // on cherche le bon index où insérer la colonne maturité (avant les autres caractéristiques, mais elle peut etre cachee)
+ int modelIndex = columnModel.getColumnExt(IndividualObservationBatchTableModel.OTHER_CARACTERISTICS).getModelIndex();
+ int indexToMove = individualObservationTable.convertColumnIndexToView(modelIndex);
+
+ // si la colonne autres caracteristiques est cachée, alors on cherche la première colonne suivante non cachée
+ int columnCount = columnModel.getColumnCount(true);
+ while (indexToMove == -1 && modelIndex < columnCount) {
+ indexToMove = individualObservationTable.convertColumnIndexToView(modelIndex);
+ modelIndex++;
+ }
+ // si une colonne après celle des autres caractéristiques est visible, on déplace la maturité avant cette colonne
+ // sinon, on laisse la maturité à la fin
+ if (modelIndex != -1) {
+ individualObservationTable.moveColumn(columnModel.getColumnCount() - 1, indexToMove);
+ }
+ // reset the row sorter
+ individualObservationTable.setAutoCreateRowSorter(true);
+
}
}
diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/IndividualObservationBatchTableModel.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/IndividualObservationBatchTableModel.java
index 690f9e5..0dca87c 100644
--- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/IndividualObservationBatchTableModel.java
+++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/IndividualObservationBatchTableModel.java
@@ -168,8 +168,8 @@ public class IndividualObservationBatchTableModel extends AbstractApplicationTab
@Override
public IndividualObservationBatchRowModel createNewRow() {
- IndividualObservationBatchRowModel result =
- new IndividualObservationBatchRowModel(weightUnit, defaultCaracteristicsMap);
+ IndividualObservationBatchRowModel result = new IndividualObservationBatchRowModel(weightUnit, defaultCaracteristicsMap);
+ result.setCopyIndividualObservationMode(uiModel.getCopyIndividualObservationMode());
// by default empty row is not valid
result.setValid(false);
@@ -265,8 +265,7 @@ public class IndividualObservationBatchTableModel extends AbstractApplicationTab
List<IndividualObservationBatchRowModel> obsRows = new ArrayList<>();
- setRows(new ArrayList<>());
-
+ //FIXME Faire un check sur la méthode de mensuration qui doit être la même
if (CollectionUtils.isNotEmpty(individualObservations)) {
CopyIndividualObservationMode copyIndividualObservationMode = null;
diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/IndividualObservationToFrequencyEngine.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/IndividualObservationToFrequencyEngine.java
new file mode 100644
index 0000000..9254f46
--- /dev/null
+++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/IndividualObservationToFrequencyEngine.java
@@ -0,0 +1,260 @@
+package fr.ifremer.tutti.ui.swing.content.operation.catches.species.frequency;
+
+import com.google.common.base.MoreObjects;
+import com.google.common.base.Preconditions;
+import fr.ifremer.tutti.persistence.entities.data.CopyIndividualObservationMode;
+import fr.ifremer.tutti.type.WeightUnit;
+import org.apache.commons.lang3.tuple.Pair;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.util.Objects;
+import java.util.Optional;
+
+/**
+ * Pour générer ce qui doit être recopié depuis une observation individuelle vers les mensurations lors d'une
+ * modification d'une observation individuelle.
+ *
+ * Created on 15/04/16.
+ *
+ * @author Tony Chemit - chemit(a)codelutin.com
+ */
+public class IndividualObservationToFrequencyEngine {
+
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(IndividualObservationToFrequencyEngine.class);
+
+ private final WeightUnit individualObservationWeightUnit;
+
+ public IndividualObservationToFrequencyEngine(WeightUnit individualObservationWeightUnit) {
+ this.individualObservationWeightUnit = individualObservationWeightUnit;
+ }
+
+ /**
+ * Ce qui doit être fait sur la table des mensurations suite à une modification d'une observation individuelle.
+ */
+ public static class FrequencyUpdate {
+
+ /**
+ * la taille dont il faut décrémenter la classe de taille.
+ */
+ private final Float decrementSize;
+ /**
+ * la taille dont il faut incrémenter la classe de taille.
+ */
+ private final Float incrementSize;
+
+ /**
+ * Le poids à soustraire du poids total de la classe de taille en clef.
+ */
+ private final Pair<Float, Float> substractWeight;
+ /**
+ * Le poids à ajouter au poids total de la classe de taille en clef.
+ */
+ private final Pair<Float, Float> addWeight;
+
+ private FrequencyUpdate(Float decrementSize, Float incrementSize, Pair<Float, Float> substractWeight, Pair<Float, Float> addWeight) {
+ this.decrementSize = decrementSize;
+ this.incrementSize = incrementSize;
+ this.substractWeight = substractWeight;
+ this.addWeight = addWeight;
+ }
+
+ public Optional<Float> getDecrementSize() {
+ return Optional.ofNullable(decrementSize);
+ }
+
+ public Optional<Float> getIncrementSize() {
+ return Optional.ofNullable(incrementSize);
+ }
+
+ public Optional<Pair<Float, Float>> getSubstractWeight() {
+ return Optional.ofNullable(substractWeight);
+ }
+
+ public Optional<Pair<Float, Float>> getAddWeight() {
+ return Optional.ofNullable(addWeight);
+ }
+
+ @Override
+ public String toString() {
+ MoreObjects.ToStringHelper toStringHelper = MoreObjects.toStringHelper(this);
+ if (decrementSize != null) {
+ toStringHelper.add("decrementSize", decrementSize);
+ }
+ if (incrementSize != null) {
+ toStringHelper.add("incrementSize", incrementSize);
+ }
+ if (substractWeight != null) {
+ toStringHelper.add("substractWeight", substractWeight);
+ }
+ if (addWeight != null) {
+ toStringHelper.add("addWeight", addWeight);
+ }
+ return toStringHelper.toString();
+ }
+
+ }
+
+ public Optional<FrequencyUpdate> computeFrequencyUpdate(CopyIndividualObservationMode copyIndividualObservationMode,
+ IndividualObservationBatchRowState oldState,
+ IndividualObservationBatchRowState newState) {
+
+ FrequencyUpdate result;
+ switch (copyIndividualObservationMode) {
+
+ case ALL:
+ result = computeFrequencyUpdateForSizeAndWeight(oldState, newState);
+ if (log.isInfoEnabled()) {
+ log.info("[Copy Mode All] result: " + result);
+ }
+ break;
+
+ case SIZE:
+ result = computeFrequencyUpdateForSizeOnly(oldState, newState);
+ if (log.isInfoEnabled()) {
+ log.info("[Copy Mode Size] result: " + (result == null ? "No size changed." : result));
+ }
+ break;
+
+ case NOTHING:
+ if (log.isDebugEnabled()) {
+ log.debug("[Copy Mode None] Do nothing.");
+ }
+ result = null;
+ break;
+
+ default:
+ throw new IllegalStateException("Can't come here");
+
+ }
+
+ return Optional.ofNullable(result);
+
+ }
+
+ public FrequencyUpdate computeFrequencyUpdateForSizeOnly(IndividualObservationBatchRowState oldState, IndividualObservationBatchRowState newState) {
+
+ Objects.requireNonNull(oldState);
+ Objects.requireNonNull(newState);
+
+ Float oldSize = oldState.getSize();
+ Float newSize = newState.getSize();
+ boolean sizeChanged = !Objects.equals(oldSize, newSize);
+
+ FrequencyUpdate frequencyUpdate;
+
+ if (sizeChanged) {
+
+ Float decrementSize = null;
+ Float incrementSize = null;
+
+ if (oldState.isValid()) {
+ decrementSize = oldSize;
+ }
+
+ if (newState.isValid()) {
+ incrementSize = newSize;
+ }
+
+ frequencyUpdate = new FrequencyUpdate(decrementSize, incrementSize, null, null);
+
+ } else {
+
+ frequencyUpdate = null;
+
+ }
+
+ return frequencyUpdate;
+
+ }
+
+ public FrequencyUpdate computeFrequencyUpdateForSizeAndWeight(IndividualObservationBatchRowState oldState, IndividualObservationBatchRowState newState) {
+
+ Objects.requireNonNull(oldState);
+ Objects.requireNonNull(newState);
+
+ Float newSize = newState.getSize();
+ Float oldSize = oldState.getSize();
+ boolean sizeChanged = !Objects.equals(oldSize, newSize);
+
+ Float newWeight = newState.getWeight();
+ Float oldWeight = oldState.getWeight();
+ boolean weightChanged = !Objects.equals(oldWeight, newWeight);
+
+ Preconditions.checkState(sizeChanged || weightChanged);
+
+ boolean oldStateValid = oldState.isValid();
+ boolean newStateValid = newState.isValid();
+
+ Float decrementSize = null;
+ Float incrementSize = null;
+
+ Pair<Float, Float> substractWeight = null;
+ Pair<Float, Float> addWeight = null;
+
+ if (sizeChanged) {
+
+ if (oldStateValid) {
+
+ decrementSize = oldSize;
+ substractWeight = Pair.of(oldSize, oldWeight);
+
+ }
+
+ if (newStateValid) {
+
+ incrementSize = newSize;
+ addWeight = Pair.of(newSize, newWeight);
+
+ }
+
+ }
+
+ if (weightChanged) {
+
+ // la classe de taille n'a pas changée, on calcule le delta de poids à ajouter ou supprimer sur la classe de taille
+
+ Float weightToAdd;
+
+ if (oldStateValid && newStateValid) {
+
+ weightToAdd = newWeight - oldWeight;
+
+ } else if (oldStateValid) {
+
+ decrementSize = oldSize;
+ weightToAdd = -oldWeight;
+
+ } else if (newStateValid) {
+
+ incrementSize = newSize;
+ weightToAdd = newWeight;
+
+ } else {
+
+ // forcement au moins un des deux états est valide car le poids a changé...
+ throw new IllegalStateException("Can't come here!");
+
+ }
+
+ if (individualObservationWeightUnit.isGreaterThanZero(weightToAdd)) {
+
+ // Ajout
+ addWeight = Pair.of(newSize, weightToAdd);
+
+ } else {
+
+ // Suppression
+ substractWeight = Pair.of(newSize, -weightToAdd);
+
+ }
+
+ }
+
+ return new FrequencyUpdate(decrementSize, incrementSize, substractWeight, addWeight);
+
+ }
+
+
+}
diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyTableModel.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyTableModel.java
index 3cd8750..6576a67 100644
--- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyTableModel.java
+++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyTableModel.java
@@ -96,10 +96,6 @@ public class SpeciesFrequencyTableModel extends AbstractApplicationTableModel<Sp
protected transient PropertyChangeListener onNumberChangedListener;
-// protected final XYSeries frequenciesSeries;
-//
-// protected final XYSeries averageWeightsSeries;
-
public SpeciesFrequencyTableModel(WeightUnit weightUnit,
WeightUnit individualObservationWeightUnit,
TableColumnModelExt columnModel,
@@ -109,8 +105,6 @@ public class SpeciesFrequencyTableModel extends AbstractApplicationTableModel<Sp
this.individualObservationWeightUnit = individualObservationWeightUnit;
this.uiModel = uiModel;
this.modelCache = uiModel.cache;
-// this.frequenciesSeries = uiModel.getFrequenciesHistogramModel().getDataset().getSeries(0);
-// this.averageWeightsSeries = uiModel.getAverageWeightsHistogramModel().getDataset().getSeries(0);
setNoneEditableCols(RTP_COMPUTED_WEIGHT);
}
@@ -224,7 +218,6 @@ public class SpeciesFrequencyTableModel extends AbstractApplicationTableModel<Sp
if (newRows != null) {
for (SpeciesFrequencyRowModel row : newRows) {
- dettachListeners(row); // prevent leaks!
attachListeners(row);
}
@@ -423,6 +416,8 @@ public class SpeciesFrequencyTableModel extends AbstractApplicationTableModel<Sp
private void attachListeners(SpeciesFrequencyRowModel result) {
+ dettachListeners(result); // prevent leaks!
+
result.addPropertyChangeListener(SpeciesFrequencyRowModel.PROPERTY_LENGTH_STEP, getOnLengthStepChangedListener());
result.addPropertyChangeListener(SpeciesFrequencyRowModel.PROPERTY_WEIGHT, getOnWeightChangedListener());
result.addPropertyChangeListener(SpeciesFrequencyRowModel.PROPERTY_NUMBER, getOnNumberChangedListener());
@@ -531,19 +526,13 @@ public class SpeciesFrequencyTableModel extends AbstractApplicationTableModel<Sp
}
- public void addWeightToFrequencyRow(IndividualObservationBatchRowModel row, float weight) {
- if (row.withSize()) {
- addWeightToFrequencyRow(row.getSize(), weight);
- }
- }
-
public void addWeightToFrequencyRow(float lengthStep, float weight) {
if (log.isInfoEnabled()) {
log.info("add weight to frequency (lengthStep: " + lengthStep + "): " + weight);
}
- Preconditions.checkState(weightUnit.isGreaterThanZero(weight));
+ Preconditions.checkState(!weightUnit.isSmallerThanZero(weight));
SpeciesFrequencyRowModel row = getOrCreateRowForLengthStep(lengthStep);
@@ -555,19 +544,13 @@ public class SpeciesFrequencyTableModel extends AbstractApplicationTableModel<Sp
}
- public void removeWeightToFrequencyRow(IndividualObservationBatchRowModel row, float weight) {
- if (row.withSize()) {
- removeWeightToFrequencyRow(row.getSize(), weight);
- }
- }
-
public void removeWeightToFrequencyRow(float lengthStep, float weight) {
if (log.isInfoEnabled()) {
log.info("remove weight to frequency (lengthStep: " + lengthStep + "): " + weight);
}
- Preconditions.checkState(weightUnit.isGreaterThanZero(weight));
+ Preconditions.checkState(!weightUnit.isSmallerThanZero(weight));
Optional<SpeciesFrequencyRowModel> optionalRow = getOptionalRowForLengthStep(lengthStep);
@@ -575,11 +558,13 @@ public class SpeciesFrequencyTableModel extends AbstractApplicationTableModel<Sp
SpeciesFrequencyRowModel row = optionalRow.get();
+ //FIXME on n'en sait rien que c'est ce type de poids.
// conversion de poids
weight = Weights.convert(uiModel.getIndividualObservationWeightUnit(), weightUnit, weight);
row.removeFromWeight(weight);
updateRow(row);
+
}
}
@@ -588,6 +573,7 @@ public class SpeciesFrequencyTableModel extends AbstractApplicationTableModel<Sp
List<SpeciesFrequencyRowModel> result = new ArrayList<>();
+ //FIXME Faire un check sur la méthode de mensuration qui doit être la même
if (CollectionUtils.isNotEmpty(incomingRows)) {
for (SpeciesFrequencyRowModel rowModel : incomingRows) {
@@ -600,6 +586,10 @@ public class SpeciesFrequencyTableModel extends AbstractApplicationTableModel<Sp
}
+ // always sort row by their length
+ // see http://forge.codelutin.com/issues/2482
+ Collections.sort(result);
+
return result;
}
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 d163a03..b4929b2 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
@@ -849,24 +849,17 @@ public class SpeciesFrequencyUIHandler extends AbstractTuttiTableUIHandler<Speci
SpeciesFrequencyUIModel model = getModel();
Objects.requireNonNull(title, "title can't be null here ?!");
-// if (title != null) {
model.getAverageWeightsHistogramModel().setTitle(title);
model.getFrequenciesHistogramModel().setTitle(title);
-// frequenciesHistogramPopup.setTitle(title + t("tutti.editSpeciesFrequencies.title"));
-// averageWeightsHistogramPopup.setTitle(title + weightUnit.decorateLabel(t("tutti.editSpeciesFrequencies.field.graphAverageWeight")));
-
-// }
frequencyEditor = editor;
-
model.setNextEditableRowIndex(frequencyEditor.getNextEditableRowIndex());
List<SpeciesFrequencyRowModel> frequency = speciesBatch.getFrequency();
List<IndividualObservationBatchRowModel> individualObservations = speciesBatch.getIndividualObservation();
-
model.setInitBatchEdition(true);
model.setCanDisplayNotifications(false);
@@ -905,7 +898,7 @@ public class SpeciesFrequencyUIHandler extends AbstractTuttiTableUIHandler<Speci
}
- getModel().setRtp(rtp);
+ model.setRtp(rtp);
// init maturity caracteristic
individualObservationBatchTableHandler.initMaturityCaracteristic(speciesProtocol);
@@ -1704,8 +1697,8 @@ public class SpeciesFrequencyUIHandler extends AbstractTuttiTableUIHandler<Speci
ui.getDeleteSampleCodeMenu().setEnabled(sampleCodeMenusEnabled);
}
-
public void loadFrequenciesAndObservations(List<SpeciesFrequencyRowModel> frequency, List<IndividualObservationBatchRowModel> individualObservations) {
+
SpeciesFrequencyUIModel model = getModel();
SpeciesBatchRowModel speciesBatch = model.getBatch();
@@ -1714,74 +1707,25 @@ public class SpeciesFrequencyUIHandler extends AbstractTuttiTableUIHandler<Speci
try {
- FrequencyConfigurationMode mode = FrequencyConfigurationMode.FREQUENCIES;
- FrequencyConfigurationMode frequenciesMode = FrequencyConfigurationMode.AUTO_GEN;
+ Integer number = speciesBatch.getNumber();
+ model.setSimpleCount(number);
model.setTotalNumber(null);
model.setTotalComputedWeight(null);
model.setTotalWeight(null);
- model.setSimpleCount(null);
-
-// Caracteristic lengthStepCaracteristic = null;
-
-// List<SpeciesFrequencyRowModel> rows = new ArrayList<>();
-// List<IndividualObservationBatchRowModel> obsRows = new ArrayList<>();
Species species = speciesBatch.getSpecies();
-// IndividualObservationBatchTableModel obsTableModel = getObsTableModel();
-// obsTableModel.setSpecies(species);
-
-// SamplingCodePrefix samplingCodePrefix = new SamplingCodePrefix(getConfig().getSamplingCodePrefix(), decorate(species, DecoratorService.WITH_SURVEY_CODE_NO_NAME));
-// obsTableModel.setSamplingCodePrefix(samplingCodePrefix);
model.setTotalWeight(speciesBatch.getWeight());
- //
- // try to load existing frequency
- //
-
- List<SpeciesFrequencyRowModel> rows = getTableModel().loadRows(frequency);
-
- Caracteristic lengthStepCaracteristic = null;
-
- if (!rows.isEmpty()) {
+ List<SpeciesFrequencyRowModel> frequencyRows = getTableModel().loadRows(frequency);
- SpeciesFrequencyRowModel firstFrequencyRow = frequency.get(0);
- lengthStepCaracteristic = firstFrequencyRow.getLengthStepCaracteristic();
- if (log.isInfoEnabled()) {
- log.info("Use existing lengthStep caracteristic / step from first existing frequency: " + decorate(lengthStepCaracteristic));
- }
+ List<IndividualObservationBatchRowModel> individualObservationRows = individualObservationBatchTableHandler.loadIndividualObservations(species, individualObservations);
+ if (log.isDebugEnabled()) {
+ log.debug("Will edit batch row: " + speciesBatch + " with " + frequencyRows.size() + " frequencies and " + individualObservationRows.size() + " indivudual observations.");
}
-// if (CollectionUtils.isNotEmpty(frequency)) {
-//
-// SpeciesFrequencyTableModel tableModel = getTableModel();
-//
-// for (SpeciesFrequencyRowModel rowModel : frequency) {
-//
-// SpeciesFrequencyRowModel newRow = tableModel.createNewRow(false, false);
-// newRow.copy(rowModel);
-// rows.add(newRow);
-//
-// }
-//
-// // use first frequency row length step caracteristics
-//
-// SpeciesFrequencyRowModel rowModel = frequency.get(0);
-// lengthStepCaracteristic = rowModel.getLengthStepCaracteristic();
-//
-// if (log.isInfoEnabled()) {
-// log.info("Use existing lengthStep caracteristic / step " + decorate(lengthStepCaracteristic));
-// }
-// }
-
- //
- // try to load existing individual observations
- //
-
- List<IndividualObservationBatchRowModel> individualObservationRows = individualObservationBatchTableHandler.loadIndividualObservations(species, individualObservations);
-
CopyIndividualObservationMode copyIndividualObservationMode;
if (individualObservationRows.isEmpty()) {
@@ -1792,158 +1736,44 @@ public class SpeciesFrequencyUIHandler extends AbstractTuttiTableUIHandler<Speci
IndividualObservationBatchRowModel firstIndividualObservationRow = individualObservationRows.get(0);
copyIndividualObservationMode = firstIndividualObservationRow.getCopyIndividualObservationMode();
- if (lengthStepCaracteristic == null) {
-
- lengthStepCaracteristic = firstIndividualObservationRow.getLengthStepCaracteristic();
-
- if (log.isInfoEnabled()) {
- log.info("Use existing lengthStep caracteristic / step from first individual observation : " + decorate(lengthStepCaracteristic));
- }
-
- }
-
}
if (log.isInfoEnabled()) {
log.info("CopyIndividualObservationMode: " + copyIndividualObservationMode);
}
-// if (CollectionUtils.isNotEmpty(individualObservations)) {
-//
-// IndividualObservationBatchTableModel tableModel = getObsTableModel();
-// tableModel.setRows(new ArrayList<>());
-//
-// int rankOrder = 1;
-// for (IndividualObservationBatchRowModel rowModel : individualObservations) {
-//
-// CopyIndividualObservationMode incomingCopyIndividualObservationMode = rowModel.getCopyIndividualObservationMode();
-// Objects.requireNonNull(incomingCopyIndividualObservationMode, "Mode de recopie non trouvé sur l'observation individuelle: " + rowModel.getId());
-// if (copyIndividualObservationMode == null) {
-// copyIndividualObservationMode = incomingCopyIndividualObservationMode;
-// } else {
-// if (copyIndividualObservationMode != incomingCopyIndividualObservationMode) {
-// throw new IllegalStateException("Plusieurs modes de recopie trouvés sur les observations individuelles du lot, ce qui est impossible");
-// }
-// }
-// IndividualObservationBatchRowModel newRow = tableModel.createNewRow();
-// newRow.copy(rowModel);
-// newRow.setRankOrder(rankOrder++);
-// newRow.addPropertyChangeListener(obsChangedListener);
-// newRow.setValid(true);
-//
-// model.moveMaturityValueFromCaracteristicsToDefaultCaracteristics(newRow);
-//
-// obsRows.add(newRow);
-//
-// }
-//
-// // use first individual observation row length step caracteristics
-//
-// if (lengthStepCaracteristic == null) {
-// IndividualObservationBatchRowModel rowModel = individualObservations.get(0);
-// lengthStepCaracteristic = rowModel.getLengthStepCaracteristic();
-//
-// if (log.isInfoEnabled()) {
-// log.info("Use existing lengthStep caracteristic / step " + decorate(lengthStepCaracteristic));
-// }
-// }
-//
-// } else {
-//
-// // par défaut pas de mode de recopie
-// copyIndividualObservationMode = CopyIndividualObservationMode.NOTHING;
-//
-// }
-//
-// if (log.isInfoEnabled()) {
-// log.info("CopyIndividualObservationMode: " + copyIndividualObservationMode);
-// }
-
- SpeciesBatchRowModel previousSiblingRow = frequencyEditor.getPreviousSiblingRow();
-
- if (lengthStepCaracteristic == null && previousSiblingRow != null) {
-
- // try to get it from his previous brother row
- List<SpeciesFrequencyRowModel> previousFrequency = previousSiblingRow.getFrequency();
-
- if (CollectionUtils.isNotEmpty(previousFrequency)) {
-
- // use the first frequency length step caracteristic / step
- SpeciesFrequencyRowModel rowModel = previousFrequency.get(0);
- lengthStepCaracteristic = rowModel.getLengthStepCaracteristic();
- if (log.isInfoEnabled()) {
- log.info("Use previous sibling existing lengthStep caracteristic / step " + decorate(lengthStepCaracteristic));
- }
- }
- }
- if (lengthStepCaracteristic == null) {
+ Caracteristic lengthStepCaracteristic = computeLengthStepCaracteristic(species, frequencyRows, individualObservationRows);
+ model.setLengthStepCaracteristic(lengthStepCaracteristic);
- String lengthStepPmfmId = taxonCache.getLengthStepPmfmId(species);
+ FrequencyConfigurationMode mode;
- if (lengthStepPmfmId != null) {
+ if (number != null || (lengthStepCaracteristic == null && taxonCache.containsLengthStepPmfmId(species))) {
- lengthStepCaracteristic = lengthStepCaracteristics.get(lengthStepPmfmId);
+ mode = FrequencyConfigurationMode.SIMPLE_COUNTING;
- if (log.isInfoEnabled()) {
- log.info("Use existing from protocol lengthStep caracteristic / step " + decorate(lengthStepCaracteristic));
- }
+ } else {
- }
- }
+ mode = FrequencyConfigurationMode.FREQUENCIES;
- if (lengthStepCaracteristic == null) {
- String speciesLengthStepPmfmId = taxonCache.getLengthStepPmfmId(species);
- if (speciesLengthStepPmfmId == null) {
- mode = FrequencyConfigurationMode.SIMPLE_COUNTING;
- }
}
if (log.isInfoEnabled()) {
log.info("FrequencyConfigurationMode: " + mode);
}
- if (log.isDebugEnabled()) {
- log.debug("Will edit batch row: " + speciesBatch + " with " + rows.size() + " frequencies and " + individualObservationRows.size() + " indivudual observations.");
- }
-
- Integer number = speciesBatch.getNumber();
- if (number != null && rows.isEmpty()) {
- mode = FrequencyConfigurationMode.SIMPLE_COUNTING;
- model.setSimpleCount(number);
- }
-
// make sure configuration mode will be rebound
model.setConfigurationMode(null);
model.setConfigurationMode(mode);
model.setFrequenciesConfigurationMode(null);
- model.setFrequenciesConfigurationMode(frequenciesMode);
+ model.setFrequenciesConfigurationMode(FrequencyConfigurationMode.AUTO_GEN);
// connect model to validator
ui.getValidator().setBean(model);
- // always sort row by their length
- // see http://forge.codelutin.com/issues/2482
- Collections.sort(rows);
-
- model.setLengthStepCaracteristic(lengthStepCaracteristic);
- model.setRows(rows);
-
- individualObservationBatchTableHandler.initCaracteristicValues(speciesBatch);
+ model.setRows(frequencyRows);
-// CaracteristicMap sampleCategoryValues = new CaracteristicMap();
-// Iterator<SampleCategory<?>> iterator = speciesBatch.iterator();
-// iterator.forEachRemaining(sampleCategory -> {
-// Caracteristic caracteristic = sampleCategory.getCategoryDef().getCaracteristic();
-// sampleCategoryValues.put(caracteristic, sampleCategory.getCategoryValue());
-// });
-//
-// obsTableModel.setDefaultCaracteristicValues(sampleCategoryValues);
-// model.setNotEditableCaracteristic(sampleCategoryValues.keySet());
-
- individualObservationBatchTableHandler.setIndividualObservationRows(individualObservationRows);
-// obsTableModel.setRows(obsRows);
-// model.recomputeIndividualObservationRowsValidateState();
+ individualObservationBatchTableHandler.editBatch(speciesBatch, individualObservationRows);
// let's change the copy mode (mark it in init mode to avoid user change confirmation and some recompuations)
model.setCopyIndividualObservationMode(null);
@@ -1957,16 +1787,6 @@ public class SpeciesFrequencyUIHandler extends AbstractTuttiTableUIHandler<Speci
}
}
-// protected void removeMaturityColumnIfPresent() {
-// if (maturityColumnId != null) {
-// TableColumnExt maturityColumn = ui.getObsTable().getColumnExt(maturityColumnId);
-// ui.getObsTable().removeColumn(maturityColumn);
-// getObsTableModel().removeMaturityIdentifier(maturityColumnId);
-// maturityColumnId = null;
-// }
-// }
-
-
// Attention on surcharge les méthodes suivantes pour pouvoir les utiliser dans l'autre handler, ne rien changer (pour le moment)...
@Override
@@ -2000,4 +1820,68 @@ public class SpeciesFrequencyUIHandler extends AbstractTuttiTableUIHandler<Speci
return super.decorate(object, context);
}
+
+ private Caracteristic computeLengthStepCaracteristic(Species species, List<SpeciesFrequencyRowModel> frequencyRows, List<IndividualObservationBatchRowModel> individualObservationRows) {
+
+ Caracteristic lengthStepCaracteristic = null;
+
+ if (!frequencyRows.isEmpty()) {
+
+ SpeciesFrequencyRowModel firstFrequencyRow = frequencyRows.get(0);
+ lengthStepCaracteristic = firstFrequencyRow.getLengthStepCaracteristic();
+ if (log.isInfoEnabled()) {
+ log.info("Use existing lengthStep caracteristic / step from first existing frequency: " + decorate(lengthStepCaracteristic));
+ }
+
+ }
+
+ if (lengthStepCaracteristic == null) {
+
+ if (!individualObservationRows.isEmpty()) {
+ IndividualObservationBatchRowModel firstIndividualObservationRow = individualObservationRows.get(0);
+
+ lengthStepCaracteristic = firstIndividualObservationRow.getLengthStepCaracteristic();
+
+ if (log.isInfoEnabled()) {
+ log.info("Use existing lengthStep caracteristic / step from first individual observation : " + decorate(lengthStepCaracteristic));
+ }
+ }
+
+ }
+
+ SpeciesBatchRowModel previousSiblingRow = frequencyEditor.getPreviousSiblingRow();
+
+ if (lengthStepCaracteristic == null && previousSiblingRow != null) {
+
+ // try to get it from his previous brother row
+ List<SpeciesFrequencyRowModel> previousFrequency = previousSiblingRow.getFrequency();
+
+ if (CollectionUtils.isNotEmpty(previousFrequency)) {
+
+ // use the first frequency length step caracteristic / step
+ SpeciesFrequencyRowModel rowModel = previousFrequency.get(0);
+ lengthStepCaracteristic = rowModel.getLengthStepCaracteristic();
+ if (log.isInfoEnabled()) {
+ log.info("Use previous sibling existing lengthStep caracteristic / step " + decorate(lengthStepCaracteristic));
+ }
+ }
+ }
+
+ if (lengthStepCaracteristic == null) {
+
+ String lengthStepPmfmId = taxonCache.getLengthStepPmfmId(species);
+
+ if (lengthStepPmfmId != null) {
+
+ lengthStepCaracteristic = lengthStepCaracteristics.get(lengthStepPmfmId);
+
+ if (log.isInfoEnabled()) {
+ log.info("Use existing from protocol lengthStep caracteristic / step " + decorate(lengthStepCaracteristic));
+ }
+
+ }
+ }
+
+ return lengthStepCaracteristic;
+ }
}
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 2a20c53..09f3fce 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
@@ -361,7 +361,7 @@ public class SpeciesFrequencyUIModel extends AbstractTuttiTableUIModel<SpeciesBa
setEmptyRows(new HashSet<>());
this.averageWeightsHistogramModel = new AverageWeightsHistogramModel(weightUnit, individualObservationWeightUnit);
- this.frequenciesHistogramModel = new FrequenciesHistogramModel(weightUnit, individualObservationWeightUnit);
+ this.frequenciesHistogramModel = new FrequenciesHistogramModel();
// XYSeries series = new XYSeries("", true, false);
//
@@ -1028,18 +1028,10 @@ public class SpeciesFrequencyUIModel extends AbstractTuttiTableUIModel<SpeciesBa
}
- public boolean isIndividualObservationRowValid(IndividualObservationBatchRowModel row) {
- return copyIndividualObservationMode == CopyIndividualObservationMode.NOTHING
- || copyIndividualObservationMode == CopyIndividualObservationMode.SIZE
- && row.getSize() != null
- || copyIndividualObservationMode == CopyIndividualObservationMode.ALL
- && row.getSize() != null
- && row.getWeight() != null;
- }
-
-// public void setDataSetIntervalWidth(float step) {
-// frequenciesDataset.setIntervalWidth(step);
-// averageWeightsDataset.setIntervalWidth(step);
+// public boolean isIndividualObservationRowValid(IndividualObservationBatchRowModel row) {
+// return copyIndividualObservationMode == CopyIndividualObservationMode.NOTHING
+// || (copyIndividualObservationMode == CopyIndividualObservationMode.SIZE && row.withSize())
+// || (copyIndividualObservationMode == CopyIndividualObservationMode.ALL && row.withSize() && row.withWeight());
// }
public List<Caracteristic> getDefaultCaracteristic() {
@@ -1153,7 +1145,7 @@ public class SpeciesFrequencyUIModel extends AbstractTuttiTableUIModel<SpeciesBa
protected final void recomputeIndividualObservationRowValidState(IndividualObservationBatchRowModel row) {
// recompute row valid state
- boolean valid = isIndividualObservationRowValid(row);
+ boolean valid = row.computeValid();
// apply it to row
row.setValid(valid);
diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/actions/ImportMultiPostSpeciesSupportAction.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/actions/ImportMultiPostSpeciesSupportAction.java
index e20afe6..4a644df 100644
--- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/actions/ImportMultiPostSpeciesSupportAction.java
+++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/actions/ImportMultiPostSpeciesSupportAction.java
@@ -189,6 +189,7 @@ public abstract class ImportMultiPostSpeciesSupportAction extends LongActionSupp
getDataContext().getDefaultIndividualObservationCaracteristics(),
individualObservations);
+ //FIXME Faire un «reset» avant pour l'algorithme de prélèvement
getHandler().loadFrequenciesAndObservations(frequencyRows, individualObservationRows);
getModel().setModify(true);
diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/actions/RemoveObservationAction.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/actions/RemoveObservationAction.java
index 0ab0c09..9a23f0f 100644
--- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/actions/RemoveObservationAction.java
+++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/actions/RemoveObservationAction.java
@@ -27,6 +27,7 @@ package fr.ifremer.tutti.ui.swing.content.operation.catches.species.frequency.ac
import fr.ifremer.tutti.ui.swing.content.operation.catches.species.frequency.IndividualObservationBatchRowModel;
import fr.ifremer.tutti.ui.swing.content.operation.catches.species.frequency.IndividualObservationBatchTableModel;
import fr.ifremer.tutti.ui.swing.content.operation.catches.species.frequency.IndividualObservationUICache;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.species.frequency.SpeciesFrequencyTableModel;
import fr.ifremer.tutti.ui.swing.content.operation.catches.species.frequency.SpeciesFrequencyUI;
import fr.ifremer.tutti.ui.swing.content.operation.catches.species.frequency.SpeciesFrequencyUIHandler;
import fr.ifremer.tutti.ui.swing.content.operation.catches.species.frequency.SpeciesFrequencyUIModel;
@@ -81,6 +82,7 @@ public class RemoveObservationAction extends SimpleActionSupport<SpeciesFrequenc
SpeciesFrequencyUIHandler handler = ui.getHandler();
IndividualObservationUICache individualObservationUICache = handler.getIndividualObservationUICache();
+ SpeciesFrequencyTableModel frequencyTableModel = handler.getTableModel();
// Attention, on ne traite ici que les observations individuelles qui ont une taille
rowsToDelete.stream().filter(IndividualObservationBatchRowModel::withSize).forEach(row -> {
@@ -92,10 +94,10 @@ public class RemoveObservationAction extends SimpleActionSupport<SpeciesFrequenc
boolean removeSize = removeWeight || model.isCopyIndividualObservationSize();
if (removeWeight) {
- handler.getTableModel().removeWeightToFrequencyRow(row, row.getWeight());
+ frequencyTableModel.removeWeightToFrequencyRow(row.getSize(), row.getWeight());
}
if (removeSize) {
- handler.getTableModel().decrementFrequencyRowsNumbers(row);
+ frequencyTableModel.decrementFrequencyRowsNumbers(row);
}
individualObservationUICache.decrements(row);
--
To stop receiving notification emails like this one, please contact
codelutin.com SCM administrator <admin+scm(a)codelutin.com>.
1
0