From kmorin@users.forge.codelutin.com Fri May 24 17:24:15 2013
From: kmorin@users.forge.codelutin.com
To: tutti-commits@list.forge.codelutin.com
Subject: [Tutti-commits] r1008 - in	=?utf-8?q?trunk/tutti-ui-swing/src/main/?=
 =?utf-8?q?java/fr/ifremer/tutti/ui/swing/content/operation/catches=3A?=
	benthos benthos/split species species/split
Date: Fri, 24 May 2013 17:24:15 +0200
Message-ID: <20130524152415.1FE25D4269@nuiton.codelutin.com>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="===============5291008211977594536=="

--===============5291008211977594536==
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable

Author: kmorin
Date: 2013-05-24 17:24:15 +0200 (Fri, 24 May 2013)
New Revision: 1008

Url: http://forge.codelutin.com/projects/tutti/repository/revisions/1008

Log:
debug sampling categories

Modified:
   trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/opera=
tion/catches/benthos/BenthosBatchRowModel.java
   trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/opera=
tion/catches/benthos/BenthosBatchUIHandler.java
   trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/opera=
tion/catches/benthos/split/SplitBenthosBatchUIHandler.java
   trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/opera=
tion/catches/benthos/split/SplitBenthosBatchUIModel.java
   trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/opera=
tion/catches/species/SpeciesBatchRowModel.java
   trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/opera=
tion/catches/species/SpeciesBatchUIHandler.java
   trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/opera=
tion/catches/species/split/SplitSpeciesBatchUIHandler.java
   trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/opera=
tion/catches/species/split/SplitSpeciesBatchUIModel.java

Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/conten=
t/operation/catches/benthos/BenthosBatchRowModel.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/oper=
ation/catches/benthos/BenthosBatchRowModel.java	2013-05-24 15:06:36 UTC (rev =
1007)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/oper=
ation/catches/benthos/BenthosBatchRowModel.java	2013-05-24 15:24:15 UTC (rev =
1008)
@@ -122,8 +122,6 @@
=20
     public static final String PROPERTY_BATCH_ROOT =3D "batchRoot";
=20
-    public static final String PROPERTY_SAMPLE_CATEGORY =3D "sampleCategory";
-
     /**
      * Species.
      *
@@ -167,16 +165,6 @@
     protected SampleCategory<Float> ageCategory;
=20
     /**
-     * Sample category of this batch.
-     * <p/>
-     * This is one of the sample category befined above, used to know if the
-     * table row which sample category affects this row exactly.
-     *
-     * @since 0.3
-     */
-    private SampleCategory<?> sampleCategory;
-
-    /**
      * Is the species need to be confirmed?.
      *
      * @since 0.2
@@ -277,17 +265,27 @@
     //-- Sample category                                                    =
--//
     //----------------------------------------------------------------------=
--//
=20
-    public SampleCategory<?> getSampleCategory() {
-        return sampleCategory;
+    public void setSampleCategory(SampleCategory sampleCategory) {
+        switch (sampleCategory.getCategoryType()) {
+            case sortedUnsorted:
+                setSortedUnsortedCategory(sampleCategory);
+                break;
+            case size:
+                setSizeCategory(sampleCategory);
+                break;
+            case sex:
+                setSexCategory(sampleCategory);
+                break;
+            case maturity:
+                setMaturityCategory(sampleCategory);
+                break;
+            case age:
+                setAgeCategory(sampleCategory);
+        }
     }
=20
-    public void setSampleCategory(SampleCategory<?> sampleCategory) {
-        Object oldValue =3D getSampleCategory();
-        this.sampleCategory =3D sampleCategory;
-        firePropertyChange(PROPERTY_SAMPLE_CATEGORY, oldValue, sampleCategor=
y);
-    }
-
     public SampleCategory<?> getSampleCategory(SampleCategoryEnum sampleCate=
goryEnum) {
+        SampleCategory sampleCategory =3D null;
         switch (sampleCategoryEnum) {
             case sortedUnsorted:
                 sampleCategory =3D getSortedUnsortedCategory();

Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/conten=
t/operation/catches/benthos/BenthosBatchUIHandler.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/oper=
ation/catches/benthos/BenthosBatchUIHandler.java	2013-05-24 15:06:36 UTC (rev=
 1007)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/oper=
ation/catches/benthos/BenthosBatchUIHandler.java	2013-05-24 15:24:15 UTC (rev=
 1008)
@@ -112,7 +112,6 @@
             LogFactory.getLog(BenthosBatchUIHandler.class);
=20
     public static final Set<String> SAMPLING_PROPERTIES =3D Sets.newHashSet(
-            BenthosBatchRowModel.PROPERTY_SAMPLE_CATEGORY,
             BenthosBatchRowModel.PROPERTY_SPECIES,
             BenthosBatchRowModel.PROPERTY_SORTED_UNSORTED_CATEGORY,
             BenthosBatchRowModel.PROPERTY_SIZE_CATEGORY,

Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/conten=
t/operation/catches/benthos/split/SplitBenthosBatchUIHandler.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/oper=
ation/catches/benthos/split/SplitBenthosBatchUIHandler.java	2013-05-24 15:06:=
36 UTC (rev 1007)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/oper=
ation/catches/benthos/split/SplitBenthosBatchUIHandler.java	2013-05-24 15:24:=
15 UTC (rev 1008)
@@ -263,7 +263,7 @@
         if (batch !=3D null) {
             //TODO Use the samplingOrder (+ the one from the table model)
=20
-            SampleCategory<?> lastCategory =3D batch.getSampleCategory();
+            SampleCategory<?> lastCategory =3D batch.getFinestCategory();
=20
             Preconditions.checkNotNull(
                     lastCategory,

Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/conten=
t/operation/catches/benthos/split/SplitBenthosBatchUIModel.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/oper=
ation/catches/benthos/split/SplitBenthosBatchUIModel.java	2013-05-24 15:06:36=
 UTC (rev 1007)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/oper=
ation/catches/benthos/split/SplitBenthosBatchUIModel.java	2013-05-24 15:24:15=
 UTC (rev 1008)
@@ -122,7 +122,7 @@
     }
=20
     public Float getBatchWeight() {
-        return batch =3D=3D null ? null : batch.getSampleCategory().getCateg=
oryWeight();
+        return batch =3D=3D null ? null : batch.getFinestCategory().getCateg=
oryWeight();
     }
=20
     public Float getSampleWeight() {

Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/conten=
t/operation/catches/species/SpeciesBatchRowModel.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/oper=
ation/catches/species/SpeciesBatchRowModel.java	2013-05-24 15:06:36 UTC (rev =
1007)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/oper=
ation/catches/species/SpeciesBatchRowModel.java	2013-05-24 15:24:15 UTC (rev =
1008)
@@ -112,8 +112,6 @@
=20
     public static final String PROPERTY_BATCH_ROOT =3D "batchRoot";
=20
-    public static final String PROPERTY_SAMPLE_CATEGORY =3D "sampleCategory";
-
     /**
      * Delegate edit object.
      *
@@ -157,16 +155,6 @@
     protected SampleCategory<Float> ageCategory;
=20
     /**
-     * Sample category of this batch.
-     * <p/>
-     * This is one of the sample category defined above, used to know if the
-     * table row which sample category affects this row exactly.
-     *
-     * @since 0.3
-     */
-    private SampleCategory<?> sampleCategory;
-
-    /**
      * Observed weight.
      *
      * @since 0.2
@@ -446,17 +434,27 @@
     //-- Sample category                                                    =
--//
     //----------------------------------------------------------------------=
--//
=20
-    public SampleCategory<?> getSampleCategory() {
-        return sampleCategory;
+    public void setSampleCategory(SampleCategory sampleCategory) {
+        switch (sampleCategory.getCategoryType()) {
+            case sortedUnsorted:
+                setSortedUnsortedCategory(sampleCategory);
+                break;
+            case size:
+                setSizeCategory(sampleCategory);
+                break;
+            case sex:
+                setSexCategory(sampleCategory);
+                break;
+            case maturity:
+                setMaturityCategory(sampleCategory);
+                break;
+            case age:
+                setAgeCategory(sampleCategory);
+        }
     }
=20
-    public void setSampleCategory(SampleCategory<?> sampleCategory) {
-        Object oldValue =3D getSampleCategory();
-        this.sampleCategory =3D sampleCategory;
-        firePropertyChange(PROPERTY_SAMPLE_CATEGORY, oldValue, sampleCategor=
y);
-    }
-
     public SampleCategory<?> getSampleCategory(SampleCategoryEnum sampleCate=
goryEnum) {
+        SampleCategory<?> sampleCategory =3D null;
         switch (sampleCategoryEnum) {
             case sortedUnsorted:
                 sampleCategory =3D getSortedUnsortedCategory();

Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/conten=
t/operation/catches/species/SpeciesBatchUIHandler.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/oper=
ation/catches/species/SpeciesBatchUIHandler.java	2013-05-24 15:06:36 UTC (rev=
 1007)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/oper=
ation/catches/species/SpeciesBatchUIHandler.java	2013-05-24 15:24:15 UTC (rev=
 1008)
@@ -110,7 +110,6 @@
             LogFactory.getLog(SpeciesBatchUIHandler.class);
=20
     public static final Set<String> SAMPLING_PROPERTIES =3D Sets.newHashSet(
-            SpeciesBatchRowModel.PROPERTY_SAMPLE_CATEGORY,
             SpeciesBatchRowModel.PROPERTY_SPECIES,
             SpeciesBatchRowModel.PROPERTY_SORTED_UNSORTED_CATEGORY,
             SpeciesBatchRowModel.PROPERTY_SIZE_CATEGORY,

Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/conten=
t/operation/catches/species/split/SplitSpeciesBatchUIHandler.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/oper=
ation/catches/species/split/SplitSpeciesBatchUIHandler.java	2013-05-24 15:06:=
36 UTC (rev 1007)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/oper=
ation/catches/species/split/SplitSpeciesBatchUIHandler.java	2013-05-24 15:24:=
15 UTC (rev 1008)
@@ -262,7 +262,7 @@
         if (batch !=3D null) {
             //TODO Use the samplingOrder (+ the one from the table model)
=20
-            SampleCategory<?> lastCategory =3D batch.getSampleCategory();
+            SampleCategory<?> lastCategory =3D batch.getFinestCategory();
=20
             Preconditions.checkNotNull(
                     lastCategory,

Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/conten=
t/operation/catches/species/split/SplitSpeciesBatchUIModel.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/oper=
ation/catches/species/split/SplitSpeciesBatchUIModel.java	2013-05-24 15:06:36=
 UTC (rev 1007)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/oper=
ation/catches/species/split/SplitSpeciesBatchUIModel.java	2013-05-24 15:24:15=
 UTC (rev 1008)
@@ -122,7 +122,7 @@
     }
=20
     public Float getBatchWeight() {
-        return batch =3D=3D null ? null : batch.getSampleCategory().getCateg=
oryWeight();
+        return batch =3D=3D null ? null : batch.getFinestCategory().getCateg=
oryWeight();
     }
=20
     public Float getSampleWeight() {


--===============5291008211977594536==--


