");
+ m = p.matcher(baseToString);
+ if(m.find()) {
+ debut = baseToString.substring(0,m.end());
+ fin = baseToString.substring(m.end());
+ String codeXMLEvaluation = Run.ecritureNode(evaluation, 0).toString().replace("\t","").replace("\r", "").replace("\n", "").replaceAll(">/{1,}<","><");
+ XMLBase = debut + codeXMLEvaluation + fin;
+ }
+
}
try {
diff --git a/src/baseEvaluations/evaluationExist.java b/src/baseEvaluations/evaluationExist.java
index de9a86c..19185cd 100644
--- a/src/baseEvaluations/evaluationExist.java
+++ b/src/baseEvaluations/evaluationExist.java
@@ -8,13 +8,10 @@ import MEPTL.commandes;
*
*/
public class evaluationExist {
-
-
public static Boolean isEvaluationExist(String date) {
if(commandes.evaluationsBase.retourneFirstNodeByNameAndAttributValueExactStrict("evaluation", "date", date)!=null) {
return true;
}
return false;
- }
-
+ }
}
diff --git a/src/baseEvaluations/recupeNodeBaseEvaluations.java b/src/baseEvaluations/recupeNodeBaseEvaluations.java
index 8dcbc64..50c1bec 100644
--- a/src/baseEvaluations/recupeNodeBaseEvaluations.java
+++ b/src/baseEvaluations/recupeNodeBaseEvaluations.java
@@ -32,6 +32,8 @@ public class recupeNodeBaseEvaluations {
}else {
file = new File(directoryName + "/" + commandes.NameBaseEvaluations);
}
+
+
if(file!=null) {
@@ -49,8 +51,7 @@ public class recupeNodeBaseEvaluations {
node evaluations = new node();
evaluations = evaluations.allFirstNodesEvaluationFichierOnly(targetString.toString().replace("\t","").replace("\r", "").replace("\n", ""));
- //node evaluations = new node(targetString.toString().replace("\t","").replace("\r", "").replace("\n", ""));
-
+
if(evaluations!=null) {
if(evaluations.getNodes().size()>0) {
if(evaluations.getNomElt().equals("evaluations")) {
@@ -91,10 +92,10 @@ public class recupeNodeBaseEvaluations {
while ((line = br.readLine()) != null) {
targetString.append(line);
}
-
node evaluations = new node();
+
evaluations = evaluations.allFirstNodesEvaluationFichierOnly(targetString.toString().replace("\t","").replace("\r", "").replace("\n", ""));
-
+
if(evaluations!=null) {
if(evaluations.getNodes().size()>0) {
if(evaluations.getNomElt().equals("evaluations")) {
@@ -105,7 +106,7 @@ public class recupeNodeBaseEvaluations {
}
}
}
-
+
}catch (Exception e) {
JFrame frame = new JFrame();
JLabel texte = new JLabel("La base de données ne se trouve pas dans le même dossier que celui de l'application.
"
diff --git a/src/evaluer/evaluerLesFichiersEtudiants.java b/src/evaluer/evaluerLesFichiersEtudiants.java
index ebe3a79..9950808 100644
--- a/src/evaluer/evaluerLesFichiersEtudiants.java
+++ b/src/evaluer/evaluerLesFichiersEtudiants.java
@@ -12,7 +12,7 @@ import MEPTL.VerificationHistorique;
import MEPTL.commandes;
import MEPTL.feedbacks;
import MEPTL.meptl;
-import MEPTL.verificationFichierAnalyse;
+import MEPTL.verificationFichierAnalyse_node_commandesSujet;
import cXML.Run;
import cXML.node;
import calcul.calculIntervalleBaremeABCDE;
@@ -287,11 +287,11 @@ public class evaluerLesFichiersEtudiants implements Runnable{
//**************************************
if(commandes.MAJFichierAnalyse||commandes.MAJnameAnalysisFile) {
try {
- verificationFichierAnalyse.MiseAJourFichierAnalyse();
+ verificationFichierAnalyse_node_commandesSujet.MiseAJourFichierAnalyse();
} catch (CloneNotSupportedException | IOException e) {
e.printStackTrace();
}
- verificationFichierAnalyse.messagMiseAJourFichierAnalyseAprèsAnalyse();
+ verificationFichierAnalyse_node_commandesSujet.messagMiseAJourFichierAnalyseAprèsAnalyse();
}
txt.setContentType("text/html");
diff --git a/src/fenetres/ChargeFichierXML.java b/src/fenetres/ChargeFichierXML.java
index 0c70983..cd7621f 100644
--- a/src/fenetres/ChargeFichierXML.java
+++ b/src/fenetres/ChargeFichierXML.java
@@ -19,17 +19,22 @@ import javax.swing.filechooser.FileNameExtensionFilter;
import MEPTL.commandes;
import MEPTL.meptl;
-import MEPTL.verificationFichierAnalyse;
+import MEPTL.verificationFichierAnalyse_node_commandesSujet;
import cXML.node;
-
+/**
+ * Chargement d'un fichier d'analyse
+ * @author pabr6
+ *
+ */
public class ChargeFichierXML extends JFileChooser {
- /**
- *
- */
+
private static final long serialVersionUID = 1L;
-
+ /**
+ * Chragement d'un fichier d'analyse.
+ * Le premier node doit être le node fichier.
+ */
public ChargeFichierXML() {
setDialogTitle("Sélectionner un fichier d'analyse");
@@ -124,7 +129,7 @@ public class ChargeFichierXML extends JFileChooser {
// Rechercher des erreurs dans le fichier d'analyse
System.out.println( "Vérification du fichier d'analyse" );
- new verificationFichierAnalyse();
+ new verificationFichierAnalyse_node_commandesSujet();
}
} catch (UnsupportedEncodingException e1) {
@@ -148,11 +153,6 @@ public class ChargeFichierXML extends JFileChooser {
if(!SujetLoad.getNomElt().equals("fichier")){
System.out.println("Pas de node fichier.");
return false;
- }else {
- if(SujetLoad.getAttributs().get("progression")==null) {
- System.out.println("Pas de node fichier.");
- return false;
- }
}
return true;
}
diff --git a/src/fenetres/ChargePathBaseEvaluation.java b/src/fenetres/ChargePathBaseEvaluation.java
index cf28702..a675d40 100644
--- a/src/fenetres/ChargePathBaseEvaluation.java
+++ b/src/fenetres/ChargePathBaseEvaluation.java
@@ -12,7 +12,11 @@ import javax.swing.filechooser.FileNameExtensionFilter;
import MEPTL.commandes;
import baseEvaluations.recupeNodeBaseEvaluations;
-
+/**
+ *
+ * @author pabr6
+ *
+ */
public class ChargePathBaseEvaluation extends JFileChooser {
/**
@@ -25,8 +29,8 @@ public class ChargePathBaseEvaluation extends JFileChooser {
*
* @param avecFusion : Si True ajoute les évaluations de la seconde base
*/
- public ChargePathBaseEvaluation(boolean avecFusion) {
- this.avecFusion = avecFusion;
+ public ChargePathBaseEvaluation() {
+
setDialogTitle("Sélectionner la base de données des évaluations.");
FileNameExtensionFilter filter = new FileNameExtensionFilter("Base de données des évaluations", "xml");
diff --git a/src/fenetres/baseDonneesEvaluations.java b/src/fenetres/baseDonneesEvaluations.java
index 3f48d44..5044403 100644
--- a/src/fenetres/baseDonneesEvaluations.java
+++ b/src/fenetres/baseDonneesEvaluations.java
@@ -11,6 +11,7 @@ import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.io.File;
import java.io.IOException;
+import java.nio.file.Paths;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -43,6 +44,7 @@ import cXML.node;
import net.lingala.zip4j.exception.ZipException;
import net.miginfocom.swing.MigLayout;
+
public class baseDonneesEvaluations extends JFrame { /**
*
*/
@@ -58,6 +60,7 @@ public class baseDonneesEvaluations extends JFrame { /**
private JButton btnSaveEvaluation = new JButton("Enregistrer l'évaluation
actuelle en mémoire");
private JButton btnRenommeFichierAnalyse = new JButton("Renommer le fichier
d'analyse");
private JButton btnRenommerEvaluation = new JButton("Renommer l'évaluation
sélectionnée");
+ private JButton btndefautBaseEvaluation = new JButton("Base par défaut");
public static boolean isDispose = true;
int indexSelect=0;
ListSelectionModel lsm = null;
@@ -68,18 +71,22 @@ public class baseDonneesEvaluations extends JFrame { /**
private final JTextPane textPane = new JTextPane();
private final JTextPane textPane_1 = new JTextPane();
private final JButton btnExtraireFileAnalysis = new JButton("Extraire le fichier
d'analyse");
- private final JButton btnFusionnerBase = new JButton("Fusionner deux bases
d'évaluation");
+ private final JButton btnFusionnerBase = new JButton("Importer");
private final JButton btnChargerFichierAnalyse = new JButton("Charger un fichier
d'analyse");
private final static JLabel lblCheminVersBase = new JLabel(commandes.PathBaseEvaluations);
- private final JButton btnArchiveBase = new JButton("Archive la base des évaluations ");
+ private final JButton btnArchiveBase = new JButton("Copie de sauvegarde");
public baseDonneesEvaluations() {
super();
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
-
- setBounds(100, 100, 1400, 850);
- int screenWidth = (int) java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds().getWidth();
+ setLocationRelativeTo( null );
+// setBounds(100, 100, 1400, 850);
+// int screenWidth = (int) java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds().getWidth();
+// int screenHeight = (int) java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds().getHeight();
+// setLocation(( (screenWidth) - getWidth()) / 2, (screenHeight - getHeight()) / 2);
+ setSize(1600,900);
+ int screenWidth = (int) java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds().getWidth();
int screenHeight = (int) java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds().getHeight();
setLocation(( (screenWidth) - getWidth()) / 2, (screenHeight - getHeight()) / 2);
@@ -141,44 +148,55 @@ public baseDonneesEvaluations() {
scrollPaneBoutons = new JScrollPane(panelGauche);
getContentPane().add(scrollPaneBoutons, BorderLayout.WEST);
- panelGauche.setLayout(new MigLayout("", "[247px]", "[53px][][][][][][][][30.00][][][][]"));
+ panelGauche.setLayout(new MigLayout("", "[:300px:400px,fill]", "[53px][][][][][][][][][30.00][][][][]"));
+
+ btndefautBaseEvaluation.setHorizontalAlignment(SwingConstants.LEFT);
+ btndefautBaseEvaluation.setForeground(new Color(0, 128, 192));
+ panelGauche.add(btndefautBaseEvaluation, "cell 0 0,grow");
+ btndefautBaseEvaluation.setFont(new Font("Tahoma", Font.BOLD, 16));
+ btndefautBaseEvaluation.setIcon(new ImageIcon(baseDonneesEvaluations.class.getResource("/resources/defautBaseEvaluation.png")));
+
btnChargerNewBase.setHorizontalAlignment(SwingConstants.LEFT);
btnChargerNewBase.setForeground(new Color(0, 128, 192));
- panelGauche.add(btnChargerNewBase, "cell 0 0,growx,aligny top");
+ panelGauche.add(btnChargerNewBase, "cell 0 1,growx,aligny top");
btnChargerNewBase.setFont(new Font("Tahoma", Font.BOLD, 16));
btnChargerNewBase.setIcon(new ImageIcon(baseDonneesEvaluations.class.getResource("/resources/sauvegardehistoriqueevaluation.png")));
btnSaveEvaluation.setHorizontalAlignment(SwingConstants.LEFT);
btnSaveEvaluation.setIcon(new ImageIcon(baseDonneesEvaluations.class.getResource("/resources/saveEvaluation.png")));
- panelGauche.add(btnSaveEvaluation, "flowy,cell 0 1,growx,aligny top");
-
+ panelGauche.add(btnSaveEvaluation, "flowy,cell 0 2,growx,aligny top");
+
btnSaveEvaluation.setForeground(new Color(0, 64, 128));
btnSaveEvaluation.setFont(new Font("Tahoma", Font.BOLD, 16));
+ btnRenommerEvaluation.setToolTipText("Renommer l'évaluation sélectionnée.");
btnRenommerEvaluation.setHorizontalAlignment(SwingConstants.LEFT);
btnRenommerEvaluation.setIcon(new ImageIcon(baseDonneesEvaluations.class.getResource("/resources/renommeEvaluaton.png")));
- panelGauche.add(btnRenommerEvaluation, "cell 0 2,growx,aligny top");
+ panelGauche.add(btnRenommerEvaluation, "cell 0 4,growx,aligny top");
btnRenommerEvaluation.setForeground(new Color(153, 50, 204));
btnRenommerEvaluation.setFont(new Font("Tahoma", Font.BOLD, 16));
+ btnFusionnerBase.setToolTipText("Importer des évaluations dans la base par défaut depuis une autre base.");
btnFusionnerBase.setForeground(new Color(56, 184, 149));
btnFusionnerBase.setHorizontalAlignment(SwingConstants.LEFT);
btnFusionnerBase.setIcon(new ImageIcon(baseDonneesEvaluations.class.getResource("/resources/fusionneBaseEvaluation.png")));
btnFusionnerBase.setFont(new Font("Tahoma", Font.BOLD, 16));
- panelGauche.add(btnFusionnerBase, "cell 0 3,growx,aligny top");
-
+ panelGauche.add(btnFusionnerBase, "cell 0 5,growx,aligny top");
+ btnFusionnerBase.setEnabled(false);
+ btnArchiveBase.setToolTipText("Archiver la base de données pour la sauvegarder et la réutiliser.");
+
btnArchiveBase.setForeground(new Color(128, 128, 192));
btnArchiveBase.setFont(new Font("Tahoma", Font.BOLD, 16));
btnArchiveBase.setHorizontalAlignment(SwingConstants.LEFT);
btnArchiveBase.setIcon(new ImageIcon(baseDonneesEvaluations.class.getResource("/resources/saveZipEvaluation.png")));
- panelGauche.add(btnArchiveBase, "cell 0 4,growx,aligny top");
+ panelGauche.add(btnArchiveBase, "cell 0 6,growx,aligny top");
btnChargerFichierAnalyse.setForeground(new Color(0, 64, 128));
btnChargerFichierAnalyse.setHorizontalAlignment(SwingConstants.LEFT);
btnChargerFichierAnalyse.setIcon(new ImageIcon(baseDonneesEvaluations.class.getResource("/resources/fichierAnalyse.png")));
btnChargerFichierAnalyse.setFont(new Font("Tahoma", Font.BOLD, 16));
- panelGauche.add(btnChargerFichierAnalyse, "cell 0 5,growx,aligny top");
+ panelGauche.add(btnChargerFichierAnalyse, "cell 0 7,growx,aligny top");
btnExtraireFileAnalysis.setHorizontalAlignment(SwingConstants.LEFT);
@@ -186,18 +204,18 @@ public baseDonneesEvaluations() {
btnExtraireFileAnalysis.setForeground(new Color(209, 105, 35));
btnExtraireFileAnalysis.setFont(new Font("Tahoma", Font.BOLD, 16));
- panelGauche.add(btnExtraireFileAnalysis, "cell 0 6,growx,aligny top");
+ panelGauche.add(btnExtraireFileAnalysis, "cell 0 8,growx,aligny top");
btnRenommeFichierAnalyse.setHorizontalAlignment(SwingConstants.LEFT);
btnRenommeFichierAnalyse.setIcon(new ImageIcon(baseDonneesEvaluations.class.getResource("/resources/fichierAnalyseRenomme.png")));
- panelGauche.add(btnRenommeFichierAnalyse, "cell 0 7,growx,aligny top");
+ panelGauche.add(btnRenommeFichierAnalyse, "cell 0 9,growx,aligny top");
btnRenommeFichierAnalyse.setForeground(new Color(255, 140, 0));
btnRenommeFichierAnalyse.setFont(new Font("Tahoma", Font.BOLD, 16));
btnSupprimeEvaluation.setHorizontalAlignment(SwingConstants.LEFT);
btnSupprimeEvaluation.setIcon(new ImageIcon(baseDonneesEvaluations.class.getResource("/resources/removeEvaluaton.png")));
- panelGauche.add(btnSupprimeEvaluation, "cell 0 9,growx,aligny top");
+ panelGauche.add(btnSupprimeEvaluation, "cell 0 11,growx,aligny top");
btnSupprimeEvaluation.setForeground(new Color(255, 0, 0));
btnSupprimeEvaluation.setFont(new Font("Tahoma", Font.BOLD, 16));
@@ -205,7 +223,7 @@ public baseDonneesEvaluations() {
btnFermer.setHorizontalAlignment(SwingConstants.LEFT);
btnFermer.setFont(new Font("Tahoma", Font.BOLD, 16));
- panelGauche.add(btnFermer, "cell 0 10,growx,aligny top");
+ panelGauche.add(btnFermer, "cell 0 12,growx,aligny top");
//*Détection de la ligne sélectionnée
table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
@@ -310,7 +328,8 @@ private void ListenerAction() {
if(lsm!=null) {
if (!lsm.isSelectionEmpty()) {
- node evaluation = commandes.evaluationsBase.getNodes().get(indexSelect).retourneFirstEnfantsByName("fichier");
+ new chargeEvaluationSelected(indexSelect);
+ node evaluation = commandes.evaluationChargeEnMemoire;
String nameFile = evaluation.getAttributs().get("analysis_filename");
JFileChooser fileChooser = new JFileChooser();
@@ -354,15 +373,19 @@ private void ListenerAction() {
btnChargerFichierAnalyse.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
new ChargeFichierXML();
+
+ //Encapsulation du node d'analyse fichier dans un node evaluation.
node evaluation = new node();
evaluation.setNomElt("evaluation");
String name = "Nouvelle évaluation";
+ evaluation.getNodes().add(commandes.sujet);
name = JOptionPane.showInputDialog(null,"Donner un nom à cette évaluation ?",name);
if(name!=null) {
if(!name.isBlank()) {
- new creerNouvelleEvaluation(new node(),name,true);
+ evaluation.getNodes().add(commandes.sujet);
+ new creerNouvelleEvaluation(evaluation,name,false);
new recupeNodeBaseEvaluations();
model.addOrUpdate();
table.setModel(model);
@@ -382,7 +405,7 @@ private void ListenerAction() {
@Override
public void actionPerformed(ActionEvent e) {
- new ChargePathBaseEvaluation(true);
+ new ChargePathBaseEvaluation();
new trierParDateDecroissanteLaBase();
model.addOrUpdate();
table.setModel(model);
@@ -408,7 +431,7 @@ private void ListenerAction() {
*/
btnChargerNewBase.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
- new ChargePathBaseEvaluation(false);
+ new ChargePathBaseEvaluation();
new actOpenBaseEvaluation();
if(commandes.PathBaseEvaluationDefaut) {
lblCheminVersBase.setText(commandes.PathBaseEvaluations);
@@ -420,6 +443,25 @@ private void ListenerAction() {
}
});
+ /**
+ * Charge la base par défaut
+ */
+ btndefautBaseEvaluation.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ commandes.PathBaseEvaluations = Paths.get("").toAbsolutePath().toString();
+ commandes.NameBaseEvaluations = "base_evaluations_analyseWriter.xml";
+ commandes.PathBaseEvaluationDefaut = true;
+ new recupeNodeBaseEvaluations();
+ if(commandes.PathBaseEvaluationDefaut) {
+ lblCheminVersBase.setText(commandes.PathBaseEvaluations);
+ }else {
+ lblCheminVersBase.setText(commandes.PathBaseEvaluations+"/"+commandes.NameBaseEvaluations);
+ }
+ model.addOrUpdate();
+ table = new JTable(model);
+ }
+ });
+
/**
* Chargement d'une évaluation par double click.
*/
@@ -597,13 +639,11 @@ private void ListenerAction() {
nomEvaluation = evaluation.getAttributs().get("name");
}
nomEvaluation = JOptionPane.showInputDialog(null,"Renommer cette évaluation ?",nomEvaluation);
-
if(!nomEvaluation.isBlank()) {
evaluation.getAttributs().put("name",nomEvaluation);
- new recupeNodeBaseEvaluations();
+ new creerNouvelleEvaluation(evaluation);
model.addOrUpdate();
table.setModel(model);
-// table.setRowSelectionInterval(0, 0);
}
}
diff --git a/src/fenetres/chargeBaseAuDemarrage.java b/src/fenetres/chargeBaseAuDemarrage.java
index db8584e..da10017 100644
--- a/src/fenetres/chargeBaseAuDemarrage.java
+++ b/src/fenetres/chargeBaseAuDemarrage.java
@@ -179,7 +179,7 @@ private void ListenerAction() {
*/
btnCheminVersBaseDonnees.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
- new ChargePathBaseEvaluation(false);
+ new ChargePathBaseEvaluation();
new actOpenBaseEvaluation();
label.setText(commandes.PathBaseEvaluations);
model.addOrUpdate();
diff --git a/src/fenetres/evaluate.java b/src/fenetres/evaluate.java
index 06a9ff4..0b028fb 100644
--- a/src/fenetres/evaluate.java
+++ b/src/fenetres/evaluate.java
@@ -32,6 +32,7 @@ import javax.swing.event.ChangeListener;
import javax.swing.filechooser.FileNameExtensionFilter;
import MEPTL.commandes;
import MEPTL.meptl;
+import MEPTL.verificationFichierAnalyse_node_commandesSujet;
import action.actAbout;
import action.actDocumentation;
import action.actExit;
@@ -724,8 +725,8 @@ public class evaluate extends JFrame {
private static void refreshLabel() {
if(!commandes.fichierAnalyseValide) {
System.out.println( "Erreur du fichier d'analyse" );
- if(!MEPTL.verificationFichierAnalyse.messageErreur.toString().isEmpty()) {
- txtpnmessages.setText(MEPTL.verificationFichierAnalyse.messageErreur.toString());
+ if(!verificationFichierAnalyse_node_commandesSujet.messageErreur.toString().isEmpty()) {
+ txtpnmessages.setText(verificationFichierAnalyse_node_commandesSujet.messageErreur.toString());
}
chckbxfichiersEtudiants.setEnabled(false);
chckbxZipfeedback.setEnabled(false);
diff --git a/src/fenetres/mainApp.java b/src/fenetres/mainApp.java
index 1d95adb..cee92ad 100644
--- a/src/fenetres/mainApp.java
+++ b/src/fenetres/mainApp.java
@@ -49,8 +49,11 @@ public class mainApp extends JFrame implements ActionListener{
* Initialize the contents of the frame.
*/
private void initialize() {
-
- new verificationNewVersion();
+ try {
+ new verificationNewVersion();
+ }catch (Exception e) {
+ System.out.println("Pas de connexion internet.");
+ }
frmEvalwriter = new JFrame();
frmEvalwriter.setResizable(false);
diff --git a/src/resources/defautBaseEvaluation.png b/src/resources/defautBaseEvaluation.png
new file mode 100644
index 0000000..34c5aa9
Binary files /dev/null and b/src/resources/defautBaseEvaluation.png differ