Coser-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
December 2010
- 2 participants
- 139 discussions
r323 - in trunk/coser-ui/src/main: java/fr/ifremer/coser/ui/selection resources/i18n
by chatellier@users.labs.libre-entreprise.org 01 Dec '10
by chatellier@users.labs.libre-entreprise.org 01 Dec '10
01 Dec '10
Author: chatellier
Date: 2010-12-01 15:04:31 +0000 (Wed, 01 Dec 2010)
New Revision: 323
Log:
Ajout de tooltip et icons
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/SelectionListsView.jaxx
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-ui/src/main/java/fr/ifremer/coser/ui/selection/SelectionDetailsView.jaxx
===================================================================
--- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/selection/SelectionDetailsView.jaxx 2010-12-01 15:04:16 UTC (rev 322)
+++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/selection/SelectionDetailsView.jaxx 2010-12-01 15:04:31 UTC (rev 323)
@@ -56,7 +56,7 @@
<cell weightx="1" fill="horizontal" columns="2">
<JToolBar floatable="false">
<JButton id="saveSelectionButton" text="coser.ui.selection.details.saveSelection"
- onActionPerformed="getHandler().saveSelection(this)" />
+ icon="disk.png" onActionPerformed="getHandler().saveSelection(this)" />
</JToolBar>
</cell>
</row>
@@ -187,6 +187,7 @@
<row>
<cell>
<JButton icon="arrow_right.png"
+ toolTipText="coser.ui.selection.details.addToSelectedListTip"
onActionPerformed="getHandler().addSelectedFilteredSpecies(this)"
enabled="{getFilteredSpecyList().getSelectedIndex() != -1 && isYearsValidated() && isStrataValidated()}"/>
</cell>
@@ -194,6 +195,7 @@
<row>
<cell>
<JButton icon="arrow_left.png"
+ toolTipText="coser.ui.selection.details.removeFromSelectedListTip"
onActionPerformed="getHandler().removeSelectedSpecies(this)"
enabled="{getSelectedSpecyList().getSelectedIndex() != -1 && isYearsValidated() && isStrataValidated()}"/>
</cell>
@@ -201,6 +203,7 @@
<row>
<cell>
<JButton icon="chart_curve.png"
+ toolTipText="coser.ui.selection.details.displayDiffCatchLengthGraphTip"
onActionPerformed='getHandler().showSelectedSpeciesGraph(this, "SPECIESGRAPH")'
enabled="{getFilteredSpecyList().getSelectedIndex() != -1 && isYearsValidated() && isStrataValidated()}" />
</cell>
Modified: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/selection/SelectionListsView.jaxx
===================================================================
--- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/selection/SelectionListsView.jaxx 2010-12-01 15:04:16 UTC (rev 322)
+++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/selection/SelectionListsView.jaxx 2010-12-01 15:04:31 UTC (rev 323)
@@ -51,9 +51,9 @@
<cell columns="8" weightx="1" fill="horizontal">
<JToolBar floatable="false">
<JButton id="saveSelectionButton" text="coser.ui.selection.details.saveSelection"
- onActionPerformed="getHandler().saveSelection(this)" />
+ icon="disk.png" onActionPerformed="getHandler().saveSelection(this)" />
<JButton id="validSelectionButton" text="coser.ui.selection.details.validSelection"
- onActionPerformed="getHandler().validSelection(this)" />
+ icon="accept.png" onActionPerformed="getHandler().validSelection(this)" />
</JToolBar>
</cell>
</row>
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 15:04:16 UTC (rev 322)
+++ trunk/coser-ui/src/main/resources/i18n/coser-ui_en_GB.properties 2010-12-01 15:04:31 UTC (rev 323)
@@ -135,11 +135,14 @@
coser.ui.selection.allSpecies=L1 \: All species
coser.ui.selection.comment=Comment \:
coser.ui.selection.createError=Creation error
+coser.ui.selection.details.addToSelectedListTip=Add selected species to selected species list.
coser.ui.selection.details.comment=Comments \:
coser.ui.selection.details.dates=Years \:
coser.ui.selection.details.description=Description \:
+coser.ui.selection.details.displayDiffCatchLengthGraphTip=Display selected species's comparison catch/length graphs.
coser.ui.selection.details.filteredSpecies=Filtered species (%d/%d) \:
coser.ui.selection.details.name=Selection name \:
+coser.ui.selection.details.removeFromSelectedListTip=Remove selected species from selected species list
coser.ui.selection.details.saveSelection=Save selection
coser.ui.selection.details.selectedSpecies=L1 \: Selected species (%d/%d) \:
coser.ui.selection.details.showMapTip=Display strata map
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 15:04:16 UTC (rev 322)
+++ trunk/coser-ui/src/main/resources/i18n/coser-ui_fr_FR.properties 2010-12-01 15:04:31 UTC (rev 323)
@@ -135,11 +135,14 @@
coser.ui.selection.allSpecies=L1 \: Toutes les esp\u00E8ces
coser.ui.selection.comment=Commentaire \:
coser.ui.selection.createError=Erreur de cr\u00E9action
+coser.ui.selection.details.addToSelectedListTip=Ajoute les esp\u00E8ces s\u00E9lectionn\u00E9es \u00E0 la liste des especes s\u00E9lectionn\u00E9es.
coser.ui.selection.details.comment=Commentaire \:
coser.ui.selection.details.dates=Ann\u00E9es \:
coser.ui.selection.details.description=Description \:
+coser.ui.selection.details.displayDiffCatchLengthGraphTip=Affiche les graphiques des diff\u00E9rences captures/tailles pour les esp\u00E8ces s�ctionn�.
coser.ui.selection.details.filteredSpecies=Esp\u00E8ces filtr\u00E9es (%d/%d) \:
coser.ui.selection.details.name=Nom de la s\u00E9lection \:
+coser.ui.selection.details.removeFromSelectedListTip=Retire les esp\u00E8ces s\u00E9lectionn\u00E9es de la liste des esp\u00E8ces s\u00E9lectionn\u00E9es
coser.ui.selection.details.saveSelection=Sauvegarder la s\u00E9lection
coser.ui.selection.details.selectedSpecies=L1 \: Esp\u00E8ces s\u00E9lectionn\u00E9es (%d/%d) \:
coser.ui.selection.details.showMapTip=Afficher la carte des strates
1
0
r322 - trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control
by chatellier@users.labs.libre-entreprise.org 01 Dec '10
by chatellier@users.labs.libre-entreprise.org 01 Dec '10
01 Dec '10
Author: chatellier
Date: 2010-12-01 15:04:16 +0000 (Wed, 01 Dec 2010)
New Revision: 322
Log:
Import
Modified:
trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/ControlHandler.java
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 14:39:38 UTC (rev 321)
+++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/ControlHandler.java 2010-12-01 15:04:16 UTC (rev 322)
@@ -58,6 +58,7 @@
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import javax.swing.event.TreeSelectionEvent;
+import javax.swing.table.TableColumn;
import javax.swing.tree.TreePath;
import jaxx.runtime.JAXXUtil;
1
0
r321 - in trunk: 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
by chatellier@users.labs.libre-entreprise.org 01 Dec '10
by chatellier@users.labs.libre-entreprise.org 01 Dec '10
01 Dec '10
Author: chatellier
Date: 2010-12-01 14:39:38 +0000 (Wed, 01 Dec 2010)
New Revision: 321
Log:
Ajout d'un control sur l'absence de taille alors que des captures sont pr?\195?\169sente
Modified:
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/resources/log4j.properties
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 14:20:34 UTC (rev 320)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/services/ControlService.java 2010-12-01 14:39:38 UTC (rev 321)
@@ -576,7 +576,10 @@
}
List<DiffCatchLengthControlError> validationErrors = new ArrayList<DiffCatchLengthControlError>();
+
+ // data necessary for compute
SortedSet<String> setYear = new TreeSet<String>();
+ Set<String> missingYearLengthSpecies = new HashSet<String>();
// look for data (data summed over catch)
Map<String, Map<String, Double>> catchForSpeciesYears = new HashMap<String, Map<String, Double>>();
@@ -693,20 +696,33 @@
lengthNumber = 0.0; // marche pour NA
}
- // diff entre 4 et 5 = (5-4) * 100 / 5
- double min = Math.min(catchNumber, lengthNumber);
- // si c'est 0, ou absence de catures, ce n'est pas une erreur
- if (min > 0) {
- double max = Math.max(catchNumber, lengthNumber);
- double diff = (max - min) * 100 / max;
-
- if (diff > config.getControlDiffCatchLength()) {
- DiffCatchLengthControlError error = new DiffCatchLengthControlError();
- error.setSpecies(species);
- error.setLevel(ValidationLevel.WARNING);
- error.setMessage(_("coser.business.control.error.diffCatchLength"));
- error.setDetailMessage(_("coser.business.control.error.diffCatchLengthDetail", species, year));
- validationErrors.add(error);
+ // warning si taille = 0 et captures différent de 0
+ // nomespece, année(s) avec absence de taille
+ if (lengthNumber == 0 && catchNumber > 0 && !missingYearLengthSpecies.contains(species)) {
+ DiffCatchLengthControlError error = new DiffCatchLengthControlError();
+ error.setSpecies(species);
+ error.setLevel(ValidationLevel.WARNING);
+ error.setMessage(_("coser.business.control.error.diffCatchLengthMissingYear"));
+ error.setDetailMessage(_("coser.business.control.error.diffCatchLengthMissingYearDetail", species));
+ validationErrors.add(error);
+ missingYearLengthSpecies.add(species);
+ }
+ else {
+ // diff entre 4 et 5 = (5-4) * 100 / 5
+ double min = Math.min(catchNumber, lengthNumber);
+ // si c'est 0, ou absence de catures, ce n'est pas une erreur
+ if (min > 0) {
+ double max = Math.max(catchNumber, lengthNumber);
+ double diff = (max - min) * 100 / max;
+
+ if (diff > config.getControlDiffCatchLength()) {
+ DiffCatchLengthControlError error = new DiffCatchLengthControlError();
+ error.setSpecies(species);
+ error.setLevel(ValidationLevel.WARNING);
+ error.setMessage(_("coser.business.control.error.diffCatchLength"));
+ error.setDetailMessage(_("coser.business.control.error.diffCatchLengthDetail", species, year));
+ validationErrors.add(error);
+ }
}
}
}
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 14:20:34 UTC (rev 320)
+++ trunk/coser-business/src/main/resources/i18n/coser-business_en_GB.properties 2010-12-01 14:39:38 UTC (rev 321)
@@ -30,6 +30,8 @@
coser.business.control.error.allCategories=All categories
coser.business.control.error.diffCatchLength=Differences between length and catch
coser.business.control.error.diffCatchLengthDetail=Differences between length and catch for species %s (year \: %s)
+coser.business.control.error.diffCatchLengthMissingYear=Years without length
+coser.business.control.error.diffCatchLengthMissingYearDetail=%s, year(s) without length
coser.business.control.error.duplicatedLine=Duplicated line
coser.business.control.error.duplicatedLineDetails=Duplicated line for key \: %s
coser.business.control.error.invalidLengthLengthStep=Invalid length step (authorized centimeters and half-centimeters)
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 14:20:34 UTC (rev 320)
+++ trunk/coser-business/src/main/resources/i18n/coser-business_fr_FR.properties 2010-12-01 14:39:38 UTC (rev 321)
@@ -30,6 +30,8 @@
coser.business.control.error.allCategories=Toutes les cat\u00E9gories
coser.business.control.error.diffCatchLength=Diff\u00E9rence entre les captures et taille
coser.business.control.error.diffCatchLengthDetail=Diff\u00E9rence entre les captures et taille pour l'esp\u00E8ce %s (ann\u00E9e %s)
+coser.business.control.error.diffCatchLengthMissingYear=Ann\u00E9e(s) avec absence de taille
+coser.business.control.error.diffCatchLengthMissingYearDetail=%s, ann\u00E9e(s) avec absence de taille
coser.business.control.error.duplicatedLine=Ligne en doublon
coser.business.control.error.duplicatedLineDetails=Ligne en doublon pour la cl\u00E9 \: %s
coser.business.control.error.invalidLengthLengthStep=Le pas de longueur est invalide (autoris\u00E9 centim\u00E8tre et demi-centim\u00E8tre)
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 14:20:34 UTC (rev 320)
+++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/ControlHandler.java 2010-12-01 14:39:38 UTC (rev 321)
@@ -395,7 +395,7 @@
List<ControlError> errors = get();
view.getGlobalControlErrorModel().setControlErrors(errors);
- // hack parce que impossible de faire un fire
+ // hack parce que impossible de faire un faire
// sans que les colonnes soit redimentionnées
SwingUtil.fixTableColumnWidth(view.getGlobalControlErrorTable(), 1, 25);
Modified: trunk/coser-ui/src/main/resources/log4j.properties
===================================================================
--- trunk/coser-ui/src/main/resources/log4j.properties 2010-12-01 14:20:34 UTC (rev 320)
+++ trunk/coser-ui/src/main/resources/log4j.properties 2010-12-01 14:39:38 UTC (rev 321)
@@ -38,4 +38,4 @@
log4j.appender.file.layout.ConversionPattern=%d{dd-MM-yy HH:mm:ss} %5p %c:%L - %m%n
# Specific logging
-#log4j.category.fr.ifremer.coser=DEBUG
+log4j.category.fr.ifremer.coser=DEBUG
1
0
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
by chatellier@users.labs.libre-entreprise.org 01 Dec '10
by chatellier@users.labs.libre-entreprise.org 01 Dec '10
01 Dec '10
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
1
0
r319 - in trunk/coser-business/src/main/java/fr/ifremer/coser: control services
by chatellier@users.labs.libre-entreprise.org 01 Dec '10
by chatellier@users.labs.libre-entreprise.org 01 Dec '10
01 Dec '10
Author: chatellier
Date: 2010-12-01 13:08:42 +0000 (Wed, 01 Dec 2010)
New Revision: 319
Log:
Tri alphabetique des erreurs diff capture/taille sur le nom de l'espece
Modified:
trunk/coser-business/src/main/java/fr/ifremer/coser/control/DiffCatchLengthControlError.java
trunk/coser-business/src/main/java/fr/ifremer/coser/services/ControlService.java
Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/control/DiffCatchLengthControlError.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/control/DiffCatchLengthControlError.java 2010-12-01 12:57:49 UTC (rev 318)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/control/DiffCatchLengthControlError.java 2010-12-01 13:08:42 UTC (rev 319)
@@ -25,6 +25,7 @@
package fr.ifremer.coser.control;
+
/**
* Erreur de controle specifique pour les différences des nombres entre
* les captures et les tailles pour utilisation typée de cette erreur
@@ -36,7 +37,7 @@
* Last update : $Date$
* By : $Author$
*/
-public class DiffCatchLengthControlError extends ControlError {
+public class DiffCatchLengthControlError extends ControlError implements Comparable<DiffCatchLengthControlError> {
/** serialVersionUID. */
private static final long serialVersionUID = -3254763296138201677L;
@@ -50,4 +51,13 @@
public void setSpecies(String species) {
this.species = species;
}
+
+ @Override
+ public int compareTo(DiffCatchLengthControlError o) {
+ int result = -1;
+ if (species != null) {
+ result = species.compareTo(o.species);
+ }
+ return result;
+ }
}
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 12:57:49 UTC (rev 318)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/services/ControlService.java 2010-12-01 13:08:42 UTC (rev 319)
@@ -29,6 +29,7 @@
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
@@ -221,7 +222,7 @@
}
// validation entre catch et length (specific)
- List<ControlError> diffCatchLengthErrors = validateDiffCatchLength(control);
+ List<? extends ControlError> diffCatchLengthErrors = validateDiffCatchLength(control, progress);
if (diffCatchLengthErrors != null) {
validationErrors.addAll(diffCatchLengthErrors);
}
@@ -550,14 +551,17 @@
* Detecte des différences entre les nombres dans captures
* et les nombres dand taille.
*
+ * @param control data container
+ * @param progress progress
+ *
* @see PublicationService#getCompareCatchLengthGraph(Project, Control, String) for details
* @see CoserBusinessConfig#getControlDiffCatchLength() for option
*
* @return errors
*/
- protected List<ControlError> validateDiffCatchLength(Control control) {
+ protected List<? extends ControlError> validateDiffCatchLength(Control control, ProgressMonitor progress) {
- List<ControlError> validationErrors = new ArrayList<ControlError>();
+ List<DiffCatchLengthControlError> validationErrors = new ArrayList<DiffCatchLengthControlError>();
SortedSet<String> setYear = new TreeSet<String>();
// look for data (data summed over catch)
@@ -674,7 +678,10 @@
}
}
}
-
+
+ // classer les warning sur les controle de différences capture/taille
+ // par ordre alphabetique des noms d'especes
+ Collections.sort(validationErrors);
return validationErrors;
}
1
0
r318 - in trunk/coser-ui/src/main: java/fr/ifremer/coser java/fr/ifremer/coser/ui java/fr/ifremer/coser/ui/control java/fr/ifremer/coser/ui/util resources/i18n
by chatellier@users.labs.libre-entreprise.org 01 Dec '10
by chatellier@users.labs.libre-entreprise.org 01 Dec '10
01 Dec '10
Author: chatellier
Date: 2010-12-01 12:57:49 +0000 (Wed, 01 Dec 2010)
New Revision: 318
Log:
Duplication des 4 tables pour que la restauration de la taille des colonnes fonctionne.
Modified:
trunk/coser-ui/src/main/java/fr/ifremer/coser/Coser.java
trunk/coser-ui/src/main/java/fr/ifremer/coser/CoserConfig.java
trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/CoserFrameHandler.java
trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/ControlDataTableModel.java
trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/ControlHandler.java
trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/ControlView.jaxx
trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/util/ErrorHelper.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-ui/src/main/java/fr/ifremer/coser/Coser.java
===================================================================
--- trunk/coser-ui/src/main/java/fr/ifremer/coser/Coser.java 2010-12-01 10:05:30 UTC (rev 317)
+++ trunk/coser-ui/src/main/java/fr/ifremer/coser/Coser.java 2010-12-01 12:57:49 UTC (rev 318)
@@ -112,7 +112,6 @@
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
-
// init LAF (from configuration)
try {
String lafClassName = coserConfig.getLookAndFeel();
Modified: trunk/coser-ui/src/main/java/fr/ifremer/coser/CoserConfig.java
===================================================================
--- trunk/coser-ui/src/main/java/fr/ifremer/coser/CoserConfig.java 2010-12-01 10:05:30 UTC (rev 317)
+++ trunk/coser-ui/src/main/java/fr/ifremer/coser/CoserConfig.java 2010-12-01 12:57:49 UTC (rev 318)
@@ -78,6 +78,15 @@
return result;
}
+ public void setsmtpHost(String smtpHost) {
+ setOption(CoserOption.SMTP_HOST.key, smtpHost);
+ }
+
+ public String getSmtpHost() {
+ String result = getOption(CoserOption.SMTP_HOST.key);
+ return result;
+ }
+
public void setSupportEmail(String supportEmail) {
setOption(CoserOption.SUPPORT_EMAIL.key, supportEmail);
}
@@ -93,6 +102,7 @@
LOCALE("coser.locale", _("coser.config.locale.description"), Locale.FRANCE.toString(), Locale.class, false, false),
LOOKANDFEEL("coser.lookandfeel", _("coser.config.lookandfeel.description"), "Nimbus", String.class, false, false),
APPLICATION_VERSION("coser.application.version", _("coser.config.application.version.description"), null, String.class, false, false),
+ SMTP_HOST("coser.smtp.host", _("coser.config.smtp.host.description"), "smtp", String.class, false, false),
SUPPORT_EMAIL("coser.support.email", _("coser.config.support.email.description"), "support at codelutin.com", String.class, false, false);
protected String key;
Modified: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/CoserFrameHandler.java
===================================================================
--- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/CoserFrameHandler.java 2010-12-01 10:05:30 UTC (rev 317)
+++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/CoserFrameHandler.java 2010-12-01 12:57:49 UTC (rev 318)
@@ -176,6 +176,11 @@
modelBuilder.addOption(CoserBusinessConfig.CoserBusinessOption.CONTROL_TYPE_FISH);
modelBuilder.addOption(CoserBusinessConfig.CoserBusinessOption.SELECTION_FILTER_OCCURRENCE);
modelBuilder.addOption(CoserBusinessConfig.CoserBusinessOption.SELECTION_FILTER_DENSITY);
+
+ // category misc
+ modelBuilder.addCategory(_("coser.config.category.misc"), _("coser.config.category.misc.description"));
+ modelBuilder.addOption(CoserConfig.CoserOption.SMTP_HOST);
+ modelBuilder.addOption(CoserConfig.CoserOption.SUPPORT_EMAIL);
ConfigUI configUI = modelBuilder.buildUI(view, _("coser.config.category.path"));
JDialog dialogUI = new JDialog(view, _("coser.ui.config.title"));
Modified: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/ControlDataTableModel.java
===================================================================
--- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/ControlDataTableModel.java 2010-12-01 10:05:30 UTC (rev 317)
+++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/ControlDataTableModel.java 2010-12-01 12:57:49 UTC (rev 318)
@@ -47,15 +47,18 @@
protected DataStorage data;
+ protected Category category;
+
protected String[] header;
- public ControlDataTableModel(ControlView controlView) {
+ public ControlDataTableModel(ControlView controlView, Category category) {
+ super();
+ this.category = category;
updateData(controlView);
}
- public void updateData(ControlView controlView) {
+ protected void updateData(ControlView controlView) {
Project project = controlView.getContextValue(Project.class);
- Category category = (Category)controlView.getCategoryComboBoxModel().getSelectedItem();
switch (category) {
case CATCH:
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 10:05:30 UTC (rev 317)
+++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/ControlHandler.java 2010-12-01 12:57:49 UTC (rev 318)
@@ -53,6 +53,7 @@
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.JViewport;
+import javax.swing.ListSelectionModel;
import javax.swing.SwingWorker;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
@@ -76,16 +77,16 @@
import fr.ifremer.coser.CoserConstants.ValidationLevel;
import fr.ifremer.coser.CoserException;
import fr.ifremer.coser.bean.Project;
+import fr.ifremer.coser.control.ControlError;
import fr.ifremer.coser.control.ControlErrorGroup;
-import fr.ifremer.coser.control.ControlError;
import fr.ifremer.coser.data.AbstractDataEntity;
import fr.ifremer.coser.data.Catch;
import fr.ifremer.coser.data.Haul;
import fr.ifremer.coser.data.Length;
import fr.ifremer.coser.data.Strata;
+import fr.ifremer.coser.services.ControlService;
import fr.ifremer.coser.services.ProjectService;
import fr.ifremer.coser.services.PublicationService;
-import fr.ifremer.coser.services.ControlService;
/**
* Control handler for control view.
@@ -101,17 +102,61 @@
private static final Log log = LogFactory.getLog(ControlHandler.class);
/**
+ * Return l'intance de la table qui est selectionnée.
+ *
+ * Les 4 table sont dupliquées juste pour concerver l'etat des colonnes.
+ *
+ * @param view view
+ * @return la table affichée (suivante la categorie)
+ */
+ protected JTable getControlDataTable(ControlView controlView) {
+ Category category = (Category)controlView.getCategoryComboBox().getSelectedItem();
+ JTable controlDataTable = null;
+
+ switch (category) {
+ case CATCH:
+ controlDataTable = controlView.getControlDataTableCatch();
+ break;
+ case HAUL:
+ controlDataTable = controlView.getControlDataTableHaul();
+ break;
+ case LENGTH:
+ controlDataTable = controlView.getControlDataTableLength();
+ break;
+ case STRATA:
+ controlDataTable = controlView.getControlDataTableStrata();
+ break;
+ }
+ return controlDataTable;
+ }
+
+ /**
* Selection d'une nouvelle categories dans la liste des categories.
*
- * @param view view
+ * @param controlView controlView
* @param event event
*/
- public void categoryChanged(ControlView view, ActionEvent event) {
- ControlDataTableModel model = (ControlDataTableModel)view.getControlDataTable().getModel();
- model.updateData(view);
+ public void categoryChanged(ControlView controlView, ActionEvent event) {
+ Category category = (Category)controlView.getCategoryComboBox().getSelectedItem();
+ controlView.getControlTablesLayout().show(controlView.getControlTablesPanel(), category.toString());
+ clearAllSelection(controlView);
}
/**
+ * Vide la selection des 4 tables pour que le bean en cours d'edition
+ * soit vidé et que le changement de categories n'arrive pas
+ * dans un etat de selection incoherent.
+ *
+ * @param controlView controlView
+ */
+ protected void clearAllSelection(ControlView controlView) {
+ controlView.getControlDataTableSelectionModelCatch().clearSelection();
+ controlView.getControlDataTableSelectionModelHaul().clearSelection();
+ controlView.getControlDataTableSelectionModelLength().clearSelection();
+ controlView.getControlDataTableSelectionModelStrata().clearSelection();
+ }
+
+ /**
* Affiche le menu contextuel de la table qui contient les données.
*
* @param controlView view
@@ -121,15 +166,16 @@
// clic contextuel
if (event.getButton() == MouseEvent.BUTTON3) {
- int[] dataSelectedRows = controlView.getControlDataTable().getSelectedRows();
- final int columnIndex = controlView.getControlDataTable().getColumnModel().getColumnIndexAtX(event.getX());
+ JTable displayedTable = getControlDataTable(controlView);
+ int[] dataSelectedRows = displayedTable.getSelectedRows();
+ final int columnIndex = displayedTable.getColumnModel().getColumnIndexAtX(event.getX());
JPopupMenu popupMenu = new JPopupMenu(_("coser.ui.control.dataMenuLabel"));
// plusieurs lignes selectionnées et pas la premiere colonne (Line index)
if (dataSelectedRows.length > 0 && columnIndex > 0) {
- ControlDataTableModel controlDataModel = controlView.getControlDataTableModel();
- final String columnName = controlView.getControlDataTable().getColumnName(columnIndex);
+ ControlDataTableModel controlDataModel = (ControlDataTableModel)displayedTable.getModel();
+ final String columnName = displayedTable.getColumnName(columnIndex);
final String firstValue = (String)controlDataModel.getValueAt(dataSelectedRows[0], columnIndex);
// replace in selection
@@ -152,7 +198,7 @@
// replace in everywhere
if (columnIndex > 0) {
- final String columnName = controlView.getControlDataTable().getColumnName(columnIndex);
+ final String columnName = displayedTable.getColumnName(columnIndex);
JMenuItem replaceAllMenu = new JMenuItem(_("coser.ui.control.dataMenuReplaceAll", columnName));
replaceAllMenu.addActionListener(new ActionListener() {
@Override
@@ -181,7 +227,7 @@
popupMenu.add(deleteSelectedMenu);
}
- popupMenu.show(controlView.getControlDataTable(), event.getX(), event.getY());
+ popupMenu.show(displayedTable, event.getX(), event.getY());
}
}
@@ -192,7 +238,7 @@
*/
protected void deletedSelectedDataLines(ControlView controlView) {
- JTable controlDataTable = controlView.getControlDataTable();
+ JTable controlDataTable = getControlDataTable(controlView);
int[] selectedLines = controlDataTable.getSelectedRows();
if (ArrayUtils.isNotEmpty(selectedLines)) {
@@ -238,7 +284,8 @@
ControlView controlView = replaceView.getContextValue(ControlView.class, JAXXUtil.PARENT);
Category category = (Category)controlView.getCategoryComboBox().getSelectedItem();
- ControlDataTableModel controlDataModel = controlView.getControlDataTableModel();
+ JTable displayedTable = getControlDataTable(controlView);
+ ControlDataTableModel controlDataModel = (ControlDataTableModel)displayedTable.getModel();
ProjectService projectService = replaceView.getContextValue(ProjectService.class);
Project project = replaceView.getContextValue(Project.class);
@@ -277,7 +324,7 @@
if (replaceView.isReplaceInSelection()) {
// on suppose que la fenetre est modale, et
// que la selection ne peut pas avoir changée
- int[] dataSelectedRows = controlView.getControlDataTable().getSelectedRows();
+ int[] dataSelectedRows = displayedTable.getSelectedRows();
for (int dataSelectedRow : dataSelectedRows) {
String[] data = controlDataModel.getDataAt(dataSelectedRow);
boolean replaced = projectService.replaceFieldValue(project, category, field, find, replace, data, false, commandUUID);
@@ -289,7 +336,7 @@
}
}
else {
- int rowCount = controlView.getControlDataTableModel().getRowCount();
+ int rowCount = controlDataModel.getRowCount();
for (int rowIndex = 0 ; rowIndex < rowCount ; ++rowIndex) {
String[] data = controlDataModel.getDataAt(rowIndex);
boolean replaced = projectService.replaceFieldValue(project, category, field, find, replace, data, false, commandUUID);
@@ -319,7 +366,7 @@
/**
* Check project.
*
- * @param view
+ * @param view view
*/
public void checkData(final ControlView view) {
final ControlService validationService = view.getContextValue(ControlService.class);
@@ -372,16 +419,6 @@
};
task.execute();
}
-
- /**
- * Called when selection change.
- *
- * @param view
- * @param event
- */
- public void controlDataTableSelectionChanged(ControlView view, ListSelectionEvent event) {
- controlDataTableSelectionChanged(view);
- }
/**
* Called when selection change to display selected bean
@@ -391,10 +428,9 @@
*/
public void controlDataTableSelectionChanged(ControlView view) {
- JTable table = view.getControlDataTable();
+ JTable table = getControlDataTable(view);
int[] selectedRows = table.getSelectedRows();
if (selectedRows.length == 1) {
-
int selectedRow = selectedRows[0];
Project project = view.getContextValue(Project.class);
Category category = (Category)view.getCategoryComboBox().getSelectedItem();
@@ -424,9 +460,7 @@
updateEditionPanel(view, category, header, line);
}
else {
- if (log.isDebugEnabled()) {
- log.debug("Clear edition row panel");
- }
+ // clear edition panel
updateEditionPanel(view, null, null, null);
}
}
@@ -455,17 +489,20 @@
Set<String> errorLineNumbers = error.getLineNumbers();
// peut être vide, si l'erreur ne porte pas sur un bean en particulier
if (errorLineNumbers != null) {
- view.getControlDataTableSelectionModel().clearSelection();
+ JTable displayedTable = getControlDataTable(view);
+ ControlDataTableModel tableModel = (ControlDataTableModel)displayedTable.getModel();
+ ListSelectionModel selectionModel = displayedTable.getSelectionModel();
+ selectionModel.clearSelection();
boolean first = true;
for (String errorLineNumber : errorLineNumbers) {
- int errorLineIndex = view.getControlDataTableModel().getRealIndexOfLine(errorLineNumber);
+ int errorLineIndex = tableModel.getRealIndexOfLine(errorLineNumber);
// ca peut arriver si la ligne a été supprimée
if (errorLineIndex >= 0) {
- view.getControlDataTableSelectionModel().addSelectionInterval(errorLineIndex, errorLineIndex);
+ selectionModel.addSelectionInterval(errorLineIndex, errorLineIndex);
if (first) {
- scrollToVisible(view.getControlDataTable(), errorLineIndex, 0);
+ scrollToVisible(displayedTable, errorLineIndex, 0);
first = false;
}
}
@@ -538,7 +575,10 @@
// select all lines
GlobalControlErrorModel model = controlView.getGlobalControlErrorModel();
- controlView.getControlDataTableSelectionModel().clearSelection();
+ JTable displayedTable = getControlDataTable(controlView);
+ ControlDataTableModel tableModel = (ControlDataTableModel)displayedTable.getModel();
+ ListSelectionModel selectionModel = displayedTable.getSelectionModel();
+ selectionModel.clearSelection();
boolean first = true;
int childCount = model.getChildCount(validationGroup);
for (int indexChild = 0 ; indexChild < childCount ; ++indexChild) {
@@ -546,13 +586,13 @@
Set<String> errorLineNumbers = validationError.getLineNumbers();
for (String errorLineNumber : errorLineNumbers) {
- int errorLineIndex = controlView.getControlDataTableModel().getRealIndexOfLine(errorLineNumber);
+ int errorLineIndex = tableModel.getRealIndexOfLine(errorLineNumber);
// ca peut arriver si la ligne a été supprimée
if (errorLineIndex >= 0) {
- controlView.getControlDataTableSelectionModel().addSelectionInterval(errorLineIndex, errorLineIndex);
+ selectionModel.addSelectionInterval(errorLineIndex, errorLineIndex);
if (first) {
- scrollToVisible(controlView.getControlDataTable(), errorLineIndex, 0);
+ scrollToVisible(displayedTable, errorLineIndex, 0);
first = false;
}
}
@@ -610,6 +650,16 @@
}
}
+ /**
+ * Contruit le panel d'edition du bean.
+ *
+ * Vide le panel si line est {@code null}.
+ *
+ * @param view view
+ * @param category category
+ * @param header header
+ * @param line line to edit
+ */
protected void updateEditionPanel(ControlView view, Category category, String[] header, String[] line) {
JPanel panel = view.getEditionPanel();
@@ -821,7 +871,7 @@
Project project = view.getContextValue(Project.class);
ProjectService projectService = view.getContextValue(ProjectService.class);
- JTable controlDataTable = view.getControlDataTable();
+ JTable controlDataTable = getControlDataTable(view);
ControlDataTableModel model = (ControlDataTableModel)controlDataTable.getModel();
int selectedLine = controlDataTable.getSelectedRow();
Category category = (Category)view.getCategoryComboBox().getSelectedItem();
@@ -882,9 +932,9 @@
Project project = view.getContextValue(Project.class);
ProjectService projectService = view.getContextValue(ProjectService.class);
-
+
// get selected row, and selected csv line index
- JTable controlDataTable = view.getControlDataTable();
+ JTable controlDataTable = getControlDataTable(view);
ControlDataTableModel model = (ControlDataTableModel)controlDataTable.getModel();
int selectedLine = controlDataTable.getSelectedRow();
Category category = (Category)view.getCategoryComboBox().getSelectedItem();
Modified: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/ControlView.jaxx
===================================================================
--- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/ControlView.jaxx 2010-12-01 10:05:30 UTC (rev 317)
+++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/ControlView.jaxx 2010-12-01 12:57:49 UTC (rev 318)
@@ -23,6 +23,7 @@
#L%
-->
<Table name="controlView">
+ <import>fr.ifremer.coser.CoserConstants.Category</import>
<script><![CDATA[
void $afterCompleteSetup() {
// bean validation
@@ -67,13 +68,33 @@
<row>
<cell fill="both" weightx="1" weighty="1" columns="2">
<JSplitPane name="splitpaneDataDetails" orientation="{JSplitPane.VERTICAL_SPLIT}">
- <JScrollPane>
- <fr.ifremer.coser.ui.control.ControlDataTableModel id="controlDataTableModel" constructorParams="this" />
- <JTable id='controlDataTable' model="{controlDataTableModel}"
- onMouseClicked="getHandler().showDataTableContextMenu(this, event)"/>
- <ListSelectionModel id="controlDataTableSelectionModel" javaBean="controlDataTable.getSelectionModel()"
- onValueChanged="getHandler().controlDataTableSelectionChanged(this, event)" />
- </JScrollPane>
+ <CardLayout id="controlTablesLayout" />
+ <JPanel id="controlTablesPanel" layout="{controlTablesLayout}">
+ <JScrollPane constraints="Category.CATCH.toString()">
+ <JTable id='controlDataTableCatch' model="{new fr.ifremer.coser.ui.control.ControlDataTableModel(this, Category.CATCH)}"
+ onMouseClicked="getHandler().showDataTableContextMenu(this, event)" />
+ <ListSelectionModel id="controlDataTableSelectionModelCatch" javaBean="controlDataTableCatch.getSelectionModel()"
+ onValueChanged="getHandler().controlDataTableSelectionChanged(this)" />
+ </JScrollPane>
+ <JScrollPane constraints="Category.STRATA.toString()">
+ <JTable id='controlDataTableStrata' model="{new fr.ifremer.coser.ui.control.ControlDataTableModel(this, Category.STRATA)}"
+ onMouseClicked="getHandler().showDataTableContextMenu(this, event)" />
+ <ListSelectionModel id="controlDataTableSelectionModelStrata" javaBean="controlDataTableStrata.getSelectionModel()"
+ onValueChanged="getHandler().controlDataTableSelectionChanged(this)" />
+ </JScrollPane>
+ <JScrollPane constraints="Category.HAUL.toString()">
+ <JTable id='controlDataTableHaul' model="{new fr.ifremer.coser.ui.control.ControlDataTableModel(this, Category.HAUL)}"
+ onMouseClicked="getHandler().showDataTableContextMenu(this, event)" />
+ <ListSelectionModel id="controlDataTableSelectionModelHaul" javaBean="controlDataTableHaul.getSelectionModel()"
+ onValueChanged="getHandler().controlDataTableSelectionChanged(this)" />
+ </JScrollPane>
+ <JScrollPane constraints="Category.LENGTH.toString()">
+ <JTable id='controlDataTableLength' model="{new fr.ifremer.coser.ui.control.ControlDataTableModel(this, Category.LENGTH)}"
+ onMouseClicked="getHandler().showDataTableContextMenu(this, event)" />
+ <ListSelectionModel id="controlDataTableSelectionModelLength" javaBean="controlDataTableLength.getSelectionModel()"
+ onValueChanged="getHandler().controlDataTableSelectionChanged(this)" />
+ </JScrollPane>
+ </JPanel>
<JSplitPane name="splitpaneDetail" orientation="{JSplitPane.VERTICAL_SPLIT}">
<JSplitPane name="splitpaneDataDetailError">
Modified: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/util/ErrorHelper.java
===================================================================
--- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/util/ErrorHelper.java 2010-12-01 10:05:30 UTC (rev 317)
+++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/util/ErrorHelper.java 2010-12-01 12:57:49 UTC (rev 318)
@@ -116,11 +116,11 @@
MultiPartEmail email = new MultiPartEmail();
// smtp
- email.setHostName("smtp");
+ email.setHostName(coserConfig.getSmtpHost());
// to
email.addTo(emailTo, "Support");
// from
- email.setFrom("no-reply at nuiton.org", "Coser");
+ email.setFrom("no-reply at labs.libre-entreprise.org", "Coser");
// subject
email.setSubject("Project error notification : Coser");
@@ -152,9 +152,9 @@
email.setContent(message.toString(), "text/plain; charset=ISO-8859-9");
// send mail
- //email.send();
-
- JOptionPane.showMessageDialog(null, "A report message has been sent to " + emailTo);
+ email.send();
+
+ JOptionPane.showMessageDialog(null, _("coser.ui.error.reportSendTo", emailTo));
} catch (EmailException ex) {
if (log.isErrorEnabled()) {
log.error("Can't send report email" ,ex);
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 10:05:30 UTC (rev 317)
+++ trunk/coser-ui/src/main/resources/i18n/coser-ui_en_GB.properties 2010-12-01 12:57:49 UTC (rev 318)
@@ -1,11 +1,14 @@
coser.config.application.version.description=Application's version
coser.config.category.configuration=Configuration
coser.config.category.configuration.description=Configuration (numerics data)
+coser.config.category.misc=Misc
+coser.config.category.misc.description=Misc
coser.config.category.path=Path
coser.config.category.path.description=File and directory configuration
coser.config.config.file.description=Coser configuration file
coser.config.locale.description=Application's locale
coser.config.lookandfeel.description=Application's swing theme
+coser.config.smtp.host.description=SMTP host address
coser.config.support.email.description=Support email address
coser.ui.common.cancel=Cancel
coser.ui.common.comment=Comment
@@ -54,6 +57,7 @@
coser.ui.control.validcontrol=Valid control
coser.ui.control.validcontroltip=Mark control as validated. Can be done only after data check ended without errors.
coser.ui.error.htmlmessage=An error occurs \: %s
+coser.ui.error.reportSendTo=A repport has been sent to %s
coser.ui.error.title=Global application error
coser.ui.graph.compareNumberCatchSize=Comparison Catch/Length
coser.ui.graph.lengthStructure=Length structure
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 10:05:30 UTC (rev 317)
+++ trunk/coser-ui/src/main/resources/i18n/coser-ui_fr_FR.properties 2010-12-01 12:57:49 UTC (rev 318)
@@ -1,12 +1,15 @@
coser.config.application.version.description=Version de l'application
coser.config.category.configuration=Configuration
coser.config.category.configuration.description=Configuration (donn\u00E9es num\u00E9riques)
+coser.config.category.misc=Disers
+coser.config.category.misc.description=Divers
coser.config.category.path=Chemins
coser.config.category.path.description=Configuration des fichiers et r\u00E9pertoires
coser.config.config.file.description=Fichier de configuration de Coser
coser.config.locale.description=Langue de l'application
coser.config.lookandfeel.description=Themes graphique Swing de l'application
-coser.config.support.email.description=Adresse de suport pour l'envoi des erreurs
+coser.config.smtp.host.description=Adresse du serveur SMTP pour envoyer les mails
+coser.config.support.email.description=Adresse de support pour l'envoi des erreurs
coser.ui.common.cancel=Annuler
coser.ui.common.comment=Commentaire
coser.ui.common.selectAll=S\u00E9lectionner tout
@@ -54,6 +57,7 @@
coser.ui.control.validcontrol=Valider le contr\u00F4le
coser.ui.control.validcontroltip=Marque le contr\u00F4le comme valid\u00E9. Ne peut \u00EAtre effectu\u00E9 qu'apr\u00E8s une v\u00E9rification des donn\u00E9es termin\u00E9e sans erreurs.
coser.ui.error.htmlmessage=Une erreur s'est produite \: %s
+coser.ui.error.reportSendTo=Un rapport a \u00E9t\u00E9 envoy\u00E9 \u00E0 %s
coser.ui.error.title=Erreur globale
coser.ui.graph.compareNumberCatchSize=Comparaison Captures/Tailles
coser.ui.graph.lengthStructure=Structures en taille
1
0
r317 - trunk/coser-ui/src/main/java/fr/ifremer/coser
by chatellier@users.labs.libre-entreprise.org 01 Dec '10
by chatellier@users.labs.libre-entreprise.org 01 Dec '10
01 Dec '10
Author: chatellier
Date: 2010-12-01 10:05:30 +0000 (Wed, 01 Dec 2010)
New Revision: 317
Log:
Catch all exception (even swing edt ones)
Modified:
trunk/coser-ui/src/main/java/fr/ifremer/coser/Coser.java
Modified: trunk/coser-ui/src/main/java/fr/ifremer/coser/Coser.java
===================================================================
--- trunk/coser-ui/src/main/java/fr/ifremer/coser/Coser.java 2010-12-01 10:05:08 UTC (rev 316)
+++ trunk/coser-ui/src/main/java/fr/ifremer/coser/Coser.java 2010-12-01 10:05:30 UTC (rev 317)
@@ -71,7 +71,7 @@
Thread.currentThread().setContextClassLoader(coserClassLoader);
// init config
- CoserConfig coserConfig = new CoserConfig();
+ final CoserConfig coserConfig = new CoserConfig();
try {
coserConfig.parse(args);
} catch (ArgumentsParserException ex) {
@@ -84,17 +84,17 @@
coserClassLoader.setValidatorsDirectory(coserConfig.getValidatorsDirectory());
// catch wall application exception
- try {
- launch(coserConfig);
- }
- catch (Exception ex) {
- if (log.isErrorEnabled()) {
- log.error("Global application exception", ex);
+ launch(coserConfig);
+
+ Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
+ public void uncaughtException(Thread t, Throwable ex) {
+ if (log.isErrorEnabled()) {
+ log.error("Global application exception", ex);
+ }
+ ErrorHelper errorHelper = new ErrorHelper(coserConfig);
+ errorHelper.showErrorDialog(null, "Global application exception", ex);
}
- ErrorHelper errorHelper = new ErrorHelper(coserConfig);
- errorHelper.showErrorDialog(null, "Global application exception", ex);
- }
-
+ });
}
/**
1
0
r316 - in trunk: coser-business/src/main/java/fr/ifremer/coser/services coser-ui/src/main/java/fr/ifremer/coser/ui coser-ui/src/main/java/fr/ifremer/coser/ui/project coser-ui/src/main/resources/i18n
by chatellier@users.labs.libre-entreprise.org 01 Dec '10
by chatellier@users.labs.libre-entreprise.org 01 Dec '10
01 Dec '10
Author: chatellier
Date: 2010-12-01 10:05:08 +0000 (Wed, 01 Dec 2010)
New Revision: 316
Log:
Add edit and close project actions
Added:
trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/project/ProjectEditView.jaxx
Modified:
trunk/coser-business/src/main/java/fr/ifremer/coser/services/ProjectService.java
trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/CoserFrame.jaxx
trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/CoserFrameHandler.java
trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/project/ProjectCreationView.jaxx
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/services/ProjectService.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/services/ProjectService.java 2010-12-01 09:59:03 UTC (rev 315)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/services/ProjectService.java 2010-12-01 10:05:08 UTC (rev 316)
@@ -216,6 +216,27 @@
}
}
+ saveProject(project);
+
+ // init additional structures (load empty control)
+ project.setSelections(new HashMap<String, Selection>());
+ control.setHistoryCommand(new ArrayList<Command>());
+ project.setControl(control);
+
+ return project;
+ }
+
+ /**
+ * Sauve seulement les informations concernant le projet.
+ *
+ * @param project
+ * @throws CoserBusinessException
+ */
+ public void saveProject(Project project) throws CoserBusinessException {
+ File projectsDirectory = config.getProjectsDirectory();
+ String projectName = project.getName();
+ File projectDirectory = new File(projectsDirectory, projectName);
+
// save project properties file
File propertiesFile = new File(projectDirectory, "project.properties");
Properties props = project.toProperties();
@@ -233,13 +254,6 @@
finally {
IOUtils.closeQuietly(outputStream);
}
-
- // init additional structures (load empty control)
- project.setSelections(new HashMap<String, Selection>());
- control.setHistoryCommand(new ArrayList<Command>());
- project.setControl(control);
-
- return project;
}
/**
Modified: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/CoserFrame.jaxx
===================================================================
--- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/CoserFrame.jaxx 2010-12-01 09:59:03 UTC (rev 315)
+++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/CoserFrame.jaxx 2010-12-01 10:05:08 UTC (rev 316)
@@ -26,16 +26,16 @@
name="mainFrame" onWindowClosing="getHandler().quit()">
<CoserFrameHandler id="handler" constructorParams="this" />
+ <fr.ifremer.coser.bean.Project id="project" javaBean="null" />
<JMenuBar id='coserMenuBar'>
<JMenu id='menuFile' text="coser.ui.mainframe.menu.file">
<JMenuItem text="coser.ui.mainframe.menu.newProject" onActionPerformed="getHandler().showProjectCreationView()"/>
<JMenuItem text="coser.ui.mainframe.menu.openProject" onActionPerformed="getHandler().showProjectOpenView()"/>
+ <JMenuItem text="coser.ui.mainframe.menu.editProject" onActionPerformed="getHandler().showProjectEditView()" enabled="{getProject() != null}" />
+ <JMenuItem text="coser.ui.mainframe.menu.closeProject" onActionPerformed="getHandler().closeProject()" enabled="{getProject() != null}" />
<JSeparator/>
- <JMenuItem actionIcon="i18n-fr" text="coser.ui.mainframe.menu.locale.fr" onActionPerformed="getHandler().switchLanguage(this, Locale.FRANCE)"/>
- <JMenuItem actionIcon="i18n-gb" text="coser.ui.mainframe.menu.locale.uk" onActionPerformed="getHandler().switchLanguage(this, Locale.UK)"/>
- <JSeparator/>
<JMenuItem text="coser.ui.mainframe.menu.quit" onActionPerformed="getHandler().quit()"/>
</JMenu>
@@ -49,6 +49,9 @@
<JMenu id='menuOptions' text="coser.ui.mainframe.menu.options">
<JMenuItem text="coser.ui.mainframe.menu.configuration" onActionPerformed="getHandler().showCoserConfiguration()"/>
<JMenuItem text="coser.ui.mainframe.menu.validators" onActionPerformed="getHandler().showValidatorsConfiguration()"/>
+ <JSeparator/>
+ <JMenuItem actionIcon="i18n-fr" text="coser.ui.mainframe.menu.locale.fr" onActionPerformed="getHandler().switchLanguage(this, Locale.FRANCE)"/>
+ <JMenuItem actionIcon="i18n-gb" text="coser.ui.mainframe.menu.locale.uk" onActionPerformed="getHandler().switchLanguage(this, Locale.UK)"/>
</JMenu>
<JMenu id='menuView' text="coser.ui.mainframe.menu.view">
Modified: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/CoserFrameHandler.java
===================================================================
--- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/CoserFrameHandler.java 2010-12-01 09:59:03 UTC (rev 315)
+++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/CoserFrameHandler.java 2010-12-01 10:05:08 UTC (rev 316)
@@ -60,6 +60,7 @@
import fr.ifremer.coser.ui.control.ControlHandler;
import fr.ifremer.coser.ui.control.ControlView;
import fr.ifremer.coser.ui.project.ProjectCreationView;
+import fr.ifremer.coser.ui.project.ProjectEditView;
import fr.ifremer.coser.ui.project.ProjectOpenView;
import fr.ifremer.coser.ui.project.ProjectSummaryView;
import fr.ifremer.coser.ui.selection.SelectionHandler;
@@ -120,6 +121,17 @@
}
/**
+ * Display new open view in main view.
+ */
+ public void showProjectEditView() {
+ Project project = view.getProject();
+ ProjectEditView projectEditView = new ProjectEditView(view);
+ projectEditView.setHandler(this);
+ projectEditView.setProject(project);
+ setMainComponent(projectEditView);
+ }
+
+ /**
* Replace window main component.
*
* @param component new component
@@ -312,6 +324,23 @@
}
/**
+ * Sauve le projet apres edition.
+ *
+ * @param view view
+ */
+ public void saveProject(ProjectEditView view) {
+ Project project = view.getProject();
+ ProjectService projectService = view.getContextValue(ProjectService.class);
+ try {
+ projectService.saveProject(project);
+ showSummaryView();
+ }
+ catch (CoserBusinessException ex) {
+ throw new CoserException("Can't save project", ex);
+ }
+ }
+
+ /**
* Reload project (name selected in ui).
*
* @param projectView view
@@ -334,9 +363,18 @@
}
/**
+ * Ferme le projet.
+ */
+ public void closeProject() {
+ setMainComponent(null);
+ view.setProject(null);
+ }
+
+ /**
* Do some operation when a new project is loaded into application.
*/
protected void projectLoaded(Project project) {
+ view.setProject(project);
view.setContextValue(project);
view.getMenuWindow().setEnabled(true);
view.getMenuWindowSelectionMenuItem().setProject(project);
Modified: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/project/ProjectCreationView.jaxx
===================================================================
--- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/project/ProjectCreationView.jaxx 2010-12-01 09:59:03 UTC (rev 315)
+++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/project/ProjectCreationView.jaxx 2010-12-01 10:05:08 UTC (rev 316)
@@ -63,7 +63,7 @@
<JLabel text='{getContextValue(fr.ifremer.coser.CoserConfig.class).getProjectsDirectory().getAbsolutePath() + File.separator}' />
</cell>
<cell anchor="west" weightx="1" fill="horizontal">
- <JTextField id="projectProjectName" text="{project.getName()}" />
+ <JTextField id="projectProjectName" text="{getProject().getName()}" />
<javax.swing.text.Document javaBean="projectProjectName.getDocument()"
onInsertUpdate='getProject().setName(projectProjectName.getText())'
onRemoveUpdate='getProject().setName(projectProjectName.getText())' />
@@ -75,7 +75,7 @@
<JLabel text="coser.ui.project.projectauthor" />
</cell>
<cell weightx="1" fill="horizontal" columns="2">
- <JTextField id="projectAuthor" text="{project.getAuthor()}" />
+ <JTextField id="projectAuthor" text="{getProject().getAuthor()}" />
<javax.swing.text.Document javaBean="projectAuthor.getDocument()"
onInsertUpdate='getProject().setAuthor(projectAuthor.getText())'
onRemoveUpdate='getProject().setAuthor(projectAuthor.getText())' />
@@ -87,7 +87,7 @@
<JLabel text="coser.ui.project.catchFile" />
</cell>
<cell weightx="1" fill="horizontal" columns="2">
- <JTextField id="projectCatchFile" text="{project.getCatchFile()}" />
+ <JTextField id="projectCatchFile" text="{getProject().getCatchFile()}" />
<javax.swing.text.Document javaBean="projectCatchFile.getDocument()"
onInsertUpdate='getProject().setCatchFile(projectCatchFile.getText())'
onRemoveUpdate='getProject().setCatchFile(projectCatchFile.getText())' />
@@ -102,7 +102,7 @@
<JLabel text="coser.ui.project.strataFile" />
</cell>
<cell fill="horizontal" columns="2">
- <JTextField id="projectStrataFile" text="{project.getStrataFile()}" />
+ <JTextField id="projectStrataFile" text="{getProject().getStrataFile()}" />
<javax.swing.text.Document javaBean="projectStrataFile.getDocument()"
onInsertUpdate='getProject().setStrataFile(projectStrataFile.getText())'
onRemoveUpdate='getProject().setStrataFile(projectStrataFile.getText())' />
@@ -117,7 +117,7 @@
<JLabel text="coser.ui.project.lengthFile" />
</cell>
<cell fill="horizontal" columns="2">
- <JTextField id="projectLengthFile" text="{project.getLengthFile()}" />
+ <JTextField id="projectLengthFile" text="{getProject().getLengthFile()}" />
<javax.swing.text.Document javaBean="projectLengthFile.getDocument()"
onInsertUpdate='getProject().setLengthFile(projectLengthFile.getText())'
onRemoveUpdate='getProject().setLengthFile(projectLengthFile.getText())' />
@@ -132,7 +132,7 @@
<JLabel text="coser.ui.project.haulFile" />
</cell>
<cell fill="horizontal" columns="2">
- <JTextField id="projectHaulFile" text="{project.getHaulFile()}" />
+ <JTextField id="projectHaulFile" text="{getProject().getHaulFile()}" />
<javax.swing.text.Document javaBean="projectHaulFile.getDocument()"
onInsertUpdate='getProject().setHaulFile(projectHaulFile.getText())'
onRemoveUpdate='getProject().setHaulFile(projectHaulFile.getText())' />
Added: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/project/ProjectEditView.jaxx
===================================================================
--- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/project/ProjectEditView.jaxx (rev 0)
+++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/project/ProjectEditView.jaxx 2010-12-01 10:05:08 UTC (rev 316)
@@ -0,0 +1,88 @@
+<!--
+ #%L
+ Coser :: UI
+
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2010 Ifremer, Codelutin, Chatellier Eric
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU 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 Public License for more details.
+
+ You should have received a copy of the GNU General Public
+ License along with this program. If not, see
+ <http://www.gnu.org/licenses/gpl-3.0.html>.
+ #L%
+ -->
+<Table>
+ <fr.ifremer.coser.ui.CoserFrameHandler id="handler" javaBean="null" />
+
+ <!-- Validation -->
+ <fr.ifremer.coser.bean.Project id="project" javaBean="null" />
+ <jaxx.runtime.validator.swing.SwingValidatorMessageTableModel id='errorsTableModel'
+ onTableChanged='saveProjectButton.setEnabled(errorsTableModel.getRowCount()==0)'/>
+ <BeanValidator id='validatorProject' bean='project'
+ uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"
+ errorTableModel="errorsTableModel">
+ <field name="name" component="projectProjectName" />
+ <field name="author" component="projectAuthor" />
+ </BeanValidator>
+
+ <row>
+ <cell weightx="1" fill="horizontal">
+ <Table border='{BorderFactory.createTitledBorder(_("coser.ui.project.editProject"))}'>
+ <row>
+ <cell anchor="west">
+ <JLabel text="coser.ui.project.projectname" />
+ </cell>
+ <cell>
+ <JLabel text='{getContextValue(fr.ifremer.coser.CoserConfig.class).getProjectsDirectory().getAbsolutePath() + File.separator}' />
+ </cell>
+ <cell anchor="west" weightx="1" fill="horizontal">
+ <JTextField id="projectProjectName" enabled="false" text="{getProject().getName()}" />
+ </cell>
+ </row>
+ <row>
+ <cell anchor="west">
+ <JLabel text="coser.ui.project.projectauthor" />
+ </cell>
+ <cell weightx="1" fill="horizontal" columns="2">
+ <JTextField id="projectAuthor" text="{getProject().getAuthor()}" />
+ <javax.swing.text.Document javaBean="projectAuthor.getDocument()"
+ onInsertUpdate='getProject().setAuthor(projectAuthor.getText())'
+ onRemoveUpdate='getProject().setAuthor(projectAuthor.getText())' />
+
+ </cell>
+ </row>
+ <row>
+ <cell anchor="northwest">
+ <JLabel text="coser.ui.project.projectcomment" />
+ </cell>
+ <cell fill="horizontal" columns="2">
+ <JScrollPane>
+ <JTextArea id="projectComment" rows="3" text="{getProject().getComment()}"/>
+ </JScrollPane>
+ <javax.swing.text.Document javaBean="projectComment.getDocument()"
+ onInsertUpdate='getProject().setComment(projectComment.getText())'
+ onRemoveUpdate='getProject().setComment(projectComment.getText())' />
+
+ </cell>
+ </row>
+ <row>
+ <cell columns="4" anchor="east">
+ <JButton id="saveProjectButton" text="coser.ui.project.saveProject"
+ onActionPerformed="getHandler().saveProject(this)" />
+ </cell>
+ </row>
+ </Table>
+ </cell>
+ </row>
+</Table>
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 09:59:03 UTC (rev 315)
+++ trunk/coser-ui/src/main/resources/i18n/coser-ui_en_GB.properties 2010-12-01 10:05:08 UTC (rev 316)
@@ -59,6 +59,7 @@
coser.ui.graph.lengthStructure=Length structure
coser.ui.locale.mustRestart=You must restart application to take effect
coser.ui.locale.title=Locale modification
+coser.ui.mainframe.menu.closeProject=Close project
coser.ui.mainframe.menu.configuration=Configuration
coser.ui.mainframe.menu.data=Data
coser.ui.mainframe.menu.data.control=Control
@@ -68,6 +69,7 @@
coser.ui.mainframe.menu.data.replaySelection=Replay selection
coser.ui.mainframe.menu.data.selections=S\u00E9lections
coser.ui.mainframe.menu.data.summary=Summary
+coser.ui.mainframe.menu.editProject=Edit project
coser.ui.mainframe.menu.file=File
coser.ui.mainframe.menu.locale.fr=Fran\u00E7ais
coser.ui.mainframe.menu.locale.uk=English
@@ -85,6 +87,7 @@
coser.ui.project.createProjectMissingReftax=File 'Reftax' is not valid \!\n(check configuration \: coser.reference.species)
coser.ui.project.creationError=Creation error
coser.ui.project.customReferenceSpeciesFile=New reference file \:
+coser.ui.project.editProject=Edit project
coser.ui.project.haulFile=Haul file \:
coser.ui.project.lengthFile=Length file \:
coser.ui.project.missingFile=Missing file
@@ -96,6 +99,7 @@
coser.ui.project.projectauthor=Author \:
coser.ui.project.projectcomment=Comment \:
coser.ui.project.projectname=Project name \:
+coser.ui.project.saveProject=Save project
coser.ui.project.strataFile=Strata file \:
coser.ui.project.summary.path=Project path \:
coser.ui.project.summary.title=Project summary
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 09:59:03 UTC (rev 315)
+++ trunk/coser-ui/src/main/resources/i18n/coser-ui_fr_FR.properties 2010-12-01 10:05:08 UTC (rev 316)
@@ -59,6 +59,7 @@
coser.ui.graph.lengthStructure=Structures en taille
coser.ui.locale.mustRestart=Vous devez red\u00E9marrer l'application pour prendre en compte la modification.
coser.ui.locale.title=Modification de la langue
+coser.ui.mainframe.menu.closeProject=Fermer le projet
coser.ui.mainframe.menu.configuration=Configuration
coser.ui.mainframe.menu.data=Donn\u00E9es
coser.ui.mainframe.menu.data.control=Contr\u00F4le
@@ -68,6 +69,7 @@
coser.ui.mainframe.menu.data.replaySelection=Rejouer une s\u00E9lection
coser.ui.mainframe.menu.data.selections=S\u00E9lections
coser.ui.mainframe.menu.data.summary=R\u00E9sum\u00E9
+coser.ui.mainframe.menu.editProject=Modifier le projet
coser.ui.mainframe.menu.file=Fichier
coser.ui.mainframe.menu.locale.fr=Fran\u00E7ais
coser.ui.mainframe.menu.locale.uk=English
@@ -85,6 +87,7 @@
coser.ui.project.createProjectMissingReftax=Le fichier 'Reftax' n'est pas valide \!\n(v\u00E9rifiez la configuration \: coser.reference.species)
coser.ui.project.creationError=Erreur de cr\u00E9ation
coser.ui.project.customReferenceSpeciesFile=Nouveau fichier de r\u00E9f\u00E9rence \:
+coser.ui.project.editProject=Modifier le projet
coser.ui.project.haulFile=Fichier des traits \:
coser.ui.project.lengthFile=Fichier des tailles \:
coser.ui.project.missingFile=Fichier manquant
@@ -96,6 +99,7 @@
coser.ui.project.projectauthor=Auteur \:
coser.ui.project.projectcomment=Commentaire \:
coser.ui.project.projectname=Nom du projet \:
+coser.ui.project.saveProject=Sauver le projet
coser.ui.project.strataFile=Fichier des strates \:
coser.ui.project.summary.path=Chemin du projet \:
coser.ui.project.summary.title=R\u00E9sum\u00E9 du projet
1
0
r315 - trunk/coser-business/src/main/java/fr/ifremer/coser/bean
by chatellier@users.labs.libre-entreprise.org 01 Dec '10
by chatellier@users.labs.libre-entreprise.org 01 Dec '10
01 Dec '10
Author: chatellier
Date: 2010-12-01 09:59:03 +0000 (Wed, 01 Dec 2010)
New Revision: 315
Log:
Fix wrong comment property used
Modified:
trunk/coser-business/src/main/java/fr/ifremer/coser/bean/Project.java
Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/bean/Project.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/bean/Project.java 2010-11-30 17:43:38 UTC (rev 314)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/bean/Project.java 2010-12-01 09:59:03 UTC (rev 315)
@@ -295,8 +295,8 @@
if (props.containsKey("project.strataFileName")) {
setStrataFileName(props.getProperty("project.strataFileName"));
}
- if (props.containsKey("control.comment")) {
- setComment(props.getProperty("control.comment"));
+ if (props.containsKey("project.comment")) {
+ setComment(props.getProperty("project.comment"));
}
}
}
1
0