Author: echatellier Date: 2012-08-20 18:37:16 +0200 (Mon, 20 Aug 2012) New Revision: 1058 Url: http://forge.codelutin.com/repositories/revision/coser/1058 Log: Un double clic sur le warning taille aberrante dans la phase de contr?\195?\180le doit afficher le graph de la structure en taille de l'esp?\195?\168ce Added: trunk/coser-business/src/main/java/fr/ifremer/coser/control/SpeciesLengthControlError.java Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/services/ControlService.java trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/common/DataHandler.java trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/ControlHandler.java Added: trunk/coser-business/src/main/java/fr/ifremer/coser/control/SpeciesLengthControlError.java =================================================================== --- trunk/coser-business/src/main/java/fr/ifremer/coser/control/SpeciesLengthControlError.java (rev 0) +++ trunk/coser-business/src/main/java/fr/ifremer/coser/control/SpeciesLengthControlError.java 2012-08-20 16:37:16 UTC (rev 1058) @@ -0,0 +1,44 @@ +/* + * #%L + * + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 Ifremer, Codelutin, Chatellier Eric + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * #L% + */ + +package fr.ifremer.coser.control; + +/** + * Erreur de controls specifique aux taille des espèces devant par exemple + * afficher un type de graphique particulier dans l'UI. + * + * @author chatellier + * @version $Revision$ + * @since 1.3 + * + * Last update : $Date$ + * By : $Author$ + */ +public class SpeciesLengthControlError extends SpeciesControlError { + + /** serialVersionUID */ + private static final long serialVersionUID = 6646855823928956144L; + +} Property changes on: trunk/coser-business/src/main/java/fr/ifremer/coser/control/SpeciesLengthControlError.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/services/ControlService.java =================================================================== --- trunk/coser-business/src/main/java/fr/ifremer/coser/services/ControlService.java 2012-08-20 16:36:35 UTC (rev 1057) +++ trunk/coser-business/src/main/java/fr/ifremer/coser/services/ControlService.java 2012-08-20 16:37:16 UTC (rev 1058) @@ -67,6 +67,7 @@ import fr.ifremer.coser.control.ControlError; import fr.ifremer.coser.control.DiffCatchLengthControlError; import fr.ifremer.coser.control.SpeciesControlError; +import fr.ifremer.coser.control.SpeciesLengthControlError; import fr.ifremer.coser.data.AbstractDataEntity; import fr.ifremer.coser.data.Catch; import fr.ifremer.coser.data.Haul; @@ -970,10 +971,11 @@ if (Math.abs(nombre - avg) > deviation * config.getStandardDeviationToAverage()) { String lineNumber = tuple[AbstractDataEntity.INDEX_LINE]; - ControlError error = new ControlError(); + SpeciesLengthControlError error = new SpeciesLengthControlError(); error.setCategory(Category.LENGTH); error.setLevel(ValidationLevel.WARNING); error.addLineNumber(lineNumber); + error.setSpecies(species); error.setMessage(_("coser.business.control.error.lengthOutliers", avg, deviation)); error.setDetailMessage(_("coser.business.control.error.lengthOutliersDetail", project.getDisplaySpeciesText(species), avg, deviation, lengthValue)); Modified: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/common/DataHandler.java =================================================================== --- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/common/DataHandler.java 2012-08-20 16:36:35 UTC (rev 1057) +++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/common/DataHandler.java 2012-08-20 16:37:16 UTC (rev 1058) @@ -63,9 +63,11 @@ * @param projectService projectService * @param project project * @param container data container + * @param species selected species (can be null) */ public void displayLengthStructureGraph(final Component parent, final SwingSession session, - final ProjectService projectService, final Project project, final AbstractDataContainer container) { + final ProjectService projectService, final Project project, final AbstractDataContainer container, + final String species) { SwingUtilities.invokeLater(new Runnable() { public void run() { try { @@ -89,9 +91,17 @@ panel.addMatrixFilter(new LengthStructureMatrixFilter(project, container)); panel.setMatrix(matrix); // init default selection and rendering + String defaultSpecies = species; + if (defaultSpecies != null) { + // il faut quand même la traduire car les données + // contiennent les noms déjà traduits + defaultSpecies = project.getDisplaySpeciesText(defaultSpecies); + } else { + defaultSpecies = (String)matrix.getSemantic(1).get(0); + } panel.initRenderering(new List[]{ matrix.getSemantic(0), // select all length - Collections.singletonList(matrix.getSemantic(1).get(0)) // select first species + Collections.singletonList(defaultSpecies) // select first species }, new int[]{-1, -1, 0, 0}); // select dim 3 et 4 sum action matrixViewerFrame.add(panel); matrixViewerFrame.pack(); Modified: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/ControlHandler.java =================================================================== --- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/ControlHandler.java 2012-08-20 16:36:35 UTC (rev 1057) +++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/ControlHandler.java 2012-08-20 16:37:16 UTC (rev 1058) @@ -87,6 +87,7 @@ import fr.ifremer.coser.control.ControlError; import fr.ifremer.coser.control.ControlErrorGroup; import fr.ifremer.coser.control.SpeciesControlError; +import fr.ifremer.coser.control.SpeciesLengthControlError; import fr.ifremer.coser.data.AbstractDataEntity; import fr.ifremer.coser.data.Catch; import fr.ifremer.coser.data.Haul; @@ -642,7 +643,11 @@ if (userObject instanceof SpeciesControlError) { SpeciesControlError error = (SpeciesControlError)userObject; String species = error.getSpecies(); - displayCompareNumberCatchGraph(controlView, species); + if (userObject instanceof SpeciesLengthControlError) { + displayLengthStructureGraph(controlView, species); + } else { + displayCompareNumberCatchGraph(controlView, species); + } } } } @@ -1023,10 +1028,20 @@ * @param view view */ public void displayLengthStructureGraph(ControlView view) { + displayLengthStructureGraph(view, null); + } + + /** + * Display lengthStructure matrix in matrixviewerpanel. + * + * @param view view + * @param species selected species (can be null) + */ + public void displayLengthStructureGraph(ControlView view, String species) { Project project = view.getContextValue(Project.class); ProjectService projectService = view.getContextValue(ProjectService.class); SwingSession session = view.getContextValue(SwingSession.class); - displayLengthStructureGraph(view, session, projectService, project, project.getControl()); + displayLengthStructureGraph(view, session, projectService, project, project.getControl(), species); } /** @@ -1156,7 +1171,8 @@ ProjectService service = view.getContextValue(ProjectService.class); try { - service.validControl(project); + List<ControlError> controlErrors = view.getGlobalControlErrorModel().getControlErrors(); + service.validControl(project, controlErrors); JOptionPane.showMessageDialog(view, _("coser.ui.control.controlValidated"), _("coser.ui.control.controlTitle"), JOptionPane.INFORMATION_MESSAGE); } catch (CoserBusinessException ex) {