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
October 2010
- 1 participants
- 54 discussions
r139 - in trunk/coser-ui/src/main: java/fr/ifremer/coser/ui/result java/fr/ifremer/coser/ui/selection resources/i18n
by chatellier@users.labs.libre-entreprise.org 29 Oct '10
by chatellier@users.labs.libre-entreprise.org 29 Oct '10
29 Oct '10
Author: chatellier
Date: 2010-10-29 17:14:40 +0000 (Fri, 29 Oct 2010)
New Revision: 139
Log:
Add form to add new rsufi result
Modified:
trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/result/ResultTableModel.java
trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/selection/SelectionResultView.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/result/ResultTableModel.java
===================================================================
--- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/result/ResultTableModel.java 2010-10-29 16:36:04 UTC (rev 138)
+++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/result/ResultTableModel.java 2010-10-29 17:14:40 UTC (rev 139)
@@ -50,26 +50,14 @@
header = new ArrayList<String>();
header.add("Nom du r\u00E9sultat :");
header.add("Version RSufi");
- header.add("Fichier data captures");
- header.add("Fichier graph captures");
- header.add("Fichier data taille");
- header.add("Fichier graph taille");
- header.add("Fichier data strates");
- header.add("Fichier graph strates");
- header.add("Fichier data traits");
- header.add("Fichier graph traits");
+ header.add("Fichier données 1");
+ header.add("Fichier données 2");
data = new ArrayList<String>();
data.add("R\u00E9sultat de test");
data.add("1.0.0");
- data.add("ListEspecesEVHOE_TOT_occ5_dens5.txt");
- data.add("NombEspeceGroupL2EVHOE_TOT.wmf");
- data.add("ListEspecesEVHOE_TOT_occ5_dens5.txt");
- data.add("NombEspeceGroupL2EVHOE_TOT.wmf");
- data.add("ListEspecesEVHOE_TOT_occ5_dens5.txt");
- data.add("NombEspeceGroupL2EVHOE_TOT.wmf");
- data.add("ListEspecesEVHOE_TOT_occ5_dens5.txt");
- data.add("NombEspeceGroupL2EVHOE_TOT.wmf");
+ data.add("EstComInd_IBTS.txt");
+ data.add("EstPopInd_IBTS.txt");
}
/*
Modified: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/selection/SelectionResultView.jaxx
===================================================================
--- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/selection/SelectionResultView.jaxx 2010-10-29 16:36:04 UTC (rev 138)
+++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/selection/SelectionResultView.jaxx 2010-10-29 17:14:40 UTC (rev 139)
@@ -57,8 +57,75 @@
</cell>
</row>
<row>
- <cell>
-
+ <cell weighty="1" fill="both">
+ <Table border='{BorderFactory.createTitledBorder(_("coser.ui.result.newDataTitle"))}'>
+ <row>
+ <cell anchor="west">
+ <JLabel text="coser.ui.result.resultName" />
+ </cell>
+ <cell fill="horizontal" columns="2">
+ <JTextField />
+ </cell>
+ </row>
+ <row>
+ <cell anchor="west">
+ <JLabel text="coser.ui.result.rsufiVersion" />
+ </cell>
+ <cell fill="horizontal" columns="2">
+ <JTextField />
+ </cell>
+ </row>
+ <row>
+ <cell anchor="west">
+ <JLabel text="coser.ui.result.rsufiVersion" />
+ </cell>
+ <cell fill="horizontal" columns="2">
+ <JTextField />
+ </cell>
+ </row>
+ <row>
+ <cell anchor="west">
+ <JLabel text="coser.ui.result.dataFile1" />
+ </cell>
+ <cell weightx="1" fill="horizontal">
+ <JTextField />
+ </cell>
+ <cell fill="horizontal">
+ <JButton text="coser.ui.common.selectFile" />
+ </cell>
+ </row>
+ <row>
+ <cell anchor="west">
+ <JLabel text="coser.ui.result.dataFile2" />
+ </cell>
+ <cell fill="horizontal">
+ <JTextField />
+ </cell>
+ <cell fill="horizontal">
+ <JButton text="coser.ui.common.selectFile" />
+ </cell>
+ </row>
+ <row>
+ <cell anchor="west" columns="3">
+ <JLabel text="coser.ui.result.otherDataFile" />
+ </cell>
+ </row>
+ <row>
+ <cell columns="3" weighty="1" fill="both">
+ <JScrollPane>
+ <JList />
+ </JScrollPane>
+ </cell>
+ </row>
+ <row>
+ <cell weightx="1" columns="2" anchor="east">
+ <JButton text="coser.ui.result.addOtherDataFile" />
+ </cell>
+ <cell anchor="east">
+ <JButton text="coser.ui.result.addNewResult" />
+ </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-10-29 16:36:04 UTC (rev 138)
+++ trunk/coser-ui/src/main/resources/i18n/coser-ui-en_GB.properties 2010-10-29 17:14:40 UTC (rev 139)
@@ -61,10 +61,18 @@
coser.ui.project.traitsFile=Traits file \:
coser.ui.project.useCustomReferenceSpeciesFile=Use custom reference file
coser.ui.project.usedReferenceSpeciesFile=Current reference file \:
+coser.ui.result.addNewResult=Save result
+coser.ui.result.addOtherDataFile=Add file
coser.ui.result.availableDataTitle=Available results \:
+coser.ui.result.dataFile1=Data file 1 \:
+coser.ui.result.dataFile2=Data file 2 \:
coser.ui.result.extractDataButton=Extract
coser.ui.result.extractDataLabel=Extraction directory
coser.ui.result.extractDataTitle=Extract RSufi data
+coser.ui.result.newDataTitle=New result
+coser.ui.result.otherDataFile=Other files \:
+coser.ui.result.resultName=Result name \:
+coser.ui.result.rsufiVersion=RSufi version
coser.ui.selection.allSpecies=All species
coser.ui.selection.createError=Creation error
coser.ui.selection.details.beginDate=Begin date \:
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-10-29 16:36:04 UTC (rev 138)
+++ trunk/coser-ui/src/main/resources/i18n/coser-ui-fr_FR.properties 2010-10-29 17:14:40 UTC (rev 139)
@@ -61,10 +61,18 @@
coser.ui.project.traitsFile=Fichiers des traits \:
coser.ui.project.useCustomReferenceSpeciesFile=Utiliser un autre fichier de r\u00E9f\u00E9rence
coser.ui.project.usedReferenceSpeciesFile=Fichier de r\u00E9f\u00E9rence utilis\u00E9 \:
+coser.ui.result.addNewResult=Enregistrer le r\u00E9sultat
+coser.ui.result.addOtherDataFile=Ajouter un fichier
coser.ui.result.availableDataTitle=R\u00E9sultats disponibles \:
+coser.ui.result.dataFile1=Fichier r\u00E9sultat 1 \:
+coser.ui.result.dataFile2=Fichier r\u00E9sultat 2 \:
coser.ui.result.extractDataButton=Extraire
coser.ui.result.extractDataLabel=Dossier d'extraction \:
coser.ui.result.extractDataTitle=Extraction des donn\u00E9es d'entr\u00E9e de RSufi
+coser.ui.result.newDataTitle=Nouveau r\u00E9sultat
+coser.ui.result.otherDataFile=Autre fichiers \:
+coser.ui.result.resultName=Nom du r\u00E9sultat \:
+coser.ui.result.rsufiVersion=Version de RSufi \:
coser.ui.selection.allSpecies=Toutes les esp\u00E8ces
coser.ui.selection.createError=Erreur de cr\u00E9action
coser.ui.selection.details.beginDate=Date de d\u00E9but \:
1
0
r138 - trunk/coser-business/src/main/resources/i18n
by chatellier@users.labs.libre-entreprise.org 29 Oct '10
by chatellier@users.labs.libre-entreprise.org 29 Oct '10
29 Oct '10
Author: chatellier
Date: 2010-10-29 16:36:04 +0000 (Fri, 29 Oct 2010)
New Revision: 138
Log:
Faute
Modified:
trunk/coser-business/src/main/resources/i18n/coser-business-fr_FR.properties
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-10-29 16:29:35 UTC (rev 137)
+++ trunk/coser-business/src/main/resources/i18n/coser-business-fr_FR.properties 2010-10-29 16:36:04 UTC (rev 138)
@@ -33,7 +33,7 @@
coser.business.category.strata=Strates
coser.business.control.error.duplicatedLine=Ligne en doublon
coser.business.control.error.minObservationCount=Nombre minimal d'observation non atteint (%s) \: %.2f
-coser.business.control.error.noCatchNumberWithWeight=Poids renseign\u00E9s, mais capture non pr\u00E9sente
+coser.business.control.error.noCatchNumberWithWeight=Poids renseign\u00E9, mais capture non pr\u00E9sente
coser.business.control.step.observation=V\u00E9rification du nombre d'observation (%d%%)
coser.business.control.step.xworks=Validation par lignes (%d%%)
coser.business.line=Ligne
1
0
r137 - in trunk/coser-business/src: main/java/fr/ifremer/coser/data main/java/fr/ifremer/coser/services main/resources/fr/ifremer/coser/data main/resources/i18n test/java/fr/ifremer/coser/services test/resources
by chatellier@users.labs.libre-entreprise.org 29 Oct '10
by chatellier@users.labs.libre-entreprise.org 29 Oct '10
29 Oct '10
Author: chatellier
Date: 2010-10-29 16:29:35 +0000 (Fri, 29 Oct 2010)
New Revision: 137
Log:
Modification des datas pour pouvoir avoir les meme donn?\195?\169es en String et en double.
Deplacement d'une validation dans le fichier xwork
Modified:
trunk/coser-business/src/main/java/fr/ifremer/coser/data/Catch.java
trunk/coser-business/src/main/java/fr/ifremer/coser/data/Haul.java
trunk/coser-business/src/main/java/fr/ifremer/coser/data/Length.java
trunk/coser-business/src/main/java/fr/ifremer/coser/data/Strata.java
trunk/coser-business/src/main/java/fr/ifremer/coser/services/ValidationService.java
trunk/coser-business/src/main/resources/fr/ifremer/coser/data/Catch-error-validation.xml
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-business/src/test/java/fr/ifremer/coser/services/ValidationServiceTest.java
trunk/coser-business/src/test/resources/log4j.properties
Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/data/Catch.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/data/Catch.java 2010-10-29 16:26:32 UTC (rev 136)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/data/Catch.java 2010-10-29 16:29:35 UTC (rev 137)
@@ -97,23 +97,85 @@
return data[INDEX_SPECIES];
}
- public void setNumber(String value) {
- String oldValue = data[INDEX_NUMBER];
+ public void setNumber(double value) {
+ double oldValue = getNumber();
data[INDEX_NUMBER] = String.valueOf(value);
getPropertyChangeSupport().firePropertyChange("number", oldValue, value);
}
- public String getNumber() {
+ public double getNumber() {
+ double result = Double.parseDouble(data[INDEX_NUMBER]);
+ return result;
+ }
+
+ public void setWeight(double value) {
+ double oldValue = getWeight();
+ data[INDEX_WEIGHT] = String.valueOf(value);
+ getPropertyChangeSupport().firePropertyChange("weight", oldValue, value);
+ }
+
+ public double getWeight() {
+ double result = Double.parseDouble(data[INDEX_WEIGHT]);
+ return result;
+ }
+
+ public void setSurveyAsString(String value) {
+ String oldValue = data[INDEX_SURVEY];
+ data[INDEX_SURVEY] = value;
+ getPropertyChangeSupport().firePropertyChange("surveyAsString", oldValue, value);
+ }
+
+ public String getSurveyAsString() {
+ return data[INDEX_SURVEY];
+ }
+
+ public void setYearAsString(String value) {
+ String oldValue = data[INDEX_YEAR];
+ data[INDEX_YEAR] = value;
+ getPropertyChangeSupport().firePropertyChange("yearAsString", oldValue, value);
+ }
+
+ public String getYearAsString() {
+ return data[INDEX_YEAR];
+ }
+
+ public void setHaulAsString(String value) {
+ String oldValue = data[INDEX_HAUL];
+ data[INDEX_HAUL] = value;
+ getPropertyChangeSupport().firePropertyChange("haulAsString", oldValue, value);
+ }
+
+ public String getHaulAsString() {
+ return data[INDEX_HAUL];
+ }
+
+ public void setSpeciesAsString(String value) {
+ String oldValue = data[INDEX_SPECIES];
+ data[INDEX_SPECIES] = value;
+ getPropertyChangeSupport().firePropertyChange("speciesAsString", oldValue, value);
+ }
+
+ public String getSpeciesAsString() {
+ return data[INDEX_SPECIES];
+ }
+
+ public void setNumberAsString(String value) {
+ String oldValue = data[INDEX_NUMBER];
+ data[INDEX_NUMBER] = value;
+ getPropertyChangeSupport().firePropertyChange("numberAsString", oldValue, value);
+ }
+
+ public String getNumberAsString() {
return data[INDEX_NUMBER];
}
- public void setWeight(String value) {
+ public void setWeightAsString(String value) {
String oldValue = data[INDEX_WEIGHT];
data[INDEX_WEIGHT] = value;
- getPropertyChangeSupport().firePropertyChange("weight", oldValue, value);
+ getPropertyChangeSupport().firePropertyChange("weightAsString", oldValue, value);
}
- public String getWeight() {
+ public String getWeightAsString() {
return data[INDEX_WEIGHT];
}
}
Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/data/Haul.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/data/Haul.java 2010-10-29 16:26:32 UTC (rev 136)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/data/Haul.java 2010-10-29 16:29:35 UTC (rev 137)
@@ -149,4 +149,94 @@
public String getDepth() {
return data[INDEX_DEPTH];
}
+
+ public void setSurveyAsString(String value) {
+ String oldValue = data[INDEX_SURVEY];
+ data[INDEX_SURVEY] = value;
+ getPropertyChangeSupport().firePropertyChange("surveyAsString", oldValue, value);
+ }
+
+ public String getSurveyAsString() {
+ return data[INDEX_SURVEY];
+ }
+
+ public void setYearAsString(String value) {
+ String oldValue = data[INDEX_YEAR];
+ data[INDEX_YEAR] = value;
+ getPropertyChangeSupport().firePropertyChange("yearAsString", oldValue, value);
+ }
+
+ public String getYearAsString() {
+ return data[INDEX_YEAR];
+ }
+
+ public void setHaulAsString(String value) {
+ String oldValue = data[INDEX_HAUL];
+ data[INDEX_HAUL] = value;
+ getPropertyChangeSupport().firePropertyChange("haulAsString", oldValue, value);
+ }
+
+ public String getHaulAsString() {
+ return data[INDEX_HAUL];
+ }
+
+ public void setMonthAsString(String value) {
+ String oldValue = data[INDEX_MONTH];
+ data[INDEX_MONTH] = value;
+ getPropertyChangeSupport().firePropertyChange("monthAsString", oldValue, value);
+ }
+
+ public String getMonthAsString() {
+ return data[INDEX_MONTH];
+ }
+
+ public void setStratumAsString(String value) {
+ String oldValue = data[INDEX_STRATUM];
+ data[INDEX_STRATUM] = value;
+ getPropertyChangeSupport().firePropertyChange("stratumAsString", oldValue, value);
+ }
+
+ public String getStratumAsString() {
+ return data[INDEX_STRATUM];
+ }
+
+ public void setSweptSurfaceAsString(String value) {
+ String oldValue = data[INDEX_SWEPT_SURFACE];
+ data[INDEX_SWEPT_SURFACE] = value;
+ getPropertyChangeSupport().firePropertyChange("sweptSurfaceAsString", oldValue, value);
+ }
+
+ public String getSweptSurfaceAsString() {
+ return data[INDEX_SWEPT_SURFACE];
+ }
+
+ public void setLatAsString(String value) {
+ String oldValue = data[INDEX_LAT];
+ data[INDEX_LAT] = value;
+ getPropertyChangeSupport().firePropertyChange("latAsString", oldValue, value);
+ }
+
+ public String getLatAsString() {
+ return data[INDEX_LAT];
+ }
+
+ public void setLongAsString(String value) {
+ String oldValue = data[INDEX_LONG];
+ data[INDEX_LONG] = value;
+ getPropertyChangeSupport().firePropertyChange("longAsString", oldValue, value);
+ }
+
+ public String getLongAsString() {
+ return data[INDEX_LONG];
+ }
+
+ public void setDepthAsString(String value) {
+ String oldValue = data[INDEX_DEPTH];
+ data[INDEX_DEPTH] = value;
+ getPropertyChangeSupport().firePropertyChange("depthAsString", oldValue, value);
+ }
+
+ public String getDepthAsString() {
+ return data[INDEX_DEPTH];
+ }
}
Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/data/Length.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/data/Length.java 2010-10-29 16:26:32 UTC (rev 136)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/data/Length.java 2010-10-29 16:29:35 UTC (rev 137)
@@ -170,4 +170,114 @@
public String getAge() {
return data[INDEX_AGE];
}
+
+ public void setSurveyAsString(String value) {
+ String oldValue = data[INDEX_SURVEY];
+ data[INDEX_SURVEY] = value;
+ getPropertyChangeSupport().firePropertyChange("surveyAsString", oldValue, value);
+ }
+
+ public String getSurveyAsString() {
+ return data[INDEX_SURVEY];
+ }
+
+ public void setYearAsString(String value) {
+ String oldValue = data[INDEX_YEAR];
+ data[INDEX_YEAR] = value;
+ getPropertyChangeSupport().firePropertyChange("yearAsString", oldValue, value);
+ }
+
+ public String getYearAsString() {
+ return data[INDEX_YEAR];
+ }
+
+ public void setHaulAsString(String value) {
+ String oldValue = data[INDEX_HAUL];
+ data[INDEX_HAUL] = value;
+ getPropertyChangeSupport().firePropertyChange("haulAsString", oldValue, value);
+ }
+
+ public String getHaulAsString() {
+ return data[INDEX_HAUL];
+ }
+
+ public void setSpeciesAsString(String value) {
+ String oldValue = data[INDEX_SPECIES];
+ data[INDEX_SPECIES] = value;
+ getPropertyChangeSupport().firePropertyChange("speciesAsString", oldValue, value);
+ }
+
+ public String getSpeciesAsString() {
+ return data[INDEX_SPECIES];
+ }
+
+ public void setSexAsString(String value) {
+ String oldValue = data[INDEX_SEX];
+ data[INDEX_SEX] = value;
+ getPropertyChangeSupport().firePropertyChange("sexAsString", oldValue, value);
+ }
+
+ public String getSexAsString() {
+ return data[INDEX_SEX];
+ }
+
+ public void setMaturityAsString(String value) {
+ String oldValue = data[INDEX_MATURITY];
+ data[INDEX_MATURITY] = value;
+ getPropertyChangeSupport().firePropertyChange("maturityAsString", oldValue, value);
+ }
+
+ public String getMaturityAsString() {
+ return data[INDEX_MATURITY];
+ }
+
+ public void setLengthAsString(String value) {
+ String oldValue = data[INDEX_LENGTH];
+ data[INDEX_LENGTH] = value;
+ getPropertyChangeSupport().firePropertyChange("lengthAsString", oldValue, value);
+ }
+
+ public String getLengthAsString() {
+ return data[INDEX_LENGTH];
+ }
+
+ public void setNumberAsString(String value) {
+ String oldValue = data[INDEX_NUMBER];
+ data[INDEX_NUMBER] = value;
+ getPropertyChangeSupport().firePropertyChange("numberAsString", oldValue, value);
+ }
+
+ public String getNumberAsString() {
+ return data[INDEX_NUMBER];
+ }
+
+ public void setWeightAsString(String value) {
+ String oldValue = data[INDEX_WEIGHT];
+ data[INDEX_WEIGHT] = value;
+ getPropertyChangeSupport().firePropertyChange("weightAsString", oldValue, value);
+ }
+
+ public String getWeightAsString() {
+ return data[INDEX_WEIGHT];
+ }
+
+ /**
+ * Age field.
+ *
+ * @param value new value to set
+ */
+ public void setAgeAsString(String value) {
+ String oldValue = data[INDEX_AGE];
+ data[INDEX_AGE] = value;
+ getPropertyChangeSupport().firePropertyChange("ageAsString", oldValue, value);
+ }
+
+ /**
+ * Age field.
+ *
+ * @return age
+ */
+ public String getAgeAsString() {
+ return data[INDEX_AGE];
+ }
}
Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/data/Strata.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/data/Strata.java 2010-10-29 16:26:32 UTC (rev 136)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/data/Strata.java 2010-10-29 16:29:35 UTC (rev 137)
@@ -84,4 +84,34 @@
return data[INDEX_SURFACE];
}
+ public void setSurveyAsString(String value) {
+ String oldValue = data[INDEX_SURVEY];
+ data[INDEX_SURVEY] = value;
+ getPropertyChangeSupport().firePropertyChange("surveyAsString", oldValue, value);
+ }
+
+ public String getSurveyAsString() {
+ return data[INDEX_SURVEY];
+ }
+
+ public void setStratumAsString(String value) {
+ String oldValue = data[INDEX_STRATUM];
+ data[INDEX_STRATUM] = value;
+ getPropertyChangeSupport().firePropertyChange("stratumAsString", oldValue, value);
+ }
+
+ public String getStratumAsString() {
+ return data[INDEX_STRATUM];
+ }
+
+ public void setSurfaceAsString(String value) {
+ String oldValue = data[INDEX_SURFACE];
+ data[INDEX_SURFACE] = value;
+ getPropertyChangeSupport().firePropertyChange("surfaceAsString", oldValue, value);
+ }
+
+ public String getSurfaceAsString() {
+ return data[INDEX_SURFACE];
+ }
+
}
Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/services/ValidationService.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/services/ValidationService.java 2010-10-29 16:26:32 UTC (rev 136)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/services/ValidationService.java 2010-10-29 16:29:35 UTC (rev 137)
@@ -409,7 +409,7 @@
// autre validation (rien a voir avec le reste attention)
// Vérifier que le nombre d'individus dans CAPT$Nombre n'est pas 0 si le poids dans CAPT$Poids>0.
- String poidsValue = tuple[Catch.INDEX_WEIGHT];
+ /*String poidsValue = tuple[Catch.INDEX_WEIGHT];
try {
Double poids = Double.valueOf(poidsValue);
if (poids > 0 && nombre <= 0) {
@@ -426,7 +426,7 @@
if (log.isWarnEnabled()) {
log.warn("Can't parse '" + poidsValue + "' as double");
}
- }
+ }*/
}
catch (NumberFormatException ex) {
// par trop grave, normalement les données deviennent
Modified: trunk/coser-business/src/main/resources/fr/ifremer/coser/data/Catch-error-validation.xml
===================================================================
--- trunk/coser-business/src/main/resources/fr/ifremer/coser/data/Catch-error-validation.xml 2010-10-29 16:26:32 UTC (rev 136)
+++ trunk/coser-business/src/main/resources/fr/ifremer/coser/data/Catch-error-validation.xml 2010-10-29 16:29:35 UTC (rev 137)
@@ -50,16 +50,20 @@
<message>You must enter a espece name.</message>
</field-validator>
</field>
- <field name="number">
+ <field name="numberAsString">
<field-validator type="checkDouble" short-circuit="true">
<param name="notAvailable">NA</param>
<message>Number attribute is not a valid double</message>
</field-validator>
</field>
- <field name="weight">
+ <field name="weightAsString">
<field-validator type="checkDouble" short-circuit="true">
<param name="notAvailable">NA</param>
<message>Weight attribute is not a valid double</message>
</field-validator>
</field>
+ <validator type="expression">
+ <param name="expression"><![CDATA[ (weight > 0 && number > 0) || weight == 0]]></param>
+ <message><![CDATA[coser.business.control.error.noCatchNumberWithWeight]]></message>
+ </validator>
</validators>
\ No newline at end of file
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-10-29 16:26:32 UTC (rev 136)
+++ trunk/coser-business/src/main/resources/i18n/coser-business-en_GB.properties 2010-10-29 16:29:35 UTC (rev 137)
@@ -26,7 +26,6 @@
You\ must\ enter\ a\ stratum\ name.=
You\ must\ enter\ a\ survey\ name.=
You\ must\ enter\ a\ trait\ name.=
-You\ must\ enter\ a\ year\ name.=
coser.business.category.catch=Catch
coser.business.category.haul=Haul
coser.business.category.length=Length
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-10-29 16:26:32 UTC (rev 136)
+++ trunk/coser-business/src/main/resources/i18n/coser-business-fr_FR.properties 2010-10-29 16:29:35 UTC (rev 137)
@@ -26,7 +26,6 @@
You\ must\ enter\ a\ stratum\ name.=
You\ must\ enter\ a\ survey\ name.=
You\ must\ enter\ a\ trait\ name.=
-You\ must\ enter\ a\ year\ name.=
coser.business.category.catch=Captures
coser.business.category.haul=Traits
coser.business.category.length=Tailles
Modified: trunk/coser-business/src/test/java/fr/ifremer/coser/services/ValidationServiceTest.java
===================================================================
--- trunk/coser-business/src/test/java/fr/ifremer/coser/services/ValidationServiceTest.java 2010-10-29 16:26:32 UTC (rev 136)
+++ trunk/coser-business/src/test/java/fr/ifremer/coser/services/ValidationServiceTest.java 2010-10-29 16:29:35 UTC (rev 137)
@@ -82,6 +82,7 @@
Catch myCatch = new Catch();
myCatch.setData(new String[]{"1", "Test survey","1999","Test trait","Test sp","NA","12"});
List<ValidationError> errors = validationService.validate(myCatch);
+ log.warn(errors);
Assert.assertTrue(errors.isEmpty());
}
Modified: trunk/coser-business/src/test/resources/log4j.properties
===================================================================
--- trunk/coser-business/src/test/resources/log4j.properties 2010-10-29 16:26:32 UTC (rev 136)
+++ trunk/coser-business/src/test/resources/log4j.properties 2010-10-29 16:29:35 UTC (rev 137)
@@ -33,3 +33,4 @@
# Categories
log4j.category.fr.ifremer.coser=DEBUG
+#log4j.category.com.opensymphony.xwork2=DEBUG
1
0
r136 - trunk/coser-business/src/main/java/fr/ifremer/coser/validators
by chatellier@users.labs.libre-entreprise.org 29 Oct '10
by chatellier@users.labs.libre-entreprise.org 29 Oct '10
29 Oct '10
Author: chatellier
Date: 2010-10-29 16:26:32 +0000 (Fri, 29 Oct 2010)
New Revision: 136
Log:
Ajout d'une classe abstraite pour pouvoir avoir les exceptions de validation
Added:
trunk/coser-business/src/main/java/fr/ifremer/coser/validators/AbstractFieldValidator.java
Modified:
trunk/coser-business/src/main/java/fr/ifremer/coser/validators/CoserCheckDoubleValidator.java
trunk/coser-business/src/main/java/fr/ifremer/coser/validators/CoserDoubleValidator.java
Added: trunk/coser-business/src/main/java/fr/ifremer/coser/validators/AbstractFieldValidator.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/validators/AbstractFieldValidator.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/validators/AbstractFieldValidator.java 2010-10-29 16:26:32 UTC (rev 136)
@@ -0,0 +1,76 @@
+/*
+ * #%L
+ *
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2010 Codelutin, Chatellier Eric
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+package fr.ifremer.coser.validators;
+
+import com.opensymphony.xwork2.util.ValueStack;
+import com.opensymphony.xwork2.validator.ValidationException;
+import com.opensymphony.xwork2.validator.validators.FieldValidatorSupport;
+
+/**
+ * Abstract validator.
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * By : $Author$
+ */
+public abstract class AbstractFieldValidator extends FieldValidatorSupport {
+
+ private ValueStack localStack;
+
+ public void setValueStack(ValueStack localStack) {
+ super.setValueStack(localStack);
+ this.localStack = localStack;
+ }
+
+ /**
+ * Return the field value named <code>name</code> from <code>object</code>,
+ * <code>object</code> should have the appropriate getter/setter.
+ *
+ * @param name
+ * @param object
+ * @return Object as field value
+ * @throws ValidationException
+ */
+ protected Object getFieldValue(String name, Object object, boolean throwExceptionOnFailure) throws ValidationException {
+
+ boolean pop = false;
+
+ if (!localStack.getRoot().contains(object)) {
+ localStack.push(object);
+ pop = true;
+ }
+
+ Object retVal = localStack.findValue(name, throwExceptionOnFailure);
+
+ if (pop) {
+ localStack.pop();
+ }
+
+ return retVal;
+ }
+}
Property changes on: trunk/coser-business/src/main/java/fr/ifremer/coser/validators/AbstractFieldValidator.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/validators/CoserCheckDoubleValidator.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/validators/CoserCheckDoubleValidator.java 2010-10-29 15:43:38 UTC (rev 135)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/validators/CoserCheckDoubleValidator.java 2010-10-29 16:26:32 UTC (rev 136)
@@ -26,7 +26,6 @@
package fr.ifremer.coser.validators;
import com.opensymphony.xwork2.validator.ValidationException;
-import com.opensymphony.xwork2.validator.validators.FieldValidatorSupport;
/**
* Validateur de double de coser.
@@ -37,7 +36,7 @@
* Last update : $Date$
* By : $Author$
*/
-public class CoserCheckDoubleValidator extends FieldValidatorSupport {
+public class CoserCheckDoubleValidator extends AbstractFieldValidator {
protected String notAvailable;
Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/validators/CoserDoubleValidator.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/validators/CoserDoubleValidator.java 2010-10-29 15:43:38 UTC (rev 135)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/validators/CoserDoubleValidator.java 2010-10-29 16:26:32 UTC (rev 136)
@@ -26,7 +26,6 @@
package fr.ifremer.coser.validators;
import com.opensymphony.xwork2.validator.ValidationException;
-import com.opensymphony.xwork2.validator.validators.FieldValidatorSupport;
/**
* TODO add comment here.
@@ -37,7 +36,7 @@
* Last update : $Date$
* By : $Author$
*/
-public class CoserDoubleValidator extends FieldValidatorSupport {
+public class CoserDoubleValidator extends AbstractFieldValidator {
protected Double max = null;
protected Double min = null;
1
0
r135 - in trunk: coser-business/src/main/java/fr/ifremer/coser/command coser-business/src/main/java/fr/ifremer/coser/services coser-business/src/main/java/fr/ifremer/coser/storage coser-business/src/main/resources/i18n coser-business/src/test/java/fr/ifremer/coser/services coser-ui/src/main/java/fr/ifremer/coser/ui/control
by chatellier@users.labs.libre-entreprise.org 29 Oct '10
by chatellier@users.labs.libre-entreprise.org 29 Oct '10
29 Oct '10
Author: chatellier
Date: 2010-10-29 15:43:38 +0000 (Fri, 29 Oct 2010)
New Revision: 135
Log:
Amelioration du storage pour acceder rapidement aux donn?\195?\169es en fonction de leur num?\195?\169ro de ligne
Added:
trunk/coser-business/src/main/java/fr/ifremer/coser/storage/MemoryDataStorage.java
Removed:
trunk/coser-business/src/main/java/fr/ifremer/coser/storage/MemoryListStorage.java
Modified:
trunk/coser-business/src/main/java/fr/ifremer/coser/command/DeleteLineCommand.java
trunk/coser-business/src/main/java/fr/ifremer/coser/command/ModifyFieldCommand.java
trunk/coser-business/src/main/java/fr/ifremer/coser/services/ImportService.java
trunk/coser-business/src/main/java/fr/ifremer/coser/storage/DataStorage.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-business/src/test/java/fr/ifremer/coser/services/CommandServiceTest.java
trunk/coser-business/src/test/java/fr/ifremer/coser/services/ValidationServiceTest.java
trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/ControlDataTableModel.java
Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/command/DeleteLineCommand.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/command/DeleteLineCommand.java 2010-10-29 15:32:52 UTC (rev 134)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/command/DeleteLineCommand.java 2010-10-29 15:43:38 UTC (rev 135)
@@ -27,8 +27,6 @@
import static org.nuiton.i18n.I18n._;
-import java.util.Iterator;
-
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -36,7 +34,6 @@
import fr.ifremer.coser.CoserConstants.Category;
import fr.ifremer.coser.bean.AbstractDataContainer;
import fr.ifremer.coser.bean.Project;
-import fr.ifremer.coser.data.AbstractDataEntity;
import fr.ifremer.coser.storage.DataStorage;
/**
@@ -101,24 +98,13 @@
}
// parcourt des lignes
- boolean dataLineFound = false;
- Iterator<String[]> itDataStorage = dataStorage.iterator();
- itDataStorage.next(); // skip header
- while (itDataStorage.hasNext()) {
- String[] dataLine = itDataStorage.next();
- String dataLineIndex = dataLine[AbstractDataEntity.INDEX_LINE];
- if (dataLineIndex.equals(lineNumber)) {
- if (log.isDebugEnabled()) {
- log.debug("Removing line " + dataLineIndex);
- }
- dataLineFound = true;
- deletedDataStorage.add(dataLine);
- itDataStorage.remove();
- }
+ int index = dataStorage.indexOf(lineNumber);
+ if (index >= 0) {
+ String[] data = dataStorage.remove(index);
+ deletedDataStorage.add(data);
}
-
- // if not found, throw business exception
- if (!dataLineFound) {
+ else {
+ // if not found, throw business exception
throw new CoserBusinessException(_("Can't find line %s for deletion", lineNumber));
}
}
@@ -149,45 +135,38 @@
break;
}
- // parcourt des lignes
- boolean dataLineFound = false;
- Iterator<String[]> itDeletedDataStorage = deletedDataStorage.iterator();
- itDeletedDataStorage.next(); //skip header
- while (itDeletedDataStorage.hasNext()) {
- String[] deletedDataLine = itDeletedDataStorage.next();
- String deletedDataLineIndex = deletedDataLine[AbstractDataEntity.INDEX_LINE];
- if (deletedDataLineIndex.equals(lineNumber)) {
- dataLineFound = true;
- itDeletedDataStorage.remove();
+ int indexDeletedData = deletedDataStorage.indexOf(lineNumber);
+
+ if (indexDeletedData != -1) {
+ String[] deletedDataLine = deletedDataStorage.get(indexDeletedData);
+
+ // search for new insert point
+ int lineNumberInt = Integer.parseInt(lineNumber);
- // search new insert point
- int originalDataLine = Integer.parseInt(deletedDataLineIndex);
- Iterator<String[]> itDataStorage = dataStorage.iterator();
- itDataStorage.next(); //skip header
- int index = 1; // due to header
- while (itDataStorage.hasNext()) {
- String[] dataLine = itDataStorage.next();
- String dataLineIndex = dataLine[AbstractDataEntity.INDEX_LINE];
- int dataLineInt = Integer.parseInt(dataLineIndex);
- if (dataLineInt == originalDataLine) {
- throw new CoserBusinessException(_("Original line already exists!"));
- }
- else if (dataLineInt > originalDataLine) {
- break;
- }
- index++;
- }
-
- // insert line at specified index
- dataStorage.add(index, deletedDataLine);
- if (log.isDebugEnabled()) {
- log.debug("Restore line " + index);
- }
+ // check que la ligne a restaurer n'existe pas deja
+ int indexData = dataStorage.indexOf(String.valueOf(lineNumberInt));
+ if (indexData != -1) {
+ throw new CoserBusinessException("Original line already exists !");
}
+
+ do {
+ lineNumberInt--;
+ indexData = dataStorage.indexOf(String.valueOf(lineNumberInt));
+ } while (indexData < 0 && lineNumberInt > 0);
+
+ // re add deleted data
+ if (indexData >= 0) {
+ // +1 car on l'insert apres la ligne qu'on a trouvé
+ dataStorage.add(indexData + 1, deletedDataLine);
+ }
+ else {
+ dataStorage.add(0, deletedDataLine);
+ }
+ deletedDataStorage.remove(indexDeletedData);
}
// if not found, throw business exception
- if (!dataLineFound) {
+ else {
throw new CoserBusinessException(_("Can't find line %s for undeletion", lineNumber));
}
}
Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/command/ModifyFieldCommand.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/command/ModifyFieldCommand.java 2010-10-29 15:32:52 UTC (rev 134)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/command/ModifyFieldCommand.java 2010-10-29 15:43:38 UTC (rev 135)
@@ -27,7 +27,6 @@
import static org.nuiton.i18n.I18n._;
-import java.lang.reflect.InvocationTargetException;
import java.util.Iterator;
import org.apache.commons.beanutils.PropertyUtils;
Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/services/ImportService.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/services/ImportService.java 2010-10-29 15:32:52 UTC (rev 134)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/services/ImportService.java 2010-10-29 15:43:38 UTC (rev 135)
@@ -58,7 +58,7 @@
import fr.ifremer.coser.data.Length;
import fr.ifremer.coser.data.Strata;
import fr.ifremer.coser.storage.DataStorage;
-import fr.ifremer.coser.storage.MemoryListStorage;
+import fr.ifremer.coser.storage.MemoryDataStorage;
/**
* File import/export service.
@@ -90,7 +90,7 @@
*/
public DataStorage loadCSVFile(Project project, Category category, File file, boolean originalLoading) throws CoserBusinessException {
- DataStorage content = new MemoryListStorage();
+ DataStorage content = new MemoryDataStorage();
Reader reader = null;
CSVReader csvReader = null;
@@ -200,7 +200,7 @@
*/
public DataStorage getEmptyStorage(Project project, Category category) {
- DataStorage dataStorage = new MemoryListStorage();
+ DataStorage dataStorage = new MemoryDataStorage();
switch (category) {
case CATCH:
dataStorage.add(Catch.EN_HEADERS);
Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/storage/DataStorage.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/storage/DataStorage.java 2010-10-29 15:32:52 UTC (rev 134)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/storage/DataStorage.java 2010-10-29 15:43:38 UTC (rev 135)
@@ -69,4 +69,6 @@
String[] set(int index, String[] data);
String[] remove(int index);
+
+ public int indexOf(String lineNumber);
}
Copied: trunk/coser-business/src/main/java/fr/ifremer/coser/storage/MemoryDataStorage.java (from rev 103, trunk/coser-business/src/main/java/fr/ifremer/coser/storage/MemoryListStorage.java)
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/storage/MemoryDataStorage.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/storage/MemoryDataStorage.java 2010-10-29 15:43:38 UTC (rev 135)
@@ -0,0 +1,197 @@
+/*
+ * #%L
+ *
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2010 Codelutin, Chatellier Eric
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+package fr.ifremer.coser.storage;
+
+import java.io.IOException;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import au.com.bytecode.opencsv.CSVReader;
+import au.com.bytecode.opencsv.CSVWriter;
+
+/**
+ * Stockage mémoire des String[] sous forme de String simple.
+ *
+ * Beaucoup moins couteux en mémoire que les String[] sans pour antant
+ * que le temps de parcours soit augmenté.
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * By : $Author$
+ */
+public class MemoryDataStorage implements DataStorage {
+
+ public List<String> listStorage;
+ public List<String> lineIndexStorage;
+
+ public MemoryDataStorage() {
+ listStorage = new ArrayList<String>();
+ lineIndexStorage = new ArrayList<String>();
+ }
+
+ public class StringListIterator implements Iterator<String[]> {
+
+ protected Iterator<String> listIterator;
+ protected Iterator<String> lineIndexIterator;
+
+ public StringListIterator(Iterator<String> internalIterator, Iterator<String> lineIndexIterator) {
+ this.listIterator = internalIterator;
+ this.lineIndexIterator = lineIndexIterator;
+ }
+
+ /*
+ * @see java.util.Iterator#hasNext()
+ */
+ @Override
+ public boolean hasNext() {
+ return listIterator.hasNext();
+ }
+
+ /*
+ * @see java.util.Iterator#next()
+ */
+ @Override
+ public String[] next() {
+
+ String nextString = listIterator.next();
+ String[] nextArray = stringToArray(nextString);
+
+ lineIndexIterator.next();
+
+ return nextArray;
+ }
+
+ /*
+ * @see java.util.Iterator#remove()
+ */
+ @Override
+ public void remove() {
+ listIterator.remove();
+ lineIndexIterator.remove();
+ }
+ }
+
+ /*
+ * @see java.lang.Iterable#iterator()
+ */
+ @Override
+ public Iterator<String[]> iterator() {
+ return new StringListIterator(listStorage.iterator(), lineIndexStorage.iterator());
+ }
+
+ /*
+ * @see fr.ifremer.coser.storage.DataStorage#addData(java.lang.String[])
+ */
+ @Override
+ public void add(String[] data) {
+
+ String stringData = arrayToString(data);
+ listStorage.add(stringData);
+ lineIndexStorage.add(data[0]);
+ }
+
+ /*
+ * @see fr.ifremer.coser.storage.DataStorage#addData(java.lang.String[])
+ */
+ @Override
+ public void add(int index, String[] data) {
+
+ String stringData = arrayToString(data);
+ listStorage.add(index, stringData);
+ lineIndexStorage.add(index, data[0]);
+ }
+
+ protected String arrayToString(String[] data) {
+ StringWriter writer = new StringWriter();
+ CSVWriter csvWriter = new CSVWriter(writer);
+ csvWriter.writeNext(data);
+ //TODO echatellier 20101022 replace with custom parsing code
+ try {
+ csvWriter.close();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ return writer.toString();
+ }
+
+ protected String[] stringToArray(String data) {
+ StringReader reader = new StringReader(data);
+ CSVReader csvReader = new CSVReader(reader);
+ String[] dataArray = null;
+ //TODO echatellier 20101022 replace with custom parsing code
+ try {
+ dataArray = csvReader.readNext();
+ csvReader.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ return dataArray;
+ }
+
+ /*
+ * @see fr.ifremer.coser.storage.DataStorage#getData(int)
+ */
+ @Override
+ public String[] get(int index) {
+ String stringData = listStorage.get(index);
+ String[] dataArray = stringToArray(stringData);
+ return dataArray;
+ }
+
+ public int indexOf(String lineNumber) {
+ return lineIndexStorage.indexOf(lineNumber);
+ }
+
+ public int size() {
+ return listStorage.size();
+ }
+
+ public String[] set(int index, String[] element) {
+ String data = arrayToString(element);
+ String old = listStorage.set(index, data);
+ String[] oldArray = stringToArray(old);
+ lineIndexStorage.set(index, element[0]);
+ return oldArray;
+ }
+
+ public String[] remove(int index) {
+ String old = listStorage.remove(index);
+ String[] oldArray = stringToArray(old);
+ lineIndexStorage.remove(index);
+ return oldArray;
+ }
+
+ @Override
+ public String toString() {
+ return listStorage.toString();
+ }
+}
Deleted: trunk/coser-business/src/main/java/fr/ifremer/coser/storage/MemoryListStorage.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/storage/MemoryListStorage.java 2010-10-29 15:32:52 UTC (rev 134)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/storage/MemoryListStorage.java 2010-10-29 15:43:38 UTC (rev 135)
@@ -1,182 +0,0 @@
-/*
- * #%L
- *
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2010 Codelutin, Chatellier Eric
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/lgpl-3.0.html>.
- * #L%
- */
-
-package fr.ifremer.coser.storage;
-
-import java.io.IOException;
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import au.com.bytecode.opencsv.CSVReader;
-import au.com.bytecode.opencsv.CSVWriter;
-
-/**
- * Stockage mémoire des String[] sous forme de String simple.
- *
- * Beaucoup moins couteux en mémoire que les String[] sans pour antant
- * que le temps de parcours soit augmenté.
- *
- * @author chatellier
- * @version $Revision$
- *
- * Last update : $Date$
- * By : $Author$
- */
-public class MemoryListStorage implements DataStorage {
-
- public List<String> internalStorage;
-
- public MemoryListStorage() {
- internalStorage = new ArrayList<String>();
- }
-
- public class StringListIterator implements Iterator<String[]> {
-
- protected Iterator<String> internalIterator;
-
- public StringListIterator(Iterator<String> internalIterator) {
- this.internalIterator = internalIterator;
- }
-
- /*
- * @see java.util.Iterator#hasNext()
- */
- @Override
- public boolean hasNext() {
- return internalIterator.hasNext();
- }
-
- /*
- * @see java.util.Iterator#next()
- */
- @Override
- public String[] next() {
-
- String nextString = internalIterator.next();
- String[] nextArray = stringToArray(nextString);
-
- return nextArray;
- }
-
- /*
- * @see java.util.Iterator#remove()
- */
- @Override
- public void remove() {
- internalIterator.remove();
- }
- }
-
- /*
- * @see java.lang.Iterable#iterator()
- */
- @Override
- public Iterator<String[]> iterator() {
- return new StringListIterator(internalStorage.iterator());
- }
-
- /*
- * @see fr.ifremer.coser.storage.DataStorage#addData(java.lang.String[])
- */
- @Override
- public void add(String[] data) {
-
- String stringData = arrayToString(data);
- internalStorage.add(stringData);
- }
-
- /*
- * @see fr.ifremer.coser.storage.DataStorage#addData(java.lang.String[])
- */
- @Override
- public void add(int index, String[] data) {
-
- String stringData = arrayToString(data);
- internalStorage.add(index, stringData);
- }
-
- protected String arrayToString(String[] data) {
- StringWriter writer = new StringWriter();
- CSVWriter csvWriter = new CSVWriter(writer);
- csvWriter.writeNext(data);
- //TODO echatellier 20101022 replace with custom parsing code
- try {
- csvWriter.close();
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- return writer.toString();
- }
-
- protected String[] stringToArray(String data) {
- StringReader reader = new StringReader(data);
- CSVReader csvReader = new CSVReader(reader);
- String[] dataArray = null;
- //TODO echatellier 20101022 replace with custom parsing code
- try {
- dataArray = csvReader.readNext();
- csvReader.close();
- } catch (IOException e) {
- e.printStackTrace();
- }
- return dataArray;
- }
-
- /*
- * @see fr.ifremer.coser.storage.DataStorage#getData(int)
- */
- @Override
- public String[] get(int index) {
- String stringData = internalStorage.get(index);
- String[] dataArray = stringToArray(stringData);
- return dataArray;
- }
-
- public int size() {
- return internalStorage.size();
- }
-
- public String[] set(int index, String[] element) {
- String data = arrayToString(element);
- String old = internalStorage.set(index, data);
- String[] oldArray = stringToArray(old);
- return oldArray;
- }
-
- public String[] remove(int index) {
- String old = internalStorage.remove(index);
- String[] oldArray = stringToArray(old);
- return oldArray;
- }
-
- @Override
- public String toString() {
- return internalStorage.toString();
- }
-}
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-10-29 15:32:52 UTC (rev 134)
+++ trunk/coser-business/src/main/resources/i18n/coser-business-en_GB.properties 2010-10-29 15:43:38 UTC (rev 135)
@@ -8,7 +8,6 @@
Maturity\ attribute\ is\ required=
Missing\ file\ %s=
Number\ attribute\ is\ not\ a\ valid\ double=
-Original\ line\ already\ exists\!=
Project\ %s\ already\ exist=
Project\ %s\ doesn't\ exists\ \!=
Project\ name\ is\ required=
@@ -53,3 +52,4 @@
long\ must\ contains\ at\ least\ 5\ decimal=
number\ attribute\ is\ not\ a\ valid\ double=
sweptSurface\ attribute\ is\ not\ a\ valid\ double=
+year\ is\ not\ valid=
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-10-29 15:32:52 UTC (rev 134)
+++ trunk/coser-business/src/main/resources/i18n/coser-business-fr_FR.properties 2010-10-29 15:43:38 UTC (rev 135)
@@ -8,7 +8,6 @@
Maturity\ attribute\ is\ required=
Missing\ file\ %s=Fichier manquant \: %s
Number\ attribute\ is\ not\ a\ valid\ double=
-Original\ line\ already\ exists\!=
Project\ %s\ already\ exist=Le projet %s existe d\u00E9j\u00E0 \!
Project\ %s\ doesn't\ exists\ \!=Le projet %s n'existe pas \!
Project\ name\ is\ required=
@@ -53,3 +52,4 @@
long\ must\ contains\ at\ least\ 5\ decimal=
number\ attribute\ is\ not\ a\ valid\ double=
sweptSurface\ attribute\ is\ not\ a\ valid\ double=
+year\ is\ not\ valid=
Modified: trunk/coser-business/src/test/java/fr/ifremer/coser/services/CommandServiceTest.java
===================================================================
--- trunk/coser-business/src/test/java/fr/ifremer/coser/services/CommandServiceTest.java 2010-10-29 15:32:52 UTC (rev 134)
+++ trunk/coser-business/src/test/java/fr/ifremer/coser/services/CommandServiceTest.java 2010-10-29 15:43:38 UTC (rev 135)
@@ -108,6 +108,24 @@
Assert.assertEquals("4", project.getControl().getLength().get(4)[Length.INDEX_LINE]);
commandService.undoAction(project, project.getControl());
Assert.assertEquals("3", project.getControl().getLength().get(4)[Length.INDEX_LINE]);
-
}
+
+ /**
+ * Test que la double annulation d'un retablissement de ligne
+ * lance une exception.
+ *
+ * @throws CoserBusinessException
+ */
+ @Test(expected=CoserBusinessException.class)
+ public void testDeleteLineUndoAlreadyExists() throws CoserBusinessException {
+ Project project = createTestProject(projectService);
+ DeleteLineCommand command = new DeleteLineCommand();
+ command.setLineNumber("3");
+ command.setCategory(Category.LENGTH);
+
+ commandService.doAction(command, project, project.getControl());
+ commandService.undoAction(project, project.getControl());
+ project.getControl().getHistoryCommand().add(command);
+ commandService.undoAction(project, project.getControl());
+ }
}
Modified: trunk/coser-business/src/test/java/fr/ifremer/coser/services/ValidationServiceTest.java
===================================================================
--- trunk/coser-business/src/test/java/fr/ifremer/coser/services/ValidationServiceTest.java 2010-10-29 15:32:52 UTC (rev 134)
+++ trunk/coser-business/src/test/java/fr/ifremer/coser/services/ValidationServiceTest.java 2010-10-29 15:43:38 UTC (rev 135)
@@ -38,7 +38,7 @@
import fr.ifremer.coser.data.Catch;
import fr.ifremer.coser.data.Haul;
import fr.ifremer.coser.storage.DataStorage;
-import fr.ifremer.coser.storage.MemoryListStorage;
+import fr.ifremer.coser.storage.MemoryDataStorage;
/**
* Test abour validation.
@@ -106,7 +106,7 @@
@Test
public void testWeigthWithNonCapture() {
Control control = new Control();
- DataStorage dataCatch = new MemoryListStorage();
+ DataStorage dataCatch = new MemoryDataStorage();
dataCatch.add(new String[]{"Line", "Campagne","Annee","Trait","Espece","Nombre","Poids"});
dataCatch.add(new String[]{"1", "Test survey","1999","Test trait","Test sp","0","12"});
control.setCatch(dataCatch);
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-10-29 15:32:52 UTC (rev 134)
+++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/ControlDataTableModel.java 2010-10-29 15:43:38 UTC (rev 135)
@@ -134,21 +134,8 @@
* @return l'index
*/
public int getRealIndexOfLine(String lineNumber) {
- Iterator<String[]> itData = data.iterator();
- itData.next(); // skip header
- int result = -1;
- int index = 0;
- while (itData.hasNext() && result == -1) {
- String currentLineNumber = itData.next()[AbstractDataEntity.INDEX_LINE];
- if (lineNumber.equals(currentLineNumber)) {
- result = index;
- }
- ++index;
- }
-
- if (log.isDebugEnabled()) {
- log.debug("Real line for " + lineNumber + " = " + index);
- }
+ // -1 because header is table header
+ int result = data.indexOf(lineNumber) - 1;
return result;
}
}
1
0
r134 - trunk/coser-business/src/main/resources/fr/ifremer/coser/data
by chatellier@users.labs.libre-entreprise.org 29 Oct '10
by chatellier@users.labs.libre-entreprise.org 29 Oct '10
29 Oct '10
Author: chatellier
Date: 2010-10-29 15:32:52 +0000 (Fri, 29 Oct 2010)
New Revision: 134
Log:
Ajout d'un meilleurs check sur les ann?\195?\169es
Modified:
trunk/coser-business/src/main/resources/fr/ifremer/coser/data/Catch-error-validation.xml
trunk/coser-business/src/main/resources/fr/ifremer/coser/data/Haul-error-validation.xml
trunk/coser-business/src/main/resources/fr/ifremer/coser/data/Length-error-validation.xml
Modified: trunk/coser-business/src/main/resources/fr/ifremer/coser/data/Catch-error-validation.xml
===================================================================
--- trunk/coser-business/src/main/resources/fr/ifremer/coser/data/Catch-error-validation.xml 2010-10-29 15:31:13 UTC (rev 133)
+++ trunk/coser-business/src/main/resources/fr/ifremer/coser/data/Catch-error-validation.xml 2010-10-29 15:32:52 UTC (rev 134)
@@ -33,9 +33,9 @@
</field-validator>
</field>
<field name="year">
- <field-validator type="requiredstring">
- <param name="trim">true</param>
- <message>You must enter a espece name.</message>
+ <field-validator type="regex">
+ <param name="expression">[0-9]{4}</param>
+ <message>year is not valid</message>
</field-validator>
</field>
<field name="haul">
Modified: trunk/coser-business/src/main/resources/fr/ifremer/coser/data/Haul-error-validation.xml
===================================================================
--- trunk/coser-business/src/main/resources/fr/ifremer/coser/data/Haul-error-validation.xml 2010-10-29 15:31:13 UTC (rev 133)
+++ trunk/coser-business/src/main/resources/fr/ifremer/coser/data/Haul-error-validation.xml 2010-10-29 15:32:52 UTC (rev 134)
@@ -32,8 +32,9 @@
</field-validator>
</field>
<field name="year">
- <field-validator type="requiredstring">
- <message>You must enter a year name.</message>
+ <field-validator type="regex">
+ <param name="expression">[0-9]{4}</param>
+ <message>year is not valid</message>
</field-validator>
</field>
<field name="haul">
Modified: trunk/coser-business/src/main/resources/fr/ifremer/coser/data/Length-error-validation.xml
===================================================================
--- trunk/coser-business/src/main/resources/fr/ifremer/coser/data/Length-error-validation.xml 2010-10-29 15:31:13 UTC (rev 133)
+++ trunk/coser-business/src/main/resources/fr/ifremer/coser/data/Length-error-validation.xml 2010-10-29 15:32:52 UTC (rev 134)
@@ -33,9 +33,9 @@
</field-validator>
</field>
<field name="year">
- <field-validator type="requiredstring">
- <param name="trim">true</param>
- <message>You must enter a espece name.</message>
+ <field-validator type="regex">
+ <param name="expression">[0-9]{4}</param>
+ <message>year is not valid</message>
</field-validator>
</field>
<field name="haul">
1
0
r133 - trunk/coser-business/src/main/java/fr/ifremer/coser/services
by chatellier@users.labs.libre-entreprise.org 29 Oct '10
by chatellier@users.labs.libre-entreprise.org 29 Oct '10
29 Oct '10
Author: chatellier
Date: 2010-10-29 15:31:13 +0000 (Fri, 29 Oct 2010)
New Revision: 133
Log:
Correction pour avoir les lignes des validations portant sur plusieurs lignes
Modified:
trunk/coser-business/src/main/java/fr/ifremer/coser/services/ValidationService.java
Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/services/ValidationService.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/services/ValidationService.java 2010-10-29 15:04:40 UTC (rev 132)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/services/ValidationService.java 2010-10-29 15:31:13 UTC (rev 133)
@@ -400,34 +400,43 @@
Double oldValue = nombreForKey.get(key);
Double newValue = oldValue + nombre;
nombreForKey.put(key, newValue);
-
- // sauvegarde la premiere ligne qui correspond a un regroupement de clé
- firstLineForKey.put(key, lineNumber);
}
else {
nombreForKey.put(key, nombre);
+ // sauvegarde la premiere ligne qui correspond a un regroupement de clé
+ firstLineForKey.put(key, lineNumber);
}
-
// autre validation (rien a voir avec le reste attention)
// Vérifier que le nombre d'individus dans CAPT$Nombre n'est pas 0 si le poids dans CAPT$Poids>0.
String poidsValue = tuple[Catch.INDEX_WEIGHT];
- Double poids = Double.valueOf(poidsValue);
- if (poids > 0 && nombre <= 0) {
- ValidationError error = new ValidationError();
- error.setLevel(ValidationLevel.ERROR);
- error.setLineNumber(lineNumber);
- error.setMessage(_("coser.business.control.error.noCatchNumberWithWeight"));
- validationErrors.add(error);
+ try {
+ Double poids = Double.valueOf(poidsValue);
+ if (poids > 0 && nombre <= 0) {
+ ValidationError error = new ValidationError();
+ error.setLevel(ValidationLevel.ERROR);
+ error.setLineNumber(lineNumber);
+ error.setMessage(_("coser.business.control.error.noCatchNumberWithWeight"));
+ validationErrors.add(error);
+ }
}
+ catch (NumberFormatException ex) {
+ // par trop grave, normalement les données deviennent
+ // valide au fil de la validation
+ if (log.isWarnEnabled()) {
+ log.warn("Can't parse '" + poidsValue + "' as double");
+ }
+ }
}
catch (NumberFormatException ex) {
- // par trop grave, normalement les données deviennet
+ // par trop grave, normalement les données deviennent
// valide au fil de la validation
if (log.isWarnEnabled()) {
- log.warn("Can't parse " + nombreValue + " as double");
+ log.warn("Can't parse '" + nombreValue + "' as double");
}
}
+
+
}
// now look for invalid data
@@ -439,9 +448,9 @@
String lineNumber = firstLineForKey.get(key);
ValidationError error = new ValidationError();
- error.setLevel(ValidationLevel.ERROR);
+ error.setLevel(ValidationLevel.WARNING);
error.setLineNumber(lineNumber);
- error.setMessage(_("coser.business.control.error.minObservationCount", key));
+ error.setMessage(_("coser.business.control.error.minObservationCount", key, value));
validationErrors.add(error);
}
}
@@ -505,12 +514,11 @@
Double oldValue = nombreForKey.get(key);
Double newValue = oldValue + nombre;
nombreForKey.put(key, newValue);
-
- // sauvegarde la premiere ligne qui correspond a un regroupement de clé
- firstLineForKey.put(key, lineNumber);
}
else {
nombreForKey.put(key, nombre);
+ // sauvegarde la premiere ligne qui correspond a un regroupement de clé
+ firstLineForKey.put(key, lineNumber);
}
}
catch (NumberFormatException ex) {
1
0
r132 - in trunk: coser-business/src/test/resources coser-ui/src/main/resources
by chatellier@users.labs.libre-entreprise.org 29 Oct '10
by chatellier@users.labs.libre-entreprise.org 29 Oct '10
29 Oct '10
Author: chatellier
Date: 2010-10-29 15:04:40 +0000 (Fri, 29 Oct 2010)
New Revision: 132
Log:
Modify loggin output
Modified:
trunk/coser-business/src/test/resources/log4j.properties
trunk/coser-ui/src/main/resources/log4j.properties
Modified: trunk/coser-business/src/test/resources/log4j.properties
===================================================================
--- trunk/coser-business/src/test/resources/log4j.properties 2010-10-29 14:17:52 UTC (rev 131)
+++ trunk/coser-business/src/test/resources/log4j.properties 2010-10-29 15:04:40 UTC (rev 132)
@@ -29,7 +29,7 @@
# Console output
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
+log4j.appender.stdout.layout.ConversionPattern=%d{HH:mm:ss} %-5p %c:%L - %m%n
# Categories
log4j.category.fr.ifremer.coser=DEBUG
Modified: trunk/coser-ui/src/main/resources/log4j.properties
===================================================================
--- trunk/coser-ui/src/main/resources/log4j.properties 2010-10-29 14:17:52 UTC (rev 131)
+++ trunk/coser-ui/src/main/resources/log4j.properties 2010-10-29 15:04:40 UTC (rev 132)
@@ -28,14 +28,14 @@
# Console output
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
+log4j.appender.stdout.layout.ConversionPattern=%d{HH:mm:ss} %-5p %c:%L - %m%n
log4j.appender.file=org.apache.log4j.RollingFileAppender
log4j.appender.file.file=coser.log
log4j.appender.file.MaxFileSize=10MB
log4j.appender.file.MaxBackupIndex=4
log4j.appender.file.layout=org.apache.log4j.PatternLayout
-log4j.appender.file.layout.ConversionPattern=%d{ISO8601} %5p [%t] %c - %m%n
+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
1
0
r131 - in trunk: coser-business/src/main/java/fr/ifremer/coser/command coser-business/src/main/java/fr/ifremer/coser/services coser-business/src/main/resources/i18n coser-business/src/test/java/fr/ifremer/coser/services coser-ui/src/main/java/fr/ifremer/coser/ui/control coser-ui/src/main/resources/i18n
by chatellier@users.labs.libre-entreprise.org 29 Oct '10
by chatellier@users.labs.libre-entreprise.org 29 Oct '10
29 Oct '10
Author: chatellier
Date: 2010-10-29 14:17:52 +0000 (Fri, 29 Oct 2010)
New Revision: 131
Log:
Begin find and replace command
Modified:
trunk/coser-business/src/main/java/fr/ifremer/coser/command/DeleteLineCommand.java
trunk/coser-business/src/main/java/fr/ifremer/coser/command/ModifyFieldCommand.java
trunk/coser-business/src/main/java/fr/ifremer/coser/services/ProjectService.java
trunk/coser-business/src/main/java/fr/ifremer/coser/services/ValidationService.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-business/src/test/java/fr/ifremer/coser/services/CommandServiceTest.java
trunk/coser-business/src/test/java/fr/ifremer/coser/services/CoserTestAbstract.java
trunk/coser-business/src/test/java/fr/ifremer/coser/services/ValidationServiceTest.java
trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/ControlFindReplaceDialog.jaxx
trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/ControlHandler.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/command/DeleteLineCommand.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/command/DeleteLineCommand.java 2010-10-29 12:00:49 UTC (rev 130)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/command/DeleteLineCommand.java 2010-10-29 14:17:52 UTC (rev 131)
@@ -56,7 +56,7 @@
protected Category category;
/** Line index of object to do command to. */
- protected String lineIndex;
+ protected String lineNumber;
public Category getCategory() {
return category;
@@ -66,12 +66,12 @@
this.category = category;
}
- public String getLineIndex() {
- return lineIndex;
+ public String getLineNumber() {
+ return lineNumber;
}
- public void setLineIndex(String lineIndex) {
- this.lineIndex = lineIndex;
+ public void setLineNumber(String lineNumber) {
+ this.lineNumber = lineNumber;
}
@Override
@@ -107,7 +107,7 @@
while (itDataStorage.hasNext()) {
String[] dataLine = itDataStorage.next();
String dataLineIndex = dataLine[AbstractDataEntity.INDEX_LINE];
- if (dataLineIndex.equals(lineIndex)) {
+ if (dataLineIndex.equals(lineNumber)) {
if (log.isDebugEnabled()) {
log.debug("Removing line " + dataLineIndex);
}
@@ -119,7 +119,7 @@
// if not found, throw business exception
if (!dataLineFound) {
- throw new CoserBusinessException(_("Can't find line %s for deletion", lineIndex));
+ throw new CoserBusinessException(_("Can't find line %s for deletion", lineNumber));
}
}
@@ -156,7 +156,7 @@
while (itDeletedDataStorage.hasNext()) {
String[] deletedDataLine = itDeletedDataStorage.next();
String deletedDataLineIndex = deletedDataLine[AbstractDataEntity.INDEX_LINE];
- if (deletedDataLineIndex.equals(lineIndex)) {
+ if (deletedDataLineIndex.equals(lineNumber)) {
dataLineFound = true;
itDeletedDataStorage.remove();
@@ -188,12 +188,12 @@
// if not found, throw business exception
if (!dataLineFound) {
- throw new CoserBusinessException(_("Can't find line %s for undeletion", lineIndex));
+ throw new CoserBusinessException(_("Can't find line %s for undeletion", lineNumber));
}
}
@Override
public String toString() {
- return "Delete line " + lineIndex + " on " + category;
+ return "Delete line " + lineNumber + " on " + category;
}
}
Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/command/ModifyFieldCommand.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/command/ModifyFieldCommand.java 2010-10-29 12:00:49 UTC (rev 130)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/command/ModifyFieldCommand.java 2010-10-29 14:17:52 UTC (rev 131)
@@ -25,14 +25,23 @@
package fr.ifremer.coser.command;
+import static org.nuiton.i18n.I18n._;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.Iterator;
+
+import org.apache.commons.beanutils.PropertyUtils;
+
import fr.ifremer.coser.CoserBusinessException;
import fr.ifremer.coser.CoserConstants.Category;
import fr.ifremer.coser.bean.AbstractDataContainer;
import fr.ifremer.coser.bean.Project;
+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.storage.DataStorage;
/**
* Command pattern object.
@@ -49,10 +58,10 @@
protected Category category;
/** Line index of object to do command to. */
- protected int line;
+ protected String lineNumber;
/** Field index to to command. */
- protected int fieldIndex;
+ protected String fieldName;
/** Field actual value. */
protected Object currentValue;
@@ -68,20 +77,20 @@
this.category = category;
}
- public int getLine() {
- return line;
+ public String getLineNumber() {
+ return lineNumber;
}
- public void setLine(int line) {
- this.line = line;
+ public void setLineNumber(String lineNumber) {
+ this.lineNumber = lineNumber;
}
- public int getFieldIndex() {
- return fieldIndex;
+ public String getFieldName() {
+ return fieldName;
}
- public void setFieldIndex(int fieldIndex) {
- this.fieldIndex = fieldIndex;
+ public void setFieldName(String fieldName) {
+ this.fieldName = fieldName;
}
public Object getCurrentValue() {
@@ -102,32 +111,102 @@
@Override
public void doCommand(Project project, AbstractDataContainer container) throws CoserBusinessException {
-
+
+ AbstractDataEntity beanData = null;
+ DataStorage dataStorage = null;
+ switch (category) {
+ case CATCH:
+ beanData = new Catch();
+ dataStorage = container.getCatch();
+ break;
+ case HAUL:
+ beanData = new Haul();
+ dataStorage = container.getHaul();
+ break;
+ case LENGTH:
+ beanData = new Length();
+ dataStorage = container.getLength();
+ break;
+ case STRATA:
+ beanData = new Strata();
+ dataStorage = container.getStrata();
+ break;
+ }
+
+ Iterator<String[]> itData = dataStorage.iterator();
+ itData.next(); // header
+ while (itData.hasNext()) {
+ String[] data = itData.next();
+ String dataLineNumber = data[AbstractDataEntity.INDEX_LINE];
+
+ if (dataLineNumber.equals(lineNumber)) {
+ beanData.setData(data);
+ try {
+ String dataValue = (String)PropertyUtils.getProperty(beanData, fieldName);
+ if (dataValue.equals(currentValue)) {
+ PropertyUtils.setProperty(beanData, fieldName, newValue);
+ }
+ else {
+ throw new CoserBusinessException(_("Can't replace data value. Expected %s but was %s", currentValue, dataValue));
+ }
+ break;
+ } catch (Exception ex) {
+ throw new CoserBusinessException("Can't replace data field value", ex);
+ }
+ }
+ }
}
@Override
public void undoCommand(Project project, AbstractDataContainer container) throws CoserBusinessException {
-
- }
-
- @Override
- public String toString() {
- String toString = "Modify field ";
+ AbstractDataEntity beanData = null;
+ DataStorage dataStorage = null;
switch (category) {
case CATCH:
- toString += Catch.EN_HEADERS[fieldIndex];
+ beanData = new Catch();
+ dataStorage = container.getCatch();
break;
case HAUL:
- toString += Haul.EN_HEADERS[fieldIndex];
+ beanData = new Haul();
+ dataStorage = container.getHaul();
break;
case LENGTH:
- toString += Length.EN_HEADERS[fieldIndex];
+ beanData = new Length();
+ dataStorage = container.getLength();
break;
case STRATA:
- toString += Strata.EN_HEADERS[fieldIndex];
+ beanData = new Strata();
+ dataStorage = container.getStrata();
break;
}
- toString += " on line " + line;
+
+ Iterator<String[]> itData = dataStorage.iterator();
+ itData.next(); // header
+ while (itData.hasNext()) {
+ String[] data = itData.next();
+ String dataLineNumber = data[AbstractDataEntity.INDEX_LINE];
+
+ if (dataLineNumber.equals(lineNumber)) {
+ beanData.setData(data);
+ try {
+ String dataValue = (String)PropertyUtils.getProperty(beanData, fieldName);
+ if (dataValue.equals(newValue)) {
+ PropertyUtils.setProperty(data, fieldName, currentValue);
+ }
+ else {
+ throw new CoserBusinessException(_("Can't replace data value. Expected %s but was %s", newValue, dataValue));
+ }
+ break;
+ } catch (Exception ex) {
+ throw new CoserBusinessException("Can't replace data field value", ex);
+ }
+ }
+ }
+ }
+
+ @Override
+ public String toString() {
+ String toString = "Modify field " + fieldName + " on line " + lineNumber;
return toString;
}
}
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-10-29 12:00:49 UTC (rev 130)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/services/ProjectService.java 2010-10-29 14:17:52 UTC (rev 131)
@@ -39,6 +39,7 @@
import java.util.TreeMap;
import java.util.TreeSet;
+import org.apache.commons.beanutils.PropertyUtils;
import org.apache.commons.io.FileUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -55,8 +56,12 @@
import fr.ifremer.coser.command.Command;
import fr.ifremer.coser.command.DeleteLineCommand;
import fr.ifremer.coser.command.MergeSpeciesCommand;
+import fr.ifremer.coser.command.ModifyFieldCommand;
+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.storage.DataStorage;
/**
@@ -660,11 +665,72 @@
// create new delete action
DeleteLineCommand command = new DeleteLineCommand();
command.setCategory(category);
- command.setLineIndex(index);
+ command.setLineNumber(index);
commandService.doAction(command, project, control);
}
/**
+ * Replace une valeur d'un champs si nécéssaire.
+ *
+ * If {@code currentValue} is not equals to current data value for fieldName,
+ * no replacement is performed.
+ *
+ * @param project project
+ * @param category category
+ * @param fieldName fieldName
+ * @param currentValue current value
+ * @param data current data
+ * @param newValue new value
+ * @param commandUUID commandUUID
+ * @return modified data
+ * @throws CoserBusinessException
+ */
+ public String[] replaceFieldValue(Project project, Category category, String fieldName,
+ String currentValue, String newValue, String[] data, String commandUUID) throws CoserBusinessException {
+
+ AbstractDataEntity beanData = null;
+
+ switch (category) {
+ case CATCH:
+ beanData = new Catch();
+ break;
+ case HAUL:
+ beanData = new Haul();
+ break;
+ case LENGTH:
+ beanData = new Length();
+ break;
+ case STRATA:
+ beanData = new Strata();
+ break;
+ }
+
+ beanData.setData(data);
+
+ // get current data value
+ try {
+ String value = (String)PropertyUtils.getProperty(beanData, fieldName);
+
+ if (value.equals(currentValue)) {
+ String lineNumber = data[AbstractDataEntity.INDEX_LINE];
+ ModifyFieldCommand command = new ModifyFieldCommand();
+ command.setCommandUUID(commandUUID);
+ command.setFieldName(fieldName);
+ command.setLineNumber(lineNumber);
+ command.setCurrentValue(currentValue);
+ command.setNewValue(newValue);
+ command.setCategory(category);
+
+ commandService.doAction(command, project, project.getControl());
+ }
+ } catch (Exception ex) {
+ throw new CoserBusinessException("Can't replace inner field value", ex);
+ }
+
+ return beanData.getData();
+ }
+
+ /**
* Get zones name in project with data in [{@code beginYear}-{@code endYear}].
*
* Used in selection ui.
Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/services/ValidationService.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/services/ValidationService.java 2010-10-29 12:00:49 UTC (rev 130)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/services/ValidationService.java 2010-10-29 14:17:52 UTC (rev 131)
@@ -533,7 +533,7 @@
ValidationError error = new ValidationError();
error.setLevel(ValidationLevel.WARNING);
error.setLineNumber(lineNumber);
- error.setMessage(_("coser.business.control.error.minObservationCount", key));
+ error.setMessage(_("coser.business.control.error.minObservationCount", key, value));
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-10-29 12:00:49 UTC (rev 130)
+++ trunk/coser-business/src/main/resources/i18n/coser-business-en_GB.properties 2010-10-29 14:17:52 UTC (rev 131)
@@ -3,6 +3,7 @@
Can't\ find\ line\ %s\ for\ deletion=
Can't\ find\ line\ %s\ for\ undeletion=
Can't\ read\ file\ '%s'.\ Check\ CSV\ file\ separator\ (%c)=
+Can't\ replace\ data\ value.\ Expected\ %s\ but\ was\ %s=
Depth\ attribute\ is\ not\ a\ valid\ double=
Maturity\ attribute\ is\ required=
Missing\ file\ %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-10-29 12:00:49 UTC (rev 130)
+++ trunk/coser-business/src/main/resources/i18n/coser-business-fr_FR.properties 2010-10-29 14:17:52 UTC (rev 131)
@@ -3,6 +3,7 @@
Can't\ find\ line\ %s\ for\ deletion=
Can't\ find\ line\ %s\ for\ undeletion=
Can't\ read\ file\ '%s'.\ Check\ CSV\ file\ separator\ (%c)=Impossible de lire le fichier '%s'.\nMerci de v\u00E9rifier le s\u00E9parateur utilis\u00E9 (%c).
+Can't\ replace\ data\ value.\ Expected\ %s\ but\ was\ %s=
Depth\ attribute\ is\ not\ a\ valid\ double=
Maturity\ attribute\ is\ required=
Missing\ file\ %s=Fichier manquant \: %s
Modified: trunk/coser-business/src/test/java/fr/ifremer/coser/services/CommandServiceTest.java
===================================================================
--- trunk/coser-business/src/test/java/fr/ifremer/coser/services/CommandServiceTest.java 2010-10-29 12:00:49 UTC (rev 130)
+++ trunk/coser-business/src/test/java/fr/ifremer/coser/services/CommandServiceTest.java 2010-10-29 14:17:52 UTC (rev 131)
@@ -67,7 +67,7 @@
Assert.assertEquals(30, project.getControl().getLength().size());
DeleteLineCommand command = new DeleteLineCommand();
- command.setLineIndex("2");
+ command.setLineNumber("2");
command.setCategory(Category.LENGTH);
commandService.doAction(command, project, project.getControl());
@@ -83,7 +83,7 @@
public void testDeleteLineWrong() throws CoserBusinessException {
Project project = createTestProject(projectService);
DeleteLineCommand command = new DeleteLineCommand();
- command.setLineIndex("2");
+ command.setLineNumber("2");
command.setCategory(Category.LENGTH);
commandService.doAction(command, project, project.getControl());
commandService.doAction(command, project, project.getControl());
@@ -101,7 +101,7 @@
Assert.assertEquals("3", project.getControl().getLength().get(4)[Length.INDEX_LINE]);
DeleteLineCommand command = new DeleteLineCommand();
- command.setLineIndex("3");
+ command.setLineNumber("3");
command.setCategory(Category.LENGTH);
commandService.doAction(command, project, project.getControl());
Modified: trunk/coser-business/src/test/java/fr/ifremer/coser/services/CoserTestAbstract.java
===================================================================
--- trunk/coser-business/src/test/java/fr/ifremer/coser/services/CoserTestAbstract.java 2010-10-29 12:00:49 UTC (rev 130)
+++ trunk/coser-business/src/test/java/fr/ifremer/coser/services/CoserTestAbstract.java 2010-10-29 14:17:52 UTC (rev 131)
@@ -28,6 +28,7 @@
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
+import java.util.Locale;
import java.util.Map;
import org.apache.commons.io.FileUtils;
@@ -35,6 +36,7 @@
import org.apache.commons.logging.LogFactory;
import org.junit.AfterClass;
import org.junit.BeforeClass;
+import org.nuiton.i18n.I18n;
import fr.ifremer.coser.CoserBusinessConfig;
import fr.ifremer.coser.CoserBusinessException;
@@ -67,6 +69,8 @@
}
config = new CoserBusinessConfig();
config.setDatabaseDirectory(testDirectory.getAbsolutePath());
+
+ I18n.init(Locale.UK);
}
@AfterClass
Modified: trunk/coser-business/src/test/java/fr/ifremer/coser/services/ValidationServiceTest.java
===================================================================
--- trunk/coser-business/src/test/java/fr/ifremer/coser/services/ValidationServiceTest.java 2010-10-29 12:00:49 UTC (rev 130)
+++ trunk/coser-business/src/test/java/fr/ifremer/coser/services/ValidationServiceTest.java 2010-10-29 14:17:52 UTC (rev 131)
@@ -114,6 +114,6 @@
if (log.isDebugEnabled()) {
log.debug("Validation errors = " + errors);
}
- Assert.assertEquals(1, errors.size());
+ Assert.assertEquals(2, errors.size());
}
}
Modified: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/ControlFindReplaceDialog.jaxx
===================================================================
--- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/ControlFindReplaceDialog.jaxx 2010-10-29 12:00:49 UTC (rev 130)
+++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/ControlFindReplaceDialog.jaxx 2010-10-29 14:17:52 UTC (rev 131)
@@ -24,9 +24,18 @@
-->
<JDialog title="coser.ui.control.replace.title" modal="true">
<ControlHandler id="handler" javaBean="null" />
+ <Integer id="columnIndex" javaBean="-1" />
<Table>
<row>
<cell fill="horizontal">
+ <JLabel text="coser.ui.control.replace.inField" />
+ </cell>
+ <cell weightx="1" fill="horizontal">
+ <JLabel id="replaceFieldNameLabel" />
+ </cell>
+ </row>
+ <row>
+ <cell fill="horizontal">
<JLabel text="coser.ui.control.replace.find" />
</cell>
<cell weightx="1" fill="horizontal">
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-10-29 12:00:49 UTC (rev 130)
+++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/ControlHandler.java 2010-10-29 14:17:52 UTC (rev 131)
@@ -32,8 +32,10 @@
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
+import java.beans.Introspector;
import java.util.Iterator;
import java.util.List;
+import java.util.UUID;
import javax.swing.JLabel;
import javax.swing.JMenuItem;
@@ -48,11 +50,11 @@
import javax.swing.event.DocumentListener;
import javax.swing.event.ListSelectionEvent;
+import jaxx.runtime.JAXXUtil;
import jaxx.runtime.SwingUtil;
import jaxx.runtime.validator.swing.SwingValidator;
-import org.apache.commons.beanutils.BeanUtils;
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.beanutils.PropertyUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jfree.chart.ChartPanel;
@@ -100,31 +102,37 @@
/**
* Affiche le menu contextuel de la table qui contient les données.
*
- * @param view view
+ * @param controlView view
* @param event mouse event
*/
- public void showDataTableContextMenu(final ControlView view, MouseEvent event) {
+ public void showDataTableContextMenu(final ControlView controlView, MouseEvent event) {
// clic contextuel
if (event.getButton() == MouseEvent.BUTTON3) {
- int[] dataSelectedRows = view.getControlDataTable().getSelectedRows();
- int columnIndex = view.getControlDataTable().getColumnModel().getColumnIndexAtX(event.getX());
+ int[] dataSelectedRows = controlView.getControlDataTable().getSelectedRows();
+ final int columnIndex = controlView.getControlDataTable().getColumnModel().getColumnIndexAtX(event.getX());
// plusieurs lignes selectionnées et pas la premiere colonne (Line index)
if (dataSelectedRows.length > 0 && columnIndex > 0) {
- String columnName = view.getControlDataTable().getColumnName(columnIndex);
+ ControlDataTableModel controlDataModel = controlView.getControlDataTableModel();
+ final String columnName = controlView.getControlDataTable().getColumnName(columnIndex);
+ final String firstValue = (String)controlDataModel.getValueAt(dataSelectedRows[0], columnIndex);
JPopupMenu popupMenu = new JPopupMenu(_("coser.ui.control.dataMenuLabel"));
JMenuItem replaceMenu = new JMenuItem(_("coser.ui.control.dataMenuReplace", columnName));
replaceMenu.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
- ControlFindReplaceDialog viewDialog = new ControlFindReplaceDialog(view);
- viewDialog.setLocationRelativeTo(view);
+ ControlFindReplaceDialog viewDialog = new ControlFindReplaceDialog(controlView);
+ viewDialog.setHandler(ControlHandler.this);
+ viewDialog.setColumnIndex(columnIndex);
+ viewDialog.getReplaceFieldNameLabel().setText(columnName);
+ viewDialog.getReplaceFindField().setText(firstValue);
+ viewDialog.setLocationRelativeTo(controlView);
viewDialog.setVisible(true);
}
});
popupMenu.add(replaceMenu);
- popupMenu.show(view.getControlDataTable(), event.getX(), event.getY());
+ popupMenu.show(controlView.getControlDataTable(), event.getX(), event.getY());
}
}
}
@@ -132,14 +140,76 @@
/**
* Perform find and replace.
*
- * @param view parent view
+ * @param replaceView view
*/
- public void performFindAndReplace(ControlFindReplaceDialog view) {
- String find = view.getReplaceFindField().getText();
- String replace = view.getReplaceReplaceField().getText();
+ public void performFindAndReplace(ControlFindReplaceDialog replaceView) {
+
+ ControlView controlView = replaceView.getContextValue(ControlView.class, JAXXUtil.PARENT);
+ Category category = (Category)controlView.getCategoryComboBox().getSelectedItem();
+ ControlDataTableModel controlDataModel = controlView.getControlDataTableModel();
+ ProjectService projectService = replaceView.getContextValue(ProjectService.class);
+ Project project = replaceView.getContextValue(Project.class);
+
+ // find en field name
+ String[] enHeaders = null;
+ switch (category) {
+ case CATCH:
+ enHeaders = Catch.EN_HEADERS;
+ break;
+ case HAUL:
+ enHeaders = Haul.EN_HEADERS;
+ break;
+ case LENGTH:
+ enHeaders = Length.EN_HEADERS;
+ break;
+ case STRATA:
+ enHeaders = Strata.EN_HEADERS;
+ break;
+ }
+
+ // -1 because table model contains line number
+ String field = enHeaders[replaceView.getColumnIndex() - 1];
+ field = Introspector.decapitalize(field);
+ String find = replaceView.getReplaceFindField().getText();
+ String replace = replaceView.getReplaceReplaceField().getText();
if (log.isWarnEnabled()) {
log.warn("Perform : " + find + " replace with " + replace);
}
+
+ String commandUUID = UUID.randomUUID().toString();
+
+ try {
+ // on suppose que la fenetre est modale, et
+ // que la selection ne peut pas avoir changée
+ int[] dataSelectedRows = controlView.getControlDataTable().getSelectedRows();
+ for (int dataSelectedRow : dataSelectedRows) {
+ String[] data = controlDataModel.getDataAt(dataSelectedRow);
+ data = projectService.replaceFieldValue(project, category, field, find, replace, data, commandUUID);
+ controlDataModel.fireTableRowsUpdated(dataSelectedRow, dataSelectedRow);
+
+ switch (category) {
+ case CATCH:
+ project.getControl().getCatch().set(dataSelectedRow + 1, data); // csv header
+ controlDataModel.fireTableRowsUpdated(dataSelectedRow, dataSelectedRow);
+ break;
+ case HAUL:
+ project.getControl().getHaul().set(dataSelectedRow + 1, data); // csv header
+ controlDataModel.fireTableRowsUpdated(dataSelectedRow, dataSelectedRow);
+ break;
+ case LENGTH:
+ project.getControl().getLength().set(dataSelectedRow + 1, data); // csv header
+ controlDataModel.fireTableRowsUpdated(dataSelectedRow, dataSelectedRow);
+ break;
+ case STRATA:
+ project.getControl().getStrata().set(dataSelectedRow + 1, data); // csv header
+ controlDataModel.fireTableRowsUpdated(dataSelectedRow, dataSelectedRow);
+ break;
+ }
+ }
+ } catch (CoserBusinessException ex) {
+ throw new CoserException("Can't replace field value", ex);
+ }
+ replaceView.dispose();
}
/**
@@ -360,9 +430,9 @@
for (int fieldIndex = 1 ; fieldIndex < header.length ; fieldIndex++) {
String headerValue = header[fieldIndex];
String fieldValue = line[fieldIndex];
-
- final String beanFieldName = StringUtils.uncapitalize(enHeaders[fieldIndex - 1]);
+ final String beanFieldName = Introspector.decapitalize(enHeaders[fieldIndex - 1]);
+
JLabel label = new JLabel(headerValue + "\u2009:");
final JTextField fieldTextField = new JTextField(fieldValue);
fieldTextField.getDocument().addDocumentListener(new DocumentListener() {
@@ -383,7 +453,7 @@
protected void valueChanged(DocumentEvent event) {
try {
- BeanUtils.setProperty(finalBean, beanFieldName, fieldTextField.getText());
+ PropertyUtils.setProperty(finalBean, beanFieldName, fieldTextField.getText());
} catch (Exception ex) {
if (log.isErrorEnabled()) {
log.error("Can't set property value (" + beanFieldName + ")", 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-10-29 12:00:49 UTC (rev 130)
+++ trunk/coser-ui/src/main/resources/i18n/coser-ui-en_GB.properties 2010-10-29 14:17:52 UTC (rev 131)
@@ -23,6 +23,7 @@
coser.ui.control.global.message=Message
coser.ui.control.graphtitle=Graph
coser.ui.control.replace.find=Find \:
+coser.ui.control.replace.inField=In field \:
coser.ui.control.replace.replace=Replace \:
coser.ui.control.replace.title=Find and replace
coser.ui.control.save=Save
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-10-29 12:00:49 UTC (rev 130)
+++ trunk/coser-ui/src/main/resources/i18n/coser-ui-fr_FR.properties 2010-10-29 14:17:52 UTC (rev 131)
@@ -23,6 +23,7 @@
coser.ui.control.global.message=Message
coser.ui.control.graphtitle=Graphique
coser.ui.control.replace.find=Chercher \:
+coser.ui.control.replace.inField=Dans le champ \:
coser.ui.control.replace.replace=Remplacer \:
coser.ui.control.replace.title=Chercher et remplacer
coser.ui.control.save=Sauvegarder
1
0
r130 - in trunk: coser-business/src/main/java/fr/ifremer/coser coser-ui/src/main/java/fr/ifremer/coser/ui coser-ui/src/main/resources/i18n
by chatellier@users.labs.libre-entreprise.org 29 Oct '10
by chatellier@users.labs.libre-entreprise.org 29 Oct '10
29 Oct '10
Author: chatellier
Date: 2010-10-29 12:00:49 +0000 (Fri, 29 Oct 2010)
New Revision: 130
Log:
Add nobsmin in config ui
Modified:
trunk/coser-business/src/main/java/fr/ifremer/coser/CoserBusinessConfig.java
trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/CoserFrameHandler.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/CoserBusinessConfig.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/CoserBusinessConfig.java 2010-10-29 11:42:24 UTC (rev 129)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/CoserBusinessConfig.java 2010-10-29 12:00:49 UTC (rev 130)
@@ -96,7 +96,7 @@
REFERENCE_SPECIES("coser.reference.species", _("coser.config.reference.species.description"), "", String.class, false, false),
REFERENCE_ZONES("coser.reference.zones", _("coser.config.reference.zones.description"), "", String.class, false, false),
- OBSERVATION_NOBSMIN("coser.observation.nobsmin", _("coser.config.observation.nobsmin.description"), "", Double.class, false, false);
+ OBSERVATION_NOBSMIN("coser.observation.nobsmin", _("coser.config.observation.nobsmin.description"), "1.0", Double.class, false, false);
protected String key;
protected String description;
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-10-29 11:42:24 UTC (rev 129)
+++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/CoserFrameHandler.java 2010-10-29 12:00:49 UTC (rev 130)
@@ -140,6 +140,10 @@
modelBuilder.addCategory(_("coser.config.category.main"), _("coser.config.category.main.description"));
modelBuilder.addOption(CoserBusinessConfig.CoserBusinessOption.REFERENCE_SPECIES);
modelBuilder.addOption(CoserBusinessConfig.CoserBusinessOption.REFERENCE_ZONES);
+
+ // category control
+ modelBuilder.addCategory(_("coser.config.category.control"), _("coser.config.category.control.description"));
+ modelBuilder.addOption(CoserBusinessConfig.CoserBusinessOption.OBSERVATION_NOBSMIN);
ConfigUI configUI = modelBuilder.buildUI(view, _("coser.config.category.main"));
JDialog dialogUI = new JDialog(view, _("coser.ui.config.title"));
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-10-29 11:42:24 UTC (rev 129)
+++ trunk/coser-ui/src/main/resources/i18n/coser-ui-en_GB.properties 2010-10-29 12:00:49 UTC (rev 130)
@@ -1,4 +1,6 @@
coser.config.application.version.description=Application's version
+coser.config.category.control=Control
+coser.config.category.control.description=Control
coser.config.category.main=Coser
coser.config.category.main.description=Main configuration
coser.config.config.file.description=Coser configuration file
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-10-29 11:42:24 UTC (rev 129)
+++ trunk/coser-ui/src/main/resources/i18n/coser-ui-fr_FR.properties 2010-10-29 12:00:49 UTC (rev 130)
@@ -1,4 +1,6 @@
coser.config.application.version.description=Version de l'application
+coser.config.category.control=Contr\u00F4le
+coser.config.category.control.description=Contr\u00F4le
coser.config.category.main=Coser
coser.config.category.main.description=Configuration principale
coser.config.config.file.description=Fichier de configuration de Coser
1
0