r917 - in trunk: . coser-ui/src/main/java/fr/ifremer/coser/ui/selection
Author: echatellier Date: 2011-12-11 15:31:20 +0100 (Sun, 11 Dec 2011) New Revision: 917 Url: http://forge.codelutin.com/repositories/revision/coser/917 Log: Fix selection lists update after species list modification Modified: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/selection/SelectionDetailsView.jaxx trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/selection/SelectionHandler.java trunk/pom.xml Modified: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/selection/SelectionDetailsView.jaxx =================================================================== --- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/selection/SelectionDetailsView.jaxx 2011-12-11 14:30:12 UTC (rev 916) +++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/selection/SelectionDetailsView.jaxx 2011-12-11 14:31:20 UTC (rev 917) @@ -276,7 +276,7 @@ <row> <cell anchor="east" columns="4"> <JButton id="validSpeciesButton" text="coser.ui.selection.details.validSpecies" - onActionPerformed="getHandler().validSelectionSpeciesData(this);setSpeciesValidated(true);saveSelectionButton.setEnabled(true)" + onActionPerformed="getHandler().validSelectionSpeciesData(this);setSpeciesValidated(true);saveSelectionButton.setEnabled(getErrorsTableModel().getRowCount() == 0)" enabled="{isYearsValidated() && isStrataValidated() && !isSpeciesValidated()}"/> </cell> </row> Modified: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/selection/SelectionHandler.java =================================================================== --- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/selection/SelectionHandler.java 2011-12-11 14:30:12 UTC (rev 916) +++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/selection/SelectionHandler.java 2011-12-11 14:31:20 UTC (rev 917) @@ -28,7 +28,6 @@ import java.awt.Component; import java.awt.GridBagConstraints; import java.awt.Insets; -import java.awt.Point; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseEvent; @@ -63,9 +62,6 @@ import org.nuiton.math.matrix.gui.MatrixTableModelND; import org.nuiton.widget.SwingSession; -import com.bbn.openmap.gui.OMToolSet; -import com.bbn.openmap.gui.Tool; - import fr.ifremer.coser.CoserBusinessException; import fr.ifremer.coser.CoserConfig; import fr.ifremer.coser.CoserException; @@ -99,7 +95,7 @@ /** * Appelé sur un changement d'onglet dans l'interface de sélection. * - * Les listes L1à4 n'ecoute pas directement les modifications du premier + * Les listes L1à4 n'ecoutent pas directement les modifications du premier * onglet. Opération manuelle, calcul de matrice en plus. * * @param view view @@ -107,74 +103,84 @@ */ public void selectionTabChanged(SelectionView view, ChangeEvent event) { - // selected tab is Lists - Component selectedComponent = view.getSelectedComponent(); - if (selectedComponent instanceof SelectionListsView) { - SelectionListsView selectionListsView = (SelectionListsView)selectedComponent; + try { + setWaitCursor(view); - if (log.isDebugEnabled()) { - log.debug("List details tab selected"); - } - - Selection selection = view.getContextValue(Selection.class); - - // si la selection n'est pas la même que que celle de la sélection - // on met à jour la liste de "Toutes les especes" (L1) - - List<String> currentList = selectionListsView.getSelectionAllSpeciesListModel().getSpecies(); - List<String> selectionSpeciesList = selection.getSelectedSpecies(); - - if (!selectionSpeciesList.equals(currentList)) { - + // selected tab is Lists + Component selectedComponent = view.getSelectedComponent(); + if (selectedComponent instanceof SelectionListsView) { + SelectionListsView selectionListsView = (SelectionListsView)selectedComponent; + if (log.isDebugEnabled()) { - log.debug("Data changed, fill default selection"); + log.debug("List details tab selected"); } - - // on calcul également les matrices de d'occurence, densité - Project project = view.getContextValue(Project.class); - ProjectService projectService = view.getContextValue(ProjectService.class); - MatrixND occurrence = projectService.getOccurrence(project, selection); - occurrence.meanOverDim(1); // moyenne sur les années - MatrixND density = projectService.getDensity(project, selection); - density.meanOverDim(1); // moyenne sur les années - Collection<String> speciesAllYear = projectService.getSpeciesWithSizeAllYears(selection); - Collection<String> speciesWithMaturity = projectService.getSpeciesWithMaturity(selection); - - // set matrix on list model - selectionListsView.getSelectionOccurrenceDensityListModel().setOccurrence(occurrence); - selectionListsView.getSelectionOccurrenceDensityListModel().setDensity(density); - - // fill all species data (at final) - selectionListsView.getSelectionAllSpeciesListModel().setSpecies(selectionSpeciesList); - ((CoserListSelectionModel)selectionListsView.getSelectionAllSpeciesList().getSelectionModel()).fillSelection(); - selectionListsView.getSelectionSizeAllYearListModel().setSizeAllYearSpecies(speciesAllYear); - selectionListsView.getSelectionMaturityListModel().setMaturitySpecies(speciesWithMaturity); - - // rechargement de la selection sauvegardée - // si aucune des autres listes n'est vide - if (!selection.getSelectedSpeciesOccDens().isEmpty() || - !selection.getSelectedSpeciesSizeAllYear().isEmpty() || - !selection.getSelectedSpeciesMaturity().isEmpty()) { - - selectionListsView.getSelectionFilterOccurrenceField().setText(String.valueOf(selection.getOccurrenceFilter())); - selectionListsView.getSelectionFilterDensityField().setText(String.valueOf(selection.getDensityFilter())); - - // restauration de la selection sauvegardée - ((CoserListSelectionModel)selectionListsView.getSelectionOccurrenceDensityList().getSelectionModel()).setSelectedObjects(selection.getSelectedSpeciesOccDens()); - ((CoserListSelectionModel)selectionListsView.getSelectionSizeAllYearList().getSelectionModel()).setSelectedObjects(selection.getSelectedSpeciesSizeAllYear()); - ((CoserListSelectionModel)selectionListsView.getSelectionMaturityList().getSelectionModel()).setSelectedObjects(selection.getSelectedSpeciesMaturity()); - } - else { - + + Selection selection = view.getContextValue(Selection.class); + + // si la selection n'est pas la même que que celle de la sélection + // on met à jour la liste de "Toutes les especes" (L1) + + List<String> currentList = selectionListsView.getSelectionAllSpeciesListModel().getSpecies(); + List<String> selectionSpeciesList = selection.getSelectedSpecies(); + + if (!selectionSpeciesList.equals(currentList)) { + if (log.isDebugEnabled()) { - log.debug("Apply occurrence/density filter"); + log.debug("Data changed, fill default selection"); } - - // select all list (not to do for reload) - // init allSize and maturity before (select all with updateOccurrenceDensityFilter) - updateOccurrenceDensityFilter(selectionListsView); + + // on calcul également les matrices de d'occurence, densité + Project project = view.getContextValue(Project.class); + ProjectService projectService = view.getContextValue(ProjectService.class); + MatrixND occurrence = projectService.getOccurrence(project, selection); + occurrence.meanOverDim(1); // moyenne sur les années + MatrixND density = projectService.getDensity(project, selection); + density.meanOverDim(1); // moyenne sur les années + Collection<String> speciesAllYear = projectService.getSpeciesWithSizeAllYears(selection); + Collection<String> speciesWithMaturity = projectService.getSpeciesWithMaturity(selection); + + // set matrix on list model + selectionListsView.getSelectionOccurrenceDensityListModel().setOccurrence(occurrence); + selectionListsView.getSelectionOccurrenceDensityListModel().setDensity(density); + + // useless line but fix a event update bug + // can take huge time becasue somes event are fired + selectionListsView.getSelectionAllSpeciesList().clearSelection(); + + // fill all species data (at final) + selectionListsView.getSelectionAllSpeciesListModel().setSpecies(selectionSpeciesList); + ((CoserListSelectionModel)selectionListsView.getSelectionAllSpeciesList().getSelectionModel()).fillSelection(); + selectionListsView.getSelectionSizeAllYearListModel().setSizeAllYearSpecies(speciesAllYear); + selectionListsView.getSelectionMaturityListModel().setMaturitySpecies(speciesWithMaturity); + + // rechargement de la selection sauvegardée + // si aucune des autres listes n'est vide + if (!selection.getSelectedSpeciesOccDens().isEmpty() || + !selection.getSelectedSpeciesSizeAllYear().isEmpty() || + !selection.getSelectedSpeciesMaturity().isEmpty()) { + + selectionListsView.getSelectionFilterOccurrenceField().setText(String.valueOf(selection.getOccurrenceFilter())); + selectionListsView.getSelectionFilterDensityField().setText(String.valueOf(selection.getDensityFilter())); + + // restauration de la selection sauvegardée + ((CoserListSelectionModel)selectionListsView.getSelectionOccurrenceDensityList().getSelectionModel()).setSelectedObjects(selection.getSelectedSpeciesOccDens()); + ((CoserListSelectionModel)selectionListsView.getSelectionSizeAllYearList().getSelectionModel()).setSelectedObjects(selection.getSelectedSpeciesSizeAllYear()); + ((CoserListSelectionModel)selectionListsView.getSelectionMaturityList().getSelectionModel()).setSelectedObjects(selection.getSelectedSpeciesMaturity()); + } + else { + + if (log.isDebugEnabled()) { + log.debug("Apply occurrence/density filter"); + } + + // select all list (not to do for reload) + // init allSize and maturity before (select all with updateOccurrenceDensityFilter) + updateOccurrenceDensityFilter(selectionListsView); + } } } + } finally { + setDefaultCursor(view); } } Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2011-12-11 14:30:12 UTC (rev 916) +++ trunk/pom.xml 2011-12-11 14:31:20 UTC (rev 917) @@ -214,7 +214,7 @@ <dependency> <groupId>com.bbn</groupId> <artifactId>openmap</artifactId> - <version>5.0.0-20111117</version> + <version>5.0.0-20111210</version> <scope>compile</scope> </dependency>
participants (1)
-
echatellier@users.forge.codelutin.com