branch develop-3.x updated (7cb5f9c -> c8d1d25)
This is an automated email from the git hooks/post-receive script. New change to branch develop-3.x in repository tutti. See http://git.codelutin.com/tutti.git from 7cb5f9c change version to 3.13.9 new c4bbece passage sur la snapshot + configuration pour le support 3.x new 4eb41b1 on ne modifie pas le modèle tant qu'on est dans le thread de l'action longue (refs #7020) new c8d1d25 fixes #7020: [CAPTURE] Erreur lors de l'élévation des poids Merge branch 'feature/7020' into develop-3.x 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 c8d1d251f8d08e7ff680f2c82d5130f75922448d Merge: c4bbece 4eb41b1 Author: Tony CHEMIT <chemit@codelutin.com> Date: Mon Apr 27 18:38:44 2015 +0200 fixes #7020: [CAPTURE] Erreur lors de l'élévation des poids Merge branch 'feature/7020' into develop-3.x commit 4eb41b1e4a4b55cb45c8a06b415c9c6f088abe85 Author: Tony CHEMIT <chemit@codelutin.com> Date: Mon Apr 27 18:38:39 2015 +0200 on ne modifie pas le modèle tant qu'on est dans le thread de l'action longue (refs #7020) commit c4bbece5a53c2fb0364a8d141593234cad07e43a Author: Tony CHEMIT <chemit@codelutin.com> Date: Mon Apr 27 18:37:01 2015 +0200 passage sur la snapshot + configuration pour le support 3.x Summary of changes: pom.xml | 7 +- tutti-ichtyometer/pom.xml | 2 +- tutti-persistence/pom.xml | 2 +- tutti-report-generator/pom.xml | 2 +- tutti-service/pom.xml | 2 +- tutti-ui-swing-updater/pom.xml | 2 +- tutti-ui-swing/pom.xml | 2 +- .../ui/swing/action/ComputeBatchWeightsAction.java | 366 ++++++++++++++------- .../catches/benthos/BenthosBatchTableModel.java | 8 +- .../catches/species/SpeciesBatchTableModel.java | 8 +- 10 files changed, 277 insertions(+), 124 deletions(-) -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop-3.x in repository tutti. See http://git.codelutin.com/tutti.git commit c4bbece5a53c2fb0364a8d141593234cad07e43a Author: Tony CHEMIT <chemit@codelutin.com> Date: Mon Apr 27 18:37:01 2015 +0200 passage sur la snapshot + configuration pour le support 3.x --- pom.xml | 7 +++++-- tutti-ichtyometer/pom.xml | 2 +- tutti-persistence/pom.xml | 2 +- tutti-report-generator/pom.xml | 2 +- tutti-service/pom.xml | 2 +- tutti-ui-swing-updater/pom.xml | 2 +- tutti-ui-swing/pom.xml | 2 +- 7 files changed, 11 insertions(+), 8 deletions(-) diff --git a/pom.xml b/pom.xml index c7f9db8..3847a3b 100644 --- a/pom.xml +++ b/pom.xml @@ -27,12 +27,12 @@ <parent> <groupId>org.nuiton</groupId> <artifactId>codelutinpom</artifactId> - <version>1.8.2</version> + <version>1.8.3</version> </parent> <groupId>fr.ifremer</groupId> <artifactId>tutti</artifactId> - <version>3.13.9</version> + <version>3.13.10-SNAPSHOT</version> <packaging>pom</packaging> <name>Tutti</name> @@ -167,6 +167,9 @@ <!-- Where are deployed software components --> <distroUrl>http://nexus.nuiton.org/nexus/content/repositories/other-releases</distroUrl> + <jgitflow.masterBranchName>master-3.x</jgitflow.masterBranchName> + <jgitflow.developBranchName>develop-3.x</jgitflow.developBranchName> + </properties> <repositories> diff --git a/tutti-ichtyometer/pom.xml b/tutti-ichtyometer/pom.xml index 64a56ff..2193115 100644 --- a/tutti-ichtyometer/pom.xml +++ b/tutti-ichtyometer/pom.xml @@ -27,7 +27,7 @@ <parent> <groupId>fr.ifremer</groupId> <artifactId>tutti</artifactId> - <version>3.13.9</version> + <version>3.13.10-SNAPSHOT</version> </parent> <groupId>fr.ifremer.tutti</groupId> diff --git a/tutti-persistence/pom.xml b/tutti-persistence/pom.xml index 10c878c..221e8aa 100644 --- a/tutti-persistence/pom.xml +++ b/tutti-persistence/pom.xml @@ -27,7 +27,7 @@ <parent> <groupId>fr.ifremer</groupId> <artifactId>tutti</artifactId> - <version>3.13.9</version> + <version>3.13.10-SNAPSHOT</version> </parent> <groupId>fr.ifremer.tutti</groupId> diff --git a/tutti-report-generator/pom.xml b/tutti-report-generator/pom.xml index 9e9772c..33203a3 100644 --- a/tutti-report-generator/pom.xml +++ b/tutti-report-generator/pom.xml @@ -27,7 +27,7 @@ <parent> <groupId>fr.ifremer</groupId> <artifactId>tutti</artifactId> - <version>3.13.9</version> + <version>3.13.10-SNAPSHOT</version> </parent> <groupId>fr.ifremer.tutti</groupId> diff --git a/tutti-service/pom.xml b/tutti-service/pom.xml index e543833..b8e44be 100644 --- a/tutti-service/pom.xml +++ b/tutti-service/pom.xml @@ -27,7 +27,7 @@ <parent> <groupId>fr.ifremer</groupId> <artifactId>tutti</artifactId> - <version>3.13.9</version> + <version>3.13.10-SNAPSHOT</version> </parent> <groupId>fr.ifremer.tutti</groupId> diff --git a/tutti-ui-swing-updater/pom.xml b/tutti-ui-swing-updater/pom.xml index 8ca9b6c..995da2d 100644 --- a/tutti-ui-swing-updater/pom.xml +++ b/tutti-ui-swing-updater/pom.xml @@ -25,7 +25,7 @@ <parent> <groupId>fr.ifremer</groupId> <artifactId>tutti</artifactId> - <version>3.13.9</version> + <version>3.13.10-SNAPSHOT</version> </parent> <groupId>fr.ifremer.tutti</groupId> diff --git a/tutti-ui-swing/pom.xml b/tutti-ui-swing/pom.xml index f1afb64..5d95707 100644 --- a/tutti-ui-swing/pom.xml +++ b/tutti-ui-swing/pom.xml @@ -27,7 +27,7 @@ <parent> <groupId>fr.ifremer</groupId> <artifactId>tutti</artifactId> - <version>3.13.9</version> + <version>3.13.10-SNAPSHOT</version> </parent> <groupId>fr.ifremer.tutti</groupId> -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop-3.x in repository tutti. See http://git.codelutin.com/tutti.git commit 4eb41b1e4a4b55cb45c8a06b415c9c6f088abe85 Author: Tony CHEMIT <chemit@codelutin.com> Date: Mon Apr 27 18:38:39 2015 +0200 on ne modifie pas le modèle tant qu'on est dans le thread de l'action longue (refs #7020) --- .../ui/swing/action/ComputeBatchWeightsAction.java | 366 ++++++++++++++------- .../catches/benthos/BenthosBatchTableModel.java | 8 +- .../catches/species/SpeciesBatchTableModel.java | 8 +- 3 files changed, 266 insertions(+), 116 deletions(-) diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ComputeBatchWeightsAction.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ComputeBatchWeightsAction.java index 1d3c7bf..9808dec 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ComputeBatchWeightsAction.java +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ComputeBatchWeightsAction.java @@ -38,19 +38,27 @@ import fr.ifremer.tutti.service.catches.WeightComputingService; import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUI; import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIHandler; import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIModel; +import fr.ifremer.tutti.ui.swing.content.operation.catches.SampleCategoryAble; +import fr.ifremer.tutti.ui.swing.content.operation.catches.SampleCategoryColumnIdentifier; import fr.ifremer.tutti.ui.swing.content.operation.catches.SpeciesBatchNaturalOrderComparator; import fr.ifremer.tutti.ui.swing.content.operation.catches.SpeciesSortMode; import fr.ifremer.tutti.ui.swing.content.operation.catches.benthos.BenthosBatchRowModel; +import fr.ifremer.tutti.ui.swing.content.operation.catches.benthos.BenthosBatchTableModel; import fr.ifremer.tutti.ui.swing.content.operation.catches.benthos.BenthosBatchUIModel; import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SpeciesBatchRowModel; +import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SpeciesBatchTableModel; import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SpeciesBatchUIModel; import fr.ifremer.tutti.ui.swing.util.AbstractTuttiUIHandler; -import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil; import fr.ifremer.tutti.util.Numbers; +import jaxx.runtime.swing.JTables; +import org.jdesktop.swingx.JXTable; +import org.jdesktop.swingx.table.TableColumnExt; +import org.nuiton.jaxx.application.swing.table.ColumnIdentifier; import javax.swing.JOptionPane; -import javax.swing.SwingUtilities; +import javax.swing.table.TableColumn; import java.util.List; +import java.util.Set; import static org.nuiton.i18n.I18n.t; @@ -62,13 +70,32 @@ public class ComputeBatchWeightsAction extends AbstractTuttiAction<EditCatchesUI protected final WeightCleaningService cleaningService; + protected List<SpeciesBatchRowModel> speciesBatchRows; + + protected List<BenthosBatchRowModel> benthosBatchRows; + + protected CatchBatch catchBatch; + + protected Boolean modified; + + protected Integer tabInError; + public ComputeBatchWeightsAction(EditCatchesUIHandler handler) { super(handler, true); - cleaningService = getContext().getWeightCleaningService(); + this.cleaningService = getContext().getWeightCleaningService(); } @Override public boolean prepareAction() throws Exception { + + // Clean internal states + + speciesBatchRows = null; + benthosBatchRows = null; + catchBatch = null; + modified = null; + tabInError = null; + boolean doAction = super.prepareAction(); if (doAction) { @@ -106,104 +133,42 @@ public class ComputeBatchWeightsAction extends AbstractTuttiAction<EditCatchesUI WeightComputingService weightComputingService = getContext().getWeightComputingService(); EditCatchesUIModel model = getModel(); - model.setLoadingData(true); + String operationId = model.getFishingOperation().getId(); // --------- // Compute species batches // --------- - BatchContainer<SpeciesBatch> computedSpeciesBatches; Float totalSpeciesSortedWeight; - String operationId = model.getFishingOperation().getId(); + BatchContainer<SpeciesBatch> computedSpeciesBatches; + try { - computedSpeciesBatches = - weightComputingService.getComputedSpeciesBatches(operationId); + computedSpeciesBatches = weightComputingService.getComputedSpeciesBatches(operationId); totalSpeciesSortedWeight = computeSpeciesBatches(persistenceService, computedSpeciesBatches); } catch (TuttiWeightComputingException e) { - getUI().getTabPane().setSelectedIndex(1); - - int index = e.getIndex(); - SpeciesBatchUIModel speciesBatchUIModel = getUI().getSpeciesTabContent().getModel(); - - SpeciesBatchRowModel row; - - if (speciesBatchUIModel.getSpeciesSortMode() != SpeciesSortMode.NONE) { - - // must resort rows in natural order (in service we use this order) - List<SpeciesBatchRowModel> rows = Lists.newArrayList(speciesBatchUIModel.getRows()); - SpeciesBatchNaturalOrderComparator.sort(rows); - // get the row - row = rows.get(index); - // get the correct rowIndex in the sorted list - index = speciesBatchUIModel.getRows().indexOf(row); - - } else { - - // correct order can directly get row from list - List<SpeciesBatchRowModel> rows = speciesBatchUIModel.getRows(); - row = rows.get(index); - - } - - int column; - if (SpeciesBatch.PROPERTY_SAMPLE_CATEGORY_WEIGHT.equals(e.getProperty())) { - column = getFinestCategoryColumn(row.getFinestCategory().getCategoryId()); - } else { - column = 6; - } - TuttiUIUtil.doSelectCell(getUI().getSpeciesTabContent().getTable(), index, column); + tabInError = 1; throw e; + } // --------- // Compute benthos batches // --------- - BatchContainer<BenthosBatch> computedBenthosBatches; Float totalBenthosSortedWeight; + BatchContainer<BenthosBatch> computedBenthosBatches; + try { - computedBenthosBatches = - weightComputingService.getComputedBenthosBatches(operationId); + computedBenthosBatches = weightComputingService.getComputedBenthosBatches(operationId); totalBenthosSortedWeight = computeBenthosBatches(persistenceService, computedBenthosBatches); } catch (TuttiWeightComputingException e) { - getUI().getTabPane().setSelectedIndex(2); - - int index = e.getIndex(); - - BenthosBatchUIModel benthosBatchUIModel = getUI().getBenthosTabContent().getModel(); - - BenthosBatchRowModel row; - if (benthosBatchUIModel.getSpeciesSortMode() != SpeciesSortMode.NONE) { - - // must resort rows in natural order (in service we use this order) - List<BenthosBatchRowModel> rows = Lists.newArrayList(benthosBatchUIModel.getRows()); - SpeciesBatchNaturalOrderComparator.sort(rows); - // get the row - row = rows.get(index); - // get the correct rowIndex in the sorted list - index = benthosBatchUIModel.getRows().indexOf(row); - - } else { - - // correct order can directly get row from list - List<BenthosBatchRowModel> rows = benthosBatchUIModel.getRows(); - row = rows.get(index); - - } - - - int column; - if (BenthosBatch.PROPERTY_SAMPLE_CATEGORY_WEIGHT.equals(e.getProperty())) { - column = getFinestCategoryColumn(row.getFinestCategory().getCategoryId()); - } else { - column = 6; - } - TuttiUIUtil.doSelectCell(getUI().getBenthosTabContent().getTable(), index, column); + tabInError = 2; throw e; + } // --------- @@ -213,15 +178,18 @@ public class ComputeBatchWeightsAction extends AbstractTuttiAction<EditCatchesUI BatchContainer<MarineLitterBatch> computedMarineLitterBatches; try { computedMarineLitterBatches = - weightComputingService.getComputedMarineLitterBatches(operationId, - model.getMarineLitterTotalWeight()); + weightComputingService.getComputedMarineLitterBatches(operationId, model.getMarineLitterTotalWeight()); } catch (TuttiWeightComputingException e) { - getUI().getTabPane().setSelectedIndex(3); - TuttiUIUtil.doSelectCell(getUI().getMarineLitterTabContent().getTable(), e.getIndex(), 3); + + tabInError = 3; throw e; + } + modified = model.isModify(); + catchBatch = model.toEntity(); + // --------- // Check species rates // --------- @@ -251,9 +219,13 @@ public class ComputeBatchWeightsAction extends AbstractTuttiAction<EditCatchesUI JOptionPane.QUESTION_MESSAGE); if (answer == JOptionPane.NO_OPTION) { - model.setSpeciesTotalSortedWeight(null); - model.setSpeciesTotalSortedComputedWeight(totalSpeciesSortedWeight); + + catchBatch.setSpeciesTotalSortedWeight(null); + catchBatch.setSpeciesTotalSortedComputedWeight(totalSpeciesSortedWeight); + modified = true; + } + } // --------- @@ -284,29 +256,78 @@ public class ComputeBatchWeightsAction extends AbstractTuttiAction<EditCatchesUI JOptionPane.QUESTION_MESSAGE); if (answer == JOptionPane.NO_OPTION) { - model.setBenthosTotalSortedWeight(null); - model.setBenthosTotalSortedComputedWeight(totalBenthosSortedWeight); + + catchBatch.setBenthosTotalSortedWeight(null); + catchBatch.setBenthosTotalSortedComputedWeight(totalBenthosSortedWeight); + modified = true; + } } -// persistenceService.recomputeCatchBatchSampleRatios(operationId); - - boolean modified = model.isModify(); - CatchBatch catchBatch = model.toEntity(); weightComputingService.computeCatchBatchWeights(catchBatch, computedSpeciesBatches, computedBenthosBatches, computedMarineLitterBatches); - model.fromEntity(catchBatch); - model.setLoadingData(false); - model.setModify(modified); } @Override public void postSuccessAction() { super.postSuccessAction(); + afterAction(); + + getUI().repaint(); + //TCHEMIT-2015-04-27 Plus besoin car le champs qui posait problème n'existe plus +// // see http://forge.codelutin.com/issues/3853 +// SwingUtilities.invokeLater( +// new Runnable() { +// @Override +// public void run() { +// getUI().getComputeSpeciesBatchButton().requestFocus(); +// } +// } +// ); + } + + protected void afterAction() { + + EditCatchesUIModel editCatchesUIModel = getModel(); + + editCatchesUIModel.setLoadingData(true); + + try { + + if (speciesBatchRows != null) { + + getUI().getSpeciesTabContent().getModel().setRows(speciesBatchRows); + + } + + if (benthosBatchRows != null) { + + getUI().getBenthosTabContent().getModel().setRows(benthosBatchRows); + + } + + if (catchBatch != null) { + + editCatchesUIModel.fromEntity(catchBatch); + + } + + if (modified != null) { + + editCatchesUIModel.setModify(modified); + + } + + } finally { + + editCatchesUIModel.setLoadingData(false); + + } + // keep sortMode // see https://forge.codelutin.com/issues/5699 @@ -334,16 +355,43 @@ public class ComputeBatchWeightsAction extends AbstractTuttiAction<EditCatchesUI } } - getUI().repaint(); - // see http://forge.codelutin.com/issues/3853 - SwingUtilities.invokeLater( - new Runnable() { - @Override - public void run() { - getUI().getComputeSpeciesBatchButton().requestFocus(); - } - } - ); + } + + @Override + public void postFailedAction(Throwable error) { + + afterAction(); + + if (error instanceof TuttiWeightComputingException) { + + // elevation error + TuttiWeightComputingException e = (TuttiWeightComputingException) error; + + getUI().getTabPane().setSelectedIndex(tabInError); + + switch (tabInError) { + + case 1: + // species error + treatSpeciesBatchError(e); + + break; + + case 2: + + // benthos error + treatBenthosBatchError(e); + + break; + + case 3: + // marine litter error + JTables.doSelectCell(getUI().getMarineLitterTabContent().getTable(), e.getIndex(), 3); + + } + + } + } //------------------------------------------------------------------------// @@ -354,10 +402,10 @@ public class ComputeBatchWeightsAction extends AbstractTuttiAction<EditCatchesUI Float totalSortedWeight = 0f; if (computedSpeciesBatches != null) { - List<SpeciesBatchRowModel> rows = Lists.newArrayList(); + speciesBatchRows = Lists.newArrayList(); List<SpeciesBatch> children = computedSpeciesBatches.getChildren(); for (SpeciesBatch batch : children) { - SpeciesBatchRowModel row = getUI().getSpeciesTabContent().getHandler().loadBatch(batch, null, rows); + SpeciesBatchRowModel row = getUI().getSpeciesTabContent().getHandler().loadBatch(batch, null, speciesBatchRows); if (persistenceService.isVracBatch(row)) { SampleCategory<?> sampleCategory = row.getFirstSampleCategory(); Float weight = Numbers.getValueOrComputedValue( @@ -366,7 +414,7 @@ public class ComputeBatchWeightsAction extends AbstractTuttiAction<EditCatchesUI totalSortedWeight += weight; } } - getUI().getSpeciesTabContent().getModel().setRows(rows); +// getUI().getSpeciesTabContent().getModel().setRows(speciesBatchRows); } return totalSortedWeight; @@ -376,10 +424,10 @@ public class ComputeBatchWeightsAction extends AbstractTuttiAction<EditCatchesUI Float totalSortedWeight = 0f; if (computedBenthosBatches != null) { - List<BenthosBatchRowModel> rows = Lists.newArrayList(); + benthosBatchRows = Lists.newArrayList(); List<BenthosBatch> children = computedBenthosBatches.getChildren(); for (BenthosBatch batch : children) { - BenthosBatchRowModel row = getUI().getBenthosTabContent().getHandler().loadBatch(batch, null, rows); + BenthosBatchRowModel row = getUI().getBenthosTabContent().getHandler().loadBatch(batch, null, benthosBatchRows); if (persistenceService.isVracBatch(row)) { SampleCategory<?> sampleCategory = row.getFirstSampleCategory(); @@ -389,22 +437,112 @@ public class ComputeBatchWeightsAction extends AbstractTuttiAction<EditCatchesUI totalSortedWeight += weight; } } - getUI().getBenthosTabContent().getModel().setRows(rows); +// getUI().getBenthosTabContent().getModel().setRows(benthosBatchRows); } return totalSortedWeight; } - protected int getFinestCategoryColumn(Integer categoryId) { - int column = 1; + protected void treatSpeciesBatchError(TuttiWeightComputingException e) { + + int index = e.getIndex(); + SpeciesBatchUIModel speciesBatchUIModel = getUI().getSpeciesTabContent().getModel(); - List<Integer> samplingOrderIds = getConfig().getSamplingOrderIds(); + SpeciesBatchRowModel row; - int index = samplingOrderIds.indexOf(categoryId); - if (index > -1) { - column += index + 1; + if (speciesBatchUIModel.getSpeciesSortMode() != SpeciesSortMode.NONE) { + + // must resort rows in natural order (in service we use this order) + List<SpeciesBatchRowModel> rows = Lists.newArrayList(speciesBatchUIModel.getRows()); + SpeciesBatchNaturalOrderComparator.sort(rows); + // get the row + row = rows.get(index); + // get the correct rowIndex in the sorted list + index = speciesBatchUIModel.getRows().indexOf(row); + + } else { + + // correct order can directly get row from list + List<SpeciesBatchRowModel> rows = speciesBatchUIModel.getRows(); + row = rows.get(index); + + } + + JXTable table = getUI().getSpeciesTabContent().getTable(); + SpeciesBatchTableModel tableModel = (SpeciesBatchTableModel) table.getModel(); + Set<SampleCategoryColumnIdentifier<SpeciesBatchRowModel>> sampleCols = tableModel.getSampleCols(); + selectBatchCell(table, index, row, e.getProperty(), sampleCols, SpeciesBatchTableModel.WEIGHT); + + } + + protected void treatBenthosBatchError(TuttiWeightComputingException e) { + + int index = e.getIndex(); + + BenthosBatchUIModel benthosBatchUIModel = getUI().getBenthosTabContent().getModel(); + + BenthosBatchRowModel row; + if (benthosBatchUIModel.getSpeciesSortMode() != SpeciesSortMode.NONE) { + + // must resort rows in natural order (in service we use this order) + List<BenthosBatchRowModel> rows = Lists.newArrayList(benthosBatchUIModel.getRows()); + SpeciesBatchNaturalOrderComparator.sort(rows); + // get the row + row = rows.get(index); + // get the correct rowIndex in the sorted list + index = benthosBatchUIModel.getRows().indexOf(row); + + } else { + + // correct order can directly get row from list + List<BenthosBatchRowModel> rows = benthosBatchUIModel.getRows(); + row = rows.get(index); + + } + + JXTable table = getUI().getBenthosTabContent().getTable(); + BenthosBatchTableModel tableModel = (BenthosBatchTableModel) table.getModel(); + Set<SampleCategoryColumnIdentifier<BenthosBatchRowModel>> sampleCols = tableModel.getSampleCols(); + + selectBatchCell(table, index, row, e.getProperty(), sampleCols, BenthosBatchTableModel.WEIGHT); + + } + + protected <R extends SampleCategoryAble> void selectBatchCell(JXTable table, + int index, + SampleCategoryAble row, + String property, + Set<SampleCategoryColumnIdentifier<R>> sampleCols, + ColumnIdentifier<R> weightColumn) { + + ColumnIdentifier columnIdentifier = weightColumn; + + if (SpeciesBatch.PROPERTY_SAMPLE_CATEGORY_WEIGHT.equals(property)) { + + // get category column for category + Integer categoryId = row.getFinestCategory().getCategoryId(); + for (SampleCategoryColumnIdentifier<R> sampleCol : sampleCols) { + if (categoryId.equals(sampleCol.getSampleCategoryId())) { + columnIdentifier = sampleCol; + break; + } + } + + } + + int column = 0; + TableColumnExt columnExt = table.getColumnExt(columnIdentifier); + int modelIndex = columnExt.getModelIndex(); + for (TableColumn tableColumn : table.getColumns(false)) { + + if (columnExt.equals(tableColumn) || tableColumn.getModelIndex() > modelIndex) { + break; + } + column++; } - return column; + JTables.doSelectCell(table, index, column); + } + } diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchTableModel.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchTableModel.java index bcb388e..1404bfb 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchTableModel.java +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchTableModel.java @@ -23,6 +23,7 @@ package fr.ifremer.tutti.ui.swing.content.operation.catches.benthos; */ import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableSet; import com.google.common.collect.Lists; import com.google.common.collect.Sets; import fr.ifremer.tutti.persistence.entities.data.SampleCategory; @@ -130,7 +131,7 @@ public class BenthosBatchTableModel extends AbstractApplicationTableModel<Bentho frequencyCols.add(COMPUTED_NUMBER); frequencyCols.add(WEIGHT); - sampleCols = Sets.newHashSet(); + Set<SampleCategoryColumnIdentifier<BenthosBatchRowModel>> sampleCols = Sets.newLinkedHashSet(); Enumeration<TableColumn> columns = columnModel.getColumns(); while (columns.hasMoreElements()) { TableColumn tableColumn = columns.nextElement(); @@ -141,6 +142,11 @@ public class BenthosBatchTableModel extends AbstractApplicationTableModel<Bentho sampleCols.add(categoryColumnIdentifier); } } + this.sampleCols = ImmutableSet.copyOf(sampleCols); + } + + public Set<SampleCategoryColumnIdentifier<BenthosBatchRowModel>> getSampleCols() { + return sampleCols; } @Override diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchTableModel.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchTableModel.java index 790c320..ba3855f 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchTableModel.java +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchTableModel.java @@ -23,6 +23,7 @@ package fr.ifremer.tutti.ui.swing.content.operation.catches.species; */ import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableSet; import com.google.common.collect.Lists; import com.google.common.collect.Sets; import fr.ifremer.tutti.persistence.entities.data.SampleCategory; @@ -130,7 +131,7 @@ public class SpeciesBatchTableModel extends AbstractApplicationTableModel<Specie frequencyCols.add(COMPUTED_NUMBER); frequencyCols.add(WEIGHT); - sampleCols = Sets.newHashSet(); + Set<SampleCategoryColumnIdentifier<SpeciesBatchRowModel>> sampleCols = Sets.newLinkedHashSet(); Enumeration<TableColumn> columns = columnModel.getColumns(); while (columns.hasMoreElements()) { @@ -140,6 +141,11 @@ public class SpeciesBatchTableModel extends AbstractApplicationTableModel<Specie sampleCols.add((SampleCategoryColumnIdentifier<SpeciesBatchRowModel>) identifier); } } + this.sampleCols = ImmutableSet.copyOf(sampleCols); + } + + public Set<SampleCategoryColumnIdentifier<SpeciesBatchRowModel>> getSampleCols() { + return sampleCols; } @Override -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop-3.x in repository tutti. See http://git.codelutin.com/tutti.git commit c8d1d251f8d08e7ff680f2c82d5130f75922448d Merge: c4bbece 4eb41b1 Author: Tony CHEMIT <chemit@codelutin.com> Date: Mon Apr 27 18:38:44 2015 +0200 fixes #7020: [CAPTURE] Erreur lors de l'élévation des poids Merge branch 'feature/7020' into develop-3.x .../ui/swing/action/ComputeBatchWeightsAction.java | 366 ++++++++++++++------- .../catches/benthos/BenthosBatchTableModel.java | 8 +- .../catches/species/SpeciesBatchTableModel.java | 8 +- 3 files changed, 266 insertions(+), 116 deletions(-) -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
participants (1)
-
codelutin.com scm