r320 - in trunk: coser-business/src/main/java/fr/ifremer/coser/control coser-business/src/main/java/fr/ifremer/coser/services coser-business/src/main/resources/i18n coser-ui/src/main/java/fr/ifremer/coser/ui/control coser-ui/src/main/resources/i18n
Author: chatellier Date: 2010-12-01 14:20:34 +0000 (Wed, 01 Dec 2010) New Revision: 320 Log: Ajout des ?\195?\169tapes dans les barres de progression Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/control/ProgressMonitor.java trunk/coser-business/src/main/java/fr/ifremer/coser/services/ControlService.java trunk/coser-business/src/main/resources/i18n/coser-business_en_GB.properties trunk/coser-business/src/main/resources/i18n/coser-business_fr_FR.properties trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/ControlHandler.java trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/ControlProgressBar.java trunk/coser-ui/src/main/resources/i18n/coser-ui_en_GB.properties trunk/coser-ui/src/main/resources/i18n/coser-ui_fr_FR.properties Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/control/ProgressMonitor.java =================================================================== --- trunk/coser-business/src/main/java/fr/ifremer/coser/control/ProgressMonitor.java 2010-12-01 13:08:42 UTC (rev 319) +++ trunk/coser-business/src/main/java/fr/ifremer/coser/control/ProgressMonitor.java 2010-12-01 14:20:34 UTC (rev 320) @@ -36,6 +36,12 @@ */ public interface ProgressMonitor { + void setStepCount(int stepCount); + + void setStep(int step); + + void nextStep(); + void setCurrent(int current); void setTotal(int total); 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 2010-12-01 13:08:42 UTC (rev 319) +++ trunk/coser-business/src/main/java/fr/ifremer/coser/services/ControlService.java 2010-12-01 14:20:34 UTC (rev 320) @@ -204,6 +204,9 @@ */ public List<ControlError> validateData(Project project, Control control, ProgressMonitor progress) { + progress.setStepCount(10); + progress.setStep(0); + // valide chaque category List<ControlError> validationErrors = new ArrayList<ControlError>(); for (Category category : Category.values()) { @@ -213,22 +216,27 @@ if (categoryErrors != null) { validationErrors.addAll(categoryErrors); } + progress.nextStep(); + // validation specifique de la category List<ControlError> specificErrors = validateCategorySpecific(control, category, progress); if (specificErrors != null) { validationErrors.addAll(specificErrors); } + progress.nextStep(); } } // validation entre catch et length (specific) List<? extends ControlError> diffCatchLengthErrors = validateDiffCatchLength(control, progress); + progress.nextStep(); if (diffCatchLengthErrors != null) { validationErrors.addAll(diffCatchLengthErrors); } // validation par croisement de fichiers List<ControlError> crossFileErrors = validationCrossFiles(project, control, progress); + progress.nextStep(); if (crossFileErrors != null) { validationErrors.addAll(crossFileErrors); } @@ -315,7 +323,7 @@ // update progress if (progress != null) { int progressPercent = (int)((double)lineIndex / (double)total * 100.0); - progress.setText(_("coser.business.control.step.xworks", progressPercent)); + progress.setText(_("coser.business.control.step.xworks", _(category.getTranslationKey()), progressPercent)); progress.setCurrent(lineIndex); ++lineIndex; } @@ -467,7 +475,7 @@ int total = control.getCatch().size() - 1; if (progress != null) { - progress.setText(_("coser.business.control.step.observation", 0)); + progress.setText(_("coser.business.control.step.observation", _(Category.CATCH.getTranslationKey()), 0)); progress.setTotal(total); } @@ -486,7 +494,7 @@ // update progress if (progress != null) { int progressPercent = (int)((double)lineIndex / (double)total * 100.0); - progress.setText(_("coser.business.control.step.observation", progressPercent)); + progress.setText(_("coser.business.control.step.observation", _(Category.CATCH.getTranslationKey()), progressPercent)); progress.setCurrent(lineIndex); ++lineIndex; } @@ -560,7 +568,13 @@ * @return errors */ protected List<? extends ControlError> validateDiffCatchLength(Control control, ProgressMonitor progress) { - + + int total = control.getCatch().size() - 1 + control.getLength().size() - 1; + if (progress != null) { + progress.setText(_("coser.business.control.step.diffCatchLength", 0)); + progress.setTotal(total); + } + List<DiffCatchLengthControlError> validationErrors = new ArrayList<DiffCatchLengthControlError>(); SortedSet<String> setYear = new TreeSet<String>(); @@ -568,7 +582,17 @@ Map<String, Map<String, Double>> catchForSpeciesYears = new HashMap<String, Map<String, Double>>(); Iterator<String[]> itCatchData = control.getCatch().iterator(); itCatchData.next(); // header + int lineIndex = 1; // skip header while (itCatchData.hasNext()) { + + // update progress + if (progress != null) { + int progressPercent = (int)((double)lineIndex / (double)total * 100.0); + progress.setText(_("coser.business.control.step.diffCatchLength", progressPercent)); + progress.setCurrent(lineIndex); + ++lineIndex; + } + String[] tuple = itCatchData.next(); String species = tuple[Catch.INDEX_SPECIES]; @@ -605,6 +629,15 @@ Iterator<String[]> itLengthData = control.getLength().iterator(); itLengthData.next(); // header while (itLengthData.hasNext()) { + + // update progress + if (progress != null) { + int progressPercent = (int)((double)lineIndex / (double)total * 100.0); + progress.setText(_("coser.business.control.step.diffCatchLength", progressPercent)); + progress.setCurrent(lineIndex); + ++lineIndex; + } + String[] tuple = itLengthData.next(); String species = tuple[Length.INDEX_SPECIES]; @@ -698,7 +731,7 @@ int total = control.getLength().size() - 1; if (progress != null) { - progress.setText(_("coser.business.control.step.observation", 0)); + progress.setText(_("coser.business.control.step.observation", _(Category.LENGTH.getTranslationKey()), 0)); progress.setTotal(total); } @@ -717,7 +750,7 @@ // update progress if (progress != null) { int progressPercent = (int)((double)lineIndex / (double)total * 100.0); - progress.setText(_("coser.business.control.step.observation", progressPercent)); + progress.setText(_("coser.business.control.step.observation", _(Category.LENGTH.getTranslationKey()), progressPercent)); progress.setCurrent(lineIndex); ++lineIndex; } @@ -810,9 +843,11 @@ protected List<ControlError> validationCrossFiles(Project project, Control control, ProgressMonitor progress) { + int total = control.getCatch().size() + control.getHaul().size() + + control.getStrata().size() + control.getLength().size() - 4; if (progress != null) { progress.setText(_("coser.business.control.step.crossFileChech", 0)); - progress.setTotal(100); + progress.setTotal(total); progress.setCurrent(0); } @@ -865,7 +900,17 @@ specyTypes.put(specyType, new Integer[]{iMinNumSys, iMaxNumSys}); } + int lineIndex = 1; // skip header while (itCatch.hasNext()) { + + // update progress + if (progress != null) { + int progressPercent = (int)((double)lineIndex / (double)total * 100.0); + progress.setText(_("coser.business.control.step.crossFileChech", progressPercent)); + progress.setCurrent(lineIndex); + ++lineIndex; + } + String[] catchData = itCatch.next(); campagneNames.add(catchData[Catch.INDEX_SURVEY]); catchYear.add(catchData[Catch.INDEX_YEAR]); @@ -885,13 +930,16 @@ crossFilesErrors.add(error); } } - - if (progress != null) { - progress.setText(_("coser.business.control.step.crossFileChech", 25)); - progress.setCurrent(25); - } while (itLength.hasNext()) { + // update progress + if (progress != null) { + int progressPercent = (int)((double)lineIndex / (double)total * 100.0); + progress.setText(_("coser.business.control.step.crossFileChech", progressPercent)); + progress.setCurrent(lineIndex); + ++lineIndex; + } + String[] lengthData = itLength.next(); String species = lengthData[Length.INDEX_SPECIES]; campagneNames.add(lengthData[Length.INDEX_SURVEY]); @@ -948,22 +996,28 @@ } } - if (progress != null) { - progress.setText(_("coser.business.control.step.crossFileChech", 50)); - progress.setCurrent(50); - } - while (itStrata.hasNext()) { + // update progress + if (progress != null) { + int progressPercent = (int)((double)lineIndex / (double)total * 100.0); + progress.setText(_("coser.business.control.step.crossFileChech", progressPercent)); + progress.setCurrent(lineIndex); + ++lineIndex; + } + String[] strataData = itStrata.next(); campagneNames.add(strataData[Strata.INDEX_SURVEY]); } - if (progress != null) { - progress.setText(_("coser.business.control.step.crossFileChech", 75)); - progress.setCurrent(75); - } - while (itHaul.hasNext()) { + // update progress + if (progress != null) { + int progressPercent = (int)((double)lineIndex / (double)total * 100.0); + progress.setText(_("coser.business.control.step.crossFileChech", progressPercent)); + progress.setCurrent(lineIndex); + ++lineIndex; + } + String[] haulData = itHaul.next(); campagneNames.add(haulData[Haul.INDEX_SURVEY]); haulYear.add(haulData[Haul.INDEX_YEAR]); @@ -1027,11 +1081,6 @@ error.setTipMessage(_("coser.business.control.error.missingYearHaulForCatchDataTip")); crossFilesErrors.add(error); } - - if (progress != null) { - progress.setText(_("coser.business.control.step.crossFileChech", 100)); - progress.setCurrent(100); - } return crossFilesErrors; } Modified: trunk/coser-business/src/main/resources/i18n/coser-business_en_GB.properties =================================================================== --- trunk/coser-business/src/main/resources/i18n/coser-business_en_GB.properties 2010-12-01 13:08:42 UTC (rev 319) +++ trunk/coser-business/src/main/resources/i18n/coser-business_en_GB.properties 2010-12-01 14:20:34 UTC (rev 320) @@ -53,8 +53,9 @@ coser.business.control.error.yearsNotEquals=Years are not equals in 4 data files coser.business.control.noerrorfound=No error found coser.business.control.step.crossFileChech=Cross file checks (%d%%) -coser.business.control.step.observation=Checking observation number (%d%%) -coser.business.control.step.xworks=Line checks (%d%%) +coser.business.control.step.diffCatchLength=Check diff catch/length (%d%%) +coser.business.control.step.observation=Checking observation number \: %s (%d%%) +coser.business.control.step.xworks=Line checks \: %s (%d%%) coser.business.line=Line coser.business.publication.htmlexportlines=Lines coser.business.publication.htmlexporttitle=Error report for project %s Modified: trunk/coser-business/src/main/resources/i18n/coser-business_fr_FR.properties =================================================================== --- trunk/coser-business/src/main/resources/i18n/coser-business_fr_FR.properties 2010-12-01 13:08:42 UTC (rev 319) +++ trunk/coser-business/src/main/resources/i18n/coser-business_fr_FR.properties 2010-12-01 14:20:34 UTC (rev 320) @@ -53,8 +53,9 @@ coser.business.control.error.yearsNotEquals=Les ann\u00E9es ne sont pas identiques dans les 4 fichiers coser.business.control.noerrorfound=Aucune erreur d\u00E9tect\u00E9e coser.business.control.step.crossFileChech=V\u00E9rification par croisement de fichiers (%d%%) -coser.business.control.step.observation=V\u00E9rification du nombre d'observation (%d%%) -coser.business.control.step.xworks=Validation par lignes (%d%%) +coser.business.control.step.diffCatchLength=V\u00E9rification des diff\u00E9rences captures/taille (%d%%) +coser.business.control.step.observation=V\u00E9rification du nombre d'observation \: %s (%d%%) +coser.business.control.step.xworks=Validation par lignes \: %s (%d%%) coser.business.line=Ligne coser.business.publication.htmlexportlines=Lignes coser.business.publication.htmlexporttitle=Rapport d'erreur pour le projet %s 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 2010-12-01 13:08:42 UTC (rev 319) +++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/ControlHandler.java 2010-12-01 14:20:34 UTC (rev 320) @@ -57,7 +57,6 @@ import javax.swing.SwingWorker; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; -import javax.swing.event.ListSelectionEvent; import javax.swing.event.TreeSelectionEvent; import javax.swing.tree.TreePath; Modified: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/ControlProgressBar.java =================================================================== --- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/ControlProgressBar.java 2010-12-01 13:08:42 UTC (rev 319) +++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/ControlProgressBar.java 2010-12-01 14:20:34 UTC (rev 320) @@ -23,6 +23,8 @@ package fr.ifremer.coser.ui.control; +import static org.nuiton.i18n.I18n._; + import javax.swing.JProgressBar; import fr.ifremer.coser.control.ProgressMonitor; @@ -40,9 +42,35 @@ /** serialVersionUID. */ private static final long serialVersionUID = 3383288562693714316L; - protected double total; + protected int stepCount; + + protected int step; /* + * @see fr.ifremer.coser.control.ProgressMonitor#setStepCount(int) + */ + @Override + public void setStepCount(int stepCount) { + this.stepCount = stepCount; + } + + /* + * @see fr.ifremer.coser.control.ProgressMonitor#setStep(int) + */ + @Override + public void setStep(int step) { + this.step = step; + } + + /* + * @see fr.ifremer.coser.control.ProgressMonitor#nextStep() + */ + @Override + public void nextStep() { + step++; + } + + /* * @see fr.ifremer.coser.control.ProgressMonitor#setCurrent(double) */ @Override @@ -60,6 +88,6 @@ @Override public void setText(String text) { - setString(text); + setString(_("coser.ui.control.progressStep", step +1, stepCount, text)); } } Modified: trunk/coser-ui/src/main/resources/i18n/coser-ui_en_GB.properties =================================================================== --- trunk/coser-ui/src/main/resources/i18n/coser-ui_en_GB.properties 2010-12-01 13:08:42 UTC (rev 319) +++ trunk/coser-ui/src/main/resources/i18n/coser-ui_en_GB.properties 2010-12-01 14:20:34 UTC (rev 320) @@ -42,6 +42,7 @@ coser.ui.control.graphtitle=Graph coser.ui.control.htmlReportCantBeOpened=HTML report as been generated in \:\n%s\nbut it can't be opened because default system browser in undefined \! coser.ui.control.htmlReportError=Open error +coser.ui.control.progressStep=Step %d/%d \: %s coser.ui.control.project.requiredauthor=Author field is required coser.ui.control.project.requiredcatchFile=Catch file is required coser.ui.control.project.requiredhaulFile=Haul file is required Modified: trunk/coser-ui/src/main/resources/i18n/coser-ui_fr_FR.properties =================================================================== --- trunk/coser-ui/src/main/resources/i18n/coser-ui_fr_FR.properties 2010-12-01 13:08:42 UTC (rev 319) +++ trunk/coser-ui/src/main/resources/i18n/coser-ui_fr_FR.properties 2010-12-01 14:20:34 UTC (rev 320) @@ -42,6 +42,7 @@ coser.ui.control.graphtitle=Graphique coser.ui.control.htmlReportCantBeOpened=Le rapport HTML a \u00E9t\u00E9 g\u00E9n\u00E9r\u00E9 dans le fichier \:\n%s\nmais ne peut pas \u00EAtre ouvert automatiquement car le navigateur\npar d\u00E9faut du syst\u00E8me n'est pas d\u00E9fini \! coser.ui.control.htmlReportError=Erreur d'ouverture +coser.ui.control.progressStep=\u00C9tape %d/%d \: %s coser.ui.control.project.requiredauthor=Le champ 'auteur' est requis coser.ui.control.project.requiredcatchFile=Le fichier 'capture' est requis coser.ui.control.project.requiredhaulFile=Le fichier 'traits' est requis
participants (1)
-
chatellierï¼ users.labs.libre-entreprise.org