Commit 3ed0e774 authored by pfreon's avatar pfreon
Browse files

Minor changes: Comment added when the answer "I don't know" is selected....

Minor changes: Comment added when the answer "I don't know" is selected. Management of the titles of jpg files to exclude forbiden characters like > or <

When the answer "I don't know" is selected the user is informed either on the default action taken or on the fact that answering by Yes or No is compulsory.
parent aa1604d2
......@@ -237,12 +237,18 @@ public class QuestionReponse {
switch (numEnCours) {
case 2: // Suite à réorganisation ordre des questions posées. Modif. 2020.
Global.changement_exploitation = index;
if(Global.changement_exploitation==3)
throw new OnError("It is compulsory to know the answer to this question. \nPlease note that you can answer 'Yes' if \nthe used fishing effort takes into account these changes. \nPlease have a look at the help file using the 'Help (H)' button if necessary.");
break;
case 3: // Suite à réorganisation ordre des questions posées. Modif. 2020.
Global.unite_standardisee = index;
if(Global.unite_standardisee==3)
throw new OnError("It is compulsory to know the answer to this question. \nPlease have a look at the help file using the 'Help (H)' button if necessary.");
break;
case 4:
Global.effet_delais_abundance_negligeable = index;
if(Global.effet_delais_abundance_negligeable==3)
throw new OnError("It is compulsory to know the answer to this question. \nPlease have a look at the help file using the 'Help (H)' button if necessary.");
break;
case 5:
Global.stock_unique = index;
......@@ -258,24 +264,38 @@ public class QuestionReponse {
break;
case 10:
Global.under_and_optimaly = index;
if(Global.under_and_optimaly==3)
throw new OnError("It is compulsory to know the answer to this question. \nPlease have a look at the help file using the 'Help (H)' button if necessary.");
break;
case 11:
Global.statistiques_anormales = index;
if(Global.statistiques_anormales==3)
throw new OnError("It is NOT compulsory to know the answer to this question because next questions \nrelated to graphics presentation should substitute for it. But please have a look \nat the help file using the 'Help (H)' button if necessary before \nconfirming your answer by using the 'Next(N)' button.");
break;
case 12:
Global.unstability = index;
if(Global.unstability==3)
throw new OnError("It is compulsory to know the answer to this question. \nPlease have a look at the help file using the 'Help (H)' button if necessary.");
break;
case 13:
Global.abnormal_points_dist = index;
if(Global.abnormal_points_dist==3)
throw new OnError("It is compulsory to know the answer to this question. \nPlease have a look at the help file using the 'Help (H)' button if necessary.");
break;
case 14:
Global.abnormal_points_scatt = index;
if(Global.abnormal_points_scatt==3)
throw new OnError("It is compulsory to know the answer to this question. \nPlease have a look at the help file using the 'Help (H)' button if necessary.");
break;
case 15:
Global.effort_increasing = index;
if(Global.effort_increasing==3)
throw new OnError("It is NOT compulsory to know the answer to this question except if the answer to it is obvious. \nBut please have a look at the help file using the 'Help (H)' button if necessary \nbefore confirming your answer by using the 'Next(N)' button. \nBy default CLIMPROD will consider that the answer is 'No'");
break;
case 16:
Global.independance = index;
if(Global.independance==3)
throw new OnError("It is NOT compulsory to know the answer to this question except if the answer to it is obvious. \nBut please have a look at the help file using the 'Help (H)' button if necessary \nbefore confirming your answer by using the 'Next(N)' button. \nBy default CLIMPROD will consider that the answer is 'Yes'");
break;
case 17:
Global.nb_classes_exploitees = index;
......@@ -292,22 +312,34 @@ public class QuestionReponse {
Global.recruitment_age = 0; // de la pr�pond�rence
Global.begin_influence_period = 0; //de l'effort ou de l'environement
Global.end_influence_period = 0;
if (index == 1) { index = 2 ;} // Modif 2020 pour faire en sorte que reponse "I don't know" branche sur prépondérance effort sans devoir tout modifier.
else{
if (index == 2) index = 1;
}
Global.effort_preponderant = index;
if (index == 3) {
index = index - 1;
index = 1;
Global.typeModele = index;
throw new OnError("It is NOT compulsory to know the answer to this question except if the answer to it is obvious. \nBut please have a look at the help file using the 'Help (H)' button if necessary \nbefore confirming your answer by using the 'Next(N)' button. \nBy default CLIMPROD will consider that the answer is 'No'");
}
Global.typeModele = index;
break;
case 19:
Global.decreasing_relationship = index;
if(index==3) {
Global.decreasing_relationship = 2;
throw new OnError("It is compulsory to know the answer to this question. \nPlease have a look at the help file using the 'Help (H)' button if necessary.");
}
else Global.decreasing_relationship = index;
break;
case 20: // Vide car traitement identique pour decisions 20 et 69.
case 20: // Vide car traitement identique pour decisions 20 et 68.
case 68:
// Global.relationCPU_E=index;
if (index == 1) {
Global.relationCPU_E = RechercheModele.lineaire;
} else {
}if (index == 2) {
Global.relationCPU_E = RechercheModele.exponentiel;
} if (index == 3) {
index = 2;
throw new OnError("It is NOT compulsory to know the answer to this question except if the answer \nis obvious. By default CLIMPROD will consider that the answer is 'No'. \nBut please have a look at the help file using the 'Help (H)' button \nif necessary before confirming your answer by using the 'Next(N)' button. \nBy default CLIMPROD will consider that the answer is 'No'");
}
break;
case 21:
......@@ -374,15 +406,23 @@ public class QuestionReponse {
if (index == 1) {
Global.relationCPU_V = RechercheModele.lineaire;
}
if(Global.linear_relationship==3)
throw new OnError("It is NOT compulsory to know the answer to this question except if the answer \nis obvious. Please have a look at the help file using the 'Help (H)' button \nif necessary before confirming your answer by using the 'Next(N)' button. \nBy default CLIMPROD will consider that the answer is 'No'");
break;
case 49:
case 60:
Global.monotonic_relationship = index;
if(Global.monotonic_relationship==3){
Global.relationCPU_V = RechercheModele.quadratique;
throw new OnError("It is NOT compulsory to know the answer to this question except if the answer \nis obvious. Please have a look at the help file using the 'Help (H)' button \nif necessary before confirming your answer by using the 'Next(N)' button. \nBy default CLIMPROD will consider that the answer is 'No'");
}
if (index == 1) {
Global.relationCPU_V = RechercheModele.general;
} else {
Global.relationCPU_V = RechercheModele.general; // Modèle puissance
}
if(Global.monotonic_relationship==2){
Global.relationCPU_V = RechercheModele.quadratique;
}
System.out.println("Global.relationCPU_V = " + Global.relationCPU_V);
break;
case 51:
......@@ -427,15 +467,29 @@ public class QuestionReponse {
break;
case 95:
Global.good_results = index;
if(Global.good_results==3)
throw new OnError("It is compulsory to know the answer to this question. \nPlease have a look at the help file using the 'Help (H)' button if necessary.");
break;
case 96:
Global.trend_residuals = index;
if(Global.trend_residuals==3) {
Global.trend_residuals = 2;
throw new OnError("It is compulsory to know the answer to this question. \nPlease have a look at the help file using the 'Help (H)' button if necessary.");
}
break;
case 98:
Global.coeff_determination_instable = index;
if(Global.coeff_determination_instable==3) {
Global.coeff_determination_instable = 2;
throw new OnError("It is compulsory to know the answer to this question. \nPlease have a look at the help file using the 'Help (H)' button if necessary.");
}
break;
case 99:
Global.acceptable_graphs = index;
if(Global.acceptable_graphs==3) {
Global.acceptable_graphs = 2;
throw new OnError("It is compulsory to know the answer to this question. \nPlease have a look at the help file using the 'Help (H)' button if necessary.");
}
break;
}
}catch (Exception e) {
......
......@@ -17,11 +17,13 @@ import java.util.Date;
import java.util.Iterator;
import java.util.Map;
import javax.swing.border.TitledBorder;
public class RapportHtml extends JDialog {
private JFrame parent;
static private String fileSep;
static private String path;
static private String folderName;
public RapportHtml(JFrame parent, String currentFacts) {
super(parent);
this.parent = parent;
......@@ -75,7 +77,7 @@ public class RapportHtml extends JDialog {
cboFile.setEditable(true);
jTextInfo.setBackground(new Color(204, 204, 204));
jTextInfo.setText("If you select an existing directory\nall HTML folder files of \nthis directory will be overwritten.");
jTextInfo.setText("If you select an existing directory\nall HTML folder files of \nthis directory will be overwritten\nalthough this is not always\nreflected in the file date.");
jTextInfo.setFont(new java.awt.Font("Dialog", 2, 12));
this.getContentPane().add(jPan, BorderLayout.CENTER);
......@@ -168,7 +170,7 @@ public class RapportHtml extends JDialog {
}
/**
*Titres des onglets et des fichiers html et of
*Titres des onglets et des fichiers html et effacement fichiers existants
*/
@SuppressWarnings("unchecked")
void cmdOk_actionPerformed(ActionEvent e) {
......@@ -194,14 +196,13 @@ public class RapportHtml extends JDialog {
if (!fPath.exists()) {
fPath.mkdir();
} else {
File[] dd = fPath.listFiles();
File[] dd = fPath.listFiles(); // Liste des 33 fichiers (13 *.html et 20 *.jpg) pré-existant dans répertoire
for (int i = 0; i < dd.length; i++) {
if (listFile.containsKey(dd[i].getName())) {
//System.out.println("Ligne 199 dd.length = " + dd.length + " dd[i] = " + dd[i] +" i = " + i + " listFile.containsKey(dd[i].getName();
dd[i].delete();
}
}
}
int c = chkInclude.length;
Vector vAncre = new Vector();
......@@ -325,7 +326,7 @@ public class RapportHtml extends JDialog {
htmlText[11] = htlmEntete.replace("HREF =\""+htmlFile[11]+"\"","HREF =\""+htmlFile[11]+"\" style=\"font-weight:bold;font-size:16px;color:red;\"") + "\n\n ";
htmlText[11] = htmlText[11] + "<H4> Questions, answers &amp; warning</H4>\n <CENTER>\n";
htmlText[11] = htmlText[11] + makeQuestionsAnswers();
System.out.println("Flag if (bEnable[11])dans RapportHtml.java ligne 328, makeQuestionsAnswers()= " + makeQuestionsAnswers()); // Modif. 2020.
//System.out.println("Flag if (bEnable[11])dans RapportHtml.java ligne 328, makeQuestionsAnswers()= " + makeQuestionsAnswers()); // Modif. 2020.
htmlText[11] = htmlText[11] + "\n </CENTER>\n</BODY>\n</HTML>";
}
if (bEnable[12]) {
......@@ -363,25 +364,18 @@ public class RapportHtml extends JDialog {
MsgDialogBox msg = new MsgDialogBox(0, "Folder successfully saved in the directory\n" + folderPath, 1, this.parent);
choice = 1;
cancel();
}
}
void cmdCancel_actionPerformed(ActionEvent e) {
choice = 2;
cancel();
}
private void makeImage(String titre, Plot p) { // Images graphiques disponibles dans classeur du path; titre = chemin complet addresse et nom fichier
private void makeImage(Plot p) {
String titre = path + fileSep + p.getTitreGraphique() + ".jpg";
ExporterImage expI = new ExporterImage(p.createImage(200, 200), titre);
expI.write();
}
private void makeImage(String titre, Plot p) {
ExporterImage expI = new ExporterImage(p.createImage(450, 450), titre);
expI.write();
//System.out.println("RapportHtml.java ligne 383, titre: " + titre); // titre obtenu dans makeImage
ExporterImage expI = new ExporterImage(p.createImage(450, 450), titre); // 450 x 450 pixels = tous fichiers plots
expI.write(); // Enregistrement fichiers .jpg
}
/*
......@@ -390,7 +384,7 @@ public class RapportHtml extends JDialog {
private String makeQuestionsAnswers(){
String resultHTML = "<ul style='text-align:left;'>";
System.out.println("Flag private String makeQuestionsAnswers() dans RapportHtml.java ligne 393, resultHTML = " + resultHTML); // Modif. 2020
//System.out.println("Flag private String makeQuestionsAnswers() dans RapportHtml.java ligne 393, resultHTML = " + resultHTML); // Modif. 2020
// ugly way to make tings ordered
for (int i = 0; i < 200; i++){
//System.out.println("RapportHtml.java ligne 396; i = " + i + "Global.warningDic.get(i) = " + Global.warningDic.get(i));
......@@ -399,7 +393,7 @@ public class RapportHtml extends JDialog {
resultHTML += Global.questionDic.get(i).replace('²','2')+" ";
resultHTML += "<b style='color:blue;'>"+Global.answerDic.get(i)+"</b>";
if (Global.warningDic.containsKey(i)){
System.out.println("Flag if (Global.warningDic.containsKey(i)) dans RapportHtml.java ligne 400, i = " + i + " Global.warningDic.containsKey(i) = " + Global.warningDic.containsKey(i)); // Modif. 2020
//System.out.println("Flag if (Global.warningDic.containsKey(i)) dans RapportHtml.java ligne 400, i = " + i + " Global.warningDic.containsKey(i) = " + Global.warningDic.containsKey(i)); // Modif. 2020
if (!Global.warningDic.get(i).equals("")){
resultHTML += "<i style='color:red;'> (Warning:"+Global.warningDic.get(i)+")</i>";
}
......@@ -735,14 +729,18 @@ public class RapportHtml extends JDialog {
baliseImage[i][j] = "";
}
}
for (int i = 0; i < nbCase; i++) {
if (p[i] != null){
titre[i] = p[i].getTitreGraphique() + ".jpg";
makeImage(folderpath + fileSep + titre[i], p[i]);
for (int i = 0; i < nbCase; i++) { // Images graphiques
if (p[i] != null){
String titreCorr = p[i].getTitreGraphique();
int cc = titreCorr.length();
if (cc > 75) titreCorr = titreCorr.substring(0,(titreCorr.indexOf("R2")+16)); // In order to cut the part of the title of the R2 jackknife plot showing ">" or "<" in the title of the file.
if (cc > 68 && cc < 75) titreCorr = titreCorr.substring(0,(titreCorr.indexOf("%")+12)); // In order to cut the part of the title of the R2 jackknife plot showing ">" or "<" in the title of the file.
titre[i] = titreCorr + ".jpg"; // Noms fichiers image jpg
System.out.println("RapportHtml.java ligne 770, titre [i]: " + titre[i] + " i = " + i);
makeImage(folderpath + fileSep + titre[i], p[i]);
temp[i] = WriteHtml.getBaliseImage("./" + titre[i], "500", "500", 1);
}
}
}
int k = 0;
for (int i = 0; i < nbLig; i++) {
for (int j = 0; j < nbCol; j++) {
......@@ -759,7 +757,8 @@ public class RapportHtml extends JDialog {
}
private void saveHtmlFile(String[] fileName, String[] htmlCode) throws IOException {
/* INUTILISE. Commentaire 2020
private void saveHtmlFile(String[] fileName, String[] htmlCode) throws IOException {
for (int i = 0; i < fileName.length; i++) {
if (!fileName[i].equals("")) {
PrintWriter out = new PrintWriter(new FileWriter(fileName[i]));
......@@ -767,11 +766,11 @@ public class RapportHtml extends JDialog {
out.close();
}
}
}
}*/
private void saveHtmlFile(String fileName, String htmlCode) throws IOException {
PrintWriter out = new PrintWriter(new FileWriter(fileName));
out.println(htmlCode);
private void saveHtmlFile(String fileName, String htmlCode) throws IOException { // Nom des fichiers .html (tables et graphiques)
PrintWriter out = new PrintWriter(new FileWriter(fileName)); // Enregistrement fichiers .html
out.println(htmlCode); // Enregistrement fichiers .html
out.close();
}
......@@ -789,8 +788,8 @@ public class RapportHtml extends JDialog {
dispose();
}
private String fileSep;
private String path;
// private String fileSep;
// private String path;
private String facts;
private String htmlText = "";
private String[] folderList;
......@@ -802,8 +801,8 @@ public class RapportHtml extends JDialog {
JCheckBox[] chkInclude = new JCheckBox[12];
String[] caption = {"Current known facts", "Data & statistical tables",
"Time plots", "Bivariate plots", "Observed-Fitted & Residual CPUE plots",
"Res f(E) vs V or Res f(V) vs E", "Jackknife plots", "CPUE=f() & Y=() plots",
"MSY & MS-E plots", "Modelization: Detailed results",
"Res f(E) vs V or Res f(V) vs E", "Jackknife plots", "CPUE=f() & Y=f() plots",
"MSY & MSE plots", "Modelization: Detailed results",
"Validation: Detailed results", "Questions, answers & warnings"};
JPanel jPan = new JPanel();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment